summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extensions/inc/extensio.hrc5
-rw-r--r--extensions/source/abpilot/abpfinalpage.cxx4
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx107
-rw-r--r--extensions/source/propctrlr/formmetadata.cxx8
-rw-r--r--extensions/source/propctrlr/formmetadata.hxx31
-rw-r--r--extensions/source/propctrlr/formres.src20
-rw-r--r--extensions/source/propctrlr/formresid.hrc3
-rw-r--r--extensions/source/propctrlr/formstrings.hxx2
-rw-r--r--extensions/source/propctrlr/makefile.mk2
-rw-r--r--extensions/source/propctrlr/propcontroller.cxx19
-rw-r--r--extensions/source/propctrlr/propres.src4
-rw-r--r--extensions/source/propctrlr/propresid.hrc1
-rw-r--r--extensions/source/propctrlr/usercontrol.cxx15
-rw-r--r--extensions/util/hidother.src1
-rw-r--r--forms/qa/integration/forms/DocumentViewHelper.java46
-rw-r--r--forms/qa/integration/forms/FormControlTest.java147
-rw-r--r--forms/source/component/Columns.cxx9
-rw-r--r--forms/source/component/ComboBox.cxx49
-rw-r--r--forms/source/component/ComboBox.hxx2
-rw-r--r--forms/source/component/DatabaseForm.cxx16
-rw-r--r--forms/source/component/Edit.cxx54
-rw-r--r--forms/source/component/Edit.hxx2
-rw-r--r--forms/source/component/FormComponent.cxx131
-rw-r--r--forms/source/component/FormattedField.cxx4
-rw-r--r--forms/source/component/ImageControl.cxx302
-rw-r--r--forms/source/component/ImageControl.hxx20
-rw-r--r--forms/source/component/Pattern.cxx42
-rw-r--r--forms/source/component/Pattern.hxx4
-rw-r--r--forms/source/component/clickableimage.cxx41
-rw-r--r--forms/source/component/clickableimage.hxx2
-rw-r--r--forms/source/component/imgprod.cxx4
-rw-r--r--forms/source/inc/FormComponent.hxx12
-rw-r--r--forms/source/inc/componenttools.hxx4
-rw-r--r--forms/source/inc/frm_strings.hxx1
-rw-r--r--forms/source/inc/property.hrc1
-rw-r--r--forms/source/misc/componenttools.cxx23
-rw-r--r--forms/source/misc/property.cxx1
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaTemplate.java1117
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java3
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java4
-rw-r--r--wizards/com/sun/star/wizards/agenda/CGAgenda.java14
-rw-r--r--wizards/com/sun/star/wizards/agenda/CGTopic.java3
-rw-r--r--wizards/com/sun/star/wizards/agenda/CallWizard.java5
-rw-r--r--wizards/com/sun/star/wizards/agenda/TemplateConsts.java21
-rw-r--r--wizards/com/sun/star/wizards/agenda/TopicsControl.java777
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigGroup.java91
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigNode.java7
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigSet.java231
-rw-r--r--wizards/com/sun/star/wizards/common/Configuration.java305
-rw-r--r--wizards/com/sun/star/wizards/common/DebugHelper.java4
-rw-r--r--wizards/com/sun/star/wizards/common/Desktop.java251
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.java531
-rw-r--r--wizards/com/sun/star/wizards/common/Helper.java297
-rw-r--r--wizards/com/sun/star/wizards/common/Indexable.java31
-rw-r--r--wizards/com/sun/star/wizards/common/InvalidQueryException.java40
-rw-r--r--wizards/com/sun/star/wizards/common/JavaTools.java519
-rw-r--r--wizards/com/sun/star/wizards/common/NoValidPathException.java32
-rw-r--r--wizards/com/sun/star/wizards/common/NumberFormatter.java153
-rw-r--r--wizards/com/sun/star/wizards/common/NumericalHelper.java845
-rw-r--r--wizards/com/sun/star/wizards/common/Properties.java84
-rw-r--r--wizards/com/sun/star/wizards/common/PropertySetHelper.java549
-rw-r--r--wizards/com/sun/star/wizards/common/Renderer.java4
-rw-r--r--wizards/com/sun/star/wizards/common/Resource.java69
-rw-r--r--wizards/com/sun/star/wizards/common/SystemDialog.java215
-rw-r--r--wizards/com/sun/star/wizards/common/TerminateWizardException.java38
-rw-r--r--wizards/com/sun/star/wizards/common/UCB.java32
-rw-r--r--wizards/com/sun/star/wizards/common/XMLHelper.java57
-rw-r--r--wizards/com/sun/star/wizards/common/XMLProvider.java38
-rw-r--r--wizards/com/sun/star/wizards/db/BlindtextCreator.java59
-rw-r--r--wizards/com/sun/star/wizards/db/ColumnPropertySet.java150
-rw-r--r--wizards/com/sun/star/wizards/db/CommandMetaData.java45
-rw-r--r--wizards/com/sun/star/wizards/db/CommandName.java233
-rw-r--r--wizards/com/sun/star/wizards/db/DBMetaData.java932
-rw-r--r--wizards/com/sun/star/wizards/db/FieldColumn.java337
-rw-r--r--wizards/com/sun/star/wizards/db/QueryMetaData.java169
-rw-r--r--wizards/com/sun/star/wizards/db/RecordParser.java203
-rw-r--r--wizards/com/sun/star/wizards/db/RelationController.java164
-rw-r--r--wizards/com/sun/star/wizards/db/SQLQueryComposer.java301
-rw-r--r--wizards/com/sun/star/wizards/db/TableDescriptor.java993
-rw-r--r--wizards/com/sun/star/wizards/db/TypeInspector.java336
-rw-r--r--wizards/com/sun/star/wizards/document/Control.java311
-rw-r--r--wizards/com/sun/star/wizards/document/DatabaseControl.java225
-rw-r--r--wizards/com/sun/star/wizards/document/FormHandler.java391
-rw-r--r--wizards/com/sun/star/wizards/document/GridControl.java64
-rw-r--r--wizards/com/sun/star/wizards/document/OfficeDocument.java263
-rw-r--r--wizards/com/sun/star/wizards/document/Shape.java117
-rw-r--r--wizards/com/sun/star/wizards/document/TimeStampControl.java99
-rw-r--r--wizards/com/sun/star/wizards/fax/CGFax.java35
-rw-r--r--wizards/com/sun/star/wizards/fax/CGFaxWizard.java35
-rw-r--r--wizards/com/sun/star/wizards/fax/CallWizard.java118
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxDocument.java138
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialog.java921
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.java195
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java502
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java78
-rw-r--r--wizards/com/sun/star/wizards/form/CallFormWizard.java96
-rw-r--r--wizards/com/sun/star/wizards/form/DataEntrySetter.java102
-rw-r--r--wizards/com/sun/star/wizards/form/FieldLinker.java220
-rw-r--r--wizards/com/sun/star/wizards/form/Finalizer.java86
-rw-r--r--wizards/com/sun/star/wizards/form/FormConfiguration.java132
-rw-r--r--wizards/com/sun/star/wizards/form/FormControlArranger.java530
-rw-r--r--wizards/com/sun/star/wizards/form/FormDocument.java433
-rw-r--r--wizards/com/sun/star/wizards/form/FormWizard.java354
-rw-r--r--wizards/com/sun/star/wizards/form/StyleApplier.java406
-rw-r--r--wizards/com/sun/star/wizards/form/UIControlArranger.java227
-rw-r--r--wizards/com/sun/star/wizards/form/XCallFormWizard.java15
-rw-r--r--wizards/com/sun/star/wizards/letter/CGLetter.java35
-rw-r--r--wizards/com/sun/star/wizards/letter/CGLetterWizard.java35
-rw-r--r--wizards/com/sun/star/wizards/letter/CGPaperElementLocation.java35
-rw-r--r--wizards/com/sun/star/wizards/letter/CallWizard.java118
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterDocument.java196
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialog.java1344
-rwxr-xr-xwizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java36
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java36
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java948
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java67
-rw-r--r--wizards/com/sun/star/wizards/letter/LocaleCodes.java54
-rw-r--r--wizards/com/sun/star/wizards/query/CallQueryWizard.java90
-rw-r--r--wizards/com/sun/star/wizards/query/Finalizer.java144
-rw-r--r--wizards/com/sun/star/wizards/query/QuerySummary.java165
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java329
-rw-r--r--wizards/com/sun/star/wizards/query/XCallQueryWizard.java43
-rw-r--r--wizards/com/sun/star/wizards/report/CallReportWizard.java174
-rw-r--r--wizards/com/sun/star/wizards/report/DBColumn.java599
-rw-r--r--wizards/com/sun/star/wizards/report/Dataimport.java198
-rw-r--r--wizards/com/sun/star/wizards/report/GroupFieldHandler.java215
-rwxr-xr-xwizards/com/sun/star/wizards/report/IReportBuilderLayouter.java9
-rwxr-xr-xwizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java7
-rw-r--r--wizards/com/sun/star/wizards/report/IReportDocument.java35
-rw-r--r--wizards/com/sun/star/wizards/report/RecordTable.java68
-rw-r--r--wizards/com/sun/star/wizards/report/ReportFinalizer.java298
-rw-r--r--wizards/com/sun/star/wizards/report/ReportImplementationHelper.java6
-rw-r--r--wizards/com/sun/star/wizards/report/ReportLayouter.java328
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextDocument.java1030
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextImplementation.java525
-rw-r--r--wizards/com/sun/star/wizards/report/ReportWizard.java893
-rw-r--r--wizards/com/sun/star/wizards/report/XCallReportWizard.java12
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java188
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java10
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java4
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java12
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java49
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java9
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java9
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java309
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java4
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java12
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java10
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java10
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java13
-rw-r--r--wizards/com/sun/star/wizards/table/CGCategory.java58
-rw-r--r--wizards/com/sun/star/wizards/table/CGTable.java80
-rw-r--r--wizards/com/sun/star/wizards/table/CallTableWizard.java91
-rw-r--r--wizards/com/sun/star/wizards/table/FieldDescription.java124
-rw-r--r--wizards/com/sun/star/wizards/table/FieldFormatter.java268
-rw-r--r--wizards/com/sun/star/wizards/table/Finalizer.java265
-rw-r--r--wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java345
-rw-r--r--wizards/com/sun/star/wizards/table/ScenarioSelector.java278
-rw-r--r--wizards/com/sun/star/wizards/table/TableWizard.java300
-rw-r--r--wizards/com/sun/star/wizards/table/XCallTableWizard.java43
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.java183
-rw-r--r--wizards/com/sun/star/wizards/text/TextFieldHandler.java167
-rw-r--r--wizards/com/sun/star/wizards/text/TextFrameHandler.java41
-rw-r--r--wizards/com/sun/star/wizards/text/TextSectionHandler.java227
-rw-r--r--wizards/com/sun/star/wizards/text/TextStyleHandler.java65
-rw-r--r--wizards/com/sun/star/wizards/text/TextTableHandler.java202
-rw-r--r--wizards/com/sun/star/wizards/text/ViewHandler.java39
-rw-r--r--wizards/com/sun/star/wizards/ui/AggregateComponent.java582
-rw-r--r--wizards/com/sun/star/wizards/ui/CommandFieldSelection.java329
-rw-r--r--wizards/com/sun/star/wizards/ui/ControlScroller.java282
-rw-r--r--wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java82
-rw-r--r--wizards/com/sun/star/wizards/ui/DocumentPreview.java87
-rw-r--r--wizards/com/sun/star/wizards/ui/FieldSelection.java330
-rw-r--r--wizards/com/sun/star/wizards/ui/FilterComponent.java828
-rw-r--r--wizards/com/sun/star/wizards/ui/ImageList.java620
-rwxr-xr-xwizards/com/sun/star/wizards/ui/PathSelection.java144
-rw-r--r--wizards/com/sun/star/wizards/ui/PeerConfig.java143
-rw-r--r--wizards/com/sun/star/wizards/ui/SortingComponent.java199
-rw-r--r--wizards/com/sun/star/wizards/ui/TitlesComponent.java145
-rw-r--r--wizards/com/sun/star/wizards/ui/UIConsts.java20
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog.java619
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog2.java213
-rw-r--r--wizards/com/sun/star/wizards/ui/WizardDialog.java447
-rw-r--r--wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java36
-rw-r--r--wizards/com/sun/star/wizards/ui/XCompletion.java6
-rw-r--r--wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java40
-rwxr-xr-xwizards/com/sun/star/wizards/ui/XPathSelectionListener.java35
-rw-r--r--wizards/com/sun/star/wizards/ui/event/AbstractListener.java51
-rw-r--r--wizards/com/sun/star/wizards/ui/event/CommonListener.java58
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAwareFields.java316
-rw-r--r--wizards/com/sun/star/wizards/ui/event/EventNames.java27
-rw-r--r--wizards/com/sun/star/wizards/ui/event/ListModelBinder.java117
-rw-r--r--wizards/com/sun/star/wizards/ui/event/MethodInvocation.java44
-rw-r--r--wizards/com/sun/star/wizards/ui/event/RadioDataAware.java41
-rw-r--r--wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java46
-rw-r--r--wizards/com/sun/star/wizards/ui/event/Task.java123
-rw-r--r--wizards/com/sun/star/wizards/ui/event/TaskEvent.java16
-rw-r--r--wizards/com/sun/star/wizards/ui/event/TaskListener.java7
-rw-r--r--wizards/com/sun/star/wizards/ui/event/UnoDataAware.java164
-rw-r--r--wizards/com/sun/star/wizards/web/AbstractErrorHandler.java140
-rw-r--r--wizards/com/sun/star/wizards/web/BackgroundsDialog.java237
-rw-r--r--wizards/com/sun/star/wizards/web/CallWizard.java126
-rw-r--r--wizards/com/sun/star/wizards/web/ErrorHandler.java175
-rw-r--r--wizards/com/sun/star/wizards/web/ExtensionVerifier.java17
-rw-r--r--wizards/com/sun/star/wizards/web/FTPDialog.java347
-rw-r--r--wizards/com/sun/star/wizards/web/FTPDialogResources.java122
-rw-r--r--wizards/com/sun/star/wizards/web/IconsDialog.java122
-rw-r--r--wizards/com/sun/star/wizards/web/ImageListDialog.java364
-rw-r--r--wizards/com/sun/star/wizards/web/LogTaskListener.java67
-rw-r--r--wizards/com/sun/star/wizards/web/Process.java438
-rw-r--r--wizards/com/sun/star/wizards/web/ProcessErrorHandler.java41
-rw-r--r--wizards/com/sun/star/wizards/web/ProcessErrors.java8
-rw-r--r--wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java35
-rw-r--r--wizards/com/sun/star/wizards/web/StatusDialog.java177
-rw-r--r--wizards/com/sun/star/wizards/web/StylePreview.java57
-rw-r--r--wizards/com/sun/star/wizards/web/TOCPreview.java28
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_Events.java798
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_General.java251
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_Startup.java394
-rw-r--r--wizards/com/sun/star/wizards/web/WWHID.java336
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizard.java50
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizardConst.java123
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizardDialog.java1497
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizardDialogResources.java337
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGArgument.java7
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGContent.java54
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGDesign.java100
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGDocument.java369
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGExporter.java47
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGFilter.java11
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java58
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGIconSet.java7
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGImage.java38
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGLayout.java40
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGPublish.java36
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGSession.java72
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGSessionName.java12
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGSettings.java200
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGStyle.java30
-rw-r--r--wizards/com/sun/star/wizards/web/data/ConfigSetItem.java44
-rw-r--r--wizards/com/sun/star/wizards/web/data/TypeDetection.java63
-rw-r--r--wizards/com/sun/star/wizards/web/export/AbstractExporter.java150
-rw-r--r--wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java85
-rw-r--r--wizards/com/sun/star/wizards/web/export/CopyExporter.java55
-rw-r--r--wizards/com/sun/star/wizards/web/export/Exporter.java10
-rw-r--r--wizards/com/sun/star/wizards/web/export/FilterExporter.java37
-rw-r--r--wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java42
-rw-r--r--wizards/com/sun/star/wizards/web/status/ErrorLog.java50
-rw-r--r--wizards/com/sun/star/wizards/web/status/ErrorReporter.java37
-rw-r--r--wizards/com/sun/star/wizards/web/status/LogTaskListener.java61
-rw-r--r--wizards/com/sun/star/wizards/web/status/Task.java141
-rw-r--r--wizards/com/sun/star/wizards/web/status/TaskEvent.java44
-rw-r--r--wizards/com/sun/star/wizards/web/status/TaskListener.java35
253 files changed, 27049 insertions, 16378 deletions
diff --git a/extensions/inc/extensio.hrc b/extensions/inc/extensio.hrc
index 1e9c94b29929..96b8a6b08a5b 100644
--- a/extensions/inc/extensio.hrc
+++ b/extensions/inc/extensio.hrc
@@ -157,7 +157,7 @@
//-----------------------------------------------------------------------
// FREE
- // FREE
+#define HID_PROP_INPUT_REQUIRED (HID_FORMS_START + 1)
#define HID_PROP_GROUPBOX (HID_FORMS_START + 2)
#define HID_PROP_CONTROLSOURCE (HID_FORMS_START + 3)
#define HID_PROP_NAME (HID_FORMS_START + 4)
@@ -181,7 +181,8 @@
#define HID_PROP_LOCKED (HID_FORMS_START + 22)
#define HID_PROP_FORMATKEY (HID_FORMS_START + 23)
#define HID_PROP_REQUIRED (HID_FORMS_START + 24)
-#define HID_PROP_SCALE (HID_FORMS_START + 25)
+ // FREE
+ // FREE
#define HID_PROP_UNIQUE (HID_FORMS_START + 27)
#define HID_PROP_CLASSID (HID_FORMS_START + 28)
#define HID_PROP_LEFT (HID_FORMS_START + 29)
diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx
index 19f6c5e262f7..ac6c01693c2d 100644
--- a/extensions/source/abpilot/abpfinalpage.cxx
+++ b/extensions/source/abpilot/abpfinalpage.cxx
@@ -149,7 +149,9 @@ namespace abp
if (!AddressBookSourcePage::commitPage(_eReason))
return sal_False;
- if ( !m_aLocationController.prepareCommit() )
+ if ( ( eTravelBackward != _eReason )
+ && ( !m_aLocationController.prepareCommit() )
+ )
return sal_False;
AddressSettings& rSettings = getSettings();
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index f634c7bfa05c..d67d27ca34cd 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -80,6 +80,7 @@
#include <com/sun/star/inspection/PropertyLineElement.hpp>
#include <com/sun/star/resource/XStringResourceManager.hpp>
#include <com/sun/star/resource/MissingResourceException.hpp>
+#include <com/sun/star/graphic/GraphicObject.hpp>
/** === end UNO includes === **/
#include <connectivity/dbexception.hxx>
#include <vcl/wrkwin.hxx>
@@ -116,6 +117,7 @@
#include <limits>
+#define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
//------------------------------------------------------------------------
extern "C" void SAL_CALL createRegistryInfo_FormComponentPropertyHandler()
{
@@ -320,7 +322,8 @@ namespace pcr
Any SAL_CALL FormComponentPropertyHandler::getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (UnknownPropertyException, RuntimeException)
{
if( _rPropertyName == PROPERTY_ROWSET )
- return ::comphelper::OPropertyContainer::getPropertyValue( _rPropertyName);
+ return ::comphelper::OPropertyContainer::getPropertyValue( _rPropertyName );
+
::osl::MutexGuard aGuard( m_aMutex );
return impl_getPropertyValue_throw( _rPropertyName );
}
@@ -333,10 +336,19 @@ namespace pcr
::comphelper::OPropertyContainer::setPropertyValue( _rPropertyName, _rValue );
return;
}
+
::osl::MutexGuard aGuard( m_aMutex );
PropertyId nPropId( impl_getPropertyId_throw( _rPropertyName ) ); // check if property is known by the handler
- if ( PROPERTY_ID_FONT_NAME == nPropId )
+ Reference< graphic::XGraphicObject > xGrfObj;
+ if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) )
+ {
+ DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid");
+ rtl::OUString sObjectID( RTL_CONSTASCII_USTRINGPARAM( GRAPHOBJ_URLPREFIX ) );
+ sObjectID = sObjectID + xGrfObj->getUniqueID();
+ m_xComponent->setPropertyValue( _rPropertyName, uno::makeAny( sObjectID ) );
+ }
+ else if ( PROPERTY_ID_FONT_NAME == nPropId )
{
// special handling, the value is a faked value we generated ourself in impl_executeFontDialog_nothrow
Sequence< NamedValue > aFontPropertyValues;
@@ -561,9 +573,14 @@ namespace pcr
{
::rtl::OUString sControlValue;
OSL_VERIFY( _rControlValue >>= sControlValue );
-
- INetURLObject aDocURL( impl_getDocumentURL_nothrow() );
- aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI );
+ // Don't convert a placeholder
+ if ( nPropId == PROPERTY_ID_IMAGE_URL && sControlValue.equals( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) )
+ aPropertyValue <<= sControlValue;
+ else
+ {
+ INetURLObject aDocURL( impl_getDocumentURL_nothrow() );
+ aPropertyValue <<= (::rtl::OUString)URIHelper::SmartRel2Abs( aDocURL, sControlValue, Link(), false, true, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI );
+ }
}
break;
@@ -816,7 +833,6 @@ namespace pcr
if ( SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
const_cast< FormComponentPropertyHandler* >( this )->m_bHaveCommand = true;
break;
-
} // switch ( nPropId )
aProperties.push_back( *pProperty );
@@ -858,6 +874,7 @@ namespace pcr
aInterestingProperties.push_back( PROPERTY_DECIMAL_ACCURACY );
aInterestingProperties.push_back( PROPERTY_SHOWTHOUSANDSEP );
aInterestingProperties.push_back( PROPERTY_FORMATKEY );
+ aInterestingProperties.push_back( PROPERTY_EMPTY_IS_NULL );
return Sequence< ::rtl::OUString >( &(*aInterestingProperties.begin()), aInterestingProperties.size() );
}
@@ -1505,9 +1522,15 @@ namespace pcr
aDependentProperties.push_back( PROPERTY_ID_BOUNDCOLUMN );
aDependentProperties.push_back( PROPERTY_ID_SCALEIMAGE );
+ aDependentProperties.push_back( PROPERTY_ID_SCALE_MODE );
+ aDependentProperties.push_back( PROPERTY_ID_INPUT_REQUIRED );
}
break;
+ case PROPERTY_ID_EMPTY_IS_NULL:
+ aDependentProperties.push_back( PROPERTY_ID_INPUT_REQUIRED );
+ break;
+
// ----- SubmitEncoding -----
case PROPERTY_ID_SUBMIT_ENCODING:
{
@@ -1569,6 +1592,7 @@ namespace pcr
}
aDependentProperties.push_back( PROPERTY_ID_SCALEIMAGE );
+ aDependentProperties.push_back( PROPERTY_ID_SCALE_MODE );
}
break;
@@ -1739,8 +1763,9 @@ namespace pcr
}
break; // case PROPERTY_ID_BOUNDCOLUMN
- // ----- ScaleImage -----
+ // ----- ScaleImage, ScaleMode -----
case PROPERTY_ID_SCALEIMAGE:
+ case PROPERTY_ID_SCALE_MODE:
{
::rtl::OUString sControlSource;
if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_CONTROLSOURCE ) )
@@ -1749,15 +1774,36 @@ namespace pcr
::rtl::OUString sImageURL;
impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sImageURL;
- _rxInspectorUI->enablePropertyUI( PROPERTY_SCALEIMAGE,
+ _rxInspectorUI->enablePropertyUI( impl_getPropertyNameFromId_nothrow( _nPropId ),
( sControlSource.getLength() != 0 ) || ( sImageURL.getLength() != 0 )
);
}
- break; // case PROPERTY_ID_SCALEIMAGE
+ break; // case PROPERTY_ID_SCALEIMAGE, PROPERTY_ID_SCALE_MODE
- // ----- SelectedItems -----
+ // ----- InputRequired -----
+ case PROPERTY_ID_INPUT_REQUIRED:
+ {
+ ::rtl::OUString sControlSource;
+ OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_CONTROLSOURCE ) >>= sControlSource );
+
+ sal_Bool bEmptyIsNULL = sal_False;
+ sal_Bool bHasEmptyIsNULL = impl_componentHasProperty_throw( PROPERTY_EMPTY_IS_NULL );
+ if ( bHasEmptyIsNULL )
+ OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_EMPTY_IS_NULL ) >>= bEmptyIsNULL );
+
+ // if the control is not bound to a DB field, there is no sense in having the "Input required"
+ // property
+ // Also, if an empty input of this control are *not* written as NULL, but as empty strings,
+ // then "Input required" does not make sense, too (since there's always an input, even if the control
+ // is empty).
+ _rxInspectorUI->enablePropertyUI( PROPERTY_INPUT_REQUIRED,
+ ( sControlSource.getLength() != 0 ) && ( !bHasEmptyIsNULL || bEmptyIsNULL )
+ );
+ }
+ break;
+
+ // ----- SelectedItems, DefaultSelection -----
case PROPERTY_ID_SELECTEDITEMS:
- // ----- DefaultSelection -----
case PROPERTY_ID_DEFAULT_SELECT_SEQ:
{
Sequence< ::rtl::OUString > aEntries;
@@ -2131,6 +2177,12 @@ namespace pcr
)
return true;
break;
+
+ case PROPERTY_ID_SCALEIMAGE:
+ if ( impl_componentHasProperty_throw( PROPERTY_SCALE_MODE ) )
+ // ScaleImage is superseded by ScaleMode
+ return true;
+ break;
}
sal_uInt32 nPropertyUIFlags = m_pInfoService->getPropertyUIFlags( _rProperty.Handle );
@@ -2658,11 +2710,15 @@ namespace pcr
//------------------------------------------------------------------------
bool FormComponentPropertyHandler::impl_browseForImage_nothrow( Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
{
+ bool bIsLink = true;// reflect the legacy behavior
::rtl::OUString aStrTrans = m_pInfoService->getPropertyTranslation( PROPERTY_ID_IMAGE_URL );
::sfx2::FileDialogHelper aFileDlg(SFXWB_GRAPHIC);
aFileDlg.SetTitle(aStrTrans);
+ // non-linked images ( e.g. those located in the document
+ // stream ) cannot *currently* be handled by openoffice basic dialogs.
+ bool bHandleNonLink = ( m_eComponentClass == eFormControl );
Reference< XFilePickerControlAccess > xController(aFileDlg.GetFilePicker(), UNO_QUERY);
DBG_ASSERT(xController.is(), "FormComponentPropertyHandler::impl_browseForImage_nothrow: missing the controller interface on the file picker!");
@@ -2671,14 +2727,14 @@ namespace pcr
// do a preview by default
xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
- // "as link" is checked, but disabled
- xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(sal_True));
- xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
+ xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, ::cppu::bool2any(bIsLink));
+ xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, bHandleNonLink );
+
}
::rtl::OUString sCurValue;
OSL_VERIFY( impl_getPropertyValue_throw( PROPERTY_IMAGE_URL ) >>= sCurValue );
- if ( sCurValue.getLength() != 0 )
+ if ( sCurValue.getLength() != 0 && sCurValue.compareToAscii(GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH(GRAPHOBJ_URLPREFIX) ) != 0 )
{
aFileDlg.SetDisplayDirectory( sCurValue );
// TODO: need to set the display directory _and_ the default name
@@ -2687,7 +2743,26 @@ namespace pcr
_rClearBeforeDialog.clear();
bool bSuccess = ( 0 == aFileDlg.Execute() );
if ( bSuccess )
- _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
+ {
+ if ( bHandleNonLink && xController.is() )
+ {
+ xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
+ }
+ if ( !bIsLink )
+ {
+ Graphic aGraphic;
+ aFileDlg.GetGraphic( aGraphic );
+
+ Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_aContext.getUNOContext() );
+ xGrfObj->setGraphic( aGraphic.GetXGraphic() );
+
+
+ _out_rNewValue <<= xGrfObj;
+
+ }
+ else
+ _out_rNewValue <<= (::rtl::OUString)aFileDlg.GetPath();
+ }
return bSuccess;
}
diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx
index f64881a931d4..ae452a566337 100644
--- a/extensions/source/propctrlr/formmetadata.cxx
+++ b/extensions/source/propctrlr/formmetadata.cxx
@@ -158,6 +158,8 @@ namespace pcr
DEF_INFO_3( CELL_EXCHANGE_TYPE,CELL_EXCHANGE_TYPE, CELL_EXCHANGE_TYPE,FORM_VISIBLE, DATA_PROPERTY, ENUM ),
DEF_INFO_2( LIST_CELL_RANGE, LIST_CELL_RANGE, LIST_CELL_RANGE, FORM_VISIBLE, DATA_PROPERTY ),
DEF_INFO_3( CONTROLSOURCE, CONTROLSOURCE, CONTROLSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
+ DEF_INFO_3( EMPTY_IS_NULL, EMPTY_IS_NULL, EMPTY_IS_NULL, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
+ DEF_INFO_3( INPUT_REQUIRED, INPUT_REQUIRED, INPUT_REQUIRED, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
DEF_INFO_3( REFVALUE, REFVALUE, REFVALUE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
DEF_INFO_3( UNCHECKEDREFVALUE, UNCHECKEDREFVALUE, UNCHECKEDREFVALUE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
DEF_INFO_3( DATASOURCE, DATASOURCE, DATASOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
@@ -174,7 +176,6 @@ namespace pcr
DEF_INFO_4( INSERTONLY, DATAENTRY, DATAENTRY, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE, COMPOSEABLE ),
DEF_INFO_4( NAVIGATION, NAVIGATION, NAVIGATION, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
DEF_INFO_4( CYCLE, CYCLE, CYCLE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
- DEF_INFO_3( EMPTY_IS_NULL, EMPTY_IS_NULL, EMPTY_IS_NULL, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
DEF_INFO_3( FILTERPROPOSAL, FILTERPROPOSAL, FILTERPROPOSAL, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
DEF_INFO_4( LISTSOURCETYPE, LISTSOURCETYPE, LISTSOURCETYPE, FORM_VISIBLE, DATA_PROPERTY, ENUM, COMPOSEABLE ),
DEF_INFO_3( LISTSOURCE, LISTSOURCE, LISTSOURCE, FORM_VISIBLE, DATA_PROPERTY, COMPOSEABLE ),
@@ -340,6 +341,7 @@ namespace pcr
DEF_INFO_3( IMAGE_URL, IMAGE_URL, IMAGE_URL, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
DEF_INFO_4( IMAGEPOSITION, IMAGEPOSITION, IMAGEPOSITION, FORM_VISIBLE, DIALOG_VISIBLE, ENUM, COMPOSEABLE ),
DEF_INFO_3( SCALEIMAGE, SCALEIMAGE, SCALEIMAGE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
+ DEF_INFO_4( SCALE_MODE, SCALEIMAGE, SCALEIMAGE, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE, ENUM ),
DEF_INFO_2( DEFAULT_SELECT_SEQ,DEFAULT_SELECT_SEQ, DEFAULT_SELECT_SEQ,FORM_VISIBLE, COMPOSEABLE ),
DEF_INFO_2( SELECTEDITEMS, SELECTEDITEMS, SELECTEDITEMS, DIALOG_VISIBLE, COMPOSEABLE ),
DEF_INFO_3( ECHO_CHAR, ECHO_CHAR, ECHO_CHAR, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
@@ -503,8 +505,12 @@ namespace pcr
case PROPERTY_ID_SELECTION_TYPE:
nStringItemsResId = RID_RSC_ENUM_SELECTION_TYPE;
break;
+ case PROPERTY_ID_SCALE_MODE:
+ nStringItemsResId = RID_RSC_ENUM_SCALE_MODE;
+ break;
default:
OSL_ENSURE( sal_False, "OPropertyInfoService::getPropertyEnumRepresentations: unknown enum property!" );
+ break;
}
::std::vector< ::rtl::OUString > aReturn;
diff --git a/extensions/source/propctrlr/formmetadata.hxx b/extensions/source/propctrlr/formmetadata.hxx
index c0b20071153a..a86eac088c7f 100644
--- a/extensions/source/propctrlr/formmetadata.hxx
+++ b/extensions/source/propctrlr/formmetadata.hxx
@@ -323,20 +323,23 @@ namespace pcr
#define PROPERTY_ID_XSD_MAX_EXCLUSIVE_DATE_TIME 179
#define PROPERTY_ID_XSD_MIN_INCLUSIVE_DATE_TIME 180
#define PROPERTY_ID_XSD_MIN_EXCLUSIVE_DATE_TIME 181
- #define PROPERTY_ID_UNCHECKEDREFVALUE 182
- #define PROPERTY_ID_SUBMISSION_ID 183
- #define PROPERTY_ID_XFORMS_BUTTONTYPE 184
- #define PROPERTY_ID_LIST_BINDING 185
- #define PROPERTY_ID_VERTICAL_ALIGN 186
- #define PROPERTY_ID_BINDING_NAME 187
- #define PROPERTY_ID_DECORATION 188
- #define PROPERTY_ID_SELECTION_TYPE 189
- #define PROPERTY_ID_ROOT_DISPLAYED 190
- #define PROPERTY_ID_SHOWS_HANDLES 191
- #define PROPERTY_ID_SHOWS_ROOT_HANDLES 192
- #define PROPERTY_ID_EDITABLE 193
- #define PROPERTY_ID_INVOKES_STOP_NOT_EDITING 194
- #define PROPERTY_ID_NOLABEL 195
+ #define PROPERTY_ID_UNCHECKEDREFVALUE 182
+ #define PROPERTY_ID_SUBMISSION_ID 183
+ #define PROPERTY_ID_XFORMS_BUTTONTYPE 184
+ #define PROPERTY_ID_LIST_BINDING 185
+ #define PROPERTY_ID_VERTICAL_ALIGN 186
+ #define PROPERTY_ID_BINDING_NAME 187
+ #define PROPERTY_ID_DECORATION 188
+ #define PROPERTY_ID_SELECTION_TYPE 189
+ #define PROPERTY_ID_ROOT_DISPLAYED 190
+ #define PROPERTY_ID_SHOWS_HANDLES 191
+ #define PROPERTY_ID_SHOWS_ROOT_HANDLES 192
+ #define PROPERTY_ID_EDITABLE 193
+ #define PROPERTY_ID_INVOKES_STOP_NOT_EDITING 194
+ #define PROPERTY_ID_NOLABEL 195
+ #define PROPERTY_ID_SCALE_MODE 196
+ #define PROPERTY_ID_INPUT_REQUIRED 197
+
//............................................................................
} // namespace pcr
//............................................................................
diff --git a/extensions/source/propctrlr/formres.src b/extensions/source/propctrlr/formres.src
index 7f4f9b31c8db..66faf679467d 100644
--- a/extensions/source/propctrlr/formres.src
+++ b/extensions/source/propctrlr/formres.src
@@ -1382,3 +1382,23 @@ String RID_STR_NOLABEL
{
Text [ en-US ] = "No Label" ;
};
+
+Resource RID_RSC_ENUM_SCALE_MODE
+{
+ String 1
+ {
+ Text [ en-US ] = "No";
+ };
+ String 2
+ {
+ Text [ en-US ] = "Keep Ratio";
+ };
+ String 3
+ {
+ Text [ en-US ] = "Fit to Size";
+ };
+};
+String RID_STR_INPUT_REQUIRED
+{
+ Text [ en-US ] = "Input required";
+};
diff --git a/extensions/source/propctrlr/formresid.hrc b/extensions/source/propctrlr/formresid.hrc
index e7f3ebd89b49..db494a5ceaa3 100644
--- a/extensions/source/propctrlr/formresid.hrc
+++ b/extensions/source/propctrlr/formresid.hrc
@@ -147,7 +147,7 @@
#define RID_STR_TAG ( RID_FORMBROWSER_START + 116 )
#define RID_STR_HELPTEXT ( RID_FORMBROWSER_START + 117 )
#define RID_STR_HELPURL ( RID_FORMBROWSER_START + 118 )
- // FREE
+#define RID_STR_INPUT_REQUIRED ( RID_FORMBROWSER_START + 119 )
#define RID_STR_UNCHECKEDREFVALUE ( RID_FORMBROWSER_START + 120 )
#define RID_STR_CURSOR_TYPE ( RID_FORMBROWSER_START + 121 )
// FREE
@@ -336,6 +336,7 @@
#define RID_RSC_ENUM_CELL_EXCHANGE_TYPE ( RID_PROPCONTROLLER_START + 23 )
#define RID_RSC_ENUM_SUBMIT_TARGET ( RID_PROPCONTROLLER_START + 24 )
#define RID_RSC_ENUM_SELECTION_TYPE ( RID_PROPCONTROLLER_START + 25 )
+#define RID_RSC_ENUM_SCALE_MODE ( RID_PROPCONTROLLER_START + 26 )
// -----------------------------------------------------------------------
// - ImageList - local ids
diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx
index 64b9181a7e12..23f677a658bc 100644
--- a/extensions/source/propctrlr/formstrings.hxx
+++ b/extensions/source/propctrlr/formstrings.hxx
@@ -55,6 +55,7 @@ namespace pcr
PCR_CONSTASCII_STRING( PROPERTY_NAVIGATION, "NavigationBarMode");
PCR_CONSTASCII_STRING( PROPERTY_CYCLE, "Cycle");
PCR_CONSTASCII_STRING( PROPERTY_CONTROLSOURCE, "DataField");
+ PCR_CONSTASCII_STRING( PROPERTY_INPUT_REQUIRED, "InputRequired");
PCR_CONSTASCII_STRING( PROPERTY_ENABLED, "Enabled");
PCR_CONSTASCII_STRING( PROPERTY_READONLY, "ReadOnly");
PCR_CONSTASCII_STRING( PROPERTY_ISREADONLY, "IsReadOnly");
@@ -182,6 +183,7 @@ namespace pcr
PCR_CONSTASCII_STRING( PROPERTY_STATE, "State");
PCR_CONSTASCII_STRING( PROPERTY_TIME, "Time");
PCR_CONSTASCII_STRING( PROPERTY_SCALEIMAGE, "ScaleImage");
+ PCR_CONSTASCII_STRING( PROPERTY_SCALE_MODE, "ScaleMode");
PCR_CONSTASCII_STRING( PROPERTY_PUSHBUTTONTYPE, "PushButtonType");
PCR_CONSTASCII_STRING( PROPERTY_EFFECTIVE_VALUE, "EffectiveValue");
PCR_CONSTASCII_STRING( PROPERTY_SELECTEDITEMS, "SelectedItems");
diff --git a/extensions/source/propctrlr/makefile.mk b/extensions/source/propctrlr/makefile.mk
index 84f631799c45..78ccf211d8de 100644
--- a/extensions/source/propctrlr/makefile.mk
+++ b/extensions/source/propctrlr/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.23 $
+# $Revision: 1.23.84.2 $
#
# This file is part of OpenOffice.org.
#
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index 760004f0d077..b4ec5c0476f7 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -1384,6 +1384,18 @@ namespace pcr
{
try
{
+ rtl::OUString sPlcHolder = String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) );
+ bool bIsPlaceHolderValue = false;
+
+ if ( rName.equals( PROPERTY_IMAGE_URL ) )
+ {
+ // if the prop value is the PlaceHolder
+ // can ignore it
+ rtl::OUString sVal;
+ _rValue >>= sVal;
+ if ( sVal.equals( sPlcHolder ) )
+ bIsPlaceHolderValue = true;
+ }
m_sCommittingProperty = rName;
bool bIsActuatingProperty = impl_isActuatingProperty_nothrow( rName );
@@ -1396,8 +1408,9 @@ namespace pcr
PropertyHandlerRef handler = impl_getHandlerForProperty_throw( rName );
//////////////////////////////////////////////////////////////////////
- // set the value
- handler->setPropertyValue( rName, _rValue );
+ // set the value ( only if it's not a placeholder )
+ if ( !bIsPlaceHolderValue )
+ handler->setPropertyValue( rName, _rValue );
//////////////////////////////////////////////////////////////////////
// re-retrieve the value
@@ -1739,7 +1752,7 @@ namespace pcr
}
catch( const Exception& )
{
- OSL_ENSURE( sal_False, "OPropertyBrowserController::impl_broadcastPropertyChange_nothrow: caught an exception while calling the handlers!" );
+ DBG_UNHANDLED_EXCEPTION();
}
}
diff --git a/extensions/source/propctrlr/propres.src b/extensions/source/propctrlr/propres.src
index 1cfbc6b64d2a..207915e1dee9 100644
--- a/extensions/source/propctrlr/propres.src
+++ b/extensions/source/propctrlr/propres.src
@@ -52,3 +52,7 @@ String RID_STR_HELP_SECTION_LABEL
{
Text [ en-US ] = "Help";
};
+String RID_EMBED_IMAGE_PLACEHOLDER
+{
+ Text [ en-US ] = "<Embedded-Image>";
+};
diff --git a/extensions/source/propctrlr/propresid.hrc b/extensions/source/propctrlr/propresid.hrc
index dacc65b946c5..aa66089b34d7 100644
--- a/extensions/source/propctrlr/propresid.hrc
+++ b/extensions/source/propctrlr/propresid.hrc
@@ -46,5 +46,6 @@
#define RID_STR_PROPPAGE_DATA ( RID_PROPCONTROLLER_START + 2 )
#define RID_STR_BOOL ( RID_PROPCONTROLLER_START + 3 )
#define RID_STR_HELP_SECTION_LABEL ( RID_PROPCONTROLLER_START + 4 )
+#define RID_EMBED_IMAGE_PLACEHOLDER ( RID_PROPCONTROLLER_START + 5 )
#endif // EXTENSIONS_PROPRESID_HRC
diff --git a/extensions/source/propctrlr/usercontrol.cxx b/extensions/source/propctrlr/usercontrol.cxx
index 0dd183d2fb68..005659f3576a 100644
--- a/extensions/source/propctrlr/usercontrol.cxx
+++ b/extensions/source/propctrlr/usercontrol.cxx
@@ -42,7 +42,8 @@
#include <svtools/zformat.hxx>
#include <connectivity/dbconversion.hxx>
#include <com/sun/star/util/Time.hpp>
-
+#include "modulepcr.hxx"
+#include "propresid.hrc"
//............................................................................
namespace pcr
{
@@ -271,6 +272,7 @@ namespace pcr
:OFileUrlControl_Base( PropertyControlType::Unknown, pParent, nWinStyle | WB_DROPDOWN )
{
getTypedControlWindow()->SetDropDownLineCount( 10 );
+ getTypedControlWindow()->SetPlaceHolder( String( PcrRes( RID_EMBED_IMAGE_PLACEHOLDER ) ) ) ;
}
//------------------------------------------------------------------
@@ -282,8 +284,13 @@ namespace pcr
void SAL_CALL OFileUrlControl::setValue( const Any& _rValue ) throw (IllegalTypeException, RuntimeException)
{
::rtl::OUString sURL;
- if ( _rValue >>= sURL )
- getTypedControlWindow()->DisplayURL( sURL );
+ if ( ( _rValue >>= sURL ) )
+ {
+ if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
+ getTypedControlWindow()->DisplayURL( getTypedControlWindow()->GetPlaceHolder() );
+ else
+ getTypedControlWindow()->DisplayURL( sURL );
+ }
else
getTypedControlWindow()->SetText( String() );
}
@@ -293,7 +300,7 @@ namespace pcr
{
Any aPropValue;
if ( getTypedControlWindow()->GetText().Len() )
- aPropValue <<= (::rtl::OUString)getTypedControlWindow()->GetURL();
+ aPropValue <<= (::rtl::OUString)getTypedControlWindow()->GetURL();
return aPropValue;
}
diff --git a/extensions/util/hidother.src b/extensions/util/hidother.src
index 82f311851863..e2c56da5d130 100644
--- a/extensions/util/hidother.src
+++ b/extensions/util/hidother.src
@@ -306,3 +306,4 @@ hidspecial HID_CHECK_FOR_UPD_STATUS { HelpId = HID_CHECK_FOR_UPD_STA
hidspecial HID_CHECK_FOR_UPD_DESCRIPTION { HelpId = HID_CHECK_FOR_UPD_DESCRIPTION; }
hidspecial HID_CHECK_FOR_UPD_CANCEL { HelpId = HID_CHECK_FOR_UPD_CANCEL; }
hidspecial HID_PROP_NOLABEL { HelpId = HID_PROP_NOLABEL; }
+hidspecial HID_PROP_INPUT_REQUIRED { HelpId = HID_PROP_INPUT_REQUIRED; }
diff --git a/forms/qa/integration/forms/DocumentViewHelper.java b/forms/qa/integration/forms/DocumentViewHelper.java
index 2ba9148b3a7a..f106ba070f8c 100644
--- a/forms/qa/integration/forms/DocumentViewHelper.java
+++ b/forms/qa/integration/forms/DocumentViewHelper.java
@@ -30,15 +30,25 @@
package integration.forms;
/**************************************************************************/
-import com.sun.star.uno.*;
-import com.sun.star.frame.*;
-import com.sun.star.lang.*;
-import com.sun.star.util.*;
-import com.sun.star.awt.*;
-import com.sun.star.view.*;
-import com.sun.star.beans.*;
-import com.sun.star.container.*;
-import com.sun.star.form.*;
+
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexContainer;
+import com.sun.star.form.FormComponentType;
+import com.sun.star.form.XForm;
+import com.sun.star.form.XFormController;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+import com.sun.star.view.XControlAccess;
+import com.sun.star.view.XFormLayerAccess;
import org.openoffice.xforms.XMLDocument;
/**************************************************************************/
@@ -169,6 +179,24 @@ public class DocumentViewHelper
}
/* ------------------------------------------------------------------ */
+ /** retrieves the form controller for a given logical form
+ */
+ public XFormController getFormController( XForm _form )
+ {
+ XFormLayerAccess formLayerAccess = (XFormLayerAccess)query( XFormLayerAccess.class );
+ return formLayerAccess.getFormController( _form );
+ }
+
+ /* ------------------------------------------------------------------ */
+ /** retrieves the form controller for a given logical form
+ */
+ public XFormController getFormController( XPropertySet _form )
+ {
+ XFormLayerAccess formLayerAccess = (XFormLayerAccess)query( XFormLayerAccess.class );
+ return formLayerAccess.getFormController( (XForm)UnoRuntime.queryInterface( XForm.class, _form ) );
+ }
+
+ /* ------------------------------------------------------------------ */
/** toggles the design mode of the form layer of active view of our sample document
*/
protected void toggleFormDesignMode( ) throws java.lang.Exception
diff --git a/forms/qa/integration/forms/FormControlTest.java b/forms/qa/integration/forms/FormControlTest.java
index ca5fcea84c9d..91193ff479e5 100644
--- a/forms/qa/integration/forms/FormControlTest.java
+++ b/forms/qa/integration/forms/FormControlTest.java
@@ -29,41 +29,33 @@
************************************************************************/
package integration.forms;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XNamingService;
-
+import com.sun.star.awt.XImageProducer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
-
+import com.sun.star.form.XFormController;
+import com.sun.star.form.XImageProducerSupplier;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.lang.EventObject;
import com.sun.star.lang.XMultiServiceFactory;
-
-import com.sun.star.util.XCloseable;
-import com.sun.star.util.XURLTransformer;
-import com.sun.star.util.URL;
-
import com.sun.star.sdb.CommandType;
-import com.sun.star.sdbc.XDataSource;
+import com.sun.star.sdb.SQLErrorEvent;
+import com.sun.star.sdb.XSQLErrorBroadcaster;
+import com.sun.star.sdb.XSQLErrorListener;
import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XDataSource;
import com.sun.star.sdbc.XResultSet;
import com.sun.star.sdbc.XResultSetUpdate;
-
-import com.sun.star.form.XImageProducerSupplier;
-
-import com.sun.star.beans.XPropertySet;
-import com.sun.star.beans.PropertyValue;
-
-import com.sun.star.frame.XDispatch;
-
-import com.sun.star.awt.XImageProducer;
-
-import com.sun.star.accessibility.XAccessible;
-import com.sun.star.accessibility.XAccessibleEditableText;
-
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XNamingService;
+import com.sun.star.util.URL;
+import com.sun.star.util.XCloseable;
+import com.sun.star.util.XURLTransformer;
import connectivity.tools.HsqlDatabase;
+import java.io.FileOutputStream;
-import java.util.*;
-import java.io.*;
-public class FormControlTest extends complexlib.ComplexTestCase
+public class FormControlTest extends complexlib.ComplexTestCase implements XSQLErrorListener
{
private static String s_tableName = "CTC_form_controls";
@@ -74,7 +66,9 @@ public class FormControlTest extends complexlib.ComplexTestCase
private DocumentHelper m_document;
private FormLayer m_formLayer;
private XPropertySet m_masterForm;
+ private XFormController m_masterFormController;
private String m_sImageURL;
+ private SQLErrorEvent m_mostRecentErrorEvent;
private final String m_dataSourceName = "integration.forms.FormControlTest";
@@ -87,7 +81,8 @@ public class FormControlTest extends complexlib.ComplexTestCase
"checkImageControl",
"checkCrossUpdates_checkBox",
"checkCrossUpdates_radioButton",
- "checkRowUpdates"
+ "checkRowUpdates",
+ "checkEmptyIsNull"
};
}
@@ -370,11 +365,7 @@ public class FormControlTest extends complexlib.ComplexTestCase
{
// start with inserting a new record
moveToInsertRow();
- if ( !verifyCleanInsertRow() )
- {
- failed( "insert row not in expected clean state" );
- return;
- }
+ assure( "insert row not in expected clean state", verifyCleanInsertRow() );
userTextInput( "ID", "3", true );
userTextInput( "f_integer", "729", true );
@@ -404,6 +395,7 @@ public class FormControlTest extends complexlib.ComplexTestCase
userTextInput( "ID", "4", true );
userTextInput( "f_integer", "618", true );
userTextInput( "f_text", "yet another stupid, meaningless text", true );
+ userTextInput( "f_required_text", "this must not be NULL", true );
userTextInput( "f_decimal", "4562", true );
userTextInput( "f_date", "26.03.2004", true );
userTextInput( "f_time", "17:05:00", true );
@@ -429,6 +421,31 @@ public class FormControlTest extends complexlib.ComplexTestCase
}
/* ------------------------------------------------------------------ */
+ /** checks the "ConvertEmptyToNull" property behavior of an edit control
+ *
+ */
+ public void checkEmptyIsNull() throws com.sun.star.uno.Exception, java.lang.Exception
+ {
+ // start with inserting a new record
+ moveToInsertRow();
+ assure( "insert row not in expected clean state", verifyCleanInsertRow() );
+
+ // make an input in any field, but leave the edit control which is bound to a required field
+ // empty
+ userTextInput( "ID", "5", true );
+ userTextInput( "f_text", "more text", true );
+
+ // this should *not* fail. Even if we did not input anything into the control bound to the
+ // f_required_text column, this control's reset (done when moving to the insertion row) is
+ // expected to write an empty string into its bound column, since its EmptyIsNULL property
+ // is set to FALSE
+ // (#i92471#)
+ m_mostRecentErrorEvent = null;
+ nextRecordByUI();
+ assure( "updating an incomplete record did not work as expected", m_mostRecentErrorEvent == null );
+ }
+
+ /* ------------------------------------------------------------------ */
private boolean verifyCleanInsertRow( ) throws com.sun.star.uno.Exception, java.lang.Exception
{
// and check the content of the various controls
@@ -477,6 +494,11 @@ public class FormControlTest extends complexlib.ComplexTestCase
m_dataSource = (XDataSource)UnoRuntime.queryInterface( XDataSource.class,
databaseContext.getByName( m_dataSourceName ) );
m_dataSourceProps = dbfTools.queryPropertySet( m_dataSource );
+
+ XPropertySet dataSourceSettings = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class,
+ m_dataSourceProps.getPropertyValue( "Settings" ) );
+ dataSourceSettings.setPropertyValue( "FormsCheckRequiredFields", new Boolean( false ) );
+
return m_dataSource != null;
}
@@ -499,27 +521,29 @@ public class FormControlTest extends complexlib.ComplexTestCase
m_formLayer = new FormLayer( m_document );
// insert some controls
- XPropertySet xIDField = m_formLayer.insertControlLine( "DatabaseNumericField", "ID", "", 3 );
- m_formLayer.insertControlLine( "DatabaseFormattedField","f_integer", "", 11 );
- m_formLayer.insertControlLine( "DatabaseTextField", "f_text", "", 19 );
- XPropertySet xDecField = m_formLayer.insertControlLine( "DatabaseNumericField", "f_decimal", "", 27 );
- m_formLayer.insertControlLine( "DatabaseDateField", "f_date", "", 35 );
- XPropertySet xTimeField = m_formLayer.insertControlLine( "DatabaseTimeField", "f_time", "", 43 );
- m_formLayer.insertControlLine( "DatabaseDateField", "f_timestamp", "_date", 51 );
- m_formLayer.insertControlLine( "DatabaseTimeField", "f_timestamp", "_time", 59 );
- XPropertySet xImageField = m_formLayer.insertControlLine( "DatabaseImageControl", "f_blob", "", 2, 67, 40 );
- m_formLayer.insertControlLine( "DatabaseTextField", "f_text_enum", "_text", 80, 25, 6 );
- XPropertySet xCheckBox = m_formLayer.insertControlLine( "DatabaseCheckBox", "f_tinyint", "", 80, 33, 6 );
- m_formLayer.insertControlLine( "DatabaseFormattedField","f_tinyint", "_format",80, 41, 6 );
- m_formLayer.insertControlLine( "DatabaseTextField", "dummy", "", 150 );
+ XPropertySet xIDField = m_formLayer.insertControlLine( "DatabaseNumericField", "ID", "", 3 );
+ m_formLayer.insertControlLine( "DatabaseFormattedField","f_integer", "", 11 );
+ m_formLayer.insertControlLine( "DatabaseTextField", "f_text", "", 19 );
+ XPropertySet xReqField = m_formLayer.insertControlLine( "DatabaseTextField", "f_required_text", "", 27 );
+ m_formLayer.insertControlLine( "DatabaseNumericField", "f_decimal", "", 35 );
+ m_formLayer.insertControlLine( "DatabaseDateField", "f_date", "", 43 );
+ XPropertySet xTimeField = m_formLayer.insertControlLine( "DatabaseTimeField", "f_time", "", 51 );
+ m_formLayer.insertControlLine( "DatabaseDateField", "f_timestamp", "_date", 59 );
+ m_formLayer.insertControlLine( "DatabaseTimeField", "f_timestamp", "_time", 67 );
+ XPropertySet xImageField = m_formLayer.insertControlLine( "DatabaseImageControl", "f_blob", "", 2, 75, 40 );
+ m_formLayer.insertControlLine( "DatabaseTextField", "f_text_enum", "_text", 80, 25, 6 );
+ XPropertySet xCheckBox = m_formLayer.insertControlLine( "DatabaseCheckBox", "f_tinyint", "", 80, 33, 6 );
+ m_formLayer.insertControlLine( "DatabaseFormattedField","f_tinyint", "_format",80, 41, 6 );
+ m_formLayer.insertControlLine( "DatabaseTextField", "dummy", "", 150 );
xIDField.setPropertyValue( "DecimalAccuracy", new Short( (short)0 ) );
xImageField.setPropertyValue( "ScaleImage", new Boolean( true) );
- xImageField.setPropertyValue( "Tabstop", new Boolean( true) );
+ xImageField.setPropertyValue( "Tabstop", new Boolean( true ) );
xCheckBox.setPropertyValue( "TriState", new Boolean( true ) );
xCheckBox.setPropertyValue( "DefaultState", new Short( (short)2 ) );
xTimeField.setPropertyValue( "TimeFormat", new Short( (short)1 ) );
xTimeField.setPropertyValue( "TimeMax", new Integer( 23595999 ) );
+ xReqField.setPropertyValue( "ConvertEmptyToNull", new Boolean( false ) );
// the logical form
m_masterForm = (XPropertySet)dbfTools.getParent( xIDField, XPropertySet.class );
@@ -534,6 +558,11 @@ public class FormControlTest extends complexlib.ComplexTestCase
// switch the forms into data entry mode
m_document.getCurrentView( ).toggleFormDesignMode( );
+ m_masterFormController = m_document.getCurrentView().getFormController( m_masterForm );
+ XSQLErrorBroadcaster errorBroadcaster = (XSQLErrorBroadcaster)UnoRuntime.queryInterface( XSQLErrorBroadcaster.class,
+ m_masterFormController );
+ errorBroadcaster.addSQLErrorListener( this );
+
// set the focus to the ID control
m_document.getCurrentView().grabControlFocus( xIDField );
}
@@ -555,6 +584,7 @@ public class FormControlTest extends complexlib.ComplexTestCase
sCreateTableStatement += "\"ID\" INTEGER NOT NULL PRIMARY KEY,";
sCreateTableStatement += "\"f_integer\" INTEGER default NULL,";
sCreateTableStatement += "\"f_text\" VARCHAR(50) default NULL,";
+ sCreateTableStatement += "\"f_required_text\" VARCHAR(50) NOT NULL,";
sCreateTableStatement += "\"f_decimal\" DECIMAL(10,2) default NULL,";
sCreateTableStatement += "\"f_date\" DATE default NULL,";
sCreateTableStatement += "\"f_time\" TIME default NULL,";
@@ -570,8 +600,8 @@ public class FormControlTest extends complexlib.ComplexTestCase
private String[] getSampleDataValueString( ) throws java.lang.Exception
{
String[] aValues = new String[] {
- "1,42,'the answer',0.12,'2003-09-22','15:00:00','2003-09-23 17:15:23',NULL,'none',1",
- "2,13,'the question',12.43,'2003-09-24','16:18:00','2003-09-24 08:45:12',NULL,'none',0"
+ "1,42,'the answer','foo',0.12,'2003-09-22','15:00:00','2003-09-23 17:15:23',NULL,'none',1",
+ "2,13,'the question','bar',12.43,'2003-09-24','16:18:00','2003-09-24 08:45:12',NULL,'none',0"
};
return aValues;
}
@@ -583,8 +613,8 @@ public class FormControlTest extends complexlib.ComplexTestCase
assure( "could not connect to the data source", xConn != null );
// drop the table, if it already exists
- if ( !implExecuteStatement( xConn, "DROP TABLE \"" + s_tableName + "\" IF EXISTS" )
- || !implExecuteStatement( xConn, getCreateTableStatement() )
+ if ( !implExecuteStatement( "DROP TABLE \"" + s_tableName + "\" IF EXISTS" )
+ || !implExecuteStatement( getCreateTableStatement() )
)
{
failed( "could not create the required sample table!" );
@@ -594,7 +624,7 @@ public class FormControlTest extends complexlib.ComplexTestCase
String sInsertionPrefix = "INSERT INTO \"" + s_tableName + "\" VALUES (";
String[] aValues = getSampleDataValueString();
for ( int i=0; i<aValues.length; ++i )
- if ( !implExecuteStatement( xConn, sInsertionPrefix + aValues[ i ] + ")" ) )
+ if ( !implExecuteStatement( sInsertionPrefix + aValues[ i ] + ")" ) )
{
failed( "could not create the required sample data" );
return false;
@@ -739,7 +769,7 @@ public class FormControlTest extends complexlib.ComplexTestCase
/* ------------------------------------------------------------------ */
/** executes the given statement on the given connection
*/
- protected boolean implExecuteStatement( XConnection xConn, String sStatement ) throws java.lang.Exception
+ protected boolean implExecuteStatement( String sStatement ) throws java.lang.Exception
{
try
{
@@ -872,6 +902,7 @@ public class FormControlTest extends complexlib.ComplexTestCase
return aBytes;
}
+ /* ------------------------------------------------------------------ */
private byte[] getSamplePictureBytes()
{
byte[] aBytes = new byte[] {
@@ -908,4 +939,16 @@ public class FormControlTest extends complexlib.ComplexTestCase
return compareImages.imagesEqual( );
}
+ /* ------------------------------------------------------------------ */
+ public void errorOccured( SQLErrorEvent _event )
+ {
+ // just remember for the moment
+ m_mostRecentErrorEvent = _event;
+ }
+
+ /* ------------------------------------------------------------------ */
+ public void disposing( EventObject _event )
+ {
+ // not interested in
+ }
}
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx
index 7f6b4a3f7e35..fae95b36f180 100644
--- a/forms/source/component/Columns.cxx
+++ b/forms/source/component/Columns.cxx
@@ -233,13 +233,6 @@ OGridColumn::OGridColumn(const Reference<XMultiServiceFactory>& _rxFactory, cons
// Refcount wieder bei NULL
decrement( m_refCount );
}
-
- if ( m_xAggregateSet.is() )
- {
- Reference< XPropertySetInfo > xPropInfo = m_xAggregateSet->getPropertySetInfo();
- if ( xPropInfo.is() && xPropInfo->hasPropertyByName( PROPERTY_TRISTATE ) )
- m_xAggregateSet->setPropertyValue( PROPERTY_TRISTATE, makeAny( sal_True ) );
- }
}
//------------------------------------------------------------------------------
@@ -331,6 +324,7 @@ void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, sal_B
aForbiddenProperties.insert( PROPERTY_AUTOCOMPLETE );
aForbiddenProperties.insert( PROPERTY_BACKGROUNDCOLOR );
aForbiddenProperties.insert( PROPERTY_BORDER );
+ aForbiddenProperties.insert( PROPERTY_BORDERCOLOR );
aForbiddenProperties.insert( PROPERTY_ECHO_CHAR );
aForbiddenProperties.insert( PROPERTY_FILLCOLOR );
aForbiddenProperties.insert( PROPERTY_FONT );
@@ -356,7 +350,6 @@ void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, sal_B
aForbiddenProperties.insert( PROPERTY_TABINDEX );
aForbiddenProperties.insert( PROPERTY_TABSTOP );
aForbiddenProperties.insert( PROPERTY_TEXTCOLOR );
- aForbiddenProperties.insert( PROPERTY_TRISTATE );
aForbiddenProperties.insert( PROPERTY_VSCROLL );
aForbiddenProperties.insert( PROPERTY_CONTROLLABEL );
aForbiddenProperties.insert( PROPERTY_RICH_TEXT );
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx
index 1b3e9578a592..fc8cd78fdfde 100644
--- a/forms/source/component/ComboBox.cxx
+++ b/forms/source/component/ComboBox.cxx
@@ -748,14 +748,22 @@ void SAL_CALL OComboBoxModel::reloaded( const EventObject& aEvent ) throw(Runtim
//-----------------------------------------------------------------------------
sal_Bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset )
{
- ::rtl::OUString aNewValue;
- m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) >>= aNewValue;
- sal_Bool bModified = ( aNewValue != m_aSaveValue );
+ Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
+ ::rtl::OUString sNewValue;
+ aNewValue >>= sNewValue;
+
+ bool bModified = ( aNewValue != m_aLastKnownValue );
if ( bModified )
{
- if (!aNewValue.getLength() && !isRequired() && m_bEmptyIsNull)
+ if ( !aNewValue.hasValue()
+ || ( !sNewValue.getLength() // an empty string
+ && m_bEmptyIsNull // which should be interpreted as NULL
+ )
+ )
+ {
m_xColumnUpdate->updateNull();
+ }
else
{
try
@@ -763,18 +771,19 @@ sal_Bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset )
OSL_PRECOND( m_pValueFormatter.get(), "OComboBoxModel::commitControlValueToDbColumn: no value formatter!" );
if ( m_pValueFormatter.get() )
{
- if ( !m_pValueFormatter->setFormattedValue( aNewValue ) )
+ if ( !m_pValueFormatter->setFormattedValue( sNewValue ) )
return sal_False;
}
else
- m_xColumnUpdate->updateString( aNewValue );
+ m_xColumnUpdate->updateString( sNewValue );
}
catch ( const Exception& )
{
return sal_False;
}
}
- m_aSaveValue = aNewValue;
+
+ m_aLastKnownValue = aNewValue;
}
// add the new value to the list
@@ -790,7 +799,7 @@ sal_Bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset )
sal_Int32 i;
for (i=0; i<aStringItemList.getLength(); ++i, ++pStringItems)
{
- if (pStringItems->equals(aNewValue))
+ if ( pStringItems->equals( sNewValue ) )
break;
}
@@ -799,7 +808,7 @@ sal_Bool OComboBoxModel::commitControlValueToDbColumn( bool _bPostReset )
{
sal_Int32 nOldLen = aStringItemList.getLength();
aStringItemList.realloc( nOldLen + 1 );
- aStringItemList.getArray()[ nOldLen ] = aNewValue;
+ aStringItemList.getArray()[ nOldLen ] = sNewValue;
setFastPropertyValue( PROPERTY_ID_STRINGITEMLIST, makeAny( aStringItemList ) );
}
@@ -815,10 +824,26 @@ Any OComboBoxModel::translateDbColumnToControlValue()
{
OSL_PRECOND( m_pValueFormatter.get(), "OComboBoxModel::translateDbColumnToControlValue: no value formatter!" );
if ( m_pValueFormatter.get() )
- m_aSaveValue = m_pValueFormatter->getFormattedValue();
+ {
+ ::rtl::OUString sValue( m_pValueFormatter->getFormattedValue() );
+ if ( !sValue.getLength()
+ && m_pValueFormatter->getColumn().is()
+ && m_pValueFormatter->getColumn()->wasNull()
+ )
+ {
+ m_aLastKnownValue.clear();
+ }
+ else
+ {
+
+ m_aLastKnownValue <<= sValue;
+ }
+ }
else
- m_aSaveValue = ::rtl::OUString();
- return makeAny( m_aSaveValue );
+ m_aLastKnownValue.clear();
+
+ return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() );
+ // (m_aLastKnownValue is alllowed to be VOID, the control value isn't)
}
//------------------------------------------------------------------------------
diff --git a/forms/source/component/ComboBox.hxx b/forms/source/component/ComboBox.hxx
index c4d8846311b2..28e17ebe9f42 100644
--- a/forms/source/component/ComboBox.hxx
+++ b/forms/source/component/ComboBox.hxx
@@ -68,7 +68,7 @@ class OComboBoxModel
::com::sun::star::uno::Any m_aBoundColumn; // obsolet
::rtl::OUString m_aListSource; //
::rtl::OUString m_aDefaultText; // DefaultText
- ::rtl::OUString m_aSaveValue;
+ ::com::sun::star::uno::Any m_aLastKnownValue;
StringSequence m_aDesignModeStringItems;
// upon loading, in some cases we reset fill our string item list ourself. We don't want
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index c96d2455c54c..f349bfa0ea6a 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -44,6 +44,7 @@
#include "property.hxx"
#include "services.hxx"
#include "frm_module.hxx"
+#include "componenttools.hxx"
#include <com/sun/star/sdb/XColumnUpdate.hpp>
#include <com/sun/star/util/XCancellable.hpp>
#include <com/sun/star/sdbc/ResultSetType.hpp>
@@ -144,20 +145,6 @@ namespace frm
{
//.........................................................................
-//---------------------------------------------------------------------
-Reference< XModel> getXModel(const Reference< XInterface>& xIface)
-{
- Reference< XInterface > xParent = xIface;
- Reference< XModel > xModel(xParent,UNO_QUERY);;
- while( xParent.is() && !xModel.is() )
- {
- Reference<XChild> xChild(xParent,UNO_QUERY);
- xParent.set(xChild.is() ? xChild->getParent() : Reference< XInterface >(),UNO_QUERY);
- xModel.set(xParent,UNO_QUERY);
- }
- return xModel;
-}
-
//==================================================================
//= OFormSubmitResetThread
//=-----------------------------------------------------------------
@@ -1936,6 +1923,7 @@ void ODatabaseForm::reset_impl(bool _bAproveByListeners)
}
catch(Exception&)
{
+ DBG_UNHANDLED_EXCEPTION();
}
}
}
diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx
index e7e85de72454..8b926ab05ff2 100644
--- a/forms/source/component/Edit.cxx
+++ b/forms/source/component/Edit.cxx
@@ -679,12 +679,21 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType )
//------------------------------------------------------------------------------
sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
- ::rtl::OUString sNewValue;
- m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) >>= sNewValue;
- if (sNewValue != m_aSaveValue)
+ Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
+
+ if ( aNewValue != m_aLastKnownValue )
{
- if (!sNewValue.getLength() && !isRequired() && m_bEmptyIsNull)
+ ::rtl::OUString sNewValue;
+ aNewValue >>= sNewValue;
+
+ if ( !aNewValue.hasValue()
+ || ( !sNewValue.getLength() // an empty string
+ && m_bEmptyIsNull // which should be interpreted as NULL
+ )
+ )
+ {
m_xColumnUpdate->updateNull();
+ }
else
{
OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" );
@@ -703,8 +712,9 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
return sal_False;
}
}
- m_aSaveValue = sNewValue;
+ m_aLastKnownValue = aNewValue;
}
+
return sal_True;
}
@@ -713,19 +723,33 @@ Any OEditModel::translateDbColumnToControlValue()
{
OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::translateDbColumnToControlValue: no value formatter!" );
if ( m_pValueFormatter.get() )
- m_aSaveValue = m_pValueFormatter->getFormattedValue();
- else
- m_aSaveValue = ::rtl::OUString();
-
- // #i2817# OJ
- sal_uInt16 nMaxTextLen = getINT16( m_xAggregateSet->getPropertyValue( PROPERTY_MAXTEXTLEN ) );
- if ( nMaxTextLen && m_aSaveValue.getLength() > nMaxTextLen )
{
- sal_Int32 nDiff = m_aSaveValue.getLength() - nMaxTextLen;
- m_aSaveValue = m_aSaveValue.replaceAt( nMaxTextLen, nDiff, ::rtl::OUString() );
+ ::rtl::OUString sValue( m_pValueFormatter->getFormattedValue() );
+ if ( !sValue.getLength()
+ && m_pValueFormatter->getColumn().is()
+ && m_pValueFormatter->getColumn()->wasNull()
+ )
+ {
+ m_aLastKnownValue.clear();
+ }
+ else
+ {
+ // #i2817# OJ
+ sal_uInt16 nMaxTextLen = getINT16( m_xAggregateSet->getPropertyValue( PROPERTY_MAXTEXTLEN ) );
+ if ( nMaxTextLen && sValue.getLength() > nMaxTextLen )
+ {
+ sal_Int32 nDiff = sValue.getLength() - nMaxTextLen;
+ sValue = sValue.replaceAt( nMaxTextLen, nDiff, ::rtl::OUString() );
+ }
+
+ m_aLastKnownValue <<= sValue;
+ }
}
+ else
+ m_aLastKnownValue.clear();
- return makeAny( m_aSaveValue );
+ return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() );
+ // (m_aLastKnownValue is alllowed to be VOID, the control value isn't)
}
//------------------------------------------------------------------------------
diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx
index cc7c5f769a7c..cb8d5c6300e4 100644
--- a/forms/source/component/Edit.hxx
+++ b/forms/source/component/Edit.hxx
@@ -47,7 +47,7 @@ namespace frm
class OEditModel
:public OEditBaseModel
{
- ::rtl::OUString m_aSaveValue;
+ ::com::sun::star::uno::Any m_aLastKnownValue;
::std::auto_ptr< ::dbtools::FormattedColumnValue >
m_pValueFormatter;
sal_Bool m_bMaxTextLenModified : 1; // set to <TRUE/> when we change the MaxTextLen of the aggregate
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index e1447853c4bd..5465b1199eaa 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -1151,10 +1151,12 @@ OBoundControlModel::OBoundControlModel(
:OControlModel( _rxFactory, _rUnoControlModelTypeName, _rDefault, sal_False )
,OPropertyChangeListener( m_aMutex )
,m_nValuePropertyAggregateHandle( -1 )
+ ,m_nFieldType( DataType::OTHER )
,m_bValuePropertyMayBeVoid( false )
,m_aUpdateListeners(m_aMutex)
,m_aResetListeners(m_aMutex)
,m_aFormComponentListeners( m_aMutex )
+ ,m_bInputRequired( sal_True )
,m_pAggPropMultiplexer( NULL )
,m_bLoadListening( sal_False )
,m_bLoaded(sal_False)
@@ -1182,11 +1184,13 @@ OBoundControlModel::OBoundControlModel(
:OControlModel( _pOriginal, _rxFactory, sal_True, sal_False )
,OPropertyChangeListener( m_aMutex )
,m_nValuePropertyAggregateHandle( _pOriginal->m_nValuePropertyAggregateHandle )
+ ,m_nFieldType( DataType::OTHER )
,m_bValuePropertyMayBeVoid( _pOriginal->m_bValuePropertyMayBeVoid )
,m_aUpdateListeners( m_aMutex )
,m_aResetListeners( m_aMutex )
,m_aFormComponentListeners( m_aMutex )
,m_xValidator( _pOriginal->m_xValidator )
+ ,m_bInputRequired( sal_True )
,m_pAggPropMultiplexer( NULL )
,m_bLoadListening( sal_False )
,m_bLoaded( sal_False )
@@ -1212,6 +1216,7 @@ OBoundControlModel::OBoundControlModel(
m_bValuePropertyMayBeVoid = _pOriginal->m_bValuePropertyMayBeVoid;
m_aValuePropertyType = _pOriginal->m_aValuePropertyType;
m_aControlSource = _pOriginal->m_aControlSource;
+ m_bInputRequired = _pOriginal->m_bInputRequired;
// m_xLabelControl, though being a property, is not to be cloned, not even the reference will be transfered.
// (the former should be clear - a clone of the object we're only referencing does not make sense)
// (the second would violate the restriction for label controls that they're part of the
@@ -1380,9 +1385,9 @@ void OBoundControlModel::disposing()
// TODO: could we replace the following 5 lines with a call to disconnectDatabaseColumn?
// The only more thing which it does is calling onDisconnectedDbColumn - could this
// cause trouble? At least when we continue to call OControlModel::disposing before, it *may*.
- if ( m_xField.is() )
+ if ( hasField() )
{
- m_xField->removePropertyChangeListener( PROPERTY_VALUE, this );
+ getField()->removePropertyChangeListener( PROPERTY_VALUE, this );
resetField();
}
m_xCursor = NULL;
@@ -1497,7 +1502,7 @@ void SAL_CALL OBoundControlModel::setParent(const Reference<XInterface>& _rxPare
void SAL_CALL OBoundControlModel::disposing(const com::sun::star::lang::EventObject& _rEvent) throw (RuntimeException)
{
::osl::ClearableMutexGuard aGuard( m_aMutex );
- if ( _rEvent.Source == m_xField )
+ if ( _rEvent.Source == getField() )
{
resetField();
}
@@ -1653,6 +1658,9 @@ void OBoundControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) co
{
switch (nHandle)
{
+ case PROPERTY_ID_INPUT_REQUIRED:
+ rValue <<= m_bInputRequired;
+ break;
case PROPERTY_ID_CONTROLSOURCEPROPERTY:
rValue <<= m_sValuePropertyName;
break;
@@ -1660,7 +1668,7 @@ void OBoundControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) co
rValue <<= m_aControlSource;
break;
case PROPERTY_ID_BOUNDFIELD:
- rValue <<= m_xField;
+ rValue <<= getField();
break;
case PROPERTY_ID_CONTROLLABEL:
if (!m_xLabelControl.is())
@@ -1683,12 +1691,15 @@ sal_Bool OBoundControlModel::convertFastPropertyValue(
sal_Bool bModified(sal_False);
switch (_nHandle)
{
+ case PROPERTY_ID_INPUT_REQUIRED:
+ bModified = tryPropertyValue( _rConvertedValue, _rOldValue, _rValue, m_bInputRequired );
+ break;
case PROPERTY_ID_CONTROLSOURCE:
bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aControlSource);
break;
case PROPERTY_ID_BOUNDFIELD:
- bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_xField);
- break;
+ DBG_ERROR( "OBoundControlModel::convertFastPropertyValue: BoundField should be a read-only property !" );
+ throw com::sun::star::lang::IllegalArgumentException();
case PROPERTY_ID_CONTROLLABEL:
if (!_rValue.hasValue())
{ // property set to void
@@ -1716,6 +1727,10 @@ Any OBoundControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const
Any aDefault;
switch ( _nHandle )
{
+ case PROPERTY_ID_INPUT_REQUIRED:
+ aDefault <<= sal_Bool( sal_True );
+ break;
+
case PROPERTY_ID_CONTROLSOURCE:
aDefault <<= ::rtl::OUString();
break;
@@ -1732,9 +1747,11 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co
{
switch (nHandle)
{
+ case PROPERTY_ID_INPUT_REQUIRED:
+ OSL_VERIFY( rValue >>= m_bInputRequired );
+ break;
case PROPERTY_ID_CONTROLSOURCE:
- DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "invalid type" );
- rValue >>= m_aControlSource;
+ OSL_VERIFY( rValue >>= m_aControlSource );
break;
case PROPERTY_ID_BOUNDFIELD:
DBG_ERROR("OBoundControlModel::setFastPropertyValue_NoBroadcast : BoundField should be a read-only property !");
@@ -1817,7 +1834,7 @@ void SAL_CALL OBoundControlModel::propertyChange( const PropertyChangeEvent& evt
// if the DBColumn value changed, transfer it to the control
if ( evt.PropertyName.equals( PROPERTY_VALUE ) )
{
- OSL_ENSURE( evt.Source == m_xField, "OBoundControlModel::propertyChange: value changes from components other than our database colum?" );
+ OSL_ENSURE( evt.Source == getField(), "OBoundControlModel::propertyChange: value changes from components other than our database colum?" );
osl::MutexGuard aGuard(m_aMutex);
if ( m_bForwardValueChanges && m_xColumn.is() )
transferDbValueToControl();
@@ -1888,7 +1905,7 @@ sal_Bool SAL_CALL OBoundControlModel::commit() throw(RuntimeException)
OSL_ENSURE( !hasExternalValueBinding(), "OBoundControlModel::commit: control flow broken!" );
// we reach this only if we're not working with an external binding
- if ( !m_xField.is() )
+ if ( !hasField() )
return sal_True;
::cppu::OInterfaceIteratorHelper aIter( m_aUpdateListeners );
@@ -1931,6 +1948,7 @@ void OBoundControlModel::resetField()
m_xColumnUpdate.clear();
m_xColumn.clear();
m_xField.clear();
+ m_nFieldType = DataType::OTHER;
}
//------------------------------------------------------------------------------
@@ -1959,46 +1977,46 @@ sal_Bool OBoundControlModel::connectToField(const Reference<XRowSet>& rForm)
}
}
- // darf ich mich ueberhaupt an dieses Feld binden (Typ-Check)
- if (xFieldCandidate.is())
- {
- sal_Int32 nFieldType = 0;
- xFieldCandidate->getPropertyValue(PROPERTY_FIELDTYPE) >>= nFieldType;
- if (approveDbColumnType(nFieldType))
- setField(xFieldCandidate,sal_False);
- }
- else
- setField(NULL,sal_False);
-
- if (m_xField.is())
+ try
{
- if(m_xField->getPropertySetInfo()->hasPropertyByName(PROPERTY_VALUE))
+ if ( xFieldCandidate.is() )
{
- // an wertaenderungen horchen
- m_xField->addPropertyChangeListener( PROPERTY_VALUE, this );
- m_xColumnUpdate = Reference< XColumnUpdate >( m_xField, UNO_QUERY );
- m_xColumn = Reference< XColumn >( m_xField, UNO_QUERY );
-
- INT32 nNullableFlag = ColumnValue::NO_NULLS;
- m_xField->getPropertyValue(PROPERTY_ISNULLABLE) >>= nNullableFlag;
- m_bRequired = (ColumnValue::NO_NULLS == nNullableFlag);
- // we're optimistic : in case of ColumnValue_NULLABLE_UNKNOWN we assume nullability ....
+ sal_Int32 nFieldType = 0;
+ xFieldCandidate->getPropertyValue( PROPERTY_FIELDTYPE ) >>= nFieldType;
+ if ( approveDbColumnType( nFieldType ) )
+ {
+ m_xField = xFieldCandidate;
+ m_xField->addPropertyChangeListener( PROPERTY_VALUE, this );
+ m_nFieldType = nFieldType;
+
+ // listen to value changes
+ m_xColumnUpdate = Reference< XColumnUpdate >( m_xField, UNO_QUERY );
+ m_xColumn = Reference< XColumn >( m_xField, UNO_QUERY );
+
+ INT32 nNullableFlag = ColumnValue::NO_NULLS;
+ m_xField->getPropertyValue( PROPERTY_ISNULLABLE ) >>= nNullableFlag;
+ m_bRequired = ( ColumnValue::NO_NULLS == nNullableFlag );
+ // we're optimistic : in case of ColumnValue_NULLABLE_UNKNOWN we assume nullability ....
+ }
}
else
- {
- OSL_ENSURE(sal_False, "OBoundControlModel::connectToField: property NAME not supported!");
- setField(NULL,sal_False);
- }
+ resetField();
+
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ resetField();
}
}
- return m_xField.is();
+ return hasField();
}
//------------------------------------------------------------------------------
void OBoundControlModel::initFromField( const Reference< XRowSet >& _rxRowSet )
{
// but only if the rowset if posisitioned on a valid record
- if ( m_xField.is() && _rxRowSet.is() )
+ if ( hasField() && _rxRowSet.is() )
{
if ( !_rxRowSet->isBeforeFirst() && !_rxRowSet->isAfterLast() )
transferDbValueToControl();
@@ -2035,12 +2053,12 @@ void OBoundControlModel::connectDatabaseColumn( const Reference< XRowSet >& _rxR
::osl::MutexGuard aGuard( m_aMutex );
// consistency checks
- DBG_ASSERT( !( m_xField.is() && !_bFromReload ),
+ DBG_ASSERT( !( hasField() && !_bFromReload ),
"OBoundControlModel::connectDatabaseColumn: the form is just *loaded*, but we already have a field!" );
(void)_bFromReload;
- Reference< XPropertySet > xOldField = m_xField;
- if ( !m_xField.is() )
+ Reference< XPropertySet > xOldField = getField();
+ if ( !hasField() )
{
// connect to the column
connectToField( _rxRowSet );
@@ -2055,12 +2073,12 @@ void OBoundControlModel::connectDatabaseColumn( const Reference< XRowSet >& _rxR
onConnectedDbColumn( _rxRowSet );
// initially transfer the db column value to the control, if we successfully connected to a database column
- if ( m_xField.is() )
+ if ( hasField() )
initFromField( _rxRowSet );
- if ( xOldField != m_xField )
+ if ( xOldField != getField() )
{
- Any aNewValue; aNewValue <<= m_xField;
+ Any aNewValue; aNewValue <<= getField();
Any aOldValue; aOldValue <<= xOldField;
sal_Int32 nHandle = PROPERTY_ID_BOUNDFIELD;
OPropertySetHelper::fire(&nHandle, &aNewValue, &aOldValue, 1, sal_False);
@@ -2076,9 +2094,9 @@ void OBoundControlModel::disconnectDatabaseColumn( )
// let derived classes react on this
onDisconnectedDbColumn();
- if ( m_xField.is() )
+ if ( hasField() )
{
- m_xField->removePropertyChangeListener( PROPERTY_VALUE, this );
+ getField()->removePropertyChangeListener( PROPERTY_VALUE, this );
resetField();
}
@@ -2394,24 +2412,6 @@ void OBoundControlModel::reset() throw (RuntimeException)
m_aResetListeners.notifyEach( &XResetListener::resetted, aResetEvent );
}
-// -----------------------------------------------------------------------------
-void OBoundControlModel::setField( const Reference< XPropertySet>& _rxField,sal_Bool _bFire )
-{
- DBG_ASSERT( !hasExternalValueBinding(), "OBoundControlModel::setField: We have an external value binding!" );
-
- // fire a property change event
- if ( m_xField != _rxField )
- {
- Any aOldValue; aOldValue <<= m_xField;
- m_xField = _rxField;
- if ( _bFire )
- {
- Any aNewValue; aNewValue <<= _rxField;
- sal_Int32 nHandle = PROPERTY_ID_BOUNDFIELD;
- OPropertySetHelper::fire(&nHandle, &aNewValue, &aOldValue, 1, sal_False);
- }
- }
-}
//--------------------------------------------------------------------
sal_Bool OBoundControlModel::impl_approveValueBinding_nolock( const Reference< XValueBinding >& _rxBinding )
{
@@ -2893,11 +2893,12 @@ void OBoundControlModel::recheckValidity( bool _bForceNotification )
//------------------------------------------------------------------------------
void OBoundControlModel::describeFixedProperties( Sequence< Property >& _rProps ) const
{
- BEGIN_DESCRIBE_PROPERTIES( 4, OControlModel )
+ BEGIN_DESCRIBE_PROPERTIES( 5, OControlModel )
DECL_PROP1 ( CONTROLSOURCE, ::rtl::OUString, BOUND );
DECL_IFACE_PROP3( BOUNDFIELD, XPropertySet, BOUND, READONLY, TRANSIENT );
DECL_IFACE_PROP2( CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID );
DECL_PROP2 ( CONTROLSOURCEPROPERTY, ::rtl::OUString, READONLY, TRANSIENT );
+ DECL_BOOL_PROP1 ( INPUT_REQUIRED, BOUND );
END_DESCRIBE_PROPERTIES()
}
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index 263a64ef4a87..00a8de08a5ef 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -458,7 +458,6 @@ Sequence< Type > OFormattedModel::_getTypes()
::rtl::OUString SAL_CALL OFormattedModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException)
{
return ::rtl::OUString(FRM_COMPONENT_EDIT);
-// return ::rtl::OUString(FRM_COMPONENT_FORMATTEDFIELD); // old (non-sun) name for compatibility !
}
// XPropertySet
@@ -1032,14 +1031,13 @@ sal_uInt16 OFormattedModel::getPersistenceFlags() const
sal_Bool OFormattedModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aControlValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
- if ( !compare( aControlValue, m_aSaveValue ) )
+ if ( aControlValue != m_aSaveValue )
{
// Leerstring + EmptyIsNull = void
if ( !aControlValue.hasValue()
|| ( ( aControlValue.getValueType().getTypeClass() == TypeClass_STRING )
&& ( getString( aControlValue ).getLength() == 0 )
&& m_bEmptyIsNull
- && !isRequired()
)
)
m_xColumnUpdate->updateNull();
diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 5655faee06d6..6376f0401a6e 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -32,14 +32,12 @@
#include "precompiled_forms.hxx"
#include "ImageControl.hxx"
-#ifndef _FRM_PROPERTY_HRC_
#include "property.hrc"
-#endif
-#ifndef _FRM_RESOURCE_HRC_
#include "frm_resource.hrc"
-#endif
#include "frm_resource.hxx"
#include "services.hxx"
+#include "componenttools.hxx"
+
#include <svtools/imageresourceaccess.hxx>
#include <unotools/ucblockbytes.hxx>
#include <sfx2/filedlghelper.hxx>
@@ -57,6 +55,7 @@
#include <com/sun/star/io/NotConnectedException.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/graphic/GraphicObject.hpp>
#include <tools/urlobj.hxx>
#include <tools/stream.hxx>
#include <tools/debug.hxx>
@@ -66,6 +65,7 @@
#include <comphelper/extract.hxx>
#include <comphelper/guarding.hxx>
#include <unotools/ucbstreamhelper.hxx>
+#include <svtools/urihelper.hxx>
#include <memory>
@@ -90,12 +90,49 @@ using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::graphic;
+using namespace ::com::sun::star::frame;
-//==================================================================
+//==============================================================================
+//= OImageControlModel
+//==============================================================================
+namespace
+{
+ enum ImageStoreType
+ {
+ ImageStoreBinary,
+ ImageStoreLink,
+
+ ImageStoreInvalid
+ };
+
+ ImageStoreType lcl_getImageStoreType( const sal_Int32 _nFieldType )
+ {
+ // binary/longvarchar types could be used to store images in binary representation
+ if ( ( _nFieldType == DataType::BINARY )
+ || ( _nFieldType == DataType::VARBINARY )
+ || ( _nFieldType == DataType::LONGVARBINARY )
+ || ( _nFieldType == DataType::OTHER )
+ || ( _nFieldType == DataType::OBJECT )
+ || ( _nFieldType == DataType::BLOB )
+ || ( _nFieldType == DataType::LONGVARCHAR )
+ )
+ return ImageStoreBinary;
+
+ // char types could be used to store links to images
+ if ( ( _nFieldType == DataType::CHAR )
+ || ( _nFieldType == DataType::VARCHAR )
+ )
+ return ImageStoreLink;
+
+ return ImageStoreInvalid;
+ }
+}
+
+//==============================================================================
// OImageControlModel
-//==================================================================
+//==============================================================================
-//------------------------------------------------------------------
+//------------------------------------------------------------------------------
InterfaceRef SAL_CALL OImageControlModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
{
return *(new OImageControlModel(_rxFactory));
@@ -144,8 +181,8 @@ OImageControlModel::OImageControlModel( const OImageControlModel* _pOriginal, co
::rtl::OUString sImageURL;
aImageURL >>= sImageURL;
- ::osl::MutexGuard aGuard( m_aMutex ); // handleNewImageURL expects this
- handleNewImageURL( sImageURL, eOther );
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_handleNewImageURL_lck( sImageURL, eOther );
}
osl_decrementInterlockedCount( &m_refCount );
}
@@ -203,15 +240,9 @@ Any SAL_CALL OImageControlModel::queryAggregation(const Type& _rType) throw (Run
}
//------------------------------------------------------------------------------
-sal_Bool OImageControlModel::approveDbColumnType(sal_Int32 _nColumnType)
+sal_Bool OImageControlModel::approveDbColumnType( sal_Int32 _nColumnType )
{
- // zulaessing sind die binary Typen, OTHER- und LONGVARCHAR-Felder
- if ((_nColumnType == DataType::BINARY) || (_nColumnType == DataType::VARBINARY)
- || (_nColumnType == DataType::LONGVARBINARY) || (_nColumnType == DataType::OTHER)
- || (_nColumnType == DataType::LONGVARCHAR))
- return sal_True;
-
- return sal_False;
+ return ImageStoreInvalid != lcl_getImageStoreType( _nColumnType );
}
@@ -229,8 +260,8 @@ void OImageControlModel::_propertyChanged( const PropertyChangeEvent& _rEvent )
::rtl::OUString sImageURL;
_rEvent.NewValue >>= sImageURL;
- ::osl::MutexGuard aGuard( m_aMutex ); // handleNewImageURL expects this
- handleNewImageURL( sImageURL, eOther );
+ ::osl::MutexGuard aGuard( m_aMutex );
+ impl_handleNewImageURL_lck( sImageURL, eOther );
}
}
@@ -339,30 +370,22 @@ void OImageControlModel::read(const Reference<XObjectInputStream>& _rxInStream)
}
//------------------------------------------------------------------------------
-sal_Bool OImageControlModel::handleNewImageURL( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator )
+sal_Bool OImageControlModel::impl_updateStreamForURL_lck( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator )
{
- // if the image URL has been set, we have to forward this to the image producer
- // xInStream erzeugen
- Reference< XActiveDataSink > xSink(
- m_xServiceFactory->createInstance(
- ::rtl::OUString::createFromAscii( "com.sun.star.io.ObjectInputStream" ) ), UNO_QUERY );
- if ( !xSink.is() )
- return sal_False;
-
// create a stream for the image specified by the URL
::std::auto_ptr< SvStream > pImageStream;
Reference< XInputStream > xImageStream;
- if ( ::svt::ImageResourceAccess::isImageResourceURL( _rURL ) )
+ if ( ::svt::GraphicAccess::isSupportedURL( _rURL ) )
{
- xImageStream = ::svt::ImageResourceAccess::getImageXStream( getORB(), _rURL );
+ xImageStream = ::svt::GraphicAccess::getImageXStream( getORB(), _rURL );
}
else
{
pImageStream.reset( ::utl::UcbStreamHelper::CreateStream( _rURL, STREAM_READ ) );
sal_Bool bSetNull = ( pImageStream.get() == NULL ) || ( ERRCODE_NONE != pImageStream->GetErrorCode() );
- if (!bSetNull)
+ if ( !bSetNull )
{
// get the size of the stream
pImageStream->Seek(STREAM_SEEK_TO_END);
@@ -377,31 +400,53 @@ sal_Bool OImageControlModel::handleNewImageURL( const ::rtl::OUString& _rURL, Va
if ( xImageStream.is() )
{
- xSink->setInputStream( xImageStream );
- Reference< XInputStream > xInStream(xSink, UNO_QUERY);
-
if ( m_xColumnUpdate.is() )
- updateColumnWithStream( xInStream );
+ m_xColumnUpdate->updateBinaryStream( xImageStream, xImageStream->available() );
else
- setControlValue( makeAny( xInStream ), _eInstigator );
+ setControlValue( makeAny( xImageStream ), _eInstigator );
+ xImageStream->closeInput();
+ return sal_True;
+ }
- // close the stream, just to be on the safe side (should have been done elsewhere ...)
- try
- {
- xInStream->closeInput();
- }
- catch (NotConnectedException&)
+ return sal_False;
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OImageControlModel::impl_handleNewImageURL_lck( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator )
+{
+ switch ( lcl_getImageStoreType( getFieldType() ) )
+ {
+ case ImageStoreBinary:
+ if ( impl_updateStreamForURL_lck( _rURL, _eInstigator ) )
+ return sal_True;
+ break;
+
+ case ImageStoreLink:
+ {
+ ::rtl::OUString sCommitURL( _rURL );
+ if ( m_sDocumentURL.getLength() )
+ sCommitURL = URIHelper::simpleNormalizedMakeRelative( m_sDocumentURL, sCommitURL );
+ OSL_ENSURE( m_xColumnUpdate.is(), "OImageControlModel::impl_handleNewImageURL_lck: no bound field, but ImageStoreLink?!" );
+ if ( m_xColumnUpdate.is() )
{
+ m_xColumnUpdate->updateString( sCommitURL );
+ return sal_True;
}
}
- else
- {
- if ( m_xColumnUpdate.is() )
- updateColumnWithStream( NULL );
- else
- setControlValue( Any(), _eInstigator );
+ break;
+
+ case ImageStoreInvalid:
+ OSL_ENSURE( false, "OImageControlModel::impl_handleNewImageURL_lck: invalid current field type!" );
+ break;
}
+ // if we're here, then the above code was unable to update our field/control from the given URL
+ // => fall back to NULL/VOID
+ if ( m_xColumnUpdate.is() )
+ m_xColumnUpdate->updateNull();
+ else
+ setControlValue( Any(), _eInstigator );
+
return sal_True;
}
@@ -412,7 +457,8 @@ sal_Bool OImageControlModel::commitControlValueToDbColumn( bool _bPostReset )
{
// since this is a "commit after reset", we can simply update the column
// with null - this is our "default" which we were just reset to
- updateColumnWithStream( NULL );
+ if ( m_xColumnUpdate.is() )
+ m_xColumnUpdate->updateNull();
}
else
{
@@ -420,34 +466,77 @@ sal_Bool OImageControlModel::commitControlValueToDbColumn( bool _bPostReset )
::rtl::OUString sImageURL;
m_xAggregateSet->getPropertyValue( PROPERTY_IMAGE_URL ) >>= sImageURL;
- return handleNewImageURL( sImageURL, eDbColumnBinding );
+ return impl_handleNewImageURL_lck( sImageURL, eDbColumnBinding );
}
return sal_True;
}
//------------------------------------------------------------------------------
-void OImageControlModel::updateColumnWithStream( const Reference< XInputStream >& _rxStream )
+namespace
{
- OSL_PRECOND( m_xColumnUpdate.is(), "OImageControlModel::updateColumnWithStream: no column update interface!" );
- if ( m_xColumnUpdate.is() )
+ bool lcl_isValidDocumentURL( const ::rtl::OUString& _rDocURL )
{
- if ( _rxStream.is() )
- m_xColumnUpdate->updateBinaryStream( _rxStream, _rxStream->available() );
- else
- m_xColumnUpdate->updateNull();
+ return ( _rDocURL.getLength() && !_rDocURL.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "private:object" ) ) );
+ }
+}
+
+//------------------------------------------------------------------------------
+void OImageControlModel::onConnectedDbColumn( const Reference< XInterface >& _rxForm )
+{
+ OBoundControlModel::onConnectedDbColumn( _rxForm );
- // note that this will fire a value change for the column, which
- // will result in us (our base class, actually) syncing the
- // db column content to our control content - finally, this will arrive
- // in setControlValue
+ try
+ {
+ Reference< XModel > xDocument( getXModel( *this ) );
+ if ( xDocument.is() )
+ {
+ m_sDocumentURL = xDocument->getURL();
+ if ( !lcl_isValidDocumentURL( m_sDocumentURL ) )
+ {
+ Reference< XChild > xAsChild( xDocument, UNO_QUERY );
+ while ( xAsChild.is() && !lcl_isValidDocumentURL( m_sDocumentURL ) )
+ {
+ xDocument.set( xAsChild->getParent(), UNO_QUERY );
+ if ( xDocument.is() )
+ m_sDocumentURL = xDocument->getURL();
+ xAsChild.set( xDocument, UNO_QUERY );
+ }
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
}
//------------------------------------------------------------------------------
+void OImageControlModel::onDisconnectedDbColumn()
+{
+ OBoundControlModel::onDisconnectedDbColumn();
+
+ m_sDocumentURL = ::rtl::OUString();
+}
+
+//------------------------------------------------------------------------------
Any OImageControlModel::translateDbColumnToControlValue()
{
- return makeAny( m_xColumn->getBinaryStream() );
+ switch ( lcl_getImageStoreType( getFieldType() ) )
+ {
+ case ImageStoreBinary: return makeAny( m_xColumn->getBinaryStream() );
+ case ImageStoreLink:
+ {
+ ::rtl::OUString sImageLink( m_xColumn->getString() );
+ if ( m_sDocumentURL.getLength() )
+ sImageLink = INetURLObject::GetAbsURL( m_sDocumentURL, sImageLink );
+ return makeAny( sImageLink );
+ }
+ case ImageStoreInvalid:
+ OSL_ENSURE( false, "OImageControlModel::translateDbColumnToControlValue: invalid field type!" );
+ break;
+ }
+ return Any();
}
//------------------------------------------------------------------------------
@@ -457,20 +546,46 @@ void OImageControlModel::doSetControlValue( const Any& _rValue )
if ( !GetImageProducer() || !m_xImageProducer.is() )
return;
- // give the image producer the stream
- Reference< XInputStream > xInStream;
- _rValue >>= xInStream;
- GetImageProducer()->setImage( xInStream );
+ bool bStartProduction = false;
+ switch ( lcl_getImageStoreType( getFieldType() ) )
+ {
+ case ImageStoreBinary:
+ {
+ // give the image producer the stream
+ Reference< XInputStream > xInStream;
+ _rValue >>= xInStream;
+ GetImageProducer()->setImage( xInStream );
+ bStartProduction = true;
+ }
+ break;
- // and start production
- Reference< XImageProducer > xProducer = m_xImageProducer;
+ case ImageStoreLink:
{
- // release our mutex once (it's acquired in the calling method!), as starting the image production may
- // result in the locking of the solar mutex (unfortunally the default implementation of our aggregate,
- // VCLXImageControl, does this locking)
- // FS - 74438 - 30.03.00
- MutexRelease aRelease(m_aMutex);
- xProducer->startProduction();
+ ::rtl::OUString sImageURL;
+ _rValue >>= sImageURL;
+ GetImageProducer()->SetImage( sImageURL );
+ bStartProduction = true;
+ }
+ break;
+
+ case ImageStoreInvalid:
+ OSL_ENSURE( false, "OImageControlModel::doSetControlValue: invalid field type!" );
+ break;
+
+ } // switch ( lcl_getImageStoreType( getFieldType() ) )
+
+ if ( bStartProduction )
+ {
+ // start production
+ Reference< XImageProducer > xProducer = m_xImageProducer;
+ {
+ // release our mutex once (it's acquired in the calling method!), as starting the image production may
+ // result in the locking of the solar mutex (unfortunally the default implementation of our aggregate,
+ // VCLXImageControl, does this locking)
+ // FS - 74438 - 30.03.00
+ MutexRelease aRelease(m_aMutex);
+ xProducer->startProduction();
+ }
}
}
@@ -647,7 +762,24 @@ void OImageControlControl::implInsertGraphics()
if ( xController.is() )
{
xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True));
- xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
+
+ Reference<XPropertySet> xBoundField;
+ if ( hasProperty( PROPERTY_BOUNDFIELD, xSet ) )
+ xSet->getPropertyValue( PROPERTY_BOUNDFIELD ) >>= xBoundField;
+ sal_Bool bHasField = xBoundField.is();
+
+ // if the control is bound to a DB field, then it's not possible to decide whether or not to link
+ xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, !bHasField );
+
+ // if the control is bound to a DB field, then linking of the image depends on the type of the field
+ sal_Bool bImageIsLinked = sal_True;
+ if ( bHasField )
+ {
+ sal_Int32 nFieldType = DataType::OTHER;
+ OSL_VERIFY( xBoundField->getPropertyValue( PROPERTY_FIELDTYPE ) >>= nFieldType );
+ bImageIsLinked = ( lcl_getImageStoreType( nFieldType ) == ImageStoreLink );
+ }
+ xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, makeAny( bImageIsLinked ) );
}
if ( ERRCODE_NONE == aDialog.Execute() )
@@ -655,8 +787,21 @@ void OImageControlControl::implInsertGraphics()
// reset the url property in case it already has the value we're about to set - in this case
// our propertyChanged would not get called without this.
implClearGraphics( sal_False );
-
- xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( aDialog.GetPath() ) ) );
+ sal_Bool bIsLink = sal_False;
+ xController->getValue(ExtendedFilePickerElementIds::CHECKBOX_LINK, 0) >>= bIsLink;
+ if ( !bIsLink )
+ {
+ Graphic aGraphic;
+ aDialog.GetGraphic( aGraphic );
+
+ Reference< graphic::XGraphicObject > xGrfObj = graphic::GraphicObject::create( m_aContext.getUNOContext() );
+ xGrfObj->setGraphic( aGraphic.GetXGraphic() );
+ rtl::OUString sObjectID( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
+ sObjectID = sObjectID + xGrfObj->getUniqueID();
+ xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( sObjectID ) ) );
+ }
+ else
+ xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( aDialog.GetPath() ) ) );
}
}
catch(Exception&)
@@ -779,19 +924,16 @@ void OImageControlControl::mousePressed(const ::com::sun::star::awt::MouseEvent&
//------------------------------------------------------------------------------
void SAL_CALL OImageControlControl::mouseReleased(const awt::MouseEvent& /*e*/) throw ( RuntimeException )
{
- // TODO: place your code here
}
//------------------------------------------------------------------------------
void SAL_CALL OImageControlControl::mouseEntered(const awt::MouseEvent& /*e*/) throw ( RuntimeException )
{
- // TODO: place your code here
}
//------------------------------------------------------------------------------
void SAL_CALL OImageControlControl::mouseExited(const awt::MouseEvent& /*e*/) throw ( RuntimeException )
{
- // TODO: place your code here
}
diff --git a/forms/source/component/ImageControl.hxx b/forms/source/component/ImageControl.hxx
index 9a2d5e84f4fc..9c43484006c3 100644
--- a/forms/source/component/ImageControl.hxx
+++ b/forms/source/component/ImageControl.hxx
@@ -60,6 +60,7 @@ class OImageControlModel
::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer> m_xImageProducer;
ImageProducer* m_pImageProducer;
sal_Bool m_bReadOnly;
+ ::rtl::OUString m_sDocumentURL;
protected:
// UNO Anbindung
@@ -114,6 +115,8 @@ public:
protected:
// OBoundControlModel overridables
+ virtual void onConnectedDbColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxForm );
+ virtual void onDisconnectedDbColumn();
virtual ::com::sun::star::uno::Any
translateDbColumnToControlValue( );
virtual sal_Bool commitControlValueToDbColumn( bool _bPostReset );
@@ -129,21 +132,16 @@ protected:
void implConstruct();
- /** updates the database column we're bound to with the given stream
-
- <p>If the stream is <NULL/>, then XColumnUpdate::updateNull will be called for the
- column.</p>
-
- @precond
- m_xColumnUpdate is not <NULL/>
- */
- void updateColumnWithStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& _rxStream );
-
/** displays the image described by the given URL
@precond
our own mutex is locked
*/
- sal_Bool handleNewImageURL( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator );
+ sal_Bool impl_handleNewImageURL_lck( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator );
+
+ /** updates the binary stream, created from loading the file which the given URL points to, into our
+ bound field, or the control itself if there is no bound field
+ */
+ sal_Bool impl_updateStreamForURL_lck( const ::rtl::OUString& _rURL, ValueChangeInstigator _eInstigator );
};
//==================================================================
diff --git a/forms/source/component/Pattern.cxx b/forms/source/component/Pattern.cxx
index 05276fb54fb5..64f5ea0e5e75 100644
--- a/forms/source/component/Pattern.cxx
+++ b/forms/source/component/Pattern.cxx
@@ -167,13 +167,21 @@ void OPatternModel::describeFixedProperties( Sequence< Property >& _rProps ) con
//------------------------------------------------------------------------------
sal_Bool OPatternModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
- ::rtl::OUString sNewValue;
- m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) >>= sNewValue;
+ Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
- if ( sNewValue != m_aSaveValue )
+ if ( aNewValue != m_aLastKnownValue )
{
- if ( !sNewValue.getLength() && !isRequired() && m_bEmptyIsNull )
+ ::rtl::OUString sNewValue;
+ aNewValue >>= sNewValue;
+
+ if ( !aNewValue.hasValue()
+ || ( !sNewValue.getLength() // an empty string
+ && m_bEmptyIsNull // which should be interpreted as NULL
+ )
+ )
+ {
m_xColumnUpdate->updateNull();
+ }
else
{
OSL_ENSURE( m_pFormattedValue.get(), "OPatternModel::commitControlValueToDbColumn: no value helper!" );
@@ -183,8 +191,10 @@ sal_Bool OPatternModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
if ( !m_pFormattedValue->setFormattedValue( sNewValue ) )
return sal_False;
}
- m_aSaveValue = sNewValue;
+
+ m_aLastKnownValue = aNewValue;
}
+
return sal_True;
}
@@ -212,11 +222,27 @@ void OPatternModel::onDisconnectedDbColumn()
Any OPatternModel::translateDbColumnToControlValue()
{
OSL_PRECOND( m_pFormattedValue.get(), "OPatternModel::translateDbColumnToControlValue: no value helper!" );
+
if ( m_pFormattedValue.get() )
- m_aSaveValue = m_pFormattedValue->getFormattedValue();
+ {
+ ::rtl::OUString sValue( m_pFormattedValue->getFormattedValue() );
+ if ( !sValue.getLength()
+ && m_pFormattedValue->getColumn().is()
+ && m_pFormattedValue->getColumn()->wasNull()
+ )
+ {
+ m_aLastKnownValue.clear();
+ }
+ else
+ {
+ m_aLastKnownValue <<= sValue;
+ }
+ }
else
- m_aSaveValue = ::rtl::OUString();
- return makeAny( m_aSaveValue );
+ m_aLastKnownValue.clear();
+
+ return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() );
+ // (m_aLastKnownValue is alllowed to be VOID, the control value isn't)
}
// XReset
diff --git a/forms/source/component/Pattern.hxx b/forms/source/component/Pattern.hxx
index e6dd36820b2f..8b2bf3b878c2 100644
--- a/forms/source/component/Pattern.hxx
+++ b/forms/source/component/Pattern.hxx
@@ -49,9 +49,9 @@ class OPatternModel
:public OEditBaseModel
{
private:
- ::rtl::OUString m_aSaveValue;
+ ::com::sun::star::uno::Any m_aLastKnownValue;
::std::auto_ptr< ::dbtools::FormattedColumnValue >
- m_pFormattedValue;
+ m_pFormattedValue;
protected:
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx
index 06f25866e871..b9738ddd49ae 100644
--- a/forms/source/component/clickableimage.cxx
+++ b/forms/source/component/clickableimage.cxx
@@ -33,6 +33,7 @@
#include "clickableimage.hxx"
#include "controlfeatureinterception.hxx"
#include "urltransformer.hxx"
+#include "componenttools.hxx"
#include <com/sun/star/form/XSubmit.hpp>
#include <com/sun/star/awt/SystemPointer.hpp>
#include <com/sun/star/form/FormComponentType.hpp>
@@ -52,7 +53,7 @@
#include "services.hxx"
#include <comphelper/container.hxx>
#include <comphelper/listenernotification.hxx>
-
+#include <svtools/imageresourceaccess.hxx>
#define LOCAL_URL_PREFIX '#'
//.........................................................................
@@ -169,25 +170,6 @@ namespace frm
}
//------------------------------------------------------------------------------
- Reference< XModel > OClickableImageBaseControl::getXModel(const InterfaceRef& xIface) const
- {
- Reference< XModel > xModel(xIface, UNO_QUERY);
- if (xModel.is())
- return xModel;
- else
- {
- Reference<XChild> xChild(xIface, UNO_QUERY);
- if (xChild.is())
- {
- InterfaceRef xParent = xChild->getParent();
- return getXModel(xParent);
- }
- else
- return NULL;
- }
- }
-
- //------------------------------------------------------------------------------
OImageProducerThread_Impl* OClickableImageBaseControl::getImageProducerThread()
{
if ( !m_pThread )
@@ -705,15 +687,20 @@ namespace frm
void OClickableImageBaseModel::StartProduction()
{
ImageProducer *pImgProd = GetImageProducer();
+ // grab the ImageURL
+ rtl::OUString sURL;
+ getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ) ) >>= sURL;
if (!m_pMedium)
{
- // caution: the medium may be NULL if somebody gave us a invalid URL to work with
- // 11/24/2000 - 79667 - FS
- pImgProd->SetImage(String());
+ if ( ::svt::GraphicAccess::isSupportedURL( sURL ) )
+ pImgProd->SetImage( sURL );
+ else
+ // caution: the medium may be NULL if somebody gave us a invalid URL to work with
+ // 11/24/2000 - 79667 - FS
+ pImgProd->SetImage(String());
m_bDownloading = sal_False;
return;
}
-
if (m_pMedium->GetErrorCode()==0)
{
SvStream* pStream = m_pMedium->GetInStream();
@@ -749,8 +736,8 @@ namespace frm
// we treat an invalid URL like we would treat no URL
return;
- if (rURL.getLength())
- {
+ if (rURL.getLength() && !::svt::GraphicAccess::isSupportedURL( rURL ) )
+ {
if (m_pMedium)
delete m_pMedium;
@@ -860,6 +847,8 @@ namespace frm
}
else
{
+ if ( ::svt::GraphicAccess::isSupportedURL( rURL ) )
+ GetImageProducer()->SetImage( rURL );
GetImageProducer()->startProduction();
}
}
diff --git a/forms/source/component/clickableimage.hxx b/forms/source/component/clickableimage.hxx
index 4c507477b885..d59451fe0fb7 100644
--- a/forms/source/component/clickableimage.hxx
+++ b/forms/source/component/clickableimage.hxx
@@ -239,8 +239,6 @@ namespace frm
virtual void SAL_CALL releaseDispatchProviderInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel(const InterfaceRef& xIface) const;
-
virtual void actionPerformed_Impl( sal_Bool bNotifyListener, const ::com::sun::star::awt::MouseEvent& rEvt );
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > _getTypes();
diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx
index f04f6816ce5d..3c6bb979d54a 100644
--- a/forms/source/component/imgprod.cxx
+++ b/forms/source/component/imgprod.cxx
@@ -267,9 +267,9 @@ void ImageProducer::SetImage( const ::rtl::OUString& rPath )
mbAsync = sal_False;
delete mpStm;
- if ( ::svt::ImageResourceAccess::isImageResourceURL( maURL ) )
+ if ( ::svt::GraphicAccess::isSupportedURL( maURL ) )
{
- mpStm = ::svt::ImageResourceAccess::getImageStream( ::comphelper::getProcessServiceFactory(), maURL );
+ mpStm = ::svt::GraphicAccess::getImageStream( ::comphelper::getProcessServiceFactory(), maURL );
}
else if( maURL.getLength() )
{
diff --git a/forms/source/inc/FormComponent.hxx b/forms/source/inc/FormComponent.hxx
index 7ee8e98f96d0..4b79262caf30 100644
--- a/forms/source/inc/FormComponent.hxx
+++ b/forms/source/inc/FormComponent.hxx
@@ -560,11 +560,9 @@ protected:
};
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
- m_xField;
-
::rtl::OUString m_sValuePropertyName;
sal_Int32 m_nValuePropertyAggregateHandle;
+ sal_Int32 m_nFieldType;
::com::sun::star::uno::Type m_aValuePropertyType;
bool m_bValuePropertyMayBeVoid;
@@ -582,6 +580,9 @@ private:
::rtl::OUString m_aControlSource; // Datenquelle, Name des Feldes
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
m_xLabelControl; // reference to a sibling control (model) which is our label
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xField;
+ sal_Bool m_bInputRequired;
// </properties>
::comphelper::OPropertyChangeMultiplexer*
@@ -904,7 +905,6 @@ protected:
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes();
- void setField( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxField,sal_Bool _bFire=sal_True);
inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getField() const
{
return m_xField;
@@ -913,6 +913,10 @@ protected:
{
return m_xField.is();
}
+ inline sal_Int32 getFieldType() const
+ {
+ return m_nFieldType;
+ }
// OControlModel's property handling
virtual void describeFixedProperties(
diff --git a/forms/source/inc/componenttools.hxx b/forms/source/inc/componenttools.hxx
index b766480de243..f15a4fc528dc 100644
--- a/forms/source/inc/componenttools.hxx
+++ b/forms/source/inc/componenttools.hxx
@@ -34,6 +34,7 @@
/** === begin UNO includes === **/
#include <com/sun/star/uno/Type.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/frame/XModel.hpp>
/** === end UNO includes === **/
#include <set>
@@ -94,6 +95,9 @@ namespace frm
TypeSequence getTypes() const;
};
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
+
//........................................................................
} // namespace frm
//........................................................................
diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx
index 4e95a8ab201e..572bacf46ae4 100644
--- a/forms/source/inc/frm_strings.hxx
+++ b/forms/source/inc/frm_strings.hxx
@@ -219,6 +219,7 @@ namespace frm
FORMS_CONSTASCII_STRING( PROPERTY_HELPURL, "HelpURL" );
FORMS_CONSTASCII_STRING( PROPERTY_RECORDMARKER, "HasRecordMarker" );
FORMS_CONSTASCII_STRING( PROPERTY_BOUNDFIELD, "BoundField" );
+ FORMS_CONSTASCII_STRING( PROPERTY_INPUT_REQUIRED, "InputRequired" );
FORMS_CONSTASCII_STRING( PROPERTY_TREATASNUMERIC, "TreatAsNumber" );
FORMS_CONSTASCII_STRING( PROPERTY_EFFECTIVE_VALUE, "EffectiveValue" );
FORMS_CONSTASCII_STRING( PROPERTY_EFFECTIVE_DEFAULT, "EffectiveDefault" );
diff --git a/forms/source/inc/property.hrc b/forms/source/inc/property.hrc
index fbe6659b2db1..c7d05d28f2ee 100644
--- a/forms/source/inc/property.hrc
+++ b/forms/source/inc/property.hrc
@@ -60,6 +60,7 @@ namespace frm
#define PROPERTY_ID_ALLOWEDITS (PROPERTY_ID_START + 16)
#define PROPERTY_ID_ALLOWDELETIONS (PROPERTY_ID_START + 17)
#define PROPERTY_ID_NATIVE_LOOK (PROPERTY_ID_START + 18)
+#define PROPERTY_ID_INPUT_REQUIRED (PROPERTY_ID_START + 19)
// free
// free
// free
diff --git a/forms/source/misc/componenttools.cxx b/forms/source/misc/componenttools.cxx
index 2859f0dd2802..21740749d4d4 100644
--- a/forms/source/misc/componenttools.cxx
+++ b/forms/source/misc/componenttools.cxx
@@ -33,6 +33,7 @@
#include "componenttools.hxx"
/** === begin UNO includes === **/
+#include <com/sun/star/container/XChild.hpp>
/** === end UNO includes === **/
#include <algorithm>
@@ -43,6 +44,14 @@ namespace frm
{
//........................................................................
+ /** === begin UNO using === **/
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::container::XChild;
+ /** === end UNO using === **/
+
//====================================================================
//= TypeBag
//====================================================================
@@ -85,6 +94,20 @@ namespace frm
return aTypes;
}
+ //====================================================================
+ Reference< XModel > getXModel( const Reference< XInterface >& _rxComponent )
+ {
+ Reference< XInterface > xParent = _rxComponent;
+ Reference< XModel > xModel( xParent, UNO_QUERY );;
+ while ( xParent.is() && !xModel.is() )
+ {
+ Reference< XChild > xChild( xParent, UNO_QUERY );
+ xParent.set( xChild.is() ? xChild->getParent() : Reference< XInterface >(), UNO_QUERY );
+ xModel.set( xParent, UNO_QUERY );
+ }
+ return xModel;
+ }
+
//........................................................................
} // namespace frm
//........................................................................
diff --git a/forms/source/misc/property.cxx b/forms/source/misc/property.cxx
index df2bbf5831cc..b8c5defa8263 100644
--- a/forms/source/misc/property.cxx
+++ b/forms/source/misc/property.cxx
@@ -202,6 +202,7 @@ void PropertyInfoService::initialize()
ADD_PROP_ASSIGNMENT(HELPURL);
ADD_PROP_ASSIGNMENT(RECORDMARKER);
ADD_PROP_ASSIGNMENT(BOUNDFIELD);
+ ADD_PROP_ASSIGNMENT(INPUT_REQUIRED);
ADD_PROP_ASSIGNMENT(TREATASNUMERIC);
ADD_PROP_ASSIGNMENT(EFFECTIVE_VALUE);
ADD_PROP_ASSIGNMENT(EFFECTIVE_DEFAULT);
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
index d00128161ad6..91b78f52855a 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.agenda;
+ ************************************************************************/
+package com.sun.star.wizards.agenda;
import java.util.Calendar;
import java.util.Hashtable;
@@ -65,7 +66,6 @@ import com.sun.star.wizards.text.TextSectionHandler;
import com.sun.star.wizards.ui.UnoDialog2;
import com.sun.star.wizards.ui.event.DataAware;
-
/**
*
* The classes here implement the whole document-functionality of the agenda wizard:
@@ -111,6 +111,7 @@ import com.sun.star.wizards.ui.event.DataAware;
*/
public class AgendaTemplate extends TextDocument implements TemplateConsts, DataAware.Listener
{
+
/**
* resources.
*/
@@ -121,17 +122,14 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* Exception: topic data is written programatically, event-oriented.
*/
CGAgenda agenda;
-
/**
* the UNO Text Document serrvice
*/
Object document;
-
/**
* Service Factory
*/
XMultiServiceFactory docMSF;
-
/**
* The template-filename of the current template.
* Since we often re-link section and the break the link,
@@ -139,7 +137,6 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* This is practically an identicall copy of the current template.
*/
String template;
-
/**
* used for common operations on sections.
*/
@@ -148,18 +145,15 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* a component loader.
*/
XComponentLoader xComponentLoader;
-
/**
* an array containing all ItemTable object (which control each an Items
* Table in the document.
*/
ItemsTable[] itemsTables;
-
/**
* the controller of the topics table.
*/
Topics topics;
-
/**
* Stores reusable OOo Placeholder TextFields to insert to the document.
*/
@@ -171,13 +165,10 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* the controller is retrieved from this Map, and a redraw is issued on this controller.
*/
Map itemsMap = new Hashtable(11);
-
/**
* A temporary variable used to list all items and map them.
*/
List _allItems = new Vector();
-
-
/**
* keep a reference on some static items in the document,
* so when their content is changed (through the user), we
@@ -185,19 +176,16 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
TextElement teTitle, teDate, teTime, teLocation;
XTextRange trTitle, trDate, trTime, trLocation;
-
/**
* used to format the date / time.
*/
int dateFormat, timeFormat;
XNumberFormatter dateFormatter, timeFormatter;
-
/**
* used to transfare time from VCL to UNO.
*/
long docNullTime;
Calendar calendar;
-
/**
* used to set the document title property (step 6).
*/
@@ -210,10 +198,11 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @see AgendaTemplate.initialize()
* @see AgendaTemplate.initializeData()
*/
- public synchronized void load(String templateURL, List topics) {
+ public synchronized void load(String templateURL, List topics)
+ {
template = calcTemplateName(templateURL);
- document = loadAsPreview(templateURL,false);
- docMSF = ((XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,document));
+ document = loadAsPreview(templateURL, false);
+ docMSF = ((XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document));
xFrame.getComponentWindow().setEnable(false);
xTextDocument.lockControllers();
initialize();
@@ -221,7 +210,6 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
xTextDocument.unlockControllers();
}
-
/**
* The agenda templates are in format of aw-XXX.ott
* the templates name is then XXX.ott.
@@ -229,8 +217,9 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param url
* @return the template name without the "aw-" at the beginning.
*/
- private String calcTemplateName(String url) {
- return FileAccess.connectURLs( FileAccess.getParentDir(url) ,FileAccess.getFilename(url).substring(3));
+ private String calcTemplateName(String url)
+ {
+ return FileAccess.connectURLs(FileAccess.getParentDir(url), FileAccess.getFilename(url).substring(3));
}
/**
@@ -241,12 +230,16 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* information (it is only actualized on save) the given list
* supplies this information.
*/
- private void initializeData(List topicsData) {
- for (int i = 0; i < itemsTables.length; i++) {
- try {
+ private void initializeData(List topicsData)
+ {
+ for (int i = 0; i < itemsTables.length; i++)
+ {
+ try
+ {
itemsTables[i].write("");
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -267,14 +260,18 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* The table is being found, in which the item is, and redrawn.
* @param itemName
*/
- public synchronized void redraw(String itemName) {
- try {
+ public synchronized void redraw(String itemName)
+ {
+ try
+ {
// get the table in which the item is...
Object itemsTable =
- itemsMap.get(itemName);
+ itemsMap.get(itemName);
// rewrite the table.
- ((ItemsTable)itemsTable).write(null);
- } catch (Exception e) {
+ ((ItemsTable) itemsTable).write(null);
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
@@ -283,8 +280,9 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* update the documents title property to the given title
* @param newTitle new title.
*/
- synchronized void setTemplateTitle(String newTitle) {
- Helper.setUnoPropertyValue(docInfo, "Title", newTitle );
+ synchronized void setTemplateTitle(String newTitle)
+ {
+ Helper.setUnoPropertyValue(docInfo, "Title", newTitle);
}
/**
@@ -294,15 +292,17 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param agenda_ the data model (CGAgenda)
* @param resources_ resources.
*/
- AgendaTemplate(XMultiServiceFactory xmsf_, CGAgenda agenda_ , AgendaWizardDialogResources resources_, XTerminateListener listener) {
+ AgendaTemplate(XMultiServiceFactory xmsf_, CGAgenda agenda_, AgendaWizardDialogResources resources_, XTerminateListener listener)
+ {
super(xmsf_, listener, "WIZARD_LIVE_PREVIEW");
agenda = agenda_;
resources = resources_;
if (itemsCache == null)
+ {
initItemsCache();
-
+ }
_allItems = null;
}
@@ -313,32 +313,56 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param itemName a string representing an Item (name or heading).
* @return true if the model specifies that the item should be displayed.
*/
- boolean isShowItem(String itemName) {
- if ( itemName.equals(FILLIN_MEETING_TYPE) )
+ boolean isShowItem(String itemName)
+ {
+ if (itemName.equals(FILLIN_MEETING_TYPE))
+ {
return agenda.cp_ShowMeetingType;
- else if ( itemName.equals(FILLIN_READ) )
+ }
+ else if (itemName.equals(FILLIN_READ))
+ {
return agenda.cp_ShowRead;
- else if ( itemName.equals(FILLIN_BRING) )
+ }
+ else if (itemName.equals(FILLIN_BRING))
+ {
return agenda.cp_ShowBring;
- else if ( itemName.equals(FILLIN_NOTES) )
+ }
+ else if (itemName.equals(FILLIN_NOTES))
+ {
return agenda.cp_ShowNotes;
-
- else if ( itemName.equals(FILLIN_FACILITATOR) )
+ }
+ else if (itemName.equals(FILLIN_FACILITATOR))
+ {
return agenda.cp_ShowFacilitator;
- else if ( itemName.equals(FILLIN_TIMEKEEPER) )
+ }
+ else if (itemName.equals(FILLIN_TIMEKEEPER))
+ {
return agenda.cp_ShowTimekeeper;
- else if ( itemName.equals(FILLIN_NOTETAKER) )
+ }
+ else if (itemName.equals(FILLIN_NOTETAKER))
+ {
return agenda.cp_ShowNotetaker;
- else if ( itemName.equals(FILLIN_PARTICIPANTS) )
+ }
+ else if (itemName.equals(FILLIN_PARTICIPANTS))
+ {
return agenda.cp_ShowAttendees;
- else if ( itemName.equals(FILLIN_CALLED_BY) )
+ }
+ else if (itemName.equals(FILLIN_CALLED_BY))
+ {
return agenda.cp_ShowCalledBy;
- else if ( itemName.equals(FILLIN_OBSERVERS) )
+ }
+ else if (itemName.equals(FILLIN_OBSERVERS))
+ {
return agenda.cp_ShowObservers;
- else if ( itemName.equals(FILLIN_RESOURCE_PERSONS) )
+ }
+ else if (itemName.equals(FILLIN_RESOURCE_PERSONS))
+ {
return agenda.cp_ShowResourcePersons;
- else throw new IllegalArgumentException("No such item");
-
+ }
+ else
+ {
+ throw new IllegalArgumentException("No such item");
+ }
}
/**
@@ -347,57 +371,58 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* A cache is used in order to reuse the objects, instead of recreate them.
* This method fills the cache will all items objects (names and headings).
*/
- private void initItemsCache() {
+ private void initItemsCache()
+ {
itemsCache = new Hashtable(11);
- XMultiServiceFactory xmsf = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,document);
+ XMultiServiceFactory xmsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
// Headings
- itemsCache.put( FILLIN_MEETING_TYPE ,
- new AgendaItem(FILLIN_MEETING_TYPE, new TextElement( resources.itemMeetingType , STYLE_MEETING_TYPE ) ,
- new PlaceholderElement( STYLE_MEETING_TYPE_TEXT , resources.reschkMeetingTitle_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_MEETING_TYPE,
+ new AgendaItem(FILLIN_MEETING_TYPE, new TextElement(resources.itemMeetingType, STYLE_MEETING_TYPE),
+ new PlaceholderElement(STYLE_MEETING_TYPE_TEXT, resources.reschkMeetingTitle_value, resources.resPlaceHolderHint, xmsf)));
- itemsCache.put( FILLIN_BRING ,
- new AgendaItem( FILLIN_BRING,new TextElement( resources.itemBring , STYLE_BRING ) ,
- new PlaceholderElement( STYLE_BRING_TEXT , resources.reschkBring_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_BRING,
+ new AgendaItem(FILLIN_BRING, new TextElement(resources.itemBring, STYLE_BRING),
+ new PlaceholderElement(STYLE_BRING_TEXT, resources.reschkBring_value, resources.resPlaceHolderHint, xmsf)));
- itemsCache.put( FILLIN_READ ,
- new AgendaItem( FILLIN_READ, new TextElement( resources.itemRead , STYLE_READ ) ,
- new PlaceholderElement( STYLE_READ_TEXT , resources.reschkRead_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_READ,
+ new AgendaItem(FILLIN_READ, new TextElement(resources.itemRead, STYLE_READ),
+ new PlaceholderElement(STYLE_READ_TEXT, resources.reschkRead_value, resources.resPlaceHolderHint, xmsf)));
- itemsCache.put( FILLIN_NOTES ,
- new AgendaItem( FILLIN_NOTES, new TextElement( resources.itemNote , STYLE_NOTES ) ,
- new PlaceholderElement( STYLE_NOTES_TEXT , resources.reschkNotes_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_NOTES,
+ new AgendaItem(FILLIN_NOTES, new TextElement(resources.itemNote, STYLE_NOTES),
+ new PlaceholderElement(STYLE_NOTES_TEXT, resources.reschkNotes_value, resources.resPlaceHolderHint, xmsf)));
// Names
- itemsCache.put( FILLIN_CALLED_BY ,
- new AgendaItem( FILLIN_CALLED_BY, new TextElement( resources.itemCalledBy , STYLE_CALLED_BY ) ,
- new PlaceholderElement( STYLE_CALLED_BY_TEXT , resources.reschkConvenedBy_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_CALLED_BY,
+ new AgendaItem(FILLIN_CALLED_BY, new TextElement(resources.itemCalledBy, STYLE_CALLED_BY),
+ new PlaceholderElement(STYLE_CALLED_BY_TEXT, resources.reschkConvenedBy_value, resources.resPlaceHolderHint, xmsf)));
- itemsCache.put( FILLIN_FACILITATOR ,
- new AgendaItem( FILLIN_FACILITATOR, new TextElement( resources.itemFacilitator , STYLE_FACILITATOR ) ,
- new PlaceholderElement( STYLE_FACILITATOR_TEXT , resources.reschkPresiding_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_FACILITATOR,
+ new AgendaItem(FILLIN_FACILITATOR, new TextElement(resources.itemFacilitator, STYLE_FACILITATOR),
+ new PlaceholderElement(STYLE_FACILITATOR_TEXT, resources.reschkPresiding_value, resources.resPlaceHolderHint, xmsf)));
- itemsCache.put( FILLIN_PARTICIPANTS,
- new AgendaItem( FILLIN_PARTICIPANTS, new TextElement( resources.itemAttendees , STYLE_PARTICIPANTS ) ,
- new PlaceholderElement( STYLE_PARTICIPANTS_TEXT , resources.reschkAttendees_value , resources.resPlaceHolderHint, xmsf )) );
+ itemsCache.put(FILLIN_PARTICIPANTS,
+ new AgendaItem(FILLIN_PARTICIPANTS, new TextElement(resources.itemAttendees, STYLE_PARTICIPANTS),
+ new PlaceholderElement(STYLE_PARTICIPANTS_TEXT, resources.reschkAttendees_value, resources.resPlaceHolderHint, xmsf)));
- itemsCache.put( FILLIN_NOTETAKER ,
- new AgendaItem( FILLIN_NOTETAKER,new TextElement( resources.itemNotetaker, STYLE_NOTETAKER ) ,
- new PlaceholderElement( STYLE_NOTETAKER_TEXT , resources.reschkNoteTaker_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_NOTETAKER,
+ new AgendaItem(FILLIN_NOTETAKER, new TextElement(resources.itemNotetaker, STYLE_NOTETAKER),
+ new PlaceholderElement(STYLE_NOTETAKER_TEXT, resources.reschkNoteTaker_value, resources.resPlaceHolderHint, xmsf)));
- itemsCache.put( FILLIN_TIMEKEEPER ,
- new AgendaItem( FILLIN_TIMEKEEPER, new TextElement( resources.itemTimekeeper , STYLE_TIMEKEEPER ) ,
- new PlaceholderElement( STYLE_TIMEKEEPER_TEXT , resources.reschkTimekeeper_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_TIMEKEEPER,
+ new AgendaItem(FILLIN_TIMEKEEPER, new TextElement(resources.itemTimekeeper, STYLE_TIMEKEEPER),
+ new PlaceholderElement(STYLE_TIMEKEEPER_TEXT, resources.reschkTimekeeper_value, resources.resPlaceHolderHint, xmsf)));
- itemsCache.put( FILLIN_OBSERVERS ,
- new AgendaItem( FILLIN_OBSERVERS,new TextElement( resources.itemObservers , STYLE_OBSERVERS ),
- new PlaceholderElement( STYLE_OBSERVERS_TEXT , resources.reschkObservers_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_OBSERVERS,
+ new AgendaItem(FILLIN_OBSERVERS, new TextElement(resources.itemObservers, STYLE_OBSERVERS),
+ new PlaceholderElement(STYLE_OBSERVERS_TEXT, resources.reschkObservers_value, resources.resPlaceHolderHint, xmsf)));
- itemsCache.put( FILLIN_RESOURCE_PERSONS ,
- new AgendaItem( FILLIN_RESOURCE_PERSONS, new TextElement( resources.itemResource , STYLE_RESOURCE_PERSONS ) ,
- new PlaceholderElement( STYLE_RESOURCE_PERSONS_TEXT , resources.reschkResourcePersons_value , resources.resPlaceHolderHint, xmsf ) ) );
+ itemsCache.put(FILLIN_RESOURCE_PERSONS,
+ new AgendaItem(FILLIN_RESOURCE_PERSONS, new TextElement(resources.itemResource, STYLE_RESOURCE_PERSONS),
+ new PlaceholderElement(STYLE_RESOURCE_PERSONS_TEXT, resources.reschkResourcePersons_value, resources.resPlaceHolderHint, xmsf)));
}
@@ -418,34 +443,36 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/*
* Get the default locale of the document, and create the date and time formatters.
*/
- XMultiServiceFactory docMSF = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,document);
- try {
+ XMultiServiceFactory docMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+ try
+ {
Object defaults = docMSF.createInstance("com.sun.star.text.Defaults");
- Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
+ Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
java.util.Locale jl = new java.util.Locale(
- l.Language , l.Country, l.Variant );
+ l.Language, l.Country, l.Variant);
calendar = Calendar.getInstance(jl);
- XNumberFormatsSupplier nfs = (XNumberFormatsSupplier)UnoRuntime.queryInterface(XNumberFormatsSupplier.class,document);
+ XNumberFormatsSupplier nfs = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document);
Object formatSettings = nfs.getNumberFormatSettings();
- com.sun.star.util.Date date = (com.sun.star.util.Date)Helper.getUnoPropertyValue( formatSettings, "NullDate");
+ com.sun.star.util.Date date = (com.sun.star.util.Date) Helper.getUnoPropertyValue(formatSettings, "NullDate");
- calendar.set(date.Year, date.Month - 1 , date.Day);
+ calendar.set(date.Year, date.Month - 1, date.Day);
docNullTime = JavaTools.getTimeInMillis(calendar);
- dateFormat = NumberFormatter.getNumberFormatterKey( nfs, NumberFormatIndex.DATE_SYSTEM_LONG );
- timeFormat = NumberFormatter.getNumberFormatterKey( nfs, NumberFormatIndex.TIME_HHMM );
+ dateFormat = NumberFormatter.getNumberFormatterKey(nfs, NumberFormatIndex.DATE_SYSTEM_LONG);
+ timeFormat = NumberFormatter.getNumberFormatterKey(nfs, NumberFormatIndex.TIME_HHMM);
- dateFormatter = NumberFormatter.createNumberFormatter(xMSF, nfs );
- timeFormatter = NumberFormatter.createNumberFormatter(xMSF, nfs );
+ dateFormatter = NumberFormatter.createNumberFormatter(xMSF, nfs);
+ timeFormatter = NumberFormatter.createNumberFormatter(xMSF, nfs);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
- throw new NullPointerException ("Fatal Error: could not initialize locale or date/time formats.");
+ throw new NullPointerException("Fatal Error: could not initialize locale or date/time formats.");
}
/*
@@ -457,8 +484,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
initializeItems();
initializeTitles();
initializeItemsSections();
- XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,document);
- textSectionHandler = new TextSectionHandler(xMultiServiceFactory, (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class,document));
+ XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+ textSectionHandler = new TextSectionHandler(xMultiServiceFactory, (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, document));
initializeTopics();
_allItems.clear();
_allItems = null;
@@ -468,31 +495,37 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* locates the titles (name, location, date, time) and saves a reference to thier Text ranges.
*
*/
- private void initializeTitles() {
+ private void initializeTitles()
+ {
XTextRange item = null;
- XMultiServiceFactory xmsf = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,document);
+ XMultiServiceFactory xmsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
- for (int i = 0; i < _allItems.size(); i++) {
- item = (XTextRange)_allItems.get(i);
+ for (int i = 0; i < _allItems.size(); i++)
+ {
+ item = (XTextRange) _allItems.get(i);
String text = item.getString().trim().toLowerCase();
- if (text.equals(FILLIN_TITLE)) {
+ if (text.equals(FILLIN_TITLE))
+ {
teTitle = new PlaceholderTextElement(item, resources.resPlaceHolderTitle, resources.resPlaceHolderHint, xmsf);
trTitle = item;
_allItems.remove(i--);
}
- else if (text.equals(FILLIN_DATE)) {
+ else if (text.equals(FILLIN_DATE))
+ {
teDate = new PlaceholderTextElement(item, resources.resPlaceHolderDate, resources.resPlaceHolderHint, xmsf);
trDate = item;
_allItems.remove(i--);
}
- else if (text.equals(FILLIN_TIME)) {
+ else if (text.equals(FILLIN_TIME))
+ {
teTime = new PlaceholderTextElement(item, resources.resPlaceHolderTime, resources.resPlaceHolderHint, xmsf);
trTime = item;
_allItems.remove(i--);
}
- else if (text.equals(FILLIN_LOCATION)) {
+ else if (text.equals(FILLIN_LOCATION))
+ {
teLocation = new PlaceholderTextElement(item, resources.resPlaceHolderLocation, resources.resPlaceHolderHint, xmsf);
trLocation = item;
_allItems.remove(i--);
@@ -514,9 +547,11 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* searches the document for items in the format "&gt;*&lt;"
* @return a vector containing the XTextRanges of the found items
*/
- private List searchFillInItems() {
- try {
- XSearchable xSearchable = (XSearchable)UnoRuntime.queryInterface(XSearchable.class,document);
+ private List searchFillInItems()
+ {
+ try
+ {
+ XSearchable xSearchable = (XSearchable) UnoRuntime.queryInterface(XSearchable.class, document);
XSearchDescriptor sd = xSearchable.createSearchDescriptor();
sd.setSearchString("<[^>]+>");
sd.setPropertyValue("SearchRegularExpression", Boolean.TRUE);
@@ -525,16 +560,21 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
XIndexAccess ia = xSearchable.findAll(sd);
List l = new Vector(ia.getCount());
- for (int i = 0; i<ia.getCount(); i++) {
- try {
- l.add((XTextRange)UnoRuntime.queryInterface(XTextRange.class,ia.getByIndex(i)));
- } catch (Exception ex) {
+ for (int i = 0; i < ia.getCount(); i++)
+ {
+ try
+ {
+ l.add((XTextRange) UnoRuntime.queryInterface(XTextRange.class, ia.getByIndex(i)));
+ }
+ catch (Exception ex)
+ {
System.err.println("Nonfatal Error in finding fillins.");
}
}
return l;
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed");
}
@@ -551,11 +591,14 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
// for each section - there is a table...
itemsTables = new ItemsTable[sections.length];
- for (int i = 0; i < itemsTables.length; i++) {
- try {
+ for (int i = 0; i < itemsTables.length; i++)
+ {
+ try
+ {
itemsTables[i] = new ItemsTable(getSection(sections[i]), getTable(sections[i]));
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
throw new IllegalArgumentException("Fatal Error while initialilzing Template: items table in section " + sections[i]);
}
@@ -570,17 +613,16 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
return getNamesWhichStartWith(allSections, s);
}
-
Object getSection(String name) throws NoSuchElementException, WrappedTargetException
{
XTextSectionsSupplier xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, document);
- return ((Any)(xTextSectionsSupplier.getTextSections().getByName(name))).getObject();
+ return ((Any) (xTextSectionsSupplier.getTextSections().getByName(name))).getObject();
}
Object getTable(String name) throws NoSuchElementException, WrappedTargetException
{
XTextTablesSupplier xTextTablesSupplier = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, document);
- return ((Any)xTextTablesSupplier.getTextTables().getByName(name)).getObject();
+ return ((Any) xTextTablesSupplier.getTextTables().getByName(name)).getObject();
}
/**
@@ -588,70 +630,87 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* called when title/date/time or location are
* changed.
*/
- public synchronized void eventPerformed(Object param) {
- TextEvent te = (TextEvent)param;
- String controlName = (String)Helper.getUnoPropertyValue(
+ public synchronized void eventPerformed(Object param)
+ {
+ TextEvent te = (TextEvent) param;
+ String controlName = (String) Helper.getUnoPropertyValue(
UnoDialog2.getModel(te.Source),
"Name");
redrawTitle(controlName);
}
- private synchronized void redrawTitle(String controlName) {
+ private synchronized void redrawTitle(String controlName)
+ {
if (controlName.equals("txtTitle"))
+ {
writeTitle(teTitle, trTitle, agenda.cp_Title);
- else if (controlName.equals("txtDate")) {
- writeTitle(teDate, trDate, getDateString(agenda.cp_Date));}
+ }
+ else if (controlName.equals("txtDate"))
+ {
+ writeTitle(teDate, trDate, getDateString(agenda.cp_Date));
+ }
else if (controlName.equals("txtTime"))
+ {
writeTitle(teTime, trTime, getTimeString(agenda.cp_Time));
+ }
else if (controlName.equals("cbLocation"))
+ {
writeTitle(teLocation, trLocation, agenda.cp_Location);
- else throw new IllegalArgumentException("No such title control...");
+ }
+ else
+ {
+ throw new IllegalArgumentException("No such title control...");
+ }
}
-
- private void writeTitle( TextElement te, XTextRange tr, String text) {
+ private void writeTitle(TextElement te, XTextRange tr, String text)
+ {
te.text = (text == null ? "" : text);
te.write(tr);
}
- private static long DAY_IN_MILLIS = ( 24 * 60 * 60 * 1000 );
+ private static long DAY_IN_MILLIS = (24 * 60 * 60 * 1000);
- private String getDateString(String d) {
+ private String getDateString(String d)
+ {
if (d == null || d.equals(""))
+ {
return "";
-
+ }
int date = new Integer(d).intValue();
calendar.clear();
- calendar.set( date / 10000 ,
- ( date % 10000 ) / 100 - 1 ,
- date % 100 ) ;
+ calendar.set(date / 10000,
+ (date % 10000) / 100 - 1,
+ date % 100);
long date1 = JavaTools.getTimeInMillis(calendar);
/*
* docNullTime and date1 are in millis, but
* I need a day...
*/
- double daysDiff = ( date1 - docNullTime ) / DAY_IN_MILLIS + 1;
+ double daysDiff = (date1 - docNullTime) / DAY_IN_MILLIS + 1;
return dateFormatter.convertNumberToString(dateFormat, daysDiff);
}
- private String getTimeString(String s) {
+ private String getTimeString(String s)
+ {
if (s == null || s.equals(""))
+ {
return "";
+ }
int time = new Integer(s).intValue();
- double t = ( (double) ( time / 1000000 ) / 24 ) + ( (double) ( ( time % 1000000 ) / 1000 ) / ( 24 * 60 ) );
+ double t = ((double) (time / 1000000) / 24) + ((double) ((time % 1000000) / 1000) / (24 * 60));
return timeFormatter.convertNumberToString(timeFormat, t);
}
-
/* *******************************************
* F I N I S H
*********************************************/
-
/** the user clicked finish **/
- public synchronized void finish(List topics) {
+ public synchronized void finish(List topics)
+ {
createMinutes(topics);
deleteHiddenSections();
textSectionHandler.removeAllTextSections();
@@ -662,21 +721,25 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* user specified not to display any items which it contains.
* When finishing the wizard removes this sections entireley from the document.
*/
- private void deleteHiddenSections() {
+ private void deleteHiddenSections()
+ {
XTextSectionsSupplier xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, document);
String[] allSections = xTextSectionsSupplier.getTextSections().getElementNames();
- try {
- for (int i = 0; i<allSections.length; i++) {
+ try
+ {
+ for (int i = 0; i < allSections.length; i++)
+ {
Object section = getSection(allSections[i]);
//Try3.showProps(section);
- boolean visible = ((Boolean)Helper.getUnoPropertyValue(section,"IsVisible")).booleanValue();
- if ( !visible )
- ((XTextContent)UnoRuntime.queryInterface(XTextContent.class,section)).getAnchor().setString("");
-
-
+ boolean visible = ((Boolean) Helper.getUnoPropertyValue(section, "IsVisible")).booleanValue();
+ if (!visible)
+ {
+ ((XTextContent) UnoRuntime.queryInterface(XTextContent.class, section)).getAnchor().setString("");
+ }
}
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -687,47 +750,65 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* specified not to create minuts, the minutes section will be removed,
* @param topicsData supplies PropertyValue arrays containing the values for the topics.
*/
- public synchronized void createMinutes(List topicsData) {
+ public synchronized void createMinutes(List topicsData)
+ {
// if the minutes section should be removed (the
// user did not check "create minutes")
- if (!agenda.cp_IncludeMinutes || (topicsData.size() <= 1)) {
- try {
+ if (!agenda.cp_IncludeMinutes || (topicsData.size() <= 1))
+ {
+ try
+ {
Object minutesAllSection = getSection(SECTION_MINUTES_ALL);
- XTextSection xTextSection = (XTextSection)UnoRuntime.queryInterface(XTextSection.class,minutesAllSection);
+ XTextSection xTextSection = (XTextSection) UnoRuntime.queryInterface(XTextSection.class, minutesAllSection);
xTextSection.getAnchor().setString("");
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
// the user checked "create minutes"
- else {
- try {
+ else
+ {
+ try
+ {
String itemText;
XTextRange item;
int topicStartTime = 0;
- try {
+ try
+ {
topicStartTime = new Integer(agenda.cp_Time).intValue();
}
- catch (Exception ex) {}
+ catch (Exception ex)
+ {
+ }
String time;
// first I replace the minutes titles...
List items = searchFillInItems();
- for ( int itemIndex = 0; itemIndex < items.size(); itemIndex++) {
- item = (XTextRange)items.get(itemIndex);
+ for (int itemIndex = 0; itemIndex < items.size(); itemIndex++)
+ {
+ item = (XTextRange) items.get(itemIndex);
itemText = item.getString().trim().toLowerCase();
- if ( itemText.equals( FILLIN_MINUTES_TITLE ))
- fillMinutesItem( item , agenda.cp_Title , resources.resPlaceHolderTitle);
- else if ( itemText.equals( FILLIN_MINUTES_LOCATION))
- fillMinutesItem( item , agenda.cp_Location , resources.resPlaceHolderLocation);
- else if ( itemText.equals( FILLIN_MINUTES_DATE ))
- fillMinutesItem( item , getDateString ( agenda.cp_Date ) , resources.resPlaceHolderDate );
- else if ( itemText.equals( FILLIN_MINUTES_TIME ))
- fillMinutesItem( item , getTimeString ( agenda.cp_Time ) , resources.resPlaceHolderTime );
+ if (itemText.equals(FILLIN_MINUTES_TITLE))
+ {
+ fillMinutesItem(item, agenda.cp_Title, resources.resPlaceHolderTitle);
+ }
+ else if (itemText.equals(FILLIN_MINUTES_LOCATION))
+ {
+ fillMinutesItem(item, agenda.cp_Location, resources.resPlaceHolderLocation);
+ }
+ else if (itemText.equals(FILLIN_MINUTES_DATE))
+ {
+ fillMinutesItem(item, getDateString(agenda.cp_Date), resources.resPlaceHolderDate);
+ }
+ else if (itemText.equals(FILLIN_MINUTES_TIME))
+ {
+ fillMinutesItem(item, getTimeString(agenda.cp_Time), resources.resPlaceHolderTime);
+ }
}
items.clear();
@@ -739,48 +820,65 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*
* topics data has *always* an empty topic at the end...
*/
- for (int i = 0; i < topicsData.size() - 1; i++) {
- PropertyValue[] topic = (PropertyValue[])topicsData.get(i);
+ for (int i = 0; i < topicsData.size() - 1; i++)
+ {
+ PropertyValue[] topic = (PropertyValue[]) topicsData.get(i);
items = searchFillInItems();
- for ( int itemIndex = 0; itemIndex < items.size(); itemIndex++) {
- item = (XTextRange)items.get(itemIndex);
+ for (int itemIndex = 0; itemIndex < items.size(); itemIndex++)
+ {
+ item = (XTextRange) items.get(itemIndex);
itemText = item.getString().trim().toLowerCase();
- if ( itemText.equals( FILLIN_MINUTE_NUM ))
- fillMinutesItem( item , topic[0].Value , "");
- else if ( itemText.equals( FILLIN_MINUTE_TOPIC ))
- fillMinutesItem( item , topic[1].Value , "" );
- else if ( itemText.equals( FILLIN_MINUTE_RESPONSIBLE ))
- fillMinutesItem( item , topic[2].Value , "" );
- else if ( itemText.equals( FILLIN_MINUTE_TIME )) {
+ if (itemText.equals(FILLIN_MINUTE_NUM))
+ {
+ fillMinutesItem(item, topic[0].Value, "");
+ }
+ else if (itemText.equals(FILLIN_MINUTE_TOPIC))
+ {
+ fillMinutesItem(item, topic[1].Value, "");
+ }
+ else if (itemText.equals(FILLIN_MINUTE_RESPONSIBLE))
+ {
+ fillMinutesItem(item, topic[2].Value, "");
+ }
+ else if (itemText.equals(FILLIN_MINUTE_TIME))
+ {
int topicTime = 0;
- try {
- topicTime = (new Integer((String)topic[3].Value)).intValue();
+ try
+ {
+ topicTime = (new Integer((String) topic[3].Value)).intValue();
+ }
+ catch (Exception ex)
+ {
}
- catch (Exception ex) {}
// if the topic has no time, we do not display any time here.
if (topicTime == 0 || topicStartTime == 0)
- time = (String)topic[3].Value;
- else {
- time = getTimeString( String.valueOf(topicStartTime) ) + " - ";
+ {
+ time = (String) topic[3].Value;
+ }
+ else
+ {
+ time = getTimeString(String.valueOf(topicStartTime)) + " - ";
topicStartTime += topicTime * 1000;
- time += getTimeString( String.valueOf(topicStartTime ) );
+ time += getTimeString(String.valueOf(topicStartTime));
}
- fillMinutesItem( item , time , "" );
+ fillMinutesItem(item, time, "");
}
}
- textSectionHandler.removeTextSectionbyName( SECTION_MINUTES );
+ textSectionHandler.removeTextSectionbyName(SECTION_MINUTES);
// after the last section we do not insert a new one.
- if ( i < topicsData.size() - 2 )
- textSectionHandler.insertTextSection( SECTION_MINUTES , template, false);
-
+ if (i < topicsData.size() - 2)
+ {
+ textSectionHandler.insertTextSection(SECTION_MINUTES, template, false);
+ }
}
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -794,17 +892,22 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param text the text to fill to the text range object.
* @param placeholder the placeholder text to use, if the text argument is empty (null or "")
*/
- private void fillMinutesItem(XTextRange range, Object text, String placeholder) {
- String paraStyle = (String)Helper.getUnoPropertyValue(range,"ParaStyleName");
- range.setString((String)text);
- Helper.setUnoPropertyValue(range,"ParaStyleName",paraStyle);
- if (text == null || text.equals("")) {
- if ( placeholder!=null && !placeholder.equals("")) {
+ private void fillMinutesItem(XTextRange range, Object text, String placeholder)
+ {
+ String paraStyle = (String) Helper.getUnoPropertyValue(range, "ParaStyleName");
+ range.setString((String) text);
+ Helper.setUnoPropertyValue(range, "ParaStyleName", paraStyle);
+ if (text == null || text.equals(""))
+ {
+ if (placeholder != null && !placeholder.equals(""))
+ {
XTextContent placeHolder = createPlaceHolder(docMSF, placeholder, resources.resPlaceHolderHint);
- try {
- range.getStart().getText().insertTextContent(range.getStart(),placeHolder,true);
+ try
+ {
+ range.getStart().getText().insertTextContent(range.getStart(), placeHolder, true);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -819,19 +922,22 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param hint hint text
* @return the place holder field.
*/
- public static XTextContent createPlaceHolder(XMultiServiceFactory xmsf, String ph, String hint) {
+ public static XTextContent createPlaceHolder(XMultiServiceFactory xmsf, String ph, String hint)
+ {
Object placeHolder;
- try {
+ try
+ {
placeHolder = xmsf.createInstance("com.sun.star.text.TextField.JumpEdit");
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
return null;
}
Helper.setUnoPropertyValue(placeHolder, "PlaceHolder", ph);
Helper.setUnoPropertyValue(placeHolder, "Hint", hint);
Helper.setUnoPropertyValue(placeHolder, "PlaceHolderType", new Short(PlaceholderType.TEXT));
- return (XTextContent)UnoRuntime.queryInterface(XTextContent.class,placeHolder);
+ return (XTextContent) UnoRuntime.queryInterface(XTextContent.class, placeHolder);
}
@@ -842,21 +948,18 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* =================================
* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
*/
-
-
-
- public class ItemsTable {
+ public class ItemsTable
+ {
Object table;
Object section;
-
/**
* the items in the table.
*/
List items = new Vector(6);
-
- public ItemsTable(Object section_, Object table_) {
+ public ItemsTable(Object section_, Object table_)
+ {
table = table_;
section = section_;
@@ -871,16 +974,19 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* and remove them from the list of all <*> items, so the next
* search will be faster.
*/
- for (int i = 0; i < _allItems.size(); i++) {
- item = (XTextRange)_allItems.get(i);
- Object t = Helper.getUnoPropertyValue(item,"TextTable");
- if ( ( t instanceof Any ) && ((Any)t).getObject() == table) {
+ for (int i = 0; i < _allItems.size(); i++)
+ {
+ item = (XTextRange) _allItems.get(i);
+ Object t = Helper.getUnoPropertyValue(item, "TextTable");
+ if ((t instanceof Any) && ((Any) t).getObject() == table)
+ {
iText = item.getString().toLowerCase().trim();
- ai = (AgendaItem)itemsCache.get(item.getString().toLowerCase().trim());
- if (ai != null) {
+ ai = (AgendaItem) itemsCache.get(item.getString().toLowerCase().trim());
+ if (ai != null)
+ {
items.add(ai);
_allItems.remove(i--);
- itemsMap.put(iText,this);
+ itemsMap.put(iText, this);
}
}
}
@@ -897,90 +1003,100 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param dummy we need a param to make this an Implementation of AgendaElement.
* @throws Exception
*/
- public synchronized void write(Object dummy) throws Exception {
- synchronized (this) {
- String name = getName(section);
-
- // link and unlink the section to the template.
- textSectionHandler.linkSectiontoTemplate(section,template,name);
- textSectionHandler.breakLinkOfTextSection(section);
-
- // we need to get a new instance after linking.
- table = getTable(name);
- section = getSection(name);
-
- XTextTable xTextTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class,table);
- XTextTableCursor cursor = xTextTable.createCursorByCellName("A1");
- AgendaItem ai ;
- // should this section be visible?
- boolean visible = false;
-
- // write items
- // ===========
- String cellName = "";
-
- /* now go through all items that belong to this
- * table. Check each one agains the model. If it should
- * be display, call it's write method.
- * All items are of type AgendaItem which means they write
- * two cells to the table: a title (text) and a placeholder.
- * see AgendaItem class below.
- */
- for (int i = 0; i < items.size(); i++) {
- ai = (AgendaItem)items.get(i);
- if (isShowItem(ai.name)) {
- visible = true;
- ai.table = table;
- ai.write(cursor);
- // I store the cell name which was last written...
- cellName = cursor.getRangeName();
-
- cursor.goRight((short)1,false);
+ public synchronized void write(Object dummy) throws Exception
+ {
+ synchronized(this)
+ {
+ String name = getName(section);
+
+ // link and unlink the section to the template.
+ textSectionHandler.linkSectiontoTemplate(section, template, name);
+ textSectionHandler.breakLinkOfTextSection(section);
+
+ // we need to get a new instance after linking.
+ table = getTable(name);
+ section = getSection(name);
+
+ XTextTable xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, table);
+ XTextTableCursor cursor = xTextTable.createCursorByCellName("A1");
+ AgendaItem ai;
+ // should this section be visible?
+ boolean visible = false;
+
+ // write items
+ // ===========
+ String cellName = "";
+
+ /* now go through all items that belong to this
+ * table. Check each one agains the model. If it should
+ * be display, call it's write method.
+ * All items are of type AgendaItem which means they write
+ * two cells to the table: a title (text) and a placeholder.
+ * see AgendaItem class below.
+ */
+ for (int i = 0; i < items.size(); i++)
+ {
+ ai = (AgendaItem) items.get(i);
+ if (isShowItem(ai.name))
+ {
+ visible = true;
+ ai.table = table;
+ ai.write(cursor);
+ // I store the cell name which was last written...
+ cellName = cursor.getRangeName();
+
+ cursor.goRight((short) 1, false);
+ }
}
- }
-
- Helper.setUnoPropertyValue(section,"IsVisible",visible ? Boolean.TRUE : Boolean.FALSE);
- if (!visible)
- return;
-
- /* remove obsolete rows
- * ====================
- * if the cell that was last written is the current cell,
- * it means this is the end of the table, so we end here.
- * (because after getting the cellName above, I call the goRight method.
- * If it did not go right, it means its the last cell.
- */
- if (cellName.equals(cursor.getRangeName()))
- return;
- /*
- * if not, we continue and clear all cells until we are at the end of the row.
- */
- Object cell;
- while ( ( !cellName.equals(cursor.getRangeName()) && ( ! cursor.getRangeName().startsWith("A"))) ) {
- cell = xTextTable.getCellByName(cursor.getRangeName());
- ((XTextRange)UnoRuntime.queryInterface(XTextRange.class,cell)).setString("");
- cellName = cursor.getRangeName();
- cursor.goRight((short)1,false);
- }
-
- /*
- * again: if we are at the end of the table, end here.
- */
- if (cellName.equals(cursor.getRangeName()))
- return;
+ Helper.setUnoPropertyValue(section, "IsVisible", visible ? Boolean.TRUE : Boolean.FALSE);
+ if (!visible)
+ {
+ return;
+ /* remove obsolete rows
+ * ====================
+ * if the cell that was last written is the current cell,
+ * it means this is the end of the table, so we end here.
+ * (because after getting the cellName above, I call the goRight method.
+ * If it did not go right, it means its the last cell.
+ */
+ }
+ if (cellName.equals(cursor.getRangeName()))
+ {
+ return;
+ /*
+ * if not, we continue and clear all cells until we are at the end of the row.
+ */
+ }
+ Object cell;
+ while ((!cellName.equals(cursor.getRangeName()) && (!cursor.getRangeName().startsWith("A"))))
+ {
+ cell = xTextTable.getCellByName(cursor.getRangeName());
+ ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, cell)).setString("");
+ cellName = cursor.getRangeName();
+ cursor.goRight((short) 1, false);
+ }
- int rowIndex = getRowIndex(cursor);
- int rowsCount = getRowCount((XTextTable)UnoRuntime.queryInterface(XTextTable.class,table));
+ /*
+ * again: if we are at the end of the table, end here.
+ */
+ if (cellName.equals(cursor.getRangeName()))
+ {
+ return;
+ }
+ int rowIndex = getRowIndex(cursor);
+ int rowsCount = getRowCount((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table));
- /* now before deleteing i move the cursor up so it
- * does not disappear, because it will crash office.
- */
- cursor.gotoStart(false);
+ /* now before deleteing i move the cursor up so it
+ * does not disappear, because it will crash office.
+ */
+ cursor.gotoStart(false);
- if (rowsCount >= rowIndex)
- removeTableRows(table, rowIndex - 1, ( rowsCount - rowIndex ) + 1);
+ if (rowsCount >= rowIndex)
+ {
+ removeTableRows(table, rowIndex - 1, (rowsCount - rowIndex) + 1);
+ }
}
}
}
@@ -992,8 +1108,6 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* =================================
* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
*/
-
-
/**
* This class handles the preview of the topics table.
* You can call it the controller of the topics table.
@@ -1008,36 +1122,32 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*
* @author rp143992
*/
- public class Topics {
+ public class Topics
+ {
+
/**
* the topics table
*/
XTextTable table;
-
/**
* A List of Cell Formatters for the first row.
*/
List firstRowFormat = new Vector();
-
/**
* A List of Cell Formatters for the last row.
* (will contain them in reverse order)
*/
List lastRowFormat = new Vector();
-
/**
* the format of the cell of each topic cell.
*/
List topicCellFormats = new Vector();
-
/**
* for each topic cell there is
* a member in this vector
*/
List topicCells = new Vector();
-
int rowsPerTopic;
-
/**
* fields which hold the number of the
* fillins in the cells vectors.
@@ -1046,7 +1156,6 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
int topicCell = -1;
int responsibleCell = -1;
int timeCell = -1;
-
/**
* this is a list which traces which topics were written to the document
* and which not. When a cell needs to be actualized, it is checked that the
@@ -1057,7 +1166,6 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
List writtenTopics = new Vector();
-
/**
* Analyze the structure of the Topics table.
* The structure Must be as follows:<br>
@@ -1083,16 +1191,18 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
Map topicItems = new Hashtable(4);
// This is the topics table. say hallo :-)
- try {
+ try
+ {
t = getTable(SECTION_TOPICS);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
throw new IllegalArgumentException("Fatal error while loading template: table " + SECTION_TOPICS + " could not load.");
}
// and this is the XTable.
- table = ((XTextTable)UnoRuntime.queryInterface(XTextTable.class,t));
+ table = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, t));
/* first I store all <*> ranges
* which are in the topics table.
@@ -1105,12 +1215,14 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
XTextRange item;
Object cell;
- for (int i = 0; i < _allItems.size(); i++) {
- item = (XTextRange)_allItems.get(i);
- t = Helper.getUnoPropertyValue(item,"TextTable");
- if ( ( t instanceof Any ) && ((Any)t).getObject() == table) {
- cell = Helper.getUnoPropertyValue(item,"Cell");
- items.put(((Any)cell).getObject(),item);
+ for (int i = 0; i < _allItems.size(); i++)
+ {
+ item = (XTextRange) _allItems.get(i);
+ t = Helper.getUnoPropertyValue(item, "TextTable");
+ if ((t instanceof Any) && ((Any) t).getObject() == table)
+ {
+ cell = Helper.getUnoPropertyValue(item, "Cell");
+ items.put(((Any) cell).getObject(), item);
}
}
@@ -1122,45 +1234,47 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
int rows = getRowCount(table);
- rowsPerTopic= (rows - 1) / 3;
+ rowsPerTopic = (rows - 1) / 3;
String firstCell = "A" + (1 + rowsPerTopic + 1);
- String afterLastCell = "A" + (1 + ( rowsPerTopic * 2 ) + 1);
+ String afterLastCell = "A" + (1 + (rowsPerTopic * 2) + 1);
// go to the first row of the 2. topic
XTextTableCursor cursor = table.createCursorByCellName(firstCell);
XTextRange range;
// analyze the structure of the topic rows.
- while ( !cursor.getRangeName().equals(afterLastCell) ) {
+ while (!cursor.getRangeName().equals(afterLastCell))
+ {
cell = table.getCellByName(cursor.getRangeName());
- XTextRange xTextRange = (XTextRange)UnoRuntime.queryInterface(XTextRange.class,cell);
+ XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, cell);
// first I store the content and para style of the cell
AgendaElement ae = new TextElement(xTextRange);
// if the cell contains a relevant <...>
// i add the text element to the hash,
// so it's text can be updated later.
- range = (XTextRange)items.get(cell);
- if (range != null) {
- topicItems.put(xTextRange.getString().toLowerCase().trim() , ae);
+ range = (XTextRange) items.get(cell);
+ if (range != null)
+ {
+ topicItems.put(xTextRange.getString().toLowerCase().trim(), ae);
}
topicCells.add(ae);
// and store the format of the cell.
- topicCellFormats.add( new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
+ topicCellFormats.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
// goto next cell.
- cursor.goRight((short)1,false);
+ cursor.goRight((short) 1, false);
}
/*
* now - in which cell is every fillin?
*/
- numCell = topicCells.indexOf( topicItems.get(FILLIN_TOPIC_NUMBER));
- topicCell = topicCells.indexOf( topicItems.get(FILLIN_TOPIC_TOPIC));
- responsibleCell = topicCells.indexOf( topicItems.get(FILLIN_TOPIC_RESPONSIBLE));
- timeCell = topicCells.indexOf( topicItems.get(FILLIN_TOPIC_TIME));
+ numCell = topicCells.indexOf(topicItems.get(FILLIN_TOPIC_NUMBER));
+ topicCell = topicCells.indexOf(topicItems.get(FILLIN_TOPIC_TOPIC));
+ responsibleCell = topicCells.indexOf(topicItems.get(FILLIN_TOPIC_RESPONSIBLE));
+ timeCell = topicCells.indexOf(topicItems.get(FILLIN_TOPIC_TIME));
@@ -1170,21 +1284,22 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
// format of first row
cursor.gotoStart(false);
- do {
- firstRowFormat.add( new TableCellFormatter(table.getCellByName(cursor.getRangeName())) );
- cursor.goRight((short)1,false);
+ do
+ {
+ firstRowFormat.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
+ cursor.goRight((short) 1, false);
}
- while (!cursor.getRangeName().startsWith("A"));
+ while (!cursor.getRangeName().startsWith("A"));
// format of the last row
cursor.gotoEnd(false);
- while (!cursor.getRangeName().startsWith("A"))
+ while (!cursor.getRangeName().startsWith("A"))
{
- lastRowFormat.add( new TableCellFormatter(table.getCellByName(cursor.getRangeName())) );
- cursor.goLeft((short)1,false);
+ lastRowFormat.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
+ cursor.goLeft((short) 1, false);
}
// we missed the A cell - so we have to add it also..
- lastRowFormat.add( new TableCellFormatter(table.getCellByName(cursor.getRangeName())) );
+ lastRowFormat.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
removeTableRows(table, 1 + rowsPerTopic, rows - rowsPerTopic - 1);
@@ -1196,21 +1311,23 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @return the number of rows that have been added
* to the table. 0 or a negative number: no rows added.
*/
- private int write2(int topic, PropertyValue[] data) throws Exception {
+ private int write2(int topic, PropertyValue[] data) throws Exception
+ {
while (topic >= writtenTopics.size())
+ {
writtenTopics.add(null);
-
- writtenTopics.set(topic,"");
+ }
+ writtenTopics.set(topic, "");
// make sure threr are enough rows for me...
int rows = getRowCount(table);
- int reqRows = 1 + ( topic + 1) * rowsPerTopic;
+ int reqRows = 1 + (topic + 1) * rowsPerTopic;
int firstRow = reqRows - rowsPerTopic + 1;
int diff = reqRows - rows;
if (diff > 0)
- insertTableRows(table,rows,diff);
-
- // set the item's text...
+ {
+ insertTableRows(table, rows, diff); // set the item's text...
+ }
setItemText(numCell, data[0].Value);
setItemText(topicCell, data[1].Value);
setItemText(responsibleCell, data[2].Value);
@@ -1219,15 +1336,16 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
// now write !
XTextTableCursor cursor = table.createCursorByCellName("A" + firstRow);
- for (int i = 0; i<topicCells.size(); i++) {
- ((AgendaElement)topicCells.get(i)).write(table.getCellByName(cursor.getRangeName()));
- cursor.goRight((short)1,false);
+ for (int i = 0; i < topicCells.size(); i++)
+ {
+ ((AgendaElement) topicCells.get(i)).write(table.getCellByName(cursor.getRangeName()));
+ cursor.goRight((short) 1, false);
}
// now format !
cursor.gotoCellByName("A" + firstRow, false);
- formatTable(cursor,topicCellFormats, false);
+ formatTable(cursor, topicCellFormats, false);
return diff;
@@ -1240,8 +1358,9 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* (false would mean new rows must be added to the table in order to
* be able to write this topic).
*/
- private boolean isWritten(int topic) {
- return (writtenTopics.size() > topic && writtenTopics.get(topic) != null );
+ private boolean isWritten(int topic)
+ {
+ return (writtenTopics.size() > topic && writtenTopics.get(topic) != null);
}
/**
@@ -1257,49 +1376,53 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param data the row's data.
* @throws Exception if something goes wrong (thow nothing should)
*/
- public void writeCell(int topic, int what, PropertyValue[] data) throws Exception {
+ public void writeCell(int topic, int what, PropertyValue[] data) throws Exception
+ {
// if the whole row should be written...
if (!isWritten(topic))
- write(topic,data);
+ {
+ write(topic, data);
// write only the "what" cell.
- else {
+ }
+ else
+ {
// calculate the table row.
- int firstRow = 1 + ( topic * rowsPerTopic ) + 1;
+ int firstRow = 1 + (topic * rowsPerTopic) + 1;
// go to the first cell of this topic.
XTextTableCursor cursor = table.createCursorByCellName("A" + firstRow);
TextElement te = null;
int cursorMoves = 0;
- switch (what) {
- case 0 :
+ switch (what)
+ {
+ case 0:
te = setItemText(numCell, data[0].Value);
cursorMoves = numCell;
break;
- case 1 :
+ case 1:
te = setItemText(topicCell, data[1].Value);
cursorMoves = topicCell;
break;
- case 2 :
+ case 2:
te = setItemText(responsibleCell, data[2].Value);
cursorMoves = responsibleCell;
break;
- case 3 :
+ case 3:
te = setItemText(timeCell, data[3].Value);
cursorMoves = timeCell;
break;
}
// move the cursor to the needed cell...
- cursor.goRight((short)cursorMoves, false);
+ cursor.goRight((short) cursorMoves, false);
XCell xc = table.getCellByName(cursor.getRangeName());
// and write it !
te.write(xc);
- ((TableCellFormatter)topicCellFormats.get(cursorMoves)).format(xc);
+ ((TableCellFormatter) topicCellFormats.get(cursorMoves)).format(xc);
}
}
-
/**
* writes the given topic.
* if the first topic was involved, reformat the
@@ -1311,19 +1434,22 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* for explanation about the topics data model)
* @throws Exception if something goes wrong (though nothing should).
*/
- public void write(int topic, PropertyValue[] data) throws Exception {
+ public void write(int topic, PropertyValue[] data) throws Exception
+ {
int diff = write2(topic, data);
/* if the first topic has been written,
* one needs to reformat the first row.
*/
- if (topic == 0) {
+ if (topic == 0)
+ {
formatFirstRow();
}
/*
* if any rows were added, one needs to format
* the whole table again.
*/
- if ( diff > 0 ) {
+ if (diff > 0)
+ {
formatLastRow();
}
}
@@ -1332,18 +1458,22 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* Writes all the topics to thetopics table.
* @param topicsData a List containing all Topic's Data.
*/
- public void writeAll(List topicsData){
- try {
+ public void writeAll(List topicsData)
+ {
+ try
+ {
for (int i = 0; i < topicsData.size() - 1; i++)
- write2(i, (PropertyValue[])topicsData.get(i) );
+ {
+ write2(i, (PropertyValue[]) topicsData.get(i));
+ }
formatLastRow();
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
-
/**
* removes obsolete rows, reducing the
* topics table to the given number of topics.
@@ -1360,34 +1490,43 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param topics the number of topics the table should contain.
* @throws Exception
*/
- public void reduceDocumentTo(int topics) throws Exception {
+ public void reduceDocumentTo(int topics) throws Exception
+ {
// we never remove the first topic...
if (topics <= 0)
+ {
topics = 1;
+ }
XTableRows tableRows = table.getRows();
int targetNumOfRows = topics * rowsPerTopic + 1;
if (tableRows.getCount() > targetNumOfRows)
- tableRows.removeByIndex(targetNumOfRows , tableRows.getCount() - targetNumOfRows );
+ {
+ tableRows.removeByIndex(targetNumOfRows, tableRows.getCount() - targetNumOfRows);
+ }
formatLastRow();
- while ( writtenTopics.size() > topics )
+ while (writtenTopics.size() > topics)
+ {
writtenTopics.remove(topics);
+ }
}
/**
* reapply the format of the first (header) row.
*/
- private void formatFirstRow() {
+ private void formatFirstRow()
+ {
XTextTableCursor cursor = table.createCursorByCellName("A1");
- formatTable(cursor,firstRowFormat, false );
+ formatTable(cursor, firstRowFormat, false);
}
/**
* reaply the format of the last row.
*/
- private void formatLastRow() {
+ private void formatLastRow()
+ {
XTextTableCursor cursor = table.createCursorByCellName("A1");
cursor.gotoEnd(false);
- formatTable(cursor,lastRowFormat, true);
+ formatTable(cursor, lastRowFormat, true);
}
/**
@@ -1398,11 +1537,15 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @return a TextElement object which will write the given value
* to the given cell.
*/
- private TextElement setItemText(int cell, Object value) {
- if (cell >= 0) {
- TextElement te = ((TextElement)topicCells.get(cell));
+ private TextElement setItemText(int cell, Object value)
+ {
+ if (cell >= 0)
+ {
+ TextElement te = ((TextElement) topicCells.get(cell));
if (te != null)
+ {
te.text = value.toString();
+ }
return te;
}
return null;
@@ -1418,17 +1561,21 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param formats a List containing TableCellFormatter objects. Each will format one cell in the direction specified.
* @param reverse if true the cursor will move left, formatting in reverse order (used for the last row).
*/
- private void formatTable(XTextTableCursor cursor, List formats, boolean reverse) {
- for ( int i = 0; i < formats.size() ; i++ ) {
- ((TableCellFormatter)formats.get(i)).format(table.getCellByName(cursor.getRangeName()));
+ private void formatTable(XTextTableCursor cursor, List formats, boolean reverse)
+ {
+ for (int i = 0; i < formats.size(); i++)
+ {
+ ((TableCellFormatter) formats.get(i)).format(table.getCellByName(cursor.getRangeName()));
if (reverse)
- cursor.goLeft((short)1,false);
+ {
+ cursor.goLeft((short) 1, false);
+ }
else
- cursor.goRight((short)1,false);
+ {
+ cursor.goRight((short) 1, false);
+ }
}
}
-
-
}
@@ -1437,13 +1584,16 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* Here are some static help methods
* =================================
*/
-
public static String[] getNamesWhichStartWith(String[] allNames, String prefix)
{
Vector v = new Vector();
for (int i = 0; i < allNames.length; i++)
+ {
if (allNames[i].startsWith(prefix))
+ {
v.add(allNames[i]);
+ }
+ }
String[] s = new String[v.size()];
System.arraycopy(v.toArray(), 0, s, 0, s.length);
return s;
@@ -1454,8 +1604,9 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param obj an XNamed object.
* @return the name of the given object.
*/
- public static String getName(Object obj) {
- return ((XNamed)UnoRuntime.queryInterface(XNamed.class,obj)).getName();
+ public static String getName(Object obj)
+ {
+ return ((XNamed) UnoRuntime.queryInterface(XNamed.class, obj)).getName();
}
/**
@@ -1464,8 +1615,9 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param start
* @param count
*/
- public static void removeTableRows(Object table, int start, int count) {
- XTableRows rows = ((XTextTable)UnoRuntime.queryInterface(XTextTable.class,table)).getRows();
+ public static void removeTableRows(Object table, int start, int count)
+ {
+ XTableRows rows = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table)).getRows();
rows.removeByIndex(start, count);
}
@@ -1475,8 +1627,9 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param start
* @param count
*/
- public static void insertTableRows(Object table, int start, int count) {
- XTableRows rows = ((XTextTable)UnoRuntime.queryInterface(XTextTable.class,table)).getRows();
+ public static void insertTableRows(Object table, int start, int count)
+ {
+ XTableRows rows = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table)).getRows();
rows.insertByIndex(start, count);
}
@@ -1486,7 +1639,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param cursor
* @return the row index in which the cursor is.
*/
- public static int getRowIndex(XTextTableCursor cursor) {
+ public static int getRowIndex(XTextTableCursor cursor)
+ {
return getRowIndex(cursor.getRangeName());
}
@@ -1495,7 +1649,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param cellName
* @return the row index for this cell name.
*/
- public static int getRowIndex(String cellName) {
+ public static int getRowIndex(String cellName)
+ {
return Integer.parseInt(cellName.substring(1));
}
@@ -1505,11 +1660,11 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* @param table
* @return the rows count of the given table.
*/
- public static int getRowCount(XTextTable table) {
+ public static int getRowCount(XTextTable table)
+ {
String[] cells = table.getCellNames();
- return getRowIndex(cells[cells.length-1]);
+ return getRowIndex(cells[cells.length - 1]);
}
-
}
/*
@@ -1520,14 +1675,11 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* ===========================================================================================
*
*/
-
-
/*
* =================================
* The AgendaElement interface
* =================================
*/
-
/**
* Interface that is used for writing content to a Uno Text / TextRange
* @author rp143992
@@ -1535,8 +1687,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
interface AgendaElement
{
- void write(Object any) throws Exception;
+ void write(Object any) throws Exception;
}
@@ -1545,8 +1697,6 @@ interface AgendaElement
* The ParaStyled class
* =================================
*/
-
-
/**
* Basic implementation of the AgendaElement interface -
* writes nothing, but applies a ParaStyle to the given XText/XTextRange
@@ -1555,29 +1705,34 @@ interface AgendaElement
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
-class ParaStyled implements AgendaElement {
+class ParaStyled implements AgendaElement
+{
+
String paraStyle;
- ParaStyled(String paraStyle_) {
+ ParaStyled(String paraStyle_)
+ {
paraStyle = paraStyle_;
}
- void format(Object textRange) {
+ void format(Object textRange)
+ {
XText o;
- o = ((XText)UnoRuntime.queryInterface(XText.class,textRange));
+ o = ((XText) UnoRuntime.queryInterface(XText.class, textRange));
if (o == null)
- o = ((XTextRange)UnoRuntime.queryInterface(XTextRange.class,textRange)).getText();
-
- XTextRange xtr = (XTextRange)UnoRuntime.queryInterface(XTextRange.class,textRange);
+ {
+ o = ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange)).getText();
+ }
+ XTextRange xtr = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange);
XTextCursor cursor = o.createTextCursorByRange(xtr);
Helper.setUnoPropertyValue(cursor, "ParaStyleName", paraStyle);
}
- public void write(Object textRange) {
+ public void write(Object textRange)
+ {
format(textRange);
}
-
}
/*
@@ -1585,33 +1740,38 @@ class ParaStyled implements AgendaElement {
* The TextElement class
* =================================
*/
-
/**
* A basic implementation of AgendaElement:
* writes a String to the given XText/XTextRange, and applies
* a ParaStyle to it (using the parent class).
* @author rp143992
*/
- class TextElement extends ParaStyled {
+class TextElement extends ParaStyled
+{
+
String text;
- TextElement(XTextRange range) {
- this( range.getString() , (String) Helper.getUnoPropertyValue( range.getStart(), "ParaStyleName"));
+ TextElement(XTextRange range)
+ {
+ this(range.getString(), (String) Helper.getUnoPropertyValue(range.getStart(), "ParaStyleName"));
}
- TextElement(String text_, String paraStyle_) {
+ TextElement(String text_, String paraStyle_)
+ {
super(paraStyle_);
- text= text_;
+ text = text_;
}
- public void write(Object textRange) {
- ((XTextRange)UnoRuntime.queryInterface(XTextRange.class,textRange)).setString(text);
+ public void write(Object textRange)
+ {
+ ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange)).setString(text);
if (!text.equals(""))
+ {
super.write(textRange);
+ }
}
}
-
/**
* A Text element which, if the text to write is empty (null or "")
* inserts a placeholder instead.
@@ -1620,75 +1780,85 @@ class ParaStyled implements AgendaElement {
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
-class PlaceholderTextElement extends TextElement {
+class PlaceholderTextElement extends TextElement
+{
+
String hint;
String placeHolderText;
XMultiServiceFactory xmsf;
- PlaceholderTextElement(XTextRange textRange, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_) {
+ PlaceholderTextElement(XTextRange textRange, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_)
+ {
super(textRange);
placeHolderText = placeHolderText_;
hint = hint_;
xmsf = xmsf_;
}
- PlaceholderTextElement(String text, String paraStyle, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_) {
- super(text,paraStyle);
+ PlaceholderTextElement(String text, String paraStyle, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_)
+ {
+ super(text, paraStyle);
placeHolderText = placeHolderText_;
hint = hint_;
xmsf = xmsf_;
}
- public void write(Object textRange) {
+ public void write(Object textRange)
+ {
super.write(textRange);
- if (text == null || text.equals("")) {
- XTextRange xTextRange = (XTextRange)UnoRuntime.queryInterface(XTextRange.class,textRange);
- try {
- XTextContent xTextContent = AgendaTemplate.createPlaceHolder(xmsf,placeHolderText, hint);
+ if (text == null || text.equals(""))
+ {
+ XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange);
+ try
+ {
+ XTextContent xTextContent = AgendaTemplate.createPlaceHolder(xmsf, placeHolderText, hint);
xTextRange.getText().insertTextContent(xTextRange.getStart(), xTextContent, true);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
}
}
-
-
/*
* =================================
* The PlaceHolder class
* =================================
*/
-
-
/**
* An Agenda element which writes no text, but inserts a placeholder, and formats
* it using a ParaStyleName.
* @author rp143992
*
*/
-class PlaceholderElement extends ParaStyled {
+class PlaceholderElement extends ParaStyled
+{
+
String hint;
String placeHolderText;
XMultiServiceFactory xmsf;
- PlaceholderElement(String paraStyle, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_) {
+ PlaceholderElement(String paraStyle, String placeHolderText_, String hint_, XMultiServiceFactory xmsf_)
+ {
super(paraStyle);
placeHolderText = placeHolderText_;
hint = hint_;
xmsf = xmsf_;
}
- public void write(Object textRange) {
- XTextRange xTextRange = (XTextRange)UnoRuntime.queryInterface(XTextRange.class,textRange);
- try {
- XTextContent xTextContent = AgendaTemplate.createPlaceHolder(xmsf,placeHolderText, hint);
+ public void write(Object textRange)
+ {
+ XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange);
+ try
+ {
+ XTextContent xTextContent = AgendaTemplate.createPlaceHolder(xmsf, placeHolderText, hint);
xTextRange.getText().insertTextContent(xTextRange.getStart(), xTextContent, true);
super.write(textRange);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -1700,7 +1870,6 @@ class PlaceholderElement extends ParaStyled {
* The AgendaItem class
* =================================
*/
-
/**
* An implementation of AgendaElement which
* gets as a parameter a table cursor, and writes
@@ -1711,36 +1880,39 @@ class PlaceholderElement extends ParaStyled {
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
+class AgendaItem implements AgendaElement
+{
-class AgendaItem implements AgendaElement {
TextElement textElement;
AgendaElement field;
public Object table;
String name;
- AgendaItem(String name_, TextElement te, AgendaElement f) {
+ AgendaItem(String name_, TextElement te, AgendaElement f)
+ {
name = name_;
field = f;
textElement = te;
}
- public void write(Object tableCursor) throws Exception {
- XTextTableCursor xTextTableCursor = (XTextTableCursor)UnoRuntime.queryInterface(XTextTableCursor.class,tableCursor);
- XTextTable xTextTable = (XTextTable)UnoRuntime.queryInterface(XTextTable.class,table);
+ public void write(Object tableCursor) throws Exception
+ {
+ XTextTableCursor xTextTableCursor = (XTextTableCursor) UnoRuntime.queryInterface(XTextTableCursor.class, tableCursor);
+ XTextTable xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, table);
String cellname = xTextTableCursor.getRangeName();
Object cell = xTextTable.getCellByName(cellname);
textElement.write(cell);
- xTextTableCursor.goRight((short)1,false);
+ xTextTableCursor.goRight((short) 1, false);
//second field is actually always null...
// this is a preparation for adding placeholders.
- if (field!= null)
+ if (field != null)
+ {
field.write(xTextTable.getCellByName(xTextTableCursor.getRangeName()));
-
-
+ }
}
}
@@ -1749,13 +1921,15 @@ class AgendaItem implements AgendaElement {
* The TableCellFormatter class
* =================================
*/
-
/**
* reads/write a table cell format from/to a table cell or a group of cells.
*
*/
-class TableCellFormatter {
- static String[] properties = new String[] {
+class TableCellFormatter
+{
+
+ static String[] properties = new String[]
+ {
"BackColor",
"BackTransparent",
"BorderDistance",
@@ -1767,18 +1941,21 @@ class TableCellFormatter {
"RightBorderDistance",
"TopBorder",
"TopBorderDistance"
- };
-
- private Object[] values = new Object[properties.length];
+ };
+ private Object[] values = new Object[properties.length];
- public TableCellFormatter(Object tableCell) {
- for (int i = 0; i<properties.length; i++)
- values[i] = Helper.getUnoPropertyValue(tableCell,properties[i]);
- }
+ public TableCellFormatter(Object tableCell)
+ {
+ for (int i = 0; i < properties.length; i++)
+ {
+ values[i] = Helper.getUnoPropertyValue(tableCell, properties[i]);
+ }
+ }
- public void format(Object tableCell) {
- Helper.setUnoPropertyValues(tableCell,properties,values);
- }
+ public void format(Object tableCell)
+ {
+ Helper.setUnoPropertyValues(tableCell, properties, values);
+ }
}
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java
index 93e2fe506285..e62cf56692c1 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.agenda;
+ ************************************************************************/
+package com.sun.star.wizards.agenda;
public interface AgendaWizardDialogConst {
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java
index 0d7b987513e4..3bcdabed67b0 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java
@@ -26,7 +26,9 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.agenda;
+ ************************************************************************/
+
+package com.sun.star.wizards.agenda;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.Resource;
diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.java b/wizards/com/sun/star/wizards/agenda/CGAgenda.java
index 089079312e8a..5a8350d7c80c 100644
--- a/wizards/com/sun/star/wizards/agenda/CGAgenda.java
+++ b/wizards/com/sun/star/wizards/agenda/CGAgenda.java
@@ -26,8 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.agenda;
-
+ ************************************************************************/
+package com.sun.star.wizards.agenda;
import com.sun.star.wizards.common.ConfigGroup;
import com.sun.star.wizards.common.ConfigSet;
@@ -38,13 +38,13 @@ import com.sun.star.wizards.common.ConfigSet;
* to save the state of the agenda wizard for reloading uppon
* next start.
*/
-public class CGAgenda extends ConfigGroup {
+public class CGAgenda extends ConfigGroup
+{
/** step 1 - design*/
public int cp_AgendaType;
/** step 1 - include minutes*/
public boolean cp_IncludeMinutes;
-
/** step 2 - title */
public String cp_Title = "";
/** step 2 - date */
@@ -53,7 +53,6 @@ public class CGAgenda extends ConfigGroup {
public String cp_Time;
/** step 2 - location */
public String cp_Location = "";
-
/** step 3 - show meeting type */
public boolean cp_ShowMeetingType;
/** step 3 - show read */
@@ -62,7 +61,6 @@ public class CGAgenda extends ConfigGroup {
public boolean cp_ShowBring;
/** step 3 - show notes */
public boolean cp_ShowNotes;
-
/** step 4 - show called by */
public boolean cp_ShowCalledBy;
/** step 4 - show facilitator */
@@ -77,16 +75,12 @@ public class CGAgenda extends ConfigGroup {
public boolean cp_ShowObservers;
/** step 4 - show resource persons */
public boolean cp_ShowResourcePersons;
-
/** page 6 - template title */
public String cp_TemplateName;
/** page 6 - template url */
public String cp_TemplatePath;
-
/** page 6 - how to proceed */
public int cp_ProceedMethod;
-
/** page 5 - topics ( a set )*/
public ConfigSet cp_Topics = new ConfigSet(CGTopic.class);
-
}
diff --git a/wizards/com/sun/star/wizards/agenda/CGTopic.java b/wizards/com/sun/star/wizards/agenda/CGTopic.java
index 1c1a5068192f..10fbbf173f46 100644
--- a/wizards/com/sun/star/wizards/agenda/CGTopic.java
+++ b/wizards/com/sun/star/wizards/agenda/CGTopic.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.agenda;
+ ************************************************************************/
+package com.sun.star.wizards.agenda;
import com.sun.star.beans.PropertyValue;
diff --git a/wizards/com/sun/star/wizards/agenda/CallWizard.java b/wizards/com/sun/star/wizards/agenda/CallWizard.java
index 36e8b79fcb7e..75fcc7a5fbb3 100644
--- a/wizards/com/sun/star/wizards/agenda/CallWizard.java
+++ b/wizards/com/sun/star/wizards/agenda/CallWizard.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.agenda;
+ ************************************************************************/
+package com.sun.star.wizards.agenda;
import com.sun.star.beans.XPropertyAccess;
import com.sun.star.comp.loader.FactoryHelper;
@@ -46,7 +47,7 @@ import com.sun.star.uno.Type;
* information into the given registry key (<CODE>__writeRegistryServiceInfo</CODE>).
*
* @author $author$
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.5.52.1 $
*/
public class CallWizard {
diff --git a/wizards/com/sun/star/wizards/agenda/TemplateConsts.java b/wizards/com/sun/star/wizards/agenda/TemplateConsts.java
index 1f5a1b25f609..2e418ab0f916 100644
--- a/wizards/com/sun/star/wizards/agenda/TemplateConsts.java
+++ b/wizards/com/sun/star/wizards/agenda/TemplateConsts.java
@@ -29,18 +29,17 @@
************************************************************************/
package com.sun.star.wizards.agenda;
-
/**
* @author rpiterman
*
*/
public interface TemplateConsts
{
+
public final static String FILLIN_TITLE = "<title>";
public final static String FILLIN_DATE = "<date>";
public final static String FILLIN_TIME = "<time>";
public final static String FILLIN_LOCATION = "<location>";
-
/**
* section name <b>prefix</b> for sections that contain items.
* this is also used as table name prefix, since each items section
@@ -59,10 +58,7 @@ public interface TemplateConsts
* the name of the child nimutes section.
* This section will be duplicated for each topic.
*/
- public final static String SECTION_MINUTES = "MINUTES";
-
- //public final static String AGENDA_ITEM = "AGENDA_ITEM";
-
+ public final static String SECTION_MINUTES = "MINUTES"; //public final static String AGENDA_ITEM = "AGENDA_ITEM";
/**
* taged headings and names.
* These will be searched in item tables (in the template) and will be
@@ -74,7 +70,6 @@ public interface TemplateConsts
public final static String FILLIN_BRING = "<bring>";
public final static String FILLIN_READ = "<read>";
public final static String FILLIN_NOTES = "<notes>";
-
/**
* names...
*/
@@ -85,9 +80,6 @@ public interface TemplateConsts
public final static String FILLIN_TIMEKEEPER = "<timekeeper>";
public final static String FILLIN_OBSERVERS = "<observers>";
public final static String FILLIN_RESOURCE_PERSONS = "<resource-persons>";
-
-
-
/**
* Styles (paragraph styles) used for agenda items.
* headings styles
@@ -97,7 +89,6 @@ public interface TemplateConsts
public final static String STYLE_BRING = "Bring";
public final static String STYLE_READ = "Read";
public final static String STYLE_NOTES = "Notes";
-
/**
* names styles
*/
@@ -108,7 +99,6 @@ public interface TemplateConsts
public final static String STYLE_TIMEKEEPER = "Timekeeper";
public final static String STYLE_OBSERVERS = "Observers";
public final static String STYLE_RESOURCE_PERSONS = "ResourcePersons";
-
/**
* Styles (paragraph styles) used for the <b>text</b> of agenda items
* The agenda wizard creates fill-in fields with the given styles...)
@@ -119,7 +109,6 @@ public interface TemplateConsts
public final static String STYLE_BRING_TEXT = "BringText";
public final static String STYLE_READ_TEXT = "ReadText";
public final static String STYLE_NOTES_TEXT = "NotesText";
-
/**
* names field styles
*/
@@ -130,7 +119,6 @@ public interface TemplateConsts
public final static String STYLE_TIMEKEEPER_TEXT = "TimekeeperText";
public final static String STYLE_OBSERVERS_TEXT = "ObserversText";
public final static String STYLE_RESOURCE_PERSONS_TEXT = "ResourcePersonsText";
-
/**
* Fillins for the topic table.
* These strings will be searched inside the topic table as
@@ -140,8 +128,6 @@ public interface TemplateConsts
public final static String FILLIN_TOPIC_TOPIC = "<topic>";
public final static String FILLIN_TOPIC_RESPONSIBLE = "<responsible>";
public final static String FILLIN_TOPIC_TIME = "<topic-time>";
-
-
/**
* fillins for minutes.
* These will be searched in the minutes section and will be replaced
@@ -151,7 +137,6 @@ public interface TemplateConsts
public final static String FILLIN_MINUTES_LOCATION = "<minutes-location>";
public final static String FILLIN_MINUTES_DATE = "<minutes-date>";
public final static String FILLIN_MINUTES_TIME = "<minutes-time>";
-
/**
* Minutes-topic fillins
* These will be searched in the minutes-child-section, and
@@ -161,6 +146,4 @@ public interface TemplateConsts
public final static String FILLIN_MINUTE_TOPIC = "<mtopic>";
public final static String FILLIN_MINUTE_RESPONSIBLE = "<mresponsible>";
public final static String FILLIN_MINUTE_TIME = "<mtime>";
-
-
}
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.java b/wizards/com/sun/star/wizards/agenda/TopicsControl.java
index 79cb5783837c..14f57990f216 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.java
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.java
@@ -52,7 +52,6 @@ import com.sun.star.wizards.ui.UnoDialog2;
import com.sun.star.wizards.ui.event.EventNames;
import com.sun.star.wizards.ui.event.MethodInvocation;
-
/**
* @author rpiterman
* This class implements the UI functionality of the topics scroller control.
@@ -110,6 +109,7 @@ import com.sun.star.wizards.ui.event.MethodInvocation;
*/
public class TopicsControl extends ControlScroller implements XFocusListener
{
+
/**
* The name prefix of the number (label) controls
*/
@@ -126,11 +126,8 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* The name prefix of the time (text) controls
*/
public static final String TIME = "txtTopicTime_";
-
-
Object lastFocusControl;
int lastFocusRow;
-
/**
* the last
* topic text box.
@@ -142,7 +139,6 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* When pressing shift-tab on this control, a scroll up *may* be performed.
*/
private Object lastTime;
-
/**
* is used when constructing to track the tab index
* of the created control rows.
@@ -156,32 +152,35 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param xmsf service factory
* @param agenda the Agenda configuration data (contains the current topics data).
*/
- public TopicsControl(AgendaWizardDialog dialog, XMultiServiceFactory xmsf, CGAgenda agenda) {
- super(dialog,xmsf,5, 92 , 38, 212 ,5,18, AgendaWizardDialogConst.LAST_HID );
+ public TopicsControl(AgendaWizardDialog dialog, XMultiServiceFactory xmsf, CGAgenda agenda)
+ {
+ super(dialog, xmsf, 5, 92, 38, 212, 5, 18, AgendaWizardDialogConst.LAST_HID);
initializeScrollFields(agenda);
- initialize( agenda.cp_Topics.getSize() + 1 );
+ initialize(agenda.cp_Topics.getSize() + 1);
// set some focus listeners for TAB scroll down and up...
- try {
+ try
+ {
// prepare scroll down on tab press...
- Object lastTime = ((ControlRow)ControlGroupVector.get(nblockincrement -1 )).timebox;
+ Object lastTime = ((ControlRow) ControlGroupVector.get(nblockincrement - 1)).timebox;
MethodInvocation mi = new MethodInvocation("lastControlKeyPressed", this, KeyEvent.class);
- dialog.getGuiEventListener().add( TIME + ( nblockincrement - 1), EventNames.EVENT_KEY_PRESSED, mi);
+ dialog.getGuiEventListener().add(TIME + (nblockincrement - 1), EventNames.EVENT_KEY_PRESSED, mi);
addKeyListener(lastTime, (XKeyListener) dialog.getGuiEventListener());
//prepare scroll up on tab press...
- firstTopic = ((ControlRow)ControlGroupVector.get(0)).textbox;
+ firstTopic = ((ControlRow) ControlGroupVector.get(0)).textbox;
mi = new MethodInvocation("firstControlKeyPressed", this, KeyEvent.class);
- dialog.getGuiEventListener().add( TOPIC + 0 , EventNames.EVENT_KEY_PRESSED, mi);
+ dialog.getGuiEventListener().add(TOPIC + 0, EventNames.EVENT_KEY_PRESSED, mi);
addKeyListener(firstTopic, (XKeyListener) dialog.getGuiEventListener());
}
- catch (NoSuchMethodException ex) {
+ catch (NoSuchMethodException ex)
+ {
ex.printStackTrace();
}
@@ -190,27 +189,29 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* Is used to add a keylistener to different controls...
*/
- static void addKeyListener(Object control,XKeyListener listener) {
- XWindow xlastControl = (XWindow)UnoRuntime.queryInterface(XWindow.class,
- control );
+ static void addKeyListener(Object control, XKeyListener listener)
+ {
+ XWindow xlastControl = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ control);
xlastControl.addKeyListener(listener);
}
-
/**
* Is used to add a focuslistener to different controls...
*/
- static void addFocusListener(Object control,XFocusListener listener) {
- XWindow xlastControl = (XWindow)UnoRuntime.queryInterface(XWindow.class,
- control );
+ static void addFocusListener(Object control, XFocusListener listener)
+ {
+ XWindow xlastControl = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ control);
xlastControl.addFocusListener(listener);
}
/**
* Implementation of the parent class...
*/
- protected void initializeScrollFields() {}
-
+ protected void initializeScrollFields()
+ {
+ }
/**
* initializes the data of the control.
@@ -219,11 +220,12 @@ public class TopicsControl extends ControlScroller implements XFocusListener
protected void initializeScrollFields(CGAgenda agenda)
{
// create a row for each topic with the given values....
- for (int i = 0; i < agenda.cp_Topics.getSize(); i++) {
+ for (int i = 0; i < agenda.cp_Topics.getSize(); i++)
+ {
PropertyValue[] row = newRow(i);
- ((CGTopic)agenda.cp_Topics.getElementAt(i)).setDataToRow(row);
+ ((CGTopic) agenda.cp_Topics.getElementAt(i)).setDataToRow(row);
// a parent class method
- registerControlGroup( row , i );
+ registerControlGroup(row, i);
this.updateDocumentRow(i);
}
// inserts a blank row at the end...
@@ -236,16 +238,18 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* The control has always a blank row at the
* end, which enables the user to enter data...
*/
- protected void insertRowAtEnd() {
+ protected void insertRowAtEnd()
+ {
int l = scrollfields.size();
- registerControlGroup( newRow(l), l );
- setTotalFieldCount(l+1);
+ registerControlGroup(newRow(l), l);
+ setTotalFieldCount(l + 1);
// if the new row is visible, it must have been disabled
// so it should be now enabled...
- if ( l- nscrollvalue < nblockincrement )
- ((ControlRow) ControlGroupVector.get( l - nscrollvalue )).setEnabled(true);
-
+ if (l - nscrollvalue < nblockincrement)
+ {
+ ((ControlRow) ControlGroupVector.get(l - nscrollvalue)).setEnabled(true);
+ }
}
/**
@@ -253,41 +257,50 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* the current content of the topics.
* @param agenda
*/
- void saveTopics(CGAgenda agenda) {
+ void saveTopics(CGAgenda agenda)
+ {
agenda.cp_Topics.clear();
- for (int i = 0; i < scrollfields.size() - 1; i++ )
+ for (int i = 0; i < scrollfields.size() - 1; i++)
+ {
agenda.cp_Topics.add(i,
- new CGTopic( scrollfields.get(i)) );
+ new CGTopic(scrollfields.get(i)));
+ }
}
/**
* overrides the parent class method to also enable the
* row whenever data is written to it.
+ * @param guiRow
*/
- protected void fillupControls(int guiRow) {
+ protected void fillupControls(int guiRow)
+ {
super.fillupControls(guiRow);
- ((ControlRow) ControlGroupVector.get( guiRow )).setEnabled(true);
+ ((ControlRow) ControlGroupVector.get(guiRow)).setEnabled(true);
}
-
/**
* remove the last row
*/
- protected void removeLastRow() {
+ protected void removeLastRow()
+ {
int l = scrollfields.size();
// if we should scroll up...
- if ( ( l - nscrollvalue >= 1) && ( l - nscrollvalue <= nblockincrement ) && nscrollvalue > 0 ) {
- while ( ( l - nscrollvalue >= 1) && ( l - nscrollvalue <= nblockincrement ) && nscrollvalue > 0 )
+ if ((l - nscrollvalue >= 1) && (l - nscrollvalue <= nblockincrement) && nscrollvalue > 0)
+ {
+ while ((l - nscrollvalue >= 1) && (l - nscrollvalue <= nblockincrement) && nscrollvalue > 0)
+ {
setScrollValue(nscrollvalue - 1);
+ }
}
// if we should disable a row...
- else if ( nscrollvalue == 0 && l - 1 < nblockincrement ) {
- ControlRow cr = (ControlRow)ControlGroupVector.get( l - 1 );
+ else if (nscrollvalue == 0 && l - 1 < nblockincrement)
+ {
+ ControlRow cr = (ControlRow) ControlGroupVector.get(l - 1);
cr.setEnabled(false);
}
- unregisterControlGroup( l - 1 );
+ unregisterControlGroup(l - 1);
setTotalFieldCount(l - 1);
}
@@ -295,9 +308,11 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* in order to use the "move up", "down" "insert" and "remove" buttons,
* we track the last control the gained focus, in order to know which
* row should be handled.
+ * @param fe
*/
- public void focusGained(FocusEvent fe) {
- XControl xc = (XControl)UnoRuntime.queryInterface(XControl.class,fe.Source);
+ public void focusGained(FocusEvent fe)
+ {
+ XControl xc = (XControl) UnoRuntime.queryInterface(XControl.class, fe.Source);
focusGained(xc);
}
@@ -310,18 +325,21 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* This is done by this method.
* @param control
*/
- private void focusGained(XControl control) {
- try {
+ private void focusGained(XControl control)
+ {
+ try
+ {
//calculate in which row we are...
- String name = (String)Helper.getUnoPropertyValue(UnoDialog2.getModel(control),"Name");
+ String name = (String) Helper.getUnoPropertyValue(UnoDialog2.getModel(control), "Name");
int i = name.indexOf("_");
- String num = name.substring(i+1);
+ String num = name.substring(i + 1);
lastFocusRow = Integer.valueOf(num).intValue() + nscrollvalue;
lastFocusControl = control;
// enable/disable the buttons...
enableButtons();
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -330,51 +348,63 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* enable or disable the buttons according to the
* current row we are in.
*/
- private void enableButtons() {
- UnoDialog2.setEnabled( getAD().btnInsert , (lastFocusRow < scrollfields.size() - 1 ? Boolean.TRUE : Boolean.FALSE ) );
- UnoDialog2.setEnabled( getAD().btnRemove , (lastFocusRow < scrollfields.size() - 1 ? Boolean.TRUE : Boolean.FALSE ) );
- UnoDialog2.setEnabled( getAD().btnUp , (lastFocusRow > 0 ? Boolean.TRUE : Boolean.FALSE ) );
- UnoDialog2.setEnabled( getAD().btnDown , (lastFocusRow < scrollfields.size() - 1 ? Boolean.TRUE : Boolean.FALSE ) );
+ private void enableButtons()
+ {
+ UnoDialog2.setEnabled(getAD().btnInsert, (lastFocusRow < scrollfields.size() - 1 ? Boolean.TRUE : Boolean.FALSE));
+ UnoDialog2.setEnabled(getAD().btnRemove, (lastFocusRow < scrollfields.size() - 1 ? Boolean.TRUE : Boolean.FALSE));
+ UnoDialog2.setEnabled(getAD().btnUp, (lastFocusRow > 0 ? Boolean.TRUE : Boolean.FALSE));
+ UnoDialog2.setEnabled(getAD().btnDown, (lastFocusRow < scrollfields.size() - 1 ? Boolean.TRUE : Boolean.FALSE));
}
/**
* compolsary implementation of FocusListener.
+ * @param fe
*/
- public void focusLost(FocusEvent fe) {}
+ public void focusLost(FocusEvent fe)
+ {
+ }
+
/**
* compolsary implementation of FocusListener.
+ * @param o
*/
- public void disposing(EventObject o) {}
-
+ public void disposing(EventObject o)
+ {
+ }
/**
* Convenience method. Is used to get a reference of
* the template controller (live preview in background).
* @return the parent dialog, casted to AgendaWizardDialog.
*/
- private AgendaWizardDialog getAD() {
- return (AgendaWizardDialog)this.CurUnoDialog;
+ private AgendaWizardDialog getAD()
+ {
+ return (AgendaWizardDialog) this.CurUnoDialog;
}
/**
* move the current row up
*/
- public void rowUp() {
+ public void rowUp()
+ {
rowUp(lastFocusRow - nscrollvalue, lastFocusControl);
}
/**
* move the current row down.
*/
- public void rowDown() {
+ public void rowDown()
+ {
rowDown(lastFocusRow - nscrollvalue, lastFocusControl);
}
- private void lockDoc() {
+ private void lockDoc()
+ {
//((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.xTextDocument.lockControllers();
}
- private void unlockDoc() {
+ private void unlockDoc()
+ {
//((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.xTextDocument.unlockControllers();
}
@@ -383,17 +413,21 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* See general class documentation explanation about the
* data model used and the limitations which explain the implementation here.
*/
- public void removeRow() {
+ public void removeRow()
+ {
lockDoc();
- for (int i = lastFocusRow; i < scrollfields.size() - 1; i++) {
- PropertyValue[] pv1 = (PropertyValue[])scrollfields.get(i);
- PropertyValue[] pv2 = (PropertyValue[])scrollfields.get(i + 1);
+ for (int i = lastFocusRow; i < scrollfields.size() - 1; i++)
+ {
+ PropertyValue[] pv1 = (PropertyValue[]) scrollfields.get(i);
+ PropertyValue[] pv2 = (PropertyValue[]) scrollfields.get(i + 1);
pv1[1].Value = pv2[1].Value;
pv1[2].Value = pv2[2].Value;
pv1[3].Value = pv2[3].Value;
updateDocumentRow(i);
if (i - nscrollvalue < nblockincrement)
- fillupControls(i-nscrollvalue);
+ {
+ fillupControls(i - nscrollvalue);
+ }
}
removeLastRow();
// update the live preview background document
@@ -404,30 +438,32 @@ public class TopicsControl extends ControlScroller implements XFocusListener
unlockDoc();
}
-
/**
* Inserts a row before the current row.
* See general class documentation explanation about the
* data model used and the limitations which explain the implementation here.
*/
- public void insertRow() {
+ public void insertRow()
+ {
lockDoc();
insertRowAtEnd();
- for (int i = scrollfields.size() - 2; i > lastFocusRow; i--) {
- PropertyValue[] pv1 = (PropertyValue[])scrollfields.get(i);
- PropertyValue[] pv2 = (PropertyValue[])scrollfields.get(i - 1);
+ for (int i = scrollfields.size() - 2; i > lastFocusRow; i--)
+ {
+ PropertyValue[] pv1 = (PropertyValue[]) scrollfields.get(i);
+ PropertyValue[] pv2 = (PropertyValue[]) scrollfields.get(i - 1);
pv1[1].Value = pv2[1].Value;
pv1[2].Value = pv2[2].Value;
pv1[3].Value = pv2[3].Value;
updateDocumentRow(i);
- if (i - nscrollvalue < nblockincrement) {
- fillupControls(i-nscrollvalue);
+ if (i - nscrollvalue < nblockincrement)
+ {
+ fillupControls(i - nscrollvalue);
}
}
// after rotating all the properties from this row on,
// we clear the row, so it is practically a new one...
- PropertyValue[] pv1 = (PropertyValue[])scrollfields.get(lastFocusRow);
+ PropertyValue[] pv1 = (PropertyValue[]) scrollfields.get(lastFocusRow);
pv1[1].Value = "";
pv1[2].Value = "";
pv1[3].Value = "";
@@ -435,7 +471,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
// update the preview document.
updateDocumentRow(lastFocusRow);
- fillupControls(lastFocusRow-nscrollvalue);
+ fillupControls(lastFocusRow - nscrollvalue);
focus(lastFocusControl);
unlockDoc();
@@ -449,10 +485,11 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param i the index of the new row
* @return
*/
- private PropertyValue[] newRow(int i) {
+ private PropertyValue[] newRow(int i)
+ {
PropertyValue[] pv = new PropertyValue[4];
pv[0] = Properties.createProperty(LABEL + i, "" + (i + 1) + ".");
- pv[1] = Properties.createProperty(TOPIC + i, "" );
+ pv[1] = Properties.createProperty(TOPIC + i, "");
pv[2] = Properties.createProperty(RESP + i, "");
pv[3] = Properties.createProperty(TIME + i, "");
return pv;
@@ -462,11 +499,13 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* Implementation of ControlScroller
* This is a UI method which inserts a new row to the control.
* It uses the child-class ControlRow. (see below).
+ * @param _index
+ * @param npos
* @see ControlRow
*/
protected void insertControlGroup(int _index, int npos)
{
- ControlRow oControlRow = new ControlRow((AgendaWizardDialog)CurUnoDialog, iCompPosX, npos, _index, tabIndex);
+ ControlRow oControlRow = new ControlRow((AgendaWizardDialog) CurUnoDialog, iCompPosX, npos, _index, tabIndex);
ControlGroupVector.addElement(oControlRow);
tabIndex += 4;
}
@@ -475,11 +514,13 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* Implementation of ControlScroller
* This is a UI method which makes a row visibele.
* As far as I know it is never called.
+ * @param _index
+ * @param _bIsVisible
* @see ControlRow
*/
protected void setControlGroupVisible(int _index, boolean _bIsVisible)
{
- ((ControlRow)ControlGroupVector.get(_index)).setVisible(_bIsVisible);
+ ((ControlRow) ControlGroupVector.get(_index)).setVisible(_bIsVisible);
}
@@ -491,17 +532,16 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param row the index number of the row to check.
* @return true if empty. false if not.
*/
- protected boolean isRowEmpty(int row) {
- PropertyValue[] data = getTopicData(row );
+ protected boolean isRowEmpty(int row)
+ {
+ PropertyValue[] data = getTopicData(row);
// now - is this row empty?
- return
- data[1].Value.equals("") &&
- data[2].Value.equals("") &&
- data[3].Value.equals("");
+ return data[1].Value.equals("") &&
+ data[2].Value.equals("") &&
+ data[3].Value.equals("");
}
-
/**
* is used for data tracking.
*/
@@ -513,69 +553,86 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param guiRow
* @param column
*/
- synchronized void fieldChanged(int guiRow, int column) {
- synchronized (this) {
-
- try {
- // First, I update the document
- PropertyValue[] data = getTopicData(guiRow + nscrollvalue);
-
- if (data == null)
- return;
-
- boolean equal = true;
+ synchronized void fieldChanged(int guiRow, int column)
+ {
+ synchronized(this)
+ {
- if (oldData != null) {
- for (int i=0; i<data.length && equal; i++)
- equal = ( equal & data[i].Value.equals(oldData[i]) );
+ try
+ {
+ // First, I update the document
+ PropertyValue[] data = getTopicData(guiRow + nscrollvalue);
- if (equal)
+ if (data == null)
+ {
return;
- }
- else
- oldData = new Object[4];
-
- for (int i=0; i<data.length; i++)
- oldData[i] = data[i].Value;
-
- updateDocumentCell(guiRow + nscrollvalue, column, data);
-
- if (isRowEmpty(guiRow + nscrollvalue)) {
- /* if this is the row before the last one
- * (the last row is always empty)
- * delete the last row...
- */
- if ( guiRow + nscrollvalue == scrollfields.size() - 2) {
- removeLastRow();
-
- /*
- * now consequentially check the last two rows,
- * and remove the last one if they are both empty.
- * (actually I check always the "before last" row,
- * because the last one is always empty...
+ }
+ boolean equal = true;
+
+ if (oldData != null)
+ {
+ for (int i = 0; i < data.length && equal; i++)
+ {
+ equal = (equal & data[i].Value.equals(oldData[i]));
+ }
+ if (equal)
+ {
+ return;
+ }
+ }
+ else
+ {
+ oldData = new Object[4];
+ }
+ for (int i = 0; i < data.length; i++)
+ {
+ oldData[i] = data[i].Value;
+ }
+ updateDocumentCell(guiRow + nscrollvalue, column, data);
+
+ if (isRowEmpty(guiRow + nscrollvalue))
+ {
+ /* if this is the row before the last one
+ * (the last row is always empty)
+ * delete the last row...
*/
- while (scrollfields.size() > 1 && isRowEmpty(scrollfields.size() -2))
+ if (guiRow + nscrollvalue == scrollfields.size() - 2)
+ {
removeLastRow();
- ControlRow cr = (ControlRow)ControlGroupVector.get( scrollfields.size() - nscrollvalue - 1);
-
- // if a remove was performed, set focus to the last row with some data in it...
- focus(getControl( cr , column ));
+ /*
+ * now consequentially check the last two rows,
+ * and remove the last one if they are both empty.
+ * (actually I check always the "before last" row,
+ * because the last one is always empty...
+ */
+ while (scrollfields.size() > 1 && isRowEmpty(scrollfields.size() - 2))
+ {
+ removeLastRow();
+ }
+ ControlRow cr = (ControlRow) ControlGroupVector.get(scrollfields.size() - nscrollvalue - 1);
+
+ // if a remove was performed, set focus to the last row with some data in it...
+ focus(getControl(cr, column));
+
+ // update the preview document.
+ reduceDocumentToTopics();
+ }
- // update the preview document.
- reduceDocumentToTopics();
}
-
+ else
+ { // row contains data
+ // is this the last row?
+ if ((guiRow + nscrollvalue + 1) == scrollfields.size())
+ {
+ insertRowAtEnd();
+ }
+ }
}
-
- else { // row contains data
- // is this the last row?
- if ( ( guiRow + nscrollvalue + 1 ) == scrollfields.size() )
- insertRowAtEnd();
+ catch (Exception e)
+ {
+ e.printStackTrace();
}
- } catch (Exception e) {
- e.printStackTrace();
- }
}
}
@@ -585,10 +642,16 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param topic index of the topic to get.
* @return a PropertyValue array with the data for the given topic.
*/
- public PropertyValue[] getTopicData(int topic) {
+ public PropertyValue[] getTopicData(int topic)
+ {
if (topic < scrollfields.size())
- return ( PropertyValue[]) scrollfields.get ( topic ) ;
- else return null;
+ {
+ return (PropertyValue[]) scrollfields.get(topic);
+ }
+ else
+ {
+ return null;
+ }
}
/**
@@ -596,16 +659,20 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* there *are* more rows in the model, scroll down.
* @param event
*/
- public void lastControlKeyPressed(KeyEvent event) {
+ public void lastControlKeyPressed(KeyEvent event)
+ {
// if tab without shift was pressed...
- if ( ( event.KeyCode == Key.TAB ) && ( event.Modifiers==0 ) )
- // if there is another row...
- if ( (nblockincrement + nscrollvalue) < scrollfields.size() ) {
+ if ((event.KeyCode == Key.TAB) && (event.Modifiers == 0))
+ // if there is another row...
+ {
+ if ((nblockincrement + nscrollvalue) < scrollfields.size())
+ {
setScrollValue(nscrollvalue + 1);
//focus(firstTopic);
- focus(getControl((ControlRow) ControlGroupVector.get( 4 ), 1));
+ focus(getControl((ControlRow) ControlGroupVector.get(4), 1));
}
+ }
}
/**
@@ -613,26 +680,30 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* there *are* more rows in the model, scroll up.
* @param event
*/
- public void firstControlKeyPressed(KeyEvent event) {
+ public void firstControlKeyPressed(KeyEvent event)
+ {
// if tab with shift was pressed...
- if ( ( event.KeyCode == Key.TAB ) && ( event.Modifiers== KeyModifier.SHIFT ) )
-
- if ( nscrollvalue > 0 ) {
+ if ((event.KeyCode == Key.TAB) && (event.Modifiers == KeyModifier.SHIFT))
+ {
+ if (nscrollvalue > 0)
+ {
setScrollValue(nscrollvalue - 1);
focus(lastTime);
}
+ }
}
/**
* sets focus to the given control.
* @param textControl
*/
- private void focus(Object textControl) {
- ((XWindow)UnoRuntime.queryInterface(XWindow.class,textControl)).setFocus();
- XTextComponent xTextComponent = (XTextComponent)UnoRuntime.queryInterface(XTextComponent.class,textControl);
+ private void focus(Object textControl)
+ {
+ ((XWindow) UnoRuntime.queryInterface(XWindow.class, textControl)).setFocus();
+ XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, textControl);
String text = xTextComponent.getText();
- xTextComponent.setSelection( new Selection(0, text.length()) );
- XControl xc = (XControl)UnoRuntime.queryInterface(XControl.class,textControl);
+ xTextComponent.setSelection(new Selection(0, text.length()));
+ XControl xc = (XControl) UnoRuntime.queryInterface(XControl.class, textControl);
focusGained(xc);
}
@@ -641,43 +712,51 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param guiRow the gui index of the row to move.
* @param control the control to gain focus after moving.
*/
- synchronized void rowDown(int guiRow, Object control ) {
+ synchronized void rowDown(int guiRow, Object control)
+ {
// only perform if this is not the last row.
int actuallRow = guiRow + nscrollvalue;
- if ( actuallRow + 1 < scrollfields.size() ) {
+ if (actuallRow + 1 < scrollfields.size())
+ {
// get the current selection
- Selection selection = getSelection(control );
+ Selection selection = getSelection(control);
// the last row should scroll...
- boolean scroll = guiRow == ( nblockincrement - 1 );
+ boolean scroll = guiRow == (nblockincrement - 1);
if (scroll)
- setScrollValue( nscrollvalue + 1 );
+ {
+ setScrollValue(nscrollvalue + 1);
+ }
int scroll1 = nscrollvalue;
- switchRows( guiRow , guiRow + (scroll ? -1 : 1));
+ switchRows(guiRow, guiRow + (scroll ? -1 : 1));
if (nscrollvalue != scroll1)
+ {
guiRow += (nscrollvalue - scroll1);
-
- setSelection(guiRow + (scroll ? 0 : 1 ) , control , selection);
+ }
+ setSelection(guiRow + (scroll ? 0 : 1), control, selection);
}
}
- synchronized void rowUp(int guiRow, Object control ) {
+ synchronized void rowUp(int guiRow, Object control)
+ {
// only perform if this is not the first row
int actuallRow = guiRow + nscrollvalue;
- if ( actuallRow > 0 ) {
+ if (actuallRow > 0)
+ {
// get the current selection
- Selection selection = getSelection( control );
+ Selection selection = getSelection(control);
// the last row should scroll...
boolean scroll = (guiRow == 0);
if (scroll)
- setScrollValue( nscrollvalue - 1 );
-
- switchRows( guiRow , guiRow + (scroll ? 1 : -1));
+ {
+ setScrollValue(nscrollvalue - 1);
+ }
+ switchRows(guiRow, guiRow + (scroll ? 1 : -1));
- setSelection(guiRow - (scroll ? 0 : 1 ) ,control , selection);
+ setSelection(guiRow - (scroll ? 0 : 1), control, selection);
}
}
@@ -686,21 +765,26 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param guiRow
* @param control
*/
- synchronized void cursorUp(int guiRow, Object control ) {
+ synchronized void cursorUp(int guiRow, Object control)
+ {
// is this the last full row ?
int actuallRow = guiRow + nscrollvalue;
//if this is the first row
- if ( actuallRow == 0 )
+ if (actuallRow == 0)
+ {
return;
// the first row should scroll...
+ }
boolean scroll = (guiRow == 0);
ControlRow upperRow;
- if (scroll) {
- setScrollValue( nscrollvalue - 1 );
- upperRow = (ControlRow) ControlGroupVector.get( guiRow );
+ if (scroll)
+ {
+ setScrollValue(nscrollvalue - 1);
+ upperRow = (ControlRow) ControlGroupVector.get(guiRow);
}
- else {
- upperRow = (ControlRow) ControlGroupVector.get( guiRow - 1 );
+ else
+ {
+ upperRow = (ControlRow) ControlGroupVector.get(guiRow - 1);
}
focus(getControl(upperRow, control));
@@ -711,40 +795,45 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param guiRow
* @param control
*/
- synchronized void cursorDown(int guiRow, Object control ) {
+ synchronized void cursorDown(int guiRow, Object control)
+ {
// is this the last full row ?
int actuallRow = guiRow + nscrollvalue;
//if this is the last row, exit
if (actuallRow == scrollfields.size() - 1)
+ {
return;
// the first row should scroll...
+ }
boolean scroll = (guiRow == nblockincrement - 1);
ControlRow lowerRow;
- if (scroll) {
- setScrollValue( nscrollvalue + 1 );
- lowerRow = (ControlRow) ControlGroupVector.get( guiRow );
+ if (scroll)
+ {
+ setScrollValue(nscrollvalue + 1);
+ lowerRow = (ControlRow) ControlGroupVector.get(guiRow);
}
// if we scrolled we are done...
//otherwise...
- else {
- lowerRow = (ControlRow) ControlGroupVector.get( guiRow + 1 );
+ else
+ {
+ lowerRow = (ControlRow) ControlGroupVector.get(guiRow + 1);
}
focus(getControl(lowerRow, control));
}
-
-
/**
* changes the values of the given rows with eachother
* @param row1 one can figure out what this parameter is...
* @param row2 one can figure out what this parameter is...
*/
- private void switchRows( int row1, int row2) {
+ private void switchRows(int row1, int row2)
+ {
PropertyValue[] o1 = (PropertyValue[]) scrollfields.get(row1 + nscrollvalue);
PropertyValue[] o2 = (PropertyValue[]) scrollfields.get(row2 + nscrollvalue);
Object temp = null;
- for (int i = 1; i < o1.length; i++) {
+ for (int i = 1; i < o1.length; i++)
+ {
temp = o1[i].Value;
o1[i].Value = o2[i].Value;
o2[i].Value = temp;
@@ -753,15 +842,15 @@ public class TopicsControl extends ControlScroller implements XFocusListener
fillupControls(row1);
fillupControls(row2);
- updateDocumentRow( row1 + nscrollvalue, o1 );
- updateDocumentRow( row2 + nscrollvalue, o2 );
+ updateDocumentRow(row1 + nscrollvalue, o1);
+ updateDocumentRow(row2 + nscrollvalue, o2);
/*
* if we changed the last row, add another one...
*/
- if ( ( row1 + nscrollvalue + 1 == scrollfields.size() ) ||
- ( row2 + nscrollvalue + 1 == scrollfields.size() )
- )
+ if ((row1 + nscrollvalue + 1 == scrollfields.size()) ||
+ (row2 + nscrollvalue + 1 == scrollfields.size()))
+ {
insertRowAtEnd();
/*
* if we did not change the last row but
@@ -769,12 +858,15 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* have two empty rows at the end.
* If so, delete the last one...
*/
- else if ( (row1 + nscrollvalue) + (row2 + nscrollvalue) == ( scrollfields.size() * 2 - 5 ) )
- if ( isRowEmpty( scrollfields.size() -2) && isRowEmpty( scrollfields.size() -1) ) {
+ }
+ else if ((row1 + nscrollvalue) + (row2 + nscrollvalue) == (scrollfields.size() * 2 - 5))
+ {
+ if (isRowEmpty(scrollfields.size() - 2) && isRowEmpty(scrollfields.size() - 1))
+ {
removeLastRow();
reduceDocumentToTopics();
}
-
+ }
}
/**
@@ -783,8 +875,9 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* should be gotten.
* @return the selection object.
*/
- private Selection getSelection(Object control) {
- return ((XTextComponent)UnoRuntime.queryInterface(XTextComponent.class,control)).getSelection();
+ private Selection getSelection(Object control)
+ {
+ return ((XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, control)).getSelection();
}
/**
@@ -801,32 +894,37 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param eventSource helps to detect the control's column to set the selection to.
* @param s the selection object to set.
*/
- private void setSelection(int guiRow, Object eventSource, Selection s) {
- ControlRow cr = (ControlRow)ControlGroupVector.get(guiRow);
+ private void setSelection(int guiRow, Object eventSource, Selection s)
+ {
+ ControlRow cr = (ControlRow) ControlGroupVector.get(guiRow);
Object control = getControl(cr, eventSource);
- ((XWindow)UnoRuntime.queryInterface(XWindow.class,control)).setFocus();
- ((XTextComponent)UnoRuntime.queryInterface(XTextComponent.class,control)).setSelection(s);
+ ((XWindow) UnoRuntime.queryInterface(XWindow.class, control)).setFocus();
+ ((XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, control)).setSelection(s);
}
-
-
/**
* returns a control out of the given row, according to a column number.
* @param cr control row object.
* @param column the column number.
* @return the control...
*/
- private Object getControl( ControlRow cr, int column) {
- switch ( column ) {
- case 0 : return cr.label;
- case 1 : return cr.textbox;
- case 2 : return cr.combobox;
- case 3 : return cr.timebox;
- default: throw new IllegalArgumentException("No such column");
+ private Object getControl(ControlRow cr, int column)
+ {
+ switch (column)
+ {
+ case 0:
+ return cr.label;
+ case 1:
+ return cr.textbox;
+ case 2:
+ return cr.combobox;
+ case 3:
+ return cr.timebox;
+ default:
+ throw new IllegalArgumentException("No such column");
}
}
-
/**
* returns a control out of the given row, which is
* in the same column as the given control.
@@ -834,9 +932,10 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param control a control indicating a column.
* @return
*/
- private Object getControl(ControlRow cr, Object control) {
+ private Object getControl(ControlRow cr, Object control)
+ {
int column = getColumn(control);
- return getControl(cr,column);
+ return getControl(cr, column);
}
/**
@@ -844,26 +943,35 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param control
* @return
*/
- private int getColumn(Object control) {
- String name = (String)Helper.getUnoPropertyValue(UnoDialog2.getModel(control),"Name");
- if (name.startsWith( TOPIC ))
+ private int getColumn(Object control)
+ {
+ String name = (String) Helper.getUnoPropertyValue(UnoDialog2.getModel(control), "Name");
+ if (name.startsWith(TOPIC))
+ {
return 1;
- if (name.startsWith( RESP ))
+ }
+ if (name.startsWith(RESP))
+ {
return 2;
- if (name.startsWith( TIME ))
+ }
+ if (name.startsWith(TIME))
+ {
return 3;
- if (name.startsWith( LABEL ))
+ }
+ if (name.startsWith(LABEL))
+ {
return 0;
+ }
return -1;
}
-
/**
* updates the given row in the preview document.
* @param row
*/
- private void updateDocumentRow( int row ) {
- updateDocumentRow( row , (PropertyValue[])scrollfields.get(row));
+ private void updateDocumentRow(int row)
+ {
+ updateDocumentRow(row, (PropertyValue[]) scrollfields.get(row));
}
/**
@@ -871,11 +979,14 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param row
* @param data
*/
- private void updateDocumentRow( int row , PropertyValue[] data) {
- try {
- ((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.topics.write(row, data);
+ private void updateDocumentRow(int row, PropertyValue[] data)
+ {
+ try
+ {
+ ((AgendaWizardDialogImpl) CurUnoDialog).agendaTemplate.topics.write(row, data);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -888,11 +999,14 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param column the column to update (a gui column, not a document column).
* @param data the data of the entire row.
*/
- private void updateDocumentCell( int row , int column, PropertyValue[] data) {
- try {
- ((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.topics.writeCell(row, column, data);
+ private void updateDocumentCell(int row, int column, PropertyValue[] data)
+ {
+ try
+ {
+ ((AgendaWizardDialogImpl) CurUnoDialog).agendaTemplate.topics.writeCell(row, column, data);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -902,11 +1016,14 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* the preview document to show the number of rows
* according to the data model.
*/
- private void reduceDocumentToTopics() {
- try {
- ((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.topics.reduceDocumentTo(scrollfields.size()-1);
+ private void reduceDocumentToTopics()
+ {
+ try
+ {
+ ((AgendaWizardDialogImpl) CurUnoDialog).agendaTemplate.topics.reduceDocumentTo(scrollfields.size() - 1);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -915,10 +1032,10 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* needed to make this data poblic.
* @return the List containing the topics data.
*/
- public List getTopicsData() {
+ public List getTopicsData()
+ {
return scrollfields;
}
-
/**
* A static member used for the child-class ControlRow (GUI Constant)
*/
@@ -930,11 +1047,17 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* A static member used for the child-class ControlRow (GUI Constant)
*/
- private static final String[] LABEL_PROPS = new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"};
+ private static final String[] LABEL_PROPS = new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ };
/**
* A static member used for the child-class ControlRow (GUI Constant)
*/
- private static final String[] TEXT_PROPS = new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"};
+ private static final String[] TEXT_PROPS = new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ };
/**
*
@@ -944,7 +1067,9 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* are being called and handle controls of
* a single row.
*/
- public class ControlRow implements XKeyListener {
+ public class ControlRow implements XKeyListener
+ {
+
/**
* the number (label) control
*/
@@ -961,7 +1086,6 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* the time (text, yes, text) control
*/
Object timebox;
-
/**
* the row offset of this instance (0 = first gui row)
*/
@@ -972,50 +1096,57 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* topic text is changed by the user.
* updates the data model and the preview document.
*/
- public void topicTextChanged() {
- try {
+ public void topicTextChanged()
+ {
+ try
+ {
// update the data model
- fieldInfo(offset,1);
+ fieldInfo(offset, 1);
// update the preview document
- fieldChanged(offset,1);
+ fieldChanged(offset, 1);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
-
/**
* called through an event listener when the
* responsible text is changed by the user.
* updates the data model and the preview document.
*/
- public void responsibleTextChanged() {
- try {
+ public void responsibleTextChanged()
+ {
+ try
+ {
// update the data model
- fieldInfo(offset,2);
+ fieldInfo(offset, 2);
// update the preview document
- fieldChanged(offset,2);
+ fieldChanged(offset, 2);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
-
/**
* called through an event listener when the
* time text is changed by the user.
* updates the data model and the preview document.
*/
- public void timeTextChanged() {
- try {
+ public void timeTextChanged()
+ {
+ try
+ {
// update the data model
- fieldInfo(offset,3);
+ fieldInfo(offset, 3);
// update the preview document
- fieldChanged(offset,3);
+ fieldChanged(offset, 3);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -1032,31 +1163,40 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param i the gui row index
* @param tabindex first tab index for this row.
*/
- public ControlRow(AgendaWizardDialog dialog, int x, int y, int i, int tabindex) {
+ public ControlRow(AgendaWizardDialog dialog, int x, int y, int i, int tabindex)
+ {
offset = i;
Integer y_ = new Integer(y);
- label = dialog.insertLabel( LABEL + i,
+ label = dialog.insertLabel(LABEL + i,
LABEL_PROPS,
- new Object[] {I_8, "" + (i + 1) + "." , new Integer(x+4), new Integer(y+2), IStep, new Short((short)tabindex), new Integer(10)}
- );
+ new Object[]
+ {
+ I_8, "" + (i + 1) + ".", new Integer(x + 4), new Integer(y + 2), IStep, new Short((short) tabindex), new Integer(10)
+ });
- textbox = dialog.insertTextField( TOPIC + i, "topicTextChanged" , this,
+ textbox = dialog.insertTextField(TOPIC + i, "topicTextChanged", this,
TEXT_PROPS,
- new Object[] { I_12, "HID:" + (curHelpIndex + i * 3 + 1) , new Integer(x+15),y_,IStep ,new Short((short)(tabindex + 1)), new Integer(84)}
- );
+ new Object[]
+ {
+ I_12, "HID:" + (curHelpIndex + i * 3 + 1), new Integer(x + 15), y_, IStep, new Short((short) (tabindex + 1)), new Integer(84)
+ });
- combobox = dialog.insertTextField( RESP + i, "responsibleTextChanged",this,
- TEXT_PROPS,
- new Object[] { I_12, "HID:" + (curHelpIndex + i * 3 + 2) , new Integer(x + 103),y_,IStep, new Short((short)(tabindex+ 2)), new Integer(68)}
- );
+ combobox = dialog.insertTextField(RESP + i, "responsibleTextChanged", this,
+ TEXT_PROPS,
+ new Object[]
+ {
+ I_12, "HID:" + (curHelpIndex + i * 3 + 2), new Integer(x + 103), y_, IStep, new Short((short) (tabindex + 2)), new Integer(68)
+ });
- timebox = dialog.insertTextField( TIME + i , "timeTextChanged", this,
+ timebox = dialog.insertTextField(TIME + i, "timeTextChanged", this,
TEXT_PROPS,
- new Object[] { I_12, "HID:" + (curHelpIndex + i * 3 + 3), new Integer(x + 175),y_, IStep , new Short((short)(tabindex + 3)), new Integer(20)}
- );
+ new Object[]
+ {
+ I_12, "HID:" + (curHelpIndex + i * 3 + 3), new Integer(x + 175), y_, IStep, new Short((short) (tabindex + 3)), new Integer(20)
+ });
setEnabled(false);
addKeyListener(textbox, this);
@@ -1073,40 +1213,47 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* not implemented.
* @param visible
*/
- public void setVisible(boolean visible) {
- // Helper.setUnoPropertyValue(UnoDialog2.getModel(button),"Visible", visible ? Boolean.TRUE : Boolean.FASLE);
+ public void setVisible(boolean visible)
+ {
+ // Helper.setUnoPropertyValue(UnoDialog2.getModel(button),"Visible", visible ? Boolean.TRUE : Boolean.FASLE);
}
/**
* enables/disables the row.
* @param enabled true for enable, false for disable.
*/
- public void setEnabled(boolean enabled) {
+ public void setEnabled(boolean enabled)
+ {
Boolean b = enabled ? Boolean.TRUE : Boolean.FALSE;
- UnoDialog2.setEnabled(label,b);
- UnoDialog2.setEnabled(textbox,b);
- UnoDialog2.setEnabled(combobox,b);
- UnoDialog2.setEnabled(timebox,b);
+ UnoDialog2.setEnabled(label, b);
+ UnoDialog2.setEnabled(textbox, b);
+ UnoDialog2.setEnabled(combobox, b);
+ UnoDialog2.setEnabled(timebox, b);
}
-
/**
* Impelementation of XKeyListener.
* Optionally performs the one of the following:
* cursor up, or down, row up or down
*/
- public void keyPressed(KeyEvent event) {
- if (isMoveDown(event)) {
- rowDown(offset , event.Source);
+ public void keyPressed(KeyEvent event)
+ {
+ if (isMoveDown(event))
+ {
+ rowDown(offset, event.Source);
}
- else if (isMoveUp(event)) {
+ else if (isMoveUp(event))
+ {
rowUp(offset, event.Source);
}
else if (isDown(event))
+ {
cursorDown(offset, event.Source);
+ }
else if (isUp(event))
+ {
cursorUp(offset, event.Source);
-
+ }
enableButtons();
}
@@ -1117,42 +1264,60 @@ public class TopicsControl extends ControlScroller implements XFocusListener
* @param control
* @return an int columnd number of the given control (0 to 3).
*/
- private int getColumn(Object control) {
- if ( control == textbox )
+ private int getColumn(Object control)
+ {
+ if (control == textbox)
+ {
return 1;
- else if ( control == combobox )
+ }
+ else if (control == combobox)
+ {
return 2;
- else if ( control == timebox )
+ }
+ else if (control == timebox)
+ {
return 3;
- else if ( control == label )
+ }
+ else if (control == label)
+ {
return 0;
+ }
else
+ {
throw new IllegalArgumentException("Control is not part of this ControlRow");
+ }
}
- private boolean isMoveDown(KeyEvent e) {
- return ( e.KeyCode == Key.DOWN ) && ( e.Modifiers == KeyModifier.MOD1 );
+ private boolean isMoveDown(KeyEvent e)
+ {
+ return (e.KeyCode == Key.DOWN) && (e.Modifiers == KeyModifier.MOD1);
}
- private boolean isMoveUp(KeyEvent e) {
- return ( e.KeyCode == Key.UP ) && ( e.Modifiers == KeyModifier.MOD1 );
+
+ private boolean isMoveUp(KeyEvent e)
+ {
+ return (e.KeyCode == Key.UP) && (e.Modifiers == KeyModifier.MOD1);
}
- private boolean isDown(KeyEvent e) {
- return ( e.KeyCode == Key.DOWN ) && ( e.Modifiers == 0 );
+
+ private boolean isDown(KeyEvent e)
+ {
+ return (e.KeyCode == Key.DOWN) && (e.Modifiers == 0);
}
- private boolean isUp(KeyEvent e) {
- return ( e.KeyCode == Key.UP ) && ( e.Modifiers == 0 );
+
+ private boolean isUp(KeyEvent e)
+ {
+ return (e.KeyCode == Key.UP) && (e.Modifiers == 0);
}
- public void keyReleased(KeyEvent arg0) {
+ public void keyReleased(KeyEvent arg0)
+ {
}
/* (non-Javadoc)
* @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
*/
- public void disposing(EventObject arg0) {
+ public void disposing(EventObject arg0)
+ {
}
-
}
-
}
diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.java b/wizards/com/sun/star/wizards/common/ConfigGroup.java
index 90281b571827..7f0654849b75 100644
--- a/wizards/com/sun/star/wizards/common/ConfigGroup.java
+++ b/wizards/com/sun/star/wizards/common/ConfigGroup.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.common;
import java.lang.reflect.Field;
@@ -36,35 +35,52 @@ import java.lang.reflect.Field;
*
* @author rpiterman
*/
-public class ConfigGroup implements ConfigNode {
+public class ConfigGroup implements ConfigNode
+{
public Object root;
- public void writeConfiguration(Object configurationView, Object param) {
+ public void writeConfiguration(Object configurationView, Object param)
+ {
Field[] fields = getClass().getFields();
for (int i = 0; i < fields.length; i++)
+ {
if (fields[i].getName().startsWith((String) param))
- try {
+ {
+ try
+ {
writeField(fields[i], configurationView, (String) param);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
System.out.println("Error writing field: " + fields[i].getName());
ex.printStackTrace();
}
+ }
+ }
}
- private void writeField(Field field, Object configView, String prefix) throws Exception {
+ private void writeField(Field field, Object configView, String prefix) throws Exception
+ {
String propertyName = field.getName().substring(prefix.length());
//System.out.println("Going to save:" + propertyName);
Class fieldType = field.getType();
- if (ConfigNode.class.isAssignableFrom(fieldType)) {
+ if (ConfigNode.class.isAssignableFrom(fieldType))
+ {
Object childView = Configuration.addConfigNode(configView, propertyName);
ConfigNode child = (ConfigNode) field.get(this);
child.writeConfiguration(childView, prefix);
- } else if (fieldType.isPrimitive()) {
+ }
+ else if (fieldType.isPrimitive())
+ {
Configuration.set(convertValue(field), propertyName, configView);
- } else if (fieldType.equals(String.class))
+ }
+ else if (fieldType.equals(String.class))
+ {
Configuration.set(field.get(this), propertyName, configView);
+ }
}
+
/**
* convert the primitive type value of the
* given Field object to the corresponding
@@ -72,63 +88,98 @@ public class ConfigGroup implements ConfigNode {
* @param field
* @return the value of the field as a Object.
*/
- public Object convertValue(Field field) throws IllegalAccessException {
+ public Object convertValue(Field field) throws IllegalAccessException
+ {
if (field.getType().equals(Boolean.TYPE))
+ {
return (field.getBoolean(this) ? Boolean.TRUE : Boolean.FALSE);
+ }
if (field.getType().equals(Integer.TYPE))
+ {
return new Integer(field.getInt(this));
+ }
if (field.getType().equals(Short.TYPE))
+ {
return new Short(field.getShort(this));
+ }
if (field.getType().equals(Float.TYPE))
+ {
return new Double(field.getFloat(this));
- if (field.getType().equals(Double.TYPE)) {
+ }
+ if (field.getType().equals(Double.TYPE))
+ {
return new Double(field.getDouble(this));
}
//System.out.println("ohoh...");
return null; //and good luck with it :-) ...
}
- public void readConfiguration(Object configurationView, Object param) {
+ public void readConfiguration(Object configurationView, Object param)
+ {
Field[] fields = getClass().getFields();
for (int i = 0; i < fields.length; i++)
+ {
if (fields[i].getName().startsWith((String) param))
- try {
+ {
+ try
+ {
readField(fields[i], configurationView, (String) param);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
System.out.println("Error reading field: " + fields[i].getName());
ex.printStackTrace();
}
+ }
+ }
}
- private void readField(Field field, Object configView, String prefix) throws Exception {
+ private void readField(Field field, Object configView, String prefix) throws Exception
+ {
String propertyName = field.getName().substring(prefix.length());
Class fieldType = field.getType();
- if (ConfigNode.class.isAssignableFrom(fieldType)) {
+ if (ConfigNode.class.isAssignableFrom(fieldType))
+ {
ConfigNode child = (ConfigNode) field.get(this);
child.setRoot(root);
child.readConfiguration(Configuration.getNode(propertyName, configView), prefix);
- } else if (fieldType.isPrimitive()) {
+ }
+ else if (fieldType.isPrimitive())
+ {
if (fieldType.equals(Boolean.TYPE))
+ {
field.setBoolean(this, Configuration.getBoolean(propertyName, configView));
+ }
else if (fieldType.equals(Integer.TYPE))
+ {
field.setInt(this, Configuration.getInt(propertyName, configView));
+ }
else if (fieldType.equals(Short.TYPE))
+ {
field.setShort(this, Configuration.getShort(propertyName, configView));
+ }
else if (fieldType.equals(Float.TYPE))
+ {
field.setFloat(this, Configuration.getFloat(propertyName, configView));
+ }
else if (fieldType.equals(Double.TYPE))
+ {
field.setDouble(this, Configuration.getDouble(propertyName, configView));
- } else if (fieldType.equals(String.class))
+ }
+ }
+ else if (fieldType.equals(String.class))
+ {
field.set(this, Configuration.getString(propertyName, configView));
+ }
}
- public void setRoot(Object newRoot) {
+ public void setRoot(Object newRoot)
+ {
root = newRoot;
}
/* (non-Javadoc)
* @see com.sun.star.wizards.common.ConfigNode#writeConfiguration(java.lang.Object, java.lang.Object)
*/
-
}
diff --git a/wizards/com/sun/star/wizards/common/ConfigNode.java b/wizards/com/sun/star/wizards/common/ConfigNode.java
index 1f249b7f88b7..9ba689ffba0c 100644
--- a/wizards/com/sun/star/wizards/common/ConfigNode.java
+++ b/wizards/com/sun/star/wizards/common/ConfigNode.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.common;
/**
@@ -38,7 +37,8 @@ package com.sun.star.wizards.common;
* The root is the first Java Object in the configuration hirarchie.
* @author rpiterman
*/
-public interface ConfigNode {
+public interface ConfigNode
+{
/**
* reads the object data out of the configuration.
@@ -49,7 +49,8 @@ public interface ConfigNode {
* it might be practical to be able to pass an extra parameter, for a free use.
*/
public void readConfiguration(Object configurationView, Object param);
+
public void writeConfiguration(Object configurationView, Object param);
- public void setRoot(Object root);
+ public void setRoot(Object root);
}
diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.java b/wizards/com/sun/star/wizards/common/ConfigSet.java
index c40feaef419e..1cc7a26b75c2 100644
--- a/wizards/com/sun/star/wizards/common/ConfigSet.java
+++ b/wizards/com/sun/star/wizards/common/ConfigSet.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.common;
+ ************************************************************************/
+package com.sun.star.wizards.common;
import java.util.*;
@@ -40,12 +41,13 @@ import org.w3c.dom.*;
*
* @author rpiterman
*/
-public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
+public class ConfigSet implements ConfigNode, XMLProvider, ListModel
+{
+
private Class childClass;
private Map childrenMap = new HashMap();
private List childrenList = new Vector();
public Object root;
-
/**
* After reading the configuration set items,
* the ConfigSet checks this field.
@@ -55,111 +57,150 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
* to avoid this "deletion" of nulls.
*/
protected boolean noNulls = true;
-
/** Utility field used by event firing mechanism. */
private javax.swing.event.EventListenerList listenerList = null;
- public ConfigSet(Class childType) {
+ public ConfigSet(Class childType)
+ {
childClass = childType;
}
- public void add(String name, Object child) {
+ public void add(String name, Object child)
+ {
childrenMap.put(name, child);
- try {
+ try
+ {
int i = ((Indexable) child).getIndex();
int oldSize = getSize();
while (getSize() <= i)
+ {
childrenList.add(null);
+ }
childrenList.set(i, child);
if (oldSize > i)
+ {
oldSize = i;
+ }
fireListDataListenerIntervalAdded(oldSize, i);
- } catch (ClassCastException cce) {
+ }
+ catch (ClassCastException cce)
+ {
childrenList.add(child);
fireListDataListenerIntervalAdded(getSize() - 1, getSize() - 1);
}
}
- public void add(int i, Object o) {
+ public void add(int i, Object o)
+ {
int name = i;
while (getElement("" + name) != null)
+ {
name++;
-
+ }
childrenMap.put("" + name, o);
childrenList.add(i, o);
fireListDataListenerIntervalAdded(i, i);
}
- protected Object createChild() throws InstantiationException, IllegalAccessException {
+ protected Object createChild() throws InstantiationException, IllegalAccessException
+ {
return childClass.newInstance();
}
- public void writeConfiguration(Object configView, Object param) {
+ public void writeConfiguration(Object configView, Object param)
+ {
Object[] names = childrenMap.keySet().toArray();
- if (ConfigNode.class.isAssignableFrom(childClass)) {
+ if (ConfigNode.class.isAssignableFrom(childClass))
+ {
//first I remove all the children from the configuration.
String children[] = Configuration.getChildrenNames(configView);
- for (int i = 0; i<children.length; i++)
- try {
- Configuration.removeNode(configView,children[i]);
+ for (int i = 0; i < children.length; i++)
+ {
+ try
+ {
+ Configuration.removeNode(configView, children[i]);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
- }
-
- // and add them new.
- for (int i = 0; i < names.length; i++) {
- try {
+ } // and add them new.
+ }
+ for (int i = 0; i < names.length; i++)
+ {
+ try
+ {
ConfigNode child = (ConfigNode) getElement(names[i]);
Object childView = Configuration.addConfigNode(configView, (String) names[i]);
child.writeConfiguration(childView, param);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
}
//for a set of primitive / String type.
else
+ {
throw new IllegalArgumentException("Unable to write primitive sets to configuration (not implemented)");
-
+ }
}
- public void readConfiguration(Object configurationView, Object param) {
+ public void readConfiguration(Object configurationView, Object param)
+ {
String[] names = Configuration.getChildrenNames(configurationView);
- if (ConfigNode.class.isAssignableFrom(childClass)) {
+ if (ConfigNode.class.isAssignableFrom(childClass))
+ {
- for (int i = 0; i < names.length; i++) {
- try {
+ for (int i = 0; i < names.length; i++)
+ {
+ try
+ {
ConfigNode child = (ConfigNode) createChild();
child.setRoot(root);
child.readConfiguration(Configuration.getNode(names[i], configurationView), param);
add(names[i], child);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
//remove any nulls from the list
if (noNulls)
+ {
for (int i = 0; i < childrenList.size(); i++)
+ {
if (childrenList.get(i) == null)
+ {
childrenList.remove(i--);
+ }
+ }
+ }
}
//for a set of primitive / String type.
else
- for (int i = 0; i < names.length; i++) {
- try {
+ {
+ for (int i = 0; i < names.length; i++)
+ {
+ try
+ {
Object child = Configuration.getNode(names[i], configurationView);
add(names[i], child);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
+ }
}
- public void remove(Object obj) {
+ public void remove(Object obj)
+ {
Object key = getKey(obj);
childrenMap.remove(key);
int i = childrenList.indexOf(obj);
@@ -167,62 +208,81 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
fireListDataListenerIntervalRemoved(i, i);
}
- public void remove(int i) {
+ public void remove(int i)
+ {
Object o = getElementAt(i);
remove(o);
}
- public void clear() {
+ public void clear()
+ {
childrenMap.clear();
childrenList.clear();
}
- public void update(int i) {
+ public void update(int i)
+ {
fireListDataListenerContentsChanged(i, i);
}
- public Node createDOM(Node parent) {
+ public Node createDOM(Node parent)
+ {
Object[] items = items();
- for (int i = 0; i < items.length; i++) {
+ for (int i = 0; i < items.length; i++)
+ {
Object item = items[i];
if (item instanceof XMLProvider)
- ((XMLProvider) item).createDOM(parent);
-
+ {
+ ((XMLProvider) item).createDOM(parent);
+ }
}
return parent;
}
- public Object[] items() {
+ public Object[] items()
+ {
return childrenList.toArray();
}
- public Object getKey(Object object) {
- for (Iterator i = childrenMap.entrySet().iterator(); i.hasNext();) {
+ public Object getKey(Object object)
+ {
+ for (Iterator i = childrenMap.entrySet().iterator(); i.hasNext();)
+ {
Map.Entry me = (Map.Entry) i.next();
if (me.getValue() == object)
+ {
return me.getKey();
-
+ }
}
return null;
}
- public Object getKey(int i) {
+ public Object getKey(int i)
+ {
int c = 0;
- while (i > -1) {
+ while (i > -1)
+ {
if (getElementAt(c) != null)
+ {
i--;
+ }
c++;
}
if (c == 0)
+ {
return null;
+ }
else
+ {
return getKey(getElementAt(c - 1));
+ }
}
- public void setRoot(Object newRoot) {
+ public void setRoot(Object newRoot)
+ {
root = newRoot;
}
@@ -230,8 +290,10 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
* @param listener The listener to register.
*
*/
- public synchronized void addListDataListener(javax.swing.event.ListDataListener listener) {
- if (listenerList == null) {
+ public synchronized void addListDataListener(javax.swing.event.ListDataListener listener)
+ {
+ if (listenerList == null)
+ {
listenerList = new javax.swing.event.EventListenerList();
}
listenerList.add(javax.swing.event.ListDataListener.class, listener);
@@ -241,7 +303,8 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
* @param listener The listener to remove.
*
*/
- public synchronized void removeListDataListener(javax.swing.event.ListDataListener listener) {
+ public synchronized void removeListDataListener(javax.swing.event.ListDataListener listener)
+ {
listenerList.remove(javax.swing.event.ListDataListener.class, listener);
}
@@ -250,13 +313,18 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
* @param event The event to be fired
*
*/
- private void fireListDataListenerIntervalAdded(int i0, int i1) {
+ private void fireListDataListenerIntervalAdded(int i0, int i1)
+ {
ListDataEvent event = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, i0, i1);
if (listenerList == null)
+ {
return;
+ }
Object[] listeners = listenerList.getListenerList();
- for (int i = listeners.length - 2; i >= 0; i -= 2) {
- if (listeners[i] == javax.swing.event.ListDataListener.class) {
+ for (int i = listeners.length - 2; i >= 0; i -= 2)
+ {
+ if (listeners[i] == javax.swing.event.ListDataListener.class)
+ {
((javax.swing.event.ListDataListener) listeners[i + 1]).intervalAdded(event);
}
}
@@ -267,13 +335,18 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
* @param event The event to be fired
*
*/
- private void fireListDataListenerIntervalRemoved(int i0, int i1) {
+ private void fireListDataListenerIntervalRemoved(int i0, int i1)
+ {
ListDataEvent event = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, i0, i1);
if (listenerList == null)
+ {
return;
+ }
Object[] listeners = listenerList.getListenerList();
- for (int i = listeners.length - 2; i >= 0; i -= 2) {
- if (listeners[i] == javax.swing.event.ListDataListener.class) {
+ for (int i = listeners.length - 2; i >= 0; i -= 2)
+ {
+ if (listeners[i] == javax.swing.event.ListDataListener.class)
+ {
((javax.swing.event.ListDataListener) listeners[i + 1]).intervalRemoved(event);
}
}
@@ -284,35 +357,45 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
* @param event The event to be fired
*
*/
- private void fireListDataListenerContentsChanged(int i0, int i1) {
+ private void fireListDataListenerContentsChanged(int i0, int i1)
+ {
ListDataEvent event = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, i0, i1);
if (listenerList == null)
+ {
return;
+ }
Object[] listeners = listenerList.getListenerList();
- for (int i = listeners.length - 2; i >= 0; i -= 2) {
- if (listeners[i] == javax.swing.event.ListDataListener.class) {
+ for (int i = listeners.length - 2; i >= 0; i -= 2)
+ {
+ if (listeners[i] == javax.swing.event.ListDataListener.class)
+ {
((javax.swing.event.ListDataListener) listeners[i + 1]).contentsChanged(event);
}
}
}
- public Object getElementAt(int i) {
+ public Object getElementAt(int i)
+ {
return childrenList.get(i);
}
- public Object getElement(Object o) {
+ public Object getElement(Object o)
+ {
return childrenMap.get(o);
}
- public int getSize() {
+ public int getSize()
+ {
return childrenList.size();
}
- public Set keys() {
+ public Set keys()
+ {
return childrenMap.keySet();
}
- public int getIndexOf(Object item) {
+ public int getIndexOf(Object item)
+ {
return childrenList.indexOf(item);
}
@@ -325,7 +408,8 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
* @param confView
* @param memebrName
*/
- public void reindexSet(Object confView, String memberName, String indexPropertyName) throws Exception {
+ public void reindexSet(Object confView, String memberName, String indexPropertyName) throws Exception
+ {
/*
* First I read all memebrs of the set,
* except the one that should be number 0
@@ -336,29 +420,36 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel {
Object member = null;
int index = 0;
for (int i = 0; i < names.length; i++)
- if (!names[i].equals(memberName)) {
+ {
+ if (!names[i].equals(memberName))
+ {
member = Configuration.getConfigurationNode(names[i], confView);
index = Configuration.getInt(indexPropertyName, member);
while (index >= v.size())
+ {
v.add(null);
+ }
v.setElementAt(member, index);
}
/**
* Now I reindex them
*/
-
+ }
index = 1;
- for (int i = 0; i < v.size(); i++) {
+ for (int i = 0; i < v.size(); i++)
+ {
member = v.get(i);
if (member != null)
+ {
Configuration.set(index++, indexPropertyName, member);
+ }
}
}
- public void sort(Comparator comparator) {
+ public void sort(Comparator comparator)
+ {
Collections.sort(this.childrenList, comparator);
}
-
}
diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java
index 7b654da755ca..b17eccbcf3bf 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.java
+++ b/wizards/com/sun/star/wizards/common/Configuration.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.common;
+ ************************************************************************/
+package com.sun.star.wizards.common;
import com.sun.star.beans.*;
import com.sun.star.container.*;
@@ -51,83 +52,114 @@ import com.sun.star.util.XChangesBatch;
* the root of the registry.
* @author rpiterman
*/
-public abstract class Configuration {
+public abstract class Configuration
+{
- public static int getInt(String name, Object parent) throws Exception {
+ public static int getInt(String name, Object parent) throws Exception
+ {
Object o = getNode(name, parent);
if (AnyConverter.isVoid(o))
+ {
return 0;
+ }
return AnyConverter.toInt(o);
}
- public static short getShort(String name, Object parent) throws Exception {
+ public static short getShort(String name, Object parent) throws Exception
+ {
Object o = getNode(name, parent);
if (AnyConverter.isVoid(o))
+ {
return (short) 0;
+ }
return AnyConverter.toShort(o);
}
- public static float getFloat(String name, Object parent) throws Exception {
+ public static float getFloat(String name, Object parent) throws Exception
+ {
Object o = getNode(name, parent);
if (AnyConverter.isVoid(o))
+ {
return (float) 0;
+ }
return AnyConverter.toFloat(o);
}
- public static double getDouble(String name, Object parent) throws Exception {
+ public static double getDouble(String name, Object parent) throws Exception
+ {
Object o = getNode(name, parent);
if (AnyConverter.isVoid(o))
+ {
return (double) 0;
+ }
return AnyConverter.toDouble(o);
}
- public static String getString(String name, Object parent) throws Exception {
+ public static String getString(String name, Object parent) throws Exception
+ {
Object o = getNode(name, parent);
if (AnyConverter.isVoid(o))
+ {
return "";
+ }
return (String) o;
}
- public static boolean getBoolean(String name, Object parent) throws Exception {
+ public static boolean getBoolean(String name, Object parent) throws Exception
+ {
Object o = getNode(name, parent);
if (AnyConverter.isVoid(o))
+ {
return false;
+ }
return AnyConverter.toBoolean(o);
}
- public static Object getNode(String name, Object parent) throws Exception {
+ public static Object getNode(String name, Object parent) throws Exception
+ {
return ((XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, parent)).getByName(name);
}
- public static void set(int value, String name, Object parent) throws Exception {
+ public static void set(int value, String name, Object parent) throws Exception
+ {
set(new Integer(value), name, parent);
}
- public static void set(short value, String name, Object parent) throws Exception {
+ public static void set(short value, String name, Object parent) throws Exception
+ {
set(new Short(value), name, parent);
}
- public static void set(String value, String name, Object parent) throws Exception {
+ public static void set(String value, String name, Object parent) throws Exception
+ {
set((Object) value, name, parent);
}
- public static void set(boolean value, String name, Object parent) throws Exception {
+ public static void set(boolean value, String name, Object parent) throws Exception
+ {
if (value = true)
+ {
set(Boolean.TRUE, name, parent);
+ }
else
+ {
set(Boolean.FALSE, name, parent);
+ }
}
- public static void set(Object value, String name, Object parent) throws com.sun.star.lang.IllegalArgumentException, PropertyVetoException, UnknownPropertyException, WrappedTargetException {
+ public static void set(Object value, String name, Object parent) throws com.sun.star.lang.IllegalArgumentException, PropertyVetoException, UnknownPropertyException, WrappedTargetException
+ {
((XHierarchicalPropertySet) UnoRuntime.queryInterface(XHierarchicalPropertySet.class, parent)).setHierarchicalPropertyValue(name, value);
}
/** Creates a new instance of RegistryEntry */
- public static Object getConfigurationNode(String name, Object parent) throws Exception {
+ public static Object getConfigurationNode(String name, Object parent) throws Exception
+ {
return ((XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, parent)).getByName(name);
}
- public static Object getConfigurationRoot(XMultiServiceFactory xmsf, String sPath, boolean updateable) throws com.sun.star.uno.Exception {
+ public static Object getConfigurationRoot(XMultiServiceFactory xmsf, String sPath, boolean updateable) throws com.sun.star.uno.Exception
+ {
Object oConfigProvider;
oConfigProvider = xmsf.createInstance("com.sun.star.configuration.ConfigurationProvider");
@@ -143,7 +175,8 @@ public abstract class Configuration {
args[0] = aPathArgument;
- if (updateable) {
+ if (updateable)
+ {
PropertyValue aModeArgument = new PropertyValue();
aModeArgument.Name = "lazywrite";
@@ -155,17 +188,22 @@ public abstract class Configuration {
return confMsf.createInstanceWithArguments(sView, args);
}
- public static String[] getChildrenNames(Object configView) {
+ public static String[] getChildrenNames(Object configView)
+ {
XNameAccess nameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, configView);
return nameAccess.getElementNames();
}
- public static String getProductName(XMultiServiceFactory xMSF) {
- try {
+ public static String getProductName(XMultiServiceFactory xMSF)
+ {
+ try
+ {
Object oProdNameAccess = getConfigurationRoot(xMSF, "org.openoffice.Setup/Product", false);
String ProductName = (String) Helper.getUnoObjectbyName(oProdNameAccess, "ooName");
return ProductName;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
@@ -196,16 +234,22 @@ public abstract class Configuration {
String[] sLocaleList = JavaTools.ArrayoutofString(sLocale, "-");
aLocLocale.Language = sLocaleList[0];
if (sLocaleList.length > 1)
+ {
aLocLocale.Country = sLocaleList[1];
+ }
return aLocLocale;
}
- public static String getOfficeLinguistic(XMultiServiceFactory xMSF) {
- try {
+ public static String getOfficeLinguistic(XMultiServiceFactory xMSF)
+ {
+ try
+ {
Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
String sLinguistic = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
return sLinguistic;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace();
return null;
}
@@ -224,17 +268,21 @@ public abstract class Configuration {
* @throws NoSuchElementException
* @throws com.sun.star.uno.Exception
*/
- public static Object addConfigNode(Object configView, String name) throws com.sun.star.lang.WrappedTargetException, ElementExistException, NoSuchElementException, com.sun.star.uno.Exception {
+ public static Object addConfigNode(Object configView, String name) throws com.sun.star.lang.WrappedTargetException, ElementExistException, NoSuchElementException, com.sun.star.uno.Exception
+ {
XNameContainer xNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, configView);
- if (xNameContainer == null) {
+ if (xNameContainer == null)
+ {
XNameReplace xNameReplace = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, configView);
return xNameReplace.getByName(name);
- } else {
+ }
+ else
+ {
/*if (xNameContainer.hasByName(name))
- xNameContainer.removeByName(name);*/
+ xNameContainer.removeByName(name);*/
// create a new detached set element (instance of DataSourceDescription)
XSingleServiceFactory xElementFactory = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, configView);
@@ -248,19 +296,24 @@ public abstract class Configuration {
}
}
- public static void removeNode(Object configView, String name) throws NoSuchElementException, WrappedTargetException {
+ public static void removeNode(Object configView, String name) throws NoSuchElementException, WrappedTargetException
+ {
XNameContainer xNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, configView);
if (xNameContainer.hasByName(name))
+ {
xNameContainer.removeByName(name);
+ }
}
- public static void commit(Object configView) throws WrappedTargetException {
+ public static void commit(Object configView) throws WrappedTargetException
+ {
XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, configView);
xUpdateControl.commitChanges();
}
- public static void updateConfiguration(XMultiServiceFactory xmsf, String path, String name, ConfigNode node, Object param) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException {
+ public static void updateConfiguration(XMultiServiceFactory xmsf, String path, String name, ConfigNode node, Object param) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException
+ {
Object view = Configuration.getConfigurationRoot(xmsf, path, true);
addConfigNode(path, name);
node.writeConfiguration(view, param);
@@ -268,113 +321,141 @@ public abstract class Configuration {
xUpdateControl.commitChanges();
}
- public static void removeNode(XMultiServiceFactory xmsf, String path, String name) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException {
+ public static void removeNode(XMultiServiceFactory xmsf, String path, String name) throws com.sun.star.uno.Exception, com.sun.star.container.ElementExistException, NoSuchElementException, WrappedTargetException
+ {
Object view = Configuration.getConfigurationRoot(xmsf, path, true);
removeNode(view, name);
XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, view);
xUpdateControl.commitChanges();
}
-
- public static String[] getNodeDisplayNames(XNameAccess _xNameAccessNode){
- String[] snames = null;
- return getNodeChildNames(_xNameAccessNode, "Name");
+ public static String[] getNodeDisplayNames(XNameAccess _xNameAccessNode)
+ {
+ String[] snames = null;
+ return getNodeChildNames(_xNameAccessNode, "Name");
}
-
- public static String[] getNodeChildNames(XNameAccess xNameAccessNode, String _schildname){
- String[] snames = null;
- try {
- snames = xNameAccessNode.getElementNames();
- String[] sdisplaynames = new String[snames.length];
- for (int i = 0; i < snames.length; i++){
- Object oContent = Helper.getUnoPropertyValue(xNameAccessNode.getByName(snames[i]), _schildname);
- if (!AnyConverter.isVoid(oContent))
- sdisplaynames[i] = (String) Helper.getUnoPropertyValue(xNameAccessNode.getByName(snames[i]), _schildname);
- else
- sdisplaynames[i] = snames[i];
+ public static String[] getNodeChildNames(XNameAccess xNameAccessNode, String _schildname)
+ {
+ String[] snames = null;
+ try
+ {
+ snames = xNameAccessNode.getElementNames();
+ String[] sdisplaynames = new String[snames.length];
+ for (int i = 0; i < snames.length; i++)
+ {
+ Object oContent = Helper.getUnoPropertyValue(xNameAccessNode.getByName(snames[i]), _schildname);
+ if (!AnyConverter.isVoid(oContent))
+ {
+ sdisplaynames[i] = (String) Helper.getUnoPropertyValue(xNameAccessNode.getByName(snames[i]), _schildname);
+ }
+ else
+ {
+ sdisplaynames[i] = snames[i];
+ }
+ }
+ return sdisplaynames;
}
- return sdisplaynames;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return snames;
- }}
-
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return snames;
+ }
+ }
- public static XNameAccess getChildNodebyIndex(Object _oNode, int _index){
+ public static XNameAccess getChildNodebyIndex(Object _oNode, int _index)
+ {
XNameAccess xNameAccessNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _oNode);
return getChildNodebyIndex(xNameAccessNode, _index);
}
+ public static XNameAccess getChildNodebyIndex(XNameAccess _xNameAccess, int _index)
+ {
+ try
+ {
+ String[] snames = _xNameAccess.getElementNames();
+ Object oNode = _xNameAccess.getByName(snames[_index]);
+ XNameAccess xNameAccessNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oNode);
+ return xNameAccessNode;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
- public static XNameAccess getChildNodebyIndex(XNameAccess _xNameAccess, int _index){
- try {
- String[] snames = _xNameAccess.getElementNames();
- Object oNode = _xNameAccess.getByName(snames[_index]);
- XNameAccess xNameAccessNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oNode);
- return xNameAccessNode;
- } catch (Exception e) {
- e.printStackTrace(System.out);
+ public static XNameAccess getChildNodebyName(XNameAccess _xNameAccessNode, String _SubNodeName)
+ {
+ try
+ {
+ if (_xNameAccessNode.hasByName(_SubNodeName))
+ {
+ return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(_SubNodeName));
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
return null;
- }}
-
-
- public static XNameAccess getChildNodebyName(XNameAccess _xNameAccessNode, String _SubNodeName){
- try {
- if (_xNameAccessNode.hasByName(_SubNodeName))
- return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(_SubNodeName));
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return null;
}
-
- public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname){
+ public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname)
+ {
String[] snames = null;
return getChildNodebyDisplayName(_xNameAccessNode, _displayname, "Name");
}
-
- public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname, String _nodename){
- String[] snames = null;
- try {
- snames = _xNameAccessNode.getElementNames();
- String[] sdisplaynames = new String[snames.length];
- for (int i = 0; i < snames.length; i++){
- String curdisplayname = (String) Helper.getUnoPropertyValue(_xNameAccessNode.getByName(snames[i]), _nodename);
- if (curdisplayname.equals(_displayname))
- return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i]));
+ public static XNameAccess getChildNodebyDisplayName(XNameAccess _xNameAccessNode, String _displayname, String _nodename)
+ {
+ String[] snames = null;
+ try
+ {
+ snames = _xNameAccessNode.getElementNames();
+ String[] sdisplaynames = new String[snames.length];
+ for (int i = 0; i < snames.length; i++)
+ {
+ String curdisplayname = (String) Helper.getUnoPropertyValue(_xNameAccessNode.getByName(snames[i]), _nodename);
+ if (curdisplayname.equals(_displayname))
+ {
+ return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i]));
+ }
+ }
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return null;
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return null;
}
-
- public static XNameAccess getChildNodebyDisplayName(XMultiServiceFactory _xMSF, Locale _aLocale, XNameAccess _xNameAccessNode, String _displayname, String _nodename, int _nmaxcharcount){
- String[] snames = null;
- try {
- snames = _xNameAccessNode.getElementNames();
- String[] sdisplaynames = new String[snames.length];
- for (int i = 0; i < snames.length; i++){
- String curdisplayname = (String) Helper.getUnoPropertyValue(_xNameAccessNode.getByName(snames[i]), _nodename);
- if ((_nmaxcharcount > 0) && (_nmaxcharcount < curdisplayname.length())){
- curdisplayname = curdisplayname.substring(0, _nmaxcharcount);
+ public static XNameAccess getChildNodebyDisplayName(XMultiServiceFactory _xMSF, Locale _aLocale, XNameAccess _xNameAccessNode, String _displayname, String _nodename, int _nmaxcharcount)
+ {
+ String[] snames = null;
+ try
+ {
+ snames = _xNameAccessNode.getElementNames();
+ String[] sdisplaynames = new String[snames.length];
+ for (int i = 0; i < snames.length; i++)
+ {
+ String curdisplayname = (String) Helper.getUnoPropertyValue(_xNameAccessNode.getByName(snames[i]), _nodename);
+ if ((_nmaxcharcount > 0) && (_nmaxcharcount < curdisplayname.length()))
+ {
+ curdisplayname = curdisplayname.substring(0, _nmaxcharcount);
+ }
+ curdisplayname = Desktop.removeSpecialCharacters(_xMSF, _aLocale, curdisplayname);
+
+ if (curdisplayname.equals(_displayname))
+ {
+ return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i]));
+ }
}
- curdisplayname = Desktop.removeSpecialCharacters(_xMSF, _aLocale, curdisplayname);
-
- if (curdisplayname.equals(_displayname))
- return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i]));
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return null;
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return null;
}
-
-
-
-
}
diff --git a/wizards/com/sun/star/wizards/common/DebugHelper.java b/wizards/com/sun/star/wizards/common/DebugHelper.java
index ef11c8ff5719..e4a515b3c920 100644
--- a/wizards/com/sun/star/wizards/common/DebugHelper.java
+++ b/wizards/com/sun/star/wizards/common/DebugHelper.java
@@ -9,7 +9,7 @@
*
* $RCSfile: DebugHelper.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.common;
import com.sun.star.uno.Exception;
@@ -60,5 +59,4 @@ public class DebugHelper
{
// throw new UnsupportedOperationException("Not supported yet.");
}
-
}
diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java
index d91260e2ee4a..bf664c7f8ba6 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.java
+++ b/wizards/com/sun/star/wizards/common/Desktop.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.common;
+ ************************************************************************/
+package com.sun.star.wizards.common;
import java.util.Date;
@@ -61,109 +62,126 @@ import com.sun.star.i18n.KParseType;
import com.sun.star.i18n.ParseResult;
import com.sun.star.i18n.XCharacterClassification;
-public class Desktop {
+public class Desktop
+{
/** Creates a new instance of Desktop */
- public Desktop() {
+ public Desktop()
+ {
}
- public static XDesktop getDesktop(XMultiServiceFactory xMSF) {
+ public static XDesktop getDesktop(XMultiServiceFactory xMSF)
+ {
com.sun.star.uno.XInterface xInterface = null;
XDesktop xDesktop = null;
- if (xMSF != null) {
- try {
+ if (xMSF != null)
+ {
+ try
+ {
xInterface = (com.sun.star.uno.XInterface) xMSF.createInstance("com.sun.star.frame.Desktop");
xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
- } else
+ }
+ else
+ {
System.out.println("Can't create a desktop. null pointer !");
+ }
return xDesktop;
}
- public static XFrame getActiveFrame(XMultiServiceFactory xMSF) {
+ public static XFrame getActiveFrame(XMultiServiceFactory xMSF)
+ {
XDesktop xDesktop = getDesktop(xMSF);
XFramesSupplier xFrameSuppl = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
XFrame xFrame = xFrameSuppl.getActiveFrame();
return xFrame;
}
-
-
- public static XComponent getActiveComponent(XMultiServiceFactory _xMSF){
+ public static XComponent getActiveComponent(XMultiServiceFactory _xMSF)
+ {
XFrame xFrame = getActiveFrame(_xMSF);
return (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
}
-
- public static XTextDocument getActiveTextDocument(XMultiServiceFactory _xMSF){
+ public static XTextDocument getActiveTextDocument(XMultiServiceFactory _xMSF)
+ {
XComponent xComponent = getActiveComponent(_xMSF);
return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
}
-
- public static XSpreadsheetDocument getActiveSpreadsheetDocument(XMultiServiceFactory _xMSF){
+ public static XSpreadsheetDocument getActiveSpreadsheetDocument(XMultiServiceFactory _xMSF)
+ {
XComponent xComponent = getActiveComponent(_xMSF);
return (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
}
-
- public static XDispatch getDispatcher(XMultiServiceFactory xMSF, XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL) {
- try {
+ public static XDispatch getDispatcher(XMultiServiceFactory xMSF, XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL)
+ {
+ try
+ {
com.sun.star.util.URL[] oURLArray = new com.sun.star.util.URL[1];
oURLArray[0] = oURL;
XDispatchProvider xDispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, xFrame);
XDispatch xDispatch = xDispatchProvider.queryDispatch(oURLArray[0], _stargetframe, FrameSearchFlag.ALL); // "_self"
return xDispatch;
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return null;
}
- public static com.sun.star.util.URL getDispatchURL(XMultiServiceFactory xMSF, String _sURL){
- try {
+ public static com.sun.star.util.URL getDispatchURL(XMultiServiceFactory xMSF, String _sURL)
+ {
+ try
+ {
Object oTransformer = xMSF.createInstance("com.sun.star.util.URLTransformer");
XURLTransformer xTransformer = (XURLTransformer) UnoRuntime.queryInterface(XURLTransformer.class, oTransformer);
com.sun.star.util.URL[] oURL = new com.sun.star.util.URL[1];
oURL[0] = new com.sun.star.util.URL();
oURL[0].Complete = _sURL;
xTransformer.parseStrict(oURL);
- return oURL[0];
- } catch (Exception e) {
+ return oURL[0];
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return null;
}
-
- public static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame, String _stargetframe) {
+ public static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame, String _stargetframe)
+ {
com.sun.star.util.URL oURL = getDispatchURL(xMSF, sURL);
XDispatch xDispatch = getDispatcher(xMSF, xFrame, _stargetframe, oURL);
dispatchURL(xDispatch, oURL);
}
-
- public static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame) {
+ public static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame)
+ {
dispatchURL(xMSF, sURL, xFrame, "");
}
- public static void dispatchURL(XDispatch _xDispatch, com.sun.star.util.URL oURL ) {
+ public static void dispatchURL(XDispatch _xDispatch, com.sun.star.util.URL oURL)
+ {
PropertyValue[] oArg = new PropertyValue[0];
_xDispatch.dispatch(oURL, oArg);
}
-
-
- public static XMultiComponentFactory getMultiComponentFactory() throws com.sun.star.uno.Exception, RuntimeException, java.lang.Exception{
+ public static XMultiComponentFactory getMultiComponentFactory() throws com.sun.star.uno.Exception, RuntimeException, java.lang.Exception
+ {
XComponentContext xcomponentcontext = Bootstrap.createInitialComponentContext(null);
// initial serviceManager
return xcomponentcontext.getServiceManager();
}
-
- public static XMultiServiceFactory connect(String connectStr) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException, Exception {
+ public static XMultiServiceFactory connect(String connectStr) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException, Exception
+ {
XComponentContext xcomponentcontext = null;
XMultiComponentFactory xMultiComponentFactory = getMultiComponentFactory();
// create a connector, so that it can contact the office
@@ -172,7 +190,8 @@ public class Desktop {
Object rInitialObject = urlResolver.resolve(connectStr);
XNamingService rName = (XNamingService) UnoRuntime.queryInterface(XNamingService.class, rInitialObject);
XMultiServiceFactory xMSF = null;
- if (rName != null) {
+ if (rName != null)
+ {
System.err.println("got the remote naming service !");
Object rXsmgr = rName.getRegisteredObject("StarOffice.ServiceManager");
xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, rXsmgr);
@@ -180,72 +199,84 @@ public class Desktop {
return (xMSF);
}
-
- public static String getIncrementSuffix(XNameAccess xElementContainer, String ElementName) {
+ public static String getIncrementSuffix(XNameAccess xElementContainer, String ElementName)
+ {
boolean bElementexists = true;
int i = 1;
String sIncSuffix = "";
String BaseName = ElementName;
- while (bElementexists == true) {
+ while (bElementexists == true)
+ {
bElementexists = xElementContainer.hasByName(ElementName);
- if (bElementexists == true) {
+ if (bElementexists == true)
+ {
i += 1;
ElementName = BaseName + Integer.toString(i);
}
}
if (i > 1)
+ {
sIncSuffix = Integer.toString(i);
+ }
return sIncSuffix;
}
-
- public static String getIncrementSuffix(XHierarchicalNameAccess xElementContainer, String ElementName) {
+ public static String getIncrementSuffix(XHierarchicalNameAccess xElementContainer, String ElementName)
+ {
boolean bElementexists = true;
int i = 1;
String sIncSuffix = "";
String BaseName = ElementName;
- while (bElementexists == true) {
+ while (bElementexists == true)
+ {
bElementexists = xElementContainer.hasByHierarchicalName(ElementName);
- if (bElementexists == true) {
+ if (bElementexists == true)
+ {
i += 1;
ElementName = BaseName + Integer.toString(i);
}
}
if (i > 1)
+ {
sIncSuffix = Integer.toString(i);
+ }
return sIncSuffix;
}
+ public static int checkforfirstSpecialCharacter(XMultiServiceFactory _xMSF, String _sString, Locale _aLocale)
+ {
+ try
+ {
+ int nStartFlags = com.sun.star.i18n.KParseTokens.ANY_LETTER_OR_NUMBER + com.sun.star.i18n.KParseTokens.ASC_UNDERSCORE;
+ int nContFlags = nStartFlags;
+ Object ocharservice = _xMSF.createInstance("com.sun.star.i18n.CharacterClassification");
+ XCharacterClassification xCharacterClassification = (XCharacterClassification) UnoRuntime.queryInterface(XCharacterClassification.class, ocharservice);
+ ParseResult aResult = xCharacterClassification.parsePredefinedToken(KParseType.IDENTNAME, _sString, 0, _aLocale, nStartFlags, "", nContFlags, " ");
+ return aResult.EndPos;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return -1;
+ }
+ }
-
- public static int checkforfirstSpecialCharacter(XMultiServiceFactory _xMSF, String _sString, Locale _aLocale){
- try {
- int nStartFlags = com.sun.star.i18n.KParseTokens.ANY_LETTER_OR_NUMBER + com.sun.star.i18n.KParseTokens.ASC_UNDERSCORE;
- int nContFlags = nStartFlags;
- Object ocharservice = _xMSF.createInstance("com.sun.star.i18n.CharacterClassification");
- XCharacterClassification xCharacterClassification = (XCharacterClassification) UnoRuntime.queryInterface(XCharacterClassification.class, ocharservice);
- ParseResult aResult = xCharacterClassification.parsePredefinedToken(KParseType.IDENTNAME, _sString, 0, _aLocale, nStartFlags, "", nContFlags, " ");
- return aResult.EndPos;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return -1;
- }}
-
-
- public static String removeSpecialCharacters(XMultiServiceFactory _xMSF, Locale _aLocale, String _sname){
+ public static String removeSpecialCharacters(XMultiServiceFactory _xMSF, Locale _aLocale, String _sname)
+ {
String snewname = _sname;
int i = 0;
- while(i < snewname.length()){
+ while (i < snewname.length())
+ {
i = Desktop.checkforfirstSpecialCharacter(_xMSF, snewname, _aLocale);
- if (i < snewname.length()){
- String sspecialchar = snewname.substring(i,i+1);
+ if (i < snewname.length())
+ {
+ String sspecialchar = snewname.substring(i, i + 1);
snewname = JavaTools.replaceSubString(snewname, "", sspecialchar);
}
}
return snewname;
}
-
/**
* Checks if the passed Element Name already exists in the ElementContainer. If yes it appends a
* suffix to make it unique
@@ -253,8 +284,8 @@ public class Desktop {
* @param sElementName
* @return a unique Name ready to be added to the container.
*/
-
- public static String getUniqueName(XNameAccess xElementContainer, String sElementName) {
+ public static String getUniqueName(XNameAccess xElementContainer, String sElementName)
+ {
String sIncSuffix = getIncrementSuffix(xElementContainer, sElementName);
return sElementName + sIncSuffix;
}
@@ -266,13 +297,12 @@ public class Desktop {
* @param sElementName
* @return a unique Name ready to be added to the container.
*/
-
- public static String getUniqueName(XHierarchicalNameAccess xElementContainer, String sElementName) {
+ public static String getUniqueName(XHierarchicalNameAccess xElementContainer, String sElementName)
+ {
String sIncSuffix = getIncrementSuffix(xElementContainer, sElementName);
return sElementName + sIncSuffix;
}
-
/**
* Checks if the passed Element Name already exists in the list If yes it appends a
* suffix to make it unique
@@ -281,25 +311,33 @@ public class Desktop {
* @param _sSuffixSeparator
* @return a unique Name not being in the passed list.
*/
- public static String getUniqueName(String[] _slist, String _sElementName, String _sSuffixSeparator) {
+ public static String getUniqueName(String[] _slist, String _sElementName, String _sSuffixSeparator)
+ {
int a = 2;
String scompname = _sElementName;
boolean bElementexists = true;
if (_slist == null)
+ {
return _sElementName;
+ }
if (_slist.length == 0)
+ {
return _sElementName;
- while (bElementexists == true) {
- for (int i = 0; i < _slist.length; i++){
+ }
+ while (bElementexists == true)
+ {
+ for (int i = 0; i < _slist.length; i++)
+ {
if (JavaTools.FieldInList(_slist, scompname) == -1)
+ {
return scompname;
+ }
}
scompname = _sElementName + _sSuffixSeparator + a++;
}
return "";
}
-
/**
* @deprecated use Configuration.getConfigurationRoot() with the same parameters instead
* @param xMSF
@@ -307,8 +345,10 @@ public class Desktop {
* @param bForUpdate
* @return
*/
- public static XInterface getRegistryKeyContent(XMultiServiceFactory xMSF, String KeyName, boolean bForUpdate) {
- try {
+ public static XInterface getRegistryKeyContent(XMultiServiceFactory xMSF, String KeyName, boolean bForUpdate)
+ {
+ try
+ {
Object oConfigProvider;
PropertyValue[] aNodePath = new PropertyValue[1];
oConfigProvider = xMSF.createInstance("com.sun.star.configuration.ConfigurationProvider");
@@ -317,10 +357,16 @@ public class Desktop {
aNodePath[0].Value = KeyName;
XMultiServiceFactory xMSFConfig = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
if (bForUpdate == true)
+ {
return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath);
+ }
else
+ {
return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath);
- } catch (Exception exception) {
+ }
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
@@ -331,22 +377,29 @@ public class Desktop {
* @author bc93774
*
*/
- public class OfficePathRetriever {
+ public class OfficePathRetriever
+ {
+
public String TemplatePath;
public String BitmapPath;
public String UserTemplatePath;
public String WorkPath;
- public OfficePathRetriever(XMultiServiceFactory xMSF) {
- try {
+ public OfficePathRetriever(XMultiServiceFactory xMSF)
+ {
+ try
+ {
TemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
UserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", "");
BitmapPath = FileAccess.combinePaths(xMSF, TemplatePath, "/wizard/bitmap");
WorkPath = FileAccess.getOfficePath(xMSF, "Work", "", "");
- } catch (NoValidPathException nopathexception) {
+ }
+ catch (NoValidPathException nopathexception)
+ {
}
}
}
+
public static String getTemplatePath(XMultiServiceFactory _xMSF)
{
try
@@ -359,6 +412,7 @@ public class Desktop {
}
return "";
}
+
public static String getUserTemplatePath(XMultiServiceFactory _xMSF)
{
try
@@ -371,6 +425,7 @@ public class Desktop {
}
return "";
}
+
public static String getBitmapPath(XMultiServiceFactory _xMSF)
{
try
@@ -383,6 +438,7 @@ public class Desktop {
}
return "";
}
+
public static String getWorkPath(XMultiServiceFactory _xMSF)
{
try
@@ -396,17 +452,25 @@ public class Desktop {
return "";
}
- public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) {
+ public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF)
+ {
Object xPathSubst = null;
- try {
+ try
+ {
xPathSubst = xMSF.createInstance("com.sun.star.util.PathSubstitution");
- } catch (com.sun.star.uno.Exception e) {
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
e.printStackTrace();
}
if (xPathSubst != null)
+ {
return (XStringSubstitution) UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst);
+ }
else
+ {
return null;
+ }
}
/**
@@ -426,26 +490,31 @@ public class Desktop {
* @throws WrappedTargetException
*/
public static XFrame findAFrame(XMultiServiceFactory xMSF, XFrame myFrame, XFrame desktop)
- throws NoSuchElementException,
- WrappedTargetException
+ throws NoSuchElementException,
+ WrappedTargetException
{
if (desktop == null)
- desktop = myFrame;
-
- // we go up in the tree...
+ {
+ desktop = myFrame; // we go up in the tree...
+ }
while (desktop != null && desktop.getComponentWindow() == null)
+ {
desktop = desktop.findFrame("_parent", FrameSearchFlag.PARENT);
+ }
+ if (desktop == null)
+ {
- if (desktop == null) {
-
- for (XEnumeration e = Desktop.getDesktop(xMSF).getComponents().createEnumeration(); e.hasMoreElements();) {
+ for (XEnumeration e = Desktop.getDesktop(xMSF).getComponents().createEnumeration(); e.hasMoreElements();)
+ {
Object comp = ((Any) e.nextElement()).getObject();
XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, comp);
XFrame xFrame = xModel.getCurrentController().getFrame();
if (xFrame != null && xFrame.getComponentWindow() != null)
+ {
return xFrame;
+ }
}
}
return desktop;
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java
index e464e8f8a705..ffa23b51baae 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.java
+++ b/wizards/com/sun/star/wizards/common/FileAccess.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.common;
import com.sun.star.beans.XPropertySet;
@@ -61,7 +60,8 @@ import com.sun.star.util.DateTime;
* conveneince methods for using them.
* These Convenince methods include mainly Exception-handling.
*/
-public class FileAccess {
+public class FileAccess
+{
/**
*
@@ -69,7 +69,8 @@ public class FileAccess {
* @param sPath
* @param sAddPath
*/
- public static void addOfficePath(XMultiServiceFactory xMSF, String sPath, String sAddPath) {
+ public static void addOfficePath(XMultiServiceFactory xMSF, String sPath, String sAddPath)
+ {
XSimpleFileAccess xSimpleFileAccess = null;
String ResultPath = getOfficePath(xMSF, sPath, xSimpleFileAccess);
// As there are several conventions about the look of Url (e.g. with " " or with "%20") you cannot make a
@@ -82,10 +83,12 @@ public class FileAccess {
// sAddPath.replace(null, (char) 47);
String CompAddPath = JavaTools.replaceSubString(sAddPath, "", "/");
String CurPath;
- for (int i = 0; i <= MaxIndex; i++) {
+ for (int i = 0; i <= MaxIndex; i++)
+ {
CurPath = JavaTools.convertfromURLNotation(PathList[i]);
CompCurPath = JavaTools.replaceSubString(CurPath, "", "/");
- if (CompCurPath.equals(CompAddPath)) {
+ if (CompCurPath.equals(CompAddPath))
+ {
return;
}
}
@@ -93,10 +96,11 @@ public class FileAccess {
return;
}
- public static String deleteLastSlashfromUrl(String _sPath){
+ public static String deleteLastSlashfromUrl(String _sPath)
+ {
if (_sPath.endsWith("/"))
{
- return _sPath.substring(0, _sPath.length()-1);
+ return _sPath.substring(0, _sPath.length() - 1);
}
else
{
@@ -104,79 +108,89 @@ public class FileAccess {
}
}
-
/**
- * Further information on arguments value see in OO Developer Guide,
- * chapter 6.2.7
- * @param xMSF
- * @param sPath
- * @param xSimpleFileAccess
- * @return the respective path of the office application. A probable following "/" at the end is trimmed.
- */
- public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, XSimpleFileAccess xSimpleFileAccess) {
- try {
+ * Further information on arguments value see in OO Developer Guide,
+ * chapter 6.2.7
+ * @param xMSF
+ * @param sPath
+ * @param xSimpleFileAccess
+ * @return the respective path of the office application. A probable following "/" at the end is trimmed.
+ */
+ public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, XSimpleFileAccess xSimpleFileAccess)
+ {
+ try
+ {
String ResultPath = "";
XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.util.PathSettings");
ResultPath = com.sun.star.uno.AnyConverter.toString(Helper.getUnoPropertyValue(xInterface, sPath));
ResultPath = deleteLastSlashfromUrl(ResultPath);
return ResultPath;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return "";
}
}
-
/**
- * Further information on arguments value see in OO Developer Guide,
- * chapter 6.2.7
- * @param sType use "share" or "user". Set to "" if not needed eg for the WorkPath;
- * In the return Officepath a possible slash at the end is cut off
- */
-
- public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, String sType, String sSearchDir) throws NoValidPathException {
+ * Further information on arguments value see in OO Developer Guide,
+ * chapter 6.2.7
+ * @param sType use "share" or "user". Set to "" if not needed eg for the WorkPath;
+ * In the return Officepath a possible slash at the end is cut off
+ */
+ public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, String sType, String sSearchDir) throws NoValidPathException
+ {
//This method currently only works with sPath="Template"
String ResultPath = "";
String Template_writable = "";
- String [] Template_internal;
- String [] Template_user;
+ String[] Template_internal;
+ String[] Template_user;
boolean bexists = false;
- try {
+ try
+ {
XInterface xPathInterface = (XInterface) xMSF.createInstance("com.sun.star.util.PathSettings");
XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, xPathInterface);
String WritePath = "";
- String [] ReadPaths = null;
+ String[] ReadPaths = null;
XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
- Template_writable = (String) xPropertySet.getPropertyValue(sPath+"_writable");
- Template_internal = (String []) xPropertySet.getPropertyValue(sPath+"_internal");
- Template_user = (String []) xPropertySet.getPropertyValue(sPath+"_user");
+ Template_writable = (String) xPropertySet.getPropertyValue(sPath + "_writable");
+ Template_internal = (String[]) xPropertySet.getPropertyValue(sPath + "_internal");
+ Template_user = (String[]) xPropertySet.getPropertyValue(sPath + "_user");
int iNumEntries = Template_user.length + Template_internal.length + 1;
ReadPaths = new String[iNumEntries];
- int t=0;
- for (int i=0; i<Template_internal.length; i++) {
+ int t = 0;
+ for (int i = 0; i < Template_internal.length; i++)
+ {
ReadPaths[t] = Template_internal[i];
t++;
}
- for (int i=0; i<Template_user.length; i++) {
+ for (int i = 0; i < Template_user.length; i++)
+ {
ReadPaths[t] = Template_user[i];
t++;
}
ReadPaths[t] = Template_writable;
WritePath = Template_writable;
- if (sType.equalsIgnoreCase("user")) {
+ if (sType.equalsIgnoreCase("user"))
+ {
ResultPath = WritePath;
bexists = true;
- } else {
+ }
+ else
+ {
//find right path using the search sub path
- for (int i = 0; i<ReadPaths.length; i++) {
- String tmpPath = ReadPaths[i]+sSearchDir;
- if (xSimpleFileAccess.exists(tmpPath)) {
+ for (int i = 0; i < ReadPaths.length; i++)
+ {
+ String tmpPath = ReadPaths[i] + sSearchDir;
+ if (xSimpleFileAccess.exists(tmpPath))
+ {
ResultPath = ReadPaths[i];
bexists = true;
break;
@@ -184,7 +198,9 @@ public class FileAccess {
}
}
ResultPath = deleteLastSlashfromUrl(ResultPath);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
ResultPath = "";
}
@@ -195,19 +211,21 @@ public class FileAccess {
return ResultPath;
}
- public static ArrayList getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir) throws NoValidPathException {
+ public static ArrayList getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir) throws NoValidPathException
+ {
//This method currently only works with sPath="Template"
// String ResultPath = "";
ArrayList aPathList = new ArrayList();
String Template_writable = "";
- String [] Template_internal;
- String [] Template_user;
+ String[] Template_internal;
+ String[] Template_user;
// String [] ReadPaths = null;
// boolean bexists = false;
- try {
+ try
+ {
XInterface xPathInterface = (XInterface) xMSF.createInstance("com.sun.star.util.PathSettings");
XPropertySet xPropertySet = (XPropertySet) com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, xPathInterface);
// String WritePath = "";
@@ -215,11 +233,11 @@ public class FileAccess {
// XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
Template_writable = (String) xPropertySet.getPropertyValue(_sPath + "_writable");
- Template_internal = (String []) xPropertySet.getPropertyValue(_sPath + "_internal");
- Template_user = (String []) xPropertySet.getPropertyValue(_sPath + "_user");
+ Template_internal = (String[]) xPropertySet.getPropertyValue(_sPath + "_internal");
+ Template_user = (String[]) xPropertySet.getPropertyValue(_sPath + "_user");
// int iNumEntries = Template_user.length + Template_internal.length + 1;
- for (int i=0; i<Template_internal.length; i++)
+ for (int i = 0; i < Template_internal.length; i++)
{
String sPath = Template_internal[i];
if (sPath.startsWith("vnd."))
@@ -235,12 +253,12 @@ public class FileAccess {
aPathList.add(sPath);
}
- for (int i=0; i<Template_user.length; i++)
+ for (int i = 0; i < Template_user.length; i++)
{
aPathList.add(Template_user[i]);
}
aPathList.add(Template_writable);
- // WritePath = Template_writable;
+ // WritePath = Template_writable;
// if (sType.equalsIgnoreCase("user"))
// {
@@ -248,7 +266,7 @@ public class FileAccess {
// bexists = true;
// }
- // There was a bug here, because we have to search through the whole list of paths
+ // There was a bug here, because we have to search through the whole list of paths
// else
// {
// //find right path using the search sub path
@@ -268,7 +286,7 @@ public class FileAccess {
catch (Exception exception)
{
exception.printStackTrace(System.out);
- // ResultPath = "";
+ // ResultPath = "";
}
// if (bexists == false)
// {
@@ -283,7 +301,7 @@ public class FileAccess {
try
{
Object defaults = _xMSF.createInstance("com.sun.star.text.Defaults");
- Locale aLocale = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
+ Locale aLocale = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
if (aLocale == null)
{
java.util.Locale.getDefault();
@@ -294,8 +312,8 @@ public class FileAccess {
}
String sLanguage = aLocale.Language;
- String sCountry = aLocale.Country;
- String sVariant = aLocale.Variant;
+ String sCountry = aLocale.Country;
+ String sVariant = aLocale.Variant;
// de-DE-Bayrisch
StringBuffer aLocaleAll = new StringBuffer();
@@ -342,8 +360,8 @@ public class FileAccess {
return sPath;
}
- // java.util.Locale jl = new java.util.Locale(
- // l.Language , l.Country, l.Variant );
+ // java.util.Locale jl = new java.util.Locale(
+ // l.Language , l.Country, l.Variant );
}
catch (com.sun.star.uno.Exception e)
{
@@ -354,52 +372,51 @@ public class FileAccess {
/*
public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, String sType) throws NoValidPathException {
- String ResultPath = "";
- Object oPathSettings;
- int iPathCount;
- String[] PathList;
- boolean bexists = false;
- try {
- XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
- XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
- ResultPath = getOfficePath(xMSF, sPath, xSimpleFileAccess);
- PathList = JavaTools.ArrayoutofString(ResultPath, ";");
- if (!sType.equals("")) {
- ResultPath = "";
- String CurPath = "";
- String EndString = "/" + sType;
- int EndLength = EndString.length();
- sType = "/" + sType + "/";
- int MaxIndex = PathList.length - 1;
- int iPos;
- for (int i = 0; i <= MaxIndex; i++) {
- CurPath = PathList[i];
- iPos = CurPath.length() - EndLength;
- if ((CurPath.indexOf(sType) > 0) || (CurPath.indexOf(EndString) == iPos)) {
- ResultPath = deleteLastSlashfromUrl(CurPath);
- if (xSimpleFileAccess.exists(ResultPath))
- break;
- }
- }
- } else
- ResultPath = PathList[0];
- if (ResultPath.equals("") == false)
- bexists = xSimpleFileAccess.exists(ResultPath);
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- ResultPath = "";
- }
- if (bexists == false)
- throw new NoValidPathException(xMSF);
- return ResultPath;
+ String ResultPath = "";
+ Object oPathSettings;
+ int iPathCount;
+ String[] PathList;
+ boolean bexists = false;
+ try {
+ XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
+ ResultPath = getOfficePath(xMSF, sPath, xSimpleFileAccess);
+ PathList = JavaTools.ArrayoutofString(ResultPath, ";");
+ if (!sType.equals("")) {
+ ResultPath = "";
+ String CurPath = "";
+ String EndString = "/" + sType;
+ int EndLength = EndString.length();
+ sType = "/" + sType + "/";
+ int MaxIndex = PathList.length - 1;
+ int iPos;
+ for (int i = 0; i <= MaxIndex; i++) {
+ CurPath = PathList[i];
+ iPos = CurPath.length() - EndLength;
+ if ((CurPath.indexOf(sType) > 0) || (CurPath.indexOf(EndString) == iPos)) {
+ ResultPath = deleteLastSlashfromUrl(CurPath);
+ if (xSimpleFileAccess.exists(ResultPath))
+ break;
+ }
+ }
+ } else
+ ResultPath = PathList[0];
+ if (ResultPath.equals("") == false)
+ bexists = xSimpleFileAccess.exists(ResultPath);
+ } catch (Exception exception) {
+ exception.printStackTrace(System.out);
+ ResultPath = "";
+ }
+ if (bexists == false)
+ throw new NoValidPathException(xMSF);
+ return ResultPath;
}
**/
-
public static void combinePaths(XMultiServiceFactory xMSF, ArrayList _aFirstPath, String _sSecondPath) throws NoValidPathException
{
- for (int i=0;i<_aFirstPath.size();i++)
+ for (int i = 0; i < _aFirstPath.size(); i++)
{
- String sOnePath = (String)_aFirstPath.get(i);
+ String sOnePath = (String) _aFirstPath.get(i);
sOnePath = addPath(sOnePath, _sSecondPath);
if (isPathValid(xMSF, sOnePath))
{
@@ -429,7 +446,8 @@ public class FileAccess {
return bExists;
}
- public static String combinePaths(XMultiServiceFactory xMSF, String _sFirstPath, String _sSecondPath) throws NoValidPathException {
+ public static String combinePaths(XMultiServiceFactory xMSF, String _sFirstPath, String _sSecondPath) throws NoValidPathException
+ {
boolean bexists = false;
String ReturnPath = "";
try
@@ -451,11 +469,14 @@ public class FileAccess {
return ReturnPath;
}
- public static boolean createSubDirectory(XMultiServiceFactory xMSF, XSimpleFileAccess xSimpleFileAccess, String Path) {
+ public static boolean createSubDirectory(XMultiServiceFactory xMSF, XSimpleFileAccess xSimpleFileAccess, String Path)
+ {
String sNoDirCreation = "";
- try {
+ try
+ {
Resource oResource = new Resource(xMSF, "ImportWizard", "imp");
- if (oResource != null) {
+ if (oResource != null)
+ {
sNoDirCreation = oResource.getResText(1050);
String sMsgDirNotThere = oResource.getResText(1051);
String sQueryForNewCreation = oResource.getResText(1052);
@@ -463,17 +484,22 @@ public class FileAccess {
String sQueryMessage = JavaTools.replaceSubString(sMsgDirNotThere, OSPath, "%1");
sQueryMessage = sQueryMessage + (char) 13 + sQueryForNewCreation;
int icreate = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sQueryMessage);
- if (icreate == 2) {
+ if (icreate == 2)
+ {
xSimpleFileAccess.createFolder(Path);
return true;
}
}
return false;
- } catch (com.sun.star.ucb.CommandAbortedException exception) {
+ }
+ catch (com.sun.star.ucb.CommandAbortedException exception)
+ {
String sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1");
SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgNoDir);
return false;
- } catch (com.sun.star.uno.Exception unoexception) {
+ }
+ catch (com.sun.star.uno.Exception unoexception)
+ {
String sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1");
SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgNoDir);
return false;
@@ -482,8 +508,10 @@ public class FileAccess {
// checks if the root of a path exists. if the parameter xWindowPeer is not null then also the directory is
// created when it does not exists and the user
- public static boolean PathisValid(XMultiServiceFactory xMSF, String Path, String sMsgFilePathInvalid, boolean baskbeforeOverwrite) {
- try {
+ public static boolean PathisValid(XMultiServiceFactory xMSF, String Path, String sMsgFilePathInvalid, boolean baskbeforeOverwrite)
+ {
+ try
+ {
String SubDir;
String SubDirPath = "";
int SubLen;
@@ -495,8 +523,10 @@ public class FileAccess {
String NewPath = Path;
XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
- if (baskbeforeOverwrite) {
- if (xSimpleFileAccess.exists(Path)) {
+ if (baskbeforeOverwrite)
+ {
+ if (xSimpleFileAccess.exists(Path))
+ {
Resource oResource = new Resource(xMSF, "ImportWizard", "imp");
String sFileexists = oResource.getResText(1053);
String NewString = JavaTools.convertfromURLNotation(Path);
@@ -511,25 +541,31 @@ public class FileAccess {
}
String[] DirArray = JavaTools.ArrayoutofString(Path, "/");
int MaxIndex = DirArray.length - 1;
- if (MaxIndex > 0) {
- for (int i = MaxIndex; i >= 0; i--) {
+ if (MaxIndex > 0)
+ {
+ for (int i = MaxIndex; i >= 0; i--)
+ {
SubDir = DirArray[i];
SubLen = SubDir.length();
NewLen = NewPath.length();
RestLen = NewLen - SubLen;
- if (RestLen > 0) {
+ if (RestLen > 0)
+ {
NewPath = NewPath.substring(0, NewLen - SubLen - 1);
if (i == MaxIndex)
{
SubDirPath = NewPath;
}
bexists = xSimpleFileAccess.exists(NewPath);
- if (bexists) {
+ if (bexists)
+ {
LowerCasePath = NewPath.toLowerCase();
bexists = (((LowerCasePath.equals("file:///")) || (LowerCasePath.equals("file://")) || (LowerCasePath.equals("file:/")) || (LowerCasePath.equals("file:"))) == false);
}
- if (bexists) {
- if (bSubDirexists == false) {
+ if (bexists)
+ {
+ if (bSubDirexists == false)
+ {
boolean bSubDiriscreated = createSubDirectory(xMSF, xSimpleFileAccess, SubDirPath);
return bSubDiriscreated;
}
@@ -544,7 +580,9 @@ public class FileAccess {
}
SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid);
return false;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid);
return false;
@@ -561,10 +599,11 @@ public class FileAccess {
* the second with the corresponding URLs.
* @deprecated please use the getFolderTitles() with ArrayList
*/
-
- public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String FilterName, String FolderName) {
+ public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String FilterName, String FolderName)
+ {
String[][] LocLayoutFiles = new String[2][]; //{"",""}{""};
- try {
+ try
+ {
java.util.Vector TitleVector = null;
java.util.Vector NameVector = null;
@@ -582,10 +621,12 @@ public class FileAccess {
FilterName = FilterName == null || FilterName.equals("") ? null : FilterName + "-";
String fileName = "";
- for (int i = 0; i < nameList.length; i++) {
- fileName = getFilename( nameList[i] );
+ for (int i = 0; i < nameList.length; i++)
+ {
+ fileName = getFilename(nameList[i]);
- if (FilterName == null || fileName.startsWith(FilterName)) {
+ if (FilterName == null || fileName.startsWith(FilterName))
+ {
xDocInfo.loadFromURL(nameList[i]);
NameVector.addElement(nameList[i]);
@@ -602,19 +643,20 @@ public class FileAccess {
LocLayoutFiles[0] = LocTitleList;
JavaTools.bubblesortList(LocLayoutFiles);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
return LocLayoutFiles;
}
- /**
- * We search in all given path for a given file
- * @param _sPath
- * @param _sPath2
- * @return
- */
-
+ /**
+ * We search in all given path for a given file
+ * @param _sPath
+ * @param _sPath2
+ * @return
+ */
public static String addPath(String _sPath, String _sPath2)
{
String sNewPath;
@@ -638,9 +680,9 @@ public class FileAccess {
XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = (com.sun.star.ucb.XSimpleFileAccess) UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface);
- for (int i=0;i<_aList.size();i++)
+ for (int i = 0; i < _aList.size(); i++)
{
- String sPath = (String)_aList.get(i);
+ String sPath = (String) _aList.get(i);
sPath = addPath(sPath, _sFile);
if (xSimpleFileAccess.exists(sPath))
{
@@ -648,20 +690,20 @@ public class FileAccess {
}
}
}
- catch(com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception e)
{
}
return sFoundFile;
}
- /**
- *
- * @param xMSF
- * @param _sStartFilterName
- * @param FolderNames
- * @return
- * @throws com.sun.star.wizards.common.NoValidPathException
- */
+ /**
+ *
+ * @param xMSF
+ * @param _sStartFilterName
+ * @param FolderNames
+ * @return
+ * @throws com.sun.star.wizards.common.NoValidPathException
+ */
public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String _sStartFilterName, ArrayList FolderNames)
throws NoValidPathException
{
@@ -767,11 +809,11 @@ public class FileAccess {
return LocLayoutFiles;
}
-
public XSimpleFileAccess2 fileAccess;
public XFileIdentifierConverter filenameConverter;
- public FileAccess(XMultiServiceFactory xmsf) throws com.sun.star.uno.Exception {
+ public FileAccess(XMultiServiceFactory xmsf) throws com.sun.star.uno.Exception
+ {
//get a simple file access...
Object fa = xmsf.createInstance("com.sun.star.ucb.SimpleFileAccess");
fileAccess = (XSimpleFileAccess2) UnoRuntime.queryInterface(XSimpleFileAccess2.class, fa);
@@ -780,31 +822,34 @@ public class FileAccess {
filenameConverter = (XFileIdentifierConverter) UnoRuntime.queryInterface(XFileIdentifierConverter.class, fcv);
}
- public String getURL(String parentPath, String childPath) {
+ public String getURL(String parentPath, String childPath)
+ {
String parent = filenameConverter.getSystemPathFromFileURL(parentPath);
File f = new File(parent, childPath);
String r = filenameConverter.getFileURLFromSystemPath(parentPath, f.getAbsolutePath());
return r;
}
- public String getURL(String path) {
+ public String getURL(String path)
+ {
File f = new File(path);
String r = filenameConverter.getFileURLFromSystemPath(
- path,f.getAbsolutePath());
+ path, f.getAbsolutePath());
return r;
}
- public String getPath(String parentURL, String childURL) {
+ public String getPath(String parentURL, String childURL)
+ {
return filenameConverter.getSystemPathFromFileURL(parentURL + (((childURL == null || childURL.equals("")) ? "" : "/" + childURL)));
}
-
/**
* @author rpiterman
* @param filename
* @return the extension of the given filename.
*/
- public static String getExtension(String filename) {
+ public static String getExtension(String filename)
+ {
int p = filename.indexOf(".");
if (p == -1)
{
@@ -826,13 +871,19 @@ public class FileAccess {
* @param s
* @return
*/
- public boolean mkdir(String s) {
- try {
+ public boolean mkdir(String s)
+ {
+ try
+ {
fileAccess.createFolder(s);
return true;
- } catch (CommandAbortedException cax) {
+ }
+ catch (CommandAbortedException cax)
+ {
cax.printStackTrace();
- } catch (com.sun.star.uno.Exception ex) {
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
ex.printStackTrace();
}
return false;
@@ -845,11 +896,17 @@ public class FileAccess {
* @return true if the given file exists or not.
* if an exception accures, returns the def value.
*/
- public boolean exists(String filename, boolean def) {
- try {
+ public boolean exists(String filename, boolean def)
+ {
+ try
+ {
return fileAccess.exists(filename);
- } catch (CommandAbortedException e) {
- } catch (Exception e) {
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
}
return def;
@@ -860,11 +917,17 @@ public class FileAccess {
* @param filename
* @return
*/
- public boolean isDirectory(String filename) {
- try {
+ public boolean isDirectory(String filename)
+ {
+ try
+ {
return fileAccess.isFolder(filename);
- } catch (CommandAbortedException e) {
- } catch (Exception e) {
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
}
return false;
@@ -877,11 +940,17 @@ public class FileAccess {
* @param includeFolders
* @return
*/
- public String[] listFiles(String dir, boolean includeFolders) {
- try {
+ public String[] listFiles(String dir, boolean includeFolders)
+ {
+ try
+ {
return fileAccess.getFolderContents(dir, includeFolders);
- } catch (CommandAbortedException e) {
- } catch (Exception e) {
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
}
return new String[0];
@@ -892,13 +961,19 @@ public class FileAccess {
* @param file
* @return
*/
- public boolean delete(String file) {
- try {
+ public boolean delete(String file)
+ {
+ try
+ {
fileAccess.kill(file);
return true;
- } catch (CommandAbortedException e) {
+ }
+ catch (CommandAbortedException e)
+ {
e.printStackTrace(System.out);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
@@ -910,7 +985,8 @@ public class FileAccess {
* @param path
* @return
*/
- public static String getFilename(String path) {
+ public static String getFilename(String path)
+ {
return getFilename(path, "/");
}
@@ -919,7 +995,8 @@ public class FileAccess {
* @param path
* @return
*/
- public static String getPathFilename(String path) {
+ public static String getPathFilename(String path)
+ {
return getFilename(path, File.separator);
}
@@ -929,16 +1006,17 @@ public class FileAccess {
* @param pathSeparator
* @return
*/
- public static String getFilename(String path, String pathSeparator) {
+ public static String getFilename(String path, String pathSeparator)
+ {
String[] s = JavaTools.ArrayoutofString(path, pathSeparator);
return s[s.length - 1];
}
-
- public static String getBasename(String path, String pathSeparator){
+ public static String getBasename(String path, String pathSeparator)
+ {
String filename = getFilename(path, pathSeparator);
String sExtension = getExtension(filename);
- String basename = filename.substring(0, filename.length()- (sExtension.length() + 1));
+ String basename = filename.substring(0, filename.length() - (sExtension.length() + 1));
return basename;
}
@@ -948,22 +1026,34 @@ public class FileAccess {
* @param target
* @return
*/
- public boolean copy(String source, String target) {
- try {
+ public boolean copy(String source, String target)
+ {
+ try
+ {
fileAccess.copy(source, target);
return true;
- } catch (CommandAbortedException e) {
- } catch (Exception e) {
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
}
return false;
}
- public DateTime getLastModified(String url) {
- try {
+ public DateTime getLastModified(String url)
+ {
+ try
+ {
return fileAccess.getDateTimeModified(url);
- } catch (CommandAbortedException e) {
- } catch (Exception e) {
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
}
return null;
}
@@ -974,7 +1064,8 @@ public class FileAccess {
* @return the parent dir of the given url.
* if the path points to file, gives the directory in which the file is.
*/
- public static String getParentDir(String url) {
+ public static String getParentDir(String url)
+ {
if (url.endsWith("/"))
{
return getParentDir(url.substring(0, url.length() - 1));
@@ -988,8 +1079,8 @@ public class FileAccess {
return url.substring(0, lastPos);
}
-
- public String createNewDir(String parentDir, String name) {
+ public String createNewDir(String parentDir, String name)
+ {
String s = getNewFile(parentDir, name, "");
if (mkdir(s))
{
@@ -1001,45 +1092,55 @@ public class FileAccess {
}
}
- public String getNewFile(String parentDir, String name, String extension) {
+ public String getNewFile(String parentDir, String name, String extension)
+ {
int i = 0;
String url;
- do {
+ do
+ {
String filename = filename(name, extension, i++);
String u = getURL(parentDir, filename);
url = u;
- } while (exists(url, true));
+ }
+ while (exists(url, true));
return url;
}
- private static String filename(String name, String ext, int i) {
+ private static String filename(String name, String ext, int i)
+ {
return name + (i == 0 ? "" : String.valueOf(i)) + (ext.equals("") ? "" : "." + ext);
}
- public int getSize(String url) {
- try {
+ public int getSize(String url)
+ {
+ try
+ {
return fileAccess.getSize(url);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
return -1;
}
}
- public static String connectURLs(String urlFolder, String urlFilename) {
- return urlFolder + ( urlFolder.endsWith("/") ? "" : "/" ) +
- ( urlFilename.startsWith("/") ? urlFilename.substring(1) : urlFilename );
+ public static String connectURLs(String urlFolder, String urlFilename)
+ {
+ return urlFolder + (urlFolder.endsWith("/") ? "" : "/") +
+ (urlFilename.startsWith("/") ? urlFilename.substring(1) : urlFilename);
}
-
- public static String[] getDataFromTextFile(XMultiServiceFactory _xMSF, String _filepath){
+ public static String[] getDataFromTextFile(XMultiServiceFactory _xMSF, String _filepath)
+ {
String[] sFileData = null;
- try {
+ try
+ {
Vector oDataVector = new Vector();
Object oSimpleFileAccess = _xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, oSimpleFileAccess);
- if (xSimpleFileAccess.exists(_filepath)){
+ if (xSimpleFileAccess.exists(_filepath))
+ {
XInputStream xInputStream = xSimpleFileAccess.openFileRead(_filepath);
Object oTextInputStream = _xMSF.createInstance("com.sun.star.io.TextInputStream");
XTextInputStream xTextInputStream = (XTextInputStream) UnoRuntime.queryInterface(XTextInputStream.class, oTextInputStream);
@@ -1054,7 +1155,9 @@ public class FileAccess {
oDataVector.toArray(sFileData);
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return sFileData;
@@ -1066,20 +1169,24 @@ public class FileAccess {
* @param maxLength
* @return
*/
- public static String getShortFilename(String path, int maxLength) {
+ public static String getShortFilename(String path, int maxLength)
+ {
int firstPart = 0;
- if (path.length() > maxLength) {
- if (path.startsWith("/")) { // unix
- int nextSlash = path.indexOf("/",1) + 1;
- firstPart = Math.min(nextSlash, ( maxLength - 3 ) / 2 );
+ if (path.length() > maxLength)
+ {
+ if (path.startsWith("/"))
+ { // unix
+ int nextSlash = path.indexOf("/", 1) + 1;
+ firstPart = Math.min(nextSlash, (maxLength - 3) / 2);
}
- else { //windows
- firstPart = Math.min( 10, (maxLength - 3) / 2);
+ else
+ { //windows
+ firstPart = Math.min(10, (maxLength - 3) / 2);
}
- String s1 = path.substring(0,firstPart);
- String s2 = path.substring(path.length() - (maxLength - ( 3 + firstPart)));
+ String s1 = path.substring(0, firstPart);
+ String s2 = path.substring(path.length() - (maxLength - (3 + firstPart)));
return s1 + "..." + s2;
}
diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java
index 70abf59e5960..2498d1a962aa 100644
--- a/wizards/com/sun/star/wizards/common/Helper.java
+++ b/wizards/com/sun/star/wizards/common/Helper.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.common;
+ ************************************************************************/
+package com.sun.star.wizards.common;
import com.sun.star.uno.XComponentContext;
import com.sun.star.util.XMacroExpander;
@@ -46,13 +47,16 @@ import com.sun.star.util.DateTime;
import com.sun.star.util.XNumberFormatsSupplier;
import com.sun.star.util.XNumberFormatter;
-public class Helper {
+public class Helper
+{
/** Creates a new instance of Helper */
- public Helper() {
+ public Helper()
+ {
}
- public static long convertUnoDatetoInteger(com.sun.star.util.Date DateValue) {
+ public static long convertUnoDatetoInteger(com.sun.star.util.Date DateValue)
+ {
java.util.Calendar oCal = java.util.Calendar.getInstance();
oCal.set(DateValue.Year, DateValue.Month, DateValue.Day);
java.util.Date dTime = oCal.getTime();
@@ -61,38 +65,57 @@ public class Helper {
return lDate;
}
- public static void setUnoPropertyValue(Object oUnoObject, String PropertyName, Object PropertyValue) {
- try {
+ public static void setUnoPropertyValue(Object oUnoObject, String PropertyName, Object PropertyValue)
+ {
+ try
+ {
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
if (xPSet.getPropertySetInfo().hasPropertyByName(PropertyName))
+ {
xPSet.setPropertyValue(PropertyName, PropertyValue);
- else{
+ }
+ else
+ {
Property[] selementnames = xPSet.getPropertySetInfo().getProperties();
- throw new java.lang.IllegalArgumentException("No Such Property: '" + PropertyName+ "'");
+ throw new java.lang.IllegalArgumentException("No Such Property: '" + PropertyName + "'");
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public static Object getUnoObjectbyName(Object oUnoObject, String ElementName) {
- try {
+ public static Object getUnoObjectbyName(Object oUnoObject, String ElementName)
+ {
+ try
+ {
com.sun.star.container.XNameAccess xName = (com.sun.star.container.XNameAccess) UnoRuntime.queryInterface(com.sun.star.container.XNameAccess.class, oUnoObject);
if (xName.hasByName(ElementName) == true)
+ {
return xName.getByName(ElementName);
+ }
else
+ {
throw new RuntimeException();
- } catch (Exception exception) {
+ }
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public static Object getPropertyValue(PropertyValue[] CurPropertyValue, String PropertyName) {
+ public static Object getPropertyValue(PropertyValue[] CurPropertyValue, String PropertyName)
+ {
int MaxCount = CurPropertyValue.length;
- for (int i = 0; i < MaxCount; i++) {
- if (CurPropertyValue[i] != null) {
- if (CurPropertyValue[i].Name.equals(PropertyName)) {
+ for (int i = 0; i < MaxCount; i++)
+ {
+ if (CurPropertyValue[i] != null)
+ {
+ if (CurPropertyValue[i].Name.equals(PropertyName))
+ {
return CurPropertyValue[i].Value;
}
}
@@ -100,31 +123,46 @@ public class Helper {
throw new RuntimeException();
}
- public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName, java.lang.Class xClass) {
- try {
- if (oUnoObject != null) {
+ public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName, java.lang.Class xClass)
+ {
+ try
+ {
+ if (oUnoObject != null)
+ {
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
Object oObject = xPSet.getPropertyValue(PropertyName);
- if ( AnyConverter.isVoid(oObject) )
+ if (AnyConverter.isVoid(oObject))
+ {
return null;
+ }
else
+ {
return com.sun.star.uno.AnyConverter.toObject(new com.sun.star.uno.Type(xClass), oObject);
+ }
}
return null;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName) {
- if (CurPropertyValue != null) {
+ public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName)
+ {
+ if (CurPropertyValue != null)
+ {
int MaxCount = CurPropertyValue.length;
- for (int i = 0; i < MaxCount; i++) {
- if (CurPropertyValue[i] != null) {
+ for (int i = 0; i < MaxCount; i++)
+ {
+ if (CurPropertyValue[i] != null)
+ {
PropertyValue aValue = (PropertyValue) CurPropertyValue[i];
if (aValue != null && aValue.Name.equals(PropertyName))
+ {
return aValue.Value;
+ }
}
}
}
@@ -132,82 +170,117 @@ public class Helper {
return null;
}
- public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName, java.lang.Class xClass) {
- try {
- if (CurPropertyValue != null) {
+ public static Object getPropertyValuefromAny(Object[] CurPropertyValue, String PropertyName, java.lang.Class xClass)
+ {
+ try
+ {
+ if (CurPropertyValue != null)
+ {
int MaxCount = CurPropertyValue.length;
- for (int i = 0; i < MaxCount; i++) {
- if (CurPropertyValue[i] != null) {
+ for (int i = 0; i < MaxCount; i++)
+ {
+ if (CurPropertyValue[i] != null)
+ {
PropertyValue aValue = (PropertyValue) CurPropertyValue[i];
if (aValue != null && aValue.Name.equals(PropertyName))
+ {
return com.sun.star.uno.AnyConverter.toObject(new com.sun.star.uno.Type(xClass), aValue.Value);
+ }
}
}
}
// System.out.println("Property not found: " + PropertyName);
return null;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName) {
- try {
- if (oUnoObject != null) {
+ public static Object getUnoPropertyValue(Object oUnoObject, String PropertyName)
+ {
+ try
+ {
+ if (oUnoObject != null)
+ {
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
Property[] aProps = xPSet.getPropertySetInfo().getProperties();
Object oObject = xPSet.getPropertyValue(PropertyName);
return oObject;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
return null;
}
- public static Object getUnoArrayPropertyValue(Object oUnoObject, String PropertyName) {
- try {
- if (oUnoObject != null) {
+ public static Object getUnoArrayPropertyValue(Object oUnoObject, String PropertyName)
+ {
+ try
+ {
+ if (oUnoObject != null)
+ {
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
Object oObject = xPSet.getPropertyValue(PropertyName);
if (AnyConverter.isArray(oObject))
+ {
return getArrayValue(oObject);
+ }
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
return null;
}
- public static Object getUnoStructValue(Object oUnoObject, String PropertyName) {
- try {
- if (oUnoObject != null) {
+ public static Object getUnoStructValue(Object oUnoObject, String PropertyName)
+ {
+ try
+ {
+ if (oUnoObject != null)
+ {
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
- if (xPSet.getPropertySetInfo().hasPropertyByName(PropertyName) == true) {
+ if (xPSet.getPropertySetInfo().hasPropertyByName(PropertyName) == true)
+ {
Object oObject = xPSet.getPropertyValue(PropertyName);
return oObject;
}
}
return null;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public static void setUnoPropertyValues(Object oUnoObject, String[] PropertyNames, Object[] PropertyValues) {
- try {
+ public static void setUnoPropertyValues(Object oUnoObject, String[] PropertyNames, Object[] PropertyValues)
+ {
+ try
+ {
com.sun.star.beans.XMultiPropertySet xMultiPSetLst = (com.sun.star.beans.XMultiPropertySet) UnoRuntime.queryInterface(com.sun.star.beans.XMultiPropertySet.class, oUnoObject);
if (xMultiPSetLst != null)
+ {
xMultiPSetLst.setPropertyValues(PropertyNames, PropertyValues);
+ }
else
- for (int i = 0; i < PropertyNames.length; i++) {
+ {
+ for (int i = 0; i < PropertyNames.length; i++)
+ {
//System.out.println(PropertyNames[i] + "=" + PropertyValues[i]);
setUnoPropertyValue(oUnoObject, PropertyNames[i], PropertyValues[i]);
}
-
- } catch (Exception exception) {
+ }
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
@@ -219,94 +292,110 @@ public class Helper {
* @param oValue the paramter that has to represent an object
* @return a null reference if the array is empty
*/
- public static Object getArrayValue(Object oValue) {
- try {
+ public static Object getArrayValue(Object oValue)
+ {
+ try
+ {
Object oPropList = com.sun.star.uno.AnyConverter.toArray(oValue);
int nlen = java.lang.reflect.Array.getLength(oPropList);
if (nlen == 0)
+ {
return null;
+ }
else
+ {
return oPropList;
- } catch (Exception exception) {
+ }
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
+ private static long DAY_IN_MILLIS = (24 * 60 * 60 * 1000);
- private static long DAY_IN_MILLIS = ( 24 * 60 * 60 * 1000 );
-
- public static class DateUtils {
+ public static class DateUtils
+ {
private long docNullTime;
private XNumberFormatter formatter;
private XNumberFormatsSupplier formatSupplier;
private Calendar calendar;
- public DateUtils(XMultiServiceFactory xmsf, Object document) throws Exception {
- XMultiServiceFactory docMSF = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,document);
+ public DateUtils(XMultiServiceFactory xmsf, Object document) throws Exception
+ {
+ XMultiServiceFactory docMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
Object defaults = docMSF.createInstance("com.sun.star.text.Defaults");
- Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
+ Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
java.util.Locale jl = new java.util.Locale(
- l.Language , l.Country, l.Variant );
+ l.Language, l.Country, l.Variant);
calendar = Calendar.getInstance(jl);
- formatSupplier = (XNumberFormatsSupplier)UnoRuntime.queryInterface(XNumberFormatsSupplier.class,document);
+ formatSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document);
Object formatSettings = formatSupplier.getNumberFormatSettings();
- com.sun.star.util.Date date = (com.sun.star.util.Date)Helper.getUnoPropertyValue( formatSettings, "NullDate");
+ com.sun.star.util.Date date = (com.sun.star.util.Date) Helper.getUnoPropertyValue(formatSettings, "NullDate");
- calendar.set(date.Year, date.Month - 1 , date.Day);
+ calendar.set(date.Year, date.Month - 1, date.Day);
docNullTime = getTimeInMillis();
- formatter = NumberFormatter.createNumberFormatter(xmsf, formatSupplier );
+ formatter = NumberFormatter.createNumberFormatter(xmsf, formatSupplier);
}
/**
* @param format a constant of the enumeration NumberFormatIndex
* @return
*/
- public int getFormat( short format ) {
- return NumberFormatter.getNumberFormatterKey( formatSupplier , format);
+ public int getFormat(short format)
+ {
+ return NumberFormatter.getNumberFormatterKey(formatSupplier, format);
}
- public XNumberFormatter getFormatter() {
+ public XNumberFormatter getFormatter()
+ {
return formatter;
}
- private long getTimeInMillis(){
+ private long getTimeInMillis()
+ {
java.util.Date dDate = calendar.getTime();
return dDate.getTime();
}
+
/**
* @param date a VCL date in form of 20041231
* @return a document relative date
*/
- public synchronized double getDocumentDateAsDouble(int date) {
+ public synchronized double getDocumentDateAsDouble(int date)
+ {
calendar.clear();
- calendar.set( date / 10000 ,
- ( date % 10000 ) / 100 - 1 ,
- date % 100 ) ;
+ calendar.set(date / 10000,
+ (date % 10000) / 100 - 1,
+ date % 100);
long date1 = getTimeInMillis();
/*
* docNullTime and date1 are in millis, but
* I need a day...
*/
- double daysDiff = ( date1 - docNullTime ) / DAY_IN_MILLIS + 1;
+ double daysDiff = (date1 - docNullTime) / DAY_IN_MILLIS + 1;
return daysDiff;
}
- public double getDocumentDateAsDouble(DateTime date) {
- return getDocumentDateAsDouble (date.Year * 10000 + date.Month * 100 + date.Day );
+ public double getDocumentDateAsDouble(DateTime date)
+ {
+ return getDocumentDateAsDouble(date.Year * 10000 + date.Month * 100 + date.Day);
}
- public synchronized double getDocumentDateAsDouble(long javaTimeInMillis) {
+ public synchronized double getDocumentDateAsDouble(long javaTimeInMillis)
+ {
calendar.clear();
- JavaTools.setTimeInMillis(calendar, javaTimeInMillis ) ;
+ JavaTools.setTimeInMillis(calendar, javaTimeInMillis);
long date1 = getTimeInMillis();
@@ -314,45 +403,45 @@ public class Helper {
* docNullTime and date1 are in millis, but
* I need a day...
*/
- double daysDiff = ( date1 - docNullTime ) / DAY_IN_MILLIS + 1;
+ double daysDiff = (date1 - docNullTime) / DAY_IN_MILLIS + 1;
return daysDiff;
}
- public String format(int formatIndex, int date) {
- return formatter.convertNumberToString( formatIndex, getDocumentDateAsDouble(date));
+ public String format(int formatIndex, int date)
+ {
+ return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date));
}
- public String format(int formatIndex, DateTime date) {
- return formatter.convertNumberToString( formatIndex, getDocumentDateAsDouble(date));
+ public String format(int formatIndex, DateTime date)
+ {
+ return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date));
}
- public String format(int formatIndex, long javaTimeInMillis) {
- return formatter.convertNumberToString( formatIndex, getDocumentDateAsDouble(javaTimeInMillis));
+ public String format(int formatIndex, long javaTimeInMillis)
+ {
+ return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(javaTimeInMillis));
}
-
}
-public static XComponentContext getComponentContext(XMultiServiceFactory _xMSF)
-{
- // Get the path to the extension and try to add the path to the class loader
- final XPropertySet xProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, _xMSF);
- final PropertySetHelper aHelper = new PropertySetHelper(xProps);
- final Object aDefaultContext = aHelper.getPropertyValueAsObject("DefaultContext");
- final XComponentContext xComponentContext = (XComponentContext)UnoRuntime.queryInterface(XComponentContext.class, aDefaultContext);
- return xComponentContext;
-}
+ public static XComponentContext getComponentContext(XMultiServiceFactory _xMSF)
+ {
+ // Get the path to the extension and try to add the path to the class loader
+ final XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xMSF);
+ final PropertySetHelper aHelper = new PropertySetHelper(xProps);
+ final Object aDefaultContext = aHelper.getPropertyValueAsObject("DefaultContext");
+ final XComponentContext xComponentContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, aDefaultContext);
+ return xComponentContext;
+ }
-public static XMacroExpander getMacroExpander(XMultiServiceFactory _xMSF)
-{
- final XComponentContext xComponentContext = getComponentContext(_xMSF);
- final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander");
- XMacroExpander xExpander = (XMacroExpander)UnoRuntime.queryInterface(XMacroExpander.class, aSingleton);
- // String[][] aStrListList = xProvider.getExtensionList();
+ public static XMacroExpander getMacroExpander(XMultiServiceFactory _xMSF)
+ {
+ final XComponentContext xComponentContext = getComponentContext(_xMSF);
+ final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander");
+ XMacroExpander xExpander = (XMacroExpander) UnoRuntime.queryInterface(XMacroExpander.class, aSingleton);
+ // String[][] aStrListList = xProvider.getExtensionList();
// final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner");
- return xExpander;
-}
-
-
+ return xExpander;
+ }
}
diff --git a/wizards/com/sun/star/wizards/common/Indexable.java b/wizards/com/sun/star/wizards/common/Indexable.java
index 5e19b0ca474b..a0648de408c9 100644
--- a/wizards/com/sun/star/wizards/common/Indexable.java
+++ b/wizards/com/sun/star/wizards/common/Indexable.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Indexable.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Indexable.java
*
* Created on 16. September 2003, 11:38
diff --git a/wizards/com/sun/star/wizards/common/InvalidQueryException.java b/wizards/com/sun/star/wizards/common/InvalidQueryException.java
index cff45771454b..83df804ed21b 100644
--- a/wizards/com/sun/star/wizards/common/InvalidQueryException.java
+++ b/wizards/com/sun/star/wizards/common/InvalidQueryException.java
@@ -1,12 +1,44 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: InvalidQueryException.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.common;
import com.sun.star.lang.XMultiServiceFactory;
-public class InvalidQueryException extends java.lang.Throwable {
-
- public InvalidQueryException(XMultiServiceFactory xMSF, String sCommand) {
+public class InvalidQueryException extends java.lang.Throwable
+{
+// TODO don't show messages in Excetions
+ public InvalidQueryException(XMultiServiceFactory xMSF, String sCommand)
+ {
final int RID_REPORT = 2400;
SystemDialog.showErrorBox(xMSF, "ReportWizard", "dbw", RID_REPORT + 65, "<STATEMENT>", sCommand); // Querycreationnotpossible
}
-
}
diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java
index a99fe97fd6bf..f8a85037c84a 100644
--- a/wizards/com/sun/star/wizards/common/JavaTools.java
+++ b/wizards/com/sun/star/wizards/common/JavaTools.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.common;
import com.sun.star.lang.XMultiServiceFactory;
@@ -44,104 +43,126 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-
-
/**
*
* @author bc93774
*/
-public class JavaTools {
+public class JavaTools
+{
/** Creates a new instance of JavaTools */
- public JavaTools() {
+ public JavaTools()
+ {
}
- public static void main(String args[]) {
+ public static void main(String args[])
+ {
String sPath = "";
DateTime oDateTime = null;
long n;
String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- try {
+ try
+ {
XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
- if(xLocMSF != null){
- System.out.println("Connected to "+ ConnectStr);
+ if (xLocMSF != null)
+ {
+ System.out.println("Connected to " + ConnectStr);
oDateTime = getDateTime(9500000);
sPath = convertfromURLNotation("file:///E:/trash/Web%20Wizard.xcu");
n = getMillis(oDateTime);
int a = 1;
}
}
- catch(Exception exception){
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
- }}
-
-
+ }
+ }
- public static String[] copyStringArray(String[] FirstArray) {
- if (FirstArray != null) {
+ public static String[] copyStringArray(String[] FirstArray)
+ {
+ if (FirstArray != null)
+ {
String[] SecondArray = new String[FirstArray.length];
- for (int i = 0; i < FirstArray.length; i++) {
+ for (int i = 0; i < FirstArray.length; i++)
+ {
SecondArray[i] = FirstArray[i];
}
return SecondArray;
- } else
+ }
+ else
+ {
return null;
+ }
}
-
- public static Object[] initializeArray(Object[] olist, Object ovalue){
+ public static Object[] initializeArray(Object[] olist, Object ovalue)
+ {
for (int i = 0; i < olist.length; i++)
+ {
olist[i] = ovalue;
+ }
return olist;
}
-
- public static Object[][] initializeMultiDimArray(Object[][] olist, Object[] ovalue){
+ public static Object[][] initializeMultiDimArray(Object[][] olist, Object[] ovalue)
+ {
for (int i = 0; i < olist.length; i++)
+ {
olist[i] = ovalue;
+ }
return olist;
}
-
- public static String[] ArrayOutOfMultiDimArray(String _sMultiDimArray[][], int _index){
+ public static String[] ArrayOutOfMultiDimArray(String _sMultiDimArray[][], int _index)
+ {
String[] sRetArray = null;
- if (_sMultiDimArray != null){
+ if (_sMultiDimArray != null)
+ {
sRetArray = new String[_sMultiDimArray.length];
- for (int i = 0; i < _sMultiDimArray.length; i++){
+ for (int i = 0; i < _sMultiDimArray.length; i++)
+ {
sRetArray[i] = _sMultiDimArray[i][_index];
}
}
return sRetArray;
}
-
- public static int[] initializeintArray(int FieldCount, int nValue) {
+ public static int[] initializeintArray(int FieldCount, int nValue)
+ {
int[] LocintArray = new int[FieldCount];
for (int i = 0; i < LocintArray.length; i++)
+ {
LocintArray[i] = nValue;
+ }
return LocintArray;
}
-
/**converts a list of Integer values included in an Integer vector to a list of int values
*
*
* @param _aIntegerVector
* @return
*/
- public static int[] IntegerTointList(Vector _aIntegerVector){
- try {
+ public static int[] IntegerTointList(Vector _aIntegerVector)
+ {
+ try
+ {
Integer[] nIntegerValues = new Integer[_aIntegerVector.size()];
int[] nintValues = new int[_aIntegerVector.size()];
_aIntegerVector.toArray(nIntegerValues);
for (int i = 0; i < nIntegerValues.length; i++)
+ {
nintValues[i] = nIntegerValues[i].intValue();
+ }
return nintValues;
- } catch (RuntimeException e) {
+ }
+ catch (RuntimeException e)
+ {
e.printStackTrace(System.out);
return null;
- }}
-
+ }
+ }
/**converts a list of Boolean values included in a Boolean vector to a list of boolean values
*
@@ -149,39 +170,50 @@ public class JavaTools {
* @param _aBooleanVector
* @return
*/
- public static boolean[] BooleanTobooleanList(Vector _aBooleanVector){
- try {
- Boolean[] bBooleanValues = new Boolean[_aBooleanVector.size()];
- boolean[] bbooleanValues = new boolean[_aBooleanVector.size()];
- _aBooleanVector.toArray(bBooleanValues);
- for (int i = 0; i < bBooleanValues.length; i++)
- bbooleanValues[i] = bBooleanValues[i].booleanValue();
- return bbooleanValues;
- } catch (RuntimeException e) {
- e.printStackTrace(System.out);
- return null;
- }}
-
-
-
+ public static boolean[] BooleanTobooleanList(Vector _aBooleanVector)
+ {
+ try
+ {
+ Boolean[] bBooleanValues = new Boolean[_aBooleanVector.size()];
+ boolean[] bbooleanValues = new boolean[_aBooleanVector.size()];
+ _aBooleanVector.toArray(bBooleanValues);
+ for (int i = 0; i < bBooleanValues.length; i++)
+ {
+ bbooleanValues[i] = bBooleanValues[i].booleanValue();
+ }
+ return bbooleanValues;
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
- public static String[] multiDimListToArray(String[][] multidimlist) {
- String[] retlist = new String[] {};
+ public static String[] multiDimListToArray(String[][] multidimlist)
+ {
+ String[] retlist = new String[]
+ {
+ };
retlist = new String[multidimlist.length];
- for (int i = 0; i < multidimlist.length; i++) {
+ for (int i = 0; i < multidimlist.length; i++)
+ {
retlist[i] = multidimlist[i][0];
}
return retlist;
}
- public static String getlongestArrayItem(String[] StringArray) {
+ public static String getlongestArrayItem(String[] StringArray)
+ {
String sLongestItem = "";
int FieldCount = StringArray.length;
int iOldLength = 0;
int iCurLength = 0;
- for (int i = 0; i < FieldCount; i++) {
+ for (int i = 0; i < FieldCount; i++)
+ {
iCurLength = StringArray[i].length();
- if (iCurLength > iOldLength) {
+ if (iCurLength > iOldLength)
+ {
iOldLength = iCurLength;
sLongestItem = StringArray[i];
}
@@ -189,13 +221,17 @@ public class JavaTools {
return sLongestItem;
}
- public static String ArraytoString(String[] LocArray) {
+ public static String ArraytoString(String[] LocArray)
+ {
String ResultString = "";
int iLen = LocArray.length;
- for (int i = 0; i < iLen; i++) {
+ for (int i = 0; i < iLen; i++)
+ {
ResultString += LocArray[i];
if (i < iLen - 1)
+ {
ResultString += ";";
+ }
}
return ResultString;
}
@@ -207,11 +243,14 @@ public class JavaTools {
* @return the index of the field that contains the string 'SearchString' or '-1' if not it is
* not contained within the array
*/
- public static int FieldInList(String[] SearchList, String SearchString) {
+ public static int FieldInList(String[] SearchList, String SearchString)
+ {
int FieldLen = SearchList.length;
int retvalue = -1;
- for (int i = 0; i < FieldLen; i++) {
- if (SearchList[i].compareTo(SearchString) == 0) {
+ for (int i = 0; i < FieldLen; i++)
+ {
+ if (SearchList[i].compareTo(SearchString) == 0)
+ {
retvalue = i;
break;
}
@@ -219,12 +258,16 @@ public class JavaTools {
return retvalue;
}
- public static int FieldInList(String[] SearchList, String SearchString, int StartIndex) {
+ public static int FieldInList(String[] SearchList, String SearchString, int StartIndex)
+ {
int FieldLen = SearchList.length;
int retvalue = -1;
- if (StartIndex < FieldLen) {
- for (int i = StartIndex; i < FieldLen; i++) {
- if (SearchList[i].compareTo(SearchString) == 0) {
+ if (StartIndex < FieldLen)
+ {
+ for (int i = StartIndex; i < FieldLen; i++)
+ {
+ if (SearchList[i].compareTo(SearchString) == 0)
+ {
retvalue = i;
break;
}
@@ -233,28 +276,39 @@ public class JavaTools {
return retvalue;
}
- public static int FieldInTable(String[][] SearchList, String SearchString) {
+ public static int FieldInTable(String[][] SearchList, String SearchString)
+ {
int retvalue;
- if (SearchList.length > 0) {
+ if (SearchList.length > 0)
+ {
int FieldLen = SearchList.length;
retvalue = -1;
- for (int i = 0; i < FieldLen; i++) {
- if (SearchList[i][0] != null) {
- if (SearchList[i][0].compareTo(SearchString) == 0) {
+ for (int i = 0; i < FieldLen; i++)
+ {
+ if (SearchList[i][0] != null)
+ {
+ if (SearchList[i][0].compareTo(SearchString) == 0)
+ {
retvalue = i;
break;
}
}
}
- } else
+ }
+ else
+ {
retvalue = -1;
+ }
return retvalue;
}
- public static int FieldInIntTable(int[][] SearchList, int SearchValue) {
+ public static int FieldInIntTable(int[][] SearchList, int SearchValue)
+ {
int retvalue = -1;
- for (int i = 0; i < SearchList.length; i++) {
- if (SearchList[i][0] == SearchValue) {
+ for (int i = 0; i < SearchList.length; i++)
+ {
+ if (SearchList[i][0] == SearchValue)
+ {
retvalue = i;
break;
}
@@ -262,11 +316,13 @@ public class JavaTools {
return retvalue;
}
-
- public static int FieldInIntTable(int[] SearchList, int SearchValue, int _startindex) {
+ public static int FieldInIntTable(int[] SearchList, int SearchValue, int _startindex)
+ {
int retvalue = -1;
- for (int i = _startindex; i < SearchList.length; i++) {
- if (SearchList[i] == SearchValue) {
+ for (int i = _startindex; i < SearchList.length; i++)
+ {
+ if (SearchList[i] == SearchValue)
+ {
retvalue = i;
break;
}
@@ -274,17 +330,18 @@ public class JavaTools {
return retvalue;
}
-
- public static int FieldInIntTable(int[] SearchList, int SearchValue) {
+ public static int FieldInIntTable(int[] SearchList, int SearchValue)
+ {
return FieldInIntTable(SearchList, SearchValue, 0);
}
-
-
- public static int getArraylength(Object[] MyArray) {
+ public static int getArraylength(Object[] MyArray)
+ {
int FieldCount = 0;
if (MyArray != null)
+ {
FieldCount = MyArray.length;
+ }
return FieldCount;
}
@@ -294,14 +351,19 @@ public class JavaTools {
* The default sorting order is the first dimension
* Only if sort2ndValue is True the second dimension is the relevant for the sorting order
*/
- public static String[][] bubblesortList(String[][] SortList) {
+ public static String[][] bubblesortList(String[][] SortList)
+ {
String DisplayDummy;
int SortCount = SortList[0].length;
int DimCount = SortList.length;
- for (int s = 0; s < SortCount; s++) {
- for (int t = 0; t < SortCount - s - 1; t++) {
- if (SortList[0][t].compareTo(SortList[0][t + 1]) > 0) {
- for (int k = 0; k < DimCount; k++) {
+ for (int s = 0; s < SortCount; s++)
+ {
+ for (int t = 0; t < SortCount - s - 1; t++)
+ {
+ if (SortList[0][t].compareTo(SortList[0][t + 1]) > 0)
+ {
+ for (int k = 0; k < DimCount; k++)
+ {
DisplayDummy = SortList[k][t];
SortList[k][t] = SortList[k][t + 1];
SortList[k][t + 1] = DisplayDummy;
@@ -317,83 +379,105 @@ public class JavaTools {
* @param Token
* @return
*/
- public static String[] ArrayoutofString(String MainString, String Token) {
+ public static String[] ArrayoutofString(String MainString, String Token)
+ {
String[] StringArray;
- if (MainString.equals("") == false) {
+ if (MainString.equals("") == false)
+ {
Vector StringVector = new Vector();
String LocString = null;
int iIndex;
- do {
+ do
+ {
iIndex = MainString.indexOf(Token);
if (iIndex < 0)
+ {
StringVector.addElement(MainString);
- else {
+ }
+ else
+ {
StringVector.addElement(MainString.substring(0, iIndex));
MainString = MainString.substring(iIndex + 1, MainString.length());
}
- } while (iIndex >= 0);
+ }
+ while (iIndex >= 0);
int FieldCount = StringVector.size();
StringArray = new String[FieldCount];
StringVector.copyInto(StringArray);
- } else
+ }
+ else
+ {
StringArray = new String[0];
+ }
return StringArray;
}
- public static String replaceSubString(String MainString, String NewSubString, String OldSubString) {
- try {
+ public static String replaceSubString(String MainString, String NewSubString, String OldSubString)
+ {
+ try
+ {
int NewIndex = 0;
int OldIndex = 0;
int NewSubLen = NewSubString.length();
int OldSubLen = OldSubString.length();
- while (NewIndex != -1) {
+ while (NewIndex != -1)
+ {
NewIndex = MainString.indexOf(OldSubString, OldIndex);
- if (NewIndex != -1) {
+ if (NewIndex != -1)
+ {
MainString = MainString.substring(0, NewIndex) + NewSubString + MainString.substring(NewIndex + OldSubLen);
OldIndex = NewIndex + NewSubLen;
}
}
return MainString;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
-
- public static String getFilenameOutOfPath(String sPath){
+ public static String getFilenameOutOfPath(String sPath)
+ {
String[] Hierarchy = ArrayoutofString(sPath, "/");
return Hierarchy[Hierarchy.length - 1];
}
-
- public static String getFileDescription(String sPath){
+ public static String getFileDescription(String sPath)
+ {
String sFilename = getFilenameOutOfPath(sPath);
String[] FilenameList = ArrayoutofString(sFilename, ".");
String FileDescription = "";
- for (int i = 0; i < FilenameList.length - 1; i++) {
+ for (int i = 0; i < FilenameList.length - 1; i++)
+ {
FileDescription += FilenameList[i];
}
return FileDescription;
}
-
-
- public static String convertfromURLNotation(String _sURLPath) {
- String sPath = "";
- try {
- URL oJavaURL = new URL(_sURLPath);
- File oFile = UrlToFileMapper.mapUrlToFile(oJavaURL);
- sPath = oFile.getAbsolutePath();
- } catch (MalformedURLException e) {
- e.printStackTrace(System.out);
- } catch (IOException e) {
- e.printStackTrace(System.out);
- }
- return sPath;
+ public static String convertfromURLNotation(String _sURLPath)
+ {
+ String sPath = "";
+ try
+ {
+ URL oJavaURL = new URL(_sURLPath);
+ File oFile = UrlToFileMapper.mapUrlToFile(oJavaURL);
+ sPath = oFile.getAbsolutePath();
+ }
+ catch (MalformedURLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return sPath;
}
- public static DateTime getDateTime(long timeMillis) {
+ public static DateTime getDateTime(long timeMillis)
+ {
java.util.Calendar cal = java.util.Calendar.getInstance();
setTimeInMillis(cal, timeMillis);
DateTime dt = new DateTime();
@@ -407,57 +491,71 @@ public class JavaTools {
return dt;
}
-
- public static long getTimeInMillis(Calendar _calendar){
+ public static long getTimeInMillis(Calendar _calendar)
+ {
java.util.Date dDate = _calendar.getTime();
return dDate.getTime();
}
-
- public static void setTimeInMillis(Calendar _calendar, long _timemillis){
+ public static void setTimeInMillis(Calendar _calendar, long _timemillis)
+ {
java.util.Date dDate = new java.util.Date();
dDate.setTime(_timemillis);
_calendar.setTime(dDate);
}
-
- public static long getMillis(DateTime time) {
+ public static long getMillis(DateTime time)
+ {
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.set(time.Year, time.Month, time.Day, time.Hours, time.Minutes, time.Seconds);
return getTimeInMillis(cal);
}
-
- public static String[] removeOutdatedFields(String[] baselist, String[] _complist) {
- String[] retarray = new String[] {};
- if ((baselist != null) && (_complist != null)) {
+ public static String[] removeOutdatedFields(String[] baselist, String[] _complist)
+ {
+ String[] retarray = new String[]
+ {
+ };
+ if ((baselist != null) && (_complist != null))
+ {
Vector retvector = new Vector();
// String[] orderedcomplist = new String[_complist.length];
// System.arraycopy(_complist, 0, orderedcomplist, 0, _complist.length);
for (int i = 0; i < baselist.length; i++)
// if (Arrays.binarySearch(orderedcomplist, baselist[i]) != -1)
+ {
if (FieldInList(_complist, baselist[i]) > -1)
+ {
retvector.add(baselist[i]);
- // else
- // here you could call the method of a defined interface to notify the calling method
- // }
+ // else
+ // here you could call the method of a defined interface to notify the calling method
+ // }
+ }
+ }
retarray = new String[retvector.size()];
retvector.toArray(retarray);
}
return (retarray);
}
-
- public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist, int _compindex) {
- String[][] retarray = new String[][] {};
- if ((baselist != null) && (_complist != null)) {
- if (baselist.length > 0) {
+ public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist, int _compindex)
+ {
+ String[][] retarray = new String[][]
+ {
+ };
+ if ((baselist != null) && (_complist != null))
+ {
+ if (baselist.length > 0)
+ {
Vector retvector = new Vector();
- for (int i = 0; i < baselist.length; i++) {
+ for (int i = 0; i < baselist.length; i++)
+ {
if (FieldInList(_complist, baselist[i][_compindex]) != -1)
+ {
retvector.add(baselist[i]);
// else
// here you could call the method of a defined interface to notify the calling method
+ }
}
retarray = new String[retvector.size()][2];
retvector.toArray(retarray);
@@ -466,28 +564,35 @@ public class JavaTools {
return (retarray);
}
-
- public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist) {
+ public static String[][] removeOutdatedFields(String[][] baselist, String[] _complist)
+ {
return removeOutdatedFields(baselist, _complist, 0);
}
- public static PropertyValue[][] removeOutdatedFields(PropertyValue[][] baselist, String[] _complist) {
- PropertyValue[][] retarray = new PropertyValue[][] {
+ public static PropertyValue[][] removeOutdatedFields(PropertyValue[][] baselist, String[] _complist)
+ {
+ PropertyValue[][] retarray = new PropertyValue[][]
+ {
};
- if ((baselist != null) && (_complist != null)) {
+ if ((baselist != null) && (_complist != null))
+ {
Vector firstdimvector = new Vector();
int b = 0;
- for (int n = 0; n < baselist.length; n++) {
+ for (int n = 0; n < baselist.length; n++)
+ {
Vector secdimvector = new Vector();
PropertyValue[] internalArray;
int a = 0;
- for (int m = 0; m < baselist[n].length; m++) {
- if (FieldInList(_complist, baselist[n][m].Name) > -1) {
+ for (int m = 0; m < baselist[n].length; m++)
+ {
+ if (FieldInList(_complist, baselist[n][m].Name) > -1)
+ {
secdimvector.add(baselist[n][m]);
a++;
}
}
- if (a > 0) {
+ if (a > 0)
+ {
internalArray = new PropertyValue[a];
secdimvector.toArray(internalArray);
firstdimvector.add(internalArray);
@@ -500,7 +605,6 @@ public class JavaTools {
return (retarray);
}
-
/**
* searches a multidimensional array for duplicate fields. According to the following example
* SlaveFieldName1 ;SlaveFieldName2; SlaveFieldName3
@@ -510,15 +614,21 @@ public class JavaTools {
* @param _scomplist
* @return
*/
- public static int getDuplicateFieldIndex(String[][] _scomplist){
+ public static int getDuplicateFieldIndex(String[][] _scomplist)
+ {
int retvalue = -1;
- if (_scomplist.length > 0){
+ if (_scomplist.length > 0)
+ {
int fieldcount = _scomplist[0].length;
String[] sDescList = new String[fieldcount];
- for (int m = 0; m < fieldcount; m++){
- for (int n = 0; n < _scomplist.length; n++){
+ for (int m = 0; m < fieldcount; m++)
+ {
+ for (int n = 0; n < _scomplist.length; n++)
+ {
if (n == 0)
+ {
sDescList[m] = new String();
+ }
sDescList[m] += _scomplist[n][m];
}
}
@@ -532,26 +642,35 @@ public class JavaTools {
* @param scomplist
* @return
*/
- public static int getDuplicateFieldIndex(String[] scomplist) {
- for (int n = 0; n < scomplist.length; n++) {
+ public static int getDuplicateFieldIndex(String[] scomplist)
+ {
+ for (int n = 0; n < scomplist.length; n++)
+ {
String scurvalue = scomplist[n];
- for (int m = n; m < scomplist.length; m++) {
- if (m != n){
+ for (int m = n; m < scomplist.length; m++)
+ {
+ if (m != n)
+ {
if (scurvalue.equals(scomplist[m]))
+ {
return m;
+ }
}
}
}
return -1;
}
-
- public static int getDuplicateFieldIndex(String[] _scomplist, String _fieldname) {
+ public static int getDuplicateFieldIndex(String[] _scomplist, String _fieldname)
+ {
int iduplicate = 0;
- for (int n = 0; n < _scomplist.length; n++) {
- if (_scomplist[n].equals(_fieldname)){
+ for (int n = 0; n < _scomplist.length; n++)
+ {
+ if (_scomplist[n].equals(_fieldname))
+ {
iduplicate++;
- if (iduplicate == 2){
+ if (iduplicate == 2)
+ {
return n;
}
}
@@ -559,84 +678,114 @@ public class JavaTools {
return -1;
}
-
-
- public static boolean isEqual(PropertyValue firstPropValue, PropertyValue secPropValue) {
+ public static boolean isEqual(PropertyValue firstPropValue, PropertyValue secPropValue)
+ {
if (!firstPropValue.Name.equals(secPropValue.Name))
+ {
return false;
//TODO replace 'equals' with AnyConverter.getType(firstpropValue).equals(secPropValue) to check content and Type
-
+ }
if (!firstPropValue.Value.equals(secPropValue.Value))
+ {
return false;
+ }
return (firstPropValue.Handle == secPropValue.Handle);
}
-
- public static int[] getDuplicateFieldIndex(PropertyValue[][] ocomplist) {
- for (int n = 0; n < ocomplist.length; n++) {
+ public static int[] getDuplicateFieldIndex(PropertyValue[][] ocomplist)
+ {
+ for (int n = 0; n < ocomplist.length; n++)
+ {
PropertyValue[] ocurValue = ocomplist[n];
- for (int m = n; m < ocurValue.length; m++) {
+ for (int m = n; m < ocurValue.length; m++)
+ {
PropertyValue odetValue = ocurValue[m];
- for (int s = 0; s < ocurValue.length; s++) {
- if (s != m) {
+ for (int s = 0; s < ocurValue.length; s++)
+ {
+ if (s != m)
+ {
if (isEqual(odetValue, ocurValue[s]))
- return new int[] { n, s };
+ {
+ return new int[]
+ {
+ n, s
+ };
+ }
}
}
}
}
- return new int[] { -1, -1 };
+ return new int[]
+ {
+ -1, -1
+ };
}
-
- public static String getSuffixNumber(String _sbasestring){
+ public static String getSuffixNumber(String _sbasestring)
+ {
int suffixcharcount = 0;
- for (int i = _sbasestring.length()-1 ;i >= 0 ; i--){
+ for (int i = _sbasestring.length() - 1; i >= 0; i--)
+ {
char b = _sbasestring.charAt(i);
if ((b >= '0') && (b <= '9'))
+ {
suffixcharcount++;
+ }
else
+ {
break;
+ }
}
int istart = _sbasestring.length() - suffixcharcount;
- return _sbasestring.substring(istart,_sbasestring.length());
+ return _sbasestring.substring(istart, _sbasestring.length());
}
-
- public static String[] removefromList(String[] _sbaselist, String[] _sdellist){
+ public static String[] removefromList(String[] _sbaselist, String[] _sdellist)
+ {
Vector tempbaselist = new Vector();
- for (int i = 0; i < _sbaselist.length; i++){
+ for (int i = 0; i < _sbaselist.length; i++)
+ {
if (FieldInList(_sdellist, _sbaselist[i]) == -1)
+ {
tempbaselist.add(_sbaselist[i]);
+ }
}
String[] sretlist = new String[tempbaselist.size()];
tempbaselist.toArray(sretlist);
return sretlist;
}
-
/**
* compares two strings. If one of them is empty and the other one is null it also returns true
* @param sFirstString
* @param sSecondString
* @return
*/
- public static boolean isSame(String sFirstString, String sSecondString){
+ public static boolean isSame(String sFirstString, String sSecondString)
+ {
boolean bissame = false;
- if (sFirstString == null){
+ if (sFirstString == null)
+ {
if (sSecondString != null)
+ {
bissame = sSecondString.equals("");
+ }
else
+ {
bissame = (sSecondString == null);
+ }
}
- else{
+ else
+ {
if (sFirstString.equals(""))
+ {
bissame = (sSecondString == null);
+ }
else if (sSecondString != null)
+ {
bissame = sFirstString.equals(sSecondString);
+ }
}
return bissame;
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/common/NoValidPathException.java b/wizards/com/sun/star/wizards/common/NoValidPathException.java
index d91de775d330..92a426689c07 100644
--- a/wizards/com/sun/star/wizards/common/NoValidPathException.java
+++ b/wizards/com/sun/star/wizards/common/NoValidPathException.java
@@ -1,3 +1,35 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: NoValidPathException.java,v $
+ *
+ * $Revision: 1.5.36.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
package com.sun.star.wizards.common;
import com.sun.star.lang.XMultiServiceFactory;
diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java
index 47ea6a627d76..2b4f9d0b2521 100644
--- a/wizards/com/sun/star/wizards/common/NumberFormatter.java
+++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java
@@ -26,7 +26,9 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.common;
+ ************************************************************************/
+
+package com.sun.star.wizards.common;
import java.util.Date;
@@ -43,7 +45,8 @@ import com.sun.star.util.XNumberFormatsSupplier;
import com.sun.star.util.XNumberFormatter;
-public class NumberFormatter {
+public class NumberFormatter
+{
public int iDateFormatKey = -1;
public int iDateTimeFormatKey = -1;
@@ -60,7 +63,8 @@ public class NumberFormatter {
private Locale aLocale;
- public NumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier _xNumberFormatsSupplier, Locale _aLocale) throws Exception{
+ public NumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier _xNumberFormatsSupplier, Locale _aLocale) throws Exception
+ {
aLocale = _aLocale;
Object oNumberFormatter = _xMSF.createInstance("com.sun.star.util.NumberFormatter");
xNumberFormats = _xNumberFormatsSupplier.getNumberFormats();
@@ -71,7 +75,8 @@ public class NumberFormatter {
}
- public NumberFormatter(XNumberFormatsSupplier _xNumberFormatsSupplier, Locale _aLocale) throws Exception{
+ public NumberFormatter(XNumberFormatsSupplier _xNumberFormatsSupplier, Locale _aLocale) throws Exception
+ {
aLocale = _aLocale;
xNumberFormats = _xNumberFormatsSupplier.getNumberFormats();
xNumberFormatSettings = _xNumberFormatsSupplier.getNumberFormatSettings();
@@ -83,7 +88,8 @@ public class NumberFormatter {
* @deprecated
*
*/
- public static XNumberFormatter createNumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier _xNumberFormatsSupplier) throws Exception{
+ public static XNumberFormatter createNumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier _xNumberFormatsSupplier) throws Exception
+ {
Object oNumberFormatter = _xMSF.createInstance("com.sun.star.util.NumberFormatter");
XNumberFormatter xNumberFormatter = (XNumberFormatter) UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter);
xNumberFormatter.attachNumberFormatsSupplier(_xNumberFormatsSupplier);
@@ -105,24 +111,28 @@ public class NumberFormatter {
* @return a key to use with a util.NumberFormat instance.
*
*/
- public static int getNumberFormatterKey( Object numberFormatsSupplier, short type) {
+ public static int getNumberFormatterKey( Object numberFormatsSupplier, short type)
+ {
Object numberFormatTypes = ((XNumberFormatsSupplier)UnoRuntime.queryInterface(XNumberFormatsSupplier.class,numberFormatsSupplier)).getNumberFormats();
Locale l = new Locale();
return ((XNumberFormatTypes)UnoRuntime.queryInterface(XNumberFormatTypes.class,numberFormatTypes)).getFormatIndex(type, l);
}
- public String convertNumberToString(int _nkey, double _dblValue){
+ public String convertNumberToString(int _nkey, double _dblValue)
+ {
return xNumberFormatter.convertNumberToString(_nkey, _dblValue);
}
- public static String convertNumberToString(XNumberFormatter _xNumberFormatter, int _nkey, double _dblValue){
+ public static String convertNumberToString(XNumberFormatter _xNumberFormatter, int _nkey, double _dblValue)
+ {
return _xNumberFormatter.convertNumberToString(_nkey, _dblValue);
}
- public double convertStringToNumber(int _nkey, String _sString)throws Exception{
+ public double convertStringToNumber(int _nkey, String _sString)throws Exception
+ {
return convertStringToNumber(_nkey, _sString);
}
@@ -130,21 +140,29 @@ public class NumberFormatter {
/**
* @param dateCorrection The lDateCorrection to set.
*/
- public void setNullDateCorrection(long dateCorrection) {
+ public void setNullDateCorrection(long dateCorrection)
+ {
lDateCorrection = dateCorrection;
}
- public int defineNumberFormat(String _FormatString){
- try {
- int NewFormatKey = xNumberFormats.queryKey(_FormatString, aLocale, true);
- if (NewFormatKey == -1)
- NewFormatKey = xNumberFormats.addNew(_FormatString, aLocale);
- return NewFormatKey;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return -1;
- }}
+ public int defineNumberFormat(String _FormatString)
+ {
+ try
+ {
+ int NewFormatKey = xNumberFormats.queryKey(_FormatString, aLocale, true);
+ if (NewFormatKey == -1)
+ {
+ NewFormatKey = xNumberFormats.addNew(_FormatString, aLocale);
+ }
+ return NewFormatKey;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return -1;
+ }
+ }
/**
@@ -154,40 +172,60 @@ public class NumberFormatter {
* @param FormatString
* @return
*/
- public int defineNumberFormat(String _FormatString, Locale _aLocale){
- try {
- int NewFormatKey = xNumberFormats.queryKey(_FormatString, _aLocale, true);
- if (NewFormatKey == -1)
- NewFormatKey = xNumberFormats.addNew(_FormatString, _aLocale);
- return NewFormatKey;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return -1;
- }}
+ public int defineNumberFormat(String _FormatString, Locale _aLocale)
+ {
+ try
+ {
+ int NewFormatKey = xNumberFormats.queryKey(_FormatString, _aLocale, true);
+ if (NewFormatKey == -1)
+ {
+ NewFormatKey = xNumberFormats.addNew(_FormatString, _aLocale);
+ }
+ return NewFormatKey;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return -1;
+ }
+ }
- public void setNumberFormat(XInterface _xFormatObject, int _FormatKey, NumberFormatter _oNumberFormatter) {
- try {
+ public void setNumberFormat(XInterface _xFormatObject, int _FormatKey, NumberFormatter _oNumberFormatter)
+ {
+ try
+ {
XPropertySet xNumberFormat = _oNumberFormatter.xNumberFormats.getByKey(_FormatKey); //CurDBField.DBFormatKey);
String FormatString = AnyConverter.toString(Helper.getUnoPropertyValue(xNumberFormat, "FormatString"));
Locale oLocale = (Locale) Helper.getUnoPropertyValue(xNumberFormat, "Locale");
int NewFormatKey = defineNumberFormat(FormatString, oLocale);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xFormatObject);
if (xPSet.getPropertySetInfo().hasPropertyByName("NumberFormat"))
+ {
xPSet.setPropertyValue("NumberFormat", new Integer(NewFormatKey));
+ }
else if (xPSet.getPropertySetInfo().hasPropertyByName("FormatKey"))
+ {
xPSet.setPropertyValue("FormatKey", new Integer(NewFormatKey));
+ }
else
+ {
+ // TODO: throws a exception in a try catch environment, very helpful?
throw new Exception();
- } catch (Exception exception){
+ }
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public long getNullDateCorrection(){
- if (!this.bNullDateCorrectionIsDefined){
+ public long getNullDateCorrection()
+ {
+ if (!this.bNullDateCorrectionIsDefined)
+ {
com.sun.star.util.Date dNullDate = (com.sun.star.util.Date) Helper.getUnoStructValue(this.xNumberFormatSettings, "NullDate");
long lNullDate = Helper.convertUnoDatetoInteger(dNullDate);
java.util.Calendar oCal = java.util.Calendar.getInstance();
@@ -199,17 +237,25 @@ public class NumberFormatter {
return lDateCorrection;
}
else
+ {
return this.lDateCorrection;
+ }
}
- public int setBooleanReportDisplayNumberFormat(){
+ public int setBooleanReportDisplayNumberFormat()
+ {
String FormatString = "[=1]" + '"' + (char)9745 + '"' + ";[=0]" + '"' + (char)58480 + '"' + ";0";
iLogicalFormatKey = xNumberFormats.queryKey(FormatString, aLocale, true);
- try {
+ try
+ {
if (iLogicalFormatKey == -1)
+ {
iLogicalFormatKey = xNumberFormats.addNew(FormatString, aLocale);
- } catch (Exception e) { //MalformedNumberFormat
+ }
+ }
+ catch (Exception e)
+ { //MalformedNumberFormat
e.printStackTrace();
iLogicalFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.LOGICAL, aLocale);
}
@@ -220,8 +266,10 @@ public class NumberFormatter {
/**
* @return Returns the iDateFormatKey.
*/
- public int getDateFormatKey() {
- if (iDateFormatKey == -1){
+ public int getDateFormatKey()
+ {
+ if (iDateFormatKey == -1)
+ {
iDateFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.DATE, aLocale);
}
return iDateFormatKey;
@@ -229,41 +277,56 @@ public class NumberFormatter {
/**
* @return Returns the iDateTimeFormatKey.
*/
- public int getDateTimeFormatKey() {
+ public int getDateTimeFormatKey()
+ {
if (iDateTimeFormatKey == -1)
+ {
iDateTimeFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.DATETIME, aLocale);
+ }
return iDateTimeFormatKey;
}
/**
* @return Returns the iLogicalFormatKey.
*/
- public int getLogicalFormatKey() {
+ public int getLogicalFormatKey()
+ {
if (iLogicalFormatKey == -1)
+ {
iLogicalFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.LOGICAL, aLocale);
+ }
return iLogicalFormatKey;
}
/**
* @return Returns the iNumberFormatKey.
*/
- public int getNumberFormatKey() {
+ public int getNumberFormatKey()
+ {
if (iNumberFormatKey == -1)
+ {
iNumberFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.NUMBER, aLocale);
+ }
return iNumberFormatKey;
}
/**
* @return Returns the iTextFormatKey.
*/
- public int getTextFormatKey() {
+ public int getTextFormatKey()
+ {
if (iTextFormatKey == -1)
+ {
iTextFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.TEXT, aLocale);
+ }
return iTextFormatKey;
}
/**
* @return Returns the iTimeFormatKey.
*/
- public int getTimeFormatKey() {
+ public int getTimeFormatKey()
+ {
if (iTimeFormatKey == -1)
+ {
iTimeFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.TIME, aLocale);
+ }
return iTimeFormatKey;
}
}
diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java
index 4a29325f0108..f65de8327677 100644
--- a/wizards/com/sun/star/wizards/common/NumericalHelper.java
+++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java
@@ -9,7 +9,7 @@
*
* $RCSfile: NumericalHelper.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,8 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
-
package com.sun.star.wizards.common;
// import com.sun.star.beans.XPropertySet;
@@ -47,7 +45,8 @@ import com.sun.star.uno.TypeClass;
* This class does not log warnings (or throws Exceptions) when the precision
* of a value is lost.
*/
-public class NumericalHelper {
+public class NumericalHelper
+{
public static final int UNKNOWN_TYPE = -32768;
public static final int BYTE_TYPE = 0;
@@ -61,11 +60,9 @@ public class NumericalHelper {
public static final int BOOLEAN_TYPE = -2;
public static final int ARRAY_TYPE = -3;
public static final int SEQUENCE_TYPE = -4;
-
public static final int ASCII_VALUE_0 = 48;
public static final int ASCII_VALUE_A = 65;
public static final int COUNT_CHARS_IN_ALPHABET = 26;
-
private static final int HEX_BASE = 16;
private static final int DEC_BASE = 10;
private static final int ASCII_LETTER_A_OFFSET = 55;
@@ -73,7 +70,8 @@ public class NumericalHelper {
/**
* private c'tor to prevent instantiation
*/
- private NumericalHelper() {
+ private NumericalHelper()
+ {
// private c'tor, so noone can instantiate
}
@@ -85,11 +83,13 @@ public class NumericalHelper {
*/
public static int getType(Object obj)
{
- try {
+ try
+ {
TypeObject aTypeObject = getTypeObject(obj);
return aTypeObject.iType;
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore this one; just return unknown type
}
return UNKNOWN_TYPE;
@@ -102,49 +102,53 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
public static byte toByte(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
byte retValue = 0;
boolean hasConversionWarning = false;
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType) {
+ switch (aTypeObject.iType)
+ {
case BYTE_TYPE:
retValue = getByte(aTypeObject);
break;
case CHAR_TYPE:
- retValue = (byte)getChar(aTypeObject);
+ retValue = (byte) getChar(aTypeObject);
break;
case SHORT_TYPE:
- retValue = (byte)getShort(aTypeObject);
+ retValue = (byte) getShort(aTypeObject);
break;
case INT_TYPE:
- retValue = (byte)getInt(aTypeObject);
+ retValue = (byte) getInt(aTypeObject);
break;
case LONG_TYPE:
- retValue = (byte)getLong(aTypeObject);
+ retValue = (byte) getLong(aTypeObject);
break;
case FLOAT_TYPE:
- retValue = (byte)getFloat(aTypeObject);
+ retValue = (byte) getFloat(aTypeObject);
break;
case DOUBLE_TYPE:
- retValue = (byte)getDouble(aTypeObject);
+ retValue = (byte) getDouble(aTypeObject);
break;
case STRING_TYPE:
- try {
- Byte b = new Byte((String)aTypeObject.aValue);
+ try
+ {
+ Byte b = new Byte((String) aTypeObject.aValue);
retValue = b.byteValue();
}
- catch(java.lang.NumberFormatException e) {
+ catch (java.lang.NumberFormatException e)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert to byte: " + aTypeObject.aValue);
+ "Cannot convert to byte: " + aTypeObject.aValue);
}
break;
case BOOLEAN_TYPE:
- retValue = getBool(aTypeObject)?(byte)-1:(byte)0;
+ retValue = getBool(aTypeObject) ? (byte) -1 : (byte) 0;
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return retValue;
}
@@ -156,54 +160,60 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
public static char toChar(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
char retValue = 0;
boolean hasConversionWarning = false;
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType) {
+ switch (aTypeObject.iType)
+ {
case CHAR_TYPE:
retValue = getChar(aTypeObject);
break;
case BYTE_TYPE:
- retValue = (char)getByte(aTypeObject);
+ retValue = (char) getByte(aTypeObject);
break;
case SHORT_TYPE:
- retValue = (char)getShort(aTypeObject);
+ retValue = (char) getShort(aTypeObject);
break;
case INT_TYPE:
- retValue = (char)getInt(aTypeObject);
+ retValue = (char) getInt(aTypeObject);
break;
case LONG_TYPE:
- retValue = (char)getLong(aTypeObject);
+ retValue = (char) getLong(aTypeObject);
break;
case FLOAT_TYPE:
- retValue = (char)getFloat(aTypeObject);
+ retValue = (char) getFloat(aTypeObject);
break;
case DOUBLE_TYPE:
- retValue = (char)getDouble(aTypeObject);
+ retValue = (char) getDouble(aTypeObject);
break;
case STRING_TYPE:
- try {
- String s = (String)aTypeObject.aValue;
- if (s.length() > 0) {
+ try
+ {
+ String s = (String) aTypeObject.aValue;
+ if (s.length() > 0)
+ {
retValue = s.charAt(0);
}
- else {
- retValue = (char)0;
+ else
+ {
+ retValue = (char) 0;
}
}
- catch(java.lang.NumberFormatException e) {
+ catch (java.lang.NumberFormatException e)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert to char: " + aTypeObject.aValue);
+ "Cannot convert to char: " + aTypeObject.aValue);
}
break;
case BOOLEAN_TYPE:
- retValue = getBool(aTypeObject)?(char)-1:(char)0;
+ retValue = getBool(aTypeObject) ? (char) -1 : (char) 0;
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return retValue;
}
@@ -215,64 +225,73 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
public static short toShort(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
short retValue = 0;
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType) {
+ switch (aTypeObject.iType)
+ {
case BYTE_TYPE:
- retValue = (short)getByte(aTypeObject);
+ retValue = (short) getByte(aTypeObject);
break;
case CHAR_TYPE:
- retValue = (byte)getChar(aTypeObject);
+ retValue = (byte) getChar(aTypeObject);
break;
case SHORT_TYPE:
retValue = getShort(aTypeObject);
break;
case INT_TYPE:
- retValue = (short)getInt(aTypeObject);
+ retValue = (short) getInt(aTypeObject);
break;
case LONG_TYPE:
- retValue = (short)getLong(aTypeObject);
+ retValue = (short) getLong(aTypeObject);
break;
case FLOAT_TYPE:
- retValue = (short)getFloat(aTypeObject);
+ retValue = (short) getFloat(aTypeObject);
break;
case DOUBLE_TYPE:
- retValue = (short)getDouble(aTypeObject);
+ retValue = (short) getDouble(aTypeObject);
break;
case STRING_TYPE:
- try {
- Short s = new Short((String)aTypeObject.aValue);
+ try
+ {
+ Short s = new Short((String) aTypeObject.aValue);
retValue = s.shortValue();
}
- catch(java.lang.NumberFormatException e) {
+ catch (java.lang.NumberFormatException e)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert to short: " + aTypeObject.aValue);
+ "Cannot convert to short: " + aTypeObject.aValue);
}
break;
case BOOLEAN_TYPE:
- retValue = getBool(aTypeObject)?(short)-1:(short)0;
+ retValue = getBool(aTypeObject) ? (short) -1 : (short) 0;
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return retValue;
}
-
- public static boolean isValidAndNumerical(Object aValue) throws com.sun.star.lang.IllegalArgumentException{
- if (aValue != null){
- if (!AnyConverter.isVoid(aValue)) {
+ public static boolean isValidAndNumerical(Object aValue) throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (aValue != null)
+ {
+ if (!AnyConverter.isVoid(aValue))
+ {
return (NumericalHelper.isNumerical(aValue));
}
}
return false;
}
- public static boolean isValidAndBoolean(Object aValue) throws com.sun.star.lang.IllegalArgumentException{
- if (aValue != null){
- if (!AnyConverter.isVoid(aValue)) {
+ public static boolean isValidAndBoolean(Object aValue) throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (aValue != null)
+ {
+ if (!AnyConverter.isVoid(aValue))
+ {
int nType = AnyConverter.getType(aValue).getTypeClass().getValue();
return (nType == TypeClass.BOOLEAN_value);
}
@@ -280,10 +299,12 @@ public class NumericalHelper {
return false;
}
-
- public static boolean isValid(Object aValue){
- if (aValue != null){
- if (!AnyConverter.isVoid(aValue)) {
+ public static boolean isValid(Object aValue)
+ {
+ if (aValue != null)
+ {
+ if (!AnyConverter.isVoid(aValue))
+ {
return true;
}
}
@@ -291,51 +312,56 @@ public class NumericalHelper {
}
/**
- @param aValue a object this can contain anything
- @return true, if the parameter aValue is type of real numbers
- @deprecate, use isRealNumber() instead.
- */
-
- public static boolean isNumerical(Object aValue) {
- try {
+ @param aValue a object this can contain anything
+ @return true, if the parameter aValue is type of real numbers
+ @deprecate, use isRealNumber() instead.
+ */
+ public static boolean isNumerical(Object aValue)
+ {
+ try
+ {
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType){
- case BYTE_TYPE:
- case CHAR_TYPE:
- case SHORT_TYPE:
- case INT_TYPE:
- case LONG_TYPE:
- case DOUBLE_TYPE:
- case FLOAT_TYPE:
- return true;
- default:
- return false;
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ case CHAR_TYPE:
+ case SHORT_TYPE:
+ case INT_TYPE:
+ case LONG_TYPE:
+ case DOUBLE_TYPE:
+ case FLOAT_TYPE:
+ return true;
+ default:
+ return false;
}
- } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
return false;
- }}
+ }
+ }
/**
- @param _aValue a object this can contain anything
- @return true, if the parameter aValue is type of real numbers
+ @param _aValue a object this can contain anything
+ @return true, if the parameter aValue is type of real numbers
- see also http://en.wikipedia.org/wiki/Mathematics
- */
+ see also http://en.wikipedia.org/wiki/Mathematics
+ */
public static boolean isRealNumber(Object _aValue)
{
return isNumerical(_aValue);
}
/**
- @param aValue a object this can contain anything
+ @param aValue a object this can contain anything
* @return true, if the value is type of any integer values. double / float are not(!) integer values
* @throws com.sun.star.lang.IllegalArgumentException
- */
+ */
public static boolean isInteger(Object aValue) throws com.sun.star.lang.IllegalArgumentException
+ {
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
{
- TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType)
- {
case BYTE_TYPE:
case CHAR_TYPE:
case SHORT_TYPE:
@@ -344,20 +370,23 @@ public class NumericalHelper {
return true;
default:
return false;
- }
}
+ }
/**
* Can a given object be converted to a String array?
* @param aValue the object to test
* @return true, if the object can be converted to a String array.
*/
- public static boolean isStringArray(Object aValue) {
- try {
+ public static boolean isStringArray(Object aValue)
+ {
+ try
+ {
toStringArray(aValue);
return true;
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore
}
return false;
@@ -368,18 +397,19 @@ public class NumericalHelper {
* @param aValue the object to test
* @return true, if the object can be converted to an Integer array.
*/
- public static boolean isIntegerArray(Object aValue) {
- try {
+ public static boolean isIntegerArray(Object aValue)
+ {
+ try
+ {
toIntArray(aValue);
return true;
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore
}
return false;
}
-
-
// public static int toIntWithErrorMessage(Object _aValue) throws com.sun.star.script.BasicErrorException{
// try {
// return toInt(_aValue);
@@ -471,8 +501,6 @@ public class NumericalHelper {
// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, "");
// return false;
// }}
-
-
/**
* get an int value from the object
* @param aValue
@@ -480,47 +508,51 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
public static int toInt(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
int retValue = 0;
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType) {
+ switch (aTypeObject.iType)
+ {
case BYTE_TYPE:
- retValue = (int)getByte(aTypeObject);
+ retValue = (int) getByte(aTypeObject);
break;
case CHAR_TYPE:
- retValue = (int)getChar(aTypeObject);
+ retValue = (int) getChar(aTypeObject);
break;
case SHORT_TYPE:
- retValue = (int)getShort(aTypeObject);
+ retValue = (int) getShort(aTypeObject);
break;
case INT_TYPE:
retValue = getInt(aTypeObject);
break;
case LONG_TYPE:
- retValue = (int)getLong(aTypeObject);
+ retValue = (int) getLong(aTypeObject);
break;
case FLOAT_TYPE:
- retValue = (int)getFloat(aTypeObject);
+ retValue = (int) getFloat(aTypeObject);
break;
case DOUBLE_TYPE:
- retValue = (int)getDouble(aTypeObject);
+ retValue = (int) getDouble(aTypeObject);
break;
case STRING_TYPE:
- try {
- Integer i = new Integer((String)aTypeObject.aValue);
+ try
+ {
+ Integer i = new Integer((String) aTypeObject.aValue);
retValue = i.intValue();
}
- catch(java.lang.NumberFormatException e) {
+ catch (java.lang.NumberFormatException e)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert to int: " + aTypeObject.aValue);
+ "Cannot convert to int: " + aTypeObject.aValue);
}
break;
case BOOLEAN_TYPE:
- retValue = getBool(aTypeObject)? -1 : 0;
+ retValue = getBool(aTypeObject) ? -1 : 0;
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return retValue;
}
@@ -532,47 +564,51 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
public static long toLong(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
long retValue = 0;
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType) {
+ switch (aTypeObject.iType)
+ {
case BYTE_TYPE:
- retValue = (long)getByte(aTypeObject);
+ retValue = (long) getByte(aTypeObject);
break;
case CHAR_TYPE:
- retValue = (long)getChar(aTypeObject);
+ retValue = (long) getChar(aTypeObject);
break;
case SHORT_TYPE:
- retValue = (long)getShort(aTypeObject);
+ retValue = (long) getShort(aTypeObject);
break;
case INT_TYPE:
- retValue = (long)getInt(aTypeObject);
+ retValue = (long) getInt(aTypeObject);
break;
case LONG_TYPE:
retValue = getLong(aTypeObject);
break;
case FLOAT_TYPE:
- retValue = (long)getFloat(aTypeObject);
+ retValue = (long) getFloat(aTypeObject);
break;
case DOUBLE_TYPE:
- retValue = (long)getDouble(aTypeObject);
+ retValue = (long) getDouble(aTypeObject);
break;
case STRING_TYPE:
- try {
- Long l = new Long((String)aTypeObject.aValue);
+ try
+ {
+ Long l = new Long((String) aTypeObject.aValue);
retValue = l.longValue();
}
- catch(java.lang.NumberFormatException e) {
+ catch (java.lang.NumberFormatException e)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert to short: " + aTypeObject.aValue);
+ "Cannot convert to short: " + aTypeObject.aValue);
}
break;
case BOOLEAN_TYPE:
- retValue = getBool(aTypeObject)? -1 : 0;
+ retValue = getBool(aTypeObject) ? -1 : 0;
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return retValue;
}
@@ -584,47 +620,51 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
public static float toFloat(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
- float retValue = (float)0.0;
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ float retValue = (float) 0.0;
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType) {
+ switch (aTypeObject.iType)
+ {
case BYTE_TYPE:
- retValue = (float)getByte(aTypeObject);
+ retValue = (float) getByte(aTypeObject);
break;
case CHAR_TYPE:
- retValue = (float)getChar(aTypeObject);
+ retValue = (float) getChar(aTypeObject);
break;
case SHORT_TYPE:
- retValue = (float)getShort(aTypeObject);
+ retValue = (float) getShort(aTypeObject);
break;
case INT_TYPE:
- retValue = (float)getInt(aTypeObject);
+ retValue = (float) getInt(aTypeObject);
break;
case LONG_TYPE:
- retValue = (float)getLong(aTypeObject);
+ retValue = (float) getLong(aTypeObject);
break;
case FLOAT_TYPE:
retValue = getFloat(aTypeObject);
break;
case DOUBLE_TYPE:
- retValue = (float)getDouble(aTypeObject);
+ retValue = (float) getDouble(aTypeObject);
break;
case STRING_TYPE:
- try {
- Float f = new Float((String)aTypeObject.aValue);
+ try
+ {
+ Float f = new Float((String) aTypeObject.aValue);
retValue = f.floatValue();
}
- catch(java.lang.NumberFormatException e) {
+ catch (java.lang.NumberFormatException e)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert to short: " + aTypeObject.aValue);
+ "Cannot convert to short: " + aTypeObject.aValue);
}
break;
case BOOLEAN_TYPE:
- retValue = getBool(aTypeObject)?(float)-1:(float)0;
+ retValue = getBool(aTypeObject) ? (float) -1 : (float) 0;
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return retValue;
}
@@ -636,47 +676,51 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
public static double toDouble(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
double retValue = 0.0;
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType) {
+ switch (aTypeObject.iType)
+ {
case BYTE_TYPE:
- retValue = (double)getByte(aTypeObject);
+ retValue = (double) getByte(aTypeObject);
break;
case CHAR_TYPE:
- retValue = (double)getChar(aTypeObject);
+ retValue = (double) getChar(aTypeObject);
break;
case SHORT_TYPE:
- retValue = (double)getShort(aTypeObject);
+ retValue = (double) getShort(aTypeObject);
break;
case INT_TYPE:
- retValue = (double)getInt(aTypeObject);
+ retValue = (double) getInt(aTypeObject);
break;
case LONG_TYPE:
- retValue = (double)getLong(aTypeObject);
+ retValue = (double) getLong(aTypeObject);
break;
case FLOAT_TYPE:
- retValue = (double)getFloat(aTypeObject);
+ retValue = (double) getFloat(aTypeObject);
break;
case DOUBLE_TYPE:
retValue = getDouble(aTypeObject);
break;
case STRING_TYPE:
- try {
- Float f = new Float((String)aTypeObject.aValue);
+ try
+ {
+ Float f = new Float((String) aTypeObject.aValue);
retValue = f.floatValue();
}
- catch(java.lang.NumberFormatException e) {
+ catch (java.lang.NumberFormatException e)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert to short: " + aTypeObject.aValue);
+ "Cannot convert to short: " + aTypeObject.aValue);
}
break;
case BOOLEAN_TYPE:
- retValue = getBool(aTypeObject)?(double)-1:(double)0;
+ retValue = getBool(aTypeObject) ? (double) -1 : (double) 0;
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return retValue;
}
@@ -688,48 +732,49 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
public static String toString(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
String retValue = null;
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType) {
+ switch (aTypeObject.iType)
+ {
case BYTE_TYPE:
- retValue = ((Byte)aTypeObject.aValue).toString();
+ retValue = ((Byte) aTypeObject.aValue).toString();
break;
case CHAR_TYPE:
- retValue = ((Character)aTypeObject.aValue).toString();
+ retValue = ((Character) aTypeObject.aValue).toString();
break;
case SHORT_TYPE:
- retValue = ((Short)aTypeObject.aValue).toString();
+ retValue = ((Short) aTypeObject.aValue).toString();
break;
case INT_TYPE:
- retValue = ((Integer)aTypeObject.aValue).toString();
+ retValue = ((Integer) aTypeObject.aValue).toString();
break;
case LONG_TYPE:
- retValue = ((Long)aTypeObject.aValue).toString();
+ retValue = ((Long) aTypeObject.aValue).toString();
break;
case FLOAT_TYPE:
- retValue = ((Float)aTypeObject.aValue).toString();
+ retValue = ((Float) aTypeObject.aValue).toString();
break;
case DOUBLE_TYPE:
- retValue = ((Double)aTypeObject.aValue).toString();
+ retValue = ((Double) aTypeObject.aValue).toString();
break;
case STRING_TYPE:
- retValue = (String)aTypeObject.aValue;
+ retValue = (String) aTypeObject.aValue;
break;
case BOOLEAN_TYPE:
- retValue = ((Boolean)aTypeObject.aValue).toString();
+ retValue = ((Boolean) aTypeObject.aValue).toString();
break;
case ARRAY_TYPE:
retValue = new String(toByteArray((aValue)));
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return retValue;
}
-
/**
* get a boolean value from the object
* @param aValue
@@ -737,47 +782,51 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
*/
public static boolean toBoolean(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
boolean retValue = true;
TypeObject aTypeObject = getTypeObject(aValue);
- switch(aTypeObject.iType) {
+ switch (aTypeObject.iType)
+ {
case BYTE_TYPE:
- retValue = (((Byte)aTypeObject.aValue).byteValue() != 0);
+ retValue = (((Byte) aTypeObject.aValue).byteValue() != 0);
break;
case CHAR_TYPE:
- retValue = (((Character)aTypeObject.aValue).charValue() != 0);
+ retValue = (((Character) aTypeObject.aValue).charValue() != 0);
break;
case SHORT_TYPE:
- retValue = (((Short)aTypeObject.aValue).shortValue() != 0);
+ retValue = (((Short) aTypeObject.aValue).shortValue() != 0);
break;
case INT_TYPE:
- retValue = (((Integer)aTypeObject.aValue).intValue() != 0);
+ retValue = (((Integer) aTypeObject.aValue).intValue() != 0);
break;
case LONG_TYPE:
- retValue = (((Long)aTypeObject.aValue).longValue() != 0);
+ retValue = (((Long) aTypeObject.aValue).longValue() != 0);
break;
case FLOAT_TYPE:
- retValue = (((Float)aTypeObject.aValue).floatValue() != 0);
+ retValue = (((Float) aTypeObject.aValue).floatValue() != 0);
break;
case DOUBLE_TYPE:
- retValue = (((Double)aTypeObject.aValue).doubleValue() != 0);
+ retValue = (((Double) aTypeObject.aValue).doubleValue() != 0);
break;
case STRING_TYPE:
- try {
- Boolean b = Boolean.valueOf((String)aTypeObject.aValue);
+ try
+ {
+ Boolean b = Boolean.valueOf((String) aTypeObject.aValue);
retValue = b.booleanValue();
}
- catch(java.lang.NumberFormatException e) {
+ catch (java.lang.NumberFormatException e)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert to short: " + aTypeObject.aValue);
+ "Cannot convert to short: " + aTypeObject.aValue);
}
break;
case BOOLEAN_TYPE:
- retValue = ((Boolean)aTypeObject.aValue).booleanValue();
+ retValue = ((Boolean) aTypeObject.aValue).booleanValue();
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return retValue;
}
@@ -789,21 +838,29 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException
*/
public static int[] toIntArray(Object anArrayValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
int[] retValue = null;
TypeObject aTypeObject = getTypeObject(anArrayValue);
- if (aTypeObject.iType == SEQUENCE_TYPE) {
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
aTypeObject = convertSequenceToObjectArray(aTypeObject);
}
- if (aTypeObject.iType == ARRAY_TYPE) {
- Object[]obj = (Object[])aTypeObject.aValue;
+ if (aTypeObject.iType == ARRAY_TYPE)
+ {
+ Object[] obj = (Object[]) aTypeObject.aValue;
retValue = new int[obj.length];
- for (int i=0; i<obj.length; i++) {
+ for (int i = 0; i < obj.length; i++)
+ {
retValue[i] = toInt(obj[i]);
}
}
- else { // object is not really an array
- retValue = new int[]{toInt(anArrayValue)};
+ else
+ { // object is not really an array
+ retValue = new int[]
+ {
+ toInt(anArrayValue)
+ };
}
return retValue;
}
@@ -815,21 +872,29 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException
*/
public static byte[] toByteArray(Object anArrayValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
byte[] retValue = null;
TypeObject aTypeObject = getTypeObject(anArrayValue);
- if (aTypeObject.iType == SEQUENCE_TYPE) {
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
aTypeObject = convertSequenceToObjectArray(aTypeObject);
}
- if (aTypeObject.iType == ARRAY_TYPE) {
- Object[]obj = (Object[])aTypeObject.aValue;
+ if (aTypeObject.iType == ARRAY_TYPE)
+ {
+ Object[] obj = (Object[]) aTypeObject.aValue;
retValue = new byte[obj.length];
- for (int i=0; i<obj.length; i++) {
+ for (int i = 0; i < obj.length; i++)
+ {
retValue[i] = toByte(obj[i]);
}
}
- else { // object is not really an array
- retValue = new byte[]{toByte(anArrayValue)};
+ else
+ { // object is not really an array
+ retValue = new byte[]
+ {
+ toByte(anArrayValue)
+ };
}
return retValue;
}
@@ -841,21 +906,29 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException
*/
public static short[] toShortArray(Object anArrayValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
short[] retValue = null;
TypeObject aTypeObject = getTypeObject(anArrayValue);
- if (aTypeObject.iType == SEQUENCE_TYPE) {
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
aTypeObject = convertSequenceToObjectArray(aTypeObject);
}
- if (aTypeObject.iType == ARRAY_TYPE) {
- Object[]obj = (Object[])aTypeObject.aValue;
+ if (aTypeObject.iType == ARRAY_TYPE)
+ {
+ Object[] obj = (Object[]) aTypeObject.aValue;
retValue = new short[obj.length];
- for (int i=0; i<obj.length; i++) {
+ for (int i = 0; i < obj.length; i++)
+ {
retValue[i] = toShort(obj[i]);
}
}
- else { // object is not really an array
- retValue = new short[]{toShort(anArrayValue)};
+ else
+ { // object is not really an array
+ retValue = new short[]
+ {
+ toShort(anArrayValue)
+ };
}
return retValue;
}
@@ -867,26 +940,33 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException
*/
public static String[] toStringArray(Object anArrayValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
String[] retValue = null;
TypeObject aTypeObject = getTypeObject(anArrayValue);
- if (aTypeObject.iType == SEQUENCE_TYPE) {
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
aTypeObject = convertSequenceToObjectArray(aTypeObject);
}
- if (aTypeObject.iType == ARRAY_TYPE) {
- Object[]obj = (Object[])aTypeObject.aValue;
+ if (aTypeObject.iType == ARRAY_TYPE)
+ {
+ Object[] obj = (Object[]) aTypeObject.aValue;
retValue = new String[obj.length];
- for (int i=0; i<obj.length; i++) {
+ for (int i = 0; i < obj.length; i++)
+ {
retValue[i] = toString(obj[i]);
}
}
- else { // object is not really an array
- retValue = new String[]{toString(anArrayValue)};
+ else
+ { // object is not really an array
+ retValue = new String[]
+ {
+ toString(anArrayValue)
+ };
}
return retValue;
}
-
/**
* get an int from an object
* @param _aValue a value that is constructed into an int
@@ -896,7 +976,7 @@ public class NumericalHelper {
*/
public static int toInt(Object _aValue, int _ndefaultValue) throws Exception
{
- int nreturn = _ndefaultValue;
+ int nreturn = _ndefaultValue;
try
{
if ((_aValue != null) && (!(AnyConverter.isVoid(_aValue))))
@@ -913,24 +993,25 @@ public class NumericalHelper {
}
catch (com.sun.star.uno.Exception e)
{
- DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/ , "");
+ DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, "");
}
return nreturn;
}
-
-
/**
* get a long from an object
* @param aValue a value that is constructed into a long
* @param defaultValue the value that is returned, if conversion fails
* @return a long value
*/
- public static long toLong(Object aValue, long defaultValue) {
- try {
+ public static long toLong(Object aValue, long defaultValue)
+ {
+ try
+ {
return toLong(aValue);
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore exception
}
return defaultValue;
@@ -942,11 +1023,14 @@ public class NumericalHelper {
* @param defaultValue the value that is returned, if conversion fails
* @return a long value
*/
- public static float toFloat(Object aValue, float defaultValue) {
- try {
+ public static float toFloat(Object aValue, float defaultValue)
+ {
+ try
+ {
return toFloat(aValue);
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore exception
}
return defaultValue;
@@ -958,11 +1042,14 @@ public class NumericalHelper {
* @param defaultValue the value that is returned, if conversion fails
* @return a double value
*/
- public static double toDouble(Object aValue, double defaultValue) {
- try {
+ public static double toDouble(Object aValue, double defaultValue)
+ {
+ try
+ {
return toDouble(aValue);
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore exception
}
return defaultValue;
@@ -974,11 +1061,14 @@ public class NumericalHelper {
* @param defaultValue the value that is returned, if conversion fails
* @return a string value
*/
- public static String toString(Object aValue, String defaultValue) {
- try {
+ public static String toString(Object aValue, String defaultValue)
+ {
+ try
+ {
return toString(aValue);
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore exception
}
return defaultValue;
@@ -990,11 +1080,14 @@ public class NumericalHelper {
* @param defaultValue the value that is returned, if conversion fails
* @return a boolean value
*/
- public static boolean toBoolean(Object aValue, boolean defaultValue) {
- try {
+ public static boolean toBoolean(Object aValue, boolean defaultValue)
+ {
+ try
+ {
return toBoolean(aValue);
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore exception
}
return defaultValue;
@@ -1006,11 +1099,14 @@ public class NumericalHelper {
* @param defaultValue the value that is returned, if conversion fails
* @return an int array
*/
- public static int[] toIntArray(Object anArrayValue, int[] defaultValue) {
- try {
+ public static int[] toIntArray(Object anArrayValue, int[] defaultValue)
+ {
+ try
+ {
return toIntArray(anArrayValue);
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore exception
}
return defaultValue;
@@ -1022,11 +1118,14 @@ public class NumericalHelper {
* @param defaultValue the value that is returned, if conversion fails
* @return a short array
*/
- public static short[] toShortArray(Object anArrayValue, short[] defaultValue) {
- try {
+ public static short[] toShortArray(Object anArrayValue, short[] defaultValue)
+ {
+ try
+ {
return toShortArray(anArrayValue);
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore exception
}
return defaultValue;
@@ -1038,11 +1137,14 @@ public class NumericalHelper {
* @param defaultValue the value that is returned, if conversion fails
* @return a string array
*/
- public static String[] toStringArray(Object anArrayValue, String[] defaultValue) {
- try {
+ public static String[] toStringArray(Object anArrayValue, String[] defaultValue)
+ {
+ try
+ {
return toStringArray(anArrayValue);
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
// ignore exception
}
return defaultValue;
@@ -1053,7 +1155,8 @@ public class NumericalHelper {
* @param number the number to transform
* @return a String with the hex code of the number
*/
- public static String getHexStringFromNumber(long number) {
+ public static String getHexStringFromNumber(long number)
+ {
TransformNumToHex num = new TransformNumToHex(number);
return num.getResult();
}
@@ -1070,8 +1173,6 @@ public class NumericalHelper {
// throws com.sun.star.script.BasicErrorException {
// return RomanNumbering.getRomanEquivalent(n);
// }
-
-
/**
* get the type object from the given object
* @param aValue an object representing a (numerical) value; can also be an 'any'
@@ -1079,13 +1180,16 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException if the object is unknown
*/
private static TypeObject getTypeObject(Object aValue)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
TypeObject aTypeObject = new TypeObject();
- if (aValue == null || AnyConverter.isVoid(aValue)) {
+ if (aValue == null || AnyConverter.isVoid(aValue))
+ {
throw new com.sun.star.lang.IllegalArgumentException("Cannot convert a null object.");
}
int type = AnyConverter.getType(aValue).getTypeClass().getValue();
- switch(type) {
+ switch (type)
+ {
case TypeClass.CHAR_value:
aTypeObject.iType = CHAR_TYPE;
aTypeObject.aValue = new Character(AnyConverter.toChar(aValue));
@@ -1124,7 +1228,10 @@ public class NumericalHelper {
break;
case TypeClass.ARRAY_value:
aTypeObject.iType = ARRAY_TYPE;
- aTypeObject.aValue = new Object[]{AnyConverter.toArray(aValue)};
+ aTypeObject.aValue = new Object[]
+ {
+ AnyConverter.toArray(aValue)
+ };
break;
case TypeClass.SEQUENCE_value:
aTypeObject.iType = SEQUENCE_TYPE;
@@ -1132,7 +1239,7 @@ public class NumericalHelper {
break;
default:
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert this type: " + aValue.getClass().getName());
+ "Cannot convert this type: " + aValue.getClass().getName());
}
return aTypeObject;
}
@@ -1141,39 +1248,44 @@ public class NumericalHelper {
* get the simple byte type
*/
private static byte getByte(TypeObject typeObject)
- throws com.sun.star.lang.IllegalArgumentException {
- if (typeObject.iType != BYTE_TYPE) {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (typeObject.iType != BYTE_TYPE)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
"Given argument is not a byte type.");
}
- return ((Byte)typeObject.aValue).byteValue();
+ return ((Byte) typeObject.aValue).byteValue();
}
/**
* get the simple char type
*/
private static char getChar(TypeObject typeObject)
- throws com.sun.star.lang.IllegalArgumentException {
- if (typeObject.iType != CHAR_TYPE) {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (typeObject.iType != CHAR_TYPE)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
"Given argument is not a char type.");
}
- return ((Character)typeObject.aValue).charValue();
+ return ((Character) typeObject.aValue).charValue();
}
/**
* get the simple short type
*/
private static short getShort(TypeObject typeObject)
- throws com.sun.star.lang.IllegalArgumentException {
- if (typeObject.iType != SHORT_TYPE) {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (typeObject.iType != SHORT_TYPE)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
"Given argument is not a short type.");
}
- return ((Short)typeObject.aValue).shortValue();
+ return ((Short) typeObject.aValue).shortValue();
}
-
/**
* get the simple int type
* @param typeObject
@@ -1181,12 +1293,14 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException
*/
static int getInt(TypeObject typeObject)
- throws com.sun.star.lang.IllegalArgumentException {
- if (typeObject.iType != INT_TYPE) {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (typeObject.iType != INT_TYPE)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
"Given argument is not an int type.");
}
- return ((Integer)typeObject.aValue).intValue();
+ return ((Integer) typeObject.aValue).intValue();
}
/**
@@ -1194,54 +1308,64 @@ public class NumericalHelper {
* @throws com.sun.star.lang.IllegalArgumentException
*/
static float getFloat(TypeObject typeObject)
- throws com.sun.star.lang.IllegalArgumentException {
- if (typeObject.iType != FLOAT_TYPE) {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (typeObject.iType != FLOAT_TYPE)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
"Given argument is not a float type.");
}
- return ((Float)typeObject.aValue).floatValue();
+ return ((Float) typeObject.aValue).floatValue();
}
/**
* get the simple double type
*/
private static double getDouble(TypeObject typeObject)
- throws com.sun.star.lang.IllegalArgumentException {
- if (typeObject.iType != DOUBLE_TYPE) {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (typeObject.iType != DOUBLE_TYPE)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
"Given argument is not a double type.");
}
- return ((Double)typeObject.aValue).doubleValue();
+ return ((Double) typeObject.aValue).doubleValue();
}
/**
* get the simple long type
*/
private static long getLong(TypeObject typeObject)
- throws com.sun.star.lang.IllegalArgumentException {
- if (typeObject.iType != LONG_TYPE) {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (typeObject.iType != LONG_TYPE)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
"Given argument is not a long type.");
}
- return ((Long)typeObject.aValue).longValue();
+ return ((Long) typeObject.aValue).longValue();
}
/**
* get the simple boolean type
*/
private static boolean getBool(TypeObject typeObject)
- throws com.sun.star.lang.IllegalArgumentException {
- if (typeObject.iType != BOOLEAN_TYPE) {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ if (typeObject.iType != BOOLEAN_TYPE)
+ {
throw new com.sun.star.lang.IllegalArgumentException(
"Given argument is not a boolean type.");
}
- return ((Boolean)typeObject.aValue).booleanValue();
+ return ((Boolean) typeObject.aValue).booleanValue();
}
/**
* a class to contain a type and a value for easier conversions
*/
- private static class TypeObject {
+ private static class TypeObject
+ {
+
public int iType;
public Object aValue;
}
@@ -1249,99 +1373,125 @@ public class NumericalHelper {
/**
* simple class to construct a hexadecimal value from a long number
*/
- private static class TransformNumToHex {
+ private static class TransformNumToHex
+ {
+
private StringBuffer val;
- public TransformNumToHex(long number) {
+ public TransformNumToHex(long number)
+ {
val = new StringBuffer();
transform(number);
}
- private void transform(long number) {
- int index = (int)(number % HEX_BASE);
+ private void transform(long number)
+ {
+ int index = (int) (number % HEX_BASE);
number = number / HEX_BASE;
- if (index < DEC_BASE) {
- val.insert(0,index);
+ if (index < DEC_BASE)
+ {
+ val.insert(0, index);
}
- else {
- val.insert(0,(char)(ASCII_LETTER_A_OFFSET + index));
+ else
+ {
+ val.insert(0, (char) (ASCII_LETTER_A_OFFSET + index));
}
- if (number >0) {
+ if (number > 0)
+ {
transform(number);
}
}
- public String getResult() {
+ public String getResult()
+ {
return val.toString();
}
}
private static TypeObject convertSequenceToObjectArray(
TypeObject sourceObject)
- throws com.sun.star.lang.IllegalArgumentException {
+ throws com.sun.star.lang.IllegalArgumentException
+ {
TypeObject destObject = new TypeObject();
Object array = sourceObject.aValue;
destObject.iType = ARRAY_TYPE;
Class c = array.getClass();
Object[] aShortVal = null;
- if (c.equals(byte[].class)) {
- byte[] vals = (byte[])array;
+ if (c.equals(byte[].class))
+ {
+ byte[] vals = (byte[]) array;
aShortVal = new Object[vals.length];
- for (int i=0; i<vals.length; i++) {
+ for (int i = 0; i < vals.length; i++)
+ {
aShortVal[i] = new Byte(vals[i]);
}
}
- else if (c.equals(short[].class)) {
- short[] vals = (short[])array;
+ else if (c.equals(short[].class))
+ {
+ short[] vals = (short[]) array;
aShortVal = new Object[vals.length];
- for (int i=0; i<vals.length; i++) {
+ for (int i = 0; i < vals.length; i++)
+ {
aShortVal[i] = new Short(vals[i]);
}
}
- else if (c.equals(int[].class)) {
- int[] vals = (int[])array;
+ else if (c.equals(int[].class))
+ {
+ int[] vals = (int[]) array;
aShortVal = new Object[vals.length];
- for (int i=0; i<vals.length; i++) {
+ for (int i = 0; i < vals.length; i++)
+ {
aShortVal[i] = new Integer(vals[i]);
}
}
- else if (c.equals(long[].class)) {
- long[] vals = (long[])array;
+ else if (c.equals(long[].class))
+ {
+ long[] vals = (long[]) array;
aShortVal = new Object[vals.length];
- for (int i=0; i<vals.length; i++) {
+ for (int i = 0; i < vals.length; i++)
+ {
aShortVal[i] = new Long(vals[i]);
}
}
- else if (c.equals(float[].class)) {
- float[] vals = (float[])array;
+ else if (c.equals(float[].class))
+ {
+ float[] vals = (float[]) array;
aShortVal = new Object[vals.length];
- for (int i=0; i<vals.length; i++) {
+ for (int i = 0; i < vals.length; i++)
+ {
aShortVal[i] = new Float(vals[i]);
}
}
- else if (c.equals(double[].class)) {
- double[] vals = (double[])array;
+ else if (c.equals(double[].class))
+ {
+ double[] vals = (double[]) array;
aShortVal = new Object[vals.length];
- for (int i=0; i<vals.length; i++) {
+ for (int i = 0; i < vals.length; i++)
+ {
aShortVal[i] = new Double(vals[i]);
}
}
- else if (c.equals(boolean[].class)) {
- boolean[] vals = (boolean[])array;
+ else if (c.equals(boolean[].class))
+ {
+ boolean[] vals = (boolean[]) array;
aShortVal = new Object[vals.length];
- for (int i=0; i<vals.length; i++) {
+ for (int i = 0; i < vals.length; i++)
+ {
aShortVal[i] = Boolean.valueOf(vals[i]);
}
}
// if nothing did match, try this
- if (aShortVal == null) {
- try {
- aShortVal = (Object[])array;
+ if (aShortVal == null)
+ {
+ try
+ {
+ aShortVal = (Object[]) array;
}
- catch(java.lang.ClassCastException e) {
+ catch (java.lang.ClassCastException e)
+ {
// unknown type cannot be converted
throw new com.sun.star.lang.IllegalArgumentException(
- "Cannot convert unknown type: '" + e.getMessage() + "'");
+ "Cannot convert unknown type: '" + e.getMessage() + "'");
}
}
destObject.aValue = aShortVal;
@@ -1368,18 +1518,17 @@ public class NumericalHelper {
// DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, "");
// return false;
// }}
-
-
/**
* Helper class for roman numbering
*/
- private static class RomanNumbering {
+ private static class RomanNumbering
+ {
/** the used roman lettesrs **/
- private static final String [] ROMAN_EQUIV = new String[]{
+ private static final String[] ROMAN_EQUIV = new String[]
+ {
"I", "V", "X", "L", "C", "D", "M"
};
-
/** max number that can be converted **/
private static final int MAX_NUMBER = 3999;
/** min number that can be converted **/
@@ -1393,7 +1542,6 @@ public class NumericalHelper {
/** special number for the conversion algorithm **/
private static final int NINE = 9;
-
/**
* Get the roman equivalent to an arabic number, e.g. 17 -> XVII.
* The allowed range for numbers goes from 1 to 3999. These can be
@@ -1403,11 +1551,14 @@ public class NumericalHelper {
* @throws BasicErrorException if the number cannot be converted.
*/
public static String getRomanEquivalent(int n)
- throws Exception {
+ throws Exception
+ {
StringBuffer romanNumber = new StringBuffer();
- try {
- if (n > MAX_NUMBER || n < MIN_NUMBER) {
- DebugHelper.exception(1 /*BasicErrorCode.SbERR_OUT_OF_RANGE*/ , "");
+ try
+ {
+ if (n > MAX_NUMBER || n < MIN_NUMBER)
+ {
+ DebugHelper.exception(1 /*BasicErrorCode.SbERR_OUT_OF_RANGE*/, "");
}
String number = NumericalHelper.toString(new Integer(n));
/* converison idea: every digit is written with a maximum of two
@@ -1417,23 +1568,29 @@ public class NumericalHelper {
* special cases 4 and 9.
*/
int symbolIndex = 0;
- for(int i = number.length() - 1; i >= 0; i--){
+ for (int i = number.length() - 1; i >= 0; i--)
+ {
StringBuffer romanDigit = new StringBuffer();
- int b = (int)number.charAt(i) - ASCII_CODE_0;
- if (b == FOUR) { // special case IV
+ int b = (int) number.charAt(i) - ASCII_CODE_0;
+ if (b == FOUR)
+ { // special case IV
romanDigit.append(ROMAN_EQUIV[symbolIndex]);
romanDigit.append(ROMAN_EQUIV[symbolIndex + 1]);
}
- else if (b == NINE) { // special case IX
+ else if (b == NINE)
+ { // special case IX
romanDigit.append(ROMAN_EQUIV[symbolIndex]);
romanDigit.append(ROMAN_EQUIV[symbolIndex + 2]);
}
- else {
- if (b >= FIVE) { // special case V
+ else
+ {
+ if (b >= FIVE)
+ { // special case V
romanDigit.append(ROMAN_EQUIV[symbolIndex + 1]);
b = b - FIVE;
}
- for (int j = 0; j < b; j++) { // append I's
+ for (int j = 0; j < b; j++)
+ { // append I's
romanDigit.append(ROMAN_EQUIV[symbolIndex]);
}
}
@@ -1443,7 +1600,8 @@ public class NumericalHelper {
romanNumber.append(romanDigit.reverse());
}
}
- catch(com.sun.star.lang.IllegalArgumentException e) {
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
DebugHelper.exception(e);
}
// reverse again to get the number
@@ -1451,22 +1609,21 @@ public class NumericalHelper {
}
}
-
- public static boolean representsIntegerNumber(double _dblvalue){
+ public static boolean representsIntegerNumber(double _dblvalue)
+ {
double dblsecvalue = (double) ((int) _dblvalue);
return Double.compare(_dblvalue, dblsecvalue) == 0;
}
-
- public static double roundDouble(Double _Dblvalue, int _ndecimals){
+ public static double roundDouble(Double _Dblvalue, int _ndecimals)
+ {
return roundDouble(_Dblvalue.doubleValue(), _ndecimals);
}
-
- public static double roundDouble(double _dblvalue, int _ndecimals){
+ public static double roundDouble(double _dblvalue, int _ndecimals)
+ {
double dblfactor = java.lang.Math.pow(10.0, (double) _ndecimals);
- double dblretvalue = ((double) ((int) (_dblvalue * dblfactor)))/dblfactor;
+ double dblretvalue = ((double) ((int) (_dblvalue * dblfactor))) / dblfactor;
return dblretvalue;
}
-
}
diff --git a/wizards/com/sun/star/wizards/common/Properties.java b/wizards/com/sun/star/wizards/common/Properties.java
index 297ae78baa20..a14c05c89de9 100644
--- a/wizards/com/sun/star/wizards/common/Properties.java
+++ b/wizards/com/sun/star/wizards/common/Properties.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Properties.java,v $
+ *
+ * $Revision: 1.4.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Properties.java
*
* Created on 1. Oktober 2003, 17:16
@@ -16,63 +47,80 @@ import java.util.*;
* When finished, call the getProperties() method to get an array of the set properties.
* @author rp
*/
-public class Properties extends Hashtable {
+public class Properties extends Hashtable
+{
- public static Object getPropertyValue(PropertyValue[] props, String propName) {
- for (int i = 0; i<props.length; i++)
+ public static Object getPropertyValue(PropertyValue[] props, String propName)
+ {
+ for (int i = 0; i < props.length; i++)
+ {
if (propName.equals(props[i].Name))
+ {
return props[i].Value;
+ }
+ }
throw new IllegalArgumentException("Property '" + propName + "' not found.");
}
-
- public static boolean hasPropertyValue(PropertyValue[] props, String propName){
- for (int i = 0; i<props.length; i++){
+ public static boolean hasPropertyValue(PropertyValue[] props, String propName)
+ {
+ for (int i = 0; i < props.length; i++)
+ {
if (propName.equals(props[i].Name))
+ {
return true;
+ }
}
return false;
}
-
- public PropertyValue[] getProperties() {
+ public PropertyValue[] getProperties()
+ {
return getProperties(this);
}
- public static PropertyValue[] getProperties(Map map) {
+ public static PropertyValue[] getProperties(Map map)
+ {
PropertyValue[] pv = new PropertyValue[map.size()];
Iterator it = map.keySet().iterator();
for (int i = 0; i < pv.length; i++)
+ {
pv[i] = createProperty((String) it.next(), map);
-
+ }
return pv;
}
- public static PropertyValue createProperty(String name, Map map) {
+ public static PropertyValue createProperty(String name, Map map)
+ {
return createProperty(name, map.get(name));
}
- public static PropertyValue createProperty(String name, Object value) {
+ public static PropertyValue createProperty(String name, Object value)
+ {
PropertyValue pv = new PropertyValue();
pv.Name = name;
pv.Value = value;
return pv;
}
- public static PropertyValue createProperty(String name, Object value, int handle) {
+ public static PropertyValue createProperty(String name, Object value, int handle)
+ {
PropertyValue pv = createProperty(name, value);
pv.Handle = handle;
return pv;
}
-
- public static PropertyValue[] convertToPropertyValueArray(Object[] _oObjectArray){
+ public static PropertyValue[] convertToPropertyValueArray(Object[] _oObjectArray)
+ {
PropertyValue[] retproperties = null;
- if (_oObjectArray != null){
- if (_oObjectArray.length > 0){
+ if (_oObjectArray != null)
+ {
+ if (_oObjectArray.length > 0)
+ {
retproperties = new PropertyValue[_oObjectArray.length];
- for (int i = 0; i < _oObjectArray.length; i++){
+ for (int i = 0; i < _oObjectArray.length; i++)
+ {
retproperties[i] = (PropertyValue) _oObjectArray[i];
}
}
diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java
index 3b520b81f420..546a57644096 100644
--- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java
+++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java
@@ -9,7 +9,7 @@
*
* $RCSfile: PropertySetHelper.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.common;
import com.sun.star.beans.Property;
@@ -44,17 +43,19 @@ import java.util.HashMap;
public class PropertySetHelper
{
+
protected XPropertySet m_xPropertySet;
private HashMap m_aHashMap;
public PropertySetHelper(Object _aObj)
+ {
+ if (_aObj == null)
{
- if (_aObj == null)
- {
- return;
- }
- m_xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, _aObj);
+ return;
}
+ m_xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aObj);
+ }
+
private HashMap getHashMap()
{
if (m_aHashMap == null)
@@ -63,337 +64,337 @@ public class PropertySetHelper
}
return m_aHashMap;
}
+
/**
- set a property, don't throw any exceptions, they will only write down as a hint in the helper debug output
- @param _sName name of the property to set
- @param _aValue property value as object
+ set a property, don't throw any exceptions, they will only write down as a hint in the helper debug output
+ @param _sName name of the property to set
+ @param _aValue property value as object
*/
public void setPropertyValueDontThrow(String _sName, Object _aValue)
+ {
+ try
{
- try
- {
- setPropertyValue(_sName, _aValue);
- }
- catch(Exception e)
- {
- DebugHelper.writeInfo("Don't throw the exception with property name(" + _sName + " ) : " + e.getMessage());
- }
+ setPropertyValue(_sName, _aValue);
}
+ catch (Exception e)
+ {
+ DebugHelper.writeInfo("Don't throw the exception with property name(" + _sName + " ) : " + e.getMessage());
+ }
+ }
/**
- set a property,
- @param _sName name of the property to set
- @param _aValue property value as object
+ set a property,
+ @param _sName name of the property to set
+ @param _aValue property value as object
* @throws java.lang.Exception
*/
public void setPropertyValue(String _sName, Object _aValue) throws java.lang.Exception
+ {
+ if (m_xPropertySet != null)
{
- if (m_xPropertySet != null)
- {
- try
- {
- m_xPropertySet.setPropertyValue(_sName, _aValue);
- }
- // Exceptions are not from interest
- catch (com.sun.star.beans.UnknownPropertyException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- DebugHelper.exception(e);
- }
- catch (com.sun.star.beans.PropertyVetoException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- DebugHelper.exception(e);
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- DebugHelper.exception(e);
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- DebugHelper.exception(e);
- }
- }
- else
- {
- // DebugHelper.writeInfo("PropertySetHelper.setProperty() can't get XPropertySet");
- getHashMap().put(_sName, _aValue);
+ try
+ {
+ m_xPropertySet.setPropertyValue(_sName, _aValue);
+ }
+ // Exceptions are not from interest
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ DebugHelper.exception(e);
+ }
+ catch (com.sun.star.beans.PropertyVetoException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ DebugHelper.exception(e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ DebugHelper.exception(e);
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ DebugHelper.exception(e);
}
}
+ else
+ {
+ // DebugHelper.writeInfo("PropertySetHelper.setProperty() can't get XPropertySet");
+ getHashMap().put(_sName, _aValue);
+ }
+ }
/**
- get a property and convert it to a int value
- @param _sName the string name of the property
- @param _nDefault if an error occur, return this value
- @return the int value of the property
+ get a property and convert it to a int value
+ @param _sName the string name of the property
+ @param _nDefault if an error occur, return this value
+ @return the int value of the property
*/
public int getPropertyValueAsInteger(String _sName, int _nDefault)
- {
- Object aObject = null;
- int nValue = _nDefault;
+ {
+ Object aObject = null;
+ int nValue = _nDefault;
- if (m_xPropertySet != null)
- {
- try
- {
- aObject = m_xPropertySet.getPropertyValue(_sName);
- }
- catch (com.sun.star.beans.UnknownPropertyException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- }
- if (aObject != null)
- {
- try
- {
- nValue = NumericalHelper.toInt(aObject);
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- DebugHelper.writeInfo("can't convert a object to integer.");
- }
- }
- return nValue;
+ if (m_xPropertySet != null)
+ {
+ try
+ {
+ aObject = m_xPropertySet.getPropertyValue(_sName);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ }
+ if (aObject != null)
+ {
+ try
+ {
+ nValue = NumericalHelper.toInt(aObject);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ DebugHelper.writeInfo("can't convert a object to integer.");
+ }
}
+ return nValue;
+ }
/**
- get a property and convert it to a short value
- @param _sName the string name of the property
- @param _nDefault if an error occur, return this value
- @return the int value of the property
+ get a property and convert it to a short value
+ @param _sName the string name of the property
+ @param _nDefault if an error occur, return this value
+ @return the int value of the property
*/
public short getPropertyValueAsShort(String _sName, short _nDefault)
- {
- Object aObject = null;
- short nValue = _nDefault;
+ {
+ Object aObject = null;
+ short nValue = _nDefault;
- if (m_xPropertySet != null)
- {
- try
- {
- aObject = m_xPropertySet.getPropertyValue(_sName);
- }
- catch (com.sun.star.beans.UnknownPropertyException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- }
- if (aObject != null)
- {
- try
- {
- nValue = NumericalHelper.toShort(aObject);
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- DebugHelper.writeInfo("can't convert a object to short.");
- }
- }
- return nValue;
+ if (m_xPropertySet != null)
+ {
+ try
+ {
+ aObject = m_xPropertySet.getPropertyValue(_sName);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ }
+ if (aObject != null)
+ {
+ try
+ {
+ nValue = NumericalHelper.toShort(aObject);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ DebugHelper.writeInfo("can't convert a object to short.");
+ }
}
+ return nValue;
+ }
/**
- get a property and convert it to a double value
- @param _sName the string name of the property
- @param _nDefault if an error occur, return this value
- @return the int value of the property
+ get a property and convert it to a double value
+ @param _sName the string name of the property
+ @param _nDefault if an error occur, return this value
+ @return the int value of the property
*/
public double getPropertyValueAsDouble(String _sName, double _nDefault)
- {
- Object aObject = null;
- double nValue = _nDefault;
+ {
+ Object aObject = null;
+ double nValue = _nDefault;
- if (m_xPropertySet != null)
- {
- try
- {
- aObject = m_xPropertySet.getPropertyValue(_sName);
- }
- catch (com.sun.star.beans.UnknownPropertyException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- }
- if (aObject == null)
- {
- if (getHashMap().containsKey(_sName))
- {
- aObject = getHashMap().get(_sName);
- }
- }
- if (aObject != null)
- {
- try
- {
- nValue = NumericalHelper.toDouble(aObject);
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- DebugHelper.writeInfo("can't convert a object to integer.");
- }
- }
- return nValue;
+ if (m_xPropertySet != null)
+ {
+ try
+ {
+ aObject = m_xPropertySet.getPropertyValue(_sName);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ }
+ if (aObject == null)
+ {
+ if (getHashMap().containsKey(_sName))
+ {
+ aObject = getHashMap().get(_sName);
+ }
}
+ if (aObject != null)
+ {
+ try
+ {
+ nValue = NumericalHelper.toDouble(aObject);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ DebugHelper.writeInfo("can't convert a object to integer.");
+ }
+ }
+ return nValue;
+ }
/**
- get a property and convert it to a boolean value
- @param _sName the string name of the property
- @param _bDefault if an error occur, return this value
- @return the boolean value of the property
+ get a property and convert it to a boolean value
+ @param _sName the string name of the property
+ @param _bDefault if an error occur, return this value
+ @return the boolean value of the property
*/
public boolean getPropertyValueAsBoolean(String _sName, boolean _bDefault)
- {
- Object aObject = null;
- boolean bValue = _bDefault;
+ {
+ Object aObject = null;
+ boolean bValue = _bDefault;
- if (m_xPropertySet != null)
- {
- try
- {
- aObject = m_xPropertySet.getPropertyValue(_sName);
- }
- catch (com.sun.star.beans.UnknownPropertyException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- DebugHelper.writeInfo("UnknownPropertyException caught: Name:=" + _sName);
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- }
- if (aObject != null)
- {
- try
- {
- bValue = NumericalHelper.toBoolean(aObject);
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- DebugHelper.writeInfo("can't convert a object to boolean.");
- }
- }
- return bValue;
+ if (m_xPropertySet != null)
+ {
+ try
+ {
+ aObject = m_xPropertySet.getPropertyValue(_sName);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ DebugHelper.writeInfo("UnknownPropertyException caught: Name:=" + _sName);
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
}
+ if (aObject != null)
+ {
+ try
+ {
+ bValue = NumericalHelper.toBoolean(aObject);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ DebugHelper.writeInfo("can't convert a object to boolean.");
+ }
+ }
+ return bValue;
+ }
/**
- get a property and convert it to a string value
- @param _sName the string name of the property
- @param _sDefault if an error occur, return this value
- @return the string value of the property
+ get a property and convert it to a string value
+ @param _sName the string name of the property
+ @param _sDefault if an error occur, return this value
+ @return the string value of the property
*/
public String getPropertyValueAsString(String _sName, String _sDefault)
- {
- Object aObject = null;
- String sValue = _sDefault;
+ {
+ Object aObject = null;
+ String sValue = _sDefault;
- if (m_xPropertySet != null)
- {
- try
- {
- aObject = m_xPropertySet.getPropertyValue(_sName);
- }
- catch (com.sun.star.beans.UnknownPropertyException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- }
- if (aObject != null)
- {
- try
- {
- sValue = AnyConverter.toString(aObject);
- }
- catch (com.sun.star.lang.IllegalArgumentException e)
- {
- DebugHelper.writeInfo("can't convert a object to string.");
- }
- }
- return sValue;
+ if (m_xPropertySet != null)
+ {
+ try
+ {
+ aObject = m_xPropertySet.getPropertyValue(_sName);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
}
+ if (aObject != null)
+ {
+ try
+ {
+ sValue = AnyConverter.toString(aObject);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ DebugHelper.writeInfo("can't convert a object to string.");
+ }
+ }
+ return sValue;
+ }
/**
- get a property and don't convert it
- @param _sName the string name of the property
- @return the object value of the property without any conversion
+ get a property and don't convert it
+ @param _sName the string name of the property
+ @return the object value of the property without any conversion
*/
public Object getPropertyValueAsObject(String _sName)
- {
- Object aObject = null;
+ {
+ Object aObject = null;
- if (m_xPropertySet != null)
- {
- try
- {
- aObject = m_xPropertySet.getPropertyValue(_sName);
- }
- catch (com.sun.star.beans.UnknownPropertyException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- catch (com.sun.star.lang.WrappedTargetException e)
- {
- DebugHelper.writeInfo(e.getMessage());
- }
- }
- return aObject;
+ if (m_xPropertySet != null)
+ {
+ try
+ {
+ aObject = m_xPropertySet.getPropertyValue(_sName);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ DebugHelper.writeInfo(e.getMessage());
+ }
}
+ return aObject;
+ }
/**
* Debug helper, to show all properties which are available in the given object.
* @param _xObj the object of which the properties should shown
*/
public static void showProperties(Object _xObj)
- {
- PropertySetHelper aHelper = new PropertySetHelper(_xObj);
- aHelper.showProperties();
- }
+ {
+ PropertySetHelper aHelper = new PropertySetHelper(_xObj);
+ aHelper.showProperties();
+ }
/**
- Debug helper, to show all properties which are available in the current object.
- */
+ Debug helper, to show all properties which are available in the current object.
+ */
public void showProperties()
- {
- String sName = "";
+ {
+ String sName = "";
- if (m_xPropertySet != null)
- {
- XServiceInfo xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, m_xPropertySet);
+ if (m_xPropertySet != null)
+ {
+ XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, m_xPropertySet);
if (xServiceInfo != null)
{
sName = xServiceInfo.getImplementationName();
}
- XPropertySetInfo xInfo = m_xPropertySet.getPropertySetInfo();
- Property[] aAllProperties = xInfo.getProperties();
- DebugHelper.writeInfo("Show all properties of Implementation of :'" + sName + "'");
- for (int i = 0; i<aAllProperties.length; i++)
- {
- DebugHelper.writeInfo(" - " + aAllProperties[i].Name);
- }
- }
- else
+ XPropertySetInfo xInfo = m_xPropertySet.getPropertySetInfo();
+ Property[] aAllProperties = xInfo.getProperties();
+ DebugHelper.writeInfo("Show all properties of Implementation of :'" + sName + "'");
+ for (int i = 0; i < aAllProperties.length; i++)
{
- DebugHelper.writeInfo("The given object don't support XPropertySet interface.");
+ DebugHelper.writeInfo(" - " + aAllProperties[i].Name);
}
}
-
+ else
+ {
+ DebugHelper.writeInfo("The given object don't support XPropertySet interface.");
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/common/Renderer.java b/wizards/com/sun/star/wizards/common/Renderer.java
index 8da8ef0a197f..08334351326b 100644
--- a/wizards/com/sun/star/wizards/common/Renderer.java
+++ b/wizards/com/sun/star/wizards/common/Renderer.java
@@ -35,6 +35,8 @@ package com.sun.star.wizards.common;
* Can be used to reference resources, internationalizartion
* a.s.o
*/
-public interface Renderer {
+public interface Renderer
+{
+
public String render(Object object);
}
diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java
index 33cc364ee9c1..49a84c98bc37 100644
--- a/wizards/com/sun/star/wizards/common/Resource.java
+++ b/wizards/com/sun/star/wizards/common/Resource.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,92 +26,117 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.common;
+ ************************************************************************/
+
+package com.sun.star.wizards.common;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.script.XInvocation;
import com.sun.star.beans.PropertyValue;
-public class Resource {
+public class Resource
+{
+
XInvocation xInvocation;
XMultiServiceFactory xMSF;
String Unit;
String Module;
/** Creates a new instance of Resource */
- public Resource(XMultiServiceFactory _xMSF, String _Unit, String _Module) {
+ public Resource(XMultiServiceFactory _xMSF, String _Unit, String _Module)
+ {
this.xMSF = _xMSF;
this.Unit = _Unit;
this.Module = _Module;
this.xInvocation = initResources();
}
- public String getResText(int nID) {
- try {
+ public String getResText(int nID)
+ {
+ try
+ {
short[][] PointerArray = new short[1][];
Object[][] DummyArray = new Object[1][];
Object[] nIDArray = new Object[1];
nIDArray[0] = new Integer(nID);
String IDString = (String) xInvocation.invoke("getString", nIDArray, PointerArray, DummyArray);
return IDString;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace();
throw new java.lang.IllegalArgumentException("Resource with ID not" + String.valueOf(nID) + "not found");
}
}
- public PropertyValue[] getStringList(int nID) {
- try {
+ public PropertyValue[] getStringList(int nID)
+ {
+ try
+ {
short[][] PointerArray = new short[1][];
Object[][] DummyArray = new Object[1][];
Object[] nIDArray = new Object[1];
nIDArray[0] = new Integer(nID);
//Object bla = xInvocation.invoke("getStringList", nIDArray, PointerArray, DummyArray);
- PropertyValue [] ResProp = (PropertyValue []) xInvocation.invoke("getStringList", nIDArray, PointerArray, DummyArray);
+ PropertyValue[] ResProp = (PropertyValue[]) xInvocation.invoke("getStringList", nIDArray, PointerArray, DummyArray);
return ResProp;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace();
throw new java.lang.IllegalArgumentException("Resource with ID not" + String.valueOf(nID) + "not found");
}
}
- public String[] getResArray(int nID, int iCount) {
- try {
+ public String[] getResArray(int nID, int iCount)
+ {
+ try
+ {
String[] ResArray = new String[iCount];
- for (int i = 0; i < iCount; i++) {
+ for (int i = 0; i < iCount; i++)
+ {
ResArray[i] = getResText(nID + i);
}
return ResArray;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
throw new java.lang.IllegalArgumentException("Resource with ID not" + String.valueOf(nID) + "not found");
}
}
- public XInvocation initResources() {
- try {
+ public XInvocation initResources()
+ {
+ try
+ {
com.sun.star.uno.XInterface xResource = (com.sun.star.uno.XInterface) xMSF.createInstance("com.sun.star.resource.VclStringResourceLoader");
- if (xResource == null) {
+ if (xResource == null)
+ {
showCommonResourceError(xMSF);
throw new IllegalArgumentException();
- } else {
+ }
+ else
+ {
XInvocation xResInvoke = (XInvocation) com.sun.star.uno.UnoRuntime.queryInterface(XInvocation.class, xResource);
xResInvoke.setValue("FileName", Module);
return xResInvoke;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
showCommonResourceError(xMSF);
return null;
}
}
- public static void showCommonResourceError(XMultiServiceFactory xMSF) {
+ public static void showCommonResourceError(XMultiServiceFactory xMSF)
+ {
String ProductName = Configuration.getProductName(xMSF);
String sError = "The files required could not be found.\nPlease start the %PRODUCTNAME Setup and choose 'Repair'.";
sError = JavaTools.replaceSubString(sError, ProductName, "%PRODUCTNAME");
SystemDialog.showMessageBox(xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, sError);
}
-
}
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java
index 2270fd763d9d..5416f8e8fbd0 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.java
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.java
@@ -43,7 +43,9 @@ import com.sun.star.awt.XToolkit;
import com.sun.star.awt.XMessageBox;
import com.sun.star.beans.PropertyValue;
-public class SystemDialog {
+public class SystemDialog
+{
+
Object systemDialog;
XFilePicker xFilePicker;
XFolderPicker xFolderPicker;
@@ -54,7 +56,6 @@ public class SystemDialog {
XFilePickerControlAccess xFilePickerControlAccess;
XMultiServiceFactory xMSF;
public XStringSubstitution xStringSubstitution;
-
public String sStorePath;
/**
@@ -63,8 +64,10 @@ public class SystemDialog {
* @param ServiceName
* @param type according to com.sun.star.ui.dialogs.TemplateDescription
*/
- public SystemDialog(XMultiServiceFactory xMSF, String ServiceName, short type) {
- try {
+ public SystemDialog(XMultiServiceFactory xMSF, String ServiceName, short type)
+ {
+ try
+ {
this.xMSF = xMSF;
systemDialog = (XInterface) xMSF.createInstance(ServiceName);
xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, systemDialog);
@@ -75,43 +78,54 @@ public class SystemDialog {
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, systemDialog);
xFilePickerControlAccess = (XFilePickerControlAccess) UnoRuntime.queryInterface(XFilePickerControlAccess.class, systemDialog);
xStringSubstitution = createStringSubstitution(xMSF);
- Short[] listAny = new Short[] { new Short(type)};
+ Short[] listAny = new Short[]
+ {
+ new Short(type)
+ };
if (xInitialize != null)
+ {
xInitialize.initialize(listAny);
-
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace();
}
}
- public static SystemDialog createStoreDialog(XMultiServiceFactory xmsf) {
+ public static SystemDialog createStoreDialog(XMultiServiceFactory xmsf)
+ {
return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILESAVE_AUTOEXTENSION);
}
- public static SystemDialog createOpenDialog(XMultiServiceFactory xmsf) {
+ public static SystemDialog createOpenDialog(XMultiServiceFactory xmsf)
+ {
return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILEOPEN_SIMPLE);
}
- public static SystemDialog createFolderDialog(XMultiServiceFactory xmsf) {
+ public static SystemDialog createFolderDialog(XMultiServiceFactory xmsf)
+ {
return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FolderPicker", (short) 0);
}
- public static SystemDialog createOfficeFolderDialog(XMultiServiceFactory xmsf) {
+ public static SystemDialog createOfficeFolderDialog(XMultiServiceFactory xmsf)
+ {
return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.OfficeFolderPicker", (short) 0);
}
-
-
- private String subst(String path) {
- try {
+ private String subst(String path)
+ {
+ try
+ {
//System.out.println("SystemDialog.subst:");
//System.out.println(path);
- String s = xStringSubstitution.substituteVariables(path,false);
+ String s = xStringSubstitution.substituteVariables(path, false);
//System.out.println(s);
return s;
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
return path;
}
@@ -127,13 +141,13 @@ public class SystemDialog {
* @param sDocuType
* @return
*/
- public String callStoreDialog(String DisplayDirectory, String DefaultName, String sDocuType) {
+ public String callStoreDialog(String DisplayDirectory, String DefaultName, String sDocuType)
+ {
String sExtension = DefaultName.substring(DefaultName.length() - 3, DefaultName.length());
addFilterToDialog(sExtension, sDocuType, true);
return callStoreDialog(DisplayDirectory, DefaultName);
}
-
/**
*
* @param displayDir
@@ -142,89 +156,122 @@ public class SystemDialog {
* given url to a local path.
* @return
*/
- public String callStoreDialog(String displayDir, String defaultName) {
+ public String callStoreDialog(String displayDir, String defaultName)
+ {
sStorePath = null;
- try {
+ try
+ {
xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, new Boolean(true));
xFilePicker.setDefaultName(defaultName);
xFilePicker.setDisplayDirectory(subst(displayDir));
- if (execute(xExecutable)) {
+ if (execute(xExecutable))
+ {
String[] sPathList = xFilePicker.getFiles();
sStorePath = sPathList[0];
}
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace();
}
return sStorePath;
}
- public String callFolderDialog(String title, String description, String displayDir) {
- try {
+ public String callFolderDialog(String title, String description, String displayDir)
+ {
+ try
+ {
xFolderPicker.setDisplayDirectory(subst(displayDir));
- } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ }
+ catch (com.sun.star.lang.IllegalArgumentException iae)
+ {
iae.printStackTrace();
throw new IllegalArgumentException(iae.getMessage());
}
xFolderPicker.setTitle(title);
xFolderPicker.setDescription(description);
if (execute(xFolderPicker))
+ {
return xFolderPicker.getDirectory();
+ }
else
+ {
return null;
+ }
}
- private boolean execute(XExecutableDialog execDialog) {
+ private boolean execute(XExecutableDialog execDialog)
+ {
return execDialog.execute() == 1;
}
- public String[] callOpenDialog(boolean multiSelect, String displayDirectory) {
+ public String[] callOpenDialog(boolean multiSelect, String displayDirectory)
+ {
- try {
+ try
+ {
xFilePicker.setMultiSelectionMode(multiSelect);
xFilePicker.setDisplayDirectory(subst(displayDirectory));
if (execute(xExecutable))
+ {
return xFilePicker.getFiles();
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace();
}
return null;
}
//("writer_StarOffice_XML_Writer_Template") 'StarOffice XML (Writer)
- public void addFilterToDialog(String sExtension, String filterName, boolean setToDefault) {
- try {
+ public void addFilterToDialog(String sExtension, String filterName, boolean setToDefault)
+ {
+ try
+ {
//get the localized filtername
String uiName = getFilterUIName(filterName);
String pattern = "*." + sExtension;
//add the filter
addFilter(uiName, pattern, setToDefault);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void addFilter(String uiName, String pattern, boolean setToDefault) {
- try {
+ public void addFilter(String uiName, String pattern, boolean setToDefault)
+ {
+ try
+ {
xFilterManager.appendFilter(uiName, pattern);
if (setToDefault)
+ {
xFilterManager.setCurrentFilter(uiName);
- } catch (Exception ex) {
+ }
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
-
-
/**
* converts the name returned from getFilterUIName_(...) so the
* product name is correct.
* @param filterName
* @return
*/
- private String getFilterUIName(String filterName) {
+ private String getFilterUIName(String filterName)
+ {
String prodName = Configuration.getProductName(xMSF);
- String[][] s = new String[][] { { getFilterUIName_(filterName)}
+ String[][] s = new String[][]
+ {
+ {
+ getFilterUIName_(filterName)
+ }
};
s[0][0] = JavaTools.replaceSubString(s[0][0], prodName, "%productname%");
return s[0][0];
@@ -235,26 +282,34 @@ public class SystemDialog {
* @param filterName
* @return the UI localized name of the given filter name.
*/
- private String getFilterUIName_(String filterName) {
- try {
+ private String getFilterUIName_(String filterName)
+ {
+ try
+ {
Object oFactory = xMSF.createInstance("com.sun.star.document.FilterFactory");
Object oObject = Helper.getUnoObjectbyName(oFactory, filterName);
Object oArrayObject = AnyConverter.toArray(oObject);
PropertyValue[] xPropertyValue = (PropertyValue[]) oArrayObject; //UnoRuntime.queryInterface(XPropertyValue.class, oObject);
int MaxCount = xPropertyValue.length;
- for (int i = 0; i < MaxCount; i++) {
+ for (int i = 0; i < MaxCount; i++)
+ {
PropertyValue aValue = (PropertyValue) xPropertyValue[i];
if (aValue != null && aValue.Name.equals("UIName"))
+ {
return AnyConverter.toString(aValue.Value);
+ }
}
throw new NullPointerException("UIName property not found for Filter " + filterName);
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public static int showErrorBox(XMultiServiceFactory xMSF, String ResName, String ResPrefix, int ResID, String AddTag, String AddString) {
+ public static int showErrorBox(XMultiServiceFactory xMSF, String ResName, String ResPrefix, int ResID, String AddTag, String AddString)
+ {
Resource oResource;
String ProductName = Configuration.getProductName(xMSF);
oResource = new Resource(xMSF, ResName, ResPrefix);
@@ -265,8 +320,8 @@ public class SystemDialog {
return SystemDialog.showMessageBox(xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, sErrorMessage);
}
-
- public static int showErrorBox(XMultiServiceFactory xMSF, String ResName, String ResPrefix, int ResID) {
+ public static int showErrorBox(XMultiServiceFactory xMSF, String ResName, String ResPrefix, int ResID)
+ {
Resource oResource;
String ProductName = Configuration.getProductName(xMSF);
oResource = new Resource(xMSF, ResName, ResPrefix);
@@ -280,7 +335,6 @@ public class SystemDialog {
* example:
* (xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, "message")
*/
-
/**
* @param windowServiceName one of the following strings:
* "ErrorBox", "WarningBox", "MessBox", "InfoBox", "QueryBox".
@@ -290,22 +344,27 @@ public class SystemDialog {
* @return 0 = cancel, 1 = ok, 2 = yes, 3 = no(I'm not sure here)
* other values check for yourself ;-)
*/
- public static int showMessageBox(XMultiServiceFactory xMSF, String windowServiceName, int windowAttribute, String MessageText) {
+ public static int showMessageBox(XMultiServiceFactory xMSF, String windowServiceName, int windowAttribute, String MessageText)
+ {
short iMessage = 0;
- try {
+ try
+ {
if (MessageText == null)
+ {
return 0;
+ }
XFrame xFrame = Desktop.getActiveFrame(xMSF);
XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
- return showMessageBox(xMSF,xWindowPeer, windowServiceName, windowAttribute, MessageText);
- } catch (Exception exception) {
+ return showMessageBox(xMSF, xWindowPeer, windowServiceName, windowAttribute, MessageText);
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
return iMessage;
}
-
/**
* just like the other showMessageBox(...) method, but recieves a
* peer argument to use to create the message box.
@@ -316,13 +375,16 @@ public class SystemDialog {
* @param MessageText
* @return
*/
- public static int showMessageBox(XMultiServiceFactory xMSF, XWindowPeer peer, String windowServiceName, int windowAttribute, String MessageText) {
+ public static int showMessageBox(XMultiServiceFactory xMSF, XWindowPeer peer, String windowServiceName, int windowAttribute, String MessageText)
+ {
// If the peer is null we try to get one from the desktop...
- if (peer==null)
- return showMessageBox(xMSF,windowServiceName, windowAttribute, MessageText);
-
+ if (peer == null)
+ {
+ return showMessageBox(xMSF, windowServiceName, windowAttribute, MessageText);
+ }
short iMessage = 0;
- try {
+ try
+ {
XInterface xAWTToolkit = (XInterface) xMSF.createInstance("com.sun.star.awt.Toolkit");
XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, xAWTToolkit);
com.sun.star.awt.WindowDescriptor oDescriptor = new com.sun.star.awt.WindowDescriptor();
@@ -336,7 +398,9 @@ public class SystemDialog {
xMsgbox.setMessageText(MessageText);
iMessage = xMsgbox.execute();
xComponent.dispose();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
// TODO Auto-generated catch block
e.printStackTrace(System.out);
}
@@ -345,19 +409,24 @@ public class SystemDialog {
public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF)
{
- Object xPathSubst = null;
- try {
- xPathSubst = xMSF.createInstance(
- "com.sun.star.util.PathSubstitution" );
- }
- catch (com.sun.star.uno.Exception e) {
- e.printStackTrace();
- }
- if (xPathSubst != null)
- return (XStringSubstitution)UnoRuntime.queryInterface(
- XStringSubstitution.class, xPathSubst );
- else
- return null;
+ Object xPathSubst = null;
+ try
+ {
+ xPathSubst = xMSF.createInstance(
+ "com.sun.star.util.PathSubstitution");
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ e.printStackTrace();
+ }
+ if (xPathSubst != null)
+ {
+ return (XStringSubstitution) UnoRuntime.queryInterface(
+ XStringSubstitution.class, xPathSubst);
+ }
+ else
+ {
+ return null;
+ }
}
-
}
diff --git a/wizards/com/sun/star/wizards/common/TerminateWizardException.java b/wizards/com/sun/star/wizards/common/TerminateWizardException.java
index 503a2866cfee..593cfd62a9c8 100644
--- a/wizards/com/sun/star/wizards/common/TerminateWizardException.java
+++ b/wizards/com/sun/star/wizards/common/TerminateWizardException.java
@@ -1,15 +1,47 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TerminateWizardException.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.common;
import com.sun.star.wizards.common.Resource;
import com.sun.star.lang.XMultiServiceFactory;
-public class TerminateWizardException extends Exception {
+public class TerminateWizardException extends Exception
+{
- public TerminateWizardException(XMultiServiceFactory xMSF) {
+ public TerminateWizardException(XMultiServiceFactory xMSF)
+ {
Resource oResource = new Resource(xMSF, "AutoPilot", "dbw");
String sErrorMessage = oResource.getResText(1006);
SystemDialog.showMessageBox(xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, sErrorMessage);
printStackTrace(System.out);
}
-
}
diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java
index 6fd04e3bdd1e..98f149bf66cd 100644
--- a/wizards/com/sun/star/wizards/common/UCB.java
+++ b/wizards/com/sun/star/wizards/common/UCB.java
@@ -1,4 +1,36 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: UCB.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/*
* Created on 31.10.2003
*
* To change the template for this generated file go to
diff --git a/wizards/com/sun/star/wizards/common/XMLHelper.java b/wizards/com/sun/star/wizards/common/XMLHelper.java
index d047fd3509ff..fdb1e18b537c 100644
--- a/wizards/com/sun/star/wizards/common/XMLHelper.java
+++ b/wizards/com/sun/star/wizards/common/XMLHelper.java
@@ -1,9 +1,40 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XMLHelper.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/*
* XMLHelper.java
*
* Created on 30. September 2003, 15:38
*/
-
package com.sun.star.wizards.common;
import org.w3c.dom.*;
@@ -12,22 +43,36 @@ import org.w3c.dom.*;
*
* @author rpiterman
*/
-public class XMLHelper {
+public class XMLHelper
+{
- public static Node addElement(Node parent, String name, String[] attNames, String[] attValues) {
+ public static Node addElement(Node parent, String name, String[] attNames, String[] attValues)
+ {
Document doc = parent.getOwnerDocument();
if (doc == null)
+ {
doc = (Document) parent;
+ }
Element e = doc.createElement(name);
for (int i = 0; i < attNames.length; i++)
+ {
if (attValues[i] != null && (!attValues[i].equals("")))
+ {
e.setAttribute(attNames[i], attValues[i]);
+ }
+ }
parent.appendChild(e);
return e;
}
- public static Node addElement(Node parent, String name, String attNames, String attValues) {
- return addElement(parent, name, new String[] { attNames }, new String[] { attValues });
+ public static Node addElement(Node parent, String name, String attNames, String attValues)
+ {
+ return addElement(parent, name, new String[]
+ {
+ attNames
+ }, new String[]
+ {
+ attValues
+ });
}
-
}
diff --git a/wizards/com/sun/star/wizards/common/XMLProvider.java b/wizards/com/sun/star/wizards/common/XMLProvider.java
index a2e46114a682..c91a05aff304 100644
--- a/wizards/com/sun/star/wizards/common/XMLProvider.java
+++ b/wizards/com/sun/star/wizards/common/XMLProvider.java
@@ -1,16 +1,50 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XMLProvider.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/*
* XMLSupplier.java
*
* Created on 19. September 2003, 11:52
*/
-
package com.sun.star.wizards.common;
import org.w3c.dom.Node;
+
/**
*
* @author rpiterman
*/
-public interface XMLProvider {
+public interface XMLProvider
+{
+
public Node createDOM(Node parent);
}
diff --git a/wizards/com/sun/star/wizards/db/BlindtextCreator.java b/wizards/com/sun/star/wizards/db/BlindtextCreator.java
index 6b448b7e6d36..5d89e61d1428 100644
--- a/wizards/com/sun/star/wizards/db/BlindtextCreator.java
+++ b/wizards/com/sun/star/wizards/db/BlindtextCreator.java
@@ -35,37 +35,40 @@ import com.sun.star.wizards.common.JavaTools;
*
* @author bc93774
*/
-public class BlindtextCreator {
+public class BlindtextCreator
+{
public static final String BlindText =
- "Ut wisi enim ad minim veniam, quis nostrud exerci tation "
- + "ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor "
- + "in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at "
- + "vero et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore "
- + "te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy "
- + "nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, "
- + "quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. "
- + "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum "
- + "dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit praesent "
- + "luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis "
- + "eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.";
+ "Ut wisi enim ad minim veniam, quis nostrud exerci tation " + "ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor " + "in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at " + "vero et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore " + "te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy " + "nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, " + "quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. " + "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum " + "dolore eu feugiat nulla facilisis at vero et accumsan et iusto odio dignissim qui blandit praesent " + "luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis " + "eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.";
- public static String adjustBlindTextlength(String FieldTitle, int FieldWidth, boolean bIsCurLandscape, boolean bIsGroupTable, String[] _RecordFieldNames) {
+ public static String adjustBlindTextlength(String FieldTitle, int FieldWidth, boolean bIsCurLandscape, boolean bIsGroupTable, String[] _RecordFieldNames)
+ {
String BlindTextString = "";
if (bIsGroupTable)
+ {
return getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
+ }
int MaxFieldCount = getMaxFieldCount(bIsCurLandscape);
- if (_RecordFieldNames.length <= 2 * MaxFieldCount) {
+ if (_RecordFieldNames.length <= 2 * MaxFieldCount)
+ {
if (_RecordFieldNames.length <= MaxFieldCount)
+ {
BlindTextString = getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
+ }
else
+ {
BlindTextString = getBlindTextString(FieldTitle, FieldWidth, (int) (0.5 * FieldWidth));
- } else
+ }
+ }
+ else
+ {
BlindTextString = getBlindTextString(FieldTitle, FieldWidth, (int) 1.1 * FieldTitle.length());
+ }
return BlindTextString;
}
- public static String getBlindTextString(String FieldTitle, int FieldWidth, int MaxWidth) {
+ public static String getBlindTextString(String FieldTitle, int FieldWidth, int MaxWidth)
+ {
String[] BlindTextArray = JavaTools.ArrayoutofString(BlindText, " ");
String PartBlindText = BlindTextArray[0];
String NewPartBlindText;
@@ -74,28 +77,40 @@ public class BlindtextCreator {
int Titlelength = (int) 1.1 * FieldTitle.length(); // We assume that the TableHeading is bold
if (Titlelength > PartBlindText.length())
+ {
MaxHeaderWidth = Titlelength;
+ }
else
+ {
MaxHeaderWidth = PartBlindText.length();
+ }
if (MaxHeaderWidth > MaxWidth)
+ {
MaxWidth = MaxHeaderWidth;
-
+ }
int i = 1;
- do {
+ do
+ {
NewPartBlindText = PartBlindText + " " + BlindTextArray[i];
- if (NewPartBlindText.length() < MaxWidth) {
+ if (NewPartBlindText.length() < MaxWidth)
+ {
PartBlindText = NewPartBlindText;
i += 1;
}
- } while (NewPartBlindText.length() < MaxWidth);
+ }
+ while (NewPartBlindText.length() < MaxWidth);
return PartBlindText;
}
- private static int getMaxFieldCount(boolean bIsCurLandscape) {
+ private static int getMaxFieldCount(boolean bIsCurLandscape)
+ {
if (bIsCurLandscape == true)
+ {
return 5;
+ }
else
+ {
return 3;
+ }
}
-
}
diff --git a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
index 84945482b05a..8e7af2924f85 100644
--- a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
+++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.db;
+ ************************************************************************/
+package com.sun.star.wizards.db;
import com.sun.star.beans.Property;
import com.sun.star.beans.PropertyValue;
@@ -40,142 +41,181 @@ import com.sun.star.uno.AnyConverter;
import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.db.TypeInspector;
+public class ColumnPropertySet
+{
-public class ColumnPropertySet {
TypeInspector oTypeInspector;
public XPropertySet xPropertySet;
private int nType;
private String sTypeName = "";
-
- public ColumnPropertySet(TypeInspector _oTypeInspector, XPropertySet _xPropertySet){
+ public ColumnPropertySet(TypeInspector _oTypeInspector, XPropertySet _xPropertySet)
+ {
xPropertySet = _xPropertySet;
oTypeInspector = _oTypeInspector;
}
- private PropertyValue [] propertySet2PropertyValueArray( XPropertySet _xNewPropertySet ) throws com.sun.star.uno.Exception
+ private PropertyValue[] propertySet2PropertyValueArray(XPropertySet _xNewPropertySet) throws com.sun.star.uno.Exception
{
- Property [] props = _xNewPropertySet.getPropertySetInfo().getProperties();
- PropertyValue [] ret = new PropertyValue[ props.length ];
- for( int i = 0; i < props.length ; i ++ )
+ Property[] props = _xNewPropertySet.getPropertySetInfo().getProperties();
+ PropertyValue[] ret = new PropertyValue[props.length];
+ for (int i = 0; i < props.length; i++)
{
PropertyValue val = new PropertyValue();
val.Name = props[i].Name;
val.Value = _xNewPropertySet.getPropertyValue(val.Name);
- ret [i] = val;
+ ret[i] = val;
}
return ret;
}
- private void assignPropertyValues( String _sNewName, PropertyValue [] _aNewColPropertyValues, boolean _bsetDefaultProperties )
+ private void assignPropertyValues(String _sNewName, PropertyValue[] _aNewColPropertyValues, boolean _bsetDefaultProperties)
{
- try {
+ try
+ {
nType = ((Integer) Properties.getPropertyValue(_aNewColPropertyValues, "Type")).intValue();
nType = oTypeInspector.convertDataType(nType);
if (Properties.hasPropertyValue(_aNewColPropertyValues, "TypeName"))
+ {
sTypeName = (String) Properties.getPropertyValue(_aNewColPropertyValues, "TypeName");
+ }
Integer precision = null;
- if( Properties.hasPropertyValue(_aNewColPropertyValues, "Precision" ) )
+ if (Properties.hasPropertyValue(_aNewColPropertyValues, "Precision"))
{
- precision = (Integer)Properties.getPropertyValue(_aNewColPropertyValues, "Precision" );
+ precision = (Integer) Properties.getPropertyValue(_aNewColPropertyValues, "Precision");
}
- if( (nType == DataType.VARCHAR ) && ( precision == null || precision.intValue() == 0) )
+ if ((nType == DataType.VARCHAR) && (precision == null || precision.intValue() == 0))
{
precision = new Integer(50);
}
- if( precision != null )
- xPropertySet.setPropertyValue( "Precision" , precision );
+ if (precision != null)
+ {
+ xPropertySet.setPropertyValue("Precision", precision);
+ }
setType(nType, sTypeName, precision);
- for (int i = 0; i < _aNewColPropertyValues.length; i++){
+ for (int i = 0; i < _aNewColPropertyValues.length; i++)
+ {
String sPropName = _aNewColPropertyValues[i].Name;
- if ( _sNewName != null && sPropName.equals("Name"))
+ if (_sNewName != null && sPropName.equals("Name"))
+ {
xPropertySet.setPropertyValue("Name", _sNewName);
- else if ( sPropName.equals( "Precision" ) )
+ }
+ else if (sPropName.equals("Precision"))
{
// do nothing, see above
}
- else if ((!sPropName.equals("Type")) && (!sPropName.equals("TypeName"))){
+ else if ((!sPropName.equals("Type")) && (!sPropName.equals("TypeName")))
+ {
Object oColValue = _aNewColPropertyValues[i].Value;
assignPropertyValue(sPropName, oColValue);
}
}
if (_bsetDefaultProperties)
+ {
assignPropertyValue("IsNullable", new Integer(oTypeInspector.isNullable(xPropertySet)));
- } catch (Exception e) {
+ }
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
- public void assignPropertyValues(PropertyValue[] _aNewColPropertyValues, boolean _bsetDefaultProperties){
- assignPropertyValues( null /* dont change the name */ , _aNewColPropertyValues, _bsetDefaultProperties );
+ public void assignPropertyValues(PropertyValue[] _aNewColPropertyValues, boolean _bsetDefaultProperties)
+ {
+ assignPropertyValues(null /* dont change the name */, _aNewColPropertyValues, _bsetDefaultProperties);
}
+ public void assignNewPropertySet(String _sNewName, XPropertySet _xNewPropertySet)
+ {
+ try
+ {
+ assignPropertyValues(
+ _sNewName, propertySet2PropertyValueArray(_xNewPropertySet), false /*setDefaultProperties*/);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public void assignNewPropertySet(String _sNewName, XPropertySet _xNewPropertySet){
- try {
- assignPropertyValues(
- _sNewName, propertySet2PropertyValueArray( _xNewPropertySet ), false /*setDefaultProperties*/ );
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- private int getPrecision(){
- try{
- return ((Integer) xPropertySet.getPropertyValue("Precision")).intValue();
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return 0;
- }}
-
+ private int getPrecision()
+ {
+ try
+ {
+ return ((Integer) xPropertySet.getPropertyValue("Precision")).intValue();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return 0;
+ }
+ }
- private void setType(int _nType, String _sTypeName, Integer precision){
+ private void setType(int _nType, String _sTypeName, Integer precision)
+ {
if (_sTypeName.equals(""))
+ {
sTypeName = oTypeInspector.getDefaultTypeName(nType, precision);
+ }
else
+ {
sTypeName = _sTypeName;
+ }
nType = oTypeInspector.getDataType(sTypeName);
assignPropertyValue("Type", new Integer(nType));
assignPropertyValue("TypeName", sTypeName);
}
-
- private void assignPropertyValue(String _spropname, Object _oValue){
- try {
- if (_spropname.equals("Type")){
+ private void assignPropertyValue(String _spropname, Object _oValue)
+ {
+ try
+ {
+ if (_spropname.equals("Type"))
+ {
nType = ((Integer) _oValue).intValue();
- xPropertySet.setPropertyValue("Type",new Integer(nType));
+ xPropertySet.setPropertyValue("Type", new Integer(nType));
}
- else if (_spropname.equals("Name")){
+ else if (_spropname.equals("Name"))
+ {
String sName = (String) _oValue;
- if (!sName.equals(""))
+ if (!sName.equals(""))
+ {
xPropertySet.setPropertyValue("Name", sName);
+ }
}
- else if (_spropname.equals("Scale")){
+ else if (_spropname.equals("Scale"))
+ {
int nScale = ((Integer) _oValue).intValue();
nScale = oTypeInspector.getScale(xPropertySet);
- xPropertySet.setPropertyValue("Scale",new Integer(nScale));
+ xPropertySet.setPropertyValue("Scale", new Integer(nScale));
}
- else if (_spropname.equals("IsNullable")){
+ else if (_spropname.equals("IsNullable"))
+ {
int nNullability = ((Integer) _oValue).intValue();
nNullability = oTypeInspector.getNullability(xPropertySet, nNullability);
xPropertySet.setPropertyValue("IsNullable", new Integer(nNullability));
}
- else if (_spropname.equals("TypeName")){
+ else if (_spropname.equals("TypeName"))
+ {
String sTypeName = (String) _oValue;
xPropertySet.setPropertyValue("TypeName", sTypeName);
}
else
+ {
xPropertySet.setPropertyValue(_spropname, _oValue);
- } catch (Exception e) {
+ }
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
-
- private int getType(){
+ private int getType()
+ {
return nType;
}
}
diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java
index 96d7d5170298..adaeacb1a965 100644
--- a/wizards/com/sun/star/wizards/db/CommandMetaData.java
+++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java
@@ -51,7 +51,8 @@ import com.sun.star.container.XNameAccess;
import com.sun.star.embed.EntryInitModes;
import com.sun.star.frame.*;
-public class CommandMetaData extends DBMetaData {
+public class CommandMetaData extends DBMetaData
+{
public Map FieldTitleSet = new HashMap();
public String[] AllFieldNames = new String[]{};
public FieldColumn[] FieldColumns = new FieldColumn[]{};
@@ -120,10 +121,10 @@ public class CommandMetaData extends DBMetaData {
{
if (FieldTitleSet.containsKey(_FieldNames[i]))
{
- FieldColumns[i].FieldTitle = (String) FieldTitleSet.get(_FieldNames[i]);
- if (FieldColumns[i].FieldTitle == null)
+ FieldColumns[i].setFieldTitle( (String) FieldTitleSet.get(_FieldNames[i]) );
+ if (FieldColumns[i].getFieldTitle() == null)
{
- FieldColumns[i].FieldTitle = _FieldNames[i];
+ FieldColumns[i].setFieldTitle( _FieldNames[i] );
FieldTitleSet.put(_FieldNames[i], _FieldNames[i]);
}
}
@@ -152,7 +153,7 @@ public class CommandMetaData extends DBMetaData {
}
String CurCommandName = CurFieldColumn.getCommandName();
CommandObject oCommand = getTableByName(CurCommandName);
- Object oColumn = oCommand.xColumns.getByName(CurFieldColumn.FieldName);
+ Object oColumn = oCommand.xColumns.getByName(CurFieldColumn.m_sFieldName);
XPropertySet xColumn = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn);
return xColumn;
}
@@ -211,10 +212,10 @@ public class CommandMetaData extends DBMetaData {
{
for (int i = 0; i < FieldColumns.length; i++)
{
- if (FieldColumns[i].FieldName.equals(_FieldName))
+ if (FieldColumns[i].m_sFieldName.equals(_FieldName))
{
- if (FieldColumns[i].CommandName.equals(_CommandName))
+ if (FieldColumns[i].getCommandName().equals(_CommandName))
{
return FieldColumns[i];
}
@@ -230,7 +231,7 @@ public class CommandMetaData extends DBMetaData {
{
for (int i = 0; i < FieldColumns.length; i++)
{
- String sFieldName = FieldColumns[i].FieldName;
+ String sFieldName = FieldColumns[i].m_sFieldName;
if (sFieldName.equals(_FieldName))
{
return FieldColumns[i];
@@ -252,7 +253,7 @@ public class CommandMetaData extends DBMetaData {
{
for (int i = 0; i < FieldColumns.length; i++)
{
- String sDisplayName = FieldColumns[i].DisplayFieldName;
+ String sDisplayName = FieldColumns[i].getDisplayFieldName();
if (sDisplayName.equals(_DisplayName))
{
return FieldColumns[i];
@@ -274,7 +275,7 @@ public class CommandMetaData extends DBMetaData {
{
for (int i = 0; i < FieldColumns.length; i++)
{
- if (FieldColumns[i].FieldTitle.equals(_FieldTitle))
+ if (FieldColumns[i].getFieldTitle().equals(_FieldTitle))
{
return FieldColumns[i];
}
@@ -283,7 +284,7 @@ public class CommandMetaData extends DBMetaData {
// LLA: Group works with fields direct
for (int i = 0; i < FieldColumns.length; i++)
{
- if (FieldColumns[i].FieldName.equals(_FieldTitle))
+ if (FieldColumns[i].m_sFieldName.equals(_FieldTitle))
{
return FieldColumns[i];
}
@@ -423,7 +424,7 @@ public class CommandMetaData extends DBMetaData {
{
if (isnumeric(FieldColumns[i]))
{
- numericfieldsvector.addElement(FieldColumns[i].DisplayFieldName);
+ numericfieldsvector.addElement(FieldColumns[i].getDisplayFieldName());
}
}
NumericFieldNames = new String[numericfieldsvector.size()];
@@ -442,11 +443,11 @@ public class CommandMetaData extends DBMetaData {
Vector sFieldNamesVector = new java.util.Vector();
for (int i = 0; i < FieldColumns.length; i++)
{
- if (_sCommandName.equals(FieldColumns[i].CommandName))
+ if (_sCommandName.equals(FieldColumns[i].getCommandName()))
{
- if (JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].DisplayFieldName) > -1)
+ if (JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].getDisplayFieldName()) > -1)
{
- sFieldNamesVector.addElement(FieldColumns[i].FieldName);
+ sFieldNamesVector.addElement(FieldColumns[i].m_sFieldName);
}
}
}
@@ -462,7 +463,7 @@ public class CommandMetaData extends DBMetaData {
String[] sFieldNames = new String[FieldColumns.length];
for (int i = 0; i < FieldColumns.length; i++)
{
- sFieldNames[i] = FieldColumns[i].FieldName;
+ sFieldNames[i] = FieldColumns[i].m_sFieldName;
}
return sFieldNames;
}
@@ -472,7 +473,7 @@ public class CommandMetaData extends DBMetaData {
String[] sDisplayFieldNames = new String[FieldColumns.length];
for (int i = 0; i < FieldColumns.length; i++)
{
- sDisplayFieldNames[i] = FieldColumns[i].DisplayFieldName;
+ sDisplayFieldNames[i] = FieldColumns[i].getDisplayFieldName();
}
return sDisplayFieldNames;
}
@@ -485,9 +486,9 @@ public class CommandMetaData extends DBMetaData {
Vector nonaggregatefieldsvector = new java.util.Vector();
for (int i = 0; i < FieldColumns.length; i++)
{
- if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].DisplayFieldName) == -1)
+ if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].getDisplayFieldName()) == -1)
{
- nonaggregatefieldsvector.addElement(FieldColumns[i].DisplayFieldName);
+ nonaggregatefieldsvector.addElement(FieldColumns[i].getDisplayFieldName());
}
}
NonAggregateFieldNames = new String[nonaggregatefieldsvector.size()];
@@ -547,7 +548,7 @@ public class CommandMetaData extends DBMetaData {
{
if (i < nFieldColLength)
{
- FieldColumns[i].FieldTitle = sFieldTitles[i];
+ FieldColumns[i].setFieldTitle(sFieldTitles[i]);
}
}
@@ -559,7 +560,7 @@ public class CommandMetaData extends DBMetaData {
String[] sFieldTitles = new String[FieldColumns.length];
for (int i = 0; i < FieldColumns.length; i++)
{
- sFieldTitles[i] = FieldColumns[i].FieldTitle;
+ sFieldTitles[i] = FieldColumns[i].getFieldTitle();
}
return sFieldTitles;
}
@@ -588,7 +589,7 @@ public class CommandMetaData extends DBMetaData {
int a = 0;
for (int i = 0; i < TotFieldCount; i++)
{
- CurFieldName = FieldColumns[i].FieldName;
+ CurFieldName = FieldColumns[i].m_sFieldName;
if (JavaTools.FieldInList(GroupFieldNames, CurFieldName) < 0)
{
RecordFieldNames[a] = CurFieldName;
diff --git a/wizards/com/sun/star/wizards/db/CommandName.java b/wizards/com/sun/star/wizards/db/CommandName.java
index c00b44b31b9e..2ea6d75bef6c 100644
--- a/wizards/com/sun/star/wizards/db/CommandName.java
+++ b/wizards/com/sun/star/wizards/db/CommandName.java
@@ -26,13 +26,16 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.db;
+ ************************************************************************/
+package com.sun.star.wizards.db;
import com.sun.star.sdbc.SQLException;
import com.sun.star.uno.Exception;
import com.sun.star.wizards.common.JavaTools;
-public class CommandName{
+public class CommandName
+{
+
protected CommandMetaData oCommandMetaData;
protected String CatalogName = "";
protected String SchemaName = "";
@@ -45,165 +48,223 @@ public class CommandName{
protected String sIdentifierQuote;
protected boolean baddQuotation = true;
-
- public CommandName(CommandMetaData _CommandMetaData, String _DisplayName){
+ public CommandName(CommandMetaData _CommandMetaData, String _DisplayName)
+ {
oCommandMetaData = _CommandMetaData;
setComposedCommandName(_DisplayName);
}
-
- public CommandName(CommandMetaData _CommandMetaData, String _CatalogName, String _SchemaName, String _TableName, boolean _baddQuotation){
- try {
- baddQuotation = _baddQuotation;
- oCommandMetaData = _CommandMetaData;
- if ((_CatalogName != null) && (oCommandMetaData.xDBMetaData.supportsCatalogsInTableDefinitions())){
- if (!_CatalogName.equals("")){
- CatalogName = _CatalogName;
+ public CommandName(CommandMetaData _CommandMetaData, String _CatalogName, String _SchemaName, String _TableName, boolean _baddQuotation)
+ {
+ try
+ {
+ baddQuotation = _baddQuotation;
+ oCommandMetaData = _CommandMetaData;
+ if ((_CatalogName != null) && (oCommandMetaData.xDBMetaData.supportsCatalogsInTableDefinitions()))
+ {
+ if (!_CatalogName.equals(""))
+ {
+ CatalogName = _CatalogName;
+ }
}
- }
- if ((_SchemaName != null) && (oCommandMetaData.xDBMetaData.supportsSchemasInTableDefinitions())){
- if (!_SchemaName.equals("")){
- SchemaName = _SchemaName;
+ if ((_SchemaName != null) && (oCommandMetaData.xDBMetaData.supportsSchemasInTableDefinitions()))
+ {
+ if (!_SchemaName.equals(""))
+ {
+ SchemaName = _SchemaName;
+ }
}
- }
- if (_TableName != null){
- if (!_TableName.equals("")){
- TableName = _TableName;
+ if (_TableName != null)
+ {
+ if (!_TableName.equals(""))
+ {
+ TableName = _TableName;
+ }
}
+ setComposedCommandName();
}
- setComposedCommandName();
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- }}
-
-
- private void setComposedCommandName(String _DisplayName) {
- try{
- if (this.setMetaDataAttributes()){
- this.DisplayName = _DisplayName;
- int iIndex;
- if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation() == true) { // ...dann Catalog mit in TableName
- iIndex = _DisplayName.indexOf(sCatalogSep);
- if (iIndex >= 0) {
- if (bCatalogAtStart == true) {
- CatalogName = _DisplayName.substring(0, iIndex);
- _DisplayName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
- } else {
- CatalogName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
- _DisplayName = _DisplayName.substring(0, iIndex);
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ private void setComposedCommandName(String _DisplayName)
+ {
+ try
+ {
+ if (this.setMetaDataAttributes())
+ {
+ this.DisplayName = _DisplayName;
+ int iIndex;
+ if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation() == true)
+ { // ...dann Catalog mit in TableName
+ iIndex = _DisplayName.indexOf(sCatalogSep);
+ if (iIndex >= 0)
+ {
+ if (bCatalogAtStart == true)
+ {
+ CatalogName = _DisplayName.substring(0, iIndex);
+ _DisplayName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
+ }
+ else
+ {
+ CatalogName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
+ _DisplayName = _DisplayName.substring(0, iIndex);
+ }
}
}
+ if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation() == true)
+ {
+ String[] NameList;
+ NameList = new String[0];
+ NameList = JavaTools.ArrayoutofString(_DisplayName, ".");
+ SchemaName = NameList[0];
+ TableName = NameList[1]; // TODO Was ist mit diesem Fall: CatalogSep = "." und CatalogName = ""
+ }
+ else
+ {
+ TableName = _DisplayName;
+ }
+ setComposedCommandName();
}
- if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation() == true) {
- String[] NameList;
- NameList = new String[0];
- NameList = JavaTools.ArrayoutofString(_DisplayName, ".");
- SchemaName = NameList[0];
- TableName = NameList[1]; // TODO Was ist mit diesem Fall: CatalogSep = "." und CatalogName = ""
- } else
- TableName = _DisplayName;
- setComposedCommandName();
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
}
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- }}
-
- public void setComposedCommandName() {
- if (this.setMetaDataAttributes()){
- if (CatalogName != null){
- if (!CatalogName.equals("")){
- if (bCatalogAtStart == true){
+ public void setComposedCommandName()
+ {
+ if (this.setMetaDataAttributes())
+ {
+ if (CatalogName != null)
+ {
+ if (!CatalogName.equals(""))
+ {
+ if (bCatalogAtStart == true)
+ {
ComposedName = quoteName(CatalogName) + sCatalogSep;
}
}
}
- if (SchemaName != null){
+ if (SchemaName != null)
+ {
if (!SchemaName.equals(""))
+ {
ComposedName += quoteName(SchemaName) + ".";
+ }
}
- if (ComposedName == "")
+ if (ComposedName.equals(""))
+ {
ComposedName = quoteName(TableName);
+ }
else
+ {
ComposedName += quoteName(TableName);
- if ((bCatalogAtStart == false) && (CatalogName != null)){
+ }
+ if ((bCatalogAtStart == false) && (CatalogName != null))
+ {
if (!CatalogName.equals(""))
+ {
ComposedName += sCatalogSep + quoteName(CatalogName);
+ }
}
}
}
+ private boolean setMetaDataAttributes()
+ {
+ try
+ {
+ bCatalogAtStart = oCommandMetaData.xDBMetaData.isCatalogAtStart();
+ sCatalogSep = oCommandMetaData.xDBMetaData.getCatalogSeparator();
+ sIdentifierQuote = oCommandMetaData.xDBMetaData.getIdentifierQuoteString();
+ return true;
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
+ }
- private boolean setMetaDataAttributes(){
- try {
- bCatalogAtStart = oCommandMetaData.xDBMetaData.isCatalogAtStart();
- sCatalogSep = oCommandMetaData.xDBMetaData.getCatalogSeparator();
- sIdentifierQuote = oCommandMetaData.xDBMetaData.getIdentifierQuoteString();
- return true;
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- return false;
- }}
-
-
- public String quoteName(String _sName) {
+ public String quoteName(String _sName)
+ {
if (baddQuotation)
+ {
return quoteName(_sName, this.oCommandMetaData.getIdentifierQuote());
+ }
else
+ {
return _sName;
+ }
}
-
- public static String quoteName(String sName, String _sIdentifierQuote) {
+ public static String quoteName(String sName, String _sIdentifierQuote)
+ {
if (sName == null)
+ {
sName = "";
+ }
String ReturnQuote = "";
ReturnQuote = _sIdentifierQuote + sName + _sIdentifierQuote;
return ReturnQuote;
}
-
- public void setAliasName(String _AliasName){
+ public void setAliasName(String _AliasName)
+ {
AliasName = _AliasName;
}
-
- public String getAliasName(){
+ public String getAliasName()
+ {
return AliasName;
}
/**
* @return Returns the catalogName.
*/
- public String getCatalogName() {
+ public String getCatalogName()
+ {
return CatalogName;
}
+
/**
* @return Returns the composedName.
*/
- public String getComposedName() {
+ public String getComposedName()
+ {
return ComposedName;
}
+
/**
* @return Returns the displayName.
*/
- public String getDisplayName() {
+ public String getDisplayName()
+ {
return DisplayName;
}
+
/**
* @return Returns the schemaName.
*/
- public String getSchemaName() {
+ public String getSchemaName()
+ {
return SchemaName;
}
+
/**
* @return Returns the tableName.
*/
- public String getTableName() {
+ public String getTableName()
+ {
return TableName;
}
- public CommandMetaData getCommandMetaData(){
+ public CommandMetaData getCommandMetaData()
+ {
return oCommandMetaData;
}
}
diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java
index a2ab9a13eb1d..af9605cb99c6 100644
--- a/wizards/com/sun/star/wizards/db/DBMetaData.java
+++ b/wizards/com/sun/star/wizards/db/DBMetaData.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.db;
import com.sun.star.awt.XWindow;
@@ -88,7 +87,8 @@ import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.sdb.XQueriesSupplier;
import com.sun.star.sdbcx.XTablesSupplier;
-public class DBMetaData {
+public class DBMetaData
+{
public XNameAccess xTableNames;
public XNameAccess xQueryNames;
@@ -100,12 +100,16 @@ public class DBMetaData {
public XOfficeDatabaseDocument xModel;
private XCompletedConnection xCompleted;
public XPropertySet xDataSourcePropertySet;
- private int[] nDataTypes = null;
+ // private int[] nDataTypes = null;
private XWindowPeer xWindowPeer;
public String[] DataSourceNames;
public String[] CommandNames;
- public String[] TableNames = new String[] {};
- public String[] QueryNames = new String[] {};
+ public String[] TableNames = new String[]
+ {
+ };
+ public String[] QueryNames = new String[]
+ {
+ };
public java.util.Vector CommandObjects = new Vector(1);
public int[][] WidthList;
public int[] NumericTypes;
@@ -124,7 +128,7 @@ public class DBMetaData {
int iMaxColumnNameLength = -1;
int iMaxTableNameLength = -1;
private boolean bPasswordIsRequired;
- private boolean bFormatKeysareset = false;
+ // private boolean bFormatKeysareset = false;
final int NOLIMIT = 9999999;
final int RID_DB_COMMON = 1000;
final int INVALID = 9999999;
@@ -135,64 +139,72 @@ public class DBMetaData {
private long lDateCorrection = INVALID;
private boolean bdisposeConnection = false;
- public DBMetaData(XMultiServiceFactory xMSF) {
+ public DBMetaData(XMultiServiceFactory xMSF)
+ {
getInterfaces(xMSF);
InitializeWidthList();
}
- public DBMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter _oNumberFormatter) {
+ public DBMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter _oNumberFormatter)
+ {
oNumberFormatter = _oNumberFormatter;
aLocale = _aLocale;
getInterfaces(xMSF);
InitializeWidthList();
}
-
- public NumberFormatter getNumberFormatter(){
- if (oNumberFormatter == null){
- try {
+ public NumberFormatter getNumberFormatter()
+ {
+ if (oNumberFormatter == null)
+ {
+ try
+ {
XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) AnyConverter.toObject(XNumberFormatsSupplier.class, xDataSourcePropertySet.getPropertyValue("NumberFormatsSupplier"));
//TODO get the locale from the datasource
aLocale = Configuration.getOfficeLocale(xMSF);
oNumberFormatter = new NumberFormatter(xMSF, xNumberFormatsSupplier, aLocale);
lDateCorrection = oNumberFormatter.getNullDateCorrection();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
return oNumberFormatter;
}
-
- public long getNullDateCorrection(){
- if (lDateCorrection == INVALID){
+ public long getNullDateCorrection()
+ {
+ if (lDateCorrection == INVALID)
+ {
if (oNumberFormatter == null)
+ {
oNumberFormatter = getNumberFormatter();
+ }
lDateCorrection = oNumberFormatter.getNullDateCorrection();
}
return lDateCorrection;
}
-
-
-
- void getInterfaces(XMultiServiceFactory xMSF) {
- try {
+ void getInterfaces(XMultiServiceFactory xMSF)
+ {
+ try
+ {
this.xMSF = xMSF;
xDatabaseContext = (XInterface) xMSF.createInstance("com.sun.star.sdb.DatabaseContext");
xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDatabaseContext);
XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.sdb.InteractionHandler");
oInteractionHandler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler);
DataSourceNames = xNameAccess.getElementNames();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
-
-
- public void setCommandTypes() {
+ public void setCommandTypes()
+ {
int TableCount;
int QueryCount;
int CommandCount;
@@ -202,99 +214,125 @@ public class DBMetaData {
QueryCount = JavaTools.getArraylength(QueryNames);
CommandCount = TableCount + QueryCount;
CommandTypes = new int[CommandCount];
- if (TableCount > 0) {
- for (i = 0; i < TableCount; i++) {
+ if (TableCount > 0)
+ {
+ for (i = 0; i < TableCount; i++)
+ {
CommandTypes[i] = com.sun.star.sdb.CommandType.TABLE;
}
a = i;
- for (i = 0; i < QueryCount; i++) {
+ for (i = 0; i < QueryCount; i++)
+ {
CommandTypes[a] = com.sun.star.sdb.CommandType.QUERY;
a += 1;
}
}
}
-
- public boolean hasTableByName(String _stablename){
+ public boolean hasTableByName(String _stablename)
+ {
getTableNames();
return xTableNames.hasByName(_stablename);
}
- public void setTableByName(String _tableName) {
+ public void setTableByName(String _tableName)
+ {
CommandObject oTableObject = new CommandObject(_tableName, com.sun.star.sdb.CommandType.TABLE);
this.CommandObjects.addElement(oTableObject);
}
- public CommandObject getTableByName(String _tablename) {
+ public CommandObject getTableByName(String _tablename)
+ {
return getCommandByName(_tablename, com.sun.star.sdb.CommandType.TABLE);
}
- public CommandObject getQueryByName(String _queryname) {
+ public CommandObject getQueryByName(String _queryname)
+ {
return getCommandByName(_queryname, com.sun.star.sdb.CommandType.QUERY);
}
- public CommandObject getCommandByName(String _commandname, int _commandtype) {
+ public CommandObject getCommandByName(String _commandname, int _commandtype)
+ {
CommandObject oCommand = null;
- for (int i = 0; i < CommandObjects.size(); i++) {
+ for (int i = 0; i < CommandObjects.size(); i++)
+ {
oCommand = (CommandObject) CommandObjects.elementAt(i);
if ((oCommand.Name.equals(_commandname)) && (oCommand.CommandType == _commandtype))
+ {
return oCommand;
+ }
}
- if (oCommand == null){
+ if (oCommand == null)
+ {
oCommand = new CommandObject(_commandname, _commandtype);
CommandObjects.addElement(oCommand);
}
return oCommand;
}
-
- public void setQueryByName(String _QueryName) {
+ public void setQueryByName(String _QueryName)
+ {
CommandObject oQueryObject = new CommandObject(_QueryName, com.sun.star.sdb.CommandType.QUERY);
this.CommandObjects.addElement(oQueryObject);
}
+ public class CommandObject
+ {
- public class CommandObject {
public XNameAccess xColumns;
public XPropertySet xPropertySet;
public String Name;
public int CommandType;
- public CommandObject(String _CommandName, int _CommandType) {
- try {
- Object oCommand;
- this.Name = _CommandName;
- this.CommandType = _CommandType;
- if (xTableNames == null)
- setCommandNames();
- if (CommandType == com.sun.star.sdb.CommandType.TABLE)
- oCommand = xTableNames.getByName(Name);
- else
- oCommand = xQueryNames.getByName(Name);
- XColumnsSupplier xCommandCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, oCommand);
- xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oCommand);
- xColumns = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xCommandCols.getColumns());
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- }}
+ public CommandObject(String _CommandName, int _CommandType)
+ {
+ try
+ {
+ Object oCommand;
+ this.Name = _CommandName;
+ this.CommandType = _CommandType;
+ if (xTableNames == null)
+ {
+ setCommandNames();
+ }
+ if (CommandType == com.sun.star.sdb.CommandType.TABLE)
+ {
+ oCommand = xTableNames.getByName(Name);
+ }
+ else
+ {
+ oCommand = xQueryNames.getByName(Name);
+ }
+ XColumnsSupplier xCommandCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, oCommand);
+ xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oCommand);
+ xColumns = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xCommandCols.getColumns());
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
}
-
- public boolean hasEscapeProcessing(XPropertySet _xQueryPropertySet){
- boolean bHasEscapeProcessing = false;
- try {
- if (_xQueryPropertySet.getPropertySetInfo().hasPropertyByName("EscapeProcessing")){
- bHasEscapeProcessing = AnyConverter.toBoolean(_xQueryPropertySet.getPropertyValue("EscapeProcessing"));
+ public boolean hasEscapeProcessing(XPropertySet _xQueryPropertySet)
+ {
+ boolean bHasEscapeProcessing = false;
+ try
+ {
+ if (_xQueryPropertySet.getPropertySetInfo().hasPropertyByName("EscapeProcessing"))
+ {
+ bHasEscapeProcessing = AnyConverter.toBoolean(_xQueryPropertySet.getPropertyValue("EscapeProcessing"));
+ }
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return bHasEscapeProcessing;
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return bHasEscapeProcessing;
}
-
-
- public void setCommandNames() {
+ public void setCommandNames()
+ {
getTableNames();
XQueriesSupplier xDBQueries = (XQueriesSupplier) UnoRuntime.queryInterface(XQueriesSupplier.class, DBConnection);
xQueryNames = (XNameAccess) xDBQueries.getQueries();
@@ -302,10 +340,14 @@ public class DBMetaData {
}
- public String[] getTableNames(){
- if (TableNames != null){
+ public String[] getTableNames()
+ {
+ if (TableNames != null)
+ {
if (TableNames.length > 0)
+ {
return TableNames;
+ }
}
XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection);
xTableNames = (XNameAccess) xDBTables.getTables();
@@ -313,8 +355,8 @@ public class DBMetaData {
return TableNames;
}
-
- void InitializeWidthList() {
+ void InitializeWidthList()
+ {
WidthList = new int[17][2];
WidthList[0][0] = DataType.BIT; // == -7;
WidthList[1][0] = DataType.BOOLEAN; // = 16
@@ -361,349 +403,460 @@ public class DBMetaData {
BinaryTypes[11] = DataType.OTHER;
}
-
- public boolean isBinaryDataType(int _itype){
+ public boolean isBinaryDataType(int _itype)
+ {
if (NumericTypes == null)
+ {
InitializeWidthList();
+ }
return (JavaTools.FieldInIntTable(BinaryTypes, _itype) > -1);
}
+ public int getMaxTablesInSelect()
+ {
+ try
+ {
+ int itablecount = xDBMetaData.getMaxTablesInSelect();
+ if (itablecount == 0)
+ {
+ return this.NOLIMIT;
+ }
+ else
+ {
+ return itablecount;
+ }
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ return - 1;
+ }
+ }
- public int getMaxTablesInSelect(){
- try {
- int itablecount = xDBMetaData.getMaxTablesInSelect();
- if (itablecount == 0)
- return this.NOLIMIT;
- else
- return itablecount;
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- return - 1;
- }}
-
-
- public int getMaxColumnsInSelect() {
+ public int getMaxColumnsInSelect()
+ {
return iMaxColumnsInSelect;
}
- public int getMaxColumnsInGroupBy() {
+ public int getMaxColumnsInGroupBy()
+ {
return iMaxColumnsInGroupBy;
}
- private void setMaxColumnsInSelect() throws SQLException {
+ private void setMaxColumnsInSelect() throws SQLException
+ {
iMaxColumnsInSelect = xDBMetaData.getMaxColumnsInSelect();
if (iMaxColumnsInSelect == 0)
+ {
iMaxColumnsInSelect = this.NOLIMIT;
+ }
}
- private void setMaxColumnsInGroupBy() throws SQLException {
+ private void setMaxColumnsInGroupBy() throws SQLException
+ {
iMaxColumnsInGroupBy = xDBMetaData.getMaxColumnsInGroupBy();
if (iMaxColumnsInGroupBy == 0)
+ {
iMaxColumnsInGroupBy = this.NOLIMIT;
+ }
}
-
- public int getMaxColumnsInTable() throws SQLException {
+ public int getMaxColumnsInTable() throws SQLException
+ {
iMaxColumnsInTable = xDBMetaData.getMaxColumnsInTable();
if (iMaxColumnsInTable == 0)
+ {
iMaxColumnsInTable = this.NOLIMIT;
+ }
return iMaxColumnsInTable;
}
+ private void getDataSourceObjects() throws Exception
+ {
+ try
+ {
+ xDBMetaData = DBConnection.getMetaData();
+ XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, DBConnection);
+ Object oDataSource = xChild.getParent();
+ getDataSourceInterfaces();
+ setMaxColumnsInGroupBy();
+ setMaxColumnsInSelect();
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- private void getDataSourceObjects() throws Exception{
- try {
- xDBMetaData = DBConnection.getMetaData();
- XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, DBConnection);
- Object oDataSource = xChild.getParent();
- getDataSourceInterfaces();
- setMaxColumnsInGroupBy();
- setMaxColumnsInSelect();
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- }}
-
-
- public boolean isSQL92CheckEnabled(){
- try {
- if (aInfoPropertyValues == null){
+ public boolean isSQL92CheckEnabled()
+ {
+ try
+ {
+ if (aInfoPropertyValues == null)
+ {
aInfoPropertyValues = (PropertyValue[]) AnyConverter.toArray(this.xDataSourcePropertySet.getPropertyValue("Info"));
- if (Properties.hasPropertyValue(aInfoPropertyValues,"EnableSQL92Check")){
+ if (Properties.hasPropertyValue(aInfoPropertyValues, "EnableSQL92Check"))
+ {
bisSQL92CheckEnabled = AnyConverter.toBoolean(Properties.getPropertyValue(aInfoPropertyValues, "EnableSQL92Check"));
}
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
return bisSQL92CheckEnabled;
}
-
- public String verifyName(String _sname, int _maxlen){
+ public String verifyName(String _sname, int _maxlen)
+ {
if (_sname.length() > _maxlen)
+ {
return _sname.substring(0, _maxlen);
- if (this.isSQL92CheckEnabled()){
+ }
+ if (this.isSQL92CheckEnabled())
+ {
return Desktop.removeSpecialCharacters(xMSF, Configuration.getOfficeLocale(xMSF), _sname);
}
return _sname;
}
-
- private void setDataSourceByName(String _DataSourceName, boolean bgetInterfaces) {
- try {
+ private void setDataSourceByName(String _DataSourceName, boolean bgetInterfaces)
+ {
+ try
+ {
this.DataSourceName = _DataSourceName;
Object oDataSource = xNameAccess.getByName(DataSourceName);
xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, oDataSource);
getDataSourceInterfaces();
- XDocumentDataSource xDocu = (XDocumentDataSource)UnoRuntime.queryInterface(XDocumentDataSource.class,this.xDataSource);
- if ( xDocu != null )
+ XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, this.xDataSource);
+ if (xDocu != null)
+ {
xModel = xDocu.getDatabaseDocument();
- } catch (Exception exception) {
+ }
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
- public void getDataSourceInterfaces() throws Exception{
+ public void getDataSourceInterfaces() throws Exception
+ {
xCompleted = (XCompletedConnection) UnoRuntime.queryInterface(XCompletedConnection.class, xDataSource);
xDataSourcePropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDataSource);
bPasswordIsRequired = ((Boolean) xDataSourcePropertySet.getPropertyValue("IsPasswordRequired")).booleanValue();
}
-
- public boolean getConnection(PropertyValue[] curproperties){
- try {
- com.sun.star.sdbc.XConnection xConnection = null;
- if (Properties.hasPropertyValue(curproperties, "ActiveConnection"))
+ public boolean getConnection(PropertyValue[] curproperties)
+ {
+ try
{
- xConnection = (com.sun.star.sdbc.XConnection) AnyConverter.toObject(com.sun.star.sdbc.XConnection.class,
- Properties.getPropertyValue(curproperties, "ActiveConnection"));
- if (xConnection !=null)
+ com.sun.star.sdbc.XConnection xConnection = null;
+ if (Properties.hasPropertyValue(curproperties, "ActiveConnection"))
{
- com.sun.star.container.XChild child = (com.sun.star.container.XChild)UnoRuntime.queryInterface(com.sun.star.container.XChild.class, xConnection);
-
- xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, child.getParent());
- XDocumentDataSource xDocu = (XDocumentDataSource)UnoRuntime.queryInterface(XDocumentDataSource.class,this.xDataSource);
- if ( xDocu != null )
- xModel = xDocu.getDatabaseDocument();
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDataSource);
- if ( xPSet != null )
- DataSourceName = AnyConverter.toString(xPSet.getPropertyValue("Name"));
- return getConnection(xConnection);
+ xConnection = (com.sun.star.sdbc.XConnection) AnyConverter.toObject(com.sun.star.sdbc.XConnection.class,
+ Properties.getPropertyValue(curproperties, "ActiveConnection"));
+ if (xConnection != null)
+ {
+ com.sun.star.container.XChild child = (com.sun.star.container.XChild) UnoRuntime.queryInterface(com.sun.star.container.XChild.class, xConnection);
+
+ xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, child.getParent());
+ XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, this.xDataSource);
+ if (xDocu != null)
+ {
+ xModel = xDocu.getDatabaseDocument();
+ }
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDataSource);
+ if (xPSet != null)
+ {
+ DataSourceName = AnyConverter.toString(xPSet.getPropertyValue("Name"));
+ }
+ return getConnection(xConnection);
+ }
+ else
+ {
+ bdisposeConnection = true;
+ }
}
else
+ {
bdisposeConnection = true;
+ }
+ if (Properties.hasPropertyValue(curproperties, "DataSourceName"))
+ {
+ String sDataSourceName = AnyConverter.toString(Properties.getPropertyValue(curproperties, "DataSourceName"));
+ return getConnection(sDataSourceName);
+ }
+ else if (Properties.hasPropertyValue(curproperties, "DataSource"))
+ {
+ xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, Properties.getPropertyValue(curproperties, "DataSource"));
+ XDocumentDataSource xDocu = (XDocumentDataSource) UnoRuntime.queryInterface(XDocumentDataSource.class, this.xDataSource);
+ if (xDocu != null)
+ {
+ xModel = xDocu.getDatabaseDocument();
+ }
+ return getConnection(xDataSource);
+ }
+ if (Properties.hasPropertyValue(curproperties, "DatabaseLocation"))
+ {
+ String sDataSourceName = AnyConverter.toString(Properties.getPropertyValue(curproperties, "DatabaseLocation"));
+ return getConnection(sDataSourceName);
+ }
+ else if (xConnection != null)
+ {
+ bdisposeConnection = false;
+ return getConnection(xConnection);
+ }
}
- else
- bdisposeConnection = true;
- if (Properties.hasPropertyValue(curproperties, "DataSourceName")){
- String sDataSourceName = AnyConverter.toString(Properties.getPropertyValue(curproperties, "DataSourceName"));
- return getConnection(sDataSourceName);
- }
- else if (Properties.hasPropertyValue(curproperties, "DataSource")){
- xDataSource = (XDataSource) UnoRuntime.queryInterface(XDataSource.class, Properties.getPropertyValue(curproperties, "DataSource"));
- XDocumentDataSource xDocu = (XDocumentDataSource)UnoRuntime.queryInterface(XDocumentDataSource.class,this.xDataSource);
- if ( xDocu != null )
- xModel = xDocu.getDatabaseDocument();
- return getConnection(xDataSource);
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
}
- if (Properties.hasPropertyValue(curproperties, "DatabaseLocation")){
- String sDataSourceName = AnyConverter.toString(Properties.getPropertyValue(curproperties, "DatabaseLocation"));
- return getConnection(sDataSourceName);
+ catch (UnknownPropertyException e)
+ {
+ e.printStackTrace(System.out);
}
- else if (xConnection !=null){
- bdisposeConnection = false;
- return getConnection(xConnection);
+ catch (WrappedTargetException e)
+ {
+ e.printStackTrace(System.out);
}
- } catch (IllegalArgumentException e){
- e.printStackTrace(System.out);
- }
- catch (UnknownPropertyException e)
- {
- e.printStackTrace(System.out);
- }
- catch (WrappedTargetException e)
- {
- e.printStackTrace(System.out);
- }
- return false;
+ return false;
}
-
- private boolean getConnection(String _DataSourceName) {
+ private boolean getConnection(String _DataSourceName)
+ {
setDataSourceByName(_DataSourceName, true);
return getConnection(xDataSource);
}
+ private boolean getConnection(com.sun.star.sdbc.XConnection _DBConnection)
+ {
+ try
+ {
+ this.DBConnection = _DBConnection;
+ this.ConnectionTools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, this.DBConnection);
+ getDataSourceObjects();
+ return true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
+ }
- private boolean getConnection(com.sun.star.sdbc.XConnection _DBConnection){
- try {
- this.DBConnection = _DBConnection;
- this.ConnectionTools = (XConnectionTools)UnoRuntime.queryInterface( XConnectionTools.class, this.DBConnection );
- getDataSourceObjects();
- return true;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return false;
- }}
-
-
- private boolean getConnection(XDataSource xDataSource){
- Resource oResource = new Resource(xMSF, "Database", "dbw");
- try {
- int iMsg = 0;
- boolean bgetConnection = false;
- if (DBConnection != null)
- xConnectionComponent.dispose();
- getDataSourceInterfaces();
- if (bPasswordIsRequired == false) {
- DBConnection = xDataSource.getConnection("", "");
- bgetConnection = true;
- } else {
- XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.sdb.InteractionHandler");
- XInteractionHandler oInteractionHandler = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler);
- boolean bExitLoop = true;
- do {
- XCompletedConnection xCompleted = (XCompletedConnection) UnoRuntime.queryInterface(XCompletedConnection.class, xDataSource);
- try {
- DBConnection = xCompleted.connectWithCompletion(oInteractionHandler);
- bgetConnection = DBConnection != null;
- if (bgetConnection == false)
- bExitLoop = true;
- } catch (Exception exception) {
- // Note: WindowAttributes from toolkit/source/awt/vclxtoolkit.cxx
- String sMsgNoConnection = oResource.getResText(RID_DB_COMMON + 14);
- iMsg = showMessageBox( "QueryBox", VclWindowPeerAttribute.RETRY_CANCEL, sMsgNoConnection);
- bExitLoop = iMsg == 0;
- bgetConnection = false;
+ private boolean getConnection(XDataSource xDataSource)
+ {
+ Resource oResource = new Resource(xMSF, "Database", "dbw");
+ try
+ {
+ int iMsg = 0;
+ boolean bgetConnection = false;
+ if (DBConnection != null)
+ {
+ xConnectionComponent.dispose();
+ }
+ getDataSourceInterfaces();
+ if (bPasswordIsRequired == false)
+ {
+ DBConnection = xDataSource.getConnection("", "");
+ bgetConnection = true;
+ }
+ else
+ {
+ XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.sdb.InteractionHandler");
+ XInteractionHandler oInteractionHandler2 = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xInteractionHandler);
+ boolean bExitLoop = true;
+ do
+ {
+ XCompletedConnection xCompleted2 = (XCompletedConnection) UnoRuntime.queryInterface(XCompletedConnection.class, xDataSource);
+ try
+ {
+ DBConnection = xCompleted2.connectWithCompletion(oInteractionHandler2);
+ bgetConnection = DBConnection != null;
+ if (bgetConnection == false)
+ {
+ bExitLoop = true;
+ }
+ }
+ catch (Exception exception)
+ {
+ // Note: WindowAttributes from toolkit/source/awt/vclxtoolkit.cxx
+ String sMsgNoConnection = oResource.getResText(RID_DB_COMMON + 14);
+ iMsg = showMessageBox("QueryBox", VclWindowPeerAttribute.RETRY_CANCEL, sMsgNoConnection);
+ bExitLoop = iMsg == 0;
+ bgetConnection = false;
+ }
}
- } while (bExitLoop == false);
+ while (bExitLoop == false);
+ }
+ if (bgetConnection == false)
+ {
+ String sMsgConnectionImpossible = oResource.getResText(RID_DB_COMMON + 35);
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgConnectionImpossible);
+ }
+ else
+ {
+ xConnectionComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, DBConnection);
+ ConnectionTools = (XConnectionTools) UnoRuntime.queryInterface(XConnectionTools.class, DBConnection);
+ getDataSourceObjects();
+ }
+ return bgetConnection;
}
- if (bgetConnection == false){
+ catch (Exception exception)
+ {
String sMsgConnectionImpossible = oResource.getResText(RID_DB_COMMON + 35);
showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgConnectionImpossible);
+ exception.printStackTrace(System.out);
+ return false;
}
- else {
- xConnectionComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, DBConnection);
- ConnectionTools = (XConnectionTools)UnoRuntime.queryInterface( XConnectionTools.class, DBConnection );
- getDataSourceObjects();
+ }
+
+ public int getMaxColumnNameLength()
+ {
+ try
+ {
+ if (iMaxColumnNameLength <= 0)
+ {
+ iMaxColumnNameLength = xDBMetaData.getMaxColumnNameLength();
+ }
+ return iMaxColumnNameLength;
}
- return bgetConnection;
- } catch (Exception exception) {
- String sMsgConnectionImpossible = oResource.getResText(RID_DB_COMMON + 35);
- showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgConnectionImpossible);
- exception.printStackTrace(System.out);
- return false;
- }}
-
-
- public int getMaxColumnNameLength(){
- try {
- if (iMaxColumnNameLength <= 0)
- iMaxColumnNameLength = xDBMetaData.getMaxColumnNameLength();
- return iMaxColumnNameLength;
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- return 0;
- }}
-
-
- public int getMaxTableNameLength(){
- try {
- if (iMaxTableNameLength <= 0)
- iMaxTableNameLength = xDBMetaData.getMaxTableNameLength();
- return iMaxTableNameLength;
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- return 0;
- }}
-
-
- public boolean supportsCoreSQLGrammar(){
- try {
- return xDBMetaData.supportsCoreSQLGrammar();
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- return false;
- }}
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ return 0;
+ }
+ }
+ public int getMaxTableNameLength()
+ {
+ try
+ {
+ if (iMaxTableNameLength <= 0)
+ {
+ iMaxTableNameLength = xDBMetaData.getMaxTableNameLength();
+ }
+ return iMaxTableNameLength;
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ return 0;
+ }
+ }
- public boolean supportsAutoIncrementation(){
- return false;
+ public boolean supportsCoreSQLGrammar()
+ {
+ try
+ {
+ return xDBMetaData.supportsCoreSQLGrammar();
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
}
+ public boolean supportsAutoIncrementation()
+ {
+ return false;
+ }
/**
* inserts a Query to a datasource; There is no validation if the queryname is already existing in the datasource
* @param oQuery
* @param QueryName
*/
- public boolean createQuery(SQLQueryComposer _oSQLQueryComposer, String _QueryName) {
- try {
+ public boolean createQuery(SQLQueryComposer _oSQLQueryComposer, String _QueryName)
+ {
+ try
+ {
XQueryDefinitionsSupplier xQueryDefinitionsSuppl = (XQueryDefinitionsSupplier) UnoRuntime.queryInterface(XQueryDefinitionsSupplier.class, xDataSource);
XNameAccess xQueryDefs = xQueryDefinitionsSuppl.getQueryDefinitions();
XSingleServiceFactory xSSFQueryDefs = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, xQueryDefs);
Object oQuery = xSSFQueryDefs.createInstance(); //"com.sun.star.sdb.QueryDefinition"
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oQuery);
- String s = _oSQLQueryComposer.xQueryAnalyzer.getQuery();
- xPSet.setPropertyValue("Command", _oSQLQueryComposer.xQueryAnalyzer.getQuery());
+
+ String s = _oSQLQueryComposer.m_xQueryAnalyzer.getQuery();
+ xPSet.setPropertyValue("Command", s);
+
XNameContainer xNameCont = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xQueryDefs);
XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xQueryDefs);
- ConnectionTools.getObjectNames().checkNameForCreate(com.sun.star.sdb.CommandType.QUERY,_QueryName);
+ ConnectionTools.getObjectNames().checkNameForCreate(com.sun.star.sdb.CommandType.QUERY, _QueryName);
xNameCont.insertByName(_QueryName, oQuery);
return true;
- } catch( WrappedTargetException exception ) {
+ }
+ catch (WrappedTargetException exception)
+ {
SQLException sqlError = null;
- try { sqlError = (SQLException)exception.TargetException; }
- catch( ClassCastException castError ) { }
+ try
+ {
+ sqlError = (SQLException) exception.TargetException;
+ }
+ catch (ClassCastException castError)
+ {
+ }
- if ( sqlError != null ) {
- callSQLErrorMessageDialog( sqlError, null );
+ if (sqlError != null)
+ {
+ callSQLErrorMessageDialog(sqlError, null);
return false;
}
exception.printStackTrace(System.out);
}
- catch (SQLException exception) {
+ catch (SQLException exception)
+ {
callSQLErrorMessageDialog(exception, null);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
return false;
}
- public void dispose() {
+ public void dispose()
+ {
if ((DBConnection != null) && (this.bdisposeConnection))
+ {
xConnectionComponent.dispose();
+ }
}
- public XHierarchicalNameAccess getReportDocuments(){
+ public XHierarchicalNameAccess getReportDocuments()
+ {
XReportDocumentsSupplier xReportDocumentSuppl = (XReportDocumentsSupplier) UnoRuntime.queryInterface(XReportDocumentsSupplier.class, this.xModel);
xReportDocumentSuppl.getReportDocuments();
XHierarchicalNameAccess xReportHier = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments());
return xReportHier;
}
-
- public XHierarchicalNameAccess getFormDocuments(){
+ public XHierarchicalNameAccess getFormDocuments()
+ {
XFormDocumentsSupplier xFormDocumentSuppl = (XFormDocumentsSupplier) UnoRuntime.queryInterface(XFormDocumentsSupplier.class, xModel);
XHierarchicalNameAccess xFormHier = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments());
return xFormHier;
}
- public boolean hasFormDocumentByName(String _sFormName){
+ public boolean hasFormDocumentByName(String _sFormName)
+ {
XFormDocumentsSupplier xFormDocumentSuppl = (XFormDocumentsSupplier) UnoRuntime.queryInterface(XFormDocumentsSupplier.class, xModel);
XNameAccess xFormNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xFormDocumentSuppl.getFormDocuments());
return xFormNameAccess.hasByName(_sFormName);
}
-
- public void addFormDocument(XComponent _xComponent){
+ public void addFormDocument(XComponent _xComponent)
+ {
XHierarchicalNameAccess _xFormDocNameAccess = getFormDocuments();
addDatabaseDocument(_xComponent, _xFormDocNameAccess, false);
}
- public void addReportDocument(XComponent _xComponent, boolean _bcreatedynamicreport){
+ public void addReportDocument(XComponent _xComponent, boolean _bcreatedynamicreport)
+ {
XHierarchicalNameAccess xReportDocNameAccess = getReportDocuments();
addDatabaseDocument(_xComponent, xReportDocNameAccess, _bcreatedynamicreport);
}
@@ -711,165 +864,203 @@ public class DBMetaData {
/**
* adds the passed document as a report or a form to the database. Afterwards the document is deleted.
* the document may not be open
- * @param xComponent
- * @param _bIsForm describes the type of the document: "form" or "report"
+ * @param _xComponent
+ * @param _xDocNameAccess
+ * @param _bcreateTemplate describes the type of the document: "form" or "report"
*/
- public void addDatabaseDocument(XComponent _xComponent, XHierarchicalNameAccess _xDocNameAccess, boolean _bcreateTemplate){
- try {
- PropertyValue[] aDocProperties;
- XModel xDocumentModel = (XModel) UnoRuntime.queryInterface(XModel.class, _xComponent);
- String sPath = xDocumentModel.getURL();
- String basename = FileAccess.getBasename(sPath, "/");
- XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, _xComponent);
- _xComponent.dispose();
- xCloseable.close(false);
- if (_bcreateTemplate)
- aDocProperties = new PropertyValue[5];
- else
- aDocProperties = new PropertyValue[4];
- aDocProperties[0] = Properties.createProperty("Name", basename);
- aDocProperties[1] = Properties.createProperty("Parent", _xDocNameAccess);
- aDocProperties[2] = Properties.createProperty("URL", sPath);
- aDocProperties[3] = Properties.createProperty("DocumentTitle", basename);
- if (_bcreateTemplate)
- aDocProperties[4] = Properties.createProperty("AsTemplate", new Boolean(_bcreateTemplate));
- XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, _xDocNameAccess);
- Object oDBDocument = xDocMSF.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", aDocProperties);
- XHierarchicalNameContainer xHier = (XHierarchicalNameContainer) UnoRuntime.queryInterface(XHierarchicalNameContainer.class, _xDocNameAccess);
- String sdocname = Desktop.getUniqueName(_xDocNameAccess, basename);
- xHier.insertByHierarchicalName(sdocname, oDBDocument);
- XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
- XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
- xSimpleFileAccess.kill(sPath);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
-
- public XComponent[] openDatabaseDocument(String _docname, boolean _bAsTemplate, boolean _bOpenInDesign, XHierarchicalNameAccess _xDocuments){
+ public void addDatabaseDocument(XComponent _xComponent, XHierarchicalNameAccess _xDocNameAccess, boolean _bcreateTemplate)
+ {
+ try
+ {
+ PropertyValue[] aDocProperties;
+ XModel xDocumentModel = (XModel) UnoRuntime.queryInterface(XModel.class, _xComponent);
+ String sPath = xDocumentModel.getURL();
+ String basename = FileAccess.getBasename(sPath, "/");
+ XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, _xComponent);
+ _xComponent.dispose();
+ xCloseable.close(false);
+ if (_bcreateTemplate)
+ {
+ aDocProperties = new PropertyValue[5];
+ }
+ else
+ {
+ aDocProperties = new PropertyValue[4];
+ }
+ aDocProperties[0] = Properties.createProperty("Name", basename);
+ aDocProperties[1] = Properties.createProperty("Parent", _xDocNameAccess);
+ aDocProperties[2] = Properties.createProperty("URL", sPath);
+ aDocProperties[3] = Properties.createProperty("DocumentTitle", basename);
+ if (_bcreateTemplate)
+ {
+ aDocProperties[4] = Properties.createProperty("AsTemplate", new Boolean(_bcreateTemplate));
+ }
+ XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, _xDocNameAccess);
+ Object oDBDocument = xDocMSF.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", aDocProperties);
+ XHierarchicalNameContainer xHier = (XHierarchicalNameContainer) UnoRuntime.queryInterface(XHierarchicalNameContainer.class, _xDocNameAccess);
+ String sdocname = Desktop.getUniqueName(_xDocNameAccess, basename);
+ xHier.insertByHierarchicalName(sdocname, oDBDocument);
+ XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
+ xSimpleFileAccess.kill(sPath);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public XComponent[] openDatabaseDocument(String _docname, boolean _bAsTemplate, boolean _bOpenInDesign, XHierarchicalNameAccess _xDocuments)
+ {
XComponent[] xRetComponent = new XComponent[2];
- try {
+ try
+ {
XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, _xDocuments);
PropertyValue[] aPropertyValues = new PropertyValue[4];
- aPropertyValues[0] = Properties.createProperty("OpenMode", _bOpenInDesign ? "openDesign": "open" );
+ aPropertyValues[0] = Properties.createProperty("OpenMode", _bOpenInDesign ? "openDesign" : "open");
aPropertyValues[1] = Properties.createProperty("ActiveConnection", this.DBConnection);
aPropertyValues[2] = Properties.createProperty("DocumentTitle", _docname);
aPropertyValues[3] = Properties.createProperty("AsTemplate", new Boolean(_bAsTemplate));
XHierarchicalNameContainer xHier = (XHierarchicalNameContainer) UnoRuntime.queryInterface(XHierarchicalNameContainer.class, _xDocuments);
- if (xHier.hasByHierarchicalName(_docname)){
- xRetComponent[0] = (XComponent)UnoRuntime.queryInterface(XComponent.class, xHier.getByHierarchicalName(_docname));
+ if (xHier.hasByHierarchicalName(_docname))
+ {
+ xRetComponent[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, xHier.getByHierarchicalName(_docname));
xRetComponent[1] = xComponentLoader.loadComponentFromURL(_docname, "", 0, aPropertyValues);
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return xRetComponent;
}
-
- public XComponent[] openFormDocument(String _sformname, boolean _bOpenInDesign){
+ public XComponent[] openFormDocument(String _sformname, boolean _bOpenInDesign)
+ {
XHierarchicalNameAccess xFormDocuments = getFormDocuments();
return openDatabaseDocument(_sformname, false, _bOpenInDesign, xFormDocuments);
}
-
- public XComponent[] openReportDocument(String _sreportname, boolean _bAsTemplate, boolean _bOpenInDesign){
+ public XComponent[] openReportDocument(String _sreportname, boolean _bAsTemplate, boolean _bOpenInDesign)
+ {
XHierarchicalNameAccess xReportDocuments = getReportDocuments();
return openDatabaseDocument(_sreportname, _bAsTemplate, _bOpenInDesign, xReportDocuments);
}
-
- public void createTypeInspector() throws SQLException{
+ public void createTypeInspector() throws SQLException
+ {
oTypeInspector = new TypeInspector(xDBMetaData.getTypeInfo());
}
-
- public TypeInspector getDBDataTypeInspector(){
+ public TypeInspector getDBDataTypeInspector()
+ {
return oTypeInspector;
}
-
- private String[] StringsFromResultSet(XResultSet _xResultSet, int _icol){
+ private String[] StringsFromResultSet(XResultSet _xResultSet, int _icol)
+ {
String[] sColValues = null;
- try {
+ try
+ {
XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, _xResultSet);
Vector aColVector = new Vector();
- while (_xResultSet.next()){
+ while (_xResultSet.next())
+ {
aColVector.addElement(xRow.getString(_icol));
}
sColValues = new String[aColVector.size()];
aColVector.toArray(sColValues);
- } catch (SQLException e) {
+ }
+ catch (SQLException e)
+ {
e.printStackTrace();
}
return sColValues;
}
- public String[] getCatalogNames(){
- try {
+ public String[] getCatalogNames()
+ {
+ try
+ {
XResultSet xResultSet = xDBMetaData.getCatalogs();
return StringsFromResultSet(xResultSet, 1);
- } catch (SQLException e) {
+ }
+ catch (SQLException e)
+ {
e.printStackTrace(System.out);
return null;
}
}
-
- public String[] getSchemaNames(){
- try {
+ public String[] getSchemaNames()
+ {
+ try
+ {
XResultSet xResultSet = xDBMetaData.getSchemas();
return StringsFromResultSet(xResultSet, 1);
- } catch (SQLException e) {
+ }
+ catch (SQLException e)
+ {
e.printStackTrace(System.out);
return null;
}
}
+ public boolean storeDatabaseDocumentToTempPath(XComponent _xcomponent, String _storename)
+ {
+ try
+ {
+ XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
+ String storepath = FileAccess.getOfficePath(xMSF, "Temp", xSimpleFileAccess) + "/" + _storename;
+ XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, _xcomponent);
+ PropertyValue[] oStoreProperties = new PropertyValue[1];
+ oStoreProperties[0] = Properties.createProperty("FilterName", "writer8");
+ storepath += ".odt";
+ xStoreable.storeAsURL(storepath, oStoreProperties);
+ return true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
+ }
- public boolean storeDatabaseDocumentToTempPath(XComponent _xcomponent, String _storename){
- try{
- XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
- XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
- String storepath = FileAccess.getOfficePath(xMSF, "Temp", xSimpleFileAccess) + "/" + _storename;
- XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, _xcomponent);
- PropertyValue[] oStoreProperties = new PropertyValue[1];
- oStoreProperties[0] = Properties.createProperty("FilterName", "writer8");
- storepath += ".odt";
- xStoreable.storeAsURL(storepath, oStoreProperties);
- return true;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return false;
- }}
-
-
- public int showMessageBox(String windowServiceName, int windowAttribute, String MessageText) {
+ public int showMessageBox(String windowServiceName, int windowAttribute, String MessageText)
+ {
if (getWindowPeer() != null)
+ {
return SystemDialog.showMessageBox(xMSF, xWindowPeer, windowServiceName, windowAttribute, MessageText);
+ }
else
+ {
return SystemDialog.showMessageBox(xMSF, windowServiceName, windowAttribute, MessageText);
+ }
}
-
/**
* @return Returns the xWindowPeer.
*/
- public XWindowPeer getWindowPeer() {
+ public XWindowPeer getWindowPeer()
+ {
return xWindowPeer;
}
+
/**
* @param windowPeer The xWindowPeer to set.
* Should be called as soon as a Windowpeer of a wizard dialog is available
* The windowpeer is needed to call a Messagebox
*/
- public void setWindowPeer(XWindowPeer windowPeer) {
+ public void setWindowPeer(XWindowPeer windowPeer)
+ {
xWindowPeer = windowPeer;
}
- public void callSQLErrorMessageDialog(SQLException oSQLException, XWindow _xWindow){
- try {
+ public void callSQLErrorMessageDialog(SQLException oSQLException, XWindow _xWindow)
+ {
+ try
+ {
Object oDialog = xMSF.createInstance("com.sun.star.sdb.ErrorMessageDialog");
XInitialization xInitialization = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oDialog);
PropertyValue[] aPropertyValue = new PropertyValue[2];
@@ -878,10 +1069,15 @@ public class DBMetaData {
xInitialization.initialize(aPropertyValue);
XExecutableDialog xExecutableDialog = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, oDialog);
xExecutableDialog.execute();
- } catch (com.sun.star.uno.Exception ex) {
- ex.printStackTrace();
- }}
- public void finish(){
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public void finish()
+ {
xTableNames = null;
xQueryNames = null;
oInteractionHandler = null;
diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java
index 4638a05045a8..2b2826b40d02 100644
--- a/wizards/com/sun/star/wizards/db/FieldColumn.java
+++ b/wizards/com/sun/star/wizards/db/FieldColumn.java
@@ -31,20 +31,22 @@ package com.sun.star.wizards.db;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XNameAccess;
-import com.sun.star.lang.IllegalArgumentException;
+// import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.sdbc.DataType;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.common.*;
-public class FieldColumn {
+public class FieldColumn
+{
+
public Object DefaultValue;
- public String FieldName;
- public String DisplayFieldName;
- public String FieldTitle;
+ public String m_sFieldName;
+ private String m_sDisplayFieldName;
+ private String FieldTitle;
public int ColIndex;
- public String CommandName;
+ private String m_sCommandName;
public int FieldWidth;
public int DBFormatKey;
public int FieldType;
@@ -59,323 +61,390 @@ public class FieldColumn {
protected int iTimeFormatKey;
protected int iLogicalFormatKey;
- public FieldColumn(CommandMetaData oCommandMetaData, String _DisplayFieldName) {
- DisplayFieldName = _DisplayFieldName;
- CommandName = oCommandMetaData.getCommandName();
- FieldName = getFieldName(DisplayFieldName, CommandName);
- FieldTitle = _DisplayFieldName; // oCommandMetaData.getFieldTitle(FieldName);
- FieldTitle = FieldName;
- DBMetaData.CommandObject oTable = oCommandMetaData.getTableByName(CommandName);
+ public FieldColumn(CommandMetaData oCommandMetaData, String _DisplayFieldName)
+ {
+ m_sDisplayFieldName = _DisplayFieldName;
+ m_sCommandName = oCommandMetaData.getCommandName();
+ m_sFieldName = getOnlyFieldName(m_sDisplayFieldName, m_sCommandName);
+// TODO: could be wrong here!
+ FieldTitle = _DisplayFieldName; // oCommandMetaData.getFieldTitle(m_sFieldName);
+ FieldTitle = m_sFieldName;
+ DBMetaData.CommandObject oTable = oCommandMetaData.getTableByName(m_sCommandName);
setFormatKeys(oCommandMetaData, oTable.xColumns);
}
-
- public FieldColumn(CommandMetaData oCommandMetaData, String _FieldName, String _CommandName, boolean _bInstantiateByDisplayName) {
- CommandName = _CommandName;
- if (_bInstantiateByDisplayName){
- DisplayFieldName = _FieldName;
- FieldName = getFieldName(_FieldName, _CommandName);
+ public FieldColumn(CommandMetaData oCommandMetaData, String _FieldName, String _CommandName, boolean _bInstantiateByDisplayName)
+ {
+ m_sCommandName = _CommandName;
+ if (_bInstantiateByDisplayName)
+ {
+ m_sDisplayFieldName = _FieldName;
+ m_sFieldName = getOnlyFieldName(_FieldName, _CommandName);
}
- else{
- FieldName = _FieldName;
- DisplayFieldName = composeDisplayFieldName(FieldName, _CommandName);
+ else
+ {
+ m_sFieldName = _FieldName;
+ m_sDisplayFieldName = composeDisplayFieldName(_CommandName, m_sFieldName);
}
- FieldTitle = FieldName;
- DBMetaData.CommandObject oTable = oCommandMetaData.getTableByName(CommandName);
+ FieldTitle = m_sFieldName;
+ DBMetaData.CommandObject oTable = oCommandMetaData.getTableByName(m_sCommandName);
setFormatKeys(oCommandMetaData, oTable.xColumns);
}
-
- public FieldColumn(CommandMetaData oCommandMetaData, XNameAccess _xColumns, String _FieldName) {
- FieldName = _FieldName;
- FieldTitle = FieldName;
- DisplayFieldName = FieldName;
- ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), FieldName) + 1;
+ public FieldColumn(CommandMetaData oCommandMetaData, XNameAccess _xColumns, String _FieldName)
+ {
+ m_sFieldName = _FieldName;
+ FieldTitle = m_sFieldName;
+ m_sDisplayFieldName = m_sFieldName;
+ ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1;
setFormatKeys(oCommandMetaData, _xColumns);
}
-
- private String getFieldName(String _DisplayFieldName, String _CommandName){
- return _DisplayFieldName.substring(_CommandName.length()+1, _DisplayFieldName.length());
+ /**
+ * Remove the pre name, we want the name after the 'dot'
+ * @param _DisplayFieldName
+ * @param _CommandName
+ * @return
+ */
+ private String getOnlyFieldName(String _DisplayFieldName, String _CommandName)
+ {
+ final String sName = _DisplayFieldName.substring(_CommandName.length() + 1, _DisplayFieldName.length());
+ return sName;
}
-
- public static String composeDisplayFieldName(String _sFieldName, String _sCommandName){
+ public static String composeDisplayFieldName(String _sCommandName, String _sFieldName)
+ {
return _sCommandName + "." + _sFieldName;
}
- private void setFormatKeys(CommandMetaData oCommandMetaData, XNameAccess _xColumns){
- try {
- m_xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(FieldName));
- ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), FieldName) + 1;
- iType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type"));
- iDateFormatKey = oCommandMetaData.getNumberFormatter().getDateFormatKey();
- iDateTimeFormatKey = oCommandMetaData.getNumberFormatter().getDateTimeFormatKey();
- iNumberFormatKey = oCommandMetaData.getNumberFormatter().getNumberFormatKey();
- iTextFormatKey = oCommandMetaData.getNumberFormatter().getTextFormatKey();
- iTimeFormatKey = oCommandMetaData.getNumberFormatter().getTimeFormatKey();
- iLogicalFormatKey = oCommandMetaData.getNumberFormatter().getLogicalFormatKey();
- DefaultValue = getTyperelatedFieldData();
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- public XPropertySet getXColumnPropertySet(){
+ private void setFormatKeys(CommandMetaData oCommandMetaData, XNameAccess _xColumns)
+ {
+ try
+ {
+ m_xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(m_sFieldName));
+ ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1;
+ iType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type"));
+
+ final NumberFormatter aNumberFormatter = oCommandMetaData.getNumberFormatter();
+ iDateFormatKey = aNumberFormatter.getDateFormatKey();
+ iDateTimeFormatKey = aNumberFormatter.getDateTimeFormatKey();
+ iNumberFormatKey = aNumberFormatter.getNumberFormatKey();
+ iTextFormatKey = aNumberFormatter.getTextFormatKey();
+ iTimeFormatKey = aNumberFormatter.getTimeFormatKey();
+ iLogicalFormatKey = aNumberFormatter.getLogicalFormatKey();
+
+ DefaultValue = getTyperelatedFieldData();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public XPropertySet getXColumnPropertySet()
+ {
return m_xColPropertySet;
}
+ public void setCommandName(String _CommandName)
+ {
+ m_sCommandName = _CommandName;
+ }
- public void setCommandName(String _CommandName) {
- CommandName = _CommandName;
+ public String getDisplayFieldName()
+ {
+ return m_sDisplayFieldName;
}
+ public String getCommandName()
+ {
+ return m_sCommandName;
+ }
- public String getCommandName() {
- return CommandName;
+ public String getFieldName()
+ {
+ return m_sFieldName;
}
+ public String getFieldTitle()
+ {
+ return FieldTitle;
+ }
- public String getFieldName(){
- return FieldName;
+ public void setFieldTitle(String _sTitle)
+ {
+ FieldTitle = _sTitle;
}
- public static String getCommandName(String _DisplayName) {
+ public static String getCommandName(String _DisplayName)
+ {
String locCommandName = null;
String[] sFieldMetaData = JavaTools.ArrayoutofString(_DisplayName, ".");
- if (sFieldMetaData.length >= 2) {
+ if (sFieldMetaData.length >= 2)
+ {
String locfieldname = sFieldMetaData[sFieldMetaData.length - 1];
locCommandName = _DisplayName.substring(0, _DisplayName.length() - locfieldname.length() - 1);
}
return locCommandName;
}
- public int getFormatKey() {
- try {
- int iKey;
- Object oKey = m_xColPropertySet.getPropertyValue( "FormatKey");
- if (AnyConverter.isVoid(oKey))
- DBFormatKey = StandardFormatKey;
- else
- DBFormatKey = AnyConverter.toInt(oKey);
- return DBFormatKey;
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- return StandardFormatKey;
- }}
-
-
- public boolean isBoolean(){
- boolean bIsBoolean = false;
- try{
- FieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type"));
- switch (FieldType) {
- case DataType.BIT : // == -7;
- case DataType.BOOLEAN :
- bIsBoolean = true;
- break;
- default:
- bIsBoolean = false;
+ public int getFormatKey()
+ {
+ try
+ {
+ // int iKey;
+ int nDBFormatKey;
+ Object oKey = m_xColPropertySet.getPropertyValue("FormatKey");
+ if (AnyConverter.isVoid(oKey))
+ {
+ nDBFormatKey = StandardFormatKey;
+ }
+ else
+ {
+ nDBFormatKey = AnyConverter.toInt(oKey);
+ }
+ return nDBFormatKey;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return StandardFormatKey;
}
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
}
+
+ public boolean isBoolean()
+ {
+ boolean bIsBoolean = false;
+ try
+ {
+ FieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type"));
+ switch (FieldType)
+ {
+ case DataType.BIT: // == -7;
+ case DataType.BOOLEAN:
+ bIsBoolean = true;
+ break;
+ default:
+ bIsBoolean = false;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
return bIsBoolean;
}
- private Object getTyperelatedFieldData() {
- try {
+ private Object getTyperelatedFieldData()
+ {
+ try
+ {
FieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type"));
- switch (FieldType) {
- case DataType.BIT : // == -7;
- case DataType.BOOLEAN :
+ switch (FieldType)
+ {
+ case DataType.BIT: // == -7;
+ case DataType.BOOLEAN:
// Todo: Look if the defaultvalue has been set in the Datasource
StandardFormatKey = iLogicalFormatKey;
FieldWidth = 5;
bIsNumberFormat = true;
break;
- case DataType.TINYINT : // == -6;
+ case DataType.TINYINT: // == -6;
StandardFormatKey = iNumberFormatKey;
FieldWidth = 5;
bIsNumberFormat = true;
break;
- case DataType.SMALLINT : // == 5;
+ case DataType.SMALLINT: // == 5;
StandardFormatKey = iNumberFormatKey;
FieldWidth = 5;
bIsNumberFormat = true;
break;
- case DataType.INTEGER : // == 4;
+ case DataType.INTEGER: // == 4;
StandardFormatKey = iNumberFormatKey;
FieldWidth = 10;
bIsNumberFormat = true;
break;
- case DataType.BIGINT : // == -5;
+ case DataType.BIGINT: // == -5;
StandardFormatKey = iNumberFormatKey;
FieldWidth = 15;
bIsNumberFormat = true;
break;
- case DataType.CHAR : // == 1;
+ case DataType.CHAR: // == 1;
StandardFormatKey = iTextFormatKey;
getTextFieldWidth(10);
bIsNumberFormat = false;
break;
- case DataType.VARCHAR : // == 12;
+ case DataType.VARCHAR: // == 12;
StandardFormatKey = iTextFormatKey;
getTextFieldWidth(30);
bIsNumberFormat = false;
break;
- case DataType.LONGVARCHAR : // == -1;
+ case DataType.LONGVARCHAR: // == -1;
StandardFormatKey = iTextFormatKey;
getTextFieldWidth(60);
bIsNumberFormat = false;
break;
- case DataType.NUMERIC : // == 2;
+ case DataType.NUMERIC: // == 2;
StandardFormatKey = iNumberFormatKey;
FieldWidth = 20;
bIsNumberFormat = true;
break;
- case DataType.DECIMAL : // == 3; [mit Nachkommastellen]
+ case DataType.DECIMAL: // == 3; [mit Nachkommastellen]
StandardFormatKey = iNumberFormatKey;
FieldWidth = 10 + AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Scale")) + 1;
bIsNumberFormat = true;
break;
- case DataType.FLOAT : // == 6;
+ case DataType.FLOAT: // == 6;
StandardFormatKey = iNumberFormatKey;
FieldWidth = 10 + AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Scale")) + 1;
bIsNumberFormat = true;
break;
- case DataType.REAL : // == 7;
+ case DataType.REAL: // == 7;
StandardFormatKey = iNumberFormatKey;
FieldWidth = 10 + AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Scale")) + 1;
bIsNumberFormat = true;
break;
- case DataType.DOUBLE : // == 8;
+ case DataType.DOUBLE: // == 8;
StandardFormatKey = iNumberFormatKey;
FieldWidth = 10 + AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Scale")) + 1;
bIsNumberFormat = true;
break;
- case DataType.DATE : // == 91;
+ case DataType.DATE: // == 91;
StandardFormatKey = iDateFormatKey;
FieldWidth = 10;
bIsNumberFormat = true;
break;
- case DataType.TIME : // == 92;
+ case DataType.TIME: // == 92;
StandardFormatKey = iTimeFormatKey;
FieldWidth = 10;
bIsNumberFormat = true;
break;
- case DataType.TIMESTAMP : // == 93;
+ case DataType.TIMESTAMP: // == 93;
StandardFormatKey = iDateTimeFormatKey;
FieldWidth = 20;
bIsNumberFormat = true;
break;
}
DBFormatKey = getFormatKey();
+ // TODO: the DefaultValue is not set in this function!!!
return DefaultValue;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- private void getTextFieldWidth(int iWidth) {
- int iNewWidth = iWidth;
- try {
+ private void getTextFieldWidth(int iWidth)
+ {
+ // int iNewWidth = iWidth;
+ try
+ {
FieldWidth = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Precision"));
- if (FieldWidth > 0) {
+ if (FieldWidth > 0)
+ {
if (FieldWidth > (2 * iWidth))
+ {
FieldWidth = 2 * iWidth;
+ }
else if (FieldWidth == 0)
+ {
FieldWidth = iWidth;
+ }
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public Object getDefaultValue() {
- switch (FieldType) {
- case DataType.BIT : // == -7;
+ public Object getDefaultValue()
+ {
+ switch (FieldType)
+ {
+ case DataType.BIT: // == -7;
case DataType.BOOLEAN:
DefaultValue = (Object) Integer.valueOf("1");
break;
- case DataType.TINYINT : // == -6;
+ case DataType.TINYINT: // == -6;
DefaultValue = (Object) Integer.valueOf("98");
break;
- case DataType.SMALLINT : // == 5;
+ case DataType.SMALLINT: // == 5;
DefaultValue = (Object) Integer.valueOf("987");
break;
- case DataType.INTEGER : // == 4;
+ case DataType.INTEGER: // == 4;
DefaultValue = (Object) Integer.valueOf("9876");
break;
- case DataType.BIGINT : // == -5;
+ case DataType.BIGINT: // == -5;
DefaultValue = (Object) Integer.valueOf("98765");
break;
- case DataType.CHAR : // == 1;
+ case DataType.CHAR: // == 1;
DefaultValue = (Object) String.valueOf('x');
break;
- case DataType.VARCHAR : // == 12;
+ case DataType.VARCHAR: // == 12;
DefaultValue = (Object) BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
break;
- case DataType.LONGVARCHAR : // == -1;
+ case DataType.LONGVARCHAR: // == -1;
DefaultValue = (Object) BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
break;
- case DataType.NUMERIC : // == 2;
+ case DataType.NUMERIC: // == 2;
DefaultValue = (Object) Double.valueOf("9876.5");
break;
- case DataType.DECIMAL : // == 3; [mit Nachkommastellen]
+ case DataType.DECIMAL: // == 3; [mit Nachkommastellen]
DefaultValue = (Object) Double.valueOf("9876.5");
break;
- case DataType.FLOAT : // == 6;
+ case DataType.FLOAT: // == 6;
DefaultValue = (Object) Double.valueOf("9876.5");
break;
- case DataType.REAL : // == 7;
+ case DataType.REAL: // == 7;
DefaultValue = (Object) Double.valueOf("9876.5");
break;
- case DataType.DOUBLE : // == 8;
+ case DataType.DOUBLE: // == 8;
DefaultValue = (Object) Double.valueOf("9876.54");
break;
- case DataType.DATE : // == 91;
+ case DataType.DATE: // == 91;
DefaultValue = (Object) Double.valueOf("42510");
break;
- case DataType.TIME : // == 92;
+ case DataType.TIME: // == 92;
DefaultValue = (Object) Double.valueOf("10");
break;
- case DataType.TIMESTAMP : // == 93;
+ case DataType.TIMESTAMP: // == 93;
DefaultValue = (Object) Double.valueOf("5454110");
break;
- default :
+ default:
break;
}
return DefaultValue;
diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java
index 9e481ae56e75..44b8833be6ea 100644
--- a/wizards/com/sun/star/wizards/db/QueryMetaData.java
+++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java
@@ -36,47 +36,64 @@ import java.util.*;
import com.sun.star.lang.Locale;
import com.sun.star.wizards.common.*;
-public class QueryMetaData extends CommandMetaData {
+public class QueryMetaData extends CommandMetaData
+{
FieldColumn CurFieldColumn;
public String Command;
- Vector CommandNamesV;
- public PropertyValue[][] FilterConditions = new PropertyValue[][] {};
- public PropertyValue[][] GroupByFilterConditions = new PropertyValue[][] {};
- public String[] UniqueAggregateFieldNames = new String[]{};
+ // Vector CommandNamesV;
+ private PropertyValue[][] m_aFilterConditions; /* = new PropertyValue[][] {}; */
+
+ public PropertyValue[][] GroupByFilterConditions = new PropertyValue[][]
+ {
+ };
+ public String[] UniqueAggregateFieldNames = new String[]
+ {
+ };
public int Type = QueryType.SODETAILQUERY;
- public static interface QueryType {
+ public static interface QueryType
+ {
+
final static int SOSUMMARYQUERY = 0;
final static int SODETAILQUERY = 1;
-
}
- public QueryMetaData(XMultiServiceFactory xMSF, Locale CharLocale, NumberFormatter oNumberFormatter) {
+ public QueryMetaData(XMultiServiceFactory xMSF, Locale CharLocale, NumberFormatter oNumberFormatter)
+ {
super(xMSF, CharLocale, oNumberFormatter);
}
- public QueryMetaData(XMultiServiceFactory _xMSF) {
+ public QueryMetaData(XMultiServiceFactory _xMSF)
+ {
super(_xMSF);
}
- public void setFilterConditions(PropertyValue[][] _FilterConditions) {
- this.FilterConditions = _FilterConditions;
+ public void setFilterConditions(PropertyValue[][] _FilterConditions)
+ {
+ this.m_aFilterConditions = _FilterConditions;
}
- public PropertyValue[][] getFilterConditions() {
- return this.FilterConditions;
+ public PropertyValue[][] getFilterConditions()
+ {
+ if (m_aFilterConditions == null)
+ {
+ m_aFilterConditions = new PropertyValue[][]
+ {
+ };
+ }
+ return m_aFilterConditions;
}
- public void setGroupByFilterConditions(PropertyValue[][] _GroupByFilterConditions) {
+ public void setGroupByFilterConditions(PropertyValue[][] _GroupByFilterConditions)
+ {
this.GroupByFilterConditions = _GroupByFilterConditions;
}
- public PropertyValue[][] getGroupByFilterConditions() {
+ public PropertyValue[][] getGroupByFilterConditions()
+ {
return this.GroupByFilterConditions;
}
-
-
// public void addFieldColumn(String _FieldName, String _sCommandName){
// FieldColumn oFieldColumn = getFieldColumn(_FieldName, _sCommandName);
// if (oFieldColumn == null){
@@ -86,83 +103,88 @@ public class QueryMetaData extends CommandMetaData {
// FieldColumns = LocFieldColumns;
// }
// }
-
-
- public void addSeveralFieldColumns(String[] _FieldNames, String _sCommandName){
+ public void addSeveralFieldColumns(String[] _FieldNames, String _sCommandName)
+ {
Vector oToBeAddedFieldColumns = new Vector();
- for (int i = 0; i < _FieldNames.length; i++){
+ for (int i = 0; i < _FieldNames.length; i++)
+ {
FieldColumn oFieldColumn = getFieldColumn(_FieldNames[i], _sCommandName);
- if (oFieldColumn == null){
- oToBeAddedFieldColumns.add( new FieldColumn(this, _FieldNames[i], _sCommandName, false));
+ if (oFieldColumn == null)
+ {
+ oToBeAddedFieldColumns.add(new FieldColumn(this, _FieldNames[i], _sCommandName, false));
}
}
- if (oToBeAddedFieldColumns.size() > 0){
+ if (oToBeAddedFieldColumns.size() > 0)
+ {
int nOldFieldCount = FieldColumns.length;
FieldColumn[] LocFieldColumns = new FieldColumn[nOldFieldCount + oToBeAddedFieldColumns.size()];
System.arraycopy(FieldColumns, 0, LocFieldColumns, 0, nOldFieldCount);
- for (int i = 0; i < oToBeAddedFieldColumns.size(); i++){
+ for (int i = 0; i < oToBeAddedFieldColumns.size(); i++)
+ {
LocFieldColumns[nOldFieldCount + i] = (FieldColumn) oToBeAddedFieldColumns.elementAt(i);
}
FieldColumns = LocFieldColumns;
}
}
-
- public void reorderFieldColumns(String[] _sDisplayFieldNames){
+ public void reorderFieldColumns(String[] _sDisplayFieldNames)
+ {
FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length];
- for (int i = 0; i < _sDisplayFieldNames.length; i++){
+ for (int i = 0; i < _sDisplayFieldNames.length; i++)
+ {
FieldColumn LocFieldColumn = this.getFieldColumnByDisplayName(_sDisplayFieldNames[i]);
LocFieldColumns[i] = LocFieldColumn;
}
System.arraycopy(LocFieldColumns, 0, FieldColumns, 0, LocFieldColumns.length);
}
-
- public void removeSeveralFieldColumnsByDisplayFieldName(String[] _DisplayFieldNames){
+ public void removeSeveralFieldColumnsByDisplayFieldName(String[] _DisplayFieldNames)
+ {
Vector oRemainingFieldColumns = new Vector();
int a = 0;
- for (int n = 0; n < FieldColumns.length; n++){
- String sDisplayFieldName = FieldColumns[n].DisplayFieldName;
- if (!(JavaTools.FieldInList(_DisplayFieldNames, sDisplayFieldName) > -1)){
+ for (int n = 0; n < FieldColumns.length; n++)
+ {
+ String sDisplayFieldName = FieldColumns[n].getDisplayFieldName();
+ if (!(JavaTools.FieldInList(_DisplayFieldNames, sDisplayFieldName) > -1))
+ {
oRemainingFieldColumns.add(FieldColumns[n]);
}
}
FieldColumns = new FieldColumn[oRemainingFieldColumns.size()];
oRemainingFieldColumns.toArray(FieldColumns);
- }
-
+ }
public void removeFieldColumn(String _sFieldName, String _sCommandName)
+ {
+ FieldColumn oFieldColumn = getFieldColumn(_sFieldName, _sCommandName);
+ int a = 0;
+ if (oFieldColumn != null)
{
- FieldColumn oFieldColumn = getFieldColumn(_sFieldName, _sCommandName);
- int a = 0;
- if (oFieldColumn != null)
+ FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length - 1];
+ for (int i = 0; i < FieldColumns.length; i++)
{
- FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length -1];
- for (int i = 0; i < FieldColumns.length;i++)
+ if (!FieldColumns[i].m_sFieldName.equals(_sFieldName))
{
- if (!FieldColumns[i].FieldName.equals(_sFieldName))
+ if (!FieldColumns[i].getCommandName().equals(_sCommandName))
{
- if (!FieldColumns[i].CommandName.equals(_sCommandName))
- {
- LocFieldColumns[a] = FieldColumns[i];
- a++;
- }
+ LocFieldColumns[a] = FieldColumns[i];
+ a++;
}
}
- FieldColumns = LocFieldColumns;
}
+ FieldColumns = LocFieldColumns;
}
+ }
-
- public String[] getIncludedCommandNames() {
- FieldColumn CurQueryField;
- CommandNamesV = new Vector(1);
- String CurCommandName;
+ public String[] getIncludedCommandNames()
+ {
+ // FieldColumn CurQueryField;
+ Vector CommandNamesV = new Vector(1);
+ // String CurCommandName;
for (int i = 0; i < FieldColumns.length; i++)
{
- CurQueryField = FieldColumns[i];
- CurCommandName = CurQueryField.getCommandName();
+ final FieldColumn CurQueryField = FieldColumns[i];
+ final String CurCommandName = CurQueryField.getCommandName();
if (!CommandNamesV.contains(CurCommandName))
{
CommandNamesV.addElement(CurCommandName);
@@ -173,10 +195,11 @@ public class QueryMetaData extends CommandMetaData {
return sIncludedCommandNames;
}
-
- public static String[] getIncludedCommandNames(String[] _FieldNames) {
+ public static String[] getIncludedCommandNames(String[] _FieldNames)
+ {
Vector CommandNames = new Vector(1);
- for (int i = 0; i < _FieldNames.length; i++) {
+ for (int i = 0; i < _FieldNames.length; i++)
+ {
String CurCommandName = "";
String[] MetaList = JavaTools.ArrayoutofString(_FieldNames[i], ".");
if (MetaList.length > 1)
@@ -196,27 +219,31 @@ public class QueryMetaData extends CommandMetaData {
return sIncludedCommandNames;
}
- public String[] getFieldNamesOfCommand(String _sCommandName){
+ public String[] getFieldNamesOfCommand(String _sCommandName)
+ {
CommandObject oTable = getTableByName(_sCommandName);
return oTable.xColumns.getElementNames();
}
- public void initializeFieldTitleSet(boolean _bAppendMode) {
- try {
- this.getIncludedCommandNames(); // fills the var CommandNamesV indirectly :-(
+ public void initializeFieldTitleSet(boolean _bAppendMode)
+ {
+ try
+ {
+ // this.getIncludedCommandNames(); // fills the var CommandNamesV indirectly :-(
if (FieldTitleSet == null)
{
FieldTitleSet = new HashMap();
}
- for (int i = 0; i < CommandNamesV.size(); i++)
+ String[] aCommandNames = getIncludedCommandNames();
+ for (int i = 0; i < aCommandNames.length; i++)
{
- CommandObject oTable = getTableByName((String) CommandNamesV.elementAt(i));
+ CommandObject oTable = getTableByName(aCommandNames[i]);
String sTableName = oTable.Name;
String[] LocFieldNames = oTable.xColumns.getElementNames();
for (int a = 0; a < LocFieldNames.length; a++)
{
- String sDisplayFieldName = FieldColumn.composeDisplayFieldName(LocFieldNames[a], sTableName);
+ String sDisplayFieldName = FieldColumn.composeDisplayFieldName(sTableName, LocFieldNames[a]);
if (!FieldTitleSet.containsKey(sDisplayFieldName))
{
FieldTitleSet.put(sDisplayFieldName, LocFieldNames[a]);
@@ -230,10 +257,11 @@ public class QueryMetaData extends CommandMetaData {
}
}
-
- public String[] getUniqueAggregateFieldNames(){
+ public String[] getUniqueAggregateFieldNames()
+ {
Vector UniqueAggregateFieldVector = new Vector(0);
- for (int i = 0; i < AggregateFieldNames.length; i++) {
+ for (int i = 0; i < AggregateFieldNames.length; i++)
+ {
if (!UniqueAggregateFieldVector.contains(AggregateFieldNames[i][0]))
{
UniqueAggregateFieldVector.add(AggregateFieldNames[i][0]);
@@ -244,7 +272,6 @@ public class QueryMetaData extends CommandMetaData {
return UniqueAggregateFieldNames;
}
-
public boolean hasNumericalFields()
{
for (int i = 0; i < FieldColumns.length; i++)
@@ -257,9 +284,8 @@ public class QueryMetaData extends CommandMetaData {
return false;
}
-
-
- public int getAggregateIndex(String _DisplayFieldName){
+ public int getAggregateIndex(String _DisplayFieldName)
+ {
int iAggregate = -1;
if (Type == QueryType.SOSUMMARYQUERY)
{
@@ -267,5 +293,4 @@ public class QueryMetaData extends CommandMetaData {
}
return iAggregate;
}
-
}
diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java
index 7dace146960c..4de36970acae 100644
--- a/wizards/com/sun/star/wizards/db/RecordParser.java
+++ b/wizards/com/sun/star/wizards/db/RecordParser.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.db;
+ ************************************************************************/
+package com.sun.star.wizards.db;
import com.sun.star.awt.XWindow;
import com.sun.star.lang.XMultiServiceFactory;
@@ -48,7 +49,9 @@ import com.sun.star.wizards.common.NumberFormatter;
import com.sun.star.sdbc.XResultSet;
import com.sun.star.task.XInteractionHandler;
-public class RecordParser extends QueryMetaData {
+public class RecordParser extends QueryMetaData
+{
+
XNameAccess xColumns;
com.sun.star.sdbc.XRow xRow;
com.sun.star.sdbc.XRow xResultSetRow;
@@ -61,127 +64,149 @@ public class RecordParser extends QueryMetaData {
public FieldColumn[] GroupFieldColumns;
public FieldColumn[] RecordFieldColumns;
- public RecordParser(XMultiServiceFactory _xMSF, Locale _aLocale, NumberFormatter _oNumberFormatter) {
+ public RecordParser(XMultiServiceFactory _xMSF, Locale _aLocale, NumberFormatter _oNumberFormatter)
+ {
super(_xMSF, _aLocale, _oNumberFormatter);
getInterfaces();
}
/** Creates a new instance of RecordParser */
- public RecordParser(XMultiServiceFactory _xMSF) {
+ public RecordParser(XMultiServiceFactory _xMSF)
+ {
super(_xMSF);
getInterfaces();
}
- private void getInterfaces() {
- try {
+ private void getInterfaces()
+ {
+ try
+ {
xRowSet = (XInterface) xMSF.createInstance("com.sun.star.sdb.RowSet");
xRowSetColumnsSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xRowSet);
xRowSetComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xRowSet);
xExecute = (com.sun.star.sdb.XCompletedExecution) UnoRuntime.queryInterface(com.sun.star.sdb.XCompletedExecution.class, xRowSet);
XInterface oInteraction = (XInterface) xMSF.createInstance("com.sun.star.sdb.InteractionHandler");
xInteraction = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, oInteraction);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- private Object getColumnStringValue(int ColIndex) {
- try {
+ private Object getColumnStringValue(int ColIndex)
+ {
+ try
+ {
com.sun.star.uno.Type CurType;
Object oAny;
String sValue = xResultSetRow.getString(ColIndex); //???
CurType = new com.sun.star.uno.Type(String.class);
oAny = AnyConverter.toObject(CurType, sValue);
return oAny;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- private Object getColumnDoubleValue(int ColIndex, boolean bisDate) {
- try {
+ private Object getColumnDoubleValue(int ColIndex, boolean bisDate)
+ {
+ try
+ {
Double DblValue;
if (bisDate)
+ {
DblValue = new Double(xResultSetRow.getDouble(ColIndex) + (double) super.getNullDateCorrection());
+ }
else
+ {
DblValue = new Double(xResultSetRow.getDouble(ColIndex));
+ }
if (!xResultSetRow.wasNull())
+ {
return DblValue;
- } catch (Exception exception) {
+ }
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
return Any.VOID;
}
- public Object getColumnValue(int ColIndex, int iType) {
+ public Object getColumnValue(int ColIndex, int iType)
+ {
boolean bResult;
Object oAny = Any.VOID;
- switch (iType) {
- case DataType.BIT : // == -7;
- case DataType.BOOLEAN :
+ switch (iType)
+ {
+ case DataType.BIT: // == -7;
+ case DataType.BOOLEAN:
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.TINYINT : // == -6;
+ case DataType.TINYINT: // == -6;
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.BIGINT : // == -5;
+ case DataType.BIGINT: // == -5;
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.CHAR : // == 1;
+ case DataType.CHAR: // == 1;
oAny = getColumnStringValue(ColIndex);
break;
- case DataType.VARCHAR : // == 12;
+ case DataType.VARCHAR: // == 12;
oAny = getColumnStringValue(ColIndex);
// double sResult = xResultSetRow.getClob(ColIndex); //???
break;
- case DataType.LONGVARCHAR : // == -1;
+ case DataType.LONGVARCHAR: // == -1;
oAny = getColumnStringValue(ColIndex);
// double sResult = xResultSetRow.getCharacterStream(ColIndex);
break;
- case DataType.NUMERIC : // == 2;
+ case DataType.NUMERIC: // == 2;
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.INTEGER : // == 4;
+ case DataType.INTEGER: // == 4;
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.SMALLINT : // == 5;
+ case DataType.SMALLINT: // == 5;
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.DECIMAL : // == 3; [mit Nachkommastellen]
+ case DataType.DECIMAL: // == 3; [mit Nachkommastellen]
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.FLOAT : // == 6;
+ case DataType.FLOAT: // == 6;
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.REAL : // == 7;
+ case DataType.REAL: // == 7;
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.DOUBLE : // == 8;
+ case DataType.DOUBLE: // == 8;
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.DATE : // == 91;
+ case DataType.DATE: // == 91;
oAny = getColumnDoubleValue(ColIndex, true);
break;
- case DataType.TIME : // == 92;
+ case DataType.TIME: // == 92;
oAny = getColumnDoubleValue(ColIndex, false);
break;
- case DataType.TIMESTAMP : // == 93;
+ case DataType.TIMESTAMP: // == 93;
oAny = getColumnDoubleValue(ColIndex, true);
break;
}
@@ -191,76 +216,82 @@ public class RecordParser extends QueryMetaData {
return oAny;
}
-
- public boolean executeCommand(int _nCommandType) throws InvalidQueryException {
- try {
- Helper.setUnoPropertyValue(xRowSet, "DataSourceName", DataSourceName);
- Helper.setUnoPropertyValue(xRowSet, "ActiveConnection", DBConnection);
- Helper.setUnoPropertyValue(xRowSet, "Command", Command);
- Helper.setUnoPropertyValue(xRowSet, "CommandType", new Integer(_nCommandType)); // CommandType
- xExecute.executeWithCompletion(xInteraction);
- com.sun.star.sdb.XResultSetAccess xResultAccess = (com.sun.star.sdb.XResultSetAccess) UnoRuntime.queryInterface(com.sun.star.sdb.XResultSetAccess.class, xRowSet);
- ResultSet = xResultAccess.createResultSet();
- xResultSetRow = (com.sun.star.sdbc.XRow) UnoRuntime.queryInterface(com.sun.star.sdbc.XRow.class, ResultSet);
- XColumnsSupplier xDBCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, ResultSet);
- xColumns = xDBCols.getColumns();
- setCommandType(_nCommandType);
- return true;
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- throw new InvalidQueryException(xMSF, Command);
- }}
-
-
-
- public boolean getFields(String[] _sFieldNames, boolean binitializeDBColumns)
- {
- try
+ public boolean executeCommand(int _nCommandType) throws InvalidQueryException
{
- if (binitializeDBColumns == true)
+ try
{
- initializeFieldColumns(_sFieldNames, xColumns);
+ Helper.setUnoPropertyValue(xRowSet, "DataSourceName", DataSourceName);
+ Helper.setUnoPropertyValue(xRowSet, "ActiveConnection", DBConnection);
+ Helper.setUnoPropertyValue(xRowSet, "Command", Command);
+ Helper.setUnoPropertyValue(xRowSet, "CommandType", new Integer(_nCommandType)); // CommandType
+ xExecute.executeWithCompletion(xInteraction);
+ com.sun.star.sdb.XResultSetAccess xResultAccess = (com.sun.star.sdb.XResultSetAccess) UnoRuntime.queryInterface(com.sun.star.sdb.XResultSetAccess.class, xRowSet);
+ ResultSet = xResultAccess.createResultSet();
+ xResultSetRow = (com.sun.star.sdbc.XRow) UnoRuntime.queryInterface(com.sun.star.sdbc.XRow.class, ResultSet);
+ XColumnsSupplier xDBCols = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, ResultSet);
+ xColumns = xDBCols.getColumns();
+ setCommandType(_nCommandType);
+ return true;
}
- String[] AllQueryFieldNames = xColumns.getElementNames();
- String[] sFieldNames = getFieldNames();
- for (int i = 0; i < FieldColumns.length; i++)
+ catch (Exception exception)
{
- String sFieldName = FieldColumns[i].FieldName;
- int nColIndex = JavaTools.FieldInList(AllQueryFieldNames, sFieldName) + 1;
- FieldColumns[i].ColIndex = nColIndex;
- if (nColIndex == -1)
- {
- throw new InvalidQueryException(xMSF, Command);
- }
+ exception.printStackTrace(System.out);
+ throw new InvalidQueryException(xMSF, Command);
}
- GroupFieldColumns = getFieldColumnList(GroupFieldNames);
- RecordFieldColumns = getFieldColumnList(getRecordFieldNames());
- return true;
}
- catch (InvalidQueryException queryexception)
+
+ public boolean getFields(String[] _sFieldNames, boolean binitializeDBColumns)
{
- queryexception.printStackTrace(System.out);
- return false;
- }
+ try
+ {
+ if (binitializeDBColumns == true)
+ {
+ initializeFieldColumns(_sFieldNames, xColumns);
+ }
+ String[] AllQueryFieldNames = xColumns.getElementNames();
+ String[] sFieldNames = getFieldNames();
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ String sFieldName = FieldColumns[i].m_sFieldName;
+ int nColIndex = JavaTools.FieldInList(AllQueryFieldNames, sFieldName) + 1;
+ FieldColumns[i].ColIndex = nColIndex;
+ if (nColIndex == -1)
+ {
+ throw new InvalidQueryException(xMSF, Command);
+ }
+ }
+ GroupFieldColumns = getFieldColumnList(GroupFieldNames);
+ RecordFieldColumns = getFieldColumnList(getRecordFieldNames());
+ return true;
+ }
+ catch (InvalidQueryException queryexception)
+ {
+ queryexception.printStackTrace(System.out);
+ return false;
+ }
}
-
- private FieldColumn[] getFieldColumnList(String[] _FieldNames) {
+ private FieldColumn[] getFieldColumnList(String[] _FieldNames)
+ {
FieldColumn[] LocFieldColumns = new FieldColumn[_FieldNames.length];
- for (int i = 0; i < _FieldNames.length; i++) {
+ for (int i = 0; i < _FieldNames.length; i++)
+ {
LocFieldColumns[i] = super.getFieldColumnByFieldName(_FieldNames[i]);
}
return LocFieldColumns;
}
- public Object getGroupColumnValue(int ColIndex) {
+ public Object getGroupColumnValue(int ColIndex)
+ {
FieldColumn CurDBFieldColumn = this.GroupFieldColumns[ColIndex];
return getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.FieldType);
}
- public boolean getcurrentRecordData(java.util.Vector DataVector) {
- Object[] RecordValueArray = new Object[RecordFieldColumns.length];
- for (int i = 0; i < RecordFieldColumns.length; i++) {
+ public boolean getcurrentRecordData(java.util.Vector DataVector)
+ {
+ Object[] RecordValueArray = new Object[RecordFieldColumns.length];
+ for (int i = 0; i < RecordFieldColumns.length; i++)
+ {
FieldColumn CurDBFieldColumn = this.RecordFieldColumns[i];
RecordValueArray[i] = getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.FieldType); //FinalColIndex
}
@@ -268,10 +299,12 @@ public class RecordParser extends QueryMetaData {
return true;
}
-
- public void dispose() {
+ public void dispose()
+ {
if (xRowSetComponent != null)
+ {
xRowSetComponent.dispose();
+ }
super.dispose();
}
}
diff --git a/wizards/com/sun/star/wizards/db/RelationController.java b/wizards/com/sun/star/wizards/db/RelationController.java
index cf14918f6ef4..a292cd3c8775 100644
--- a/wizards/com/sun/star/wizards/db/RelationController.java
+++ b/wizards/com/sun/star/wizards/db/RelationController.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.db;
import java.util.Vector;
@@ -49,95 +48,122 @@ import com.sun.star.wizards.common.JavaTools;
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
-public class RelationController extends CommandName {
- private int PKTABLE_CAT = 1;
- private int PKTABLE_SCHEM = 2;
- private int PKTABLE_NAME = 3;
- private int PKCOLUMN_NAME = 4;
+public class RelationController extends CommandName
+{
- private int FKTABLE_CAT = 5;
- private int FKTABLE_SCHEM = 6;
- private int FKTABLE_NAME = 7;
- private int FKCOLUMN_NAME = 8;
+ private int PKTABLE_CAT = 1;
+ private int PKTABLE_SCHEM = 2;
+ private int PKTABLE_NAME = 3;
+ private int PKCOLUMN_NAME = 4;
+ private int FKTABLE_CAT = 5;
+ private int FKTABLE_SCHEM = 6;
+ private int FKTABLE_NAME = 7;
+ private int FKCOLUMN_NAME = 8;
- public RelationController(CommandMetaData _CommandMetaData, String _CatalogName, String _SchemaName, String _TableName, boolean _baddQuotation){
+ public RelationController(CommandMetaData _CommandMetaData, String _CatalogName, String _SchemaName, String _TableName, boolean _baddQuotation)
+ {
super(_CommandMetaData, _CatalogName, _SchemaName, _TableName, _baddQuotation);
}
-
- public RelationController(CommandMetaData _CommandMetaData, String _DisplayName){
+ public RelationController(CommandMetaData _CommandMetaData, String _DisplayName)
+ {
super(_CommandMetaData, _DisplayName);
}
-
- public String[] getExportedKeys(){
- String[] sReferencedTableNames = new String[]{};
- try {
- String[] sTableNames = super.getCommandMetaData().getTableNames();
- Vector aReferencedTableVector = new Vector();
- XResultSet xResultSet = super.getCommandMetaData().xDBMetaData.getExportedKeys((getCatalogName(this)), getSchemaName(), getTableName());
- XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet);
- while (xResultSet.next()){
- String sForeignCatalog = xRow.getString(FKTABLE_CAT);
- String sForeignScheme = xRow.getString(FKTABLE_SCHEM);
- String sForeignTableName = xRow.getString(FKTABLE_NAME);
- CommandName oCommandName = new CommandName(getCommandMetaData(), sForeignCatalog, sForeignScheme, sForeignTableName, false);
- aReferencedTableVector.add(oCommandName.getComposedName());
+ public String[] getExportedKeys()
+ {
+ String[] sReferencedTableNames = new String[]
+ {
+ };
+ try
+ {
+ String[] sTableNames = super.getCommandMetaData().getTableNames();
+ Vector aReferencedTableVector = new Vector();
+ XResultSet xResultSet = super.getCommandMetaData().xDBMetaData.getExportedKeys((getCatalogName(this)), getSchemaName(), getTableName());
+ XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet);
+ while (xResultSet.next())
+ {
+ String sForeignCatalog = xRow.getString(FKTABLE_CAT);
+ String sForeignScheme = xRow.getString(FKTABLE_SCHEM);
+ String sForeignTableName = xRow.getString(FKTABLE_NAME);
+ CommandName oCommandName = new CommandName(getCommandMetaData(), sForeignCatalog, sForeignScheme, sForeignTableName, false);
+ aReferencedTableVector.add(oCommandName.getComposedName());
+ }
+ sReferencedTableNames = new String[aReferencedTableVector.size()];
+ aReferencedTableVector.toArray(sReferencedTableNames);
}
- sReferencedTableNames = new String[aReferencedTableVector.size()];
- aReferencedTableVector.toArray(sReferencedTableNames);
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- }
- return sReferencedTableNames;
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return sReferencedTableNames;
}
- private Object getCatalogName(CommandName _oCommandName){
+ private Object getCatalogName(CommandName _oCommandName)
+ {
String sLocCatalog = _oCommandName.getCatalogName();
if (sLocCatalog.equals(""))
+ {
return null;
+ }
else
+ {
return sLocCatalog;
+ }
}
- public String[][] getImportedKeyColumns(String _sreferencedtablename){
- String[][] sKeyColumnNames = new String[][]{};
- try {
- CommandName oLocCommandName = new CommandName(super.getCommandMetaData(), _sreferencedtablename);
- XResultSet xResultSet = super.getCommandMetaData().xDBMetaData.getImportedKeys(getCatalogName(oLocCommandName),oLocCommandName.getSchemaName(), _sreferencedtablename);
- XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet);
- boolean bleaveLoop = false;
- Vector aMasterFieldNamesVector = new Vector();
- Vector aSlaveFieldNamesVector = new Vector();
- while (xResultSet.next() && !bleaveLoop){
- String sPrimaryCatalog = null;
- String sPrimarySchema = null;
- if (super.getCommandMetaData().xDBMetaData.supportsCatalogsInDataManipulation())
- sPrimaryCatalog = xRow.getString(PKTABLE_CAT);
- if (super.getCommandMetaData().xDBMetaData.supportsCatalogsInDataManipulation())
- sPrimarySchema = xRow.getString(PKTABLE_SCHEM);
- String sPrimaryTableName = xRow.getString(PKTABLE_NAME);
- String sPrimaryColumnName = xRow.getString(PKCOLUMN_NAME);
- String sForeignColumnName = xRow.getString(FKCOLUMN_NAME);
- if (JavaTools.isSame(getTableName(), sPrimaryTableName )){
- if (JavaTools.isSame(getSchemaName(), sPrimarySchema )){
- if (JavaTools.isSame(getCatalogName(), sPrimaryCatalog)){
- aSlaveFieldNamesVector.add(sForeignColumnName);
- aMasterFieldNamesVector.add(sPrimaryColumnName);
- bleaveLoop = true; //Only one relation may exist between two tables...
- }
+ public String[][] getImportedKeyColumns(String _sreferencedtablename)
+ {
+ String[][] sKeyColumnNames = new String[][]
+ {
+ };
+ try
+ {
+ CommandName oLocCommandName = new CommandName(super.getCommandMetaData(), _sreferencedtablename);
+ XResultSet xResultSet = super.getCommandMetaData().xDBMetaData.getImportedKeys(getCatalogName(oLocCommandName), oLocCommandName.getSchemaName(), _sreferencedtablename);
+ XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet);
+ boolean bleaveLoop = false;
+ Vector aMasterFieldNamesVector = new Vector();
+ Vector aSlaveFieldNamesVector = new Vector();
+ while (xResultSet.next() && !bleaveLoop)
+ {
+ String sPrimaryCatalog = null;
+ String sPrimarySchema = null;
+ if (super.getCommandMetaData().xDBMetaData.supportsCatalogsInDataManipulation())
+ {
+ sPrimaryCatalog = xRow.getString(PKTABLE_CAT);
}
+ if (super.getCommandMetaData().xDBMetaData.supportsCatalogsInDataManipulation())
+ {
+ sPrimarySchema = xRow.getString(PKTABLE_SCHEM);
+ }
+ String sPrimaryTableName = xRow.getString(PKTABLE_NAME);
+ String sPrimaryColumnName = xRow.getString(PKCOLUMN_NAME);
+ String sForeignColumnName = xRow.getString(FKCOLUMN_NAME);
+ if (JavaTools.isSame(getTableName(), sPrimaryTableName))
+ {
+ if (JavaTools.isSame(getSchemaName(), sPrimarySchema))
+ {
+ if (JavaTools.isSame(getCatalogName(), sPrimaryCatalog))
+ {
+ aSlaveFieldNamesVector.add(sForeignColumnName);
+ aMasterFieldNamesVector.add(sPrimaryColumnName);
+ bleaveLoop = true; //Only one relation may exist between two tables...
+ }
+ }
+ }
}
+ sKeyColumnNames = new String[2][aMasterFieldNamesVector.size()];
+ sKeyColumnNames[0] = new String[aSlaveFieldNamesVector.size()];
+ sKeyColumnNames[1] = new String[aMasterFieldNamesVector.size()];
+ aSlaveFieldNamesVector.toArray(sKeyColumnNames[0]);
+ aMasterFieldNamesVector.toArray(sKeyColumnNames[1]);
}
- sKeyColumnNames = new String[2][aMasterFieldNamesVector.size()];
- sKeyColumnNames[0] = new String[aSlaveFieldNamesVector.size()];
- sKeyColumnNames[1] = new String[aMasterFieldNamesVector.size()];
- aSlaveFieldNamesVector.toArray(sKeyColumnNames[0]);
- aMasterFieldNamesVector.toArray(sKeyColumnNames[1]);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return sKeyColumnNames;
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return sKeyColumnNames;
}
}
diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
index 53d9c677e7c5..c8e419a86161 100644
--- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
+++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
@@ -31,15 +31,15 @@ package com.sun.star.wizards.db;
import java.util.Vector;
-import com.sun.star.lang.IllegalArgumentException;
-import com.sun.star.lang.WrappedTargetException;
+// import com.sun.star.lang.IllegalArgumentException;
+// import com.sun.star.lang.WrappedTargetException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.beans.*;
-import com.sun.star.container.NoSuchElementException;
+// import com.sun.star.container.NoSuchElementException;
import com.sun.star.container.XIndexAccess;
-import com.sun.star.container.XNameAccess;
+// import com.sun.star.container.XNameAccess;
import com.sun.star.sdbcx.XColumnsSupplier;
-import com.sun.star.sdb.XColumn;
+// import com.sun.star.sdb.XColumn;
import com.sun.star.sdb.XSQLQueryComposer;
import com.sun.star.sdb.XSQLQueryComposerFactory;
import com.sun.star.sdb.XSingleSelectQueryComposer;
@@ -54,232 +54,275 @@ import com.sun.star.awt.XWindow;
import com.sun.star.wizards.common.*;
-public class SQLQueryComposer {
+public class SQLQueryComposer
+{
public XColumnsSupplier xColSuppl;
- XSQLQueryComposerFactory xSQLComposerFactory;
- XSQLQueryComposer xSQLQueryComposer;
+ // XSQLQueryComposer xSQLQueryComposer;
QueryMetaData CurDBMetaData;
- String selectclause;
- String fromclause;
- public XSingleSelectQueryAnalyzer xQueryAnalyzer;
+ // String m_sSelectClause;
+ // String m_sFromClause;
+ public XSingleSelectQueryAnalyzer m_xQueryAnalyzer;
Vector composedCommandNames = new Vector(1);
- public XSingleSelectQueryComposer xQueryComposer;
+ public XSingleSelectQueryComposer m_xQueryComposer;
XMultiServiceFactory xMSF;
boolean bincludeGrouping = true;
- public SQLQueryComposer(QueryMetaData _CurDBMetaData) {
- try {
+ public SQLQueryComposer(QueryMetaData _CurDBMetaData)
+ {
+ try
+ {
this.CurDBMetaData = _CurDBMetaData;
xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, CurDBMetaData.DBConnection);
- Object oQueryComposer = xMSF.createInstance("com.sun.star.sdb.SingleSelectQueryComposer");
- xQueryAnalyzer = (XSingleSelectQueryAnalyzer) UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, oQueryComposer);
- xQueryComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, xQueryAnalyzer);
+ final Object oQueryComposer = xMSF.createInstance("com.sun.star.sdb.SingleSelectQueryComposer");
+ m_xQueryAnalyzer = (XSingleSelectQueryAnalyzer) UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, oQueryComposer);
+ m_xQueryComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, m_xQueryAnalyzer);
+ XSQLQueryComposerFactory xSQLComposerFactory;
xSQLComposerFactory = (XSQLQueryComposerFactory) UnoRuntime.queryInterface(XSQLQueryComposerFactory.class, CurDBMetaData.DBConnection);
- XSQLQueryComposer xSQLComposer = xSQLComposerFactory.createQueryComposer();
- } catch (Exception exception) {
+ // /* XSQLQueryComposer */ xSQLQueryComposer = xSQLComposerFactory.createQueryComposer();
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- private boolean addtoSelectClause(String DisplayFieldName) throws SQLException {
- if (bincludeGrouping){
- if (CurDBMetaData.xDBMetaData.supportsGroupByUnrelated()) {
- if (CurDBMetaData.GroupFieldNames != null) {
+ private boolean addtoSelectClause(String DisplayFieldName) throws SQLException
+ {
+ if (bincludeGrouping)
+ {
+ if (CurDBMetaData.xDBMetaData.supportsGroupByUnrelated())
+ {
+ if (CurDBMetaData.GroupFieldNames != null)
+ {
if (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, DisplayFieldName) > -1)
+ {
return false;
+ }
}
}
}
return true;
}
- public void appendSelectClause(boolean _baddAliasFieldNames) throws SQLException
+ public String getSelectClause(boolean _baddAliasFieldNames) throws SQLException
{
String sSelectBaseClause = "SELECT ";
- selectclause = sSelectBaseClause;
+ String sSelectClause = sSelectBaseClause;
for (int i = 0; i < CurDBMetaData.FieldColumns.length; i++)
{
- if (addtoSelectClause(CurDBMetaData.FieldColumns[i].DisplayFieldName))
+ if (addtoSelectClause(CurDBMetaData.FieldColumns[i].getDisplayFieldName()))
{
- int iAggregate = CurDBMetaData.getAggregateIndex(CurDBMetaData.FieldColumns[i].DisplayFieldName);
+ int iAggregate = CurDBMetaData.getAggregateIndex(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
if (iAggregate > -1)
{
- selectclause += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + getComposedAliasFieldName(CurDBMetaData.AggregateFieldNames[iAggregate][0]) + ")";
+ sSelectClause += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + getComposedAliasFieldName(CurDBMetaData.AggregateFieldNames[iAggregate][0]) + ")";
if (_baddAliasFieldNames)
{
- selectclause += getAliasFieldNameClause(CurDBMetaData.AggregateFieldNames[iAggregate][0]);
+ sSelectClause += getAliasFieldNameClause(CurDBMetaData.AggregateFieldNames[iAggregate][0]);
}
}
else
{
- selectclause += getComposedAliasFieldName(CurDBMetaData.FieldColumns[i].DisplayFieldName);
+ sSelectClause += getComposedAliasFieldName(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
if (_baddAliasFieldNames)
{
- selectclause += getAliasFieldNameClause(CurDBMetaData.FieldColumns[i].DisplayFieldName);
- }
+ sSelectClause += getAliasFieldNameClause(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
+ }
}
- selectclause += ", ";
+ sSelectClause += ", ";
}
}
- if (selectclause.equals(sSelectBaseClause))
+ // TODO: little bit unhandy version of remove the append 'comma' at the end
+ if (sSelectClause.equals(sSelectBaseClause))
{
- selectclause = selectclause.substring(0, selectclause.length() - 1);
+ sSelectClause = sSelectClause.substring(0, sSelectClause.length() - 1);
}
else
{
- selectclause = selectclause.substring(0, selectclause.length() - 2);
+ sSelectClause = sSelectClause.substring(0, sSelectClause.length() - 2);
}
+ return sSelectClause;
}
-
- public String getAliasFieldNameClause(String _FieldName) {
+ public String getAliasFieldNameClause(String _FieldName)
+ {
String FieldTitle = CurDBMetaData.getFieldTitle(_FieldName);
if (!FieldTitle.equals(_FieldName))
+ {
return " AS " + CommandName.quoteName(FieldTitle, CurDBMetaData.getIdentifierQuote());
+ }
else
+ {
return "";
+ }
}
- public void appendFilterConditions() throws SQLException {
- try {
- for (int i = 0; i < CurDBMetaData.FilterConditions.length; i++) {
- String CurFieldName = CurDBMetaData.FilterConditions[i][0].Name;
- xQueryComposer.setStructuredFilter(CurDBMetaData.FilterConditions);
+ public void appendFilterConditions() throws SQLException
+ {
+ try
+ {
+ for (int i = 0; i < CurDBMetaData.getFilterConditions().length; i++)
+ {
+ String sCurFieldName = CurDBMetaData.getFilterConditions()[i][0].Name;
+ m_xQueryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions());
}
- String s = xQueryAnalyzer.getQuery();
- } catch (Exception exception) {
+ String s = m_xQueryAnalyzer.getQuery();
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
- public void prependSortingCriteria() throws SQLException{
- XIndexAccess xColumnIndexAccess = xQueryAnalyzer.getOrderColumns();
- xQueryComposer.setOrder("");
+ public void prependSortingCriteria() throws SQLException
+ {
+ XIndexAccess xColumnIndexAccess = m_xQueryAnalyzer.getOrderColumns();
+ m_xQueryComposer.setOrder("");
for (int i = 0; i < CurDBMetaData.getSortFieldNames().length; i++)
+ {
appendSortingCriterion(i, false);
- for (int i = 0; i < xColumnIndexAccess.getCount(); i++){
- try {
+ }
+ for (int i = 0; i < xColumnIndexAccess.getCount(); i++)
+ {
+ try
+ {
XPropertySet xColumnPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xColumnIndexAccess.getByIndex(i));
String sName = (String) xColumnPropertySet.getPropertyValue("Name");
- if (JavaTools.FieldInTable(CurDBMetaData.getSortFieldNames(), sName) == -1){
+ if (JavaTools.FieldInTable(CurDBMetaData.getSortFieldNames(), sName) == -1)
+ {
boolean bascend = AnyConverter.toBoolean(xColumnPropertySet.getPropertyValue("IsAscending"));
- xQueryComposer.appendOrderByColumn(xColumnPropertySet, bascend);
+ m_xQueryComposer.appendOrderByColumn(xColumnPropertySet, bascend);
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
}
- private void appendSortingCriterion(int _SortIndex, boolean _baddAliasFieldNames ) throws SQLException
+ private void appendSortingCriterion(int _SortIndex, boolean _baddAliasFieldNames) throws SQLException
{
String sSortValue = CurDBMetaData.getSortFieldNames()[_SortIndex][0];
XPropertySet xColumn = CurDBMetaData.getColumnObjectByFieldName(sSortValue, _baddAliasFieldNames);
String sSort = CurDBMetaData.getSortFieldNames()[_SortIndex][1];
- boolean bascend = ( sSort.equals( "ASC" ));
- xQueryComposer.appendOrderByColumn(xColumn, bascend);
+ boolean bascend = (sSort.equals("ASC"));
+ m_xQueryComposer.appendOrderByColumn(xColumn, bascend);
}
-
- public void appendSortingcriteria(boolean _baddAliasFieldNames) throws SQLException {
+ public void appendSortingcriteria(boolean _baddAliasFieldNames) throws SQLException
+ {
String sOrder = "";
- xQueryComposer.setOrder("");
+ m_xQueryComposer.setOrder("");
for (int i = 0; i < CurDBMetaData.getSortFieldNames().length; i++)
{
String sSortValue = CurDBMetaData.getSortFieldNames()[i][0];
int iAggregate = CurDBMetaData.getAggregateIndex(sSortValue);
if (iAggregate > -1)
{
- sOrder = xQueryAnalyzer.getOrder();
+ sOrder = m_xQueryAnalyzer.getOrder();
if (sOrder.length() > 0)
{
sOrder += ", ";
}
sOrder += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + CurDBMetaData.AggregateFieldNames[iAggregate][0] + ")";
sOrder += " " + CurDBMetaData.getSortFieldNames()[i][1];
- xQueryComposer.setOrder(sOrder);
+ m_xQueryComposer.setOrder(sOrder);
}
else
{
appendSortingCriterion(i, _baddAliasFieldNames);
}
- sOrder = xQueryAnalyzer.getOrder();
+ sOrder = m_xQueryAnalyzer.getOrder();
}
// just for debug!
- sOrder = xQueryComposer.getOrder();
+ sOrder = m_xQueryComposer.getOrder();
int dummy = 0;
}
- public void appendGroupByColumns(boolean _baddAliasFieldNames) throws SQLException {
- for (int i = 0; i < CurDBMetaData.GroupFieldNames.length; i++) {
+ public void appendGroupByColumns(boolean _baddAliasFieldNames) throws SQLException
+ {
+ for (int i = 0; i < CurDBMetaData.GroupFieldNames.length; i++)
+ {
XPropertySet xColumn = CurDBMetaData.getColumnObjectByFieldName(CurDBMetaData.GroupFieldNames[i], _baddAliasFieldNames);
- xQueryComposer.appendGroupByColumn(xColumn);
+ m_xQueryComposer.appendGroupByColumn(xColumn);
}
- String s = xQueryAnalyzer.getQuery();
+ String s = m_xQueryAnalyzer.getQuery();
}
- public void setDBMetaData(QueryMetaData _oDBMetaData) {
+ public void setDBMetaData(QueryMetaData _oDBMetaData)
+ {
this.CurDBMetaData = _oDBMetaData;
}
- private PropertyValue[][] replaceConditionsByAlias(PropertyValue _filterconditions[][]) {
- for (int n = 0; n < _filterconditions.length; n++) {
- for (int m = 0; m < _filterconditions[n].length; m++) {
+ private PropertyValue[][] replaceConditionsByAlias(PropertyValue _filterconditions[][])
+ {
+ for (int n = 0; n < _filterconditions.length; n++)
+ {
+ for (int m = 0; m < _filterconditions[n].length; m++)
+ {
_filterconditions[n][m].Name = getComposedAliasFieldName(_filterconditions[n][m].Name);
}
}
return _filterconditions;
}
- public String getQuery() {
- return xQueryAnalyzer.getQuery();
+ public String getQuery()
+ {
+ return m_xQueryAnalyzer.getQuery();
}
+ private String getFromClause()
+ {
+ String sFromClause = "FROM";
+ String[] sCommandNames = CurDBMetaData.getIncludedCommandNames();
+ for (int i = 0; i < sCommandNames.length; i++)
+ {
+ CommandName curCommandName = new CommandName(CurDBMetaData, sCommandNames[i]); //(setComposedCommandName)
+ curCommandName.setAliasName(getuniqueAliasName(curCommandName.getTableName()));
+ sFromClause += " " + curCommandName.getComposedName() + " " + quoteName(curCommandName.getAliasName());
+ if (i < sCommandNames.length - 1)
+ {
+ sFromClause += ", ";
+ }
+ // fill composedCommandNames
+ composedCommandNames.add(curCommandName);
+ }
+ return sFromClause;
+ }
- public boolean setQueryCommand(String QueryName, XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames) {
+ public boolean setQueryCommand(String QueryName, XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames)
+ {
try
{
String s;
bincludeGrouping = _bincludeGrouping;
- fromclause = "FROM";
- String[] sCommandNames = CurDBMetaData.getIncludedCommandNames();
- for (int i = 0; i < sCommandNames.length; i++)
- {
- CommandName curCommandName = new CommandName(CurDBMetaData, sCommandNames[i]); //(setComposedCommandName)
- curCommandName.setAliasName(getuniqueAliasName(curCommandName.getTableName()));
- fromclause += " " + curCommandName.getComposedName() + " " + quoteName(curCommandName.getAliasName());
- if (i < sCommandNames.length - 1)
- {
- fromclause += ", ";
- }
- composedCommandNames.add(curCommandName);
- }
- appendSelectClause(_baddAliasFieldNames);
- String queryclause = selectclause + " " + fromclause;
- xQueryAnalyzer.setQuery(queryclause);
- if (CurDBMetaData.FilterConditions != null)
+ String sFromClause = getFromClause();
+ String sSelectClause = getSelectClause(_baddAliasFieldNames);
+ String queryclause = sSelectClause + " " + sFromClause;
+ m_xQueryAnalyzer.setQuery(queryclause);
+ if (CurDBMetaData.getFilterConditions() != null)
{
- if (CurDBMetaData.FilterConditions.length > 0)
+ if (CurDBMetaData.getFilterConditions().length > 0)
{
- CurDBMetaData.FilterConditions = replaceConditionsByAlias(CurDBMetaData.FilterConditions);
- xQueryComposer.setStructuredFilter(CurDBMetaData.FilterConditions);
+ CurDBMetaData.setFilterConditions(replaceConditionsByAlias(CurDBMetaData.getFilterConditions()));
+ m_xQueryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions());
}
}
- s = xQueryAnalyzer.getQuery();
+ s = m_xQueryAnalyzer.getQuery();
if (_bincludeGrouping)
{
appendGroupByColumns(_baddAliasFieldNames);
if (CurDBMetaData.GroupByFilterConditions.length > 0)
{
- xQueryComposer.setStructuredHavingClause(CurDBMetaData.GroupByFilterConditions);
+ m_xQueryComposer.setStructuredHavingClause(CurDBMetaData.GroupByFilterConditions);
}
}
appendSortingcriteria(_baddAliasFieldNames);
- s = xQueryAnalyzer.getQuery();
+ s = m_xQueryAnalyzer.getQuery();
return true;
}
catch (Exception exception)
@@ -290,65 +333,79 @@ public class SQLQueryComposer {
}
}
-
- private String getComposedAliasFieldName(String _fieldname){
+ private String getComposedAliasFieldName(String _fieldname)
+ {
FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByDisplayName(_fieldname);
CommandName curComposedCommandName = getComposedCommandByDisplayName(CurFieldColumn.getCommandName());
String curAliasName = curComposedCommandName.getAliasName();
- return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.FieldName);
+ return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.m_sFieldName);
}
-
- private CommandName getComposedCommandByAliasName(String _AliasName) {
- if (composedCommandNames != null) {
+ private CommandName getComposedCommandByAliasName(String _AliasName)
+ {
+ if (composedCommandNames != null)
+ {
CommandName curComposedName;
- for (int i = 0; i < composedCommandNames.size(); i++) {
+ for (int i = 0; i < composedCommandNames.size(); i++)
+ {
curComposedName = (CommandName) composedCommandNames.elementAt(i);
if (curComposedName.getAliasName().equals(_AliasName))
+ {
return curComposedName;
+ }
}
}
return null;
}
-
- public CommandName getComposedCommandByDisplayName(String _DisplayName) {
- if (composedCommandNames != null) {
+ public CommandName getComposedCommandByDisplayName(String _DisplayName)
+ {
+ if (composedCommandNames != null)
+ {
CommandName curComposedName;
- for (int i = 0; i < composedCommandNames.size(); i++) {
+ for (int i = 0; i < composedCommandNames.size(); i++)
+ {
curComposedName = (CommandName) composedCommandNames.elementAt(i);
if (curComposedName.getDisplayName().equals(_DisplayName))
+ {
return curComposedName;
+ }
}
}
return null;
}
-
- public String getuniqueAliasName(String _TableName) {
+ public String getuniqueAliasName(String _TableName)
+ {
int a = 0;
String AliasName = "";
boolean bAliasNameexists = true;
String locAliasName = _TableName;
- while (bAliasNameexists == true) {
+ while (bAliasNameexists == true)
+ {
bAliasNameexists = (getComposedCommandByAliasName(locAliasName) != null);
- if (bAliasNameexists) {
+ if (bAliasNameexists)
+ {
a++;
locAliasName = _TableName + "_" + String.valueOf(a);
- } else
+ }
+ else
+ {
AliasName = locAliasName;
+ }
}
return AliasName;
}
-
- private String quoteName(String _sname){
+ private String quoteName(String _sname)
+ {
return CommandName.quoteName(_sname, CurDBMetaData.getIdentifierQuote());
}
-
- public void displaySQLErrorDialog(Exception _exception, XWindow _xParentWindow) {
- try {
+ public void displaySQLErrorDialog(Exception _exception, XWindow _xParentWindow)
+ {
+ try
+ {
Object oErrorDialog = CurDBMetaData.xMSF.createInstance("com.sun.star.sdb.ErrorMessageDialog");
XInitialization xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oErrorDialog);
XExecutableDialog xExecute = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.class, oErrorDialog);
@@ -358,8 +415,10 @@ public class SQLQueryComposer {
rDispatchArguments[2] = Properties.createProperty("SQLException", _exception);
xInitialize.initialize(rDispatchArguments);
xExecute.execute();
- //TODO dispose???
- } catch (Exception typeexception) {
+ //TODO dispose???
+ }
+ catch (Exception typeexception)
+ {
typeexception.printStackTrace(System.out);
}
}
diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java
index b9e69d4992fb..35cf52373921 100644
--- a/wizards/com/sun/star/wizards/db/TableDescriptor.java
+++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java
@@ -65,17 +65,17 @@ import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.Properties;
+public class TableDescriptor extends CommandMetaData implements XContainerListener
+{
-public class TableDescriptor extends CommandMetaData implements XContainerListener{
XDataDescriptorFactory xTableDataDescriptorFactory;
XPropertySet xPropTableDataDescriptor;
private XNameAccess xNameAccessColumns;
private XIndexAccess xIndexAccessKeys;
-
public XDataDescriptorFactory xColumnDataDescriptorFactory;
XContainer xTableContainer;
XAppend xTableAppend;
- XDrop xTableDrop;
+ XDrop xTableDrop;
private XAppend xKeyAppend;
private XDrop xKeyDrop;
private String[] sTableFilters = null;
@@ -92,277 +92,371 @@ public class TableDescriptor extends CommandMetaData implements XContainerListe
private WizardDialog oUnoDialog;
private XWindow xWindow;
- /**
- * @param xMSF
- */
- public TableDescriptor(XMultiServiceFactory xMSF, XWindow _xWindow, String _sColumnAlreadyExistsMessage) {
- super(xMSF);
- columncontainer = new Vector();
- keycolumncontainer = new Vector();
- sColumnAlreadyExistsMessage = _sColumnAlreadyExistsMessage;
- xWindow = _xWindow;
- }
-
-
- private class ColumnDescriptor{
- String Name;
- XPropertySet xColPropertySet;
-
- public ColumnDescriptor(XPropertySet _xColPropertySet, String _Name){
- Name = _Name;
- xColPropertySet = _xColPropertySet;
+ /**
+ * @param xMSF
+ */
+ public TableDescriptor(XMultiServiceFactory xMSF, XWindow _xWindow, String _sColumnAlreadyExistsMessage)
+ {
+ super(xMSF);
+ columncontainer = new Vector();
+ keycolumncontainer = new Vector();
+ sColumnAlreadyExistsMessage = _sColumnAlreadyExistsMessage;
+ xWindow = _xWindow;
+ }
+
+ private class ColumnDescriptor
+ {
+
+ String Name;
+ XPropertySet xColPropertySet;
+
+ public ColumnDescriptor(XPropertySet _xColPropertySet, String _Name)
+ {
+ Name = _Name;
+ xColPropertySet = _xColPropertySet;
+ }
+ }
+
+ public boolean getConnection(PropertyValue[] _curPropertyValue)
+ {
+ if (super.getConnection(_curPropertyValue))
+ {
+ XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection);
+ xTableNames = xDBTables.getTables();
+ xTableAppend = (XAppend) UnoRuntime.queryInterface(XAppend.class, xTableNames);
+ xTableDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xTableNames);
+ xTableDataDescriptorFactory = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xTableNames);
+ xPropTableDataDescriptor = xTableDataDescriptorFactory.createDataDescriptor();
+ XColumnsSupplier xColumnsSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xPropTableDataDescriptor);
+ xNameAccessColumns = xColumnsSupplier.getColumns();
+ xColumnDataDescriptorFactory = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xNameAccessColumns);
+ try
+ {
+ createTypeInspector();
+ sTableFilters = (String[]) AnyConverter.toArray(xDataSourcePropertySet.getPropertyValue("TableFilter"));
}
-
- }
-
- public boolean getConnection(PropertyValue[] _curPropertyValue){
- if (super.getConnection(_curPropertyValue)){
- XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection);
- xTableNames = xDBTables.getTables();
- xTableAppend = (XAppend) UnoRuntime.queryInterface(XAppend.class, xTableNames);
- xTableDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xTableNames);
- xTableDataDescriptorFactory = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xTableNames);
- xPropTableDataDescriptor = xTableDataDescriptorFactory.createDataDescriptor();
- XColumnsSupplier xColumnsSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xPropTableDataDescriptor);
- xNameAccessColumns = xColumnsSupplier.getColumns();
- xColumnDataDescriptorFactory = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xNameAccessColumns);
- try {
- createTypeInspector();
- sTableFilters = (String[]) AnyConverter.toArray(xDataSourcePropertySet.getPropertyValue("TableFilter"));
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return true;
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
}
- else
- return false;
+ return true;
}
+ else
+ {
+ return false;
+ }
+ }
-
- private void removePrimaryKeys(){
- if (keycolumncontainer.size() > 0){
- for (int i = (keycolumncontainer.size()-1); i >= 0 ; i--){
- keycolumncontainer.remove(i);
- }
+ private void removePrimaryKeys()
+ {
+ if (keycolumncontainer.size() > 0)
+ {
+ for (int i = (keycolumncontainer.size() - 1); i >= 0; i--)
+ {
+ keycolumncontainer.remove(i);
}
}
-
-
- public boolean createPrimaryKeys(String[] _fieldnames, boolean _bAutoincrementation){
- try {
- XKeysSupplier xKeySupplier = (XKeysSupplier)UnoRuntime.queryInterface(XKeysSupplier.class, xPropTableDataDescriptor);
- xIndexAccessKeys = xKeySupplier.getKeys();
- XDataDescriptorFactory xKeyFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(XDataDescriptorFactory.class,xIndexAccessKeys);
- xKeyDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xIndexAccessKeys);
- xKeyAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class, xKeyFac);
- xKey = xKeyFac.createDataDescriptor();
- xKey.setPropertyValue("Type", new Integer(KeyType.PRIMARY));
- xKeyColumnSupplier = (XColumnsSupplier)UnoRuntime.queryInterface(XColumnsSupplier.class, xKey);
- XDataDescriptorFactory xKeyColFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(XDataDescriptorFactory.class,xKeyColumnSupplier.getColumns());
- xKeyColAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class, xKeyColFac);
- removePrimaryKeys();
- for (int i = 0; i < _fieldnames.length; i++){
+ }
+
+ public boolean createPrimaryKeys(String[] _fieldnames, boolean _bAutoincrementation)
+ {
+ try
+ {
+ XKeysSupplier xKeySupplier = (XKeysSupplier) UnoRuntime.queryInterface(XKeysSupplier.class, xPropTableDataDescriptor);
+ xIndexAccessKeys = xKeySupplier.getKeys();
+ XDataDescriptorFactory xKeyFac = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xIndexAccessKeys);
+ xKeyDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xIndexAccessKeys);
+ xKeyAppend = (XAppend) UnoRuntime.queryInterface(XAppend.class, xKeyFac);
+ xKey = xKeyFac.createDataDescriptor();
+ xKey.setPropertyValue("Type", new Integer(KeyType.PRIMARY));
+ xKeyColumnSupplier = (XColumnsSupplier) UnoRuntime.queryInterface(XColumnsSupplier.class, xKey);
+ XDataDescriptorFactory xKeyColFac = (XDataDescriptorFactory) UnoRuntime.queryInterface(XDataDescriptorFactory.class, xKeyColumnSupplier.getColumns());
+ xKeyColAppend = (XAppend) UnoRuntime.queryInterface(XAppend.class, xKeyColFac);
+ removePrimaryKeys();
+ for (int i = 0; i < _fieldnames.length; i++)
+ {
XPropertySet xKeyColPropertySet = xKeyColFac.createDataDescriptor();
xKeyColPropertySet.setPropertyValue("Name", _fieldnames[i]);
keycolumncontainer.add(xKeyColPropertySet);
XPropertySet xColPropertySet = null;
if (hasByName(_fieldnames[i]))
+ {
xColPropertySet = getByName(_fieldnames[i]);
+ }
else
+ {
xColPropertySet = addPrimaryKeyColumn(_fieldnames[i]);
+ }
xColPropertySet.setPropertyValue("IsNullable", new Integer(com.sun.star.sdbc.ColumnValue.NO_NULLS));
- if (_bAutoincrementation){
- int nDataType = oTypeInspector.getAutoIncrementIndex(xColPropertySet);
+ if (_bAutoincrementation)
+ {
+ int nDataType = oTypeInspector.getAutoIncrementIndex(xColPropertySet);
if (nDataType != oTypeInspector.INVALID)
- if (xColPropertySet.getPropertySetInfo().hasPropertyByName("IsAutoIncrement")){
+ {
+ if (xColPropertySet.getPropertySetInfo().hasPropertyByName("IsAutoIncrement"))
+ {
xColPropertySet.setPropertyValue("Type", new Integer(nDataType));
xColPropertySet.setPropertyValue("IsAutoIncrement", new Boolean(_bAutoincrementation));
}
+ }
}
modifyColumn(_fieldnames[i], xColPropertySet);
- }
- return true;
- } catch (UnknownPropertyException e) {
+ }
+ return true;
+ }
+ catch (UnknownPropertyException e)
+ {
e.printStackTrace(System.out);
- } catch (PropertyVetoException e) {
+ }
+ catch (PropertyVetoException e)
+ {
e.printStackTrace(System.out);
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
e.printStackTrace(System.out);
- } catch (WrappedTargetException e) {
+ }
+ catch (WrappedTargetException e)
+ {
e.printStackTrace(System.out);
}
return false;
- }
+ }
-
- public boolean isColunnNameDuplicate(XNameAccess _xColumns, XPropertySet _xToBeAppendedPropertySet){
- try {
+ public boolean isColunnNameDuplicate(XNameAccess _xColumns, XPropertySet _xToBeAppendedPropertySet)
+ {
+ try
+ {
String sColumnName = (String) AnyConverter.toString(_xToBeAppendedPropertySet.getPropertyValue("Name"));
- if (_xColumns.hasByName(sColumnName)){
+ if (_xColumns.hasByName(sColumnName))
+ {
String sMessage = JavaTools.replaceSubString(sColumnAlreadyExistsMessage, sColumnName, "%FIELDNAME");
showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage);
return true;
}
return false;
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace(System.out);
return false;
- }}
-
-
- /**
- * creates the table under the passed name
- * @param _tablename is made unique if necessary
- * @return true or false to indicate successful creation or not
- */
- public boolean createTable(String _catalogname, String _schemaname, String _tablename, String[] _fieldnames){
- boolean breturn = true;
- try {
- XAppend xAppendColumns = (XAppend) UnoRuntime.queryInterface(XAppend.class, xNameAccessColumns);
- for (int i = 0; i < columncontainer.size(); i++){
- XPropertySet xColPropertySet = getByIndex(i);
- if (!isColunnNameDuplicate(xNameAccessColumns, xColPropertySet)){
- xAppendColumns.appendByDescriptor(xColPropertySet); //xColPropertySet.setPropertyValue("Type", new Integer(32423))
- }
- else{
- breturn = false;
- }
+ }
+ }
+
+ /**
+ * creates the table under the passed name
+ * @param _tablename is made unique if necessary
+ * @return true or false to indicate successful creation or not
+ */
+ public boolean createTable(String _catalogname, String _schemaname, String _tablename, String[] _fieldnames)
+ {
+ boolean breturn = true;
+ try
+ {
+ XAppend xAppendColumns = (XAppend) UnoRuntime.queryInterface(XAppend.class, xNameAccessColumns);
+ for (int i = 0; i < columncontainer.size(); i++)
+ {
+ XPropertySet xColPropertySet = getByIndex(i);
+ if (!isColunnNameDuplicate(xNameAccessColumns, xColPropertySet))
+ {
+ xAppendColumns.appendByDescriptor(xColPropertySet); //xColPropertySet.setPropertyValue("Type", new Integer(32423))
}
- if (breturn){
- assignTableProperty("Name", _tablename);
- assignTableProperty("CatalogName", _catalogname);
- assignTableProperty("SchemaName", _schemaname);
- xTableContainer = (XContainer) UnoRuntime.queryInterface(XContainer.class, xTableNames);
- xTableContainer.addContainerListener(this);
- if (keycolumncontainer.size() > 0){
- for (int i = 0; i < keycolumncontainer.size(); i++){
- XPropertySet xKeyColPropertySet = (XPropertySet) keycolumncontainer.get(i);
- if (!isColunnNameDuplicate(xKeyColumnSupplier.getColumns(), xKeyColPropertySet)){
- xKeyColAppend.appendByDescriptor(xKeyColPropertySet);
- }
- else{
+ else
+ {
+ breturn = false;
+ }
+ }
+ if (breturn)
+ {
+ assignTableProperty("Name", _tablename);
+ assignTableProperty("CatalogName", _catalogname);
+ assignTableProperty("SchemaName", _schemaname);
+ xTableContainer = (XContainer) UnoRuntime.queryInterface(XContainer.class, xTableNames);
+ xTableContainer.addContainerListener(this);
+ if (keycolumncontainer.size() > 0)
+ {
+ for (int i = 0; i < keycolumncontainer.size(); i++)
+ {
+ XPropertySet xKeyColPropertySet = (XPropertySet) keycolumncontainer.get(i);
+ if (!isColunnNameDuplicate(xKeyColumnSupplier.getColumns(), xKeyColPropertySet))
+ {
+ xKeyColAppend.appendByDescriptor(xKeyColPropertySet);
+ }
+ else
+ {
breturn = false;
- }
- }
- if (breturn)
+ }
+ }
+ if (breturn)
+ {
xKeyAppend.appendByDescriptor(xKey);
- }
- if (breturn)
- xTableAppend.appendByDescriptor(xPropTableDataDescriptor);
+ }
+ }
+ if (breturn)
+ {
+ xTableAppend.appendByDescriptor(xPropTableDataDescriptor);
}
- } catch (SQLException oSQLException) {
- super.callSQLErrorMessageDialog(oSQLException, xWindow);
- breturn = false;
- }
- catch (Exception e){
- e.printStackTrace(System.out);
- breturn = false;
- }
- if (!breturn){
- removeAllColumnsFromDescriptor(_tablename);
- this.removePrimaryKeys();
}
- return breturn;
}
-
-
- private boolean removeAllColumnsFromDescriptor(String _tablename){
- try {
- xPropTableDataDescriptor.setPropertyValue("Name", "");
- if ((xKeyDrop != null) && (xIndexAccessKeys != null)){
- int icount = xIndexAccessKeys.getCount();
- if (icount > 0){
- for (int i = xIndexAccessKeys.getCount()-1; i >= 0; i--){
- xKeyDrop.dropByIndex(i);
- }
+ catch (SQLException oSQLException)
+ {
+ super.callSQLErrorMessageDialog(oSQLException, xWindow);
+ breturn = false;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ breturn = false;
+ }
+ if (!breturn)
+ {
+ removeAllColumnsFromDescriptor(_tablename);
+ this.removePrimaryKeys();
+ }
+ return breturn;
+ }
+
+ private boolean removeAllColumnsFromDescriptor(String _tablename)
+ {
+ try
+ {
+ xPropTableDataDescriptor.setPropertyValue("Name", "");
+ if ((xKeyDrop != null) && (xIndexAccessKeys != null))
+ {
+ int icount = xIndexAccessKeys.getCount();
+ if (icount > 0)
+ {
+ for (int i = xIndexAccessKeys.getCount() - 1; i >= 0; i--)
+ {
+ xKeyDrop.dropByIndex(i);
}
}
- XDrop xColumnDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xNameAccessColumns);
- for (int i = xNameAccessColumns.getElementNames().length - 1; i >= 0; i--)
- xColumnDrop.dropByIndex(i);
- if (xTableDrop != null)
- if (xTableNames.hasByName(_tablename))
- xTableDrop.dropByName(_tablename);
- if (bIDFieldisInserted){
- this.dropColumnbyName(this.IDFieldName);
- bIDFieldisInserted = false;
+ }
+ XDrop xColumnDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xNameAccessColumns);
+ for (int i = xNameAccessColumns.getElementNames().length - 1; i >= 0; i--)
+ {
+ xColumnDrop.dropByIndex(i);
+ }
+ if (xTableDrop != null)
+ {
+ if (xTableNames.hasByName(_tablename))
+ {
+ xTableDrop.dropByName(_tablename);
}
- return false;
- } catch (SQLException oSQLException) {
- super.callSQLErrorMessageDialog(oSQLException, xWindow);
}
- catch (Exception e1) {
- e1.printStackTrace(System.out);
+ if (bIDFieldisInserted)
+ {
+ this.dropColumnbyName(this.IDFieldName);
+ bIDFieldisInserted = false;
}
return false;
}
-
-
- public boolean createTable(String _catalogname, String _schemaname, String _tablename, String[] _keycolumnnames, boolean _bAutoincrementation, String[] _fieldnames){
- if (createPrimaryKeys(_keycolumnnames, _bAutoincrementation))
- return createTable(_catalogname, _schemaname, _tablename, _fieldnames);
- return false;
+ catch (SQLException oSQLException)
+ {
+ super.callSQLErrorMessageDialog(oSQLException, xWindow);
}
+ catch (Exception e1)
+ {
+ e1.printStackTrace(System.out);
+ }
+ return false;
+ }
-
- private void assignTableProperty(String _spropname, String _svalue){
- if (_svalue != null){
- if (!_svalue.equals("")){
- try {
- xPropTableDataDescriptor.setPropertyValue(_spropname, _svalue);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
+ public boolean createTable(String _catalogname, String _schemaname, String _tablename, String[] _keycolumnnames, boolean _bAutoincrementation, String[] _fieldnames)
+ {
+ if (createPrimaryKeys(_keycolumnnames, _bAutoincrementation))
+ {
+ return createTable(_catalogname, _schemaname, _tablename, _fieldnames);
+ }
+ return false;
+ }
+
+ private void assignTableProperty(String _spropname, String _svalue)
+ {
+ if (_svalue != null)
+ {
+ if (!_svalue.equals(""))
+ {
+ try
+ {
+ xPropTableDataDescriptor.setPropertyValue(_spropname, _svalue);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
}
}
}
+ }
-
- public boolean modifyColumnName(String _soldname, String _snewname){
- try {
+ public boolean modifyColumnName(String _soldname, String _snewname)
+ {
+ try
+ {
return modifyColumn(_soldname, "Name", _snewname);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, e.getMessage());
return false;
- }}
-
+ }
+ }
- public boolean modifyColumn(String _sname, String _spropname, Object _oValue){
- try {
- if (this.columncontainer.size() > 0){
- for (int i = 0; i < columncontainer.size(); i++){
+ public boolean modifyColumn(String _sname, String _spropname, Object _oValue)
+ {
+ try
+ {
+ if (this.columncontainer.size() > 0)
+ {
+ for (int i = 0; i < columncontainer.size(); i++)
+ {
ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
- if (oColumnDescriptor.Name.equals(_sname)){
+ if (oColumnDescriptor.Name.equals(_sname))
+ {
oColumnDescriptor.xColPropertySet.setPropertyValue(_spropname, _oValue);
if (_spropname.equals("Name"))
+ {
oColumnDescriptor.Name = (String) _oValue;
+ }
columncontainer.remove(i);
columncontainer.insertElementAt(oColumnDescriptor, i);
return true;
}
}
}
- } catch (UnknownPropertyException e) {
- e.printStackTrace(System.out);
- } catch (PropertyVetoException e) {
+ }
+ catch (UnknownPropertyException e)
+ {
e.printStackTrace(System.out);
- } catch (IllegalArgumentException e) {
+ }
+ catch (PropertyVetoException e)
+ {
e.printStackTrace(System.out);
- } catch (WrappedTargetException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
e.printStackTrace(System.out);
}
- return false;
+ catch (WrappedTargetException e)
+ {
+ e.printStackTrace(System.out);
}
-
-
- public boolean modifyColumn(String _sname, XPropertySet _xColPropertySet){
- try {
- if (this.columncontainer.size() > 0){
- for (int i = 0; i < columncontainer.size(); i++){
+ return false;
+ }
+
+ public boolean modifyColumn(String _sname, XPropertySet _xColPropertySet)
+ {
+ try
+ {
+ if (this.columncontainer.size() > 0)
+ {
+ for (int i = 0; i < columncontainer.size(); i++)
+ {
ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
- if (oColumnDescriptor.Name.equals(_sname)){
+ if (oColumnDescriptor.Name.equals(_sname))
+ {
oColumnDescriptor.xColPropertySet = _xColPropertySet;
oColumnDescriptor.Name = (String) _xColPropertySet.getPropertyValue("Name");
columncontainer.remove(i);
@@ -371,154 +465,213 @@ public class TableDescriptor extends CommandMetaData implements XContainerListe
}
}
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return false;
- }
-
-
- public void dropColumnbyName(String _sname){
- try {
- if (columncontainer.size() > 0){
- for (int i = 0; i < columncontainer.size(); i++){
+ }
+
+ public void dropColumnbyName(String _sname)
+ {
+ try
+ {
+ if (columncontainer.size() > 0)
+ {
+ for (int i = 0; i < columncontainer.size(); i++)
+ {
ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
if (oColumnDescriptor != null)
+ {
if (oColumnDescriptor.Name.equals(_sname))
+ {
columncontainer.remove(i);
+ }
+ }
}
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
- }}
-
-
- public String[] getColumnNames(){
- if (columncontainer.size() > 0){
- try {
- String[] fieldnames = new String[columncontainer.size()];
- for (int i = 0; i < columncontainer.size(); i++){
- ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
- fieldnames[i] = oColumnDescriptor.Name;
- }
- return fieldnames;
- } catch (RuntimeException e) {
- e.printStackTrace(System.out);
+ }
+ }
+
+ public String[] getColumnNames()
+ {
+ if (columncontainer.size() > 0)
+ {
+ try
+ {
+ String[] fieldnames = new String[columncontainer.size()];
+ for (int i = 0; i < columncontainer.size(); i++)
+ {
+ ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
+ fieldnames[i] = oColumnDescriptor.Name;
}
+ return fieldnames;
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
}
- return new String[]{};
}
-
-
- private boolean hasByName(String _fieldname){
- try {
- if (columncontainer.size() > 0){
- for (int i = 0; i < columncontainer.size(); i++){
- ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
- if (oColumnDescriptor.Name.equals(_fieldname)){
- return true;
- }
+ return new String[]
+ {
+ };
+ }
+
+ private boolean hasByName(String _fieldname)
+ {
+ try
+ {
+ if (columncontainer.size() > 0)
+ {
+ for (int i = 0; i < columncontainer.size(); i++)
+ {
+ ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
+ if (oColumnDescriptor.Name.equals(_fieldname))
+ {
+ return true;
}
}
- } catch (RuntimeException e) {
- e.printStackTrace(System.out);
}
- return false;
}
-
-
- private ColumnDescriptor getColumnDescriptorByName(String _fieldname){
- try {
- if (this.columncontainer.size() > 0){
- for (int i = 0; i < columncontainer.size(); i++){
- ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
- if (oColumnDescriptor.Name.equals(_fieldname)){
- return oColumnDescriptor;
- }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return false;
+ }
+
+ private ColumnDescriptor getColumnDescriptorByName(String _fieldname)
+ {
+ try
+ {
+ if (this.columncontainer.size() > 0)
+ {
+ for (int i = 0; i < columncontainer.size(); i++)
+ {
+ ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
+ if (oColumnDescriptor.Name.equals(_fieldname))
+ {
+ return oColumnDescriptor;
}
}
- } catch (RuntimeException e) {
- e.printStackTrace(System.out);
}
- return null;
}
-
-
- public XPropertySet getByName(String _fieldname){
- ColumnDescriptor oColumnDescriptor = getColumnDescriptorByName(_fieldname);
- if (oColumnDescriptor != null)
- return oColumnDescriptor.xColPropertySet;
- else
- return null;
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
}
+ return null;
+ }
-
- private XPropertySet getByIndex(int _index){
- try {
- if (columncontainer.size() > _index){
- ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(_index);
- return oColumnDescriptor.xColPropertySet;
- }
- } catch (RuntimeException e) {
- e.printStackTrace(System.out);
- }
+ public XPropertySet getByName(String _fieldname)
+ {
+ ColumnDescriptor oColumnDescriptor = getColumnDescriptorByName(_fieldname);
+ if (oColumnDescriptor != null)
+ {
+ return oColumnDescriptor.xColPropertySet;
+ }
+ else
+ {
return null;
}
+ }
-
- public XPropertySet clonePropertySet(String _snewname, XPropertySet _xnewPropertySet){
- XPropertySet xRetPropertySet = xColumnDataDescriptorFactory.createDataDescriptor();
- try {
- if (hasByName(_snewname)){
- Object oColumn = getByName(_snewname);
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn);
- Property[] aColProperties = xPropertySet.getPropertySetInfo().getProperties();
- for (int i = 0; i < aColProperties.length; i++){
- String sPropName = aColProperties[i].Name;
- Object oColValue = _xnewPropertySet.getPropertyValue(sPropName);
- xRetPropertySet.setPropertyValue(sPropName, oColValue);
- }
+ private XPropertySet getByIndex(int _index)
+ {
+ try
+ {
+ if (columncontainer.size() > _index)
+ {
+ ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(_index);
+ return oColumnDescriptor.xColPropertySet;
+ }
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return null;
+ }
+
+ public XPropertySet clonePropertySet(String _snewname, XPropertySet _xnewPropertySet)
+ {
+ XPropertySet xRetPropertySet = xColumnDataDescriptorFactory.createDataDescriptor();
+ try
+ {
+ if (hasByName(_snewname))
+ {
+ Object oColumn = getByName(_snewname);
+ XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn);
+ Property[] aColProperties = xPropertySet.getPropertySetInfo().getProperties();
+ for (int i = 0; i < aColProperties.length; i++)
+ {
+ String sPropName = aColProperties[i].Name;
+ Object oColValue = _xnewPropertySet.getPropertyValue(sPropName);
+ xRetPropertySet.setPropertyValue(sPropName, oColValue);
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
}
- return xRetPropertySet;
}
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return xRetPropertySet;
+ }
-
- public boolean addColumn(PropertyValue[] _aNewPropertyValues){
- try {
+ public boolean addColumn(PropertyValue[] _aNewPropertyValues)
+ {
+ try
+ {
String sname = (String) Properties.getPropertyValue(_aNewPropertyValues, "Name");
- if (!hasByName(sname)){
+ if (!hasByName(sname))
+ {
ColumnPropertySet oPropertySet = new ColumnPropertySet(oTypeInspector, xColumnDataDescriptorFactory.createDataDescriptor());
oPropertySet.assignPropertyValues(_aNewPropertyValues, true);
ColumnDescriptor oColumnDescriptor = new ColumnDescriptor(oPropertySet.xPropertySet, sname);
this.columncontainer.add(oColumnDescriptor);
return true;
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return false;
- }
+ }
- public boolean moveColumn(int _nOldIndex, int _nNewIndex){
- try{
+ public boolean moveColumn(int _nOldIndex, int _nNewIndex)
+ {
+ try
+ {
ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) this.columncontainer.get(_nOldIndex);
this.columncontainer.remove(_nOldIndex);
columncontainer.add(_nNewIndex, oColumnDescriptor);
return true;
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
return false;
- }}
+ }
+ }
- public boolean addColumn(String _columnname, XPropertySet _xNewColPropertySet){
- try {
- if (!hasByName(_columnname)){
+ public boolean addColumn(String _columnname, XPropertySet _xNewColPropertySet)
+ {
+ try
+ {
+ if (!hasByName(_columnname))
+ {
if (_columnname.equals(""))
+ {
return false;
- else{
+ }
+ else
+ {
ColumnPropertySet oPropertySet = new ColumnPropertySet(oTypeInspector, xColumnDataDescriptorFactory.createDataDescriptor());
oPropertySet.assignNewPropertySet(_columnname, _xNewColPropertySet);
ColumnDescriptor oColumnDescriptor = new ColumnDescriptor(oPropertySet.xPropertySet, _columnname);
@@ -526,148 +679,186 @@ public class TableDescriptor extends CommandMetaData implements XContainerListe
return true;
}
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return false;
- }
-
-
-
- public XPropertySet addPrimaryKeyColumn(String _columnname){
- try {
- if (!hasByName(_columnname)){
- try {
+ }
+
+ public XPropertySet addPrimaryKeyColumn(String _columnname)
+ {
+ try
+ {
+ if (!hasByName(_columnname))
+ {
+ try
+ {
XPropertySet xColPropertySet = xColumnDataDescriptorFactory.createDataDescriptor();
IDFieldName = Desktop.getUniqueName(getColumnNames(), _columnname, "");
xColPropertySet.setPropertyValue("Name", IDFieldName);
int nDataType = oTypeInspector.convertDataType(com.sun.star.sdbc.DataType.INTEGER);
xColPropertySet.setPropertyValue("Type", new Integer(nDataType));
- xColPropertySet.setPropertyValue("TypeName", oTypeInspector.getDefaultTypeName( nDataType, null));
- ColumnDescriptor oColumnDescriptor = new ColumnDescriptor( xColPropertySet, IDFieldName);
+ xColPropertySet.setPropertyValue("TypeName", oTypeInspector.getDefaultTypeName(nDataType, null));
+ ColumnDescriptor oColumnDescriptor = new ColumnDescriptor(xColPropertySet, IDFieldName);
this.columncontainer.add(0, oColumnDescriptor);
this.bIDFieldisInserted = true;
return xColPropertySet;
- } catch (RuntimeException e1) {
+ }
+ catch (RuntimeException e1)
+ {
e1.printStackTrace(System.out);
}
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
}
- return null;
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
}
-
-
-
- public String[] getNonBinaryFieldNames(){
- Vector NonBinaryFieldNameVector = new Vector();
- try {
- for (int i = 0; i < columncontainer.size(); i++){
- ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
- XPropertySet xColPropertySet = getByName(oColumnDescriptor.Name);
- Property[] aProperties = xColPropertySet.getPropertySetInfo().getProperties();
- int itype;
- try {
- itype = AnyConverter.toInt(xColPropertySet.getPropertyValue("Type"));
- if (!isBinaryDataType(itype))
- NonBinaryFieldNameVector.addElement(oColumnDescriptor.Name);
- } catch (Exception e) {
- e.printStackTrace(System.out);
+ return null;
+ }
+
+ public String[] getNonBinaryFieldNames()
+ {
+ Vector NonBinaryFieldNameVector = new Vector();
+ try
+ {
+ for (int i = 0; i < columncontainer.size(); i++)
+ {
+ ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
+ XPropertySet xColPropertySet = getByName(oColumnDescriptor.Name);
+ Property[] aProperties = xColPropertySet.getPropertySetInfo().getProperties();
+ int itype;
+ try
+ {
+ itype = AnyConverter.toInt(xColPropertySet.getPropertyValue("Type"));
+ if (!isBinaryDataType(itype))
+ {
+ NonBinaryFieldNameVector.addElement(oColumnDescriptor.Name);
}
}
- } catch (RuntimeException e) {
- e.printStackTrace(System.out);
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
}
- String[] sbinaryfieldnames = new String[NonBinaryFieldNameVector.size()];
- NonBinaryFieldNameVector.toArray(sbinaryfieldnames);
- return sbinaryfieldnames;
}
-
-
- public String getComposedTableName(String _scatalogname, String _sschemaname, String _stablename){
- ComposedTableName = new CommandName(this, _scatalogname, _sschemaname, _stablename, false);
- return ComposedTableName.getComposedName();
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
}
-
-
- public String getComposedTableName(){
- if (ComposedTableName != null)
- return this.ComposedTableName.getComposedName();
- else
- return null;
+ String[] sbinaryfieldnames = new String[NonBinaryFieldNameVector.size()];
+ NonBinaryFieldNameVector.toArray(sbinaryfieldnames);
+ return sbinaryfieldnames;
+ }
+
+ public String getComposedTableName(String _scatalogname, String _sschemaname, String _stablename)
+ {
+ ComposedTableName = new CommandName(this, _scatalogname, _sschemaname, _stablename, false);
+ return ComposedTableName.getComposedName();
+ }
+
+ public String getComposedTableName()
+ {
+ if (ComposedTableName != null)
+ {
+ return this.ComposedTableName.getComposedName();
+ }
+ else
+ {
+ return null;
}
+ }
-
- /* (non-Javadoc)
- * @see com.sun.star.container.XContainerListener#elementInserted(com.sun.star.container.ContainerEvent)
- */
- public void elementInserted(ContainerEvent arg0) {
- try {
+ /* (non-Javadoc)
+ * @see com.sun.star.container.XContainerListener#elementInserted(com.sun.star.container.ContainerEvent)
+ */
+ public void elementInserted(ContainerEvent arg0)
+ {
+ try
+ {
XPropertySet xTablePropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, arg0.Element);
String stablename = AnyConverter.toString(xTablePropertySet.getPropertyValue("Name"));
String sschemaname = AnyConverter.toString(xPropTableDataDescriptor.getPropertyValue("SchemaName"));
String scatalogname = AnyConverter.toString(xPropTableDataDescriptor.getPropertyValue("CatalogName"));
ComposedTableName = new CommandName(this, scatalogname, sschemaname, stablename, false);
appendTableNameToFilter(ComposedTableName.getComposedName());
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- /* (non-Javadoc)
- * @see com.sun.star.container.XContainerListener#elementRemoved(com.sun.star.container.ContainerEvent)
- */
- public void elementRemoved(ContainerEvent arg0) {
-
}
-
- /* (non-Javadoc)
- * @see com.sun.star.container.XContainerListener#elementReplaced(com.sun.star.container.ContainerEvent)
- */
- public void elementReplaced(ContainerEvent arg0) {
-
- }
-
- /* (non-Javadoc)
- * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
- */
- public void disposing(EventObject arg0) {
-
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
}
-
- /**
- * @param _stablename
- * @return
- */
- public boolean appendTableNameToFilter(String _scomposedtablename){
- boolean bhastoinsert = true;
- for (int i = 0; i < sTableFilters.length; i++){
- if (sTableFilters[i].compareTo("%") > -1){
- if (sTableFilters[i].endsWith("." + _scomposedtablename))
- bhastoinsert = false;
- else if (sTableFilters[i].length() == 1)
- bhastoinsert = false;
- }
- else if (sTableFilters[i].equals(_scomposedtablename))
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.container.XContainerListener#elementRemoved(com.sun.star.container.ContainerEvent)
+ */
+ public void elementRemoved(ContainerEvent arg0)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.container.XContainerListener#elementReplaced(com.sun.star.container.ContainerEvent)
+ */
+ public void elementReplaced(ContainerEvent arg0)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
+ */
+ public void disposing(EventObject arg0)
+ {
+ }
+
+ /**
+ * @param _stablename
+ * @return
+ */
+ public boolean appendTableNameToFilter(String _scomposedtablename)
+ {
+ boolean bhastoinsert = true;
+ for (int i = 0; i < sTableFilters.length; i++)
+ {
+ if (sTableFilters[i].compareTo("%") > -1)
+ {
+ if (sTableFilters[i].endsWith("." + _scomposedtablename))
+ {
bhastoinsert = false;
- if (!bhastoinsert)
- break;
- }
- if (bhastoinsert){
- String[] sNewTableFilters = new String[sTableFilters.length + 1];
- System.arraycopy(sTableFilters, 0, sNewTableFilters, 0, sTableFilters.length);
- sNewTableFilters[sTableFilters.length] = _scomposedtablename;
- sTableFilters = sNewTableFilters;
- try {
- xDataSourcePropertySet.setPropertyValue("TableFilter", sTableFilters);
- } catch (Exception e) {
- e.printStackTrace(System.out);
+ }
+ else if (sTableFilters[i].length() == 1)
+ {
bhastoinsert = false;
}
}
- return bhastoinsert;
+ else if (sTableFilters[i].equals(_scomposedtablename))
+ {
+ bhastoinsert = false;
+ }
+ if (!bhastoinsert)
+ {
+ break;
+ }
+ }
+ if (bhastoinsert)
+ {
+ String[] sNewTableFilters = new String[sTableFilters.length + 1];
+ System.arraycopy(sTableFilters, 0, sNewTableFilters, 0, sTableFilters.length);
+ sNewTableFilters[sTableFilters.length] = _scomposedtablename;
+ sTableFilters = sNewTableFilters;
+ try
+ {
+ xDataSourcePropertySet.setPropertyValue("TableFilter", sTableFilters);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ bhastoinsert = false;
+ }
}
+ return bhastoinsert;
+ }
}
diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java
index e0133623edea..689910b87e4c 100644
--- a/wizards/com/sun/star/wizards/db/TypeInspector.java
+++ b/wizards/com/sun/star/wizards/db/TypeInspector.java
@@ -44,8 +44,9 @@ import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.common.JavaTools;
+public class TypeInspector
+{
-public class TypeInspector{
private String[] sDataTypeNames;
private int[] nDataTypeInfos;
private int[] nPrecisionInfos;
@@ -54,194 +55,253 @@ public class TypeInspector{
private boolean[] bisAutoIncrementableInfos;
private int[] nMinScaleInfos;
private int[] nMaxScaleInfos;
- private int[] nNumericFallBackList = new int[]{DataType.INTEGER, DataType.FLOAT, DataType.REAL, DataType.DOUBLE, DataType.NUMERIC, DataType.DECIMAL};
+ private int[] nNumericFallBackList = new int[]
+ {
+ DataType.INTEGER, DataType.FLOAT, DataType.REAL, DataType.DOUBLE, DataType.NUMERIC, DataType.DECIMAL
+ };
final int INVALID = 999999;
XResultSet xResultSet;
- public class TypeInfo{
+ public class TypeInfo
+ {
+
public int nDataType;
public String sDataTypeName;
public boolean bisAutoIncrementable;
- public TypeInfo(int _nDataType, String _sDataTypeName, boolean _bisAutoIncrementable){
+ public TypeInfo(int _nDataType, String _sDataTypeName, boolean _bisAutoIncrementable)
+ {
nDataType = _nDataType;
sDataTypeName = _sDataTypeName;
bisAutoIncrementable = _bisAutoIncrementable;
}
}
- public TypeInspector(XResultSet _xResultSet){
- try {
- xResultSet = _xResultSet;
- Vector aTypeNameVector = new Vector();
- Vector aTypeVector = new Vector();
- Vector aNullableVector = new Vector();
- Vector aAutoIncrementVector = new Vector();
- Vector aPrecisionVector = new Vector();
- Vector aMinScaleVector = new Vector();
- Vector aMaxScaleVector = new Vector();
- Vector aSearchableVector = new Vector();
- Integer[] aIntegerDataTypes = null;
+ public TypeInspector(XResultSet _xResultSet)
+ {
+ try
+ {
+ xResultSet = _xResultSet;
+ Vector aTypeNameVector = new Vector();
+ Vector aTypeVector = new Vector();
+ Vector aNullableVector = new Vector();
+ Vector aAutoIncrementVector = new Vector();
+ Vector aPrecisionVector = new Vector();
+ Vector aMinScaleVector = new Vector();
+ Vector aMaxScaleVector = new Vector();
+ Vector aSearchableVector = new Vector();
+ Integer[] aIntegerDataTypes = null;
// XResultSet xResultSet = xDBMetaDagetTypeInfo();
- XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet);
- while (xResultSet.next()){
- aTypeNameVector.addElement(new String(xRow.getString(1)));
- aTypeVector.addElement(new Integer(xRow.getShort(2)));
- aPrecisionVector.addElement(new Integer(xRow.getInt(3)));
- aNullableVector.addElement(new Integer(xRow.getShort(7)));
- aSearchableVector.addElement(new Integer(xRow.getShort(9)));
- aAutoIncrementVector.addElement(new Boolean(xRow.getBoolean(12)));
- aMinScaleVector.addElement(new Integer(xRow.getShort(14)));
- aMaxScaleVector.addElement(new Integer(xRow.getShort(15)));
+ XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet);
+ while (xResultSet.next())
+ {
+ aTypeNameVector.addElement(new String(xRow.getString(1)));
+ aTypeVector.addElement(new Integer(xRow.getShort(2)));
+ aPrecisionVector.addElement(new Integer(xRow.getInt(3)));
+ aNullableVector.addElement(new Integer(xRow.getShort(7)));
+ aSearchableVector.addElement(new Integer(xRow.getShort(9)));
+ aAutoIncrementVector.addElement(new Boolean(xRow.getBoolean(12)));
+ aMinScaleVector.addElement(new Integer(xRow.getShort(14)));
+ aMaxScaleVector.addElement(new Integer(xRow.getShort(15)));
+ }
+ sDataTypeNames = new String[aTypeNameVector.size()];
+ aTypeNameVector.toArray(sDataTypeNames);
+ nDataTypeInfos = JavaTools.IntegerTointList(aTypeVector);
+ nNullableInfos = JavaTools.IntegerTointList(aNullableVector);
+ nSearchables = JavaTools.IntegerTointList(aSearchableVector);
+ bisAutoIncrementableInfos = JavaTools.BooleanTobooleanList(aAutoIncrementVector);
+ nPrecisionInfos = JavaTools.IntegerTointList(aPrecisionVector);
+ nMinScaleInfos = JavaTools.IntegerTointList(aMinScaleVector);
+ nMaxScaleInfos = JavaTools.IntegerTointList(aMaxScaleVector);
}
- sDataTypeNames = new String[aTypeNameVector.size()];
- aTypeNameVector.toArray(sDataTypeNames);
- nDataTypeInfos = JavaTools.IntegerTointList(aTypeVector);
- nNullableInfos = JavaTools.IntegerTointList(aNullableVector);
- nSearchables = JavaTools.IntegerTointList(aSearchableVector);
- bisAutoIncrementableInfos = JavaTools.BooleanTobooleanList(aAutoIncrementVector);
- nPrecisionInfos = JavaTools.IntegerTointList(aPrecisionVector);
- nMinScaleInfos = JavaTools.IntegerTointList(aMinScaleVector);
- nMaxScaleInfos = JavaTools.IntegerTointList(aMaxScaleVector);
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- }}
-
-
- public int getScale(XPropertySet _xColPropertySet){
- try {
- int i = getDataTypeIndex(_xColPropertySet, false);
- int nScale = AnyConverter.toInt(_xColPropertySet.getPropertyValue("Scale"));
- if (i == -1)
- return nScale;
- if (nScale > nMaxScaleInfos[i])
- return nMaxScaleInfos[i];
- else if (nScale < nMinScaleInfos[i])
- return nMinScaleInfos[i];
- else
- return nScale;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return 0;
- }}
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ public int getScale(XPropertySet _xColPropertySet)
+ {
+ try
+ {
+ int i = getDataTypeIndex(_xColPropertySet, false);
+ int nScale = AnyConverter.toInt(_xColPropertySet.getPropertyValue("Scale"));
+ if (i == -1)
+ {
+ return nScale;
+ }
+ if (nScale > nMaxScaleInfos[i])
+ {
+ return nMaxScaleInfos[i];
+ }
+ else if (nScale < nMinScaleInfos[i])
+ {
+ return nMinScaleInfos[i];
+ }
+ else
+ {
+ return nScale;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return 0;
+ }
+ }
- public int getNullability(XPropertySet _xColPropertySet, int _nNullable){
+ public int getNullability(XPropertySet _xColPropertySet, int _nNullable)
+ {
int i = getDataTypeIndex(_xColPropertySet, false);
if (i == -1)
+ {
return ColumnValue.NO_NULLS;
+ }
int nNullable = _nNullable;
if (nNullable == ColumnValue.NULLABLE)
+ {
return nNullableInfos[i]; //probably nullability is not allowed
+ }
return nNullable;
}
-
- public int getNullability(XPropertySet _xColPropertySet){
- try {
+ public int getNullability(XPropertySet _xColPropertySet)
+ {
+ try
+ {
int i = getDataTypeIndex(_xColPropertySet, false);
if (i == -1)
+ {
return ColumnValue.NO_NULLS;
+ }
int nNullable = AnyConverter.toInt(_xColPropertySet.getPropertyValue("IsNullable"));
if (nNullable == ColumnValue.NULLABLE)
+ {
return nNullableInfos[i];
+ }
return nNullable;
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return ColumnValue.NO_NULLS;
}
-
- public boolean isColumnOrderable(XPropertySet _xColPropertySet){
+ public boolean isColumnOrderable(XPropertySet _xColPropertySet)
+ {
int i = getDataTypeIndex(_xColPropertySet, false);
if (i > -1)
+ {
return (nSearchables[i] != ColumnSearch.NONE);
+ }
else
+ {
return false;
+ }
}
-
- public int isNullable(XPropertySet _xColPropertySet){
+ public int isNullable(XPropertySet _xColPropertySet)
+ {
int i = getDataTypeIndex(_xColPropertySet, false);
if (i > -1)
+ {
return nNullableInfos[i];
+ }
else
+ {
return ColumnValue.NO_NULLS;
+ }
}
-
- private int getDataTypeIndex(XPropertySet _xColPropertySet, boolean _bCheckNumericAttributes){
- try {
+ private int getDataTypeIndex(XPropertySet _xColPropertySet, boolean _bCheckNumericAttributes)
+ {
+ try
+ {
int nPrecision = -1;
int nScale = -1;
int nDataType = AnyConverter.toInt(_xColPropertySet.getPropertyValue("Type"));
String sTypeName = AnyConverter.toString(_xColPropertySet.getPropertyValue("TypeName"));
- if (_bCheckNumericAttributes){
+ if (_bCheckNumericAttributes)
+ {
nPrecision = AnyConverter.toInt(_xColPropertySet.getPropertyValue("Precision"));
nScale = AnyConverter.toInt(_xColPropertySet.getPropertyValue("Scale"));
}
boolean bleaveloop = false;
int startindex = 0;
- while (!bleaveloop){
+ while (!bleaveloop)
+ {
int i = JavaTools.FieldInIntTable(nDataTypeInfos, nDataType, startindex);
- startindex = i+1;
+ startindex = i + 1;
bleaveloop = (i < 0);
- if (!bleaveloop){
- if (sTypeName.equals(sDataTypeNames[i])){
- if (_bCheckNumericAttributes){
- if (nPrecision <= nPrecisionInfos[i]){
- if ((nScale >= nMinScaleInfos[i]) && (nScale <= nMinScaleInfos[i])){
+ if (!bleaveloop)
+ {
+ if (sTypeName.equals(sDataTypeNames[i]))
+ {
+ if (_bCheckNumericAttributes)
+ {
+ if (nPrecision <= nPrecisionInfos[i])
+ {
+ if ((nScale >= nMinScaleInfos[i]) && (nScale <= nMinScaleInfos[i]))
+ {
return i;
}
}
}
else
+ {
return i;
+ }
}
}
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return -1;
}
-
- public boolean supportsDataType(int _curDataType){
- return (JavaTools.FieldInIntTable(nDataTypeInfos, _curDataType)> -1);
+ public boolean supportsDataType(int _curDataType)
+ {
+ return (JavaTools.FieldInIntTable(nDataTypeInfos, _curDataType) > -1);
}
-
- public int getLastConversionFallbackDataType(){
+ public int getLastConversionFallbackDataType()
+ {
if (supportsDataType(DataType.VARCHAR))
+ {
return DataType.VARCHAR;
+ }
else
+ {
return DataType.LONGVARCHAR;
+ }
}
-
/**
* an empty string is returned when no appropriate Typename can be found
* finds the first TypeName of the passed datatype.
* @param _curDataType
* @return
*/
- public String getDefaultTypeName(int _curDataType, Integer precision){
+ public String getDefaultTypeName(int _curDataType, Integer precision)
+ {
String ret = "";
- for( int i = 0 ; i < nDataTypeInfos.length ; i ++ )
+ for (int i = 0; i < nDataTypeInfos.length; i++)
{
- if( nDataTypeInfos[i] == _curDataType )
+ if (nDataTypeInfos[i] == _curDataType)
{
// System.out.println( "Desired prec " + precision + ",nPrecisionInfos[i]="+nPrecisionInfos[i] + ",sDataTypeNames[i]="+sDataTypeNames[i] );
- if( precision == null || nPrecisionInfos[i] >= precision.intValue() )
+ if (precision == null || nPrecisionInfos[i] >= precision.intValue())
{
ret = sDataTypeNames[i]; // this fits best !
break;
}
- else if( ret.length() == 0 )
+ else if (ret.length() == 0)
{
// in case we dont find anything else, we at return a typename
// with the correct class
@@ -253,27 +313,32 @@ public class TypeInspector{
return ret;
}
-
- public int getDataType(String _sTypeName){
+ public int getDataType(String _sTypeName)
+ {
int i = JavaTools.FieldInList(sDataTypeNames, _sTypeName);
if (i > -1)
+ {
return nDataTypeInfos[i];
+ }
else
+ {
return getLastConversionFallbackDataType();
+ }
}
-
- public int convertDataType(int _curDataType){
+ public int convertDataType(int _curDataType)
+ {
int retDataType = _curDataType;
- if (!supportsDataType(_curDataType)){
- switch(_curDataType)
+ if (!supportsDataType(_curDataType))
+ {
+ switch (_curDataType)
{
case DataType.BIT:
- retDataType = convertDataType(DataType.BOOLEAN);
- break;
+ retDataType = convertDataType(DataType.BOOLEAN);
+ break;
case DataType.BOOLEAN:
- retDataType = convertDataType(DataType.BIT);
- break;
+ retDataType = convertDataType(DataType.BIT);
+ break;
case DataType.TINYINT:
retDataType = convertDataType(DataType.SMALLINT);
break;
@@ -303,11 +368,17 @@ public class TypeInspector{
break;
case DataType.DECIMAL:
if (supportsDataType(DataType.DOUBLE))
+ {
retDataType = convertDataType(DataType.DOUBLE);
+ }
else if (supportsDataType(DataType.NUMERIC))
+ {
retDataType = DataType.NUMERIC;
+ }
else
+ {
retDataType = getLastConversionFallbackDataType();
+ }
break;
case DataType.VARCHAR:
retDataType = getLastConversionFallbackDataType();
@@ -319,35 +390,40 @@ public class TypeInspector{
return retDataType;
}
- public int getAutoIncrementIndex(XPropertySet _xColPropertySet){
- try {
- boolean bleaveloop = false;
- int startindex = 0;
- int curDataType = ((Integer) _xColPropertySet.getPropertyValue("Type")).intValue();
- while (!bleaveloop){
- int i = JavaTools.FieldInIntTable(nDataTypeInfos, curDataType, startindex);
- startindex = i+1;
- bleaveloop = (i == -1);
- if (!bleaveloop){
- if (bisAutoIncrementableInfos[i]){
- return nDataTypeInfos[i];
+ public int getAutoIncrementIndex(XPropertySet _xColPropertySet)
+ {
+ try
+ {
+ boolean bleaveloop = false;
+ int startindex = 0;
+ int curDataType = ((Integer) _xColPropertySet.getPropertyValue("Type")).intValue();
+ while (!bleaveloop)
+ {
+ int i = JavaTools.FieldInIntTable(nDataTypeInfos, curDataType, startindex);
+ startindex = i + 1;
+ bleaveloop = (i == -1);
+ if (!bleaveloop)
+ {
+ if (bisAutoIncrementableInfos[i])
+ {
+ return nDataTypeInfos[i];
+ }
}
}
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return INVALID;
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return INVALID;
}
-
- public boolean isAutoIncrementable(XPropertySet _xColPropertySet){
+ public boolean isAutoIncrementable(XPropertySet _xColPropertySet)
+ {
return (getAutoIncrementIndex(_xColPropertySet) != INVALID);
}
-
-
/** finds the first available DataType that can be used as a primary key in a table.
* @return The first datatype that also supports Autoincrmentation is taken according to the following list:
*1) INTEGER
@@ -364,25 +440,31 @@ public class TypeInspector{
* on several spots in the class!!
*
*/
- public TypeInfo findAutomaticPrimaryKeyType(){
+ public TypeInfo findAutomaticPrimaryKeyType()
+ {
int nDataType;
- for (int n = 0; n < this.nNumericFallBackList.length; n++){
+ for (int n = 0; n < this.nNumericFallBackList.length; n++)
+ {
nDataType = nNumericFallBackList[n];
boolean bleaveloop = false;
int startindex = 0;
- while (!bleaveloop){
+ while (!bleaveloop)
+ {
int i = JavaTools.FieldInIntTable(nDataTypeInfos, nDataType, startindex);
bleaveloop = (i < 0);
- if (!bleaveloop){
- if (this.bisAutoIncrementableInfos[i] )
+ if (!bleaveloop)
+ {
+ if (this.bisAutoIncrementableInfos[i])
+ {
return new TypeInfo(nDataType, this.sDataTypeNames[i], true);
- startindex = i+1;
+ }
+ startindex = i + 1;
}
- startindex = i+1;
+ startindex = i + 1;
}
}
// As Autoincrementation is not supported for any numeric datatype we take the first available numeric Type;
- nDataType =convertDataType(DataType.INTEGER);
- return new TypeInfo(nDataType, getDefaultTypeName(nDataType,null), false);
+ nDataType = convertDataType(DataType.INTEGER);
+ return new TypeInfo(nDataType, getDefaultTypeName(nDataType, null), false);
}
}
diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java
index 557b9340cdb3..c5f2ed8ff403 100644
--- a/wizards/com/sun/star/wizards/document/Control.java
+++ b/wizards/com/sun/star/wizards/document/Control.java
@@ -28,6 +28,7 @@
*
************************************************************************/
package com.sun.star.wizards.document;
+
import com.sun.star.awt.Point;
import com.sun.star.awt.Size;
import com.sun.star.awt.XControl;
@@ -51,8 +52,9 @@ import com.sun.star.drawing.XShapes;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.WrappedTargetException;
+public class Control extends Shape
+{
-public class Control extends Shape{
XControlModel xControlModel;
XControl xControl;
public XPropertySet xPropertySet;
@@ -67,72 +69,87 @@ public class Control extends Shape{
protected XNameContainer xFormName;
protected final int IIMGFIELDWIDTH = 2000;
-
- public Control(){
+ public Control()
+ {
}
- public Control(FormHandler _oFormHandler, String _sServiceName, Point _aPoint){
+ public Control(FormHandler _oFormHandler, String _sServiceName, Point _aPoint)
+ {
super(_oFormHandler, _sServiceName, _aPoint, null);
}
- public Control(FormHandler _oFormHandler, XNameContainer _xFormName, int _icontroltype, String _FieldName, Point _aPoint, Size _aSize){
- super(_oFormHandler, _aPoint, _aSize);
+ public Control(FormHandler _oFormHandler, XNameContainer _xFormName, int _icontroltype, String _FieldName, Point _aPoint, Size _aSize)
+ {
+ super(_oFormHandler, _aPoint, _aSize);
xFormName = _xFormName;
createControl(_icontroltype, _aPoint, _aSize, null, _FieldName);
}
-
- public Control(FormHandler _oFormHandler, XShapes _xGroupShapes, XNameContainer _xFormName, int _icontroltype, Point _aPoint, Size _aSize){
- super(_oFormHandler, _aPoint, _aSize);
+ public Control(FormHandler _oFormHandler, XShapes _xGroupShapes, XNameContainer _xFormName, int _icontroltype, Point _aPoint, Size _aSize)
+ {
+ super(_oFormHandler, _aPoint, _aSize);
xFormName = _xFormName;
createControl(_icontroltype, _aPoint, _aSize, _xGroupShapes, null);
}
-
- public Control(FormHandler _oFormHandler, int _icontroltype, Point _aPoint, Size _aSize){
+ public Control(FormHandler _oFormHandler, int _icontroltype, Point _aPoint, Size _aSize)
+ {
super(_oFormHandler, _aPoint, _aSize);
createControl(_icontroltype, _aPoint, _aSize, null, null);
}
-
-
- public void createControl(int _icontroltype, Point _aPoint, Size _aSize, XShapes _xGroupShapes, String _FieldName){
- try {
- this.icontroltype = _icontroltype;
- this.sServiceName = oFormHandler.sModelServices[icontroltype];
- Object oControlModel = oFormHandler.xMSFDoc.createInstance(sServiceName);
- xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, oControlModel);
- xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oControlModel);
- insertControlInContainer(_FieldName);
- xControlShape.setControl(xControlModel);
- if (_xGroupShapes == null)
- oFormHandler.xDrawPage.add(xShape);
- else
- _xGroupShapes.add(xShape);
- xControl = oFormHandler.xControlAccess.getControl(xControlModel);
- xControlPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControl);
- xWindowPeer = xControl.getPeer();
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- public void insertControlInContainer(String _fieldname){
- try {
- if (xFormName != null){
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xFormName);
- String sControlName = Desktop.getUniqueName(xNameAccess, getControlName(_fieldname));
- xPropertySet.setPropertyValue("Name", sControlName);
- xFormName.insertByName(sControlName, xControlModel);
+ public void createControl(int _icontroltype, Point _aPoint, Size _aSize, XShapes _xGroupShapes, String _FieldName)
+ {
+ try
+ {
+ this.icontroltype = _icontroltype;
+ this.sServiceName = oFormHandler.sModelServices[icontroltype];
+ Object oControlModel = oFormHandler.xMSFDoc.createInstance(sServiceName);
+ xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, oControlModel);
+ xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oControlModel);
+ insertControlInContainer(_FieldName);
+ xControlShape.setControl(xControlModel);
+ if (_xGroupShapes == null)
+ {
+ oFormHandler.xDrawPage.add(xShape);
+ }
+ else
+ {
+ _xGroupShapes.add(xShape);
+ }
+ xControl = oFormHandler.xControlAccess.getControl(xControlModel);
+ xControlPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControl);
+ xWindowPeer = xControl.getPeer();
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ public void insertControlInContainer(String _fieldname)
+ {
+ try
+ {
+ if (xFormName != null)
+ {
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xFormName);
+ String sControlName = Desktop.getUniqueName(xNameAccess, getControlName(_fieldname));
+ xPropertySet.setPropertyValue("Name", sControlName);
+ xFormName.insertByName(sControlName, xControlModel);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public String getControlName(String _fieldname){
+ public String getControlName(String _fieldname)
+ {
String controlname = "";
- switch (getControlType()){
+ switch (getControlType())
+ {
case FormHandler.SOLABEL:
controlname = "lbl" + _fieldname;
break;
@@ -163,140 +180,182 @@ public class Control extends Shape{
return controlname;
}
-
- private void setDefaultValue(Object DatabaseField){
+ private void setDefaultValue(Object DatabaseField)
+ {
oDefaultValue = Helper.getUnoPropertyValue(DatabaseField, "DefaultValue");
}
-
- public int getPreferredWidth(String sText){
+ public int getPreferredWidth(String sText)
+ {
Size aPeerSize = getPreferredSize(sText);
return ((aPeerSize.Width + 10) * oFormHandler.getXPixelFactor());
}
-
- public int getPreferredHeight(String sText){
+ public int getPreferredHeight(String sText)
+ {
Size aPeerSize = getPreferredSize(sText);
if (icontroltype == FormHandler.SOCHECKBOX)
+ {
return (aPeerSize.Height * oFormHandler.getXPixelFactor());
+ }
else
+ {
return ((aPeerSize.Height + 2) * oFormHandler.getXPixelFactor());
+ }
}
-
- public int getPreferredWidth(){
+ public int getPreferredWidth()
+ {
if (icontroltype == FormHandler.SOIMAGECONTROL)
+ {
return IIMGFIELDWIDTH;
- else{
+ }
+ else
+ {
Size aPeerSize = getPeerSize();
// We increase the preferred Width a bit so that the control does not become too small
// when we change the border from "3D" to "Flat"
if (icontroltype == FormHandler.SOCHECKBOX)
- return((aPeerSize.Width * oFormHandler.getXPixelFactor()) );
+ {
+ return ((aPeerSize.Width * oFormHandler.getXPixelFactor()));
+ }
else
- return((aPeerSize.Width * oFormHandler.getXPixelFactor()) + 200);
+ {
+ return ((aPeerSize.Width * oFormHandler.getXPixelFactor()) + 200);
+ }
}
}
-
- public int getPreferredHeight(){
+ public int getPreferredHeight()
+ {
if (this.icontroltype == FormHandler.SOIMAGECONTROL)
+ {
return 2000;
- else{
+ }
+ else
+ {
Size aPeerSize = getPeerSize();
int nHeight = aPeerSize.Height;
// We increase the preferred Height a bit so that the control does not become too small
// when we change the border from "3D" to "Flat"
- return((nHeight+1) * oFormHandler.getYPixelFactor());
+ return ((nHeight + 1) * oFormHandler.getYPixelFactor());
}
}
-
- public Size getPreferredSize(String sText){
- try {
- if (xPropertySet.getPropertySetInfo().hasPropertyByName("Text")){
- xPropertySet.setPropertyValue("Text", sText);
+ public Size getPreferredSize(String sText)
+ {
+ try
+ {
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName("Text"))
+ {
+ xPropertySet.setPropertyValue("Text", sText);
+ }
+ else if (xPropertySet.getPropertySetInfo().hasPropertyByName("Label"))
+ {
+ xPropertySet.setPropertyValue("Label", sText);
+ }
+ else
+ {
+ throw new IllegalArgumentException();
+ }
+ return getPeer().getPreferredSize();
}
- else if (xPropertySet.getPropertySetInfo().hasPropertyByName("Label"))
- xPropertySet.setPropertyValue("Label", sText);
- else
- throw new IllegalArgumentException();
-
- return getPeer().getPreferredSize();
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return null;
- }}
-
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
- public void setPropertyValue(String _sPropertyName, Object _aPropertyValue) throws Exception{
+ public void setPropertyValue(String _sPropertyName, Object _aPropertyValue) throws Exception
+ {
if (xPropertySet.getPropertySetInfo().hasPropertyByName(_sPropertyName))
+ {
xPropertySet.setPropertyValue(_sPropertyName, _aPropertyValue);
+ }
}
-
/** the peer should be retrieved every time before it is used because it
* might be disposed otherwise
*
* @return
*/
- public XLayoutConstrains getPeer(){
- return (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, xControl.getPeer());
+ public XLayoutConstrains getPeer()
+ {
+ return (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, xControl.getPeer());
}
- public Size getPeerSize(){
- try {
- Size aPreferredSize = null;
- double dblEffMax = 0;
- if (xPropertySet.getPropertySetInfo().hasPropertyByName("EffectiveMax")){
- Object oValue = xPropertySet.getPropertyValue("EffectiveMax");
- if (xPropertySet.getPropertyValue("EffectiveMax") != com.sun.star.uno.Any.VOID)
- dblEffMax = AnyConverter.toDouble(xPropertySet.getPropertyValue("EffectiveMax"));
- if (dblEffMax == 0){
- // This is relevant for decimal fields
- xPropertySet.setPropertyValue("EffectiveValue", new Double(99999));
+ public Size getPeerSize()
+ {
+ try
+ {
+ Size aPreferredSize = null;
+ double dblEffMax = 0;
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName("EffectiveMax"))
+ {
+ Object oValue = xPropertySet.getPropertyValue("EffectiveMax");
+ if (xPropertySet.getPropertyValue("EffectiveMax") != com.sun.star.uno.Any.VOID)
+ {
+ dblEffMax = AnyConverter.toDouble(xPropertySet.getPropertyValue("EffectiveMax"));
+ }
+ if (dblEffMax == 0)
+ {
+ // This is relevant for decimal fields
+ xPropertySet.setPropertyValue("EffectiveValue", new Double(99999));
+ }
+ else
+ {
+ xPropertySet.setPropertyValue("EffectiveValue", new Double(dblEffMax)); //new Double(100000.2)); //
+ }
+ aPreferredSize = getPeer().getPreferredSize();
+ xPropertySet.setPropertyValue("EffectiveValue", com.sun.star.uno.Any.VOID);
}
- else{
- xPropertySet.setPropertyValue("EffectiveValue", new Double(dblEffMax)); //new Double(100000.2)); //
+ else if (this.icontroltype == FormHandler.SOCHECKBOX)
+ {
+ aPreferredSize = getPeer().getPreferredSize();
+ }
+ else if (this.icontroltype == FormHandler.SODATECONTROL)
+ {
+ xPropertySet.setPropertyValue("Date", new Integer(4711)); //TODO find a better date
+ aPreferredSize = getPeer().getPreferredSize();
+ xPropertySet.setPropertyValue("Date", com.sun.star.uno.Any.VOID);
+ }
+ else if (this.icontroltype == FormHandler.SOTIMECONTROL)
+ {
+ xPropertySet.setPropertyValue("Time", new Integer(47114)); //TODO find a better time
+ aPreferredSize = getPeer().getPreferredSize();
+ xPropertySet.setPropertyValue("Time", com.sun.star.uno.Any.VOID);
}
- aPreferredSize = getPeer().getPreferredSize();
- xPropertySet.setPropertyValue("EffectiveValue", com.sun.star.uno.Any.VOID);
- }
- else if (this.icontroltype == FormHandler.SOCHECKBOX){
- aPreferredSize = getPeer().getPreferredSize();
- }
- else if (this.icontroltype == FormHandler.SODATECONTROL){
- xPropertySet.setPropertyValue("Date", new Integer(4711)); //TODO find a better date
- aPreferredSize = getPeer().getPreferredSize();
- xPropertySet.setPropertyValue("Date", com.sun.star.uno.Any.VOID);
- }
- else if (this.icontroltype == FormHandler.SOTIMECONTROL){
- xPropertySet.setPropertyValue("Time", new Integer(47114)); //TODO find a better time
- aPreferredSize = getPeer().getPreferredSize();
- xPropertySet.setPropertyValue("Time", com.sun.star.uno.Any.VOID);
- }
- else{
- String stext;
- short iTextLength = AnyConverter.toShort(xPropertySet.getPropertyValue("MaxTextLen"));
- if (iTextLength < this.SOMAXTEXTSIZE)
- stext = FormHandler.SOSIZETEXT.substring(0,this.SOMAXTEXTSIZE);
else
- stext = FormHandler.SOSIZETEXT.substring(0, iTextLength);
- xPropertySet.setPropertyValue("Text", stext);
- aPreferredSize = getPeer().getPreferredSize();
- xPropertySet.setPropertyValue("Text", "");
+ {
+ String stext;
+ short iTextLength = AnyConverter.toShort(xPropertySet.getPropertyValue("MaxTextLen"));
+ if (iTextLength < this.SOMAXTEXTSIZE)
+ {
+ stext = FormHandler.SOSIZETEXT.substring(0, this.SOMAXTEXTSIZE);
+ }
+ else
+ {
+ stext = FormHandler.SOSIZETEXT.substring(0, iTextLength);
+ }
+ xPropertySet.setPropertyValue("Text", stext);
+ aPreferredSize = getPeer().getPreferredSize();
+ xPropertySet.setPropertyValue("Text", "");
+ }
+ return aPreferredSize;
}
- return aPreferredSize;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return null;
- }}
-
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
/**
* @return
*/
- public int getControlType() {
+ public int getControlType()
+ {
return icontroltype;
}
}
diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java
index e5baeaaf8d2e..f809ef479f05 100644
--- a/wizards/com/sun/star/wizards/document/DatabaseControl.java
+++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java
@@ -26,7 +26,9 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.document;
+ ************************************************************************/
+
+package com.sun.star.wizards.document;
import com.sun.star.awt.Point;
import com.sun.star.awt.Size;
@@ -50,149 +52,184 @@ import com.sun.star.wizards.db.FieldColumn;
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
-public class DatabaseControl extends Control {
+public class DatabaseControl extends Control
+{
+
protected int ifieldtype;
private int iMemofieldwidth = IIMGFIELDWIDTH;
private int iMemofieldheight = -1;
private FieldColumn m_FieldColumn;
-
- public DatabaseControl(GridControl _oGridControl, FieldColumn _curfieldcolumn){
+ public DatabaseControl(GridControl _oGridControl, FieldColumn _curfieldcolumn)
+ {
super();
m_FieldColumn = _curfieldcolumn;
if (_curfieldcolumn.FieldType != DataType.TIMESTAMP)
- createGridColumn(_oGridControl, _curfieldcolumn, _curfieldcolumn.FieldType, _curfieldcolumn.FieldTitle);
+ {
+ createGridColumn(_oGridControl, _curfieldcolumn, _curfieldcolumn.FieldType, _curfieldcolumn.getFieldTitle());
+ }
}
-
- public DatabaseControl(GridControl _oGridControl, FieldColumn _curfieldcolumn, int _fieldtype, String _columntitle){
+ public DatabaseControl(GridControl _oGridControl, FieldColumn _curfieldcolumn, int _fieldtype, String _columntitle)
+ {
super();
m_FieldColumn = _curfieldcolumn;
createGridColumn(_oGridControl, _curfieldcolumn, _fieldtype, _columntitle);
}
+ private void createGridColumn(GridControl _oGridControl, FieldColumn _curfieldcolumn, int _fieldtype, String _columntitle)
+ {
+ try
+ {
+ ifieldtype = _fieldtype;
+ String suniqueName = Desktop.getUniqueName(_oGridControl.xNameAccess, _curfieldcolumn.m_sFieldName);
+ XPropertySet xPropColumn = _oGridControl.xGridColumnFactory.createColumn(getGridColumnName());
+ xPropColumn.setPropertyValue("Name", suniqueName);
+ xPropColumn.setPropertyValue("Hidden", new Boolean(_fieldtype == DataType.LONGVARBINARY)); //TODO CONTROLType abfragen!!!!!!
+ xPropColumn.setPropertyValue("DataField", _curfieldcolumn.m_sFieldName);
+ xPropColumn.setPropertyValue("Label", _columntitle);
+ xPropColumn.setPropertyValue("Width", new Integer(0)); // Width of column is adjusted to Columname
+ setNumerics();
+ _oGridControl.xNameContainer.insertByName(_curfieldcolumn.m_sFieldName, xPropColumn);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- private void createGridColumn(GridControl _oGridControl, FieldColumn _curfieldcolumn, int _fieldtype, String _columntitle){
- try {
- ifieldtype = _fieldtype;
- String suniqueName = Desktop.getUniqueName(_oGridControl.xNameAccess, _curfieldcolumn.FieldName);
- XPropertySet xPropColumn = _oGridControl.xGridColumnFactory.createColumn(getGridColumnName());
- xPropColumn.setPropertyValue("Name", suniqueName);
- xPropColumn.setPropertyValue("Hidden", new Boolean(_fieldtype == DataType.LONGVARBINARY)); //TODO CONTROLType abfragen!!!!!!
- xPropColumn.setPropertyValue("DataField", _curfieldcolumn.FieldName);
- xPropColumn.setPropertyValue("Label", _columntitle);
- xPropColumn.setPropertyValue("Width", new Integer(0)); // Width of column is adjusted to Columname
- setNumerics();
- _oGridControl.xNameContainer.insertByName(_curfieldcolumn.FieldName, xPropColumn);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- public DatabaseControl (FormHandler _oFormHandler, String _sServiceName, Point _aPoint){
+ public DatabaseControl(FormHandler _oFormHandler, String _sServiceName, Point _aPoint)
+ {
super(_oFormHandler, _sServiceName, _aPoint);
}
+ public DatabaseControl(FormHandler _oFormHandler, XNameContainer _xFormName, String _curFieldName, int _fieldtype, Point _aPoint)
+ {
+ super(_oFormHandler, _xFormName, _oFormHandler.getControlType(_fieldtype), _curFieldName, _aPoint, null);
+ try
+ {
+ this.ifieldtype = _fieldtype;
+ Helper.setUnoPropertyValue(xControlModel, "DataField", _curFieldName);
+ setNumerics();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public DatabaseControl(FormHandler _oFormHandler, XNameContainer _xFormName, String _curFieldName, int _fieldtype, Point _aPoint) {
- super(_oFormHandler, _xFormName, _oFormHandler.getControlType(_fieldtype), _curFieldName, _aPoint, null);
- try {
- this.ifieldtype = _fieldtype;
- Helper.setUnoPropertyValue(xControlModel, "DataField", _curFieldName);
- setNumerics();
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- public DatabaseControl(FormHandler _oFormHandler, XShapes _xGroupShapes, XNameContainer _xFormName, String _curFieldName, int _fieldtype, Point _aPoint) {
- super(_oFormHandler, _xGroupShapes, _xFormName, _oFormHandler.getControlType(_fieldtype), _aPoint, null);
- try {
- this.ifieldtype = _fieldtype;
- Helper.setUnoPropertyValue(xControlModel, "DataField", _curFieldName);
- setNumerics();
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ public DatabaseControl(FormHandler _oFormHandler, XShapes _xGroupShapes, XNameContainer _xFormName, String _curFieldName, int _fieldtype, Point _aPoint)
+ {
+ super(_oFormHandler, _xGroupShapes, _xFormName, _oFormHandler.getControlType(_fieldtype), _aPoint, null);
+ try
+ {
+ this.ifieldtype = _fieldtype;
+ Helper.setUnoPropertyValue(xControlModel, "DataField", _curFieldName);
+ setNumerics();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- private String getGridColumnName(){
- for (int i = 0; i < FormHandler.oControlData.length; i++){
+ private String getGridColumnName()
+ {
+ for (int i = 0; i < FormHandler.oControlData.length; i++)
+ {
if (FormHandler.oControlData[i].DataType == this.ifieldtype)
+ {
return FormHandler.oControlData[i].GridColumnName;
+ }
}
return "";
}
-
- public int getDBHeight(){
+ public int getDBHeight()
+ {
if (this.icontroltype == FormHandler.SOIMAGECONTROL)
+ {
return oFormHandler.getImageControlHeight();
- else{
- if (this.ifieldtype == DataType.LONGVARCHAR){
- if (iMemofieldheight == -1){
+ }
+ else
+ {
+ if (this.ifieldtype == DataType.LONGVARCHAR)
+ {
+ if (iMemofieldheight == -1)
+ {
Helper.setUnoPropertyValue(xControlModel, "MultiLine", Boolean.TRUE);
iMemofieldheight = oFormHandler.getDBRefHeight() * 4;
}
return iMemofieldheight;
}
else if (this.icontroltype == FormHandler.SOCHECKBOX)
+ {
return super.getPreferredHeight();
+ }
else
+ {
return oFormHandler.getDBRefHeight();
+ }
}
}
-
- public int getDBWidth(){
- if (this.ifieldtype == DataType.LONGVARCHAR){
+ public int getDBWidth()
+ {
+ if (this.ifieldtype == DataType.LONGVARCHAR)
+ {
return 2 * getDBHeight();
}
- else{
+ else
+ {
return getPreferredWidth();
}
}
-
- public void setNumerics(){
- try {
- if (this.icontroltype == FormHandler.SONUMERICCONTROL){
- xPropertySet.setPropertyValue("TreatAsNumber", Boolean.TRUE);
- switch (ifieldtype){
- case DataType.BIGINT:
- xPropertySet.setPropertyValue("EffectiveMax", new Double(2147483647 * 2147483647));
- xPropertySet.setPropertyValue("EffectiveMin", new Double(-(-2147483648 * -2147483648)));
- break;
- case DataType.INTEGER:
- xPropertySet.setPropertyValue("EffectiveMax", new Double(2147483647));
- xPropertySet.setPropertyValue("EffectiveMin", new Double(-2147483648));
- break;
- case DataType.SMALLINT:
- xPropertySet.setPropertyValue("EffectiveMax", new Double(32767));
- xPropertySet.setPropertyValue("EffectiveMin", new Double(-32768));
- break;
- case DataType.TINYINT:
- xPropertySet.setPropertyValue("EffectiveMax", new Double(127));
- xPropertySet.setPropertyValue("EffectiveMin", new Double(-128));
- break;
- case DataType.FLOAT:
- case DataType.REAL:
- case DataType.DOUBLE:
- case DataType.DECIMAL:
- case DataType.NUMERIC:
- break;
+ public void setNumerics()
+ {
+ try
+ {
+ if (this.icontroltype == FormHandler.SONUMERICCONTROL)
+ {
+ xPropertySet.setPropertyValue("TreatAsNumber", Boolean.TRUE);
+ switch (ifieldtype)
+ {
+ case DataType.BIGINT:
+ xPropertySet.setPropertyValue("EffectiveMax", new Double(2147483647 * 2147483647));
+ xPropertySet.setPropertyValue("EffectiveMin", new Double(-(-2147483648 * -2147483648)));
+ break;
+ case DataType.INTEGER:
+ xPropertySet.setPropertyValue("EffectiveMax", new Double(2147483647));
+ xPropertySet.setPropertyValue("EffectiveMin", new Double(-2147483648));
+ break;
+ case DataType.SMALLINT:
+ xPropertySet.setPropertyValue("EffectiveMax", new Double(32767));
+ xPropertySet.setPropertyValue("EffectiveMin", new Double(-32768));
+ break;
+ case DataType.TINYINT:
+ xPropertySet.setPropertyValue("EffectiveMax", new Double(127));
+ xPropertySet.setPropertyValue("EffectiveMin", new Double(-128));
+ break;
+ case DataType.FLOAT:
+ case DataType.REAL:
+ case DataType.DOUBLE:
+ case DataType.DECIMAL:
+ case DataType.NUMERIC:
+ break;
+ }
+ }
+ else if (icontroltype == FormHandler.SOTEXTBOX)
+ { // com.sun.star.sdbc.DataType.CHAR, com.sun.star.sdbc.DataType.VARCHAR, com.sun.star.sdbc.DataType.LONGVARCHAR
+ }
+ else if (icontroltype == FormHandler.SOCHECKBOX)
+ {
}
}
- else if (icontroltype == FormHandler.SOTEXTBOX){ // com.sun.star.sdbc.DataType.CHAR, com.sun.star.sdbc.DataType.VARCHAR, com.sun.star.sdbc.DataType.LONGVARCHAR
-
- }
- else if (icontroltype == FormHandler.SOCHECKBOX){
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
+ }
/**
* @return
*/
diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java
index c96151dbe798..1c8f18844101 100644
--- a/wizards/com/sun/star/wizards/document/FormHandler.java
+++ b/wizards/com/sun/star/wizards/document/FormHandler.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -67,7 +67,8 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.container.XNamed;
-public class FormHandler {
+public class FormHandler
+{
public XFormsSupplier xFormsSupplier;
public XMultiServiceFactory xMSFDoc;
@@ -86,7 +87,6 @@ public class FormHandler {
public final static int SOGRIDCONTROL = 6;
public final static int SOIMAGECONTROL = 7;
public final static int SODATETIMECONTROL = 8;
-
int iImageControlHeight = 2000;
public static String SOSIZETEXT = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";
int iXPixelFactor = -1;
@@ -95,13 +95,15 @@ public class FormHandler {
int iYNirwanaPos = 50000;
public int nLabelHeight = -1;
public int nDBRefHeight = -1;
- public int BasicLabelDiffHeight= -1;
+ public int BasicLabelDiffHeight = -1;
XNameAccess xNamedForms;
XControlAccess xControlAccess;
XShapeGrouper xShapeGrouper;
XNameContainer xNamedFormContainer;
- public class ControlData{
+ public class ControlData
+ {
+
int DataType;
int ControlType;
String ControlService;
@@ -109,9 +111,9 @@ public class FormHandler {
boolean bIsText;
}
-
/** Creates a new instance of FormHandler */
- public FormHandler(XMultiServiceFactory _xMSF, XTextDocument xTextDocument) {
+ public FormHandler(XMultiServiceFactory _xMSF, XTextDocument xTextDocument)
+ {
this.xMSF = _xMSF;
xDrawPageSupplier = (XDrawPageSupplier) UnoRuntime.queryInterface(XDrawPageSupplier.class, xTextDocument);
xDrawPage = xDrawPageSupplier.getDrawPage();
@@ -152,45 +154,52 @@ public class FormHandler {
oImageControlData[3] = createControlData(DataType.BLOB, SOIMAGECONTROL, "ImageControl", "TextField", false);
}
-
- public int getControlType(int _fieldtype){
- for (int i = 0; i < oControlData.length; i++){
- if (oControlData[i].DataType == _fieldtype){
+ public int getControlType(int _fieldtype)
+ {
+ for (int i = 0; i < oControlData.length; i++)
+ {
+ if (oControlData[i].DataType == _fieldtype)
+ {
return oControlData[i].ControlType;
}
}
return -1;
}
- public void setglobalMultiServiceFactory(XMultiServiceFactory _xMSF){
+ public void setglobalMultiServiceFactory(XMultiServiceFactory _xMSF)
+ {
xMSF = _xMSF;
}
-
- public String getModelServiceName(int _fieldtype){
+ public String getModelServiceName(int _fieldtype)
+ {
int icontroltype = getControlType(_fieldtype);
if (icontroltype > -1)
+ {
return sModelServices[icontroltype];
+ }
else
+ {
return null;
+ }
}
-
- public void initializeBasicControlValues(){
+ public void initializeBasicControlValues()
+ {
Control oLabelControl = new Control(this, SOLABEL, new Point(), new Size());
XDevice xDevice = (XDevice) UnoRuntime.queryInterface(XDevice.class, oLabelControl.xWindowPeer);
- iXPixelFactor = (int) (100000/xDevice.getInfo().PixelPerMeterX);
- iYPixelFactor = (int) (100000/xDevice.getInfo().PixelPerMeterY);
+ iXPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterX);
+ iYPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterY);
nLabelHeight = (oLabelControl.getPreferredHeight("The quick brown fox...") + 1);
Control oTextControl = new Control(this, SOTEXTBOX, new Point(), new Size());
nDBRefHeight = (oTextControl.getPreferredHeight("The quick brown fox...") + 1);
- BasicLabelDiffHeight = (nDBRefHeight - nLabelHeight)/2;
+ BasicLabelDiffHeight = (nDBRefHeight - nLabelHeight) / 2;
xDrawPage.remove(oLabelControl.xShape);
xDrawPage.remove(oTextControl.xShape);
}
-
- public ControlData createControlData(int _datatype, int _controltype, String _scontrolservicename, String _gridcolumnname, boolean _bIsTextControl){
+ public ControlData createControlData(int _datatype, int _controltype, String _scontrolservicename, String _gridcolumnname, boolean _bIsTextControl)
+ {
ControlData curControlData = new ControlData();
curControlData.DataType = _datatype;
curControlData.ControlType = _controltype;
@@ -200,42 +209,59 @@ public class FormHandler {
return curControlData;
}
-
- public XNameContainer getDocumentForms() {
+ public XNameContainer getDocumentForms()
+ {
XNameContainer xNamedForms = xFormsSupplier.getForms();
return xNamedForms;
}
-
- public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName, String sMsg) throws com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException {
- try {
- if (xNamedForm.hasByName(ControlName)) {
+ public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName, String sMsg) throws com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException
+ {
+ try
+ {
+ if (xNamedForm.hasByName(ControlName))
+ {
String ControlValue = AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
return ControlValue;
- } else
+ }
+ else
+ {
throw new UnknownHiddenControlException(xNamedForm, ControlName, sMsg);
- } catch (Exception exception) {
+ }
+ }
+ catch (Exception exception)
+ {
throw new UnknownHiddenControlException(xNamedForm, ControlName, sMsg);
}
}
- public void insertHiddenControl(XNameAccess xNameAccess, XNameContainer xNamedForm, String ControlName, String ControlValue) {
- try {
- XInterface xHiddenControl;
- if (xNameAccess.hasByName(ControlName) == true)
- xHiddenControl = (XInterface) AnyConverter.toObject(new Type(XInterface.class), xNameAccess.getByName(ControlName));
- else {
- xHiddenControl = (XInterface) xMSFDoc.createInstance("com.sun.star.form.component.HiddenControl");
- xNamedForm.insertByName(ControlName, xHiddenControl);
+ public void insertHiddenControl(XNameAccess xNameAccess, XNameContainer xNamedForm, String ControlName, String ControlValue)
+ {
+ try
+ {
+ XInterface xHiddenControl;
+ if (xNameAccess.hasByName(ControlName) == true)
+ {
+ xHiddenControl = (XInterface) AnyConverter.toObject(new Type(XInterface.class), xNameAccess.getByName(ControlName));
+ }
+ else
+ {
+ xHiddenControl = (XInterface) xMSFDoc.createInstance("com.sun.star.form.component.HiddenControl");
+ xNamedForm.insertByName(ControlName, xHiddenControl);
+ }
+ Helper.setUnoPropertyValue(xHiddenControl, "HiddenValue", ControlValue);
}
- Helper.setUnoPropertyValue(xHiddenControl, "HiddenValue", ControlValue);
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- }}
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+ public class UnknownHiddenControlException extends java.lang.Throwable
+ {
- public class UnknownHiddenControlException extends java.lang.Throwable {
- public UnknownHiddenControlException(XNameAccess xNamedForm, String ControlName, String sMsgHiddenControlisMissing) {
+ public UnknownHiddenControlException(XNameAccess xNamedForm, String ControlName, String sMsgHiddenControlisMissing)
+ {
XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xNamedForm);
String FormName = xNamed.getName();
sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, FormName, "<REPORTFORM>");
@@ -244,46 +270,58 @@ public class FormHandler {
}
}
-
- public boolean hasFormByName(String _FormName){
+ public boolean hasFormByName(String _FormName)
+ {
xNamedFormContainer = getDocumentForms();
xNamedForms = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNamedFormContainer);
return xNamedForms.hasByName(_FormName);
}
-
- public void removeFormByName(String _FormName){
- try {
- if (hasFormByName(_FormName)){
- removeControlsofForm(_FormName);
- xNamedFormContainer.removeByName(_FormName);
+ public void removeFormByName(String _FormName)
+ {
+ try
+ {
+ if (hasFormByName(_FormName))
+ {
+ removeControlsofForm(_FormName);
+ xNamedFormContainer.removeByName(_FormName);
+ }
}
- } catch (com.sun.star.uno.Exception exception) {
- exception.printStackTrace(System.out);
- }}
-
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
- public void removeControlsofForm(String _FormName){
- try {
- for (int i = xDrawPage.getCount() - 1; i >= 0; i--){
- if (hasControlByName(_FormName, xDrawPage.getByIndex(i))){
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
- xDrawPage.remove(xShape);
+ public void removeControlsofForm(String _FormName)
+ {
+ try
+ {
+ for (int i = xDrawPage.getCount() - 1; i >= 0; i--)
+ {
+ if (hasControlByName(_FormName, xDrawPage.getByIndex(i)))
+ {
+ XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ xDrawPage.remove(xShape);
+ }
}
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public boolean hasControlByName(String _FormName, Object _oDrawPageElement){
+ public boolean hasControlByName(String _FormName, Object _oDrawPageElement)
+ {
XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement);
- if (xServiceInfo.supportsService("com.sun.star.drawing.ControlShape")){
+ if (xServiceInfo.supportsService("com.sun.star.drawing.ControlShape"))
+ {
XControlShape xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, _oDrawPageElement);
XControlModel xControlModel = xControlShape.getControl();
xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xControlShape.getControl());
- if (xServiceInfo.supportsService("com.sun.star.form.FormComponent")){
+ if (xServiceInfo.supportsService("com.sun.star.form.FormComponent"))
+ {
XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, xControlModel);
XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xChild.getParent());
String sName = xNamed.getName();
@@ -293,104 +331,125 @@ public class FormHandler {
return false;
}
+ public XNameContainer insertFormbyName(String _FormName, XNameContainer _xNamedFormContainer)
+ {
+ try
+ {
+ Object oDBForm;
+ if (!hasFormByName(_FormName))
+ {
+ oDBForm = xMSFDoc.createInstance("com.sun.star.form.component.Form");
+ _xNamedFormContainer.insertByName(_FormName, oDBForm);
+ xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
+ return xNamedForm;
+ }
+ else
+ {
+ return getFormByName(_FormName);
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
- public XNameContainer insertFormbyName(String _FormName, XNameContainer _xNamedFormContainer){
- try {
- Object oDBForm;
- if (!hasFormByName(_FormName)){
- oDBForm = xMSFDoc.createInstance("com.sun.star.form.component.Form");
- _xNamedFormContainer.insertByName(_FormName, oDBForm);
- xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
- return xNamedForm;
- } else
- return getFormByName(_FormName);
- } catch (com.sun.star.uno.Exception exception) {
- exception.printStackTrace(System.out);
- return null;
- }}
-
-
- public XNameContainer insertSubFormbyName(String _FormName, XNameContainer _xNamedFormContainer){
+ public XNameContainer insertSubFormbyName(String _FormName, XNameContainer _xNamedFormContainer)
+ {
return insertFormbyName(_FormName, _xNamedFormContainer);
}
-
- public XNameContainer insertFormbyName(String _FormName) {
+ public XNameContainer insertFormbyName(String _FormName)
+ {
return insertFormbyName(_FormName, getDocumentForms());
}
-
- public XNameContainer getFormByName(String _sname){
- XNameContainer xNamedForm = null;
- try {
- if (xNamedForms.hasByName(_sname)) {
- Object oDBForm = AnyConverter.toObject(new Type(XInterface.class), Helper.getUnoObjectbyName(xNamedForms, _sname));
- xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
+ public XNameContainer getFormByName(String _sname)
+ {
+ XNameContainer xNamedForm = null;
+ try
+ {
+ if (xNamedForms.hasByName(_sname))
+ {
+ Object oDBForm = AnyConverter.toObject(new Type(XInterface.class), Helper.getUnoObjectbyName(xNamedForms, _sname));
+ xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
+ }
}
- } catch (IllegalArgumentException e) {
- e.printStackTrace(System.out);
- }
- return xNamedForm;
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return xNamedForm;
}
-
/**
* @return
*/
- public int getXPixelFactor() {
+ public int getXPixelFactor()
+ {
if (iXPixelFactor == -1)
+ {
initializeBasicControlValues();
+ }
return iXPixelFactor;
}
/**
* @return
*/
- public int getYPixelFactor() {
+ public int getYPixelFactor()
+ {
if (iYPixelFactor == -1)
+ {
initializeBasicControlValues();
+ }
return iYPixelFactor;
}
/**
* @param i
*/
- public void setXPixelFactor(int i) {
+ public void setXPixelFactor(int i)
+ {
iXPixelFactor = i;
}
/**
* @param i
*/
- public void setYPixelFactor(int i) {
+ public void setYPixelFactor(int i)
+ {
iYPixelFactor = i;
}
-
/**
* @return
*/
- public int getImageControlHeight() {
+ public int getImageControlHeight()
+ {
return iImageControlHeight;
}
/**
* @param i
*/
- public void setImageControlHeight(int i) {
+ public void setImageControlHeight(int i)
+ {
iImageControlHeight = i;
}
-
-
-
// Note: as Shapes cannot be removed from the DrawPage without destroying
// the object we have to park them somewhere beyond the visible area of the page
- public void moveShapesToNirwana(Control[] ControlList){
- if (ControlList != null){
- for (int i = 0; i < ControlList.length; i++){
- if (ControlList[i] != null)
+ public void moveShapesToNirwana(Control[] ControlList)
+ {
+ if (ControlList != null)
+ {
+ for (int i = 0; i < ControlList.length; i++)
+ {
+ if (ControlList[i] != null)
// try {
// this.xDrawPage.remove(ControlList[i].xShape);
+ {
ControlList[i].setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos));
// String sControlName = (String) ControlList[i].xPropertySet.getPropertyValue("Name");
//
@@ -399,97 +458,121 @@ public class FormHandler {
// } catch (Exception e) {
// e.printStackTrace(System.out);
// }
+ }
}
- }}
-
-
-
- public void moveShapesToNirwana(){
- try {
- for (int i = 0; i < this.xDrawPage.getCount(); i++){
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
- xShape.setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos));
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ }
+ public void moveShapesToNirwana()
+ {
+ try
+ {
+ for (int i = 0; i < this.xDrawPage.getCount(); i++)
+ {
+ XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ xShape.setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos));
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public void removeAllShapes() throws Exception{
- for (int i = this.xDrawPage.getCount(); i >-1; i--){
+ public void removeAllShapes() throws Exception
+ {
+ for (int i = this.xDrawPage.getCount(); i > -1; i--)
+ {
XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
removeShape(xShape);
}
}
-
/**
* By removing the shape the whole control is disposed too
*
*/
- public void removeShape(XShape _xShape){
+ public void removeShape(XShape _xShape)
+ {
xDrawPage.remove(_xShape);
XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _xShape);
xComponent.dispose();
}
-
-
// Destroy all Shapes in Nirwana
- public void removeNirwanaShapes() throws Exception{
- for (int i = this.xDrawPage.getCount(); i >-1; i--){
+ public void removeNirwanaShapes() throws Exception
+ {
+ for (int i = this.xDrawPage.getCount(); i > -1; i--)
+ {
XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
if (xShape.getPosition().Y < this.iYNirwanaPos)
+ {
xDrawPage.remove(xShape);
+ }
}
}
- public XShape groupShapesTogether(XMultiServiceFactory _xMSF, XShape _xLabelShape, XShape _xControlShape){
- try {
- Object oGroupShape = _xMSF.createInstance("com.sun.star.drawing.ShapeCollection");
- XShapes xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, oGroupShape);
- xShapes.add(_xLabelShape);
- xShapes.add(_xControlShape);
- return this.xShapeGrouper.group(xShapes);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return null;
- }}
+ public XShape groupShapesTogether(XMultiServiceFactory _xMSF, XShape _xLabelShape, XShape _xControlShape)
+ {
+ try
+ {
+ Object oGroupShape = _xMSF.createInstance("com.sun.star.drawing.ShapeCollection");
+ XShapes xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, oGroupShape);
+ xShapes.add(_xLabelShape);
+ xShapes.add(_xControlShape);
+ return this.xShapeGrouper.group(xShapes);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
/**
* @return
*/
- public int getBasicLabelDiffHeight() {
+ public int getBasicLabelDiffHeight()
+ {
if (this.BasicLabelDiffHeight == -1)
+ {
initializeBasicControlValues();
+ }
return BasicLabelDiffHeight;
}
-
/**
* @return
*/
- public int getDBRefHeight() {
+ public int getDBRefHeight()
+ {
if (this.nDBRefHeight == -1)
+ {
initializeBasicControlValues();
+ }
return nDBRefHeight;
}
/**
* @return
*/
- public int getLabelHeight() {
+ public int getLabelHeight()
+ {
if (this.nLabelHeight == -1)
+ {
initializeBasicControlValues();
+ }
return nLabelHeight;
}
-
- public void setDrawObjectsCaptureMode(boolean _bCaptureObjects){
- try {
+ public void setDrawObjectsCaptureMode(boolean _bCaptureObjects)
+ {
+ try
+ {
XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, this.xMSFDoc.createInstance("com.sun.star.text.DocumentSettings"));
xPropertySet.setPropertyValue("DoNotCaptureDrawObjsOnPage", new Boolean(!_bCaptureObjects));
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace(System.out);
}
}
diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java
index c88dd47fe241..54814f3fc3b4 100644
--- a/wizards/com/sun/star/wizards/document/GridControl.java
+++ b/wizards/com/sun/star/wizards/document/GridControl.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.document;
+ ************************************************************************/
+package com.sun.star.wizards.document;
import com.sun.star.awt.Point;
import com.sun.star.awt.Size;
@@ -44,8 +45,9 @@ import com.sun.star.form.XGridColumnFactory;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
+public class GridControl extends Shape
+{
-public class GridControl extends Shape{
FieldColumn[] fieldcolumns;
public XNameContainer xNameContainer;
public XGridColumnFactory xGridColumnFactory;
@@ -55,33 +57,41 @@ public class GridControl extends Shape{
XControlModel xControlModel;
public XComponent xComponent;
- public GridControl(XMultiServiceFactory _xMSF, String _sname, FormHandler _oFormHandler, XNameContainer _xFormName, FieldColumn[] _fieldcolumns, Point _aPoint, Size _aSize) {
- super(_oFormHandler, _aPoint, _aSize);
- try {
- fieldcolumns = _fieldcolumns;
- Object oGridModel = oFormHandler.xMSFDoc.createInstance(oFormHandler.sModelServices[FormHandler.SOGRIDCONTROL]);
- xNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oGridModel);
- xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oGridModel);
- _xFormName.insertByName(_sname, oGridModel);
- xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, oGridModel);
- xControlShape.setControl(xControlModel);
- xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oGridModel);
- oFormHandler.xDrawPage.add(xShape);
- xGridColumnFactory = (XGridColumnFactory) UnoRuntime.queryInterface(XGridColumnFactory.class, oGridModel);
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oGridModel);
+ public GridControl(XMultiServiceFactory _xMSF, String _sname, FormHandler _oFormHandler, XNameContainer _xFormName, FieldColumn[] _fieldcolumns, Point _aPoint, Size _aSize)
+ {
+ super(_oFormHandler, _aPoint, _aSize);
+ try
+ {
+ fieldcolumns = _fieldcolumns;
+ Object oGridModel = oFormHandler.xMSFDoc.createInstance(oFormHandler.sModelServices[FormHandler.SOGRIDCONTROL]);
+ xNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oGridModel);
+ xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oGridModel);
+ _xFormName.insertByName(_sname, oGridModel);
+ xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, oGridModel);
+ xControlShape.setControl(xControlModel);
+ xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oGridModel);
+ oFormHandler.xDrawPage.add(xShape);
+ xGridColumnFactory = (XGridColumnFactory) UnoRuntime.queryInterface(XGridColumnFactory.class, oGridModel);
+ xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oGridModel);
// Helper.setUnoPropertyValue(oGridModel, "Name", _sname);
- for (int i = 0; i < fieldcolumns.length; i++){
- FieldColumn curfieldcolumn = fieldcolumns[i];
- if (curfieldcolumn.FieldType == DataType.TIMESTAMP){
- TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, "", "dbw"),this, curfieldcolumn);
+ for (int i = 0; i < fieldcolumns.length; i++)
+ {
+ FieldColumn curfieldcolumn = fieldcolumns[i];
+ if (curfieldcolumn.FieldType == DataType.TIMESTAMP)
+ {
+ TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, "", "dbw"), this, curfieldcolumn);
+ }
+ else
+ {
+ Control oControl = new DatabaseControl(this, curfieldcolumn);
+ }
}
- else{
- Control oControl = new DatabaseControl(this, curfieldcolumn);
- }
- }
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java
index 4d3e2aba6ae5..df8141cbe4b1 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.java
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -66,18 +66,22 @@ import com.sun.star.frame.XTerminateListener;
import com.sun.star.util.XCloseable;
import com.sun.star.util.XModifiable;
-public class OfficeDocument {
+public class OfficeDocument
+{
+
private XWindowPeer xWindowPeer;
private XMultiServiceFactory xMSF;
-
/** Creates a new instance of OfficeDocument */
- public OfficeDocument(XMultiServiceFactory _xMSF) {
+ public OfficeDocument(XMultiServiceFactory _xMSF)
+ {
xMSF = _xMSF;
}
- public static void attachEventCall(XComponent xComponent, String EventName, String EventType, String EventURL) {
- try {
+ public static void attachEventCall(XComponent xComponent, String EventName, String EventType, String EventURL)
+ {
+ try
+ {
XEventsSupplier xEventsSuppl = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class, xComponent);
PropertyValue[] oEventProperties = new PropertyValue[2];
oEventProperties[0] = new PropertyValue();
@@ -87,24 +91,34 @@ public class OfficeDocument {
oEventProperties[1].Name = "Script"; //"URL";
oEventProperties[1].Value = EventURL;
xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public static void dispose(XMultiServiceFactory xMSF, XComponent xComponent) {
- try {
- if (xComponent != null) {
- XModifiable xModified = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xComponent);
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
- XFrame xFrame = xModel.getCurrentController().getFrame();
- if (xModified.isModified())
- xModified.setModified(false);
- Desktop.dispatchURL(xMSF, ".uno:CloseDoc", xFrame);
+ public static void dispose(XMultiServiceFactory xMSF, XComponent xComponent)
+ {
+ try
+ {
+ if (xComponent != null)
+ {
+ XModifiable xModified = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xComponent);
+ XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
+ XFrame xFrame = xModel.getCurrentController().getFrame();
+ if (xModified.isModified())
+ {
+ xModified.setModified(false);
+ }
+ Desktop.dispatchURL(xMSF, ".uno:CloseDoc", xFrame);
+ }
+ }
+ catch (PropertyVetoException exception)
+ {
+ exception.printStackTrace(System.out);
}
- } catch (PropertyVetoException exception) {
- exception.printStackTrace(System.out);
- }}
+ }
/**
* Create a new office document, attached to the given frame.
@@ -113,7 +127,8 @@ public class OfficeDocument {
* @param sDocumentType e.g. swriter, scalc, ( simpress, scalc : not tested)
* @return the document Component (implements XComponent) object ( XTextDocument, or XSpreadsheedDocument )
*/
- public static Object createNewDocument(XFrame frame, String sDocumentType, boolean preview, boolean readonly) {
+ public static Object createNewDocument(XFrame frame, String sDocumentType, boolean preview, boolean readonly)
+ {
PropertyValue[] loadValues = new PropertyValue[2];
loadValues[0] = new PropertyValue();
@@ -128,37 +143,50 @@ public class OfficeDocument {
XInterface xInterface = null;
String sURL = "private:factory/" + sDocumentType;
- try {
+ try
+ {
xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, frame);
/*if (frame.getName() == null || frame.getName().equals(""));
- frame.setName("T" + System.currentTimeMillis());*/
- XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, "_self" ,0 , loadValues);
+ frame.setName("T" + System.currentTimeMillis());*/
+ XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, "_self", 0, loadValues);
if (sDocumentType == "swriter")
+ {
oDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ }
else if (sDocumentType == "scalc")
+ {
oDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
//TODO:
// else if (sDocumentType == "simpress")
// else if (sDocumentType == "sdraw")
- } catch (Exception exception) {
+ }
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
return oDocument;
}
- public static XFrame createNewFrame(XMultiServiceFactory xMSF, XTerminateListener listener) {
+ public static XFrame createNewFrame(XMultiServiceFactory xMSF, XTerminateListener listener)
+ {
return createNewFrame(xMSF, listener, "_blank");
}
- public static XFrame createNewFrame(XMultiServiceFactory xMSF, XTerminateListener listener, String FrameName) {
+ public static XFrame createNewFrame(XMultiServiceFactory xMSF, XTerminateListener listener, String FrameName)
+ {
XFrame xFrame = null;
- if (FrameName.equalsIgnoreCase("WIZARD_LIVE_PREVIEW")) {
+ if (FrameName.equalsIgnoreCase("WIZARD_LIVE_PREVIEW"))
+ {
xFrame = createNewPreviewFrame(xMSF, listener);
- } else {
+ }
+ else
+ {
XFrame xF = (XFrame) UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xMSF));
xFrame = xF.findFrame(FrameName, 0);
- if (listener != null) {
+ if (listener != null)
+ {
XFramesSupplier xFS = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xF);
XFrames xFF = xFS.getFrames();
xFF.remove(xFrame);
@@ -169,37 +197,44 @@ public class OfficeDocument {
return xFrame;
}
- public static XFrame createNewPreviewFrame(XMultiServiceFactory xMSF, XTerminateListener listener) {
+ public static XFrame createNewPreviewFrame(XMultiServiceFactory xMSF, XTerminateListener listener)
+ {
XToolkit xToolkit = null;
- try {
- xToolkit = (XToolkit)UnoRuntime.queryInterface(XToolkit.class,xMSF.createInstance("com.sun.star.awt.Toolkit"));
- } catch (Exception e) {
+ try
+ {
+ xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, xMSF.createInstance("com.sun.star.awt.Toolkit"));
+ }
+ catch (Exception e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
//describe the window and its properties
WindowDescriptor aDescriptor = new WindowDescriptor();
- aDescriptor.Type = com.sun.star.awt.WindowClass.TOP;
- aDescriptor.WindowServiceName = "window";
- aDescriptor.ParentIndex = -1;
- aDescriptor.Parent = null;
- aDescriptor.Bounds = new Rectangle(10,10,640,480);
- aDescriptor.WindowAttributes = WindowAttribute.BORDER |
- WindowAttribute.MOVEABLE |
- WindowAttribute.SIZEABLE |
- //WindowAttribute.CLOSEABLE |
- VclWindowPeerAttribute.CLIPCHILDREN ;
+ aDescriptor.Type = com.sun.star.awt.WindowClass.TOP;
+ aDescriptor.WindowServiceName = "window";
+ aDescriptor.ParentIndex = -1;
+ aDescriptor.Parent = null;
+ aDescriptor.Bounds = new Rectangle(10, 10, 640, 480);
+ aDescriptor.WindowAttributes = WindowAttribute.BORDER |
+ WindowAttribute.MOVEABLE |
+ WindowAttribute.SIZEABLE |
+ //WindowAttribute.CLOSEABLE |
+ VclWindowPeerAttribute.CLIPCHILDREN;
//create a new blank container window
XWindowPeer xPeer = null;
- try {
- xPeer = (XWindowPeer)UnoRuntime.queryInterface(XWindowPeer.class,xToolkit.createWindow(aDescriptor));
- } catch (IllegalArgumentException e) {
+ try
+ {
+ xPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xToolkit.createWindow(aDescriptor));
+ }
+ catch (IllegalArgumentException e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
- XWindow xWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class,xPeer);
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xPeer);
//define some further properties of the frame window
//if it's needed .-)
@@ -207,9 +242,12 @@ public class OfficeDocument {
//create new empty frame and set window on it
XFrame xFrame = null;
- try {
- xFrame = (XFrame)UnoRuntime.queryInterface(XFrame.class,xMSF.createInstance("com.sun.star.frame.Frame"));
- } catch (Exception e) {
+ try
+ {
+ xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, xMSF.createInstance("com.sun.star.frame.Frame"));
+ }
+ catch (Exception e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
@@ -219,7 +257,8 @@ public class OfficeDocument {
//and not part of the desktop tree.
//You are alone with him .-)
- if (listener != null) {
+ if (listener != null)
+ {
Desktop.getDesktop(xMSF).addTerminateListener(listener);
}
@@ -227,46 +266,59 @@ public class OfficeDocument {
}
-
- public static Object load(XInterface xInterface, String sURL, String sFrame, PropertyValue[] xValues) {
+ public static Object load(XInterface xInterface, String sURL, String sFrame, PropertyValue[] xValues)
+ {
// XComponent xComponent = null;
Object oDocument = null;
com.sun.star.frame.XComponentLoader xComponentLoader = null;
//XInterface xInterface = null;
- try {
+ try
+ {
xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xInterface);
com.sun.star.lang.XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, sFrame, 0, xValues);
XServiceInfo xComponentService = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xComponent);
if (xComponentService.supportsService("com.sun.star.text.TextDocument"))
- oDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
-
- //TODO: write if clauses for Calc, Impress and Draw
-
- } catch (Exception exception) {
+ {
+ oDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent); //TODO: write if clauses for Calc, Impress and Draw
+ }
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
return oDocument;
}
-
- public static boolean store(XMultiServiceFactory xMSF, XComponent xComponent, String StorePath, String FilterName, boolean bStoreToUrl, String sMsgSavingImpossible) {
- try {
+ public static boolean store(XMultiServiceFactory xMSF, XComponent xComponent, String StorePath, String FilterName, boolean bStoreToUrl, String sMsgSavingImpossible)
+ {
+ try
+ {
XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xComponent);
PropertyValue[] oStoreProperties;
- if (FilterName.length() > 0) {
+ if (FilterName.length() > 0)
+ {
oStoreProperties = new PropertyValue[1];
oStoreProperties[0] = new PropertyValue();
oStoreProperties[0].Name = "FilterName";
oStoreProperties[0].Value = FilterName;
- } else
+ }
+ else
+ {
oStoreProperties = new PropertyValue[0];
+ }
if (bStoreToUrl == true)
+ {
xStoreable.storeToURL(StorePath, oStoreProperties);
+ }
else
+ {
xStoreable.storeAsURL(StorePath, oStoreProperties);
+ }
return true;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
//TODO make sure that the peer of the dialog is used when available
@@ -275,23 +327,30 @@ public class OfficeDocument {
}
}
-
- public static boolean close(XComponent xComponent) {
+ public static boolean close(XComponent xComponent)
+ {
boolean bState = false;
XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
- if (xModel != null) {
+ if (xModel != null)
+ {
XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, xModel);
- if (xCloseable != null) {
- try {
+ if (xCloseable != null)
+ {
+ try
+ {
xCloseable.close(true);
bState = true;
- } catch (com.sun.star.util.CloseVetoException exCloseVeto) {
+ }
+ catch (com.sun.star.util.CloseVetoException exCloseVeto)
+ {
System.out.println("could not close doc");
bState = false;
}
- } else {
+ }
+ else
+ {
XComponent xDisposeable = (XComponent) UnoRuntime.queryInterface(XComponent.class, xModel);
xDisposeable.dispose();
bState = true;
@@ -300,27 +359,31 @@ public class OfficeDocument {
return bState;
}
-
- public static void ArraytoCellRange(Object[][] datalist, Object oTable, int xpos, int ypos){
- try {
+ public static void ArraytoCellRange(Object[][] datalist, Object oTable, int xpos, int ypos)
+ {
+ try
+ {
int rowcount = datalist.length;
- if (rowcount > 0){
+ if (rowcount > 0)
+ {
int colcount = datalist[0].length;
- if (colcount > 0){
+ if (colcount > 0)
+ {
XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oTable);
- XCellRange xNewRange = xCellRange.getCellRangeByPosition(xpos, ypos, (colcount+xpos)-1, (rowcount+ypos)-1);
+ XCellRange xNewRange = xCellRange.getCellRangeByPosition(xpos, ypos, (colcount + xpos) - 1, (rowcount + ypos) - 1);
XCellRangeData xDataArray = (XCellRangeData) UnoRuntime.queryInterface(XCellRangeData.class, xNewRange);
xDataArray.setDataArray(datalist);
}
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
-
public static PropertyValue[] getFileMediaDecriptor(XMultiServiceFactory xmsf, String url)
- throws Exception
+ throws Exception
{
Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
@@ -329,21 +392,24 @@ public class OfficeDocument {
mediaDescr[0][0].Name = "URL";
mediaDescr[0][0].Value = url;
- String type = ((XTypeDetection)UnoRuntime.queryInterface(XTypeDetection.class, typeDetect)).queryTypeByDescriptor(mediaDescr, true);
+ String type = ((XTypeDetection) UnoRuntime.queryInterface(XTypeDetection.class, typeDetect)).queryTypeByDescriptor(mediaDescr, true);
- XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class,typeDetect);
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
if (type.equals(""))
+ {
return null;
+ }
else
+ {
return (PropertyValue[]) xNameAccess.getByName(type);
+ }
}
-
public static PropertyValue[] getTypeMediaDescriptor(XMultiServiceFactory xmsf, String type)
- throws Exception
+ throws Exception
{
Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
- XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class,typeDetect);
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
return (PropertyValue[]) xNameAccess.getByName(type);
}
@@ -353,36 +419,41 @@ public class OfficeDocument {
* @param model a presentation or a draw document
* @return the number of slides/pages in the given document.
*/
- public static int getSlideCount(Object model) {
- XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier) UnoRuntime.queryInterface(XDrawPagesSupplier.class,model);
+ public static int getSlideCount(Object model)
+ {
+ XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier) UnoRuntime.queryInterface(XDrawPagesSupplier.class, model);
return xDrawPagesSupplier.getDrawPages().getCount();
}
- public static Object getDocumentInfo(Object document) {
- XDocumentInfoSupplier xDocumentInfoSupplier = (XDocumentInfoSupplier)UnoRuntime.queryInterface(XDocumentInfoSupplier.class,document);
+ public static Object getDocumentInfo(Object document)
+ {
+ XDocumentInfoSupplier xDocumentInfoSupplier = (XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class, document);
return xDocumentInfoSupplier.getDocumentInfo();
}
- public static int showMessageBox(XMultiServiceFactory xMSF, String windowServiceName, int windowAttribute, String MessageText) {
+ public static int showMessageBox(XMultiServiceFactory xMSF, String windowServiceName, int windowAttribute, String MessageText)
+ {
// if (getWindowPeer() != null)
- // return SystemDialog.showMessageBox(xMSF, xWindowPeer, windowServiceName, windowAttribute, MessageText);
+ // return SystemDialog.showMessageBox(xMSF, xWindowPeer, windowServiceName, windowAttribute, MessageText);
// else
- return SystemDialog.showMessageBox(xMSF, windowServiceName, windowAttribute, MessageText);
+ return SystemDialog.showMessageBox(xMSF, windowServiceName, windowAttribute, MessageText);
}
-
/**
* @return Returns the xWindowPeer.
*/
- public XWindowPeer getWindowPeer() {
+ public XWindowPeer getWindowPeer()
+ {
return xWindowPeer;
}
+
/**
* @param windowPeer The xWindowPeer to set.
* Should be called as soon as a Windowpeer of a wizard dialog is available
* The windowpeer is needed to call a Messagebox
*/
- public void setWindowPeer(XWindowPeer windowPeer) {
+ public void setWindowPeer(XWindowPeer windowPeer)
+ {
xWindowPeer = windowPeer;
}
}
diff --git a/wizards/com/sun/star/wizards/document/Shape.java b/wizards/com/sun/star/wizards/document/Shape.java
index cb3fdf27cb31..fb41e3e0ad17 100644
--- a/wizards/com/sun/star/wizards/document/Shape.java
+++ b/wizards/com/sun/star/wizards/document/Shape.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.document;
+ ************************************************************************/
+package com.sun.star.wizards.document;
import com.sun.star.awt.Point;
import com.sun.star.awt.Size;
@@ -49,7 +50,9 @@ import com.sun.star.wizards.common.JavaTools;
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
-public class Shape {
+public class Shape
+{
+
public XShape xShape;
protected FormHandler oFormHandler;
public XServiceInfo xServiceInfo;
@@ -59,70 +62,86 @@ public class Shape {
public XMultiServiceFactory xMSF;
public XShapes xShapes;
-
-
- public Shape(FormHandler _oFormHandler, Point _aPoint, Size _aSize) {
+ public Shape(FormHandler _oFormHandler, Point _aPoint, Size _aSize)
+ {
this.aPoint = _aPoint;
this.aSize = _aSize;
this.oFormHandler = _oFormHandler;
createShape("com.sun.star.drawing.ControlShape");
}
-
- public Shape(FormHandler _oFormHandler, String _sServiceName, Point _aPoint, Size _aSize) {
- try {
- this.aPoint = _aPoint;
- this.aSize = _aSize;
- this.oFormHandler = _oFormHandler;
- Object oShape = oFormHandler.xMSF.createInstance(_sServiceName);
- xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, oShape);
- xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oShape);
- } catch (Exception e) {
- e.printStackTrace();
- }}
-
-
- public Shape() {
+ public Shape(FormHandler _oFormHandler, String _sServiceName, Point _aPoint, Size _aSize)
+ {
+ try
+ {
+ this.aPoint = _aPoint;
+ this.aSize = _aSize;
+ this.oFormHandler = _oFormHandler;
+ Object oShape = oFormHandler.xMSF.createInstance(_sServiceName);
+ xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, oShape);
+ xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oShape);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
+ public Shape()
+ {
+ }
- private void createShape(String sServiceName){
- try {
- xMSF = oFormHandler.xMSFDoc;
- Object oShape = xMSF.createInstance(sServiceName);
- xShape = (XShape) UnoRuntime.queryInterface(XShape.class, oShape);
- xShape.setPosition(aPoint);
- if (aSize != null)
- xShape.setSize(aSize);
- else
- xShape.setSize(new Size(1000, 100));
- Helper.setUnoPropertyValue(xShape, "AnchorType", TextContentAnchorType.AT_PARAGRAPH);
- xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xShape);
- xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, xShape);
-
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
+ private void createShape(String sServiceName)
+ {
+ try
+ {
+ xMSF = oFormHandler.xMSFDoc;
+ Object oShape = xMSF.createInstance(sServiceName);
+ xShape = (XShape) UnoRuntime.queryInterface(XShape.class, oShape);
+ xShape.setPosition(aPoint);
+ if (aSize != null)
+ {
+ xShape.setSize(aSize);
+ }
+ else
+ {
+ xShape.setSize(new Size(1000, 100));
+ }
+ Helper.setUnoPropertyValue(xShape, "AnchorType", TextContentAnchorType.AT_PARAGRAPH);
+ xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xShape);
+ xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, xShape);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public Size getSize(){
+ public Size getSize()
+ {
return xShape.getSize();
}
+ public void setSize(Size _aSize)
+ {
+ try
+ {
+ xShape.setSize(_aSize);
+ }
+ catch (PropertyVetoException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public void setSize(Size _aSize){
- try {
- xShape.setSize(_aSize);
- } catch (PropertyVetoException e) {
- e.printStackTrace(System.out);
- }}
-
-
- public Point getPosition(){
+ public Point getPosition()
+ {
return xShape.getPosition();
}
-
- public void setPosition(Point _aPoint){
+ public void setPosition(Point _aPoint)
+ {
xShape.setPosition(_aPoint);
}
}
diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java
index 85ce9e8b44b5..343aad8de747 100644
--- a/wizards/com/sun/star/wizards/document/TimeStampControl.java
+++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.document;
+ ************************************************************************/
+package com.sun.star.wizards.document;
import com.sun.star.awt.Point;
import com.sun.star.awt.Size;
@@ -45,14 +46,15 @@ import com.sun.star.drawing.XShape;
import com.sun.star.drawing.XShapeGroup;
import com.sun.star.drawing.XShapes;
+public class TimeStampControl extends DatabaseControl
+{
-public class TimeStampControl extends DatabaseControl {
DatabaseControl oDateControl;
DatabaseControl oTimeControl;
// XShape xGroupShape;
Resource oResource;
- String sDateAppendix; // = GetResText(RID_FORM + 4)
- String sTimeAppendix; // = GetResText(RID_FORM + 5)
+ private String sDateAppendix; // = GetResText(RID_FORM + 4)
+ private String sTimeAppendix; // = GetResText(RID_FORM + 5)
XShapes xGroupShapes = null;
double nreldatewidth;
double nreltimewidth;
@@ -61,91 +63,96 @@ public class TimeStampControl extends DatabaseControl {
int nDateWidth;
XShape xShapeGroup;
-
-
- public TimeStampControl(Resource _oResource, FormHandler _oFormHandler, XNameContainer _xFormName, String _curFieldName, Point _aPoint){
- super(_oFormHandler, "com.sun.star.drawing.ShapeCollection", _aPoint);
+ public TimeStampControl(Resource _oResource, FormHandler _oFormHandler, XNameContainer _xFormName, String _curFieldName, Point _aPoint)
+ {
+ super(_oFormHandler, "com.sun.star.drawing.ShapeCollection", _aPoint);
oResource = _oResource;
// xGroupShape = xShape;
- oDateControl = new DatabaseControl(oFormHandler, _xFormName, _curFieldName, DataType.DATE, aPoint);
+ oDateControl = new DatabaseControl(oFormHandler, _xFormName, _curFieldName, DataType.DATE, aPoint);
int nDBHeight = oDateControl.getDBHeight();
nDateWidth = oDateControl.getPreferredWidth();
- oDateControl.setSize(new Size(nDateWidth , nDBHeight));
+ oDateControl.setSize(new Size(nDateWidth, nDBHeight));
Point aTimePoint = new Point(aPoint.X + 10 + nDateWidth, aPoint.Y);
oTimeControl = new DatabaseControl(oFormHandler, _xFormName, _curFieldName, DataType.TIME, aTimePoint);
nTimeWidth = oTimeControl.getPreferredWidth();
- oTimeControl.setSize(new Size(nTimeWidth,nDBHeight));
+ oTimeControl.setSize(new Size(nTimeWidth, nDBHeight));
nDBWidth = nDateWidth + nTimeWidth + 10;
xShapes.add(oDateControl.xShape);
xShapes.add(oTimeControl.xShape);
xShapeGroup = _oFormHandler.xShapeGrouper.group(xShapes);
xShapeGroup = (XShape) UnoRuntime.queryInterface(XShape.class, xShapeGroup);
- nreldatewidth = 1.0/((double)getSize().Width/(double)nDateWidth);
+ nreldatewidth = 1.0 / ((double) getSize().Width / (double) nDateWidth);
nreltimewidth = 1.0 - nreldatewidth;
}
-
- public XPropertySet getControlofGroupShapeByIndex(int _i){
- try {
- if (_i < xShapes.getCount()){
+ public XPropertySet getControlofGroupShapeByIndex(int _i)
+ {
+ try
+ {
+ if (_i < xShapes.getCount())
+ {
Object oControl = xShapes.getByIndex(_i);
XControlShape xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, oControl);
XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlShape.getControl());
return xPropertySet;
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
return null;
}
-
-
-
-
- public TimeStampControl(Resource _oResource, GridControl _oGridControl, FieldColumn _curfieldcolumn){
+ public TimeStampControl(Resource _oResource, GridControl _oGridControl, FieldColumn _curfieldcolumn)
+ {
super(_oGridControl, _curfieldcolumn);
oResource = _oResource;
sDateAppendix = oResource.getResText(UIConsts.RID_FORM + 88);
sTimeAppendix = oResource.getResText(UIConsts.RID_FORM + 89);
- oDateControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.DATE, _curfieldcolumn.FieldTitle + " " + sDateAppendix);
- oTimeControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.TIME, _curfieldcolumn.FieldTitle + " " + sTimeAppendix);
+ oDateControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.DATE, _curfieldcolumn.getFieldTitle() + " " + sDateAppendix);
+ oTimeControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.TIME, _curfieldcolumn.getFieldTitle() + " " + sTimeAppendix);
}
- public void setPropertyValue(String _sPropertyName, Object _aPropertyValue) throws Exception{
+ public void setPropertyValue(String _sPropertyName, Object _aPropertyValue) throws Exception
+ {
oDateControl.setPropertyValue(_sPropertyName, _aPropertyValue);
oTimeControl.setPropertyValue(_sPropertyName, _aPropertyValue);
}
-
- public int getPreferredWidth(){
+ public int getPreferredWidth()
+ {
return nDBWidth;
}
+ public void setSize(Size _aSize)
+ {
+ try
+ {
+ int ndatewidth = (int) (nreldatewidth * (double) _aSize.Width);
+ int ntimewidth = (int) (nreltimewidth * (double) _aSize.Width);
+ oDateControl.xShape.setSize(new Size(ndatewidth, _aSize.Height));
+ oTimeControl.xShape.setSize(new Size(ntimewidth, _aSize.Height));
+ }
+ catch (PropertyVetoException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public void setSize(Size _aSize){
- try {
- int ndatewidth = (int) (nreldatewidth * (double) _aSize.Width);
- int ntimewidth = (int) (nreltimewidth * (double) _aSize.Width);
- oDateControl.xShape.setSize(new Size(ndatewidth, _aSize.Height));
- oTimeControl.xShape.setSize( new Size(ntimewidth, _aSize.Height));
- } catch (PropertyVetoException e){
- e.printStackTrace(System.out);
- }}
-
-
- public Size getSize(){
+ public Size getSize()
+ {
int ncontrolwidth = oDateControl.xShape.getSize().Width + oTimeControl.xShape.getSize().Width;
return new Size(ncontrolwidth, oDateControl.xShape.getSize().Height);
}
-
- public Point getPosition(){
+ public Point getPosition()
+ {
return xShapeGroup.getPosition();
}
-
- public void setPosition(Point _aPoint){
+ public void setPosition(Point _aPoint)
+ {
// --> TESTING
Point aBeforePt = xShapeGroup.getPosition();
// <--
@@ -155,11 +162,11 @@ public class TimeStampControl extends DatabaseControl {
// oTimeControl.xShape.setPosition(atimepoint);
// --> TESTING
Point aAfterPt = xShapeGroup.getPosition();
- // <--
+ // <--
}
-
- public int getControlType() {
+ public int getControlType()
+ {
return FormHandler.SODATETIMECONTROL;
}
}
diff --git a/wizards/com/sun/star/wizards/fax/CGFax.java b/wizards/com/sun/star/wizards/fax/CGFax.java
index 88da6ff1193d..32543331ae1b 100644
--- a/wizards/com/sun/star/wizards/fax/CGFax.java
+++ b/wizards/com/sun/star/wizards/fax/CGFax.java
@@ -1,8 +1,40 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CGFax.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.fax;
import com.sun.star.wizards.common.ConfigGroup;
-public class CGFax extends ConfigGroup {
+public class CGFax extends ConfigGroup
+{
public int cp_Style;
public boolean cp_PrintCompanyLogo;
@@ -29,5 +61,4 @@ public class CGFax extends ConfigGroup {
public int cp_CreationType;
public String cp_TemplateName;
public String cp_TemplatePath;
-
}
diff --git a/wizards/com/sun/star/wizards/fax/CGFaxWizard.java b/wizards/com/sun/star/wizards/fax/CGFaxWizard.java
index feb543dbe62e..5b677f328bf3 100644
--- a/wizards/com/sun/star/wizards/fax/CGFaxWizard.java
+++ b/wizards/com/sun/star/wizards/fax/CGFaxWizard.java
@@ -1,11 +1,42 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CGFaxWizard.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.fax;
import com.sun.star.wizards.common.ConfigGroup;
-public class CGFaxWizard extends ConfigGroup {
+public class CGFaxWizard extends ConfigGroup
+{
public int cp_FaxType;
public CGFax cp_BusinessFax = new CGFax();
public CGFax cp_PrivateFax = new CGFax();
-
}
diff --git a/wizards/com/sun/star/wizards/fax/CallWizard.java b/wizards/com/sun/star/wizards/fax/CallWizard.java
index f4e50f4e72e1..024ce71b5b6a 100644
--- a/wizards/com/sun/star/wizards/fax/CallWizard.java
+++ b/wizards/com/sun/star/wizards/fax/CallWizard.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CallWizard.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.fax;
import com.sun.star.beans.XPropertyAccess;
@@ -18,9 +49,10 @@ import com.sun.star.uno.Type;
* information into the given registry key (<CODE>__writeRegistryServiceInfo</CODE>).
*
* @author $author$
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.3.192.1 $
*/
-public class CallWizard {
+public class CallWizard
+{
/**
* Gives a factory for creating the service. This method is called by the
@@ -37,10 +69,12 @@ public class CallWizard {
*
* @see com.sun.star.comp.loader.JavaLoader#
*/
- public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey) {
+ public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey)
+ {
XSingleServiceFactory xsingleservicefactory = null;
- if (stringImplementationName.equals(WizardImplementation.class.getName())) {
+ if (stringImplementationName.equals(WizardImplementation.class.getName()))
+ {
xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey);
}
@@ -58,7 +92,8 @@ public class CallWizard {
*
* @see com.sun.star.comp.loader.JavaLoader#
*/
- public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey) {
+ public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey)
+ {
return FactoryHelper.writeRegistryServiceInfo(WizardImplementation.class.getName(), WizardImplementation.__serviceName, xregistrykey);
}
@@ -66,7 +101,8 @@ public class CallWizard {
* This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
- public static class WizardImplementation implements XInitialization, XTypeProvider, XServiceInfo, XJobExecutor {
+ public static class WizardImplementation implements XInitialization, XTypeProvider, XServiceInfo, XJobExecutor
+ {
/**
* The constructor of the inner class has a XMultiServiceFactory parameter.
@@ -74,11 +110,12 @@ public class CallWizard {
* @param xmultiservicefactoryInitialization A special service factory could be
* introduced while initializing.
*/
- public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization) {
+ public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
xmultiservicefactory = xmultiservicefactoryInitialization;
- if (xmultiservicefactory != null) {
-
+ if (xmultiservicefactory != null)
+ {
}
}
@@ -87,23 +124,21 @@ public class CallWizard {
*
* @param str only valid parameter is 'start' at the moment.
*/
-
- public void trigger(String str) {
- if (str.equalsIgnoreCase("start")) {
+ public void trigger(String str)
+ {
+ if (str.equalsIgnoreCase("start"))
+ {
FaxWizardDialogImpl lw = new FaxWizardDialogImpl(xmultiservicefactory);
- if (!FaxWizardDialogImpl.running) {
+ if (!FaxWizardDialogImpl.running)
+ {
lw.startWizard(xmultiservicefactory, null);
}
}
- }
-
- //*******************************************
-
+ } //*******************************************
/**
* The service name, that must be used to get an instance of this service.
*/
private static final String __serviceName = "com.sun.star.wizards.fax.CallWizard";
-
/**
* The service manager, that gives access to all registered services.
*/
@@ -119,8 +154,8 @@ public class CallWizard {
* @throws com.sun.star.uno.Exception Every exception will not be handled, but
* will be passed to the caller.
*/
- public void initialize(Object[] object) throws com.sun.star.uno.Exception {
-
+ public void initialize(Object[] object) throws com.sun.star.uno.Exception
+ {
}
/**
@@ -128,7 +163,8 @@ public class CallWizard {
*
* @return Array of supported service names.
*/
- public java.lang.String[] getSupportedServiceNames() {
+ public java.lang.String[] getSupportedServiceNames()
+ {
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
@@ -143,10 +179,12 @@ public class CallWizard {
*
* @return True, if the given service name will be supported.
*/
- public boolean supportsService(String stringService) {
+ public boolean supportsService(String stringService)
+ {
boolean booleanSupportsService = false;
- if (stringService.equals(__serviceName)) {
+ if (stringService.equals(__serviceName))
+ {
booleanSupportsService = true;
}
@@ -164,13 +202,18 @@ public class CallWizard {
*
* @return Array of bytes, in order to distinguish between two sets.
*/
- public byte[] getImplementationId() {
- byte[] byteReturn = {
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
};
- try {
+ try
+ {
byteReturn = ("" + this.hashCode()).getBytes();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
@@ -182,7 +225,8 @@ public class CallWizard {
*
* @return Class name of the component.
*/
- public java.lang.String getImplementationName() {
+ public java.lang.String getImplementationName()
+ {
return (WizardImplementation.class.getName());
}
@@ -193,13 +237,21 @@ public class CallWizard {
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- public com.sun.star.uno.Type[] getTypes() {
- Type[] typeReturn = {
+ public com.sun.star.uno.Type[] getTypes()
+ {
+ Type[] typeReturn =
+ {
};
- try {
- typeReturn = new Type[] { new Type(XPropertyAccess.class), new Type(XJob.class), new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class)};
- } catch (Exception exception) {
+ try
+ {
+ typeReturn = new Type[]
+ {
+ new Type(XPropertyAccess.class), new Type(XJob.class), new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class)
+ };
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.java b/wizards/com/sun/star/wizards/fax/FaxDocument.java
index 42e972e35efe..0d797e634314 100644
--- a/wizards/com/sun/star/wizards/fax/FaxDocument.java
+++ b/wizards/com/sun/star/wizards/fax/FaxDocument.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: FaxDocument.java,v $
+ *
+ * $Revision: 1.7.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.fax;
import com.sun.star.wizards.common.*;
@@ -15,41 +46,52 @@ import com.sun.star.style.ParagraphAdjust;
import com.sun.star.style.XStyleFamiliesSupplier;
import com.sun.star.style.XStyle;
-public class FaxDocument extends TextDocument {
+public class FaxDocument extends TextDocument
+{
XDesktop xDesktop;
boolean keepLogoFrame = true;
boolean keepTypeFrame = true;
- public FaxDocument(XMultiServiceFactory xMSF, XTerminateListener listener) {
+ public FaxDocument(XMultiServiceFactory xMSF, XTerminateListener listener)
+ {
super(xMSF, listener, "WIZARD_LIVE_PREVIEW");
}
- public XWindowPeer getWindowPeer() {
+ public XWindowPeer getWindowPeer()
+ {
XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument);
return xWindowPeer;
}
- public void switchElement(String sElement, boolean bState) {
- try {
+ public void switchElement(String sElement, boolean bState)
+ {
+ try
+ {
TextSectionHandler mySectionHandler = new TextSectionHandler(xMSF, xTextDocument);
Object oSection = mySectionHandler.xTextSectionsSupplier.getTextSections().getByName(sElement);
Helper.setUnoPropertyValue(oSection, "IsVisible", new Boolean(bState));
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void updateDateFields() {
+ public void updateDateFields()
+ {
TextFieldHandler FH = new TextFieldHandler(xMSFDoc, xTextDocument);
FH.updateDateFields();
}
- public void switchFooter(String sPageStyle, boolean bState, boolean bPageNumber, String sText) {
- if (xTextDocument != null) {
+ public void switchFooter(String sPageStyle, boolean bState, boolean bPageNumber, String sText)
+ {
+ if (xTextDocument != null)
+ {
xTextDocument.lockControllers();
- try {
+ try
+ {
XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
com.sun.star.container.XNameAccess xNameAccess = null;
xNameAccess = xStyleFamiliesSupplier.getStyleFamilies();
@@ -60,11 +102,13 @@ public class FaxDocument extends TextDocument {
XText xFooterText;
XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle));
- if (bState) {
+ if (bState)
+ {
Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(true));
xFooterText = (XText) UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText"));
xFooterText.setString(sText);
- if (bPageNumber) {
+ if (bPageNumber)
+ {
//Adding the Page Number
XTextCursor myCursor = xFooterText.createTextCursor();
myCursor.gotoEnd(false);
@@ -74,39 +118,53 @@ public class FaxDocument extends TextDocument {
XTextField xPageNumberField = (XTextField) UnoRuntime.queryInterface(XTextField.class, xMSFDoc.createInstance("com.sun.star.text.TextField.PageNumber"));
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageNumberField);
xPSet.setPropertyValue("SubType", PageNumberType.CURRENT);
- xPSet.setPropertyValue("NumberingType", new Short (NumberingType.ARABIC));
+ xPSet.setPropertyValue("NumberingType", new Short(NumberingType.ARABIC));
xFooterText.insertTextContent(xFooterText.getEnd(), xPageNumberField, false);
}
- } else {
+ }
+ else
+ {
Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(false));
}
xTextDocument.unlockControllers();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
}
- public boolean hasElement(String sElement) {
- if (xTextDocument != null) {
+ public boolean hasElement(String sElement)
+ {
+ if (xTextDocument != null)
+ {
TextSectionHandler mySectionHandler = new TextSectionHandler(xMSF, xTextDocument);
return mySectionHandler.hasTextSectionByName(sElement);
- } else {
+ }
+ else
+ {
return false;
}
}
- public void switchUserField(String sFieldName, String sNewContent, boolean bState) {
+ public void switchUserField(String sFieldName, String sNewContent, boolean bState)
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
- if (bState) {
+ if (bState)
+ {
myFieldHandler.changeUserFieldContent(sFieldName, sNewContent);
- } else {
+ }
+ else
+ {
myFieldHandler.changeUserFieldContent(sFieldName, "");
}
}
- public void fillSenderWithUserData() {
- try {
+ public void fillSenderWithUserData()
+ {
+ try
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(xMSFDoc, xTextDocument);
Object oUserDataAccess = Configuration.getConfigurationRoot(xMSF, "org.openoffice.UserProfile/Data", false);
myFieldHandler.changeUserFieldContent("Company", (String) Helper.getUnoObjectbyName(oUserDataAccess, "o"));
@@ -115,30 +173,44 @@ public class FaxDocument extends TextDocument {
myFieldHandler.changeUserFieldContent("State", (String) Helper.getUnoObjectbyName(oUserDataAccess, "st"));
myFieldHandler.changeUserFieldContent("City", (String) Helper.getUnoObjectbyName(oUserDataAccess, "l"));
myFieldHandler.changeUserFieldContent("Fax", (String) Helper.getUnoObjectbyName(oUserDataAccess, "facsimiletelephonenumber"));
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void killEmptyUserFields() {
+ public void killEmptyUserFields()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
myFieldHandler.removeUserFieldByContent("");
}
- public void killEmptyFrames() {
- try {
- if (!keepLogoFrame) {
+ public void killEmptyFrames()
+ {
+ try
+ {
+ if (!keepLogoFrame)
+ {
XTextFrame xTF = TextFrameHandler.getFrameByName("Company Logo", xTextDocument);
- if (xTF != null) xTF.dispose();
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
}
- if (!keepTypeFrame) {
+ if (!keepTypeFrame)
+ {
XTextFrame xTF = TextFrameHandler.getFrameByName("Communication Type", xTextDocument);
- if (xTF != null) xTF.dispose();
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
-
}
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java
index 722f0eba4a5b..747e6a50ce81 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: FaxWizardDialog.java,v $
+ *
+ * $Revision: 1.5.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.fax;
import com.sun.star.awt.*;
@@ -5,333 +36,597 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.*;
import com.sun.star.wizards.ui.*;
-public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardDialogConst, UIConsts {
+public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardDialogConst, UIConsts
+{
- XRadioButton optBusinessFax;
- XListBox lstBusinessStyle;
- XRadioButton optPrivateFax;
- XListBox lstPrivateStyle;
- XFixedText lblBusinessStyle;
- XFixedText lblTitle1;
- XFixedText lblPrivateStyle;
- XFixedText lblIntroduction;
- //Image Control
- XControl ImageControl3;
- XCheckBox chkUseLogo;
- XCheckBox chkUseDate;
- XCheckBox chkUseCommunicationType;
- XComboBox lstCommunicationType;
- XCheckBox chkUseSubject;
- XCheckBox chkUseSalutation;
- XComboBox lstSalutation;
- XCheckBox chkUseGreeting;
- XComboBox lstGreeting;
- XCheckBox chkUseFooter;
- XFixedText lblTitle3;
- XRadioButton optSenderPlaceholder;
- XRadioButton optSenderDefine;
- XTextComponent txtSenderName;
- XTextComponent txtSenderStreet;
- XTextComponent txtSenderPostCode;
- XTextComponent txtSenderState;
- XTextComponent txtSenderCity;
- XTextComponent txtSenderFax;
- XRadioButton optReceiverDatabase;
- XRadioButton optReceiverPlaceholder;
- XFixedText lblSenderAddress;
- //Fixed Line
- XControl FixedLine2;
- XFixedText lblSenderName;
- XFixedText lblSenderStreet;
- XFixedText lblPostCodeCity;
- XFixedText lblTitle4;
- XFixedText Label1;
- XFixedText Label2;
- XTextComponent txtFooter;
- XCheckBox chkFooterNextPages;
- XCheckBox chkFooterPageNumbers;
- XFixedText lblFooter;
- XFixedText lblTitle5;
- XTextComponent txtTemplateName;
- //File Control
- XControl fileTemplatePath;
- XRadioButton optCreateFax;
- XRadioButton optMakeChanges;
- XFixedText lblFinalExplanation1;
- XFixedText lblProceed;
- XFixedText lblFinalExplanation2;
- //Image Control
- XControl ImageControl2;
- XFixedText lblTemplateName;
- XFixedText lblTemplatePath;
- XFixedText lblTitle6;
- XFixedText Label9;
- //Font Descriptors as Class members.
- FontDescriptor fontDescriptor1 = new FontDescriptor();
- FontDescriptor fontDescriptor2 = new FontDescriptor();
- FontDescriptor fontDescriptor4 = new FontDescriptor();
- FontDescriptor fontDescriptor5 = new FontDescriptor();
+ XRadioButton optBusinessFax;
+ XListBox lstBusinessStyle;
+ XRadioButton optPrivateFax;
+ XListBox lstPrivateStyle;
+ XFixedText lblBusinessStyle;
+ XFixedText lblTitle1;
+ XFixedText lblPrivateStyle;
+ XFixedText lblIntroduction;
+ //Image Control
+ XControl ImageControl3;
+ XCheckBox chkUseLogo;
+ XCheckBox chkUseDate;
+ XCheckBox chkUseCommunicationType;
+ XComboBox lstCommunicationType;
+ XCheckBox chkUseSubject;
+ XCheckBox chkUseSalutation;
+ XComboBox lstSalutation;
+ XCheckBox chkUseGreeting;
+ XComboBox lstGreeting;
+ XCheckBox chkUseFooter;
+ XFixedText lblTitle3;
+ XRadioButton optSenderPlaceholder;
+ XRadioButton optSenderDefine;
+ XTextComponent txtSenderName;
+ XTextComponent txtSenderStreet;
+ XTextComponent txtSenderPostCode;
+ XTextComponent txtSenderState;
+ XTextComponent txtSenderCity;
+ XTextComponent txtSenderFax;
+ XRadioButton optReceiverDatabase;
+ XRadioButton optReceiverPlaceholder;
+ XFixedText lblSenderAddress;
+ //Fixed Line
+ XControl FixedLine2;
+ XFixedText lblSenderName;
+ XFixedText lblSenderStreet;
+ XFixedText lblPostCodeCity;
+ XFixedText lblTitle4;
+ XFixedText Label1;
+ XFixedText Label2;
+ XTextComponent txtFooter;
+ XCheckBox chkFooterNextPages;
+ XCheckBox chkFooterPageNumbers;
+ XFixedText lblFooter;
+ XFixedText lblTitle5;
+ XTextComponent txtTemplateName;
+ //File Control
+ XControl fileTemplatePath;
+ XRadioButton optCreateFax;
+ XRadioButton optMakeChanges;
+ XFixedText lblFinalExplanation1;
+ XFixedText lblProceed;
+ XFixedText lblFinalExplanation2;
+ //Image Control
+ XControl ImageControl2;
+ XFixedText lblTemplateName;
+ XFixedText lblTemplatePath;
+ XFixedText lblTitle6;
+ XFixedText Label9;
+ //Font Descriptors as Class members.
+ FontDescriptor fontDescriptor1 = new FontDescriptor();
+ FontDescriptor fontDescriptor2 = new FontDescriptor();
+ FontDescriptor fontDescriptor4 = new FontDescriptor();
+ FontDescriptor fontDescriptor5 = new FontDescriptor(); //Resources Object
+ FaxWizardDialogResources resources;
- //Resources Object
-FaxWizardDialogResources resources;
+ public FaxWizardDialog(XMultiServiceFactory xmsf)
+ {
+ super(xmsf, HIDMAIN);
+ //Load Resources
+ resources = new FaxWizardDialogResources(xmsf);
- public FaxWizardDialog(XMultiServiceFactory xmsf) {
- super(xmsf,HIDMAIN);
- //Load Resources
- resources = new FaxWizardDialogResources(xmsf);
+ //set dialog properties...
+ Helper.setUnoPropertyValues(xDialogModel,
+ new String[]
+ {
+ "Closeable", "Height", "Moveable", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(210), Boolean.TRUE, new Integer(104), new Integer(52), INTEGERS[1], new Short((short) 1), resources.resFaxWizardDialog_title, new Integer(310)
+ });
- //set dialog properties...
- Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Closeable","Height","Moveable","PositionX","PositionY","Step","TabIndex","Title","Width"},
- new Object[] { Boolean.TRUE,new Integer(210),Boolean.TRUE,new Integer(104),new Integer(52),INTEGERS[1],new Short((short)1),resources.resFaxWizardDialog_title,new Integer(310)}
- );
-
- //Set member- FontDescriptors...
- fontDescriptor1.Weight = 150;
- fontDescriptor1.Underline = com.sun.star.awt.FontUnderline.SINGLE;
- fontDescriptor2.Weight = 100;
- fontDescriptor4.Weight = 100;
- fontDescriptor5.Weight = 150;
- }
- //build components
- public void buildStep1() {
- optBusinessFax = insertRadioButton("optBusinessFax", OPTBUSINESSFAX_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],OPTBUSINESSFAX_HID,resources.resoptBusinessFax_value,new Integer(97),new Integer(28),INTEGERS[1],new Short((short)1),new Integer(184)}
- );
- lstBusinessStyle = insertListBox("lstBusinessStyle", LSTBUSINESSSTYLE_ACTION_PERFORMED,LSTBUSINESSSTYLE_ITEM_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,LSTBUSINESSSTYLE_HID,new Integer(180),INTEGER_40,INTEGERS[1],new Short((short)3),new Integer(74)}
- );
- optPrivateFax = insertRadioButton("optPrivateFax", OPTPRIVATEFAX_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],OPTPRIVATEFAX_HID,resources.resoptPrivateFax_value,new Integer(97),new Integer(81),INTEGERS[1],new Short((short)2),new Integer(184)}
- );
- lstPrivateStyle = insertListBox("lstPrivateStyle", LSTPRIVATESTYLE_ACTION_PERFORMED,LSTPRIVATESTYLE_ITEM_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,LSTPRIVATESTYLE_HID,new Integer(180),new Integer(95),INTEGERS[1],new Short((short)4),new Integer(74)}
- );
- lblBusinessStyle = insertLabel("lblBusinessStyle",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblBusinessStyle_value,new Integer(110),new Integer(42),INTEGERS[1],new Short((short)32),new Integer(60)}
- );
- lblTitle1 = insertLabel("lblTitle1",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor5,INTEGER_16,resources.reslblTitle1_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[1],new Short((short)37),new Integer(212)}
- );
- lblPrivateStyle = insertLabel("lblPrivateStyle",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblPrivateStyle_value,new Integer(110),new Integer(95),INTEGERS[1],new Short((short)50),new Integer(60)}
- );
- lblIntroduction = insertLabel("lblIntroduction",
- new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(39),resources.reslblIntroduction_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[1],new Short((short)55),new Integer(199)}
- );
- ImageControl3 = insertInfoImage(92, 145, 1);
+ //Set member- FontDescriptors...
+ fontDescriptor1.Weight = 150;
+ fontDescriptor1.Underline = com.sun.star.awt.FontUnderline.SINGLE;
+ fontDescriptor2.Weight = 100;
+ fontDescriptor4.Weight = 100;
+ fontDescriptor5.Weight = 150;
+ }
+ //build components
+ public void buildStep1()
+ {
+ optBusinessFax = insertRadioButton("optBusinessFax", OPTBUSINESSFAX_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], OPTBUSINESSFAX_HID, resources.resoptBusinessFax_value, new Integer(97), new Integer(28), INTEGERS[1], new Short((short) 1), new Integer(184)
+ });
+ lstBusinessStyle = insertListBox("lstBusinessStyle", LSTBUSINESSSTYLE_ACTION_PERFORMED, LSTBUSINESSSTYLE_ITEM_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, LSTBUSINESSSTYLE_HID, new Integer(180), INTEGER_40, INTEGERS[1], new Short((short) 3), new Integer(74)
+ });
+ optPrivateFax = insertRadioButton("optPrivateFax", OPTPRIVATEFAX_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], OPTPRIVATEFAX_HID, resources.resoptPrivateFax_value, new Integer(97), new Integer(81), INTEGERS[1], new Short((short) 2), new Integer(184)
+ });
+ lstPrivateStyle = insertListBox("lstPrivateStyle", LSTPRIVATESTYLE_ACTION_PERFORMED, LSTPRIVATESTYLE_ITEM_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, LSTPRIVATESTYLE_HID, new Integer(180), new Integer(95), INTEGERS[1], new Short((short) 4), new Integer(74)
+ });
+ lblBusinessStyle = insertLabel("lblBusinessStyle",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblBusinessStyle_value, new Integer(110), new Integer(42), INTEGERS[1], new Short((short) 32), new Integer(60)
+ });
+ lblTitle1 = insertLabel("lblTitle1",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor5, INTEGER_16, resources.reslblTitle1_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[1], new Short((short) 37), new Integer(212)
+ });
+ lblPrivateStyle = insertLabel("lblPrivateStyle",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblPrivateStyle_value, new Integer(110), new Integer(95), INTEGERS[1], new Short((short) 50), new Integer(60)
+ });
+ lblIntroduction = insertLabel("lblIntroduction",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(39), resources.reslblIntroduction_value, Boolean.TRUE, new Integer(104), new Integer(145), INTEGERS[1], new Short((short) 55), new Integer(199)
+ });
+ ImageControl3 = insertInfoImage(92, 145, 1);
// ImageControl3 = insertImage("ImageControl3",
// new String[] {"Border", "Height", "ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"},
// new Object[] { new Short((short)0),INTEGERS[10],"private:resource/dbu/image/19205",new Integer(92),new Integer(145),Boolean.FALSE,INTEGERS[1],new Short((short)56),INTEGERS[10]}
// );
- }
-
- public void buildStep2() {
- chkUseLogo = insertCheckBox("chkUseLogo", CHKUSELOGO_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],CHKUSELOGO_HID,resources.reschkUseLogo_value,new Integer(97),new Integer(28),new Short((short)0),INTEGERS[2],new Short((short)5),new Integer(212)}
- );
- chkUseDate = insertCheckBox("chkUseDate", CHKUSEDATE_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],CHKUSEDATE_HID,resources.reschkUseDate_value,new Integer(97),new Integer(43),new Short((short)0),INTEGERS[2],new Short((short)6),new Integer(212)}
- );
- chkUseCommunicationType = insertCheckBox("chkUseCommunicationType", CHKUSECOMMUNICATIONTYPE_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],CHKUSECOMMUNICATIONTYPE_HID,resources.reschkUseCommunicationType_value,new Integer(97),new Integer(57),new Short((short)0),INTEGERS[2],new Short((short)7),new Integer(100)}
- );
- lstCommunicationType = insertComboBox("lstCommunicationType", LSTCOMMUNICATIONTYPE_ACTION_PERFORMED,LSTCOMMUNICATIONTYPE_ITEM_CHANGED,LSTCOMMUNICATIONTYPE_TEXT_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,LSTCOMMUNICATIONTYPE_HID,new Integer(105),new Integer(68),INTEGERS[2],new Short((short)8),new Integer(174)}
- );
- chkUseSubject = insertCheckBox("chkUseSubject", CHKUSESUBJECT_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],CHKUSESUBJECT_HID,resources.reschkUseSubject_value,new Integer(97),new Integer(87),new Short((short)0),INTEGERS[2],new Short((short)9),new Integer(212)}
- );
- chkUseSalutation = insertCheckBox("chkUseSalutation", CHKUSESALUTATION_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],CHKUSESALUTATION_HID,resources.reschkUseSalutation_value,new Integer(97),new Integer(102),new Short((short)0),INTEGERS[2],new Short((short)10),new Integer(100)}
- );
- lstSalutation = insertComboBox("lstSalutation", LSTSALUTATION_ACTION_PERFORMED,LSTSALUTATION_ITEM_CHANGED,LSTSALUTATION_TEXT_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,LSTSALUTATION_HID,new Integer(105),new Integer(113),INTEGERS[2],new Short((short)11),new Integer(174)}
- );
- chkUseGreeting = insertCheckBox("chkUseGreeting", CHKUSEGREETING_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],CHKUSEGREETING_HID,resources.reschkUseGreeting_value,new Integer(97),new Integer(132),new Short((short)0),INTEGERS[2],new Short((short)12),new Integer(100)}
- );
- lstGreeting = insertComboBox("lstGreeting", LSTGREETING_ACTION_PERFORMED,LSTGREETING_ITEM_CHANGED,LSTGREETING_TEXT_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,LSTGREETING_HID,new Integer(105),new Integer(143),INTEGERS[2],new Short((short)13),new Integer(174)}
- );
- chkUseFooter = insertCheckBox("chkUseFooter", CHKUSEFOOTER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],CHKUSEFOOTER_HID,resources.reschkUseFooter_value,new Integer(97),new Integer(163),new Short((short)0),INTEGERS[2],new Short((short)14),new Integer(212)}
- );
- lblTitle3 = insertLabel("lblTitle3",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor5,INTEGER_16,resources.reslblTitle3_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[2],new Short((short)59),new Integer(212)}
- );
- }
+ }
- public void buildStep3() {
- optSenderPlaceholder = insertRadioButton("optSenderPlaceholder", OPTSENDERPLACEHOLDER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],OPTSENDERPLACEHOLDER_HID,resources.resoptSenderPlaceholder_value,new Integer(104),new Integer(42),INTEGERS[3],new Short((short)15),new Integer(149)}
- );
- optSenderDefine = insertRadioButton("optSenderDefine", OPTSENDERDEFINE_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],OPTSENDERDEFINE_HID,resources.resoptSenderDefine_value,new Integer(104),new Integer(54),INTEGERS[3],new Short((short)16),new Integer(149)}
- );
- txtSenderName = insertTextField("txtSenderName", TXTSENDERNAME_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,TXTSENDERNAME_HID,new Integer(182),new Integer(67),INTEGERS[3],new Short((short)17),new Integer(119)}
- );
- txtSenderStreet = insertTextField("txtSenderStreet", TXTSENDERSTREET_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,TXTSENDERSTREET_HID,new Integer(182),new Integer(81),INTEGERS[3],new Short((short)18),new Integer(119)}
- );
- txtSenderPostCode = insertTextField("txtSenderPostCode", TXTSENDERPOSTCODE_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,TXTSENDERPOSTCODE_HID,new Integer(182),new Integer(95),INTEGERS[3],new Short((short)19),new Integer(25)}
- );
- txtSenderState = insertTextField("txtSenderState", TXTSENDERSTATE_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,TXTSENDERSTATE_HID,new Integer(211),new Integer(95),INTEGERS[3],new Short((short)20),new Integer(21)}
- );
- txtSenderCity = insertTextField("txtSenderCity", TXTSENDERCITY_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,TXTSENDERCITY_HID,new Integer(236),new Integer(95),INTEGERS[3],new Short((short)21),new Integer(65)}
- );
- txtSenderFax = insertTextField("txtSenderFax", TXTSENDERFAX_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,TXTSENDERFAX_HID,new Integer(182),new Integer(109),INTEGERS[3],new Short((short)22),new Integer(119)}
- );
- optReceiverPlaceholder = insertRadioButton("optReceiverPlaceholder", OPTRECEIVERPLACEHOLDER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],OPTRECEIVERPLACEHOLDER_HID,resources.resoptReceiverPlaceholder_value,new Integer(104),new Integer(148),INTEGERS[3],new Short((short)23),new Integer(200)}
- );
- optReceiverDatabase = insertRadioButton("optReceiverDatabase", OPTRECEIVERDATABASE_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],OPTRECEIVERDATABASE_HID,resources.resoptReceiverDatabase_value,new Integer(104),new Integer(160),INTEGERS[3],new Short((short)24),new Integer(200)}
- );
- lblSenderAddress = insertLabel("lblSenderAddress",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblSenderAddress_value,new Integer(97),new Integer(28),INTEGERS[3],new Short((short)46),new Integer(136)}
- );
- FixedLine2 = insertFixedLine("FixedLine2",
- new String[] {"Height", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[5],new Integer(90),new Integer(126),INTEGERS[3],new Short((short)51),new Integer(212)}
- );
- lblSenderName = insertLabel("lblSenderName",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblSenderName_value,new Integer(113),new Integer(69),INTEGERS[3],new Short((short)52),new Integer(68)}
- );
- lblSenderStreet = insertLabel("lblSenderStreet",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblSenderStreet_value,new Integer(113),new Integer(82),INTEGERS[3],new Short((short)53),new Integer(68)}
- );
- lblPostCodeCity = insertLabel("lblPostCodeCity",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblPostCodeCity_value,new Integer(113),new Integer(97),INTEGERS[3],new Short((short)54),new Integer(68)}
- );
- lblTitle4 = insertLabel("lblTitle4",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor5,INTEGER_16,resources.reslblTitle4_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[3],new Short((short)60),new Integer(212)}
- );
- Label1 = insertLabel("lblSenderFax",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.resLabel1_value,new Integer(113),new Integer(111),INTEGERS[3],new Short((short)68),new Integer(68)}
- );
- Label2 = insertLabel("Label2",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.resLabel2_value,new Integer(97),new Integer(137),INTEGERS[3],new Short((short)69),new Integer(136)}
- );
- }
+ public void buildStep2()
+ {
+ chkUseLogo = insertCheckBox("chkUseLogo", CHKUSELOGO_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], CHKUSELOGO_HID, resources.reschkUseLogo_value, new Integer(97), new Integer(28), new Short((short) 0), INTEGERS[2], new Short((short) 5), new Integer(212)
+ });
+ chkUseDate = insertCheckBox("chkUseDate", CHKUSEDATE_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], CHKUSEDATE_HID, resources.reschkUseDate_value, new Integer(97), new Integer(43), new Short((short) 0), INTEGERS[2], new Short((short) 6), new Integer(212)
+ });
+ chkUseCommunicationType = insertCheckBox("chkUseCommunicationType", CHKUSECOMMUNICATIONTYPE_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], CHKUSECOMMUNICATIONTYPE_HID, resources.reschkUseCommunicationType_value, new Integer(97), new Integer(57), new Short((short) 0), INTEGERS[2], new Short((short) 7), new Integer(100)
+ });
+ lstCommunicationType = insertComboBox("lstCommunicationType", LSTCOMMUNICATIONTYPE_ACTION_PERFORMED, LSTCOMMUNICATIONTYPE_ITEM_CHANGED, LSTCOMMUNICATIONTYPE_TEXT_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, LSTCOMMUNICATIONTYPE_HID, new Integer(105), new Integer(68), INTEGERS[2], new Short((short) 8), new Integer(174)
+ });
+ chkUseSubject = insertCheckBox("chkUseSubject", CHKUSESUBJECT_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], CHKUSESUBJECT_HID, resources.reschkUseSubject_value, new Integer(97), new Integer(87), new Short((short) 0), INTEGERS[2], new Short((short) 9), new Integer(212)
+ });
+ chkUseSalutation = insertCheckBox("chkUseSalutation", CHKUSESALUTATION_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], CHKUSESALUTATION_HID, resources.reschkUseSalutation_value, new Integer(97), new Integer(102), new Short((short) 0), INTEGERS[2], new Short((short) 10), new Integer(100)
+ });
+ lstSalutation = insertComboBox("lstSalutation", LSTSALUTATION_ACTION_PERFORMED, LSTSALUTATION_ITEM_CHANGED, LSTSALUTATION_TEXT_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, LSTSALUTATION_HID, new Integer(105), new Integer(113), INTEGERS[2], new Short((short) 11), new Integer(174)
+ });
+ chkUseGreeting = insertCheckBox("chkUseGreeting", CHKUSEGREETING_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], CHKUSEGREETING_HID, resources.reschkUseGreeting_value, new Integer(97), new Integer(132), new Short((short) 0), INTEGERS[2], new Short((short) 12), new Integer(100)
+ });
+ lstGreeting = insertComboBox("lstGreeting", LSTGREETING_ACTION_PERFORMED, LSTGREETING_ITEM_CHANGED, LSTGREETING_TEXT_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, LSTGREETING_HID, new Integer(105), new Integer(143), INTEGERS[2], new Short((short) 13), new Integer(174)
+ });
+ chkUseFooter = insertCheckBox("chkUseFooter", CHKUSEFOOTER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], CHKUSEFOOTER_HID, resources.reschkUseFooter_value, new Integer(97), new Integer(163), new Short((short) 0), INTEGERS[2], new Short((short) 14), new Integer(212)
+ });
+ lblTitle3 = insertLabel("lblTitle3",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor5, INTEGER_16, resources.reslblTitle3_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[2], new Short((short) 59), new Integer(212)
+ });
+ }
- public void buildStep4() {
- txtFooter = insertTextField("txtFooter", TXTFOOTER_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(47),TXTFOOTER_HID,Boolean.TRUE,new Integer(97),INTEGER_40,INTEGERS[4],new Short((short)25),new Integer(203)}
- );
- chkFooterNextPages = insertCheckBox("chkFooterNextPages", CHKFOOTERNEXTPAGES_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],CHKFOOTERNEXTPAGES_HID,resources.reschkFooterNextPages_value,new Integer(97),new Integer(92),new Short((short)0),INTEGERS[4],new Short((short)26),new Integer(202)}
- );
- chkFooterPageNumbers = insertCheckBox("chkFooterPageNumbers", CHKFOOTERPAGENUMBERS_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],CHKFOOTERPAGENUMBERS_HID,resources.reschkFooterPageNumbers_value,new Integer(97),new Integer(106),new Short((short)0),INTEGERS[4],new Short((short)27),new Integer(201)}
- );
- lblFooter = insertLabel("lblFooter",
- new String[] {"FontDescriptor", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor4,INTEGERS[8],resources.reslblFooter_value,new Integer(97),new Integer(28),INTEGERS[4],new Short((short)33),new Integer(116)}
- );
- lblTitle5 = insertLabel("lblTitle5",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor5,INTEGER_16,resources.reslblTitle5_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[4],new Short((short)61),new Integer(212)}
- );
- }
+ public void buildStep3()
+ {
+ optSenderPlaceholder = insertRadioButton("optSenderPlaceholder", OPTSENDERPLACEHOLDER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], OPTSENDERPLACEHOLDER_HID, resources.resoptSenderPlaceholder_value, new Integer(104), new Integer(42), INTEGERS[3], new Short((short) 15), new Integer(149)
+ });
+ optSenderDefine = insertRadioButton("optSenderDefine", OPTSENDERDEFINE_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], OPTSENDERDEFINE_HID, resources.resoptSenderDefine_value, new Integer(104), new Integer(54), INTEGERS[3], new Short((short) 16), new Integer(149)
+ });
+ txtSenderName = insertTextField("txtSenderName", TXTSENDERNAME_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, TXTSENDERNAME_HID, new Integer(182), new Integer(67), INTEGERS[3], new Short((short) 17), new Integer(119)
+ });
+ txtSenderStreet = insertTextField("txtSenderStreet", TXTSENDERSTREET_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, TXTSENDERSTREET_HID, new Integer(182), new Integer(81), INTEGERS[3], new Short((short) 18), new Integer(119)
+ });
+ txtSenderPostCode = insertTextField("txtSenderPostCode", TXTSENDERPOSTCODE_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, TXTSENDERPOSTCODE_HID, new Integer(182), new Integer(95), INTEGERS[3], new Short((short) 19), new Integer(25)
+ });
+ txtSenderState = insertTextField("txtSenderState", TXTSENDERSTATE_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, TXTSENDERSTATE_HID, new Integer(211), new Integer(95), INTEGERS[3], new Short((short) 20), new Integer(21)
+ });
+ txtSenderCity = insertTextField("txtSenderCity", TXTSENDERCITY_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, TXTSENDERCITY_HID, new Integer(236), new Integer(95), INTEGERS[3], new Short((short) 21), new Integer(65)
+ });
+ txtSenderFax = insertTextField("txtSenderFax", TXTSENDERFAX_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, TXTSENDERFAX_HID, new Integer(182), new Integer(109), INTEGERS[3], new Short((short) 22), new Integer(119)
+ });
+ optReceiverPlaceholder = insertRadioButton("optReceiverPlaceholder", OPTRECEIVERPLACEHOLDER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], OPTRECEIVERPLACEHOLDER_HID, resources.resoptReceiverPlaceholder_value, new Integer(104), new Integer(148), INTEGERS[3], new Short((short) 23), new Integer(200)
+ });
+ optReceiverDatabase = insertRadioButton("optReceiverDatabase", OPTRECEIVERDATABASE_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], OPTRECEIVERDATABASE_HID, resources.resoptReceiverDatabase_value, new Integer(104), new Integer(160), INTEGERS[3], new Short((short) 24), new Integer(200)
+ });
+ lblSenderAddress = insertLabel("lblSenderAddress",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSenderAddress_value, new Integer(97), new Integer(28), INTEGERS[3], new Short((short) 46), new Integer(136)
+ });
+ FixedLine2 = insertFixedLine("FixedLine2",
+ new String[]
+ {
+ "Height", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[5], new Integer(90), new Integer(126), INTEGERS[3], new Short((short) 51), new Integer(212)
+ });
+ lblSenderName = insertLabel("lblSenderName",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSenderName_value, new Integer(113), new Integer(69), INTEGERS[3], new Short((short) 52), new Integer(68)
+ });
+ lblSenderStreet = insertLabel("lblSenderStreet",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSenderStreet_value, new Integer(113), new Integer(82), INTEGERS[3], new Short((short) 53), new Integer(68)
+ });
+ lblPostCodeCity = insertLabel("lblPostCodeCity",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblPostCodeCity_value, new Integer(113), new Integer(97), INTEGERS[3], new Short((short) 54), new Integer(68)
+ });
+ lblTitle4 = insertLabel("lblTitle4",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor5, INTEGER_16, resources.reslblTitle4_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[3], new Short((short) 60), new Integer(212)
+ });
+ Label1 = insertLabel("lblSenderFax",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.resLabel1_value, new Integer(113), new Integer(111), INTEGERS[3], new Short((short) 68), new Integer(68)
+ });
+ Label2 = insertLabel("Label2",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.resLabel2_value, new Integer(97), new Integer(137), INTEGERS[3], new Short((short) 69), new Integer(136)
+ });
+ }
- public void buildStep5() {
- txtTemplateName = insertTextField("txtTemplateName", TXTTEMPLATENAME_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"},
- new Object[] { INTEGER_12,TXTTEMPLATENAME_HID,new Integer(202),new Integer(56),INTEGERS[5],new Short((short)28),resources.restxtTemplateName_value,new Integer(100)}
- );
- /*
- fileTemplatePath = insertFileControl("fileTemplatePath", FILETEMPLATEPATH_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,FILETEMPLATEPATH_HID,new Integer(172),new Integer(74),INTEGERS[5],new Short((short)29),new Integer(130)}
- );
- */
- optCreateFax = insertRadioButton("optCreateFax", OPTCREATEFAX_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],OPTCREATEFAX_HID,resources.resoptCreateFax_value,new Integer(104),new Integer(111),INTEGERS[5],new Short((short)30),new Integer(198)}
- );
- optMakeChanges = insertRadioButton("optMakeChanges", OPTMAKECHANGES_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],OPTMAKECHANGES_HID,resources.resoptMakeChanges_value,new Integer(104),new Integer(123),INTEGERS[5],new Short((short)31),new Integer(198)}
- );
- lblFinalExplanation1 = insertLabel("lblFinalExplanation1",
- new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(28),resources.reslblFinalExplanation1_value,Boolean.TRUE,new Integer(97),new Integer(28),INTEGERS[5],new Short((short)34),new Integer(205)}
- );
- lblProceed = insertLabel("lblProceed",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblProceed_value,new Integer(97),new Integer(100),INTEGERS[5],new Short((short)35),new Integer(204)}
- );
- lblFinalExplanation2 = insertLabel("lblFinalExplanation2",
- new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(33),resources.reslblFinalExplanation2_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[5],new Short((short)36),new Integer(199)}
- );
- ImageControl2 = insertImage("ImageControl2",
- new String[] {"Border", "Height", "ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"},
- new Object[] { new Short((short)0),INTEGERS[10],"private:resource/dbu/image/19205",new Integer(92),new Integer(145),Boolean.FALSE,INTEGERS[5],new Short((short)47),INTEGERS[10]}
- );
- lblTemplateName = insertLabel("lblTemplateName",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblTemplateName_value,new Integer(97),new Integer(58),INTEGERS[5],new Short((short)57),new Integer(101)}
- );
- /*
- lblTemplatePath = insertLabel("lblTemplatePath",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblTemplatePath_value,new Integer(97),new Integer(77),INTEGERS[5],new Short((short)58),new Integer(71)}
- );
- */
- lblTitle6 = insertLabel("lblTitle6",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor5,INTEGER_16,resources.reslblTitle6_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[5],new Short((short)62),new Integer(212)}
- );
+ public void buildStep4()
+ {
+ txtFooter = insertTextField("txtFooter", TXTFOOTER_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(47), TXTFOOTER_HID, Boolean.TRUE, new Integer(97), INTEGER_40, INTEGERS[4], new Short((short) 25), new Integer(203)
+ });
+ chkFooterNextPages = insertCheckBox("chkFooterNextPages", CHKFOOTERNEXTPAGES_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], CHKFOOTERNEXTPAGES_HID, resources.reschkFooterNextPages_value, new Integer(97), new Integer(92), new Short((short) 0), INTEGERS[4], new Short((short) 26), new Integer(202)
+ });
+ chkFooterPageNumbers = insertCheckBox("chkFooterPageNumbers", CHKFOOTERPAGENUMBERS_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], CHKFOOTERPAGENUMBERS_HID, resources.reschkFooterPageNumbers_value, new Integer(97), new Integer(106), new Short((short) 0), INTEGERS[4], new Short((short) 27), new Integer(201)
+ });
+ lblFooter = insertLabel("lblFooter",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor4, INTEGERS[8], resources.reslblFooter_value, new Integer(97), new Integer(28), INTEGERS[4], new Short((short) 33), new Integer(116)
+ });
+ lblTitle5 = insertLabel("lblTitle5",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor5, INTEGER_16, resources.reslblTitle5_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[4], new Short((short) 61), new Integer(212)
+ });
+ }
- }
+ public void buildStep5()
+ {
+ txtTemplateName = insertTextField("txtTemplateName", TXTTEMPLATENAME_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, TXTTEMPLATENAME_HID, new Integer(202), new Integer(56), INTEGERS[5], new Short((short) 28), resources.restxtTemplateName_value, new Integer(100)
+ });
+ /*
+ fileTemplatePath = insertFileControl("fileTemplatePath", FILETEMPLATEPATH_TEXT_CHANGED,
+ new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
+ new Object[] { INTEGER_12,FILETEMPLATEPATH_HID,new Integer(172),new Integer(74),INTEGERS[5],new Short((short)29),new Integer(130)}
+ );
+ */
+ optCreateFax = insertRadioButton("optCreateFax", OPTCREATEFAX_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], OPTCREATEFAX_HID, resources.resoptCreateFax_value, new Integer(104), new Integer(111), INTEGERS[5], new Short((short) 30), new Integer(198)
+ });
+ optMakeChanges = insertRadioButton("optMakeChanges", OPTMAKECHANGES_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], OPTMAKECHANGES_HID, resources.resoptMakeChanges_value, new Integer(104), new Integer(123), INTEGERS[5], new Short((short) 31), new Integer(198)
+ });
+ lblFinalExplanation1 = insertLabel("lblFinalExplanation1",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(28), resources.reslblFinalExplanation1_value, Boolean.TRUE, new Integer(97), new Integer(28), INTEGERS[5], new Short((short) 34), new Integer(205)
+ });
+ lblProceed = insertLabel("lblProceed",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblProceed_value, new Integer(97), new Integer(100), INTEGERS[5], new Short((short) 35), new Integer(204)
+ });
+ lblFinalExplanation2 = insertLabel("lblFinalExplanation2",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(33), resources.reslblFinalExplanation2_value, Boolean.TRUE, new Integer(104), new Integer(145), INTEGERS[5], new Short((short) 36), new Integer(199)
+ });
+ ImageControl2 = insertImage("ImageControl2",
+ new String[]
+ {
+ "Border", "Height", "ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Short((short) 0), INTEGERS[10], "private:resource/dbu/image/19205", new Integer(92), new Integer(145), Boolean.FALSE, INTEGERS[5], new Short((short) 47), INTEGERS[10]
+ });
+ lblTemplateName = insertLabel("lblTemplateName",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblTemplateName_value, new Integer(97), new Integer(58), INTEGERS[5], new Short((short) 57), new Integer(101)
+ });
+ /*
+ lblTemplatePath = insertLabel("lblTemplatePath",
+ new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
+ new Object[] { INTEGERS[8],resources.reslblTemplatePath_value,new Integer(97),new Integer(77),INTEGERS[5],new Short((short)58),new Integer(71)}
+ );
+ */
+ lblTitle6 = insertLabel("lblTitle6",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor5, INTEGER_16, resources.reslblTitle6_value, Boolean.TRUE, new Integer(91), INTEGERS[8], INTEGERS[5], new Short((short) 62), new Integer(212)
+ });
+ }
} \ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.java
index 833d2a0ea985..a0cad19d1f8f 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.java
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.java
@@ -1,88 +1,119 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: FaxWizardDialogConst.java,v $
+ *
+ * $Revision: 1.4.212.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.fax;
-public interface FaxWizardDialogConst {
- public static final String OPTBUSINESSFAX_ITEM_CHANGED = "optBusinessFaxItemChanged";
- public static final String LSTBUSINESSSTYLE_ACTION_PERFORMED = null; // "lstBusinessStyleActionPerformed";
- public static final String LSTBUSINESSSTYLE_ITEM_CHANGED = "lstBusinessStyleItemChanged";
- public static final String OPTPRIVATEFAX_ITEM_CHANGED = "optPrivateFaxItemChanged";
- public static final String LSTPRIVATESTYLE_ACTION_PERFORMED = null; // "lstPrivateStyleActionPerformed";
- public static final String LSTPRIVATESTYLE_ITEM_CHANGED = "lstPrivateStyleItemChanged";
- public static final String CHKUSELOGO_ITEM_CHANGED = "chkUseLogoItemChanged";
- public static final String CHKUSEDATE_ITEM_CHANGED = "chkUseDateItemChanged";
- public static final String CHKUSECOMMUNICATIONTYPE_ITEM_CHANGED = "chkUseCommunicationItemChanged";
- public static final String LSTCOMMUNICATIONTYPE_ACTION_PERFORMED = null; // "lstCommunicationActionPerformed";
- public static final String LSTCOMMUNICATIONTYPE_ITEM_CHANGED = "lstCommunicationItemChanged";
- public static final String LSTCOMMUNICATIONTYPE_TEXT_CHANGED = "lstCommunicationTextChanged";
- public static final String CHKUSESUBJECT_ITEM_CHANGED = "chkUseSubjectItemChanged";
- public static final String CHKUSESALUTATION_ITEM_CHANGED = "chkUseSalutationItemChanged";
- public static final String LSTSALUTATION_ACTION_PERFORMED = null; // "lstSalutationActionPerformed";
- public static final String LSTSALUTATION_ITEM_CHANGED = "lstSalutationItemChanged";
- public static final String LSTSALUTATION_TEXT_CHANGED = "lstSalutationTextChanged";
- public static final String CHKUSEGREETING_ITEM_CHANGED = "chkUseGreetingItemChanged";
- public static final String LSTGREETING_ACTION_PERFORMED = null; // "lstGreetingActionPerformed";
- public static final String LSTGREETING_ITEM_CHANGED = "lstGreetingItemChanged";
- public static final String LSTGREETING_TEXT_CHANGED = "lstGreetingTextChanged";
- public static final String CHKUSEFOOTER_ITEM_CHANGED = "chkUseFooterItemChanged";
- public static final String OPTSENDERPLACEHOLDER_ITEM_CHANGED = "optSenderPlaceholderItemChanged";
- public static final String OPTSENDERDEFINE_ITEM_CHANGED = "optSenderDefineItemChanged";
- public static final String TXTSENDERNAME_TEXT_CHANGED = "txtSenderNameTextChanged";
- public static final String TXTSENDERSTREET_TEXT_CHANGED = "txtSenderStreetTextChanged";
- public static final String TXTSENDERPOSTCODE_TEXT_CHANGED = "txtSenderPostCodeTextChanged";
- public static final String TXTSENDERSTATE_TEXT_CHANGED = "txtSenderStateTextChanged";
- public static final String TXTSENDERCITY_TEXT_CHANGED = "txtSenderCityTextChanged";
- public static final String TXTSENDERFAX_TEXT_CHANGED = "txtSenderFaxTextChanged";
- public static final String OPTRECEIVERPLACEHOLDER_ITEM_CHANGED = "optReceiverPlaceholderItemChanged";
- public static final String OPTRECEIVERDATABASE_ITEM_CHANGED = "optReceiverDatabaseItemChanged";
- public static final String TXTFOOTER_TEXT_CHANGED = "txtFooterTextChanged";
- public static final String CHKFOOTERNEXTPAGES_ITEM_CHANGED = "chkFooterNextPagesItemChanged";
- public static final String CHKFOOTERPAGENUMBERS_ITEM_CHANGED = "chkFooterPageNumbersItemChanged";
- public static final String TXTTEMPLATENAME_TEXT_CHANGED = "txtTemplateNameTextChanged";
- public static final String FILETEMPLATEPATH_TEXT_CHANGED = null; // "fileTemplatePathTextChanged";
- public static final String OPTCREATEFAX_ITEM_CHANGED = "optCreateFaxItemChanged";
- public static final String OPTMAKECHANGES_ITEM_CHANGED = "optMakeChangesItemChanged";
- public static final String imageURLImageControl2 = null; //"images/ImageControl2";
- public static final String imageURLImageControl3 = null; //"images/ImageControl3";
+public interface FaxWizardDialogConst
+{
- /* ====================================
- * Help IDs
- * ====================================
- */
- public final static int HID = 41119; //TODO enter first hid here
- public static final int HIDMAIN = 41180;
-
- public final String OPTBUSINESSFAX_HID = "HID:" + (HID + 1);
- public final String LSTBUSINESSSTYLE_HID = "HID:" + (HID + 2);
- public final String OPTPRIVATEFAX_HID = "HID:" + (HID + 3);
- public final String LSTPRIVATESTYLE_HID = "HID:" + (HID + 4);
- public final String IMAGECONTROL3_HID = "HID:" + (HID + 5);
- public final String CHKUSELOGO_HID = "HID:" + (HID + 6);
- public final String CHKUSEDATE_HID = "HID:" + (HID + 7);
- public final String CHKUSECOMMUNICATIONTYPE_HID = "HID:" + (HID + 8);
- public final String LSTCOMMUNICATIONTYPE_HID = "HID:" + (HID + 9);
- public final String CHKUSESUBJECT_HID = "HID:" + (HID + 10);
- public final String CHKUSESALUTATION_HID = "HID:" + (HID + 11);
- public final String LSTSALUTATION_HID = "HID:" + (HID + 12);
- public final String CHKUSEGREETING_HID = "HID:" + (HID + 13);
- public final String LSTGREETING_HID = "HID:" + (HID + 14);
- public final String CHKUSEFOOTER_HID = "HID:" + (HID + 15);
- public final String OPTSENDERPLACEHOLDER_HID = "HID:" + (HID + 16);
- public final String OPTSENDERDEFINE_HID = "HID:" + (HID + 17);
- public final String TXTSENDERNAME_HID = "HID:" + (HID + 18);
- public final String TXTSENDERSTREET_HID = "HID:" + (HID + 19);
- public final String TXTSENDERPOSTCODE_HID = "HID:" + (HID + 20);
- public final String TXTSENDERSTATE_HID = "HID:" + (HID + 21);
- public final String TXTSENDERCITY_HID = "HID:" + (HID + 22);
- public final String TXTSENDERFAX_HID = "HID:" + (HID + 23);
- public final String OPTRECEIVERPLACEHOLDER_HID = "HID:" + (HID + 24);
- public final String OPTRECEIVERDATABASE_HID = "HID:" + (HID + 25);
- public final String TXTFOOTER_HID = "HID:" + (HID + 26);
- public final String CHKFOOTERNEXTPAGES_HID = "HID:" + (HID + 27);
- public final String CHKFOOTERPAGENUMBERS_HID = "HID:" + (HID + 28);
- public final String TXTTEMPLATENAME_HID = "HID:" + (HID + 29);
- public final String FILETEMPLATEPATH_HID = "HID:" + (HID + 30);
- public final String OPTCREATEFAX_HID = "HID:" + (HID + 31);
- public final String OPTMAKECHANGES_HID = "HID:" + (HID + 32);
- public final String IMAGECONTROL2_HID = "HID:" + (HID + 33);
+ public static final String OPTBUSINESSFAX_ITEM_CHANGED = "optBusinessFaxItemChanged";
+ public static final String LSTBUSINESSSTYLE_ACTION_PERFORMED = null; // "lstBusinessStyleActionPerformed";
+ public static final String LSTBUSINESSSTYLE_ITEM_CHANGED = "lstBusinessStyleItemChanged";
+ public static final String OPTPRIVATEFAX_ITEM_CHANGED = "optPrivateFaxItemChanged";
+ public static final String LSTPRIVATESTYLE_ACTION_PERFORMED = null; // "lstPrivateStyleActionPerformed";
+ public static final String LSTPRIVATESTYLE_ITEM_CHANGED = "lstPrivateStyleItemChanged";
+ public static final String CHKUSELOGO_ITEM_CHANGED = "chkUseLogoItemChanged";
+ public static final String CHKUSEDATE_ITEM_CHANGED = "chkUseDateItemChanged";
+ public static final String CHKUSECOMMUNICATIONTYPE_ITEM_CHANGED = "chkUseCommunicationItemChanged";
+ public static final String LSTCOMMUNICATIONTYPE_ACTION_PERFORMED = null; // "lstCommunicationActionPerformed";
+ public static final String LSTCOMMUNICATIONTYPE_ITEM_CHANGED = "lstCommunicationItemChanged";
+ public static final String LSTCOMMUNICATIONTYPE_TEXT_CHANGED = "lstCommunicationTextChanged";
+ public static final String CHKUSESUBJECT_ITEM_CHANGED = "chkUseSubjectItemChanged";
+ public static final String CHKUSESALUTATION_ITEM_CHANGED = "chkUseSalutationItemChanged";
+ public static final String LSTSALUTATION_ACTION_PERFORMED = null; // "lstSalutationActionPerformed";
+ public static final String LSTSALUTATION_ITEM_CHANGED = "lstSalutationItemChanged";
+ public static final String LSTSALUTATION_TEXT_CHANGED = "lstSalutationTextChanged";
+ public static final String CHKUSEGREETING_ITEM_CHANGED = "chkUseGreetingItemChanged";
+ public static final String LSTGREETING_ACTION_PERFORMED = null; // "lstGreetingActionPerformed";
+ public static final String LSTGREETING_ITEM_CHANGED = "lstGreetingItemChanged";
+ public static final String LSTGREETING_TEXT_CHANGED = "lstGreetingTextChanged";
+ public static final String CHKUSEFOOTER_ITEM_CHANGED = "chkUseFooterItemChanged";
+ public static final String OPTSENDERPLACEHOLDER_ITEM_CHANGED = "optSenderPlaceholderItemChanged";
+ public static final String OPTSENDERDEFINE_ITEM_CHANGED = "optSenderDefineItemChanged";
+ public static final String TXTSENDERNAME_TEXT_CHANGED = "txtSenderNameTextChanged";
+ public static final String TXTSENDERSTREET_TEXT_CHANGED = "txtSenderStreetTextChanged";
+ public static final String TXTSENDERPOSTCODE_TEXT_CHANGED = "txtSenderPostCodeTextChanged";
+ public static final String TXTSENDERSTATE_TEXT_CHANGED = "txtSenderStateTextChanged";
+ public static final String TXTSENDERCITY_TEXT_CHANGED = "txtSenderCityTextChanged";
+ public static final String TXTSENDERFAX_TEXT_CHANGED = "txtSenderFaxTextChanged";
+ public static final String OPTRECEIVERPLACEHOLDER_ITEM_CHANGED = "optReceiverPlaceholderItemChanged";
+ public static final String OPTRECEIVERDATABASE_ITEM_CHANGED = "optReceiverDatabaseItemChanged";
+ public static final String TXTFOOTER_TEXT_CHANGED = "txtFooterTextChanged";
+ public static final String CHKFOOTERNEXTPAGES_ITEM_CHANGED = "chkFooterNextPagesItemChanged";
+ public static final String CHKFOOTERPAGENUMBERS_ITEM_CHANGED = "chkFooterPageNumbersItemChanged";
+ public static final String TXTTEMPLATENAME_TEXT_CHANGED = "txtTemplateNameTextChanged";
+ public static final String FILETEMPLATEPATH_TEXT_CHANGED = null; // "fileTemplatePathTextChanged";
+ public static final String OPTCREATEFAX_ITEM_CHANGED = "optCreateFaxItemChanged";
+ public static final String OPTMAKECHANGES_ITEM_CHANGED = "optMakeChangesItemChanged";
+ public static final String imageURLImageControl2 = null; //"images/ImageControl2";
+ public static final String imageURLImageControl3 = null; //"images/ImageControl3";
+ /* ====================================
+ * Help IDs
+ * ====================================
+ */
+ public final static int HID = 41119; //TODO enter first hid here
+ public static final int HIDMAIN = 41180;
+ public final String OPTBUSINESSFAX_HID = "HID:" + (HID + 1);
+ public final String LSTBUSINESSSTYLE_HID = "HID:" + (HID + 2);
+ public final String OPTPRIVATEFAX_HID = "HID:" + (HID + 3);
+ public final String LSTPRIVATESTYLE_HID = "HID:" + (HID + 4);
+ public final String IMAGECONTROL3_HID = "HID:" + (HID + 5);
+ public final String CHKUSELOGO_HID = "HID:" + (HID + 6);
+ public final String CHKUSEDATE_HID = "HID:" + (HID + 7);
+ public final String CHKUSECOMMUNICATIONTYPE_HID = "HID:" + (HID + 8);
+ public final String LSTCOMMUNICATIONTYPE_HID = "HID:" + (HID + 9);
+ public final String CHKUSESUBJECT_HID = "HID:" + (HID + 10);
+ public final String CHKUSESALUTATION_HID = "HID:" + (HID + 11);
+ public final String LSTSALUTATION_HID = "HID:" + (HID + 12);
+ public final String CHKUSEGREETING_HID = "HID:" + (HID + 13);
+ public final String LSTGREETING_HID = "HID:" + (HID + 14);
+ public final String CHKUSEFOOTER_HID = "HID:" + (HID + 15);
+ public final String OPTSENDERPLACEHOLDER_HID = "HID:" + (HID + 16);
+ public final String OPTSENDERDEFINE_HID = "HID:" + (HID + 17);
+ public final String TXTSENDERNAME_HID = "HID:" + (HID + 18);
+ public final String TXTSENDERSTREET_HID = "HID:" + (HID + 19);
+ public final String TXTSENDERPOSTCODE_HID = "HID:" + (HID + 20);
+ public final String TXTSENDERSTATE_HID = "HID:" + (HID + 21);
+ public final String TXTSENDERCITY_HID = "HID:" + (HID + 22);
+ public final String TXTSENDERFAX_HID = "HID:" + (HID + 23);
+ public final String OPTRECEIVERPLACEHOLDER_HID = "HID:" + (HID + 24);
+ public final String OPTRECEIVERDATABASE_HID = "HID:" + (HID + 25);
+ public final String TXTFOOTER_HID = "HID:" + (HID + 26);
+ public final String CHKFOOTERNEXTPAGES_HID = "HID:" + (HID + 27);
+ public final String CHKFOOTERPAGENUMBERS_HID = "HID:" + (HID + 28);
+ public final String TXTTEMPLATENAME_HID = "HID:" + (HID + 29);
+ public final String FILETEMPLATEPATH_HID = "HID:" + (HID + 30);
+ public final String OPTCREATEFAX_HID = "HID:" + (HID + 31);
+ public final String OPTMAKECHANGES_HID = "HID:" + (HID + 32);
+ public final String IMAGECONTROL2_HID = "HID:" + (HID + 33);
}
\ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
index fc04469005c5..ad1fdbddf330 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: FaxWizardDialogImpl.java,v $
+ *
+ * $Revision: 1.10.36.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.fax;
import java.util.Vector;
@@ -31,24 +62,25 @@ import com.sun.star.wizards.ui.event.*;
import com.sun.star.wizards.common.Helper;
import com.sun.star.document.MacroExecMode;
-public class FaxWizardDialogImpl extends FaxWizardDialog {
+public class FaxWizardDialogImpl extends FaxWizardDialog
+{
-protected void enterStep(int OldStep, int NewStep){}
-protected void leaveStep(int OldStep, int NewStep){}
+ protected void enterStep(int OldStep, int NewStep)
+ {
+ }
+ protected void leaveStep(int OldStep, int NewStep)
+ {
+ }
static FaxDocument myFaxDoc;
static boolean running;
-
XTextDocument xTextDocument;
PathSelection myPathSelection;
-
CGFaxWizard myConfig;
Vector mainDA = new Vector();
Vector faxDA = new Vector();
-
String[][] BusinessFiles;
String[][] PrivateFiles;
-
String sTemplatePath;
String sUserTemplatePath;
String sBitmapPath;
@@ -58,42 +90,52 @@ protected void leaveStep(int OldStep, int NewStep){}
boolean bEditTemplate;
boolean bSaveSuccess = false;
private boolean filenameChanged = false;
-
final static int RM_TYPESTYLE = 1;
final static int RM_ELEMENTS = 2;
final static int RM_SENDERRECEIVER = 3;
final static int RM_FOOTER = 4;
final static int RM_FINALSETTINGS = 5;
- public FaxWizardDialogImpl(XMultiServiceFactory xmsf) {
+ public FaxWizardDialogImpl(XMultiServiceFactory xmsf)
+ {
super(xmsf);
}
- public static void main(String args[]) {
+ public static void main(String args[])
+ {
//only being called when starting wizard remotely
- try {
- String ConnectStr = "uno:socket,host=127.0.0.1,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
- XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
- FaxWizardDialogImpl lw = new FaxWizardDialogImpl(xLocMSF);
- lw.startWizard(xLocMSF, null);
- } catch (RuntimeException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (java.lang.Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ try
+ {
+ String ConnectStr = "uno:socket,host=127.0.0.1,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
+ XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
+ FaxWizardDialogImpl lw = new FaxWizardDialogImpl(xLocMSF);
+ lw.startWizard(xLocMSF, null);
+ }
+ catch (RuntimeException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (java.lang.Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
- public void startWizard(XMultiServiceFactory xMSF, Object[] CurPropertyValue) {
+ public void startWizard(XMultiServiceFactory xMSF, Object[] CurPropertyValue)
+ {
running = true;
- try {
+ try
+ {
//Number of steps on WizardDialog:
setMaxStep(5);
@@ -124,7 +166,10 @@ protected void leaveStep(int OldStep, int NewStep){}
//update the dialog UI according to the loaded Configuration
updateUI();
- if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ {
+ myPathSelection.initializePath();
+ }
XWindow xContainerWindow = myFaxDoc.xFrame.getContainerWindow();
XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
@@ -151,28 +196,33 @@ protected void leaveStep(int OldStep, int NewStep){}
closeDocument();
running = false;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
removeTerminateListener();
exception.printStackTrace(System.out);
- running=false;
+ running = false;
return;
}
}
-
- public void cancelWizard() {
+ public void cancelWizard()
+ {
xDialog.endExecute();
running = false;
}
- public void finishWizard() {
- switchToStep(getCurrentStep(),getMaxStep());
+ public void finishWizard()
+ {
+ switchToStep(getCurrentStep(), getMaxStep());
myFaxDoc.setWizardTemplateDocInfo(resources.resFaxWizardDialog_title, resources.resTemplateDescription);
- try {
+ try
+ {
//myFaxDoc.xTextDocument.lockControllers();
FileAccess fileAccess = new FileAccess(xMSF);
sPath = myPathSelection.getSelectedPath();
- if (sPath.equals("")) {
+ if (sPath.equals(""))
+ {
myPathSelection.triggerPathPicker();
sPath = myPathSelection.getSelectedPath();
}
@@ -182,12 +232,17 @@ protected void leaveStep(int OldStep, int NewStep){}
//it is coming from a saved session, check if the
// file exists and warn the user.
if (!filenameChanged)
- if (fileAccess.exists(sPath, true)) {
+ {
+ if (fileAccess.exists(sPath, true))
+ {
int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resOverwriteWarning);
if (answer == 3) // user said: no, do not overwrite....
+ {
return;
+ }
}
+ }
myFaxDoc.setWizardTemplateDocInfo(resources.resFaxWizardDialog_title, resources.resTemplateDescription);
myFaxDoc.killEmptyUserFields();
myFaxDoc.keepLogoFrame = (chkUseLogo.getState() != 0);
@@ -196,7 +251,8 @@ protected void leaveStep(int OldStep, int NewStep){}
bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath, "writer8_template", false, "Template could not be saved to" + sPath);
- if (bSaveSuccess) {
+ if (bSaveSuccess)
+ {
saveConfiguration();
XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
PropertyValue loadValues[] = new PropertyValue[4];
@@ -204,18 +260,21 @@ protected void leaveStep(int OldStep, int NewStep){}
loadValues[0].Name = "AsTemplate";
loadValues[1] = new PropertyValue();
loadValues[1].Name = "MacroExecutionMode";
- loadValues[1].Value = new Short (MacroExecMode.ALWAYS_EXECUTE);
+ loadValues[1].Value = new Short(MacroExecMode.ALWAYS_EXECUTE);
loadValues[2] = new PropertyValue();
loadValues[2].Name = "UpdateDocMode";
- loadValues[2].Value = new Short (com.sun.star.document.UpdateDocMode.FULL_UPDATE);
+ loadValues[2].Value = new Short(com.sun.star.document.UpdateDocMode.FULL_UPDATE);
loadValues[3] = new PropertyValue();
loadValues[3].Name = "InteractionHandler";
loadValues[3].Value = xIH;
- if (bEditTemplate) {
+ if (bEditTemplate)
+ {
loadValues[0].Value = Boolean.FALSE;
- } else {
+ }
+ else
+ {
loadValues[0].Value = Boolean.TRUE;
}
Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), sPath, "_default", loadValues);
@@ -223,30 +282,40 @@ protected void leaveStep(int OldStep, int NewStep){}
XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
ViewHandler myViewHandler = new ViewHandler(xDocMSF, xTextDocument);
myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.OPTIMAL));
- } else {
+ }
+ else
+ {
//TODO: Error Handling
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
- finally {
+ finally
+ {
xDialog.endExecute();
running = false;
}
}
- public void closeDocument() {
- try {
+ public void closeDocument()
+ {
+ try
+ {
//xComponent.dispose();
XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myFaxDoc.xFrame);
xCloseable.close(false);
- } catch (CloseVetoException e) {
+ }
+ catch (CloseVetoException e)
+ {
e.printStackTrace();
}
}
- public void insertRoadmap() {
+ public void insertRoadmap()
+ {
addRoadmap();
int i = 0;
i = insertRoadmapItem(0, true, resources.RoadmapLabels[RM_TYPESTYLE], RM_TYPESTYLE);
@@ -259,26 +328,33 @@ protected void leaveStep(int OldStep, int NewStep){}
setCurrentRoadmapItemID((short) 1);
}
- private class myPathSelectionListener implements XPathSelectionListener {
- public void validatePath() {
- if (myPathSelection.usedPathPicker) {
+ private class myPathSelectionListener implements XPathSelectionListener
+ {
+
+ public void validatePath()
+ {
+ if (myPathSelection.usedPathPicker)
+ {
filenameChanged = true;
}
myPathSelection.usedPathPicker = false;
}
}
- public void insertPathSelectionControl() {
+ public void insertPathSelectionControl()
+ {
myPathSelection = new PathSelection(xMSF, this, PathSelection.TransferMode.SAVE, PathSelection.DialogTypes.FILE);
- myPathSelection.insert(5, 97, 70, 205, (short) 45, resources.reslblTemplatePath_value, true, "HID:" + ( HID + 34 ), "HID:" + ( HID + 35 ));
+ myPathSelection.insert(5, 97, 70, 205, (short) 45, resources.reslblTemplatePath_value, true, "HID:" + (HID + 34), "HID:" + (HID + 35));
myPathSelection.sDefaultDirectory = sUserTemplatePath;
myPathSelection.sDefaultName = "myFaxTemplate.ott";
myPathSelection.sDefaultFilter = "writer8_template";
myPathSelection.addSelectionListener(new myPathSelectionListener());
}
- private void insertIcons() {
- try {
+ private void insertIcons()
+ {
+ try
+ {
Object oGS = xMSF.createInstance("com.sun.star.graphic.GraphicProvider");
XGraphicProvider xGraphicProvider = (XGraphicProvider) UnoRuntime.queryInterface(XGraphicProvider.class, oGS);
@@ -288,93 +364,122 @@ protected void leaveStep(int OldStep, int NewStep){}
GraphicValues[0].Value = "private:resource/svx/imagelist/18000/18022";
XGraphic xGraphic = xGraphicProvider.queryGraphic(GraphicValues);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
- private void updateUI() {
+ private void updateUI()
+ {
UnoDataAware.updateUI(mainDA);
UnoDataAware.updateUI(faxDA);
}
- private void initializePaths() {
- try {
+ private void initializePaths()
+ {
+ try
+ {
sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", "");
sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap");
- } catch (NoValidPathException e) {
+ }
+ catch (NoValidPathException e)
+ {
e.printStackTrace();
}
}
- public boolean initializeTemplates(XMultiServiceFactory xMSF) {
- try {
- String sFaxSubPath = "/wizard/fax";
- sFaxPath = FileAccess.combinePaths(xMSF, sTemplatePath, sFaxSubPath);
- sWorkPath = FileAccess.getOfficePath(xMSF, "Work", "", "");
+ public boolean initializeTemplates(XMultiServiceFactory xMSF)
+ {
+ try
+ {
+ String sFaxSubPath = "/wizard/fax";
+ sFaxPath = FileAccess.combinePaths(xMSF, sTemplatePath, sFaxSubPath);
+ sWorkPath = FileAccess.getOfficePath(xMSF, "Work", "", "");
- BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus", sFaxPath);
- PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", sFaxPath);
+ BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus", sFaxPath);
+ PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", sFaxPath);
- setControlProperty("lstBusinessStyle", "StringItemList", BusinessFiles[0]);
- setControlProperty("lstPrivateStyle", "StringItemList", PrivateFiles[0]);
+ setControlProperty("lstBusinessStyle", "StringItemList", BusinessFiles[0]);
+ setControlProperty("lstPrivateStyle", "StringItemList", PrivateFiles[0]);
- setControlProperty("lstBusinessStyle", "SelectedItems", new short[]{0});
- setControlProperty("lstPrivateStyle", "SelectedItems", new short[]{0});
+ setControlProperty("lstBusinessStyle", "SelectedItems", new short[]
+ {
+ 0
+ });
+ setControlProperty("lstPrivateStyle", "SelectedItems", new short[]
+ {
+ 0
+ });
- return true;
- } catch (NoValidPathException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return false;
- }
+ return true;
+ }
+ catch (NoValidPathException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return false;
+ }
}
- public void initializeElements() {
+ public void initializeElements()
+ {
setControlProperty("chkUseLogo", "Enabled", new Boolean(myFaxDoc.hasElement("Company Logo")));
setControlProperty("chkUseSubject", "Enabled", new Boolean(myFaxDoc.hasElement("Subject Line")));
setControlProperty("chkUseDate", "Enabled", new Boolean(myFaxDoc.hasElement("Date")));
myFaxDoc.updateDateFields();
}
- public void initializeSalutation() {
+ public void initializeSalutation()
+ {
setControlProperty("lstSalutation", "StringItemList", resources.SalutationLabels);
}
- public void initializeGreeting() {
+ public void initializeGreeting()
+ {
setControlProperty("lstGreeting", "StringItemList", resources.GreetingLabels);
}
- public void initializeCommunication() {
+ public void initializeCommunication()
+ {
setControlProperty("lstCommunicationType", "StringItemList", resources.CommunicationLabels);
}
- private void setDefaultForGreetingAndSalutationAndCommunication() {
+ private void setDefaultForGreetingAndSalutationAndCommunication()
+ {
XTextComponent xTextComponent;
xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
- if (xTextComponent.getText().equals("")) {
+ if (xTextComponent.getText().equals(""))
+ {
xTextComponent.setText(resources.SalutationLabels[0]);
}
xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
- if (xTextComponent.getText().equals("")) {
+ if (xTextComponent.getText().equals(""))
+ {
xTextComponent.setText(resources.GreetingLabels[0]);
}
xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
- if (xTextComponent.getText().equals("")) {
+ if (xTextComponent.getText().equals(""))
+ {
xTextComponent.setText(resources.CommunicationLabels[0]);
}
}
-
- public void initConfiguration() {
- try {
+ public void initConfiguration()
+ {
+ try
+ {
myConfig = new CGFaxWizard();
Object root = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.Office.Writer/Wizards/Fax", false);
myConfig.readConfiguration(root, "cp_");
- mainDA.add(RadioDataAware.attachRadioButtons(myConfig, "cp_FaxType", new Object[] { optBusinessFax, optPrivateFax }, null, true));
+ mainDA.add(RadioDataAware.attachRadioButtons(myConfig, "cp_FaxType", new Object[]
+ {
+ optBusinessFax, optPrivateFax
+ }, null, true));
mainDA.add(UnoDataAware.attachListBox(myConfig.cp_BusinessFax, "cp_Style", lstBusinessStyle, null, true));
mainDA.add(UnoDataAware.attachListBox(myConfig.cp_PrivateFax, "cp_Style", lstPrivateStyle, null, true));
@@ -390,49 +495,68 @@ protected void leaveStep(int OldStep, int NewStep){}
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_Salutation", lstSalutation, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_Greeting", lstGreeting, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_CommunicationType", lstCommunicationType, null, true));
- faxDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_SenderAddressType", new Object[] { optSenderDefine, optSenderPlaceholder }, null, true));
+ faxDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_SenderAddressType", new Object[]
+ {
+ optSenderDefine, optSenderPlaceholder
+ }, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderCompanyName", txtSenderName, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderStreet", txtSenderStreet, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderPostCode", txtSenderPostCode, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderState", txtSenderState, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderCity", txtSenderCity, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderFax", txtSenderFax, null, true));
- faxDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_ReceiverAddressType", new Object[] { optReceiverDatabase, optReceiverPlaceholder }, null, true));
+ faxDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_ReceiverAddressType", new Object[]
+ {
+ optReceiverDatabase, optReceiverPlaceholder
+ }, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_Footer", txtFooter, null, true));
faxDA.add(UnoDataAware.attachCheckBox(cgl, "cp_FooterOnlySecondPage", chkFooterNextPages, null, true));
faxDA.add(UnoDataAware.attachCheckBox(cgl, "cp_FooterPageNumbers", chkFooterPageNumbers, null, true));
- faxDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_CreationType", new Object[] { optCreateFax, optMakeChanges }, null, true));
+ faxDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_CreationType", new Object[]
+ {
+ optCreateFax, optMakeChanges
+ }, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_TemplateName", txtTemplateName, null, true));
faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_TemplatePath", myPathSelection.xSaveTextBox, null, true));
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace();
}
}
- public void saveConfiguration() {
- try {
+ public void saveConfiguration()
+ {
+ try
+ {
Object root = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.Office.Writer/Wizards/Fax", true);
myConfig.writeConfiguration(root, "cp_");
Configuration.commit(root);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
- public void setConfiguration() {
+ public void setConfiguration()
+ {
//set correct Configuration tree:
- if (optBusinessFax.getState()) {
+ if (optBusinessFax.getState())
+ {
optBusinessFaxItemChanged();
}
- if (optPrivateFax.getState()) {
+ if (optPrivateFax.getState())
+ {
optPrivateFaxItemChanged();
}
}
- public void optBusinessFaxItemChanged() {
- DataAware.setDataObject(faxDA,myConfig.cp_BusinessFax,true);
+ public void optBusinessFaxItemChanged()
+ {
+ DataAware.setDataObject(faxDA, myConfig.cp_BusinessFax, true);
setControlProperty("lblBusinessStyle", "Enabled", Boolean.TRUE);
setControlProperty("lstBusinessStyle", "Enabled", Boolean.TRUE);
setControlProperty("lblPrivateStyle", "Enabled", Boolean.FALSE);
@@ -442,14 +566,16 @@ protected void leaveStep(int OldStep, int NewStep){}
setPossibleFooter(true);
}
- public void lstBusinessStyleItemChanged() {
+ public void lstBusinessStyleItemChanged()
+ {
xTextDocument = myFaxDoc.loadAsPreview(BusinessFiles[1][lstBusinessStyle.getSelectedItemPos()], false);
initializeElements();
setElements();
}
- public void optPrivateFaxItemChanged() {
- DataAware.setDataObject(faxDA,myConfig.cp_PrivateFax,true);
+ public void optPrivateFaxItemChanged()
+ {
+ DataAware.setDataObject(faxDA, myConfig.cp_PrivateFax, true);
setControlProperty("lblBusinessStyle", "Enabled", Boolean.FALSE);
setControlProperty("lstBusinessStyle", "Enabled", Boolean.FALSE);
setControlProperty("lblPrivateStyle", "Enabled", Boolean.TRUE);
@@ -459,20 +585,23 @@ protected void leaveStep(int OldStep, int NewStep){}
setPossibleFooter(false);
}
- public void lstPrivateStyleItemChanged() {
+ public void lstPrivateStyleItemChanged()
+ {
xTextDocument = myFaxDoc.loadAsPreview(PrivateFiles[1][lstPrivateStyle.getSelectedItemPos()], false);
initializeElements();
setElements();
}
- public void txtTemplateNameTextChanged() {
+ public void txtTemplateNameTextChanged()
+ {
XDocumentInfoSupplier xDocInfoSuppl = (XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDocument);
XDocumentInfo xDocInfo = xDocInfoSuppl.getDocumentInfo();
String TitleName = txtTemplateName.getText();
Helper.setUnoPropertyValue(xDocInfo, "Title", TitleName);
}
- public void optSenderPlaceholderItemChanged() {
+ public void optSenderPlaceholderItemChanged()
+ {
setControlProperty("lblSenderName", "Enabled", Boolean.FALSE);
setControlProperty("lblSenderStreet", "Enabled", Boolean.FALSE);
setControlProperty("lblPostCodeCity", "Enabled", Boolean.FALSE);
@@ -486,7 +615,8 @@ protected void leaveStep(int OldStep, int NewStep){}
myFaxDoc.fillSenderWithUserData();
}
- public void optSenderDefineItemChanged() {
+ public void optSenderDefineItemChanged()
+ {
setControlProperty("lblSenderName", "Enabled", Boolean.TRUE);
setControlProperty("lblSenderStreet", "Enabled", Boolean.TRUE);
setControlProperty("lblPostCodeCity", "Enabled", Boolean.TRUE);
@@ -505,58 +635,73 @@ protected void leaveStep(int OldStep, int NewStep){}
txtSenderFaxTextChanged();
}
- public void optReceiverPlaceholderItemChanged() {
+ public void optReceiverPlaceholderItemChanged()
+ {
OfficeDocument.attachEventCall(xTextDocument, "OnNew", "StarBasic", "macro:///Template.Correspondence.Placeholder()");
}
- public void optReceiverDatabaseItemChanged() {
+ public void optReceiverDatabaseItemChanged()
+ {
OfficeDocument.attachEventCall(xTextDocument, "OnNew", "StarBasic", "macro:///Template.Correspondence.Database()");
}
- public void optCreateFaxItemChanged() {
+ public void optCreateFaxItemChanged()
+ {
bEditTemplate = false;
}
- public void optMakeChangesItemChanged() {
+ public void optMakeChangesItemChanged()
+ {
bEditTemplate = true;
}
- public void txtSenderNameTextChanged() {
+ public void txtSenderNameTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("Company", txtSenderName.getText());
}
- public void txtSenderStreetTextChanged() {
+ public void txtSenderStreetTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("Street", txtSenderStreet.getText());
}
- public void txtSenderCityTextChanged() {
+ public void txtSenderCityTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("City", txtSenderCity.getText());
}
- public void txtSenderPostCodeTextChanged() {
+ public void txtSenderPostCodeTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("PostCode", txtSenderPostCode.getText());
}
- public void txtSenderStateTextChanged() {
+ public void txtSenderStateTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("State", txtSenderState.getText());
}
- public void txtSenderFaxTextChanged() {
+ public void txtSenderFaxTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("Fax", txtSenderFax.getText());
}
-
-
//switch Elements on/off -------------------------------------------------------
- public void setElements() {
+ public void setElements()
+ {
//UI relevant:
- if (optSenderDefine.getState()) {optSenderDefineItemChanged();}
- if (optSenderPlaceholder.getState()) {optSenderPlaceholderItemChanged();}
+ if (optSenderDefine.getState())
+ {
+ optSenderDefineItemChanged();
+ }
+ if (optSenderPlaceholder.getState())
+ {
+ optSenderPlaceholderItemChanged();
+ }
chkUseLogoItemChanged();
chkUseSubjectItemChanged();
chkUseSalutationItemChanged();
@@ -567,39 +712,61 @@ protected void leaveStep(int OldStep, int NewStep){}
txtTemplateNameTextChanged();
//not UI relevant:
- if (optReceiverDatabase.getState()) {optReceiverDatabaseItemChanged();}
- if (optReceiverPlaceholder.getState()) {optReceiverPlaceholderItemChanged();}
- if (optCreateFax.getState()) {optCreateFaxItemChanged();}
- if (optMakeChanges.getState()) {optMakeChangesItemChanged();}
+ if (optReceiverDatabase.getState())
+ {
+ optReceiverDatabaseItemChanged();
+ }
+ if (optReceiverPlaceholder.getState())
+ {
+ optReceiverPlaceholderItemChanged();
+ }
+ if (optCreateFax.getState())
+ {
+ optCreateFaxItemChanged();
+ }
+ if (optMakeChanges.getState())
+ {
+ optMakeChangesItemChanged();
+ }
}
-
- public void chkUseLogoItemChanged() {
- if (myFaxDoc.hasElement("Company Logo")) {
+ public void chkUseLogoItemChanged()
+ {
+ if (myFaxDoc.hasElement("Company Logo"))
+ {
myFaxDoc.switchElement("Company Logo", (chkUseLogo.getState() != 0));
}
}
- public void chkUseSubjectItemChanged() {
- if (myFaxDoc.hasElement("Subject Line")) {
+ public void chkUseSubjectItemChanged()
+ {
+ if (myFaxDoc.hasElement("Subject Line"))
+ {
myFaxDoc.switchElement("Subject Line", (chkUseSubject.getState() != 0));
}
}
- public void chkUseDateItemChanged() {
- if (myFaxDoc.hasElement("Date")) {
+ public void chkUseDateItemChanged()
+ {
+ if (myFaxDoc.hasElement("Date"))
+ {
myFaxDoc.switchElement("Date", (chkUseDate.getState() != 0));
}
}
- public void chkUseFooterItemChanged() {
- try {
+ public void chkUseFooterItemChanged()
+ {
+ try
+ {
boolean bFooterPossible = (chkUseFooter.getState() != 0) && AnyConverter.toBoolean(getControlProperty("chkUseFooter", "Enabled"));
- if (chkFooterNextPages.getState() != 0) {
- myFaxDoc.switchFooter("First Page", false, (chkFooterPageNumbers.getState() != 0),txtFooter.getText());
+ if (chkFooterNextPages.getState() != 0)
+ {
+ myFaxDoc.switchFooter("First Page", false, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
myFaxDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
- } else {
+ }
+ else
+ {
myFaxDoc.switchFooter("First Page", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
myFaxDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
}
@@ -608,85 +775,100 @@ protected void leaveStep(int OldStep, int NewStep){}
XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER);
Helper.setUnoPropertyValue(BPaperItem, "Enabled", new Boolean(bFooterPossible));
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void chkFooterNextPagesItemChanged() {
+ public void chkFooterNextPagesItemChanged()
+ {
chkUseFooterItemChanged();
}
- public void chkFooterPageNumbersItemChanged() {
+ public void chkFooterPageNumbersItemChanged()
+ {
chkUseFooterItemChanged();
}
- public void txtFooterTextChanged() {
+ public void txtFooterTextChanged()
+ {
chkUseFooterItemChanged();
}
- public void chkUseSalutationItemChanged() {
+ public void chkUseSalutationItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
myFaxDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
setControlProperty("lstSalutation", "Enabled", new Boolean(chkUseSalutation.getState() != 0));
}
- public void lstSalutationItemChanged() {
+ public void lstSalutationItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
myFaxDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
}
- public void lstSalutationTextChanged() {
+ public void lstSalutationTextChanged()
+ {
}
- public void chkUseCommunicationItemChanged() {
+ public void chkUseCommunicationItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
myFaxDoc.switchUserField("CommunicationType", xTextComponent.getText(), (chkUseCommunicationType.getState() != 0));
setControlProperty("lstCommunicationType", "Enabled", new Boolean(chkUseCommunicationType.getState() != 0));
}
- public void lstCommunicationItemChanged() {
+ public void lstCommunicationItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
myFaxDoc.switchUserField("CommunicationType", xTextComponent.getText(), (chkUseCommunicationType.getState() != 0));
}
- public void lstCommunicationTextChanged() {
+ public void lstCommunicationTextChanged()
+ {
}
- public void chkUseGreetingItemChanged() {
+ public void chkUseGreetingItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
myFaxDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
setControlProperty("lstGreeting", "Enabled", new Boolean(chkUseGreeting.getState() != 0));
}
- public void lstGreetingItemChanged() {
+ public void lstGreetingItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
myFaxDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
}
- public void lstGreetingTextChanged() {
+ public void lstGreetingTextChanged()
+ {
}
- private void setPossibleFooter(boolean bState) {
+ private void setPossibleFooter(boolean bState)
+ {
setControlProperty("chkUseFooter", "Enabled", new Boolean(bState));
- if (!bState) {
+ if (!bState)
+ {
chkUseFooter.setState((short) 0);
}
chkUseFooterItemChanged();
}
- private void enableSenderReceiver() {
+ private void enableSenderReceiver()
+ {
XInterface BPaperItem = getRoadmapItemByID(RM_SENDERRECEIVER);
Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.TRUE);
}
- private void disableSenderReceiver() {
+ private void disableSenderReceiver()
+ {
XInterface BPaperItem = getRoadmapItemByID(RM_SENDERRECEIVER);
Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.FALSE);
}
-
-
-
}
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java
index 7278fd6a4e14..ccaacae7ec91 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java
@@ -1,9 +1,42 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: FaxWizardDialogResources.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.fax;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.Resource;
-public class FaxWizardDialogResources extends Resource {
+public class FaxWizardDialogResources extends Resource
+{
+
final static String UNIT_NAME = "dbwizres";
final static String MODULE_NAME = "dbw";
final static int RID_FAXWIZARDDIALOG_START = 3200;
@@ -12,15 +45,12 @@ public class FaxWizardDialogResources extends Resource {
final static int RID_FAXWIZARDSALUTATION_START = 3290;
final static int RID_FAXWIZARDROADMAP_START = 3300;
final static int RID_RID_COMMON_START = 500;
-
protected String[] RoadmapLabels = new String[7];
protected String[] SalutationLabels = new String[4];
protected String[] GreetingLabels = new String[4];
protected String[] CommunicationLabels = new String[3];
-
String resOverwriteWarning;
String resTemplateDescription;
-
String resFaxWizardDialog_title;
String resLabel9_value;
String resoptBusinessFax_value;
@@ -62,7 +92,8 @@ public class FaxWizardDialogResources extends Resource {
String resoptReceiverDatabase_value;
String resLabel2_value;
- public FaxWizardDialogResources(XMultiServiceFactory xmsf) {
+ public FaxWizardDialogResources(XMultiServiceFactory xmsf)
+ {
super(xmsf, UNIT_NAME, MODULE_NAME);
/**
* Delete the String, uncomment the getResText method
@@ -115,36 +146,41 @@ public class FaxWizardDialogResources extends Resource {
loadCommonResources();
}
- private void loadCommonResources() {
+ private void loadCommonResources()
+ {
resOverwriteWarning = getResText(RID_RID_COMMON_START + 19);
resTemplateDescription = getResText(RID_RID_COMMON_START + 20);
}
- private void loadRoadmapResources() {
- for (int i = 1; i < 6; i++) {
+ private void loadRoadmapResources()
+ {
+ for (int i = 1; i < 6; i++)
+ {
RoadmapLabels[i] = getResText(RID_FAXWIZARDROADMAP_START + i);
}
}
- private void loadSalutationResources() {
- for (int i = 1; i < 5; i++) {
- SalutationLabels[i - 1] = getResText(RID_FAXWIZARDSALUTATION_START
- + i);
+ private void loadSalutationResources()
+ {
+ for (int i = 1; i < 5; i++)
+ {
+ SalutationLabels[i - 1] = getResText(RID_FAXWIZARDSALUTATION_START + i);
}
}
- private void loadGreetingResources() {
- for (int i = 1; i < 5; i++) {
- GreetingLabels[i - 1] = getResText(RID_FAXWIZARDGREETING_START
- + i);
+ private void loadGreetingResources()
+ {
+ for (int i = 1; i < 5; i++)
+ {
+ GreetingLabels[i - 1] = getResText(RID_FAXWIZARDGREETING_START + i);
}
}
- private void loadCommunicationResources() {
- for (int i = 1; i < 4; i++) {
- CommunicationLabels[i - 1] = getResText(RID_FAXWIZARDCOMMUNICATION_START
- + i);
+ private void loadCommunicationResources()
+ {
+ for (int i = 1; i < 4; i++)
+ {
+ CommunicationLabels[i - 1] = getResText(RID_FAXWIZARDCOMMUNICATION_START + i);
}
}
-
} \ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java
index 561d0b140dbe..60b0b1705487 100644
--- a/wizards/com/sun/star/wizards/form/CallFormWizard.java
+++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -41,7 +41,8 @@ import com.sun.star.wizards.common.Properties;
* (<CODE>__writeRegistryServiceInfo</CODE>).
* @author Bertram Nolte
*/
-public class CallFormWizard {
+public class CallFormWizard
+{
/** Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -56,10 +57,13 @@ public class CallFormWizard {
* structures) of a single
* registry key accessible.
*/
- public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey) {
+ public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey)
+ {
com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null;
if (stringImplementationName.equals(FormWizardImplementation.class.getName()))
+ {
xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(FormWizardImplementation.class, FormWizardImplementation.__serviceName, xMSF, xregistrykey);
+ }
return xsingleservicefactory;
}
@@ -71,14 +75,16 @@ public class CallFormWizard {
* structures) of a single
* registry key accessible.
*/
- public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey) {
+ public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey)
+ {
return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(FormWizardImplementation.class.getName(), FormWizardImplementation.__serviceName, xregistrykey);
}
/** This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
- public static class FormWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor {
+ public static class FormWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor
+ {
PropertyValue[] databaseproperties;
public XComponent Document = null;
@@ -88,38 +94,44 @@ public class CallFormWizard {
* @param xmultiservicefactoryInitialization A special service factory
* could be introduced while initializing.
*/
- public FormWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) {
+ public FormWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
super();
xmultiservicefactory = xmultiservicefactoryInitialization;
- registerProperty("Document", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
- registerProperty("DocumentDefinition", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
+ registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
+ registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
}
- public void trigger(String sEvent) {
- try {
- if (sEvent.compareTo("start") == 0) {
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.compareTo("start") == 0)
+ {
FormWizard CurFormWizard = new FormWizard(xmultiservicefactory);
XComponent[] obj = CurFormWizard.startFormWizard(xmultiservicefactory, databaseproperties);
- if ( obj != null ){
+ if (obj != null)
+ {
DocumentDefinition = obj[0];
Document = obj[1];
}
}
- else if (sEvent.compareTo("end") == 0) {
+ else if (sEvent.compareTo("end") == 0)
+ {
DocumentDefinition = null;
Document = null;
databaseproperties = null;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
System.gc();
}
-
/** The service name, that must be used to get an instance of this service.
*/
private static final String __serviceName = "com.sun.star.wizards.form.CallFormWizard";
-
/** The service manager, that gives access to all registered services.
*/
private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
@@ -131,14 +143,16 @@ public class CallFormWizard {
* @throws Exception Every exception will not be handled, but will be
* passed to the caller.
*/
- public void initialize(Object[] object) throws com.sun.star.uno.Exception {
+ public void initialize(Object[] object) throws com.sun.star.uno.Exception
+ {
databaseproperties = Properties.convertToPropertyValueArray(object);
}
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
- public java.lang.String[] getSupportedServiceNames() {
+ public java.lang.String[] getSupportedServiceNames()
+ {
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
@@ -151,10 +165,12 @@ public class CallFormWizard {
* @param stringService Service name.
* @return True, if the given service name will be supported.
*/
- public boolean supportsService(String stringService) {
+ public boolean supportsService(String stringService)
+ {
boolean booleanSupportsService = false;
- if (stringService.equals(__serviceName)) {
+ if (stringService.equals(__serviceName))
+ {
booleanSupportsService = true;
}
return (booleanSupportsService);
@@ -171,13 +187,18 @@ public class CallFormWizard {
* whole combination of objects.
* @return Array of bytes, in order to distinguish between two sets.
*/
- public byte[] getImplementationId() {
- byte[] byteReturn = {
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
};
- try {
+ try
+ {
byteReturn = new String("" + this.hashCode()).getBytes();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
@@ -187,7 +208,8 @@ public class CallFormWizard {
/** Return the class name of the component.
* @return Class name of the component.
*/
- public java.lang.String getImplementationName() {
+ public java.lang.String getImplementationName()
+ {
return (FormWizardImplementation.class.getName());
}
@@ -196,19 +218,21 @@ public class CallFormWizard {
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- public Type[] getTypes() {
- Type[] typeReturn = {
+ public Type[] getTypes()
+ {
+ Type[] typeReturn =
+ {
};
- try {
- typeReturn = new Type[] { new Type(com.sun.star.task.XJobExecutor.class)
- , new Type(com.sun.star.lang.XTypeProvider.class)
- , new Type(com.sun.star.lang.XServiceInfo.class)
- , new Type(com.sun.star.beans.XPropertySet.class)
- , new Type(com.sun.star.beans.XFastPropertySet.class)
- , new Type(com.sun.star.beans.XMultiPropertySet.class)
- , new Type(com.sun.star.lang.XInitialization.class)};
- } catch (Exception exception) {
+ try
+ {
+ typeReturn = new Type[]
+ {
+ new Type(com.sun.star.task.XJobExecutor.class), new Type(com.sun.star.lang.XTypeProvider.class), new Type(com.sun.star.lang.XServiceInfo.class), new Type(com.sun.star.beans.XPropertySet.class), new Type(com.sun.star.beans.XFastPropertySet.class), new Type(com.sun.star.beans.XMultiPropertySet.class), new Type(com.sun.star.lang.XInitialization.class)
+ };
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
index 35480f4b49dd..5b9473ba4c60 100644
--- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java
+++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
@@ -28,6 +28,7 @@
*
************************************************************************/
package com.sun.star.wizards.form;
+
import com.sun.star.awt.XCheckBox;
import com.sun.star.awt.XRadioButton;
import com.sun.star.beans.PropertyValue;
@@ -37,18 +38,19 @@ import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.WizardDialog;
import com.sun.star.wizards.ui.UIConsts;
+public class DataEntrySetter
+{
-public class DataEntrySetter{
WizardDialog CurUnoDialog;
short curtabindex;
-
XRadioButton optNewDataOnly;
XRadioButton optDisplayAllData;
XCheckBox chknomodification;
XCheckBox chknodeletion;
XCheckBox chknoaddition;
- public DataEntrySetter(WizardDialog _CurUnoDialog) {
+ public DataEntrySetter(WizardDialog _CurUnoDialog)
+ {
this.CurUnoDialog = _CurUnoDialog;
curtabindex = (short) (FormWizard.SODATAPAGE * 100);
Integer IDataStep = new Integer(FormWizard.SODATAPAGE);
@@ -59,37 +61,68 @@ public class DataEntrySetter{
String sNoAddition = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 49); // AlowInserts
String sdontdisplayExistingData = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 45);
- optNewDataOnly = CurUnoDialog.insertRadioButton("optNewDataOnly", "toggleCheckBoxes", this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], "HID:34461", sNewDataOnly, new Integer(98), new Integer(25),IDataStep, new Short(curtabindex++), new Integer(195)}
- );
+ optNewDataOnly = CurUnoDialog.insertRadioButton("optNewDataOnly", "toggleCheckBoxes", this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:34461", sNewDataOnly, new Integer(98), new Integer(25), IDataStep, new Short(curtabindex++), new Integer(195)
+ });
- optDisplayAllData = CurUnoDialog.insertRadioButton("optDisplayAllData", "toggleCheckBoxes", this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8],"HID:34462", sDisplayAllData, new Integer(98), new Integer(50), new Short((short)1),IDataStep, new Short(curtabindex++), new Integer(197)}
- );
- chknomodification = CurUnoDialog.insertCheckBox("chknomodification", null,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], "HID:34463", sNoModification, new Integer(108), new Integer(62), new Short((short)0),IDataStep, new Short(curtabindex++), new Integer(189)}
- );
- chknodeletion = CurUnoDialog.insertCheckBox("chknodeletion", null,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], "HID:34464", sNoDeletion, new Integer(108), new Integer(74), new Short((short)0),IDataStep, new Short(curtabindex++), new Integer(189)}
- );
- chknoaddition = CurUnoDialog.insertCheckBox("chknoaddition", null,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], "HID:34465", sNoAddition, new Integer(108), new Integer(86), new Short((short)0),IDataStep, new Short(curtabindex++), new Integer(191)}
- );
- CurUnoDialog.insertLabel("lbldontdisplayExistingData",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(8), sdontdisplayExistingData, new Integer(108), new Integer(33),IDataStep, new Short(curtabindex++), new Integer(134)}
- );
+ optDisplayAllData = CurUnoDialog.insertRadioButton("optDisplayAllData", "toggleCheckBoxes", this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:34462", sDisplayAllData, new Integer(98), new Integer(50), new Short((short) 1), IDataStep, new Short(curtabindex++), new Integer(197)
+ });
+ chknomodification = CurUnoDialog.insertCheckBox("chknomodification", null,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:34463", sNoModification, new Integer(108), new Integer(62), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(189)
+ });
+ chknodeletion = CurUnoDialog.insertCheckBox("chknodeletion", null,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:34464", sNoDeletion, new Integer(108), new Integer(74), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(189)
+ });
+ chknoaddition = CurUnoDialog.insertCheckBox("chknoaddition", null,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:34465", sNoAddition, new Integer(108), new Integer(86), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(191)
+ });
+ CurUnoDialog.insertLabel("lbldontdisplayExistingData",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), sdontdisplayExistingData, new Integer(108), new Integer(33), IDataStep, new Short(curtabindex++), new Integer(134)
+ });
}
-
- public PropertyValue[] getFormProperties(){
+ public PropertyValue[] getFormProperties()
+ {
PropertyValue[] retProperties;
- if (optDisplayAllData.getState()){
+ if (optDisplayAllData.getState())
+ {
retProperties = new PropertyValue[3];
boolean bAllowUpdates = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknomodification), "State")).shortValue()) != 1;
boolean bAllowDeletes = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknodeletion), "State")).shortValue()) != 1;
@@ -98,7 +131,8 @@ public class DataEntrySetter{
retProperties[1] = Properties.createProperty("AllowDeletes", new Boolean(bAllowDeletes));
retProperties[2] = Properties.createProperty("AllowInserts", new Boolean(bAllowInserts));
}
- else{
+ else
+ {
retProperties = new PropertyValue[1];
retProperties[0] = Properties.createProperty("IgnoreResult", new Boolean(true));
}
@@ -106,13 +140,11 @@ public class DataEntrySetter{
}
-
- public void toggleCheckBoxes(){
+ public void toggleCheckBoxes()
+ {
boolean bdisplayalldata = optDisplayAllData.getState();
Helper.setUnoPropertyValue(UnoDialog.getModel(chknomodification), "Enabled", new Boolean(bdisplayalldata));
Helper.setUnoPropertyValue(UnoDialog.getModel(chknodeletion), "Enabled", new Boolean(bdisplayalldata));
Helper.setUnoPropertyValue(UnoDialog.getModel(chknoaddition), "Enabled", new Boolean(bdisplayalldata));
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/form/FieldLinker.java b/wizards/com/sun/star/wizards/form/FieldLinker.java
index 2b0464f0f664..2bcee88c84d0 100644
--- a/wizards/com/sun/star/wizards/form/FieldLinker.java
+++ b/wizards/com/sun/star/wizards/form/FieldLinker.java
@@ -47,8 +47,9 @@ import com.sun.star.wizards.ui.WizardDialog;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.DBLimitedFieldSelection;
+public class FieldLinker extends DBLimitedFieldSelection
+{
-public class FieldLinker extends DBLimitedFieldSelection{
XFixedText[] lblSlaveFields;
XFixedText[] lblMasterFields;
XListBox[] lstSlaveFields;
@@ -66,118 +67,183 @@ public class FieldLinker extends DBLimitedFieldSelection{
String sMasterHidString;
Integer IListBoxPosX;
-
-
- public FieldLinker(WizardDialog _CurUnoDialog, int iStep, int iCompPosX, int iCompPosY, int iCompWidth, int _firsthelpid) {
+ public FieldLinker(WizardDialog _CurUnoDialog, int iStep, int iCompPosX, int iCompPosY, int iCompWidth, int _firsthelpid)
+ {
super(_CurUnoDialog, iStep, iCompPosX, iCompPosY, iCompWidth, _firsthelpid);
}
+ protected void insertControlGroup(int i)
+ {
+ try
+ {
+ if (i == 0)
+ {
+ lblSlaveFields = new XFixedText[rowcount];
+ lblMasterFields = new XFixedText[rowcount];
+ lstSlaveFields = new XListBox[rowcount];
+ lstMasterFields = new XListBox[rowcount];
+ SOFIRSTLINKLST = 0;
+ SOSECLINKLST = 1;
+ SOTHIRDLINKLST = 2;
+ SOFOURTHLINKLST = 3;
+ IListBoxPosX = new Integer(iCompPosX + 6);
+ sSlaveListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 20, 4); //new String[rowcount];""; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
+ sMasterListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 24, 4);// new String[rowcount];""; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
+ SOLINKLST = new int[]
+ {
+ SOFIRSTLINKLST, SOSECLINKLST, SOTHIRDLINKLST, SOFOURTHLINKLST
+ };
+ }
+ sSlaveHidString = "HID:" + Integer.toString(FirstHelpIndex + (i * 2));
+ sMasterHidString = "HID:" + Integer.toString(FirstHelpIndex + (i * 2) + 1);
+ boolean bDoEnable = (i < 2);
+ lblSlaveFields[i] = CurUnoDialog.insertLabel("lblSlaveFieldLink" + new Integer(i + 1).toString(),
+ new String[]
+ {
+ "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(bDoEnable), new Integer(8), sSlaveListHeader[i], new Integer(97), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97)
+ });
+ lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(),
+ new String[]
+ {
+ "Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Boolean(bDoEnable), UIConsts.INTEGER_12, sSlaveHidString, new Integer(97), new Integer(iCurPosY + 10), IStep, new Short(curtabindex++), new Integer(97)
+ });
+
+ lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + new Integer(i + 1).toString(),
+ new String[]
+ {
+ "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(bDoEnable), new Integer(8), sMasterListHeader[i], new Integer(206), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97)
+ });
- protected void insertControlGroup(int i){
- try {
- if (i == 0){
- lblSlaveFields = new XFixedText[rowcount];
- lblMasterFields = new XFixedText[rowcount];
- lstSlaveFields = new XListBox[rowcount];
- lstMasterFields = new XListBox[rowcount];
- SOFIRSTLINKLST = 0;
- SOSECLINKLST = 1;
- SOTHIRDLINKLST = 2;
- SOFOURTHLINKLST = 3;
- IListBoxPosX = new Integer(iCompPosX + 6);
- sSlaveListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 20, 4); //new String[rowcount];""; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
- sMasterListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 24, 4);// new String[rowcount];""; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
- SOLINKLST = new int[] { SOFIRSTLINKLST, SOSECLINKLST, SOTHIRDLINKLST, SOFOURTHLINKLST };
+ lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(),
+ new String[]
+ {
+ "Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Boolean(bDoEnable), UIConsts.INTEGER_12, sMasterHidString, new Integer(206), new Integer(iCurPosY + 10), IStep, new Short(curtabindex++), new Integer(97)
+ });
+ iCurPosY = iCurPosY + 38;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
}
- sSlaveHidString = "HID:" + Integer.toString(FirstHelpIndex + (i * 2));
- sMasterHidString = "HID:" + Integer.toString(FirstHelpIndex + (i * 2) + 1);
- boolean bDoEnable = (i < 2);
- lblSlaveFields[i] = CurUnoDialog.insertLabel("lblSlaveFieldLink" + new Integer(i + 1).toString(),
- new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {new Boolean(bDoEnable), new Integer(8), sSlaveListHeader[i], new Integer(97), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97)} );
- lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(),
- new String[] {"Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE, new Boolean(bDoEnable), UIConsts.INTEGER_12, sSlaveHidString, new Integer(97), new Integer(iCurPosY+10), IStep, new Short(curtabindex++), new Integer(97)});
-
- lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + new Integer(i + 1).toString(),
- new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {new Boolean(bDoEnable), new Integer(8),sMasterListHeader[i], new Integer(206), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97)});
-
- lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(),
- new String[] {"Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE, new Boolean(bDoEnable), UIConsts.INTEGER_12, sMasterHidString, new Integer(206), new Integer(iCurPosY+10), IStep, new Short(curtabindex++), new Integer(97)});
- iCurPosY = iCurPosY + 38;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- protected void enableNextControlRow(int curindex) {
+ }
+
+ protected void enableNextControlRow(int curindex)
+ {
setMaxSelIndex();
boolean bDoEnable = ((lstSlaveFields[curindex].getSelectedItemPos() > 0) && (lstMasterFields[curindex].getSelectedItemPos() > 0));
if (!bDoEnable)
+ {
moveupSelectedItems(curindex, bDoEnable);
+ }
else
+ {
toggleControlRow(curindex + 1, true);
+ }
}
-
- protected void setMaxSelIndex(){
+ protected void setMaxSelIndex()
+ {
MaxSelIndex = -1;
- for (int i = 0; i < rowcount; i++) {
+ for (int i = 0; i < rowcount; i++)
+ {
if ((lstSlaveFields[i].getSelectedItemPos() > 0) && (lstMasterFields[i].getSelectedItemPos() > 0))
+ {
MaxSelIndex += 1;
+ }
}
}
-
- protected void toggleControlRow(int i, boolean bDoEnable){
- if (i < rowcount) {
+ protected void toggleControlRow(int i, boolean bDoEnable)
+ {
+ if (i < rowcount)
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(lblSlaveFields[i]), "Enabled", new Boolean(bDoEnable));
Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), "Enabled", new Boolean(bDoEnable));
Helper.setUnoPropertyValue(UnoDialog.getModel(lblMasterFields[i]), "Enabled", new Boolean(bDoEnable));
Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "Enabled", new Boolean(bDoEnable));
- if (bDoEnable == false){
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), "SelectedItems", new short[] {0});
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "SelectedItems", new short[] {0});
+ if (bDoEnable == false)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), "SelectedItems", new short[]
+ {
+ 0
+ });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "SelectedItems", new short[]
+ {
+ 0
+ });
}
}
}
-
- protected void updateFromNextControlRow(int curindex){
+ protected void updateFromNextControlRow(int curindex)
+ {
short iNextMasterItemPos = lstMasterFields[curindex + 1].getSelectedItemPos();
short iNextSlaveItemPos = lstSlaveFields[curindex + 1].getSelectedItemPos();
- if ((iNextMasterItemPos != 0) && (iNextSlaveItemPos != 0)) {
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex]), "SelectedItems", new short[] { iNextMasterItemPos });
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), "SelectedItems", new short[] { iNextSlaveItemPos });
+ if ((iNextMasterItemPos != 0) && (iNextSlaveItemPos != 0))
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex]), "SelectedItems", new short[]
+ {
+ iNextMasterItemPos
+ });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), "SelectedItems", new short[]
+ {
+ iNextSlaveItemPos
+ });
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex+1]), "SelectedItems", new short[] {0});
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex+1]), "SelectedItems", new short[] {0});
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), "SelectedItems", new short[]
+ {
+ 0
+ });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), "SelectedItems", new short[]
+ {
+ 0
+ });
toggleControlRow(curindex, true);
}
}
-
- public void initialize(String[] _AllMasterFieldNames, String[] _AllSlaveFieldNames, String[][] _LinkFieldNames) {
+ public void initialize(String[] _AllMasterFieldNames, String[] _AllSlaveFieldNames, String[][] _LinkFieldNames)
+ {
short[] MasterSelList = null;
short[] SlaveSelList = null;
String[] MasterLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOMASTERINDEX);
String[] SlaveLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOSLAVEINDEX);
String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames);
String[] ViewSlaveFieldNames = addNoneFieldItemToList(_AllSlaveFieldNames);
- for (int i = 0; i < super.rowcount; i++) {
+ for (int i = 0; i < super.rowcount; i++)
+ {
super.initializeListBox(lstMasterFields[i], ViewMasterFieldNames, MasterLinkNames, i);
super.initializeListBox(lstSlaveFields[i], ViewSlaveFieldNames, SlaveLinkNames, i);
if (_LinkFieldNames != null)
+ {
toggleControlRow(i, (i <= _LinkFieldNames.length));
+ }
else
+ {
toggleControlRow(i, i == 0);
+ }
}
}
- public String[][] getLinkFieldNames(RelationController _oRelationController, String _sReferencedTableName){
+ public String[][] getLinkFieldNames(RelationController _oRelationController, String _sReferencedTableName)
+ {
return _oRelationController.getImportedKeyColumns(_sReferencedTableName);
}
@@ -186,16 +252,19 @@ public class FieldLinker extends DBLimitedFieldSelection{
* When Joins were assigned duplicate a null value is returned
*
*/
- public String[][] getLinkFieldNames() {
+ public String[][] getLinkFieldNames()
+ {
String sLinkFieldsAreDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 19);
setMaxSelIndex();
String[][] LinkFieldNames = new String[2][MaxSelIndex + 1];
- for (int i = 0; i <= MaxSelIndex; i++) {
+ for (int i = 0; i <= MaxSelIndex; i++)
+ {
LinkFieldNames[0][i] = lstSlaveFields[i].getSelectedItem();
LinkFieldNames[1][i] = lstMasterFields[i].getSelectedItem();
}
int iduplicate = JavaTools.getDuplicateFieldIndex(LinkFieldNames);
- if (iduplicate != -1) {
+ if (iduplicate != -1)
+ {
String sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLinkFieldsAreDuplicate, LinkFieldNames[0][iduplicate], "<FIELDNAME1>");
sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLocLinkFieldsAreDuplicate, LinkFieldNames[1][iduplicate], "<FIELDNAME2>");
CurUnoDialog.setCurrentStep(FormWizard.SOFIELDLINKERPAGE);
@@ -203,24 +272,29 @@ public class FieldLinker extends DBLimitedFieldSelection{
CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sLocLinkFieldsAreDuplicate);
CurUnoDialog.setFocus("lstSlaveFieldLink" + (iduplicate + 1));
return null;
- } else
+ }
+ else
+ {
return LinkFieldNames;
+ }
}
-
-
- public void enable(boolean _bdoenable){
+ public void enable(boolean _bdoenable)
+ {
CurUnoDialog.setStepEnabled(IStep.intValue(), _bdoenable);
}
- class ItemListenerImpl implements com.sun.star.awt.XItemListener {
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
- public void itemStateChanged(ItemEvent EventObject) {
+ public void itemStateChanged(ItemEvent EventObject)
+ {
int ikey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
enableNextControlRow(ikey);
}
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
}
}
diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java
index eafb1c8e2d7f..eb5a0d312f13 100644
--- a/wizards/com/sun/star/wizards/form/Finalizer.java
+++ b/wizards/com/sun/star/wizards/form/Finalizer.java
@@ -43,7 +43,9 @@ import com.sun.star.wizards.ui.*;
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
-public class Finalizer {
+public class Finalizer
+{
+
WizardDialog CurUnoDialog;
Desktop.OfficePathRetriever curofficepath;
short curtabindex;
@@ -52,7 +54,8 @@ public class Finalizer {
XTextComponent txtFormName;
FormDocument oFormDocument;
- public Finalizer(WizardDialog _CurUnoDialog) {
+ public Finalizer(WizardDialog _CurUnoDialog)
+ {
this.CurUnoDialog = _CurUnoDialog;
curtabindex = (short) (FormWizard.SOSTOREPAGE * 100);
@@ -61,51 +64,84 @@ public class Finalizer {
String sWorkWithForm = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 52);
String sModifyForm = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 53);
CurUnoDialog.insertLabel("lblFormName",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], slblFormName, new Integer(97), new Integer(25), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(111)}
- );
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], slblFormName, new Integer(97), new Integer(25), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(111)
+ });
txtFormName = CurUnoDialog.insertTextField("txtFormName", "toggleFinishButton", this,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"},
- new Object[] { UIConsts.INTEGER_12, "HID:34481", new Integer(97), new Integer(35),UIConsts.INTEGERS[8], new Short((short)82),"", new Integer(185)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGER_12, "HID:34481", new Integer(97), new Integer(35), UIConsts.INTEGERS[8], new Short((short) 82), "", new Integer(185)
+ });
CurUnoDialog.insertLabel("lblProceed",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(62),UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(185)}
- );
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(62), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(185)
+ });
XRadioButton optWorkWithForm = CurUnoDialog.insertRadioButton("optWorkWithForm", null,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], "HID:34482", sWorkWithForm, new Integer(101), new Integer(77), new Short((short)1),UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:34482", sWorkWithForm, new Integer(101), new Integer(77), new Short((short) 1), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107)
+ });
optModifyForm = CurUnoDialog.insertRadioButton("optModifyForm", null,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], "HID:34483", sModifyForm, new Integer(101), new Integer(89),UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:34483", sModifyForm, new Integer(101), new Integer(89), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107)
+ });
}
- public void initialize(String _formname, FormDocument _oFormDocument){
+ public void initialize(String _formname, FormDocument _oFormDocument)
+ {
if (oFormDocument == null)
+ {
oFormDocument = _oFormDocument;
+ }
if (txtFormName.getText().length() == 0)
- txtFormName.setText(Desktop.getUniqueName(_oFormDocument.oMainFormDBMetaData.getFormDocuments(),_formname));
+ {
+ txtFormName.setText(Desktop.getUniqueName(_oFormDocument.oMainFormDBMetaData.getFormDocuments(), _formname));
+ }
}
- public void toggleFinishButton(){
+ public void toggleFinishButton()
+ {
CurUnoDialog.enableFinishButton(txtFormName.getText().length() > 0);
}
-
- public String getName(){
+ public String getName()
+ {
return txtFormName.getText();
}
- public boolean getOpenMode(){
+ public boolean getOpenMode()
+ {
boolean bOpenMode = optModifyForm.getState() ? true : false;
return bOpenMode;
}
- public boolean finish(){
+ public boolean finish()
+ {
// if (!oFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sFormName)){
- return oFormDocument.oMainFormDBMetaData.storeDatabaseDocumentToTempPath(this.oFormDocument.xComponent, getName());
+ return oFormDocument.oMainFormDBMetaData.storeDatabaseDocumentToTempPath(this.oFormDocument.xComponent, getName());
// }
}
}
diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java
index a9213ea679c6..3ae38c477094 100644
--- a/wizards/com/sun/star/wizards/form/FormConfiguration.java
+++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java
@@ -47,7 +47,9 @@ import com.sun.star.wizards.db.RelationController;
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
-public class FormConfiguration {
+public class FormConfiguration
+{
+
WizardDialog CurUnoDialog;
short curtabindex;
XRadioButton optOnExistingRelation;
@@ -65,8 +67,8 @@ public class FormConfiguration {
boolean bsupportsRelations;
RelationController oRelationController = null;
-
- public FormConfiguration(WizardDialog _CurUnoDialog){
+ public FormConfiguration(WizardDialog _CurUnoDialog)
+ {
this.CurUnoDialog = _CurUnoDialog;
curtabindex = (short) (FormWizard.SOSUBFORMPAGE * 100);
Integer ISubFormStep = new Integer(FormWizard.SOSUBFORMPAGE);
@@ -77,42 +79,82 @@ public class FormConfiguration {
String sSubFormDescription = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 3);
chkcreateSubForm = CurUnoDialog.insertCheckBox("chkcreateSubForm", SSUBFORMMODE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], "HID:34421", sSelectManually, new Integer(97), new Integer(26), ISubFormStep, new Short(curtabindex++), new Integer(160)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:34421", sSelectManually, new Integer(97), new Integer(26), ISubFormStep, new Short(curtabindex++), new Integer(160)
+ });
optOnExistingRelation = CurUnoDialog.insertRadioButton("optOnExistingRelation", STOGGLESTEPS, this,
- new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {Boolean.FALSE, UIConsts.INTEGERS[8], "HID:34422", sOnExistingRelation, new Integer(107), new Integer(43), ISubFormStep, new Short(curtabindex++), new Integer(160)});
+ new String[]
+ {
+ "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, UIConsts.INTEGERS[8], "HID:34422", sOnExistingRelation, new Integer(107), new Integer(43), ISubFormStep, new Short(curtabindex++), new Integer(160)
+ });
optSelectManually = CurUnoDialog.insertRadioButton("optSelectManually", STOGGLESTEPS, this,
- new String[] {"Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] {Boolean.FALSE, UIConsts.INTEGERS[8], "HID:34423", sOnManualRelation, new Integer(107), new Integer(99), new Short((short)1), ISubFormStep, new Short(curtabindex++), new Integer(160)});
+ new String[]
+ {
+ "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, UIConsts.INTEGERS[8], "HID:34423", sOnManualRelation, new Integer(107), new Integer(99), new Short((short) 1), ISubFormStep, new Short(curtabindex++), new Integer(160)
+ });
lblRelations = CurUnoDialog.insertLabel("lblSelectRelation",
- new String[] {"Enabled", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {Boolean.FALSE, new Integer(19), sSelectRelation, Boolean.TRUE, new Integer(119), new Integer(56), ISubFormStep, new Short(curtabindex++), new Integer(80)});
+ new String[]
+ {
+ "Enabled", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, new Integer(19), sSelectRelation, Boolean.TRUE, new Integer(119), new Integer(56), ISubFormStep, new Short(curtabindex++), new Integer(80)
+ });
lstRelations = CurUnoDialog.insertListBox("lstrelations", SONEXISTINGRELATIONSELECTION, SONEXISTINGRELATIONSELECTION, this,
- new String[] {"Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {Boolean.FALSE, new Integer(37), "HID:34424", new Integer(201), new Integer(55), ISubFormStep, new Short(curtabindex++), new Integer(103)});
+ new String[]
+ {
+ "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, new Integer(37), "HID:34424", new Integer(201), new Integer(55), ISubFormStep, new Short(curtabindex++), new Integer(103)
+ });
lblSubFormDescription = CurUnoDialog.insertLabel("lblSubFormDescription",
- new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(59), sSubFormDescription,Boolean.TRUE, new Integer(110), new Integer(120), ISubFormStep, new Short(curtabindex++), new Integer(190)});
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(59), sSubFormDescription, Boolean.TRUE, new Integer(110), new Integer(120), ISubFormStep, new Short(curtabindex++), new Integer(190)
+ });
CurUnoDialog.insertInfoImage(97, 120, ISubFormStep.intValue());
}
- public RelationController getRelationController(){
+ public RelationController getRelationController()
+ {
return oRelationController;
}
- public boolean areexistingRelationsdefined(){
+ public boolean areexistingRelationsdefined()
+ {
return ((chkcreateSubForm.getState() == 1) && (optOnExistingRelation.getState()));
}
- public void toggleSubFormMode(){
+ public void toggleSubFormMode()
+ {
boolean bdoEnable = (this.chkcreateSubForm.getState() == 1);
Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), "Enabled", new Boolean(bdoEnable && bsupportsRelations));
Helper.setUnoPropertyValue(UnoDialog.getModel(optSelectManually), "Enabled", new Boolean(bdoEnable));
toggleSteps();
}
- public void initialize(CommandFieldSelection _CurSubFormFieldSelection, RelationController _oRelationController){
+ public void initialize(CommandFieldSelection _CurSubFormFieldSelection, RelationController _oRelationController)
+ {
oRelationController = _oRelationController;
sreferencedTables = oRelationController.getExportedKeys();
bsupportsRelations = (sreferencedTables.length > 0);
@@ -122,19 +164,23 @@ public class FormConfiguration {
Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), "Enabled", new Boolean(bsupportsRelations && (chkcreateSubForm.getState() == 1)));
}
-
- public void toggleSteps(){
+ public void toggleSteps()
+ {
boolean bDoEnableFollowingSteps;
- if (chkcreateSubForm.getState() == 1){
- if (optOnExistingRelation.getState()){
+ if (chkcreateSubForm.getState() == 1)
+ {
+ if (optOnExistingRelation.getState())
+ {
onexistingRelationSelection();
}
- else if (optSelectManually.getState()){
- CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKERPAGE, (CurSubFormFieldSelection.getSelectedFieldNames().length > 0 ));
+ else if (optSelectManually.getState())
+ {
+ CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKERPAGE, (CurSubFormFieldSelection.getSelectedFieldNames().length > 0));
CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDSPAGE, true);
}
}
- else{
+ else
+ {
CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDSPAGE, false);
CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKERPAGE, false);
CurUnoDialog.enablefromStep(FormWizard.SOCONTROLPAGE, true);
@@ -142,27 +188,35 @@ public class FormConfiguration {
toggleRelationsListbox();
}
- public String getreferencedTableName(){
- if (areexistingRelationsdefined()){
+ public String getreferencedTableName()
+ {
+ if (areexistingRelationsdefined())
+ {
short[] iselected = (short[]) Helper.getUnoArrayPropertyValue(UnoDialog.getModel(lstRelations), "SelectedItems");
- if (iselected != null){
+ if (iselected != null)
+ {
if (iselected.length > 0)
+ {
return sreferencedTables[iselected[0]];
+ }
}
}
return "";
}
-
- public void onexistingRelationSelection(){
+ public void onexistingRelationSelection()
+ {
String scurreferencedTableName = getreferencedTableName();
- if (scurreferencedTableName.length() > 0){
- if (CurSubFormFieldSelection.getSelectedCommandName().equals(scurreferencedTableName)){
+ if (scurreferencedTableName.length() > 0)
+ {
+ if (CurSubFormFieldSelection.getSelectedCommandName().equals(scurreferencedTableName))
+ {
CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDSPAGE, true);
CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKERPAGE, false);
return;
}
- else{
+ else
+ {
CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDSPAGE, true);
CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKERPAGE, false);
return;
@@ -171,15 +225,15 @@ public class FormConfiguration {
CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDSPAGE, false);
}
- private void toggleRelationsListbox(){
- boolean bdoenable = bsupportsRelations && this.optOnExistingRelation.getState() && (chkcreateSubForm.getState() == 1);
+ private void toggleRelationsListbox()
+ {
+ boolean bdoenable = bsupportsRelations && this.optOnExistingRelation.getState() && (chkcreateSubForm.getState() == 1);
Helper.setUnoPropertyValue(UnoDialog.getModel(lblRelations), "Enabled", new Boolean(bdoenable));
Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), "Enabled", new Boolean(bdoenable));
}
-
- public boolean hasSubForm(){
+ public boolean hasSubForm()
+ {
return (this.chkcreateSubForm.getState() == 1);
}
-
}
diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java
index e53556e9076c..73bad73b5fb1 100644
--- a/wizards/com/sun/star/wizards/form/FormControlArranger.java
+++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java
@@ -28,6 +28,7 @@
*
************************************************************************/
package com.sun.star.wizards.form;
+
import com.sun.star.awt.Point;
import com.sun.star.awt.Size;
import com.sun.star.beans.UnknownPropertyException;
@@ -47,8 +48,9 @@ import com.sun.star.wizards.document.FormHandler;
import com.sun.star.wizards.document.Shape;
import com.sun.star.wizards.document.TimeStampControl;
+public class FormControlArranger
+{
-public class FormControlArranger {
XNameContainer xFormName;
XMultiServiceFactory xMSF;
public DatabaseControl[] DBControlList = null;
@@ -88,8 +90,8 @@ public class FormControlArranger {
int nMaxDBYPos = 0; //the maximum YPosition of a DBControl in the form
Short NBorderType = new Short((short) 1); //3-D Border
-
- public FormControlArranger(FormHandler _oFormHandler, XNameContainer _xFormName, CommandMetaData oDBMetaData, XStatusIndicator _xProgressBar, Point _StartPoint, Size _FormSize) {
+ public FormControlArranger(FormHandler _oFormHandler, XNameContainer _xFormName, CommandMetaData oDBMetaData, XStatusIndicator _xProgressBar, Point _StartPoint, Size _FormSize)
+ {
FieldColumns = oDBMetaData.FieldColumns;
xMSF = oDBMetaData.xMSF;
xFormName = _xFormName;
@@ -101,38 +103,42 @@ public class FormControlArranger {
cYOffset = _StartPoint.Y;
setFormSize(_FormSize);
}
-
-
// Note: on all Controls except for the checkbox the Label has to be set
// a bit under the DBControl because its Height is also smaller
- private int getLabelDiffHeight(int _index){
- if (curDBControl != null){
+ private int getLabelDiffHeight(int _index)
+ {
+ if (curDBControl != null)
+ {
if (curDBControl.getControlType() == FormHandler.SOCHECKBOX)
+ {
return getCheckBoxDiffHeight(_index);
+ }
}
return oFormHandler.getBasicLabelDiffHeight();
}
-
- public void setBorderType(short _nBorderType){
+ public void setBorderType(short _nBorderType)
+ {
NBorderType = new Short(_nBorderType);
}
-
- private int getCheckBoxDiffHeight(int LastIndex){
- if ((LastIndex < DBControlList.length)){
- if (DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX){
- return (int)((oFormHandler.getDBRefHeight() - DBControlList[LastIndex].getDBHeight())/2);
+ private int getCheckBoxDiffHeight(int LastIndex)
+ {
+ if ((LastIndex < DBControlList.length))
+ {
+ if (DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX)
+ {
+ return (int) ((oFormHandler.getDBRefHeight() - DBControlList[LastIndex].getDBHeight()) / 2);
}
}
return 0;
}
-
- private boolean isReducable(int _index){
+ private boolean isReducable(int _index)
+ {
boolean bisreducable = false;
int ntype = this.FieldColumns[_index].FieldType;
- switch(ntype)
+ switch (ntype)
{
case DataType.TINYINT:
case DataType.SMALLINT:
@@ -151,11 +157,16 @@ public class FormControlArranger {
break;
case DataType.VARCHAR:
short nTextLen;
- try {
+ try
+ {
nTextLen = AnyConverter.toShort(DBControlList[_index].xPropertySet.getPropertyValue("MaxTextLen"));
if ((nTextLen == 0) || (nTextLen > 20))
+ {
bisreducable = true;
- } catch (Exception e) {
+ }
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
break;
@@ -166,24 +177,31 @@ public class FormControlArranger {
bisreducable = true;
}
if (nTCWidth > 0.9 * CMAXREDUCTION * nDBWidth)
+ {
bisreducable = false;
+ }
return bisreducable;
}
-
- private int getControlGroupWidth(){
+ private int getControlGroupWidth()
+ {
if (nDBWidth > nTCWidth)
+ {
return nDBWidth;
+ }
else
+ {
return nTCWidth;
+ }
}
-
- private void checkJustifiedPosition(int a){
+ private void checkJustifiedPosition(int a)
+ {
int nBaseWidth = nFormWidth + cXOffset;
int nLeftDist = nMaxColRightX - nBaseWidth;
int nRightDist = nBaseWidth - (DBControlList[a].getPosition().X - this.cHoriDistance);
- if (nLeftDist < 0.5 * nRightDist){
+ if (nLeftDist < 0.5 * nRightDist)
+ {
// Fieldwidths in the line can be made smaller..
adjustLineWidth(StartA, a, nLeftDist, -1);
nYTCPos = nMaxRowY + cVertDistance;
@@ -195,14 +213,18 @@ public class FormControlArranger {
bIsFirstRun = true;
StartA = a + 1;
}
- else{
+ else
+ {
// FieldWidths in the line can be made wider...
- if (nYDBPos + nDBHeight == nMaxRowY){
+ if (nYDBPos + nDBHeight == nMaxRowY)
+ {
// The last Control was the highest in the row
nYTCPos = nSecMaxRowY + cVertDistance;
}
else
+ {
nYTCPos = nMaxRowY + cVertDistance;
+ }
nYDBPos = nYTCPos + nTCHeight;
nXDBPos = cXOffset;
nXTCPos = cXOffset;
@@ -210,31 +232,36 @@ public class FormControlArranger {
this.DBControlList[a].setPosition(new Point(cXOffset, nYDBPos));
bIsFirstRun = true;
if (nDBWidth > nTCWidth)
+ {
checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
+ }
else
+ {
checkOuterPoints(nXDBPos, nTCWidth, nYDBPos, nDBHeight, true);
+ }
nXTCPos = nMaxColRightX + cHoriDistance;
nXDBPos = nXTCPos;
- adjustLineWidth(StartA, a-1, nRightDist, 1);
+ adjustLineWidth(StartA, a - 1, nRightDist, 1);
StartA = a;
}
}
-
- private int getCorrWidth(int StartIndex , int EndIndex , int nDist, int Widthfactor ){
- int ShapeCount;
- if (Widthfactor > 0){
+ private int getCorrWidth(int StartIndex, int EndIndex, int nDist, int Widthfactor)
+ {
+ int ShapeCount;
+ if (Widthfactor > 0)
+ {
// shapes are made wide
- ShapeCount = EndIndex-StartIndex + 1;
+ ShapeCount = EndIndex - StartIndex + 1;
}
- else{
+ else
+ {
// shapes are made more narrow
ShapeCount = iReduceWidth;
}
- return (nDist)/ShapeCount;
+ return (nDist) / ShapeCount;
}
-
/**
*
* @param StartIndex
@@ -242,55 +269,78 @@ public class FormControlArranger {
* @param nDist
* @param WidthFactor is either '+1' or '-1' and determines whether the control shapes widths are to be made smaller or larger
*/
- private void adjustLineWidth(int StartIndex , int EndIndex , int nDist, int WidthFactor ){
+ private void adjustLineWidth(int StartIndex, int EndIndex, int nDist, int WidthFactor)
+ {
int CorrWidth = getCorrWidth(StartIndex, EndIndex, nDist, WidthFactor);
int iLocTCPosX = cXOffset;
- for (int i = StartIndex; i <= EndIndex; i++){
+ for (int i = StartIndex; i <= EndIndex; i++)
+ {
int nControlBaseWidth = 0;
curDBControl = this.DBControlList[i];
curLabelControl = this.LabelControlList[i];
- if (i != StartIndex){
- curLabelControl.setPosition( new Point(iLocTCPosX, curLabelControl.getPosition().Y));
- curDBControl.setPosition( new Point(iLocTCPosX, curLabelControl.getPosition().Y + nTCHeight));
+ if (i != StartIndex)
+ {
+ curLabelControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y));
+ curDBControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + nTCHeight));
}
if (((curLabelControl.getSize().Width > curDBControl.getSize().Width)) && (WidthFactor > 0))
+ {
nControlBaseWidth = curLabelControl.getSize().Width;
+ }
else
+ {
nControlBaseWidth = curDBControl.getSize().Width;
- if (FieldColumns[i].FieldType == DataType.TIMESTAMP){
+ }
+ if (FieldColumns[i].FieldType == DataType.TIMESTAMP)
+ {
TimeStampControl oDBTimeStampControl = (TimeStampControl) curDBControl;
nControlBaseWidth = oDBTimeStampControl.getSize().Width;
if (this.isReducable(i) || WidthFactor > 0)
- oDBTimeStampControl.setSize( new Size(nControlBaseWidth + WidthFactor * CorrWidth, oDBTimeStampControl.getSize().Height));
+ {
+ oDBTimeStampControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, oDBTimeStampControl.getSize().Height));
+ }
}
- else{
+ else
+ {
if (this.isReducable(i) || WidthFactor > 0)
- curDBControl.setSize( new Size(nControlBaseWidth + WidthFactor * CorrWidth, curDBControl.getSize().Height));
+ {
+ curDBControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, curDBControl.getSize().Height));
+ }
}
iLocTCPosX = curDBControl.getPosition().X + curDBControl.getSize().Width + cHoriDistance;
if (curLabelControl.getSize().Width > curDBControl.getSize().Width)
+ {
iLocTCPosX = curLabelControl.getPosition().X + curLabelControl.getSize().Width + cHoriDistance;
+ }
}
if (WidthFactor > 0)
+ {
iReduceWidth = 1;
+ }
else
+ {
iReduceWidth = 0;
+ }
}
-
-
- private void checkOuterPoints(int nXPos, int nWidth, int nYPos, int nHeight, boolean bIsDBField){
+ private void checkOuterPoints(int nXPos, int nWidth, int nYPos, int nHeight, boolean bIsDBField)
+ {
int nColRightX;
- if (icurArrangement == FormWizard.SOTOPJUSTIFIED){
- if (bIsDBField){
+ if (icurArrangement == FormWizard.SOTOPJUSTIFIED)
+ {
+ if (bIsDBField)
+ {
// Only at DBControls you can measure the Value of nMaxRowY
- if (bIsFirstRun){
+ if (bIsFirstRun)
+ {
nMaxRowY = nYPos + nHeight;
nSecMaxRowY = nMaxRowY;
}
- else{
+ else
+ {
int nRowY = nYPos + nHeight;
- if (nRowY >= nMaxRowY){
+ if (nRowY >= nMaxRowY)
+ {
int nOldMaxRowY = nMaxRowY;
nSecMaxRowY = nOldMaxRowY;
nMaxRowY = nRowY;
@@ -299,68 +349,82 @@ public class FormControlArranger {
}
}
// Find the outer right point
- if (bIsFirstRun){
+ if (bIsFirstRun)
+ {
nMaxColRightX = nXPos + nWidth;
bIsFirstRun = false;
}
- else{
+ else
+ {
nColRightX = nXPos + nWidth;
- if (nColRightX > nMaxColRightX){
+ if (nColRightX > nMaxColRightX)
+ {
nMaxColRightX = nColRightX;
}
}
}
+ public void positionControls(int _icurArrangement, Point _aStartPoint, Size _aFormSize, short _iAlign, Short _NBorderType)
+ {
+ try
+ {
+ this.NBorderType = _NBorderType;
+ this.setStartPoint(_aStartPoint);
+ icurArrangement = _icurArrangement;
+ initializePosSizes();
+ initializeControlColumn(-1);
+ bIsVeryFirstRun = true;
+ nMaxRowY = 0;
+ nSecMaxRowY = 0;
+ this.nMaxColRightX = 0;
+ xProgressBar.start("", FieldColumns.length);
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ insertLabel(i, _iAlign);
+ insertDBControl(i);
+ bIsVeryFirstRun = false;
+ DBControlList[i].setPropertyValue("LabelControl", curLabelControl.xPropertySet);
+ resetPosSizes(i);
+ xProgressBar.setValue(i + 1);
+ }
+ xProgressBar.end();
+ bControlsareCreated = true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public void positionControls(int _icurArrangement, Point _aStartPoint,Size _aFormSize, short _iAlign, Short _NBorderType){
- try {
- this.NBorderType = _NBorderType;
- this.setStartPoint(_aStartPoint);
- icurArrangement = _icurArrangement;
- initializePosSizes();
- initializeControlColumn(-1);
- bIsVeryFirstRun = true;
- nMaxRowY = 0;
- nSecMaxRowY = 0;
- this.nMaxColRightX = 0;
- xProgressBar.start("", FieldColumns.length);
- for (int i = 0; i < FieldColumns.length; i++){
- insertLabel(i, _iAlign);
- insertDBControl(i);
- bIsVeryFirstRun = false;
- DBControlList[i].setPropertyValue("LabelControl", curLabelControl.xPropertySet);
- resetPosSizes(i);
- xProgressBar.setValue(i+1);
- }
- xProgressBar.end();
- bControlsareCreated = true;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- public boolean areControlsexisting(){
+ public boolean areControlsexisting()
+ {
if (DBControlList != null)
+ {
if (DBControlList.length > 0)
+ {
return (DBControlList[0] != null);
+ }
+ }
return false;
}
-
- private void initializeControlColumn(int LastIndex){
+ private void initializeControlColumn(int LastIndex)
+ {
bIsFirstRun = true;
StartA = LastIndex + 1;
a = 0;
}
-
- private void resetPosSizes(int LastIndex){
+ private void resetPosSizes(int LastIndex)
+ {
int nYRefPos = nYDBPos;
- switch (icurArrangement){
+ switch (icurArrangement)
+ {
case FormWizard.SOCOLUMNARLEFT:
- nYDBPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
+ nYDBPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
nYRefPos = nYDBPos;
- if ((nYDBPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length-1))){
+ if ((nYDBPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1)))
+ {
repositionColumnarLeftControls(LastIndex);
nXTCPos = nMaxColRightX + 2 * cHoriDistance;
nXDBPos = nXTCPos + this.cLabelGap + nMaxTCWidth;
@@ -368,17 +432,24 @@ public class FormControlArranger {
nYRefPos = nYDBPos;
initializeControlColumn(LastIndex);
}
- else{
- a = a + 1;
+ else
+ {
+ /*a = a + 1;*/
+ /* a += 1;*/
+ ++a;
}
nYTCPos = nYDBPos + this.getLabelDiffHeight(LastIndex);
- if ((nYRefPos + nDBHeight) > nMaxDBYPos)
+ if ((nYRefPos + nDBHeight) > nMaxDBYPos)
+ {
nMaxDBYPos = nYRefPos + nDBHeight;
+ }
break;
- case FormWizard.SOCOLUMNARTOP:
- nYTCPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);;
- if ((nYTCPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length-1))){
+ case FormWizard.SOCOLUMNARTOP:
+ nYTCPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
+ ;
+ if ((nYTCPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1)))
+ {
nXDBPos = nMaxColRightX + cHoriDistance;
nXTCPos = nXDBPos;
nYRefPos = nYDBPos;
@@ -387,38 +458,50 @@ public class FormControlArranger {
initializeControlColumn(LastIndex);
}
else
+ {
a = a + 1;
+ }
if ((nYRefPos + nDBHeight + cVertDistance) > nMaxDBYPos)
+ {
nMaxDBYPos = nYRefPos + nDBHeight + cVertDistance;
+ }
break;
- case FormWizard.SOTOPJUSTIFIED:
+ case FormWizard.SOTOPJUSTIFIED:
if (this.isReducable(a))
+ {
iReduceWidth = iReduceWidth + 1;
- if (nMaxColRightX > cXOffset + nFormWidth){
+ }
+ if (nMaxColRightX > cXOffset + nFormWidth)
+ {
int nOldYTCPos = nYTCPos;
checkJustifiedPosition(a);
nYRefPos = nYDBPos;
}
else
+ {
nXTCPos = nMaxColRightX + cHoriDistance;
+ }
a = a + 1;
if ((nYRefPos + nDBHeight) > nMaxDBYPos)
+ {
nMaxDBYPos = nYRefPos + nDBHeight;
+ }
break;
}
// if ((nYRefPos + nDBHeight) > nMaxDBYPos)
// nMaxDBYPos = nYRefPos + nDBHeight;
}
-
-
- private void repositionColumnarLeftControls(int LastIndex ){
+ private void repositionColumnarLeftControls(int LastIndex)
+ {
bIsFirstRun = true;
- for (int i = StartA; i <= LastIndex; i++){
- if (i == StartA){
+ for (int i = StartA; i <= LastIndex; i++)
+ {
+ if (i == StartA)
+ {
nXTCPos = LabelControlList[i].getPosition().X;
- nXDBPos = nXTCPos + nMaxTCWidth + cHoriDistance;
+ nXDBPos = nXTCPos + nMaxTCWidth + cHoriDistance;
}
LabelControlList[i].setSize(new Size(nMaxTCWidth, nTCHeight));
resetDBShape(DBControlList[i], nXDBPos);
@@ -426,16 +509,16 @@ public class FormControlArranger {
}
}
-
- private void resetDBShape(Shape _curDBControl, int iXPos){
+ private void resetDBShape(Shape _curDBControl, int iXPos)
+ {
int nYDBPos = _curDBControl.getPosition().Y;
nDBWidth = _curDBControl.getSize().Width;
nDBHeight = _curDBControl.getSize().Height;
_curDBControl.setPosition(new Point(iXPos, nYDBPos));
}
-
- private void initializePosSizes(){
+ private void initializePosSizes()
+ {
this.nMaxDBYPos = 0;
nXTCPos = cXOffset;
nTCWidth = 2000;
@@ -443,144 +526,187 @@ public class FormControlArranger {
nDBHeight = oFormHandler.getDBRefHeight();
nTCHeight = oFormHandler.getLabelHeight();
iReduceWidth = 0;
- if (icurArrangement == FormWizard.SOCOLUMNARLEFT){
+ if (icurArrangement == FormWizard.SOCOLUMNARLEFT)
+ {
nYTCPos = cYOffset + this.getLabelDiffHeight(0);
nXDBPos = cXOffset + 3050;
nYDBPos = cYOffset;
}
- else{
+ else
+ {
nXDBPos = cXOffset;
nYTCPos = cYOffset;
}
}
-
- private void insertLabel(int i, int _iAlign){
- try {
- if (bControlsareCreated){
- LabelControlList[i].setPosition(new Point(nXTCPos, nYTCPos));
- if (icurArrangement != FormWizard.SOCOLUMNARLEFT){
- nTCWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].FieldTitle);
- LabelControlList[i].setSize(new Size(nTCWidth, nTCHeight));
+ private void insertLabel(int i, int _iAlign)
+ {
+ try
+ {
+ if (bControlsareCreated)
+ {
+ LabelControlList[i].setPosition(new Point(nXTCPos, nYTCPos));
+ if (icurArrangement != FormWizard.SOCOLUMNARLEFT)
+ {
+ nTCWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].getFieldTitle());
+ LabelControlList[i].setSize(new Size(nTCWidth, nTCHeight));
+ }
+ else
+ {
+ nTCWidth = LabelControlList[i].getSize().Width;
+ }
}
else
- nTCWidth = LabelControlList[i].getSize().Width;
- }
- else{
- Point aPoint = new Point(nXTCPos, nYTCPos);
- Size aSize = new Size(nTCWidth,nTCHeight);
- this.LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, FieldColumns[i].FieldName, aPoint, aSize);
- if (bIsVeryFirstRun){
- if (icurArrangement == FormWizard.SOCOLUMNARTOP)
- nYDBPos = nYTCPos + nTCHeight;
+ {
+ Point aPoint = new Point(nXTCPos, nYTCPos);
+ Size aSize = new Size(nTCWidth, nTCHeight);
+ this.LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, FieldColumns[i].m_sFieldName, aPoint, aSize);
+ if (bIsVeryFirstRun)
+ {
+ if (icurArrangement == FormWizard.SOCOLUMNARTOP)
+ {
+ nYDBPos = nYTCPos + nTCHeight;
+ }
+ }
+ nTCWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].getFieldTitle());
}
- nTCWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].FieldTitle);
- }
- curLabelControl = LabelControlList[i];
- if (icurArrangement == FormWizard.SOCOLUMNARLEFT){
- // Note This If Sequence must be called before retrieving the outer Points
- if (bIsFirstRun){
- nMaxTCWidth = nTCWidth;
- bIsFirstRun = false;
+ curLabelControl = LabelControlList[i];
+ if (icurArrangement == FormWizard.SOCOLUMNARLEFT)
+ {
+ // Note This If Sequence must be called before retrieving the outer Points
+ if (bIsFirstRun)
+ {
+ nMaxTCWidth = nTCWidth;
+ bIsFirstRun = false;
+ }
+ else if (nTCWidth > nMaxTCWidth)
+ {
+ nMaxTCWidth = nTCWidth;
+ }
}
- else if (nTCWidth > nMaxTCWidth){
- nMaxTCWidth = nTCWidth;
+ checkOuterPoints(nXTCPos, nTCWidth, nYTCPos, nTCHeight, false);
+ if ((icurArrangement == FormWizard.SOCOLUMNARTOP) || (icurArrangement == FormWizard.SOTOPJUSTIFIED))
+ {
+ nXDBPos = nXTCPos;
+ nYDBPos = nYTCPos + nTCHeight;
+ curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short) com.sun.star.awt.TextAlign.LEFT));
+ }
+ else
+ {
+ curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short) _iAlign));
+ }
+ if (!bControlsareCreated)
+ {
+ curLabelControl.setSize(new Size(nTCWidth, nTCHeight));
}
- }
- checkOuterPoints(nXTCPos, nTCWidth, nYTCPos, nTCHeight, false);
- if ((icurArrangement == FormWizard.SOCOLUMNARTOP) || (icurArrangement == FormWizard.SOTOPJUSTIFIED)){
- nXDBPos = nXTCPos;
- nYDBPos = nYTCPos + nTCHeight;
- curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short)com.sun.star.awt.TextAlign.LEFT));
- }
- else
- curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short)_iAlign));
- if (!bControlsareCreated)
- curLabelControl.setSize(new Size(nTCWidth,nTCHeight));
// if (CurHelpText != ""){
// oModel.HelpText = CurHelptext;
// }
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- private void insertDBControl(int i ){
- try {
- Point aPoint = new Point(nXDBPos, nYDBPos);
- if (bControlsareCreated)
- DBControlList[i].setPosition(aPoint);
- else{
- if (FieldColumns[i].FieldType == DataType.TIMESTAMP)
- DBControlList[i] = new TimeStampControl(new Resource(xMSF, "FormWizard", "dbw"), oFormHandler, xFormName, FieldColumns[i].FieldName, aPoint);
- else{
- DBControlList[i] = new DatabaseControl(oFormHandler, xFormName, FieldColumns[i].FieldName, FieldColumns[i].FieldType, aPoint);
- if (DBControlList[i].getControlType() == FormHandler.SOCHECKBOX)
- DBControlList[i].setPropertyValue("Label", "");
+ private void insertDBControl(int i)
+ {
+ try
+ {
+ Point aPoint = new Point(nXDBPos, nYDBPos);
+ if (bControlsareCreated)
+ {
+ DBControlList[i].setPosition(aPoint);
}
+ else
+ {
+ if (FieldColumns[i].FieldType == DataType.TIMESTAMP)
+ {
+ DBControlList[i] = new TimeStampControl(new Resource(xMSF, "FormWizard", "dbw"), oFormHandler, xFormName, FieldColumns[i].m_sFieldName, aPoint);
+ }
+ else
+ {
+ DBControlList[i] = new DatabaseControl(oFormHandler, xFormName, FieldColumns[i].m_sFieldName, FieldColumns[i].FieldType, aPoint);
+ if (DBControlList[i].getControlType() == FormHandler.SOCHECKBOX)
+ {
+ DBControlList[i].setPropertyValue("Label", "");
+ }
+ }
+ }
+ this.curDBControl = DBControlList[i];
+ nDBHeight = curDBControl.getDBHeight();
+ nDBWidth = curDBControl.getDBWidth();
+ if (FieldColumns[i].FieldType != DataType.TIMESTAMP)
+ {
+ curDBControl.setSize(new Size(nDBWidth, nDBHeight));
+ }
+ if (curDBControl.getControlType() == FormHandler.SOCHECKBOX)
+ {
+ nYDBPos = nYDBPos + /*(int)*/ ((oFormHandler.getDBRefHeight() - nDBHeight) / 2);
+ aPoint = new Point(nXDBPos, nYDBPos);
+ curDBControl.setPosition(aPoint);
+ }
+ checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
+ curDBControl.setPropertyValue("Border", NBorderType);
}
- this.curDBControl = DBControlList[i];
- nDBHeight = curDBControl.getDBHeight();
- nDBWidth = curDBControl.getDBWidth();
- if (FieldColumns[i].FieldType != DataType.TIMESTAMP)
- curDBControl.setSize(new Size(nDBWidth, nDBHeight));
- if (curDBControl.getControlType() == FormHandler.SOCHECKBOX){
- nYDBPos = nYDBPos +(int)((oFormHandler.getDBRefHeight() - nDBHeight)/2);
- aPoint = new Point(nXDBPos, nYDBPos);
- curDBControl.setPosition(aPoint);
- }
- checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
- curDBControl.setPropertyValue("Border", NBorderType);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- private int assignFieldLength(int _fieldlength){
+ private int assignFieldLength(int _fieldlength)
+ {
if (_fieldlength >= 65535)
- return -1;
+ {
+ return -1;
+ }
else
+ {
return _fieldlength;
+ }
}
-
-
- public int getFormHeight(){
+ public int getFormHeight()
+ {
return nMaxDBYPos - this.cYOffset;
}
-
- public int getEntryPointY(){
- if (this.icurArrangement == FormWizard.SOCOLUMNARTOP){
- Control curLabelControl = LabelControlList[0];
- return curLabelControl.getPosition().Y;
+ public int getEntryPointY()
+ {
+ if (this.icurArrangement == FormWizard.SOCOLUMNARTOP)
+ {
+ Control curLabelControl2 = LabelControlList[0];
+ return curLabelControl2.getPosition().Y;
}
- else{
- DatabaseControl curDBControl = DBControlList[0];
- return curDBControl.getPosition().Y;
+ else
+ {
+ DatabaseControl curDBControl2 = DBControlList[0];
+ return curDBControl2.getPosition().Y;
}
}
-
- public void setStartPoint(Point _aPoint){
+ public void setStartPoint(Point _aPoint)
+ {
this.cXOffset = _aPoint.X;
this.cYOffset = _aPoint.Y;
}
-
- public void adjustYPositions(int _diffY){
- for (int i = 0; i < DBControlList.length; i++){
+ public void adjustYPositions(int _diffY)
+ {
+ for (int i = 0; i < DBControlList.length; i++)
+ {
Point aPoint = DBControlList[i].getPosition();
DBControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY));
aPoint = this.LabelControlList[i].getPosition();
LabelControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY));
}
- nMaxDBYPos =- _diffY;
- cYOffset =- _diffY;
+ nMaxDBYPos = -_diffY;
+ cYOffset = -_diffY;
}
-
- public void setFormSize(Size _FormSize){
+ public void setFormSize(Size _FormSize)
+ {
nFormHeight = _FormSize.Height;
nFormWidth = _FormSize.Width;
}
diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java
index 7a24517bb70b..5e07324d3182 100644
--- a/wizards/com/sun/star/wizards/form/FormDocument.java
+++ b/wizards/com/sun/star/wizards/form/FormDocument.java
@@ -51,8 +51,9 @@ import com.sun.star.wizards.document.DatabaseControl;
import com.sun.star.wizards.document.FormHandler;
import com.sun.star.wizards.document.GridControl;
+public class FormDocument extends TextDocument
+{
-public class FormDocument extends TextDocument {
public FormHandler oFormHandler;
public ViewHandler oViewHandler;
public TextStyleHandler oTextStyleHandler;
@@ -80,91 +81,120 @@ public class FormDocument extends TextDocument {
final static String SOMAINFORM = "MainForm";
final static String SOSUBFORM = "SubForm";
- public FormDocument(XMultiServiceFactory xMSF, Resource oResource) {
- super(xMSF, new TextDocument.ModuleIdentifier( "com.sun.star.sdb.FormDesign" ), true);
- try {
- oFormHandler = new FormHandler(xMSF, xTextDocument);
- oFormHandler.setDrawObjectsCaptureMode(false);
- oTextStyleHandler = new TextStyleHandler(xMSFDoc, xTextDocument);
- oViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
- oMainFormDBMetaData = new CommandMetaData(xMSF);// , CharLocale);
- oSubFormDBMetaData = new CommandMetaData(xMSF);// , CharLocale);
- ViewHandler oViewHandler = new ViewHandler(xMSF, xTextDocument);
- TextStyleHandler oTextStyleSupplier = new TextStyleHandler(xMSFDoc, xTextDocument);
- Helper.setUnoPropertyValue(xTextDocument, "ApplyFormDesignMode", Boolean.FALSE);
- oViewHandler.setViewSetting("ShowTableBoundaries", Boolean.FALSE);
- oViewHandler.setViewSetting("ShowOnlineLayout", Boolean.TRUE);
- xPropPageStyle = oTextStyleSupplier.getStyleByName("PageStyles", "Standard");
- Size aSize = oTextStyleHandler.changePageAlignment(xPropPageStyle, true);
- nPageWidth = aSize.Width;
- nPageHeight = aSize.Height;
- sMsgEndAutopilot = oResource.getResText(UIConsts.RID_DB_COMMON + 33);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
- public void addUIFormController(UIControlArranger _curUIControlArranger){
+ public FormDocument(XMultiServiceFactory xMSF, Resource oResource)
+ {
+ super(xMSF, new TextDocument.ModuleIdentifier("com.sun.star.sdb.FormDesign"), true);
+ try
+ {
+ oFormHandler = new FormHandler(xMSF, xTextDocument);
+ oFormHandler.setDrawObjectsCaptureMode(false);
+ oTextStyleHandler = new TextStyleHandler(xMSFDoc, xTextDocument);
+ oViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
+ oMainFormDBMetaData = new CommandMetaData(xMSF);// , CharLocale);
+ oSubFormDBMetaData = new CommandMetaData(xMSF);// , CharLocale);
+ ViewHandler oViewHandler = new ViewHandler(xMSF, xTextDocument);
+ TextStyleHandler oTextStyleSupplier = new TextStyleHandler(xMSFDoc, xTextDocument);
+ Helper.setUnoPropertyValue(xTextDocument, "ApplyFormDesignMode", Boolean.FALSE);
+ oViewHandler.setViewSetting("ShowTableBoundaries", Boolean.FALSE);
+ oViewHandler.setViewSetting("ShowOnlineLayout", Boolean.TRUE);
+ xPropPageStyle = oTextStyleSupplier.getStyleByName("PageStyles", "Standard");
+ Size aSize = oTextStyleHandler.changePageAlignment(xPropPageStyle, true);
+ nPageWidth = aSize.Width;
+ nPageHeight = aSize.Height;
+ sMsgEndAutopilot = oResource.getResText(UIConsts.RID_DB_COMMON + 33);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void addUIFormController(UIControlArranger _curUIControlArranger)
+ {
this.curUIControlArranger = _curUIControlArranger;
}
- public void addStyleApplier(StyleApplier _curStyleApplier){
+ public void addStyleApplier(StyleApplier _curStyleApplier)
+ {
this.curStyleApplier = _curStyleApplier;
}
- private String getDataSourceName(){
+ private String getDataSourceName()
+ {
return this.oMainFormDBMetaData.DataSourceName;
}
- private void adjustPageStyle(){
- try {
- int nMargin;
- totfieldcount = getTotFieldCount();
- if (totfieldcount > 30)
- nMargin = 500;
- else if (totfieldcount > 20)
- nMargin = 750;
- else
- nMargin = 1000;
- xPropPageStyle.setPropertyValue("RightMargin", new Integer(nMargin));
- xPropPageStyle.setPropertyValue("LeftMargin", new Integer(nMargin));
- xPropPageStyle.setPropertyValue("TopMargin", new Integer(nMargin));
- xPropPageStyle.setPropertyValue("BottomMargin", new Integer(nMargin));
- aMainFormPoint = new Point(nMargin, nMargin);
- nFormWidth = (int) (0.8 * (double) nPageWidth) - 2 * nMargin;
- nFormHeight = (int) (0.65 * (double) nPageHeight) - 2 * nMargin;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- public void initialize(boolean _baddParentForm, boolean _bhasSubForm, boolean _bModifySubForm, Short _NBorderType){
+ private void adjustPageStyle()
+ {
+ try
+ {
+ int nMargin;
+ totfieldcount = getTotFieldCount();
+ if (totfieldcount > 30)
+ {
+ nMargin = 500;
+ }
+ else if (totfieldcount > 20)
+ {
+ nMargin = 750;
+ }
+ else
+ {
+ nMargin = 1000;
+ }
+ xPropPageStyle.setPropertyValue("RightMargin", new Integer(nMargin));
+ xPropPageStyle.setPropertyValue("LeftMargin", new Integer(nMargin));
+ xPropPageStyle.setPropertyValue("TopMargin", new Integer(nMargin));
+ xPropPageStyle.setPropertyValue("BottomMargin", new Integer(nMargin));
+ aMainFormPoint = new Point(nMargin, nMargin);
+ nFormWidth = (int) (0.8 * (double) nPageWidth) - 2 * nMargin;
+ nFormHeight = (int) (0.65 * (double) nPageHeight) - 2 * nMargin;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void initialize(boolean _baddParentForm, boolean _bhasSubForm, boolean _bModifySubForm, Short _NBorderType)
+ {
bhasSubForm = _bhasSubForm;
adjustPageStyle();
- if (_baddParentForm ){
+ if (_baddParentForm)
+ {
if (oControlForms.size() == 0)
+ {
oControlForms.addElement(new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.SOGRID)));
- else{
+ }
+ else
+ {
oFormHandler.removeControlsofForm(SOMAINFORM);
((ControlForm) oControlForms.get(0)).oFormController = null;
}
- ((ControlForm) oControlForms.get(0)).initialize(curUIControlArranger.getSelectedArrangement(0), _NBorderType );
+ ((ControlForm) oControlForms.get(0)).initialize(curUIControlArranger.getSelectedArrangement(0), _NBorderType);
}
- if(_bhasSubForm){
- if (oControlForms.size() == 1){
+ if (_bhasSubForm)
+ {
+ if (oControlForms.size() == 1)
+ {
adjustMainFormSize(_NBorderType);
oControlForms.addElement(new ControlForm(this, SOSUBFORM, getSubFormPoint(), getSubFormSize()));
((ControlForm) oControlForms.get(1)).initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType);
}
- else if (_bModifySubForm){
- if (oControlForms.size() > 1){
+ else if (_bModifySubForm)
+ {
+ if (oControlForms.size() > 1)
+ {
oFormHandler.removeControlsofForm(SOSUBFORM);
((ControlForm) oControlForms.get(1)).oFormController = null;
((ControlForm) oControlForms.get(1)).initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType);
}
}
}
- else{
- if (oFormHandler.hasFormByName(SOSUBFORM)){
+ else
+ {
+ if (oFormHandler.hasFormByName(SOSUBFORM))
+ {
oFormHandler.removeFormByName(SOSUBFORM);
oControlForms.remove(1);
adjustMainFormSize(_NBorderType);
@@ -172,22 +202,26 @@ public class FormDocument extends TextDocument {
}
}
-
- private int getTotFieldCount(){
+ private int getTotFieldCount()
+ {
nMainFormFieldCount = oMainFormDBMetaData.getFieldNames().length;
totfieldcount = nMainFormFieldCount + oSubFormDBMetaData.getFieldNames().length;
return totfieldcount;
}
-
- private Size getMainFormSize(int _curArrangement){
+ private Size getMainFormSize(int _curArrangement)
+ {
int nMainFormHeight = nFormHeight;
- if (bhasSubForm){
+ if (bhasSubForm)
+ {
if (_curArrangement == FormWizard.SOGRID)
- nMainFormHeight = (int) ((double)(nFormHeight-SOFORMGAP)/2);
- else{
+ {
+ nMainFormHeight = (int) ((double) (nFormHeight - SOFORMGAP) / 2);
+ }
+ else
+ {
totfieldcount = getTotFieldCount();
- nMainFormHeight = (int) (((double) nMainFormFieldCount/(double) totfieldcount) * ((double)(nFormHeight-SOFORMGAP)/2));
+ nMainFormHeight = (int) (((double) nMainFormFieldCount / (double) totfieldcount) * ((double) (nFormHeight - SOFORMGAP) / 2));
}
}
Size aMainFormSize = new Size(nFormWidth, nMainFormHeight);
@@ -195,8 +229,8 @@ public class FormDocument extends TextDocument {
return aMainFormSize;
}
-
- private Size getSubFormSize(){
+ private Size getSubFormSize()
+ {
// int nSubFormHeight = (int) ((double)nFormHeight/2) - SOFORMGAP;
// int nSubFormFieldCount = this.oSubFormDBMetaData.FieldNames.length;
// int totfieldcount = oMainFormDBMetaData.FieldNames.length + nSubFormFieldCount;
@@ -205,77 +239,95 @@ public class FormDocument extends TextDocument {
return aSubFormSize;
}
- private Point getSubFormPoint(){
+ private Point getSubFormPoint()
+ {
ControlForm curMainControlForm = ((ControlForm) oControlForms.get(0));
return new Point(curMainControlForm.aStartPoint.X,
- (curMainControlForm.aStartPoint.Y + curMainControlForm.getFormSize().Height + SOFORMGAP));
+ (curMainControlForm.aStartPoint.Y + curMainControlForm.getFormSize().Height + SOFORMGAP));
}
-
- private void adjustMainFormSize(Short _NBorderType){
+ private void adjustMainFormSize(Short _NBorderType)
+ {
ControlForm oMainControlForm = (ControlForm) oControlForms.get(0);
oMainControlForm.setFormSize(getMainFormSize(oMainControlForm.curArrangement));
if (oMainControlForm.curArrangement == FormWizard.SOGRID)
+ {
oMainControlForm.oGridControl.setSize(oMainControlForm.getFormSize());
+ }
else
+ {
oMainControlForm.oFormController.positionControls(oMainControlForm.curArrangement,
- oMainControlForm.aStartPoint,
- oMainControlForm.getFormSize(),
- curUIControlArranger.getAlignValue(), _NBorderType);
+ oMainControlForm.aStartPoint,
+ oMainControlForm.getFormSize(),
+ curUIControlArranger.getAlignValue(), _NBorderType);
+ }
}
-
- private void adjustSubFormPosSize(Short _NBorderType){
+ private void adjustSubFormPosSize(Short _NBorderType)
+ {
ControlForm oMainControlForm = (ControlForm) oControlForms.get(0);
ControlForm oSubControlForm = (ControlForm) oControlForms.get(1);
- oSubControlForm.setFormSize(new Size(nFormWidth, (int)nFormHeight - oMainControlForm.getFormSize().Height));
- if (oSubControlForm.curArrangement == FormWizard.SOGRID){
+ oSubControlForm.setFormSize(new Size(nFormWidth, (int) nFormHeight - oMainControlForm.getFormSize().Height));
+ if (oSubControlForm.curArrangement == FormWizard.SOGRID)
+ {
Point aPoint = oSubControlForm.oGridControl.getPosition();
- int idiffheight = oSubControlForm.getEntryPointY() - oMainControlForm.getActualFormHeight()- oMainControlForm.aStartPoint.Y - SOFORMGAP;
+ int idiffheight = oSubControlForm.getEntryPointY() - oMainControlForm.getActualFormHeight() - oMainControlForm.aStartPoint.Y - SOFORMGAP;
oSubControlForm.setStartPoint(new Point(aPoint.X, (aPoint.Y - idiffheight)));
oSubControlForm.oGridControl.setPosition(oSubControlForm.aStartPoint);
oSubControlForm.oGridControl.setSize(getSubFormSize());
}
- else{
+ else
+ {
// oSubControlForm.oFormController.adjustYPositions(_idiffheight);
- oSubControlForm.setStartPoint( new Point(oSubControlForm.aStartPoint.X, oMainControlForm.getActualFormHeight() + oMainControlForm.aStartPoint.Y + SOFORMGAP));
+ oSubControlForm.setStartPoint(new Point(oSubControlForm.aStartPoint.X, oMainControlForm.getActualFormHeight() + oMainControlForm.aStartPoint.Y + SOFORMGAP));
oSubControlForm.oFormController.positionControls(oSubControlForm.curArrangement, oSubControlForm.aStartPoint, oSubControlForm.getAvailableFormSize(), curUIControlArranger.getAlignValue(), _NBorderType);
}
}
-
- public ControlForm getControlFormByName(String _sname){
- for (int i = 0; i < oControlForms.size(); i++){
+ public ControlForm getControlFormByName(String _sname)
+ {
+ for (int i = 0; i < oControlForms.size(); i++)
+ {
ControlForm curControlForm = ((ControlForm) oControlForms.get(i));
if (curControlForm.Name.equals(_sname))
+ {
return curControlForm;
+ }
}
return null;
}
-
- public ControlForm[] getControlForms(){
+ public ControlForm[] getControlForms()
+ {
return (ControlForm[]) oControlForms.toArray();
}
-
- public boolean finalizeForms(DataEntrySetter _curDataEntrySetter, FieldLinker _curFieldLinker, FormConfiguration _curFormConfiguration){
- try {
+ public boolean finalizeForms(DataEntrySetter _curDataEntrySetter, FieldLinker _curFieldLinker, FormConfiguration _curFormConfiguration)
+ {
+ try
+ {
this.xTextDocument.lockControllers();
PropertyValue[] aFormProperties = _curDataEntrySetter.getFormProperties();
ControlForm oMasterControlForm = getControlFormByName(SOMAINFORM);
oMasterControlForm.setFormProperties(aFormProperties, oMainFormDBMetaData);
oMasterControlForm.finalizeControls();
- if (oMasterControlForm.xFormContainer.hasByName(SOSUBFORM)){
+ if (oMasterControlForm.xFormContainer.hasByName(SOSUBFORM))
+ {
ControlForm oSubControlForm = getControlFormByName(SOSUBFORM);
oSubControlForm.setFormProperties(aFormProperties, oSubFormDBMetaData);
String sRefTableName = _curFormConfiguration.getreferencedTableName();
if (sRefTableName.equals(""))
+ {
LinkFieldNames = _curFieldLinker.getLinkFieldNames();
+ }
else
+ {
LinkFieldNames = _curFieldLinker.getLinkFieldNames(_curFormConfiguration.getRelationController(), sRefTableName);
- if (LinkFieldNames != null){
- if (LinkFieldNames.length > 0){
+ }
+ if (LinkFieldNames != null)
+ {
+ if (LinkFieldNames.length > 0)
+ {
oSubControlForm.xPropertySet.setPropertyValue("DetailFields", LinkFieldNames[0]);
oSubControlForm.xPropertySet.setPropertyValue("MasterFields", LinkFieldNames[1]);
oSubControlForm.finalizeControls();
@@ -285,17 +337,21 @@ public class FormDocument extends TextDocument {
return false;
}
return true;
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
return false;
}
- finally{
+ finally
+ {
unlockallControllers();
}
}
+ public class ControlForm
+ {
- public class ControlForm{
XNameContainer xFormContainer;
GridControl oGridControl;
FormControlArranger oFormController;
@@ -307,55 +363,74 @@ public class FormDocument extends TextDocument {
CommandMetaData oDBMetaData;
XPropertySet xPropertySet;
- public ControlForm(FormDocument _oFormDocument, String _sname, Point _astartPoint, Size _aFormSize){
+ public ControlForm(FormDocument _oFormDocument, String _sname, Point _astartPoint, Size _aFormSize)
+ {
aStartPoint = _astartPoint;
aFormSize = _aFormSize;
oFormDocument = _oFormDocument;
Name = _sname;
- if (_sname.equals(SOSUBFORM)){
+ if (_sname.equals(SOSUBFORM))
+ {
ControlForm oMainControlForm = ((ControlForm) oControlForms.get(0));
xFormContainer = oFormHandler.insertFormbyName(_sname, oMainControlForm.xFormContainer);
}
else
+ {
xFormContainer = oFormHandler.insertFormbyName(_sname);
+ }
xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFormContainer);
if (_sname.equals(SOMAINFORM))
+ {
oDBMetaData = oFormDocument.oMainFormDBMetaData;
+ }
else
+ {
oDBMetaData = oFormDocument.oSubFormDBMetaData;
+ }
}
-
- public void initialize(int _curArrangement, Short _NBorderType){
+ public void initialize(int _curArrangement, Short _NBorderType)
+ {
boolean badaptControlStyles = false;
xTextDocument.lockControllers();
curArrangement = _curArrangement;
- if (oGridControl != null){
+ if (oGridControl != null)
+ {
oFormHandler.xDrawPage.remove(oGridControl.xShape);
oGridControl.xComponent.dispose();
oGridControl = null;
}
if (oFormController == null)
+ {
oFormController = new FormControlArranger(oFormHandler, xFormContainer, oDBMetaData, xProgressBar, aStartPoint, aFormSize);
- else{
- if (curArrangement == FormWizard.SOGRID){
+ }
+ else
+ {
+ if (curArrangement == FormWizard.SOGRID)
+ {
oFormHandler.moveShapesToNirwana(getLabelControls());
oFormHandler.moveShapesToNirwana(getDatabaseControls());
}
}
- if (curArrangement == FormWizard.SOGRID){
+ if (curArrangement == FormWizard.SOGRID)
+ {
insertGridControl(_NBorderType);
badaptControlStyles = true;
}
- else{
+ else
+ {
badaptControlStyles = !oFormController.areControlsexisting();
oFormController.positionControls(_curArrangement, aStartPoint, getAvailableFormSize(), curUIControlArranger.getAlignValue(), _NBorderType);
}
if (badaptControlStyles)
+ {
curStyleApplier.applyStyle(false, true);
- if ((Name.equals(SOMAINFORM)) && (oControlForms.size() > 1)){
+ }
+ if ((Name.equals(SOMAINFORM)) && (oControlForms.size() > 1))
+ {
ControlForm curSubControlForm = ((ControlForm) oControlForms.get(1));
- if (curSubControlForm != null){
+ if (curSubControlForm != null)
+ {
adjustSubFormPosSize(_NBorderType);
}
}
@@ -363,107 +438,155 @@ public class FormDocument extends TextDocument {
unlockallControllers();
}
-
- public Control[] getLabelControls(){
+ public Control[] getLabelControls()
+ {
if (oFormController != null)
+ {
return oFormController.LabelControlList;
- else return null;
+ }
+ else
+ {
+ return null;
+ }
}
-
- public Size getFormSize(){
+ public Size getFormSize()
+ {
return aFormSize;
}
- private Size getAvailableFormSize(){
+ private Size getAvailableFormSize()
+ {
if (this.Name.equals(SOMAINFORM))
+ {
setFormSize(getMainFormSize(curArrangement));
+ }
else
+ {
setFormSize(getSubFormSize());
+ }
return aFormSize;
}
- public void setFormSize(Size _aSize){
+ public void setFormSize(Size _aSize)
+ {
aFormSize = _aSize;
oFormController.setFormSize(aFormSize);
}
-
- private void setStartPoint(Point _aPoint){
+ private void setStartPoint(Point _aPoint)
+ {
aStartPoint = _aPoint;
if (oFormController != null)
+ {
oFormController.setStartPoint(_aPoint);
+ }
}
- private int getActualFormHeight(){
+ private int getActualFormHeight()
+ {
if (curArrangement == FormWizard.SOGRID)
+ {
return oGridControl.xShape.getSize().Height;
+ }
else
+ {
return oFormController.getFormHeight();
+ }
}
-
- private int getEntryPointY(){
+ private int getEntryPointY()
+ {
if (curArrangement == FormWizard.SOGRID)
+ {
return oGridControl.xShape.getPosition().Y;
+ }
else
+ {
return oFormController.getEntryPointY();
+ }
}
-
- private void setFormProperties(PropertyValue[] _aPropertySetList, CommandMetaData _oDBMetaData){
- try {
- xPropertySet.setPropertyValue("DataSourceName", getDataSourceName());
- xPropertySet.setPropertyValue("Command", _oDBMetaData.getCommandName());
- xPropertySet.setPropertyValue("CommandType", new Integer(_oDBMetaData.getCommandType()));
- for (int i = 0; i < _aPropertySetList.length; i++){
- xPropertySet.setPropertyValue(_aPropertySetList[i].Name, _aPropertySetList[i].Value);
+ private void setFormProperties(PropertyValue[] _aPropertySetList, CommandMetaData _oDBMetaData)
+ {
+ try
+ {
+ xPropertySet.setPropertyValue("DataSourceName", getDataSourceName());
+ xPropertySet.setPropertyValue("Command", _oDBMetaData.getCommandName());
+ xPropertySet.setPropertyValue("CommandType", new Integer(_oDBMetaData.getCommandType()));
+ for (int i = 0; i < _aPropertySetList.length; i++)
+ {
+ xPropertySet.setPropertyValue(_aPropertySetList[i].Name, _aPropertySetList[i].Value);
+ }
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public DatabaseControl[] getDatabaseControls(){
+ public DatabaseControl[] getDatabaseControls()
+ {
if (oFormController != null)
+ {
return oFormController.DBControlList;
- else return null;
+ }
+ else
+ {
+ return null;
+ }
}
- public GridControl getGridControl(){
+ public GridControl getGridControl()
+ {
return oGridControl;
}
- public int getArrangemode(){
+ public int getArrangemode()
+ {
return curArrangement;
}
- private void insertGridControl(Short _NBorderType){
- try {
- curArrangement = FormWizard.SOGRID;
- if (Name.equals(SOMAINFORM))
- oGridControl = new GridControl(xMSF,Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getMainFormSize(FormWizard.SOGRID));
- else
- oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getSubFormSize());
- oGridControl.xPropertySet.setPropertyValue("Border", _NBorderType);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ private void insertGridControl(Short _NBorderType)
+ {
+ try
+ {
+ curArrangement = FormWizard.SOGRID;
+ if (Name.equals(SOMAINFORM))
+ {
+ oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getMainFormSize(FormWizard.SOGRID));
+ }
+ else
+ {
+ oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getSubFormSize());
+ }
+ oGridControl.xPropertySet.setPropertyValue("Border", _NBorderType);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public void finalizeControls(){
+ public void finalizeControls()
+ {
Control[] oLabelControls = getLabelControls();
Control[] oDBControls = getDatabaseControls();
- if (oLabelControls != null){
- for (int i = 0; i < getLabelControls().length; i++){
- if (curArrangement == FormWizard.SOGRID){
- if ((oLabelControls[i] != null) && (oDBControls[i] != null)){
+ if (oLabelControls != null)
+ {
+ for (int i = 0; i < getLabelControls().length; i++)
+ {
+ if (curArrangement == FormWizard.SOGRID)
+ {
+ if ((oLabelControls[i] != null) && (oDBControls[i] != null))
+ {
oFormHandler.removeShape(oLabelControls[i].xShape);
oFormHandler.removeShape(oDBControls[i].xShape);
}
}
- else{
- oFormHandler.groupShapesTogether(xMSF,oLabelControls[i].xShape, oDBControls[i].xShape);
+ else
+ {
+ oFormHandler.groupShapesTogether(xMSF, oLabelControls[i].xShape, oDBControls[i].xShape);
}
}
diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java
index 2ed1fcb498a3..2330832a45a3 100644
--- a/wizards/com/sun/star/wizards/form/FormWizard.java
+++ b/wizards/com/sun/star/wizards/form/FormWizard.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.form;
import com.sun.star.beans.PropertyValue;
@@ -41,8 +40,8 @@ import com.sun.star.wizards.db.RelationController;
import com.sun.star.wizards.document.OfficeDocument;
import com.sun.star.wizards.ui.*;
-
-public class FormWizard extends WizardDialog{
+public class FormWizard extends WizardDialog
+{
CommandFieldSelection curDBCommandFieldSelection;
FormConfiguration curFormConfiguration;
@@ -55,11 +54,9 @@ public class FormWizard extends WizardDialog{
Finalizer curFinalizer;
static String slblFields;
static String slblSelFields;
-
String sShowBinaryFields = "";
String sMsgWizardName = "";
String serrFormNameexists = "";
-
public static final int SONULLPAGE = 0;
public static final int SOMAINPAGE = 1;
public static final int SOSUBFORMPAGE = 2;
@@ -69,76 +66,92 @@ public class FormWizard extends WizardDialog{
public static final int SODATAPAGE = 6;
public static final int SOSTYLEPAGE = 7;
public static final int SOSTOREPAGE = 8;
-
public static final int SOCOLUMNARLEFT = 1;
public static final int SOCOLUMNARTOP = 2;
public static final int SOGRID = 3;
public static final int SOTOPJUSTIFIED = 4;
-
String WizardHeaderText[] = new String[8];
String slblTables;
boolean bFormOpenMode;
boolean bcreateForm = false;
- String FormName;
+ String FormName;
Short NBorderValue = null;
- public FormWizard(XMultiServiceFactory xMSF) {
+ public FormWizard(XMultiServiceFactory xMSF)
+ {
super(xMSF, 34400);
super.addResourceHandler("FormWizard", "dbw");
Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Height","Moveable","Name","PositionX","PositionY","Step","TabIndex","Title","Width"},
- new Object[] { new Integer(210),Boolean.TRUE, "DialogForm", new Integer(102),new Integer(41),new Integer(1), new Short((short)0), m_oResource.getResText(UIConsts.RID_FORM), new Integer(310)} );
+ new String[]
+ {
+ "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width"
+ },
+ new Object[]
+ {
+ new Integer(210), Boolean.TRUE, "DialogForm", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), m_oResource.getResText(UIConsts.RID_FORM), new Integer(310)
+ });
drawNaviBar();
if (getFormResources() == true)
+ {
setRightPaneHeaders(m_oResource, UIConsts.RID_FORM + 90, 8);
+ }
}
-
- protected void enterStep(int nOldStep, int nNewStep) {
- try {
- if ((nOldStep < SOCONTROLPAGE) && (nNewStep >= SOCONTROLPAGE)){
- curFormDocument.initialize(curDBCommandFieldSelection.isModified(), curFormConfiguration.hasSubForm(), curSubFormFieldSelection.isModified(), getBorderType());
- curDBCommandFieldSelection.setModified(false);
- curSubFormFieldSelection.setModified(false);
- }
- switch (nNewStep){
- case SOMAINPAGE:
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ try
+ {
+ if ((nOldStep < SOCONTROLPAGE) && (nNewStep >= SOCONTROLPAGE))
+ {
+ curFormDocument.initialize(curDBCommandFieldSelection.isModified(), curFormConfiguration.hasSubForm(), curSubFormFieldSelection.isModified(), getBorderType());
curDBCommandFieldSelection.setModified(false);
- break;
- case SOSUBFORMPAGE:
- RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData,curDBCommandFieldSelection.getSelectedCommandName());
- curFormConfiguration.initialize(curSubFormFieldSelection, oRelationController);
- break;
- case SOSUBFORMFIELDSPAGE:
- String spreselectedTableName = curFormConfiguration.getreferencedTableName();
- curSubFormFieldSelection.preselectCommand(spreselectedTableName, (spreselectedTableName.length() > 0));
- break;
- case SOFIELDLINKERPAGE:
- curFieldLinker.initialize(curFormDocument.oMainFormDBMetaData.getFieldNames(), curFormDocument.oSubFormDBMetaData.getFieldNames(), curFormDocument.LinkFieldNames);
- break;
- case SOCONTROLPAGE:
- curControlArranger.enableSubFormImageList(curFormConfiguration.hasSubForm());
- break;
- case SODATAPAGE:
- break;
- case SOSTYLEPAGE:
- break;
- case SOSTOREPAGE:
- this.curFinalizer.initialize(this.curDBCommandFieldSelection.getSelectedCommandName(), curFormDocument);
- break;
- default:
- break;
+ curSubFormFieldSelection.setModified(false);
+ }
+ switch (nNewStep)
+ {
+ case SOMAINPAGE:
+ curDBCommandFieldSelection.setModified(false);
+ break;
+ case SOSUBFORMPAGE:
+ RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData, curDBCommandFieldSelection.getSelectedCommandName());
+ curFormConfiguration.initialize(curSubFormFieldSelection, oRelationController);
+ break;
+ case SOSUBFORMFIELDSPAGE:
+ String spreselectedTableName = curFormConfiguration.getreferencedTableName();
+ curSubFormFieldSelection.preselectCommand(spreselectedTableName, (spreselectedTableName.length() > 0));
+ break;
+ case SOFIELDLINKERPAGE:
+ curFieldLinker.initialize(curFormDocument.oMainFormDBMetaData.getFieldNames(), curFormDocument.oSubFormDBMetaData.getFieldNames(), curFormDocument.LinkFieldNames);
+ break;
+ case SOCONTROLPAGE:
+ curControlArranger.enableSubFormImageList(curFormConfiguration.hasSubForm());
+ break;
+ case SODATAPAGE:
+ break;
+ case SOSTYLEPAGE:
+ break;
+ case SOSTOREPAGE:
+ this.curFinalizer.initialize(this.curDBCommandFieldSelection.getSelectedCommandName(), curFormDocument);
+ break;
+ default:
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
+ }
- protected Short getBorderType(){
+ protected Short getBorderType()
+ {
return curStyleApplier.getBorderType();
}
- protected void leaveStep(int nOldStep, int nNewStep){
- switch (nOldStep){
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+ switch (nOldStep)
+ {
case SOMAINPAGE:
// curFormDocument.oMainFormDBMetaData.setFieldNames(curDBCommandFieldSelection.getSelectedFieldNames());
curFormDocument.oMainFormDBMetaData.initializeFieldColumns(true, curDBCommandFieldSelection.getSelectedCommandName(), curDBCommandFieldSelection.getSelectedFieldNames());
@@ -160,54 +173,70 @@ public class FormWizard extends WizardDialog{
break;
case SOSTOREPAGE:
break;
- default:
- break;
- }
+ default:
+ break;
+ }
}
-
- public static void main(String args[]) {
-
- String ConnectStr = "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- PropertyValue[] curproperties = null;
- try {
- XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
- FormWizard CurFormWizard = new FormWizard(xLocMSF);
- if(xLocMSF != null){
- System.out.println("Connected to "+ ConnectStr);
- curproperties = new PropertyValue[1];
+ public static void main(String args[])
+ {
+
+ String ConnectStr = "uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
+ PropertyValue[] curproperties = null;
+ try
+ {
+ XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
+ FormWizard CurFormWizard = new FormWizard(xLocMSF);
+ if (xLocMSF != null)
+ {
+ System.out.println("Connected to " + ConnectStr);
+ curproperties = new PropertyValue[1];
// curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb");
- curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb");
- curproperties[0] = Properties.createProperty("DataSourceName", "MyHSQLDatabase"); //file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/myjapanesehsqldatasourceMyDocAssign.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1");*// /--/curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/MyHSQL Database.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, baseLocation ); "DataSourceName", "db1");*// curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");* // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); //Bibliography* CurTableWizard.startTableWizard(xLocMSF, curproperties);
- CurFormWizard.startFormWizard(xLocMSF, curproperties);
+ curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb");
+ curproperties[0] = Properties.createProperty("DataSourceName", "MyHSQLDatabase"); //file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/myjapanesehsqldatasourceMyDocAssign.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1");*// /--/curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/MyHSQL Database.odb"); //MyDBase; Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb ; Mydbwizard2DocAssign.odb; NewAccessDatabase, baseLocation ); "DataSourceName", "db1");*// curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");* // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography"); //Bibliography* CurTableWizard.startTableWizard(xLocMSF, curproperties);
+ CurFormWizard.startFormWizard(xLocMSF, curproperties);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
}
}
- catch(Exception exception){
- exception.printStackTrace(System.out);
- }}
-
- public void buildSteps() throws NoValidPathException{
- curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411);
+ public void buildSteps() throws NoValidPathException
+ {
+ curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411);
curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
curFormDocument.xProgressBar.setValue(20);
insertLabel("lblBinaryHelpText",
- new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"},
- new Object[] { new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOMAINPAGE),new Integer(210)});
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOMAINPAGE), new Integer(210)
+ });
curFormConfiguration = new FormConfiguration(this);
curFormDocument.xProgressBar.setValue(30);
- curSubFormFieldSelection = new CommandFieldSelection(this, curFormDocument.oSubFormDBMetaData, SOSUBFORMFIELDSPAGE, 92, slblFields, slblSelFields, slblTables, true, 34431);
+ curSubFormFieldSelection = new CommandFieldSelection(this, curFormDocument.oSubFormDBMetaData, SOSUBFORMFIELDSPAGE, 92, slblFields, slblSelFields, slblTables, true, 34431);
curSubFormFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
insertLabel("lblSubFormBinaryHelpText",
- new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"},
- new Object[] { new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOSUBFORMFIELDSPAGE), new Integer(210)});
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOSUBFORMFIELDSPAGE), new Integer(210)
+ });
curFormDocument.xProgressBar.setValue(40);
- curFieldLinker = new FieldLinker(this, SOFIELDLINKERPAGE, 95, 30, 210, 34441);
+ curFieldLinker = new FieldLinker(this, SOFIELDLINKERPAGE, 95, 30, 210, 34441);
curFormDocument.xProgressBar.setValue(50);
curControlArranger = new UIControlArranger(this, curFormDocument);
@@ -228,44 +257,49 @@ public class FormWizard extends WizardDialog{
curFormDocument.xProgressBar.end();
}
-
-
- public void finishWizard(){
+ public void finishWizard()
+ {
int ncurStep = getCurrentStep();
- if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE)){
+ if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE))
+ {
this.curFinalizer.initialize(curDBCommandFieldSelection.getSelectedCommandName(), this.curFormDocument);
String sNewFormName = curFinalizer.getName();
- if (!curFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sNewFormName)){
+ if (!curFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sNewFormName))
+ {
bFormOpenMode = curFinalizer.getOpenMode();
FormName = curFinalizer.getName();
- if (curFormDocument.finalizeForms(CurDataEntrySetter, curFieldLinker, curFormConfiguration)){;
- if (curFinalizer.finish()){
+ if (curFormDocument.finalizeForms(CurDataEntrySetter, curFieldLinker, curFormConfiguration))
+ {
+ ;
+ if (curFinalizer.finish())
+ {
bcreateForm = true;
xDialog.endExecute();
}
}
}
- else{
+ else
+ {
String smessage = JavaTools.replaceSubString(serrFormNameexists, sNewFormName, "%FORMNAME");
- showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage );
+ showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage);
}
}
}
-
- public void cancelWizard() {
+ public void cancelWizard()
+ {
bcreateForm = false;
xDialog.endExecute();
}
-
- public void insertFormRelatedSteps(){
+ public void insertFormRelatedSteps()
+ {
addRoadmap();
int i = 0;
i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_FORM + 80), SOMAINPAGE);
i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 81), SOSUBFORMPAGE);
i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 82), SOSUBFORMFIELDSPAGE);
- i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 83), SOFIELDLINKERPAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 83), SOFIELDLINKERPAGE);
i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 84), SOCONTROLPAGE);
i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 85), SODATAPAGE);
i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 86), SOSTYLEPAGE);
@@ -275,39 +309,47 @@ public class FormWizard extends WizardDialog{
setCurrentRoadmapItemID((short) 1);
}
-
- public XComponent[] startFormWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue){
+ public XComponent[] startFormWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue)
+ {
XComponent[] ret = null;
- try{
- curFormDocument = new FormDocument(xMSF, m_oResource);
- if (curFormDocument.oMainFormDBMetaData.getConnection(CurPropertyValue)){
- curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[]{Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection)});
+ try
+ {
+ curFormDocument = new FormDocument(xMSF, m_oResource);
+ if (curFormDocument.oMainFormDBMetaData.getConnection(CurPropertyValue))
+ {
+ curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[]
+ {
+ Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection)
+ });
curFormDocument.xProgressBar.setValue(20);
buildSteps();
this.curDBCommandFieldSelection.preselectCommand(CurPropertyValue, false);
createWindowPeer(curFormDocument.xWindowPeer);
curFormDocument.oMainFormDBMetaData.setWindowPeer(xControl.getPeer());
- // setAutoMnemonic("lblDialogHeader", false);
+ // setAutoMnemonic("lblDialogHeader", false);
insertFormRelatedSteps();
short RetValue = executeDialog(curFormDocument.xFrame);
xComponent.dispose();
- if (bcreateForm){
+ if (bcreateForm)
+ {
curFormDocument.oMainFormDBMetaData.addFormDocument(curFormDocument.xComponent);
- ret = curFormDocument.oMainFormDBMetaData.openFormDocument( FormName, bFormOpenMode);
+ ret = curFormDocument.oMainFormDBMetaData.openFormDocument(FormName, bFormOpenMode);
}
}
}
- catch(java.lang.Exception jexception ){
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
}
if ((!bcreateForm) && (curFormDocument != null))
+ {
OfficeDocument.close(curFormDocument.xComponent);
+ }
return ret;
}
-
-
- public boolean getFormResources(){
+ public boolean getFormResources()
+ {
sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_FORM);
sShowBinaryFields = m_oResource.getResText(UIConsts.RID_FORM + 2);
slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6);
@@ -318,76 +360,96 @@ public class FormWizard extends WizardDialog{
return true;
}
+ public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ {
- public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener{
- protected int ID;
+ protected int ID;
- public int getID(){
- return ID;
- }
+ public int getID()
+ {
+ return ID;
+ }
- public void setID(String sIncSuffix){
- ID = 1;
- if (sIncSuffix != null){
- if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_"))) {
- String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
- ID = Integer.parseInt(sID);
- int a = 0;
- }
- }
- }
+ public void setID(String sIncSuffix)
+ {
+ ID = 1;
+ if (sIncSuffix != null)
+ {
+ if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
+ {
+ String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
+ ID = Integer.parseInt(sID);
+ int a = 0;
+ }
+ }
+ }
- public void shiftFromLeftToRight(String[] SelItems, String[] NewItems) {
- if (ID == 1){
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (ID == 1)
+ {
toggleMainFormSteps();
- }
- else{
+ }
+ else
+ {
toggleSubFormSteps();
- }
- }
-
+ }
+ }
- public void shiftFromRightToLeft(String[] SelItems, String[] NewItems ) {
- // TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox
- if (ID == 1){
+ public void shiftFromRightToLeft(String[] SelItems, String[] NewItems)
+ {
+ // TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox
+ if (ID == 1)
+ {
toggleMainFormSteps();
- }
- else{
+ }
+ else
+ {
toggleSubFormSteps();
- }
- }
+ }
+ }
- public void moveItemDown(String item){
- }
+ public void moveItemDown(String item)
+ {
+ }
- public void moveItemUp(String item){
- }
+ public void moveItemUp(String item)
+ {
+ }
- private boolean toggleSubFormSteps(){
+ private boolean toggleSubFormSteps()
+ {
curSubFormFieldSelection.setModified(true);
boolean benable = curSubFormFieldSelection.getSelectedFieldNames().length > 0;
enablefromStep(SOFIELDLINKERPAGE, benable);
if (benable)
+ {
curFieldLinker.enable(!curFormConfiguration.areexistingRelationsdefined());
+ }
return benable;
- }
+ }
- private void toggleMainFormSteps(){
+ private void toggleMainFormSteps()
+ {
curDBCommandFieldSelection.setModified(true);
boolean benable = curDBCommandFieldSelection.getSelectedFieldNames().length > 0;
enablefromStep(SOSUBFORMPAGE, benable);
setControlProperty("btnWizardNext", "Enabled", new Boolean(benable));
- if (benable){
+ if (benable)
+ {
if (curFormConfiguration.hasSubForm())
+ {
benable = toggleSubFormSteps();
- else{
+ }
+ else
+ {
setStepEnabled(SOSUBFORMFIELDSPAGE, false);
setStepEnabled(SOFIELDLINKERPAGE, false);
}
}
setControlProperty("btnWizardFinish", "Enabled", new Boolean(benable));
}
- }
+ }
}
diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java
index c0b55d9363ec..93903ef4930c 100644
--- a/wizards/com/sun/star/wizards/form/StyleApplier.java
+++ b/wizards/com/sun/star/wizards/form/StyleApplier.java
@@ -26,7 +26,9 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.form;
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.XListBox;
import com.sun.star.awt.XRadioButton;
@@ -61,7 +63,8 @@ import com.sun.star.wizards.text.TextStyleHandler;
import com.sun.star.wizards.ui.*;
import com.sun.star.wizards.ui.UIConsts;
-public class StyleApplier{
+public class StyleApplier
+{
WizardDialog CurUnoDialog;
XPropertySet xPageStylePropertySet;
@@ -71,8 +74,7 @@ public class StyleApplier{
XRadioButton opt3DLook;
XRadioButton optFlat;
XListBox lstStyles;
- Desktop.OfficePathRetriever curofficepath;
-// String[][] sLayoutFiles;
+ Desktop.OfficePathRetriever curofficepath;// String[][] sLayoutFiles;
FormDocument curFormDocument;
short iOldLayoutPos;
int SOLAYOUTLST = 0;
@@ -82,7 +84,6 @@ public class StyleApplier{
String[] StyleNodeNames;
String[] FileNames;
String StylesPath;
-
final static int SOBACKGROUNDCOLOR = 0;
final static int SODBTEXTCOLOR = 1;
final static int SOLABELTEXTCOLOR = 2;
@@ -91,12 +92,13 @@ public class StyleApplier{
final static int SOBORDERCOLOR = 5;
Short IBorderValue = new Short((short) 1);
-
- public StyleApplier(WizardDialog _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException{
- try {
+ public StyleApplier(WizardDialog _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException
+ {
+ try
+ {
this.curFormDocument = _curFormDocument;
xMSF = curFormDocument.xMSF;
- StylesPath = FileAccess.getOfficePath(xMSF, "Config","", "");
+ StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", "");
StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles");
TextStyleHandler oTextStyleHandler = new TextStyleHandler(xMSF, curFormDocument.xTextDocument);
xPageStylePropertySet = oTextStyleHandler.getStyleByName("PageStyles", "Standard");
@@ -111,79 +113,130 @@ public class StyleApplier{
XInterface xUcbInterface = (XInterface) _curFormDocument.xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
setStyles();
short[] SelLayoutPos;
- SelLayoutPos = new short[]{0};
+ SelLayoutPos = new short[]
+ {
+ 0
+ };
CurUnoDialog.insertLabel("lblStyles",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], sPageStyles, new Integer(92), new Integer(25),IStyleStep, new Short(curtabindex++), new Integer(90)});
-
- lstStyles = CurUnoDialog.insertListBox("lstStyles", null, SCHANGELAYOUT, this,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width"},
- new Object[] { new Integer(143),"HID:34471", new Integer(92), new Integer(35), SelLayoutPos, IStyleStep, this.StyleNames, new Short(curtabindex++), new Integer(90)});
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], sPageStyles, new Integer(92), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(90)
+ });
+
+ lstStyles = CurUnoDialog.insertListBox("lstStyles", null, SCHANGELAYOUT, this,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(143), "HID:34471", new Integer(92), new Integer(35), SelLayoutPos, IStyleStep, this.StyleNames, new Short(curtabindex++), new Integer(90)
+ });
optNoBorder = CurUnoDialog.insertRadioButton("otpNoBorder", SCHANGEBORDERTYPE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Tag", "Width"},
- new Object[] {UIConsts.INTEGERS[10],"HID:34472",sNoBorder, new Integer(196), new Integer(39),IStyleStep, new Short(curtabindex++), "0", new Integer(93)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Tag", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[10], "HID:34472", sNoBorder, new Integer(196), new Integer(39), IStyleStep, new Short(curtabindex++), "0", new Integer(93)
+ });
opt3DLook = CurUnoDialog.insertRadioButton("otp3DLook", SCHANGEBORDERTYPE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Tag", "Width"},
- new Object[] {UIConsts.INTEGERS[10],"HID:34473",s3DLook, new Integer(196), new Integer(53), new Short((short)1),IStyleStep, new Short(curtabindex++), "1", new Integer(93)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Tag", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[10], "HID:34473", s3DLook, new Integer(196), new Integer(53), new Short((short) 1), IStyleStep, new Short(curtabindex++), "1", new Integer(93)
+ });
optFlat = CurUnoDialog.insertRadioButton("otpFlat", SCHANGEBORDERTYPE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Tag", "Width"},
- new Object[] {UIConsts.INTEGERS[10],"HID:34474",sFlat, new Integer(196), new Integer(67),IStyleStep, new Short(curtabindex++), "2", new Integer(93)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Tag", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[10], "HID:34474", sFlat, new Integer(196), new Integer(67), IStyleStep, new Short(curtabindex++), "2", new Integer(93)
+ });
CurUnoDialog.insertFixedLine("lnFieldBorder",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], sFieldBorder, new Integer(192), new Integer(25),IStyleStep, new Short(curtabindex++), new Integer(98)});
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
-/* public void initialize(short _iStyleindex){
- if (_iStyleindex < lstStyles.getItemCount()){
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems", new short[]{_iStyleindex});
- applyStyle(true, false);
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], sFieldBorder, new Integer(192), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(98)
+ });
}
- }
-*/
-
-
- private void setStyles(){
- try {
- Object oRootNode = Configuration.getConfigurationRoot(xMSF, "org.openoffice.Office.FormWizard/FormWizard/Styles", false);
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oRootNode);
- StyleNodeNames = xNameAccess.getElementNames();
- StyleNames = new String[StyleNodeNames.length];
- FileNames = new String[StyleNodeNames.length];
- for (int i = 0; i < StyleNodeNames.length; i++){
- Object oStyleNode = xNameAccess.getByName(StyleNodeNames[i]);
- StyleNames[i] = (String) Helper.getUnoPropertyValue(oStyleNode, "Name");
- FileNames[i] = (String) Helper.getUnoPropertyValue(oStyleNode, "CssHref");
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ }
- private short getStyleIndex(){
- try {
- short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems"));
- if (SelFields != null)
- return SelFields[0];
- } catch (IllegalArgumentException e) {
- e.printStackTrace(System.out);
+ /* public void initialize(short _iStyleindex){
+ if (_iStyleindex < lstStyles.getItemCount()){
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems", new short[]{_iStyleindex});
+ applyStyle(true, false);
}
- return (short) -1;
+ }
+ */
+ private void setStyles()
+ {
+ try
+ {
+ Object oRootNode = Configuration.getConfigurationRoot(xMSF, "org.openoffice.Office.FormWizard/FormWizard/Styles", false);
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oRootNode);
+ StyleNodeNames = xNameAccess.getElementNames();
+ StyleNames = new String[StyleNodeNames.length];
+ FileNames = new String[StyleNodeNames.length];
+ for (int i = 0; i < StyleNodeNames.length; i++)
+ {
+ Object oStyleNode = xNameAccess.getByName(StyleNodeNames[i]);
+ StyleNames[i] = (String) Helper.getUnoPropertyValue(oStyleNode, "Name");
+ FileNames[i] = (String) Helper.getUnoPropertyValue(oStyleNode, "CssHref");
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
}
+ private short getStyleIndex()
+ {
+ try
+ {
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems"));
+ if (SelFields != null)
+ {
+ return SelFields[0];
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return (short) -1;
+ }
-
- public void applyStyle( boolean _bmodifyBackground, boolean _bapplyalways){
+ public void applyStyle(boolean _bmodifyBackground, boolean _bapplyalways)
+ {
short iStyle = getStyleIndex();
- if ((iStyle != iOldLayoutPos) || _bapplyalways){
- if (iStyle > -1){
+ if ((iStyle != iOldLayoutPos) || _bapplyalways)
+ {
+ if (iStyle > -1)
+ {
iOldLayoutPos = iStyle;
String sFileName = FileNames[iStyle]; //Style = lstStyles.getSelectedItem();
int[] iStyles = getStyleColors(sFileName);
@@ -192,9 +245,11 @@ public class StyleApplier{
}
}
- public void changeLayout(){
+ public void changeLayout()
+ {
short iPos = lstStyles.getSelectedItemPos();
- if (iPos != iOldLayoutPos){
+ if (iPos != iOldLayoutPos)
+ {
iOldLayoutPos = iPos;
String sFileName = FileNames[iPos]; //Style = lstStyles.getSelectedItem();
int[] iStyles = getStyleColors(sFileName);
@@ -203,78 +258,102 @@ public class StyleApplier{
curFormDocument.unlockallControllers();
}
-
-/* public void changeLayout(){
-/ curFormDocument.xTextDocument.lockControllers();
- applyStyle(true, false);
- curFormDocument.unlockallControllers();
+ /* public void changeLayout(){
+ / curFormDocument.xTextDocument.lockControllers();
+ applyStyle(true, false);
+ curFormDocument.unlockallControllers();
}
- */
-
- public Short getBorderType(){
+ */
+ public Short getBorderType()
+ {
return IBorderValue;
}
+ public void changeBorderLayouts()
+ {
+ try
+ {
+ curFormDocument.xTextDocument.lockControllers();
- public void changeBorderLayouts(){
- try {
- curFormDocument.xTextDocument.lockControllers();
-
- if (optNoBorder.getState())
- IBorderValue = new Short((short) 0);
- else if (opt3DLook.getState())
- IBorderValue = new Short((short) 1);
- else
- IBorderValue = new Short((short) 2);
- for (int m = 0; m < curFormDocument.oControlForms.size(); m++){
- FormDocument.ControlForm curControlForm = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m));
- if (curControlForm.getArrangemode() == FormWizard.SOGRID){
- GridControl oGridControl = curControlForm.getGridControl();
- oGridControl.xPropertySet.setPropertyValue("Border", IBorderValue);
+ if (optNoBorder.getState())
+ {
+ IBorderValue = new Short((short) 0);
}
- else{
- DatabaseControl[] DBControls = curControlForm.getDatabaseControls();
- for (int n = 0; n < DBControls.length; n++){
- if (DBControls[n].xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")){
- TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n];
- for (int i = 0; i < 2; i++){
- XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i);
- if (xPropertySet.getPropertySetInfo().hasPropertyByName("Border"))
- xPropertySet.setPropertyValue("Border", IBorderValue);
+ else if (opt3DLook.getState())
+ {
+ IBorderValue = new Short((short) 1);
+ }
+ else
+ {
+ IBorderValue = new Short((short) 2);
+ }
+ for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
+ {
+ FormDocument.ControlForm curControlForm = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m));
+ if (curControlForm.getArrangemode() == FormWizard.SOGRID)
+ {
+ GridControl oGridControl = curControlForm.getGridControl();
+ oGridControl.xPropertySet.setPropertyValue("Border", IBorderValue);
+ }
+ else
+ {
+ DatabaseControl[] DBControls = curControlForm.getDatabaseControls();
+ for (int n = 0; n < DBControls.length; n++)
+ {
+ if (DBControls[n].xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection"))
+ {
+ TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n];
+ for (int i = 0; i < 2; i++)
+ {
+ XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i);
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName("Border"))
+ {
+ xPropertySet.setPropertyValue("Border", IBorderValue);
+ }
+ }
+ }
+ else
+ {
+ if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName("Border"))
+ {
+ DBControls[n].xPropertySet.setPropertyValue("Border", IBorderValue);
+ }
}
- }
- else{
- if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName("Border"))
- DBControls[n].xPropertySet.setPropertyValue("Border", IBorderValue);
}
}
}
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- curFormDocument.unlockallControllers();
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ curFormDocument.unlockallControllers();
}
-
- public void disposing(EventObject eventObject) {
+ public void disposing(EventObject eventObject)
+ {
}
-
- private int getStyleColor(String[] _sDataList, String _sHeader, String _sPropertyDescription){
+ private int getStyleColor(String[] _sDataList, String _sHeader, String _sPropertyDescription)
+ {
int iColor = -1;
int index = JavaTools.FieldInList(_sDataList, _sHeader);
- if (index > -1){
+ if (index > -1)
+ {
String sPropName = "";
int iStyleColor;
- while (((sPropName.indexOf("}") < 0) && (index < _sDataList.length-1))){
+ while (((sPropName.indexOf("}") < 0) && (index < _sDataList.length - 1)))
+ {
String scurline = _sDataList[index++];
- if ((scurline.indexOf(_sPropertyDescription)) > 0){
- if (scurline.indexOf(":") > 0){
+ if ((scurline.indexOf(_sPropertyDescription)) > 0)
+ {
+ if (scurline.indexOf(":") > 0)
+ {
String[] sPropList = JavaTools.ArrayoutofString(scurline, ":");
String sPropValue = sPropList[1];
sPropValue.trim();
- if (sPropValue.indexOf("#") > 0){
+ if (sPropValue.indexOf("#") > 0)
+ {
sPropValue = JavaTools.replaceSubString(sPropValue, "", ";");
sPropValue = JavaTools.replaceSubString(sPropValue, "", " ");
return Integer.decode(sPropValue).intValue();
@@ -286,8 +365,8 @@ public class StyleApplier{
return -1;
}
-
- private int[] getStyleColors(String _filename){
+ private int[] getStyleColors(String _filename)
+ {
String sFilePath = this.StylesPath + "/" + _filename;
int[] oStylePropList = new int[6];
String[] sData = FileAccess.getDataFromTextFile(xMSF, sFilePath);
@@ -300,57 +379,82 @@ public class StyleApplier{
return oStylePropList;
}
-
-
- private void setDBControlColors(XPropertySet xPropertySet, int[] _iStyleColors){
- try {
- if (xPropertySet.getPropertySetInfo().hasPropertyByName("TextColor")){
+ private void setDBControlColors(XPropertySet xPropertySet, int[] _iStyleColors)
+ {
+ try
+ {
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName("TextColor"))
+ {
if (_iStyleColors[SODBTEXTCOLOR] > -1)
+ {
xPropertySet.setPropertyValue("TextColor", Integer.decode("#00000"));
+ }
}
- if (xPropertySet.getPropertySetInfo().hasPropertyByName("BackgroundColor")){
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName("BackgroundColor"))
+ {
xPropertySet.setPropertyValue("BackgroundColor", Integer.decode("#DDDDDD"));
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
-
- public void applyDBControlProperties(int[] _iStyleColors){
- try {
- for (int m = 0; m < curFormDocument.oControlForms.size(); m++){
- FormDocument.ControlForm curControlForm = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m));
- if (curControlForm.getArrangemode() == FormWizard.SOGRID){
- if (_iStyleColors[SOLABELTEXTCOLOR] > -1)
- curControlForm.oGridControl.xPropertySet.setPropertyValue("TextColor", new Integer(_iStyleColors[SODBTEXTCOLOR]));
- curControlForm.oGridControl.xPropertySet.setPropertyValue("BackgroundColor", Integer.decode("#DDDDDD"));
- }
- else{
- DatabaseControl[] DBControls = curControlForm.getDatabaseControls();
- for (int n = 0; n < DBControls.length; n++){
- if (_iStyleColors[SODBTEXTCOLOR] > -1)
- if (DBControls[n].xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection")){
+ public void applyDBControlProperties(int[] _iStyleColors)
+ {
+ try
+ {
+ for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
+ {
+ FormDocument.ControlForm curControlForm = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m));
+ if (curControlForm.getArrangemode() == FormWizard.SOGRID)
+ {
+ if (_iStyleColors[SOLABELTEXTCOLOR] > -1)
+ {
+ curControlForm.oGridControl.xPropertySet.setPropertyValue("TextColor", new Integer(_iStyleColors[SODBTEXTCOLOR]));
+ }
+ curControlForm.oGridControl.xPropertySet.setPropertyValue("BackgroundColor", Integer.decode("#DDDDDD"));
+ }
+ else
+ {
+ DatabaseControl[] DBControls = curControlForm.getDatabaseControls();
+ for (int n = 0; n < DBControls.length; n++)
+ {
+ if (_iStyleColors[SODBTEXTCOLOR] > -1)
+ {
+ if (DBControls[n].xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection"))
+ {
TimeStampControl oTimeStampControl = (TimeStampControl) DBControls[n];
- for (int i = 0; i < 2; i++){
+ for (int i = 0; i < 2; i++)
+ {
XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i);
setDBControlColors(xPropertySet, _iStyleColors);
}
+ }
+ else
+ {
+ setDBControlColors(DBControls[n].xPropertySet, _iStyleColors);
+ }
}
- else
- setDBControlColors(DBControls[n].xPropertySet, _iStyleColors);
- }
- Control[] LabelControls = curControlForm.getLabelControls();
- for (int n = 0; n < LabelControls.length; n++){
- if (_iStyleColors[SOLABELTEXTCOLOR] > -1)
- LabelControls[n].xPropertySet.setPropertyValue("TextColor", new Integer(_iStyleColors[SOLABELTEXTCOLOR]));
+ }
+ Control[] LabelControls = curControlForm.getLabelControls();
+ for (int n = 0; n < LabelControls.length; n++)
+ {
+ if (_iStyleColors[SOLABELTEXTCOLOR] > -1)
+ {
+ LabelControls[n].xPropertySet.setPropertyValue("TextColor", new Integer(_iStyleColors[SOLABELTEXTCOLOR]));
// if (_iStyleColors[SOCONTROLBACKGROUNDCOLOR] > -1)
// LabelControls[n].xPropertySet.setPropertyValue("BackgroundColor", new Integer(_iStyleColors[SOCONTROLBACKGROUNDCOLOR]));
+ }
+ }
}
}
+ xPageStylePropertySet.setPropertyValue("BackColor", new Integer(_iStyleColors[SOBACKGROUNDCOLOR]));
}
- xPageStylePropertySet.setPropertyValue("BackColor", new Integer(_iStyleColors[SOBACKGROUNDCOLOR]));
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java
index e03b02fed0b7..ead1681e87d6 100644
--- a/wizards/com/sun/star/wizards/form/UIControlArranger.java
+++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java
@@ -26,7 +26,9 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.form;
+ ************************************************************************/
+package com.sun.star.wizards.form;
+
import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.Size;
@@ -49,9 +51,9 @@ import javax.swing.ListModel;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
+public class UIControlArranger
+{
-
-public class UIControlArranger {
FormWizard CurUnoDialog;
FormDocument curFormDocument;
short curtabindex;
@@ -67,8 +69,8 @@ public class UIControlArranger {
final int SOIMAGELISTHEIGHT = 60;
final String SOALIGNMETHOD = "alignLabelControls";
-
- public UIControlArranger(FormWizard _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException {
+ public UIControlArranger(FormWizard _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException
+ {
this.CurUnoDialog = _CurUnoDialog;
this.curFormDocument = _curFormDocument;
curtabindex = (short) (FormWizard.SOCONTROLPAGE * 100);
@@ -84,187 +86,236 @@ public class UIControlArranger {
HelpTexts[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 39);
flnLabelPlacement = CurUnoDialog.insertFixedLine("lnLabelPlacement",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8],sLabelPlacment, new Integer(97), new Integer(25), IControlStep, new Short(curtabindex++), new Integer(207)}
- );
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], sLabelPlacment, new Integer(97), new Integer(25), IControlStep, new Short(curtabindex++), new Integer(207)
+ });
optAlignLeft = CurUnoDialog.insertRadioButton("optAlignLeft", SOALIGNMETHOD, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[10],"HID:34451",sAlignLeft, new Integer(107), new Integer(38), new Short((short)1), IControlStep, new Short(curtabindex++), new Integer(171)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[10], "HID:34451", sAlignLeft, new Integer(107), new Integer(38), new Short((short) 1), IControlStep, new Short(curtabindex++), new Integer(171)
+ });
optAlignRight = CurUnoDialog.insertRadioButton("optAlignRight", SOALIGNMETHOD, this,
- new String[] {"Height", "HelpURL", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[10],"HID:34452",sAlignRight, Boolean.TRUE, new Integer(107), new Integer(50), IControlStep, new Short(curtabindex++), new Integer(171)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[10], "HID:34452", sAlignRight, Boolean.TRUE, new Integer(107), new Integer(50), IControlStep, new Short(curtabindex++), new Integer(171)
+ });
DefaultListModel imageModel = new DefaultListModel();
- for (int i = 0; i< HelpTexts.length; i++)
+ for (int i = 0; i < HelpTexts.length; i++)
+ {
imageModel.addElement(new Integer(i));
-
- oImageList[0] = new ArrangeImageList(0,imageModel);
- oImageList[1] = new ArrangeImageList(1,imageModel);
+ }
+ oImageList[0] = new ArrangeImageList(0, imageModel);
+ oImageList[1] = new ArrangeImageList(1, imageModel);
enableAlignControlGroup(false);
}
-
- public int getSelectedArrangement(int _formindex){
- return oImageList[_formindex].ilLayouts.getSelected()+1;
+ public int getSelectedArrangement(int _formindex)
+ {
+ return oImageList[_formindex].ilLayouts.getSelected() + 1;
}
+ private class LayoutRenderer implements ImageList.ImageRenderer
+ {
- private class LayoutRenderer implements ImageList.ImageRenderer {
- public Object[] getImageUrls(Object listitem) {
+ public Object[] getImageUrls(Object listitem)
+ {
- int ResId = UIConsts.RID_IMG_FORM + (2 * ((Integer)listitem).intValue());
+ int ResId = UIConsts.RID_IMG_FORM + (2 * ((Integer) listitem).intValue());
Index++;
- return new Integer[]{new Integer(ResId), new Integer(ResId + 1)};
+ return new Integer[]
+ {
+ new Integer(ResId), new Integer(ResId + 1)
+ };
// String s = CurUnoDialog.getWizardImageUrl(ResId, ResId + 1); //((Integer)listitem).intValue(), )sBitmapPath + "/Arrange_" + (((Integer)listitem).intValue() + 1) + ".gif";
// return s;
}
- public String render(Object listItem) {
+ public String render(Object listItem)
+ {
if (listItem == null)
+ {
return "";
- return HelpTexts[((Integer)listItem).intValue()];
+ }
+ return HelpTexts[((Integer) listItem).intValue()];
}
}
-
- public void enableSubFormImageList(boolean _bdoEnable){
+ public void enableSubFormImageList(boolean _bdoEnable)
+ {
oImageList[1].ilLayouts.setenabled(_bdoEnable);
CurUnoDialog.setControlProperty("lnLabelPlacment_2", "Enabled", new Boolean(_bdoEnable));
}
-
- public short getAlignValue(){
+ public short getAlignValue()
+ {
Short IAlignValue = null;
if (optAlignLeft.getState())
+ {
IAlignValue = new Short((short) 0);
+ }
else
- IAlignValue = new Short((short) 2);
+ {
+ IAlignValue = new Short((short) 2);
+ }
return IAlignValue.shortValue();
}
-
- public void alignLabelControls(){
- try {
- short iAlignValue = getAlignValue();
- for (int m = 0; m < curFormDocument.oControlForms.size(); m++){
- FormDocument.ControlForm curControlForm = (FormDocument.ControlForm) curFormDocument.oControlForms.get(m);
- if (curControlForm.getArrangemode() == FormWizard.SOCOLUMNARLEFT){
- Control[] LabelControls = curControlForm.getLabelControls();
- for (int n = 0; n < LabelControls.length; n++){
- LabelControls[n].xPropertySet.setPropertyValue("Align", new Short(iAlignValue));
+ public void alignLabelControls()
+ {
+ try
+ {
+ short iAlignValue = getAlignValue();
+ for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
+ {
+ FormDocument.ControlForm curControlForm = (FormDocument.ControlForm) curFormDocument.oControlForms.get(m);
+ if (curControlForm.getArrangemode() == FormWizard.SOCOLUMNARLEFT)
+ {
+ Control[] LabelControls = curControlForm.getLabelControls();
+ for (int n = 0; n < LabelControls.length; n++)
+ {
+ LabelControls[n].xPropertySet.setPropertyValue("Align", new Short(iAlignValue));
+ }
}
}
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- private void enableAlignControlGroup(boolean _bEnableAlignControlGroup){
+ private void enableAlignControlGroup(boolean _bEnableAlignControlGroup)
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(flnLabelPlacement), "Enabled", new Boolean(_bEnableAlignControlGroup));
Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), "Enabled", new Boolean(_bEnableAlignControlGroup));
Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignRight), "Enabled", new Boolean(_bEnableAlignControlGroup));
}
+ private class ArrangeImageList implements XItemListener
+ {
- private class ArrangeImageList implements XItemListener{
int formindex;
ImageList ilLayouts = new ImageList();
-
- public ArrangeImageList(int _formindex, ListModel model){
+ public ArrangeImageList(int _formindex, ListModel model)
+ {
formindex = _formindex;
Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT);
- CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex +1),
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], sArrangementHeader[_formindex], new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207)}
- );
-
- int nypos = SOBASEIMAGEYPOSITION + 12+ _formindex * SOIMAGELISTHEIGHT;
+ CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1),
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], sArrangementHeader[_formindex], new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207)
+ });
+
+ int nypos = SOBASEIMAGEYPOSITION + 12 + _formindex * SOIMAGELISTHEIGHT;
ilLayouts = new ImageList();
- ilLayouts.setPos(new Size( 107,nypos));
- ilLayouts.setImageSize(new Size(26,26));
+ ilLayouts.setPos(new Size(107, nypos));
+ ilLayouts.setImageSize(new Size(26, 26));
ilLayouts.setCols(4);
ilLayouts.setRows(1);
ilLayouts.name = "ImageList_" + formindex;
ilLayouts.setStep(new Short((short) FormWizard.SOCONTROLPAGE));
ilLayouts.setShowButtons(false);
ilLayouts.setRenderer(new LayoutRenderer());
- ilLayouts.setSelectionGap(new Size(2,2));
- ilLayouts.setGap(new Size(3,3));
+ ilLayouts.setSelectionGap(new Size(2, 2));
+ ilLayouts.setGap(new Size(3, 3));
ilLayouts.scaleImages = Boolean.FALSE;
ilLayouts.tabIndex = (int) curtabindex++;
ilLayouts.helpURL = 34453 + (formindex * 4);
ilLayouts.setListModel(model);
ilLayouts.create(CurUnoDialog);
- ilLayouts.setSelected(FormWizard.SOGRID-1);
+ ilLayouts.setSelected(FormWizard.SOGRID - 1);
ilLayouts.addItemListener(this);
}
-
- public void setToLeftAlign(){
+ public void setToLeftAlign()
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), "State", new Short((short) 1));
}
/* (non-Javadoc)
* @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener)
*/
- public void addListDataListener(ListDataListener arg0) {
+ public void addListDataListener(ListDataListener arg0)
+ {
// TODO Auto-generated method stub
-
}
-
- public void itemStateChanged(ItemEvent arg0) {
- try {
- if (oImageList[formindex].ilLayouts.isenabled()){
- boolean bEnableAlignControlGroup;
- if (curFormDocument.oControlForms.size() == 2)
- bEnableAlignControlGroup = (((oImageList[0].ilLayouts.getSelected()+1) == FormWizard.SOCOLUMNARLEFT) || ((oImageList[1].ilLayouts.getSelected()+1) == FormWizard.SOCOLUMNARLEFT));
- else
- bEnableAlignControlGroup = ((oImageList[0].ilLayouts.getSelected()+1) == FormWizard.SOCOLUMNARLEFT);
- enableAlignControlGroup(bEnableAlignControlGroup);
- ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(ilLayouts.getSelected() + 1, CurUnoDialog.getBorderType());
+ public void itemStateChanged(ItemEvent arg0)
+ {
+ try
+ {
+ if (oImageList[formindex].ilLayouts.isenabled())
+ {
+ boolean bEnableAlignControlGroup;
+ if (curFormDocument.oControlForms.size() == 2)
+ {
+ bEnableAlignControlGroup = (((oImageList[0].ilLayouts.getSelected() + 1) == FormWizard.SOCOLUMNARLEFT) || ((oImageList[1].ilLayouts.getSelected() + 1) == FormWizard.SOCOLUMNARLEFT));
+ }
+ else
+ {
+ bEnableAlignControlGroup = ((oImageList[0].ilLayouts.getSelected() + 1) == FormWizard.SOCOLUMNARLEFT);
+ }
+ enableAlignControlGroup(bEnableAlignControlGroup);
+ ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(ilLayouts.getSelected() + 1, CurUnoDialog.getBorderType());
+ }
}
- } catch (RuntimeException e) {
- e.printStackTrace();
- }}
+ catch (RuntimeException e)
+ {
+ e.printStackTrace();
+ }
+ }
/* (non-Javadoc)
* @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent)
*/
- public void contentsChanged(ListDataEvent arg0) {
+ public void contentsChanged(ListDataEvent arg0)
+ {
// TODO Auto-generated method stub
-
}
/* (non-Javadoc)
* @see javax.swing.event.ListDataListener#intervalAdded(javax.swing.event.ListDataEvent)
*/
- public void intervalAdded(ListDataEvent arg0) {
+ public void intervalAdded(ListDataEvent arg0)
+ {
// TODO Auto-generated method stub
-
}
/* (non-Javadoc)
* @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent)
*/
- public void intervalRemoved(ListDataEvent arg0) {
+ public void intervalRemoved(ListDataEvent arg0)
+ {
// TODO Auto-generated method stub
-
}
/* (non-Javadoc)
* @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
*/
- public void disposing(EventObject arg0) {
+ public void disposing(EventObject arg0)
+ {
// TODO Auto-generated method stub
-
}
}
-
}
diff --git a/wizards/com/sun/star/wizards/form/XCallFormWizard.java b/wizards/com/sun/star/wizards/form/XCallFormWizard.java
index 255360086156..c3da310a583d 100644
--- a/wizards/com/sun/star/wizards/form/XCallFormWizard.java
+++ b/wizards/com/sun/star/wizards/form/XCallFormWizard.java
@@ -26,12 +26,15 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.form;
+ ************************************************************************/
+package com.sun.star.wizards.form;
-public interface XCallFormWizard extends com.sun.star.uno.XInterface {
+public interface XCallFormWizard extends com.sun.star.uno.XInterface
+{
// Methods
- public void CallFormDialog();
-
- // static Member
- public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = { new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallFormDialog", 0, 0)};
+ public void CallFormDialog(); // static Member
+ public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] =
+ {
+ new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallFormDialog", 0, 0)
+ };
}
diff --git a/wizards/com/sun/star/wizards/letter/CGLetter.java b/wizards/com/sun/star/wizards/letter/CGLetter.java
index 51e0d6ef02a8..0d464732c10b 100644
--- a/wizards/com/sun/star/wizards/letter/CGLetter.java
+++ b/wizards/com/sun/star/wizards/letter/CGLetter.java
@@ -1,8 +1,40 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CGLetter.java,v $
+ *
+ * $Revision: 1.4.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
import com.sun.star.wizards.common.ConfigGroup;
-public class CGLetter extends ConfigGroup {
+public class CGLetter extends ConfigGroup
+{
public int cp_Style;
public boolean cp_BusinessPaper;
@@ -35,5 +67,4 @@ public class CGLetter extends ConfigGroup {
public int cp_CreationType;
public String cp_TemplateName;
public String cp_TemplatePath;
-
}
diff --git a/wizards/com/sun/star/wizards/letter/CGLetterWizard.java b/wizards/com/sun/star/wizards/letter/CGLetterWizard.java
index 0fe90cd4f059..55f21e029892 100644
--- a/wizards/com/sun/star/wizards/letter/CGLetterWizard.java
+++ b/wizards/com/sun/star/wizards/letter/CGLetterWizard.java
@@ -1,12 +1,43 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CGLetterWizard.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
import com.sun.star.wizards.common.ConfigGroup;
-public class CGLetterWizard extends ConfigGroup {
+public class CGLetterWizard extends ConfigGroup
+{
public int cp_LetterType;
public CGLetter cp_BusinessLetter = new CGLetter();
public CGLetter cp_PrivateOfficialLetter = new CGLetter();
public CGLetter cp_PrivateLetter = new CGLetter();
-
}
diff --git a/wizards/com/sun/star/wizards/letter/CGPaperElementLocation.java b/wizards/com/sun/star/wizards/letter/CGPaperElementLocation.java
index 7d5ff1265dc7..92d40c21d4de 100644
--- a/wizards/com/sun/star/wizards/letter/CGPaperElementLocation.java
+++ b/wizards/com/sun/star/wizards/letter/CGPaperElementLocation.java
@@ -1,13 +1,44 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CGPaperElementLocation.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
import com.sun.star.wizards.common.ConfigGroup;
-public class CGPaperElementLocation extends ConfigGroup {
+public class CGPaperElementLocation extends ConfigGroup
+{
public boolean cp_Display;
public double cp_Width;
public double cp_Height;
public double cp_X;
public double cp_Y;
-
}
diff --git a/wizards/com/sun/star/wizards/letter/CallWizard.java b/wizards/com/sun/star/wizards/letter/CallWizard.java
index e53fbeceadbf..7b0e7e170597 100644
--- a/wizards/com/sun/star/wizards/letter/CallWizard.java
+++ b/wizards/com/sun/star/wizards/letter/CallWizard.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CallWizard.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
import com.sun.star.beans.XPropertyAccess;
@@ -18,9 +49,10 @@ import com.sun.star.uno.Type;
* information into the given registry key (<CODE>__writeRegistryServiceInfo</CODE>).
*
* @author $author$
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.3.192.1 $
*/
-public class CallWizard {
+public class CallWizard
+{
/**
* Gives a factory for creating the service. This method is called by the
@@ -37,10 +69,12 @@ public class CallWizard {
*
* @see com.sun.star.comp.loader.JavaLoader#
*/
- public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey) {
+ public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey)
+ {
XSingleServiceFactory xsingleservicefactory = null;
- if (stringImplementationName.equals(WizardImplementation.class.getName())) {
+ if (stringImplementationName.equals(WizardImplementation.class.getName()))
+ {
xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey);
}
@@ -58,7 +92,8 @@ public class CallWizard {
*
* @see com.sun.star.comp.loader.JavaLoader#
*/
- public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey) {
+ public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey)
+ {
return FactoryHelper.writeRegistryServiceInfo(WizardImplementation.class.getName(), WizardImplementation.__serviceName, xregistrykey);
}
@@ -66,7 +101,8 @@ public class CallWizard {
* This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
- public static class WizardImplementation implements XInitialization, XTypeProvider, XServiceInfo, XJobExecutor {
+ public static class WizardImplementation implements XInitialization, XTypeProvider, XServiceInfo, XJobExecutor
+ {
/**
* The constructor of the inner class has a XMultiServiceFactory parameter.
@@ -74,11 +110,12 @@ public class CallWizard {
* @param xmultiservicefactoryInitialization A special service factory could be
* introduced while initializing.
*/
- public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization) {
+ public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
xmultiservicefactory = xmultiservicefactoryInitialization;
- if (xmultiservicefactory != null) {
-
+ if (xmultiservicefactory != null)
+ {
}
}
@@ -87,23 +124,21 @@ public class CallWizard {
*
* @param str only valid parameter is 'start' at the moment.
*/
-
- public void trigger(String str) {
- if (str.equalsIgnoreCase("start")) {
+ public void trigger(String str)
+ {
+ if (str.equalsIgnoreCase("start"))
+ {
LetterWizardDialogImpl lw = new LetterWizardDialogImpl(xmultiservicefactory);
- if (!LetterWizardDialogImpl.running) {
+ if (!LetterWizardDialogImpl.running)
+ {
lw.startWizard(xmultiservicefactory, null);
}
}
- }
-
- //*******************************************
-
+ } //*******************************************
/**
* The service name, that must be used to get an instance of this service.
*/
private static final String __serviceName = "com.sun.star.wizards.letter.CallWizard";
-
/**
* The service manager, that gives access to all registered services.
*/
@@ -119,8 +154,8 @@ public class CallWizard {
* @throws com.sun.star.uno.Exception Every exception will not be handled, but
* will be passed to the caller.
*/
- public void initialize(Object[] object) throws com.sun.star.uno.Exception {
-
+ public void initialize(Object[] object) throws com.sun.star.uno.Exception
+ {
}
/**
@@ -128,7 +163,8 @@ public class CallWizard {
*
* @return Array of supported service names.
*/
- public java.lang.String[] getSupportedServiceNames() {
+ public java.lang.String[] getSupportedServiceNames()
+ {
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
@@ -143,10 +179,12 @@ public class CallWizard {
*
* @return True, if the given service name will be supported.
*/
- public boolean supportsService(String stringService) {
+ public boolean supportsService(String stringService)
+ {
boolean booleanSupportsService = false;
- if (stringService.equals(__serviceName)) {
+ if (stringService.equals(__serviceName))
+ {
booleanSupportsService = true;
}
@@ -164,13 +202,18 @@ public class CallWizard {
*
* @return Array of bytes, in order to distinguish between two sets.
*/
- public byte[] getImplementationId() {
- byte[] byteReturn = {
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
};
- try {
+ try
+ {
byteReturn = ("" + this.hashCode()).getBytes();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
@@ -182,7 +225,8 @@ public class CallWizard {
*
* @return Class name of the component.
*/
- public java.lang.String getImplementationName() {
+ public java.lang.String getImplementationName()
+ {
return (WizardImplementation.class.getName());
}
@@ -193,13 +237,21 @@ public class CallWizard {
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- public com.sun.star.uno.Type[] getTypes() {
- Type[] typeReturn = {
+ public com.sun.star.uno.Type[] getTypes()
+ {
+ Type[] typeReturn =
+ {
};
- try {
- typeReturn = new Type[] { new Type(XPropertyAccess.class), new Type(XJob.class), new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class)};
- } catch (Exception exception) {
+ try
+ {
+ typeReturn = new Type[]
+ {
+ new Type(XPropertyAccess.class), new Type(XJob.class), new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class)
+ };
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.java b/wizards/com/sun/star/wizards/letter/LetterDocument.java
index 7f7354f91343..492b867e0d6b 100644
--- a/wizards/com/sun/star/wizards/letter/LetterDocument.java
+++ b/wizards/com/sun/star/wizards/letter/LetterDocument.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LetterDocument.java,v $
+ *
+ * $Revision: 1.10.146.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
import com.sun.star.wizards.common.*;
@@ -17,7 +48,8 @@ import com.sun.star.style.ParagraphAdjust;
import com.sun.star.style.XStyleFamiliesSupplier;
import com.sun.star.style.XStyle;
-public class LetterDocument extends TextDocument {
+public class LetterDocument extends TextDocument
+{
XDesktop xDesktop;
boolean keepLogoFrame = true;
@@ -26,36 +58,44 @@ public class LetterDocument extends TextDocument {
boolean keepSenderAddressRepeatedFrame = true;
boolean keepAddressFrame = true;
-
- public LetterDocument(XMultiServiceFactory xMSF, XTerminateListener listener) {
+ public LetterDocument(XMultiServiceFactory xMSF, XTerminateListener listener)
+ {
super(xMSF, listener, "WIZARD_LIVE_PREVIEW");
}
-
- public XWindowPeer getWindowPeer() {
+ public XWindowPeer getWindowPeer()
+ {
XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument);
return xWindowPeer;
}
- public void switchElement(String sElement, boolean bState) {
- try {
+ public void switchElement(String sElement, boolean bState)
+ {
+ try
+ {
TextSectionHandler mySectionHandler = new TextSectionHandler(xMSF, xTextDocument);
Object oSection = mySectionHandler.xTextSectionsSupplier.getTextSections().getByName(sElement);
Helper.setUnoPropertyValue(oSection, "IsVisible", new Boolean(bState));
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void updateDateFields() {
+ public void updateDateFields()
+ {
TextFieldHandler FH = new TextFieldHandler(xMSFDoc, xTextDocument);
FH.updateDateFields();
}
- public void switchFooter(String sPageStyle, boolean bState, boolean bPageNumber, String sText) {
- if (xTextDocument != null) {
- try {
+ public void switchFooter(String sPageStyle, boolean bState, boolean bPageNumber, String sText)
+ {
+ if (xTextDocument != null)
+ {
+ try
+ {
xTextDocument.lockControllers();
XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
com.sun.star.container.XNameAccess xNameAccess = null;
@@ -67,11 +107,13 @@ public class LetterDocument extends TextDocument {
XText xFooterText;
XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle));
- if (bState) {
+ if (bState)
+ {
Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(true));
xFooterText = (XText) UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText"));
xFooterText.setString(sText);
- if (bPageNumber) {
+ if (bPageNumber)
+ {
//Adding the Page Number
XTextCursor myCursor = xFooterText.createTextCursor();
myCursor.gotoEnd(false);
@@ -81,39 +123,53 @@ public class LetterDocument extends TextDocument {
XTextField xPageNumberField = (XTextField) UnoRuntime.queryInterface(XTextField.class, xMSFDoc.createInstance("com.sun.star.text.TextField.PageNumber"));
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xPageNumberField);
xPSet.setPropertyValue("SubType", PageNumberType.CURRENT);
- xPSet.setPropertyValue("NumberingType", new Short (NumberingType.ARABIC));
+ xPSet.setPropertyValue("NumberingType", new Short(NumberingType.ARABIC));
xFooterText.insertTextContent(xFooterText.getEnd(), xPageNumberField, false);
}
- } else {
+ }
+ else
+ {
Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(false));
}
xTextDocument.unlockControllers();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
}
- public boolean hasElement(String sElement) {
- if (xTextDocument != null) {
+ public boolean hasElement(String sElement)
+ {
+ if (xTextDocument != null)
+ {
TextSectionHandler SH = new TextSectionHandler(xMSF, xTextDocument);
return SH.hasTextSectionByName(sElement);
- } else {
+ }
+ else
+ {
return false;
}
}
- public void switchUserField(String sFieldName, String sNewContent, boolean bState) {
+ public void switchUserField(String sFieldName, String sNewContent, boolean bState)
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
- if (bState) {
+ if (bState)
+ {
myFieldHandler.changeUserFieldContent(sFieldName, sNewContent);
- } else {
+ }
+ else
+ {
myFieldHandler.changeUserFieldContent(sFieldName, "");
}
}
- public void fillSenderWithUserData() {
- try {
+ public void fillSenderWithUserData()
+ {
+ try
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(xMSFDoc, xTextDocument);
Object oUserDataAccess = Configuration.getConfigurationRoot(xMSF, "org.openoffice.UserProfile/Data", false);
myFieldHandler.changeUserFieldContent("Company", (String) Helper.getUnoObjectbyName(oUserDataAccess, "o"));
@@ -121,64 +177,92 @@ public class LetterDocument extends TextDocument {
myFieldHandler.changeUserFieldContent("PostCode", (String) Helper.getUnoObjectbyName(oUserDataAccess, "postalcode"));
myFieldHandler.changeUserFieldContent("City", (String) Helper.getUnoObjectbyName(oUserDataAccess, "l"));
myFieldHandler.changeUserFieldContent("State", (String) Helper.getUnoObjectbyName(oUserDataAccess, "st"));
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void killEmptyUserFields() {
+ public void killEmptyUserFields()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
myFieldHandler.removeUserFieldByContent("");
}
- public void killEmptyFrames() {
- try {
- if (!keepLogoFrame) {
+ public void killEmptyFrames()
+ {
+ try
+ {
+ if (!keepLogoFrame)
+ {
XTextFrame xTF = TextFrameHandler.getFrameByName("Company Logo", xTextDocument);
- if (xTF != null) xTF.dispose();
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
}
- if (!keepBendMarksFrame) {
+ if (!keepBendMarksFrame)
+ {
XTextFrame xTF = TextFrameHandler.getFrameByName("Bend Marks", xTextDocument);
- if (xTF != null) xTF.dispose();
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
}
- if (!keepLetterSignsFrame) {
+ if (!keepLetterSignsFrame)
+ {
XTextFrame xTF = TextFrameHandler.getFrameByName("Letter Signs", xTextDocument);
- if (xTF != null) xTF.dispose();
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
}
- if (!keepSenderAddressRepeatedFrame) {
+ if (!keepSenderAddressRepeatedFrame)
+ {
XTextFrame xTF = TextFrameHandler.getFrameByName("Sender Address Repeated", xTextDocument);
- if (xTF != null) xTF.dispose();
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
}
- if (!keepAddressFrame) {
+ if (!keepAddressFrame)
+ {
XTextFrame xTF = TextFrameHandler.getFrameByName("Sender Address", xTextDocument);
- if (xTF != null) xTF.dispose();
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
-
- public class BusinessPaperObject {
+ public class BusinessPaperObject
+ {
public int iWidth;
public int iHeight;
public int iXPos;
public int iYPos;
-
XTextFrame xFrame;
XShape xShape;
- public BusinessPaperObject(String FrameText, int Width, int Height, int XPos, int YPos) {
+ public BusinessPaperObject(String FrameText, int Width, int Height, int XPos, int YPos)
+ {
iWidth = Width;
iHeight = Height;
iXPos = XPos;
iYPos = YPos;
- try {
+ try
+ {
xFrame = (XTextFrame) UnoRuntime.queryInterface(XTextFrame.class, xMSFDoc.createInstance("com.sun.star.text.TextFrame"));
xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xFrame);
@@ -213,12 +297,15 @@ public class LetterDocument extends TextDocument {
xFrameText.insertString(xFrameCursor, FrameText, false);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
- public void setFramePosition() {
+ public void setFramePosition()
+ {
Helper.setUnoPropertyValue(xFrame, "HoriOrient", new Short(HoriOrientation.NONE));
Helper.setUnoPropertyValue(xFrame, "VertOrient", new Short(VertOrientation.NONE));
Helper.setUnoPropertyValue(xFrame, "Height", new Integer(iHeight));
@@ -229,16 +316,19 @@ public class LetterDocument extends TextDocument {
Helper.setUnoPropertyValue(xFrame, "VertOrientRelation", new Short(RelOrientation.PAGE_FRAME));
}
- public void removeFrame() {
- if (xFrame != null) {
- try {
+ public void removeFrame()
+ {
+ if (xFrame != null)
+ {
+ try
+ {
xTextDocument.getText().removeTextContent(xFrame);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
}
-
}
-
}
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
index cd5a1a5eb7b4..3c54f92ca6f6 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LetterWizardDialog.java,v $
+ *
+ * $Revision: 1.6.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
import com.sun.star.awt.*;
@@ -5,473 +36,882 @@ import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.*;
import com.sun.star.wizards.ui.*;
-public abstract class LetterWizardDialog extends WizardDialog implements LetterWizardDialogConst, UIConsts {
- //GUI Components as Class members.
- XRadioButton optBusinessLetter;
- XListBox lstBusinessStyle;
- XCheckBox chkBusinessPaper;
- XRadioButton optPrivOfficialLetter;
- XListBox lstPrivOfficialStyle;
- XRadioButton optPrivateLetter;
- XListBox lstPrivateStyle;
- XFixedText lblBusinessStyle;
- XFixedText lblPrivOfficialStyle;
- XFixedText lblTitle1;
- XFixedText lblPrivateStyle;
- XFixedText lblIntroduction;
- //Image Control
- XControl ImageControl3;
- XCheckBox chkPaperCompanyLogo;
- XNumericField numLogoHeight;
- XNumericField numLogoX;
- XNumericField numLogoWidth;
- XNumericField numLogoY;
- XCheckBox chkPaperCompanyAddress;
- XNumericField numAddressHeight;
- XNumericField numAddressX;
- XNumericField numAddressWidth;
- XNumericField numAddressY;
- XCheckBox chkCompanyReceiver;
- XCheckBox chkPaperFooter;
- XNumericField numFooterHeight;
- XFixedText lblLogoHeight;
- XFixedText lblLogoWidth;
- //Fixed Line
- XControl FixedLine5;
- //Fixed Line
- XControl FixedLine6;
- XFixedText lblFooterHeight;
- XFixedText lblLogoX;
- XFixedText lblLogoY;
- XFixedText lblAddressHeight;
- XFixedText lblAddressWidth;
- XFixedText lblAddressX;
- XFixedText lblAddressY;
- XFixedText lblTitle2;
- XListBox lstLetterNorm;
- XCheckBox chkUseLogo;
- XCheckBox chkUseAddressReceiver;
- XCheckBox chkUseSigns;
- XCheckBox chkUseSubject;
- XCheckBox chkUseSalutation;
- XComboBox lstSalutation;
- XCheckBox chkUseBendMarks;
- XCheckBox chkUseGreeting;
- XComboBox lstGreeting;
- XCheckBox chkUseFooter;
- XFixedText lblLetterNorm;
- XFixedText lblTitle3;
- XRadioButton optSenderPlaceholder;
- XRadioButton optSenderDefine;
- XTextComponent txtSenderName;
- XTextComponent txtSenderStreet;
- XTextComponent txtSenderPostCode;
- XTextComponent txtSenderState;
- XTextComponent txtSenderCity;
- XRadioButton optReceiverPlaceholder;
- XRadioButton optReceiverDatabase;
- XFixedText lblSenderAddress;
- //Fixed Line
- XControl FixedLine2;
- XFixedText lblReceiverAddress;
- XFixedText lblSenderName;
- XFixedText lblSenderStreet;
- XFixedText lblPostCodeCity;
- XFixedText lblTitle4;
- XTextComponent txtFooter;
- XCheckBox chkFooterNextPages;
- XCheckBox chkFooterPageNumbers;
- XFixedText lblFooter;
- XFixedText lblTitle5;
- XTextComponent txtTemplateName;
- //File Control
- XControl fileTemplatePath;
- XRadioButton optCreateLetter;
- XRadioButton optMakeChanges;
- XFixedText lblFinalExplanation1;
- XFixedText lblProceed;
- XFixedText lblFinalExplanation2;
- //Image Control
- XControl ImageControl2;
- XFixedText lblTemplateName;
- XFixedText lblTemplatePath;
- XFixedText lblTitle6;
- XFixedText Label9;
- //Font Descriptors as Class members.
- FontDescriptor fontDescriptor1 = new FontDescriptor();
- FontDescriptor fontDescriptor2 = new FontDescriptor();
- FontDescriptor fontDescriptor5 = new FontDescriptor();
- FontDescriptor fontDescriptor6 = new FontDescriptor();
+public abstract class LetterWizardDialog extends WizardDialog implements LetterWizardDialogConst, UIConsts
+{
+ //GUI Components as Class members.
+ XRadioButton optBusinessLetter;
+ XListBox lstBusinessStyle;
+ XCheckBox chkBusinessPaper;
+ XRadioButton optPrivOfficialLetter;
+ XListBox lstPrivOfficialStyle;
+ XRadioButton optPrivateLetter;
+ XListBox lstPrivateStyle;
+ XFixedText lblBusinessStyle;
+ XFixedText lblPrivOfficialStyle;
+ XFixedText lblTitle1;
+ XFixedText lblPrivateStyle;
+ XFixedText lblIntroduction;
+ //Image Control
+ XControl ImageControl3;
+ XCheckBox chkPaperCompanyLogo;
+ XNumericField numLogoHeight;
+ XNumericField numLogoX;
+ XNumericField numLogoWidth;
+ XNumericField numLogoY;
+ XCheckBox chkPaperCompanyAddress;
+ XNumericField numAddressHeight;
+ XNumericField numAddressX;
+ XNumericField numAddressWidth;
+ XNumericField numAddressY;
+ XCheckBox chkCompanyReceiver;
+ XCheckBox chkPaperFooter;
+ XNumericField numFooterHeight;
+ XFixedText lblLogoHeight;
+ XFixedText lblLogoWidth;
+ //Fixed Line
+ XControl FixedLine5;
+ //Fixed Line
+ XControl FixedLine6;
+ XFixedText lblFooterHeight;
+ XFixedText lblLogoX;
+ XFixedText lblLogoY;
+ XFixedText lblAddressHeight;
+ XFixedText lblAddressWidth;
+ XFixedText lblAddressX;
+ XFixedText lblAddressY;
+ XFixedText lblTitle2;
+ XListBox lstLetterNorm;
+ XCheckBox chkUseLogo;
+ XCheckBox chkUseAddressReceiver;
+ XCheckBox chkUseSigns;
+ XCheckBox chkUseSubject;
+ XCheckBox chkUseSalutation;
+ XComboBox lstSalutation;
+ XCheckBox chkUseBendMarks;
+ XCheckBox chkUseGreeting;
+ XComboBox lstGreeting;
+ XCheckBox chkUseFooter;
+ XFixedText lblLetterNorm;
+ XFixedText lblTitle3;
+ XRadioButton optSenderPlaceholder;
+ XRadioButton optSenderDefine;
+ XTextComponent txtSenderName;
+ XTextComponent txtSenderStreet;
+ XTextComponent txtSenderPostCode;
+ XTextComponent txtSenderState;
+ XTextComponent txtSenderCity;
+ XRadioButton optReceiverPlaceholder;
+ XRadioButton optReceiverDatabase;
+ XFixedText lblSenderAddress;
+ //Fixed Line
+ XControl FixedLine2;
+ XFixedText lblReceiverAddress;
+ XFixedText lblSenderName;
+ XFixedText lblSenderStreet;
+ XFixedText lblPostCodeCity;
+ XFixedText lblTitle4;
+ XTextComponent txtFooter;
+ XCheckBox chkFooterNextPages;
+ XCheckBox chkFooterPageNumbers;
+ XFixedText lblFooter;
+ XFixedText lblTitle5;
+ XTextComponent txtTemplateName;
+ //File Control
+ XControl fileTemplatePath;
+ XRadioButton optCreateLetter;
+ XRadioButton optMakeChanges;
+ XFixedText lblFinalExplanation1;
+ XFixedText lblProceed;
+ XFixedText lblFinalExplanation2;
+ //Image Control
+ XControl ImageControl2;
+ XFixedText lblTemplateName;
+ XFixedText lblTemplatePath;
+ XFixedText lblTitle6;
+ XFixedText Label9;
+ //Font Descriptors as Class members.
+ FontDescriptor fontDescriptor1 = new FontDescriptor();
+ FontDescriptor fontDescriptor2 = new FontDescriptor();
+ FontDescriptor fontDescriptor5 = new FontDescriptor();
+ FontDescriptor fontDescriptor6 = new FontDescriptor(); //Resources Object
+ LetterWizardDialogResources resources;
- //Resources Object
-LetterWizardDialogResources resources;
+ public LetterWizardDialog(XMultiServiceFactory xmsf)
+ {
+ super(xmsf, HIDMAIN);
+ //Load Resources
+ resources = new LetterWizardDialogResources(xmsf);
- public LetterWizardDialog(XMultiServiceFactory xmsf) {
- super(xmsf, HIDMAIN);
- //Load Resources
- resources = new LetterWizardDialogResources(xmsf);
+ //set dialog properties...
+ Helper.setUnoPropertyValues(xDialogModel,
+ new String[]
+ {
+ "Closeable", "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(210), Boolean.TRUE, "LetterWizardDialog", new Integer(104), new Integer(52), INTEGERS[1], new Short((short) 1), resources.resLetterWizardDialog_title, new Integer(310)
+ });
- //set dialog properties...
- Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Closeable","Height","Moveable","Name","PositionX","PositionY","Step","TabIndex","Title","Width"},
- new Object[] { Boolean.TRUE,new Integer(210),Boolean.TRUE,"LetterWizardDialog",new Integer(104),new Integer(52),INTEGERS[1],new Short((short)1),resources.resLetterWizardDialog_title,new Integer(310)}
- );
-
- //Set member- FontDescriptors...
- fontDescriptor1.Weight = 150;
- fontDescriptor1.Underline = com.sun.star.awt.FontUnderline.SINGLE;
- fontDescriptor2.Weight = 100;
- fontDescriptor5.Weight = 100;
- fontDescriptor6.Weight = 150;
- }
- //build components
- public void buildStep1() {
- optBusinessLetter = insertRadioButton("optBusinessLetter", OPTBUSINESSLETTER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 1 ),resources.resoptBusinessLetter_value,"optBusinessLetter",new Integer(97),new Integer(28),INTEGERS[1],new Short((short)1),new Integer(184)}
- );
- optPrivOfficialLetter = insertRadioButton("optPrivOfficialLetter", OPTPRIVOFFICIALLETTER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 2 ),resources.resoptPrivOfficialLetter_value,"optPrivOfficialLetter",new Integer(97),new Integer(74),INTEGERS[1],new Short((short)2),new Integer(184)}
- );
- optPrivateLetter = insertRadioButton("optPrivateLetter", OPTPRIVATELETTER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 3 ),resources.resoptPrivateLetter_value,"optPrivateLetter",new Integer(97),new Integer(106),INTEGERS[1],new Short((short)3),new Integer(184)}
- );
- lstBusinessStyle = insertListBox("lstBusinessStyle", LSTBUSINESSSTYLE_ACTION_PERFORMED,LSTBUSINESSSTYLE_ITEM_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,"HID:" + ( HID + 4 ),"lstBusinessStyle",new Integer(180),INTEGER_40,INTEGERS[1],new Short((short)4),new Integer(74)}
- );
- chkBusinessPaper = insertCheckBox("chkBusinessPaper", CHKBUSINESSPAPER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 5 ),resources.reschkBusinessPaper_value,"chkBusinessPaper",new Integer(110),new Integer(56),new Short((short)0),INTEGERS[1],new Short((short)5),new Integer(168)}
- );
- lstPrivOfficialStyle = insertListBox("lstPrivOfficialStyle", LSTPRIVOFFICIALSTYLE_ACTION_PERFORMED,LSTPRIVOFFICIALSTYLE_ITEM_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,"HID:" + ( HID + 6 ),"lstPrivOfficialStyle",new Integer(180),new Integer(86),INTEGERS[1],new Short((short)6),new Integer(74)}
- );
- lstPrivateStyle = insertListBox("lstPrivateStyle", LSTPRIVATESTYLE_ACTION_PERFORMED,LSTPRIVATESTYLE_ITEM_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,"HID:" + ( HID + 7 ),"lstPrivateStyle",new Integer(180),new Integer(118),INTEGERS[1],new Short((short)7),new Integer(74)}
- );
- lblBusinessStyle = insertLabel("lblBusinessStyle",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblBusinessStyle_value,"lblBusinessStyle",new Integer(110),new Integer(42),INTEGERS[1],new Short((short)48),new Integer(60)}
- );
- lblPrivOfficialStyle = insertLabel("lblPrivOfficialStyle",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblPrivOfficialStyle_value,"lblPrivOfficialStyle",new Integer(110),new Integer(88),INTEGERS[1],new Short((short)49),new Integer(60)}
- );
- lblTitle1 = insertLabel("lblTitle1",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor6,INTEGER_16,resources.reslblTitle1_value,Boolean.TRUE,"lblTitle1",new Integer(91),INTEGERS[8],INTEGERS[1],new Short((short)55),new Integer(212)}
- );
- lblPrivateStyle = insertLabel("lblPrivateStyle",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblPrivateStyle_value,"lblPrivateStyle",new Integer(110),new Integer(120),INTEGERS[1],new Short((short)74),new Integer(60)}
- );
- lblIntroduction = insertLabel("lblIntroduction",
- new String[] {"Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(39),resources.reslblIntroduction_value,Boolean.TRUE,"lblIntroduction",new Integer(104),new Integer(145),INTEGERS[1],new Short((short)80),new Integer(199)}
- );
- ImageControl3 = insertInfoImage(92, 145, 1);
+ //Set member- FontDescriptors...
+ fontDescriptor1.Weight = 150;
+ fontDescriptor1.Underline = com.sun.star.awt.FontUnderline.SINGLE;
+ fontDescriptor2.Weight = 100;
+ fontDescriptor5.Weight = 100;
+ fontDescriptor6.Weight = 150;
+ }
+ //build components
+ public void buildStep1()
+ {
+ optBusinessLetter = insertRadioButton("optBusinessLetter", OPTBUSINESSLETTER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 1), resources.resoptBusinessLetter_value, "optBusinessLetter", new Integer(97), new Integer(28), INTEGERS[1], new Short((short) 1), new Integer(184)
+ });
+ optPrivOfficialLetter = insertRadioButton("optPrivOfficialLetter", OPTPRIVOFFICIALLETTER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 2), resources.resoptPrivOfficialLetter_value, "optPrivOfficialLetter", new Integer(97), new Integer(74), INTEGERS[1], new Short((short) 2), new Integer(184)
+ });
+ optPrivateLetter = insertRadioButton("optPrivateLetter", OPTPRIVATELETTER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 3), resources.resoptPrivateLetter_value, "optPrivateLetter", new Integer(97), new Integer(106), INTEGERS[1], new Short((short) 3), new Integer(184)
+ });
+ lstBusinessStyle = insertListBox("lstBusinessStyle", LSTBUSINESSSTYLE_ACTION_PERFORMED, LSTBUSINESSSTYLE_ITEM_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + (HID + 4), "lstBusinessStyle", new Integer(180), INTEGER_40, INTEGERS[1], new Short((short) 4), new Integer(74)
+ });
+ chkBusinessPaper = insertCheckBox("chkBusinessPaper", CHKBUSINESSPAPER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 5), resources.reschkBusinessPaper_value, "chkBusinessPaper", new Integer(110), new Integer(56), new Short((short) 0), INTEGERS[1], new Short((short) 5), new Integer(168)
+ });
+ lstPrivOfficialStyle = insertListBox("lstPrivOfficialStyle", LSTPRIVOFFICIALSTYLE_ACTION_PERFORMED, LSTPRIVOFFICIALSTYLE_ITEM_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + (HID + 6), "lstPrivOfficialStyle", new Integer(180), new Integer(86), INTEGERS[1], new Short((short) 6), new Integer(74)
+ });
+ lstPrivateStyle = insertListBox("lstPrivateStyle", LSTPRIVATESTYLE_ACTION_PERFORMED, LSTPRIVATESTYLE_ITEM_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + (HID + 7), "lstPrivateStyle", new Integer(180), new Integer(118), INTEGERS[1], new Short((short) 7), new Integer(74)
+ });
+ lblBusinessStyle = insertLabel("lblBusinessStyle",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblBusinessStyle_value, "lblBusinessStyle", new Integer(110), new Integer(42), INTEGERS[1], new Short((short) 48), new Integer(60)
+ });
+ lblPrivOfficialStyle = insertLabel("lblPrivOfficialStyle",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblPrivOfficialStyle_value, "lblPrivOfficialStyle", new Integer(110), new Integer(88), INTEGERS[1], new Short((short) 49), new Integer(60)
+ });
+ lblTitle1 = insertLabel("lblTitle1",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor6, INTEGER_16, resources.reslblTitle1_value, Boolean.TRUE, "lblTitle1", new Integer(91), INTEGERS[8], INTEGERS[1], new Short((short) 55), new Integer(212)
+ });
+ lblPrivateStyle = insertLabel("lblPrivateStyle",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblPrivateStyle_value, "lblPrivateStyle", new Integer(110), new Integer(120), INTEGERS[1], new Short((short) 74), new Integer(60)
+ });
+ lblIntroduction = insertLabel("lblIntroduction",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(39), resources.reslblIntroduction_value, Boolean.TRUE, "lblIntroduction", new Integer(104), new Integer(145), INTEGERS[1], new Short((short) 80), new Integer(199)
+ });
+ ImageControl3 = insertInfoImage(92, 145, 1);
// ImageControl3 = insertImage("ImageControl3",
// new String[] {"Border", "Height", "ImageURL", "Name", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"},
// new Object[] { new Short((short)0), INTEGERS[10],"private:resource/dbu/image/19205","ImageControl3",new Integer(92),new Integer(145),Boolean.FALSE,INTEGERS[1],new Short((short)81),INTEGERS[10]}
// );
- }
-
- public void buildStep2() {
- chkPaperCompanyLogo = insertCheckBox("chkPaperCompanyLogo", CHKPAPERCOMPANYLOGO_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 8 ),resources.reschkPaperCompanyLogo_value,"chkPaperCompanyLogo",new Integer(97),new Integer(28),new Short((short)0),INTEGERS[2],new Short((short)8),new Integer(68)}
- );
- numLogoHeight = insertNumericField("numLogoHeight", NUMLOGOHEIGHT_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "StrictFormat", "TabIndex", "Value", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 9 ),"numLogoHeight",new Integer(138),INTEGER_40,Boolean.TRUE,INTEGERS[2],Boolean.TRUE,new Short((short)9),INTEGERS[3],new Integer(30)}
-
- );
- numLogoX = insertNumericField("numLogoX", NUMLOGOX_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 10 ),"numLogoX",new Integer(266),INTEGER_40,Boolean.TRUE,INTEGERS[2],new Short((short)10),INTEGERS[0],new Integer(30)}
- );
- numLogoWidth = insertNumericField("numLogoWidth", NUMLOGOWIDTH_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 11 ),"numLogoWidth",new Integer(138),new Integer(56),Boolean.TRUE,INTEGERS[2],new Short((short)11),new Double(3.8),new Integer(30)}
- );
- numLogoY = insertNumericField("numLogoY", NUMLOGOY_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 12 ),"numLogoY",new Integer(266),new Integer(56),Boolean.TRUE,INTEGERS[2],new Short((short)12),new Double(-3.4),new Integer(30)}
- );
- chkPaperCompanyAddress = insertCheckBox("chkPaperCompanyAddress", CHKPAPERCOMPANYADDRESS_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 13 ),resources.reschkPaperCompanyAddress_value,"chkPaperCompanyAddress",new Integer(98),new Integer(84),new Short((short)0),INTEGERS[2],new Short((short)13),new Integer(68)}
- );
- numAddressHeight = insertNumericField("numAddressHeight", NUMADDRESSHEIGHT_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "StrictFormat", "TabIndex", "Value", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 14 ),"numAddressHeight",new Integer(138),new Integer(96),Boolean.TRUE,INTEGERS[2],Boolean.TRUE,new Short((short)14),INTEGERS[3],new Integer(30)}
- );
- numAddressX = insertNumericField("numAddressX", NUMADDRESSX_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 15 ),"numAddressX",new Integer(266),new Integer(96),Boolean.TRUE,INTEGERS[2],new Short((short)15),new Double(3.8),new Integer(30)}
- );
- numAddressWidth = insertNumericField("numAddressWidth", NUMADDRESSWIDTH_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 16 ),"numAddressWidth",new Integer(138),new Integer(112),Boolean.TRUE,INTEGERS[2],new Short((short)16),new Double(13.8),new Integer(30)}
- );
- numAddressY = insertNumericField("numAddressY", NUMADDRESSY_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 17 ),"numAddressY",new Integer(266),new Integer(112),Boolean.TRUE,INTEGERS[2],new Short((short)17),new Double(-3.4),new Integer(30)}
- );
- chkCompanyReceiver = insertCheckBox("chkCompanyReceiver", CHKCOMPANYRECEIVER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 18 ),resources.reschkCompanyReceiver_value,"chkCompanyReceiver",new Integer(103),new Integer(131),new Short((short)0),INTEGERS[2],new Short((short)18),new Integer(185)}
- );
- chkPaperFooter = insertCheckBox("chkPaperFooter", CHKPAPERFOOTER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 19 ),resources.reschkPaperFooter_value,"chkPaperFooter",new Integer(97),new Integer(158),new Short((short)0),INTEGERS[2],new Short((short)19),new Integer(68)}
- );
- numFooterHeight = insertNumericField("numFooterHeight", NUMFOOTERHEIGHT_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 20 ),"numFooterHeight",new Integer(236),new Integer(156),Boolean.TRUE,INTEGERS[2],new Short((short)20),INTEGERS[5],new Integer(30)}
- );
- lblLogoHeight = insertLabel("lblLogoHeight",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblLogoHeight_value,"lblLogoHeight",new Integer(103),new Integer(42),INTEGERS[2],new Short((short)68),new Integer(32)}
- );
- lblLogoWidth = insertLabel("lblLogoWidth",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblLogoWidth_value,"lblLogoWidth",new Integer(103),new Integer(58),INTEGERS[2],new Short((short)69),new Integer(32)}
- );
- FixedLine5 = insertFixedLine("FixedLine5",
- new String[] {"Height", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[2],"FixedLine5",new Integer(90),new Integer(78),INTEGERS[2],new Short((short)70),new Integer(215)}
- );
- FixedLine6 = insertFixedLine("FixedLine6",
- new String[] {"Height", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[2],"FixedLine6",new Integer(90),new Integer(150),INTEGERS[2],new Short((short)71),new Integer(215)}
- );
- lblFooterHeight = insertLabel("lblFooterHeight",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblFooterHeight_value,"lblFooterHeight",new Integer(200),new Integer(158),INTEGERS[2],new Short((short)72),new Integer(32)}
- );
- lblLogoX = insertLabel("lblLogoX",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblLogoX_value,"lblLogoX",new Integer(170),new Integer(42),INTEGERS[2],new Short((short)84),new Integer(94)}
- );
- lblLogoY = insertLabel("lblLogoY",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblLogoY_value,"lblLogoY",new Integer(170),new Integer(58),INTEGERS[2],new Short((short)85),new Integer(94)}
- );
- lblAddressHeight = insertLabel("lblAddressHeight",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblAddressHeight_value,"lblAddressHeight",new Integer(103),new Integer(98),INTEGERS[2],new Short((short)86),new Integer(32)}
- );
- lblAddressWidth = insertLabel("lblAddressWidth",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblAddressWidth_value,"lblAddressWidth",new Integer(103),new Integer(114),INTEGERS[2],new Short((short)87),new Integer(32)}
- );
- lblAddressX = insertLabel("lblAddressX",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblAddressX_value,"lblAddressX",new Integer(170),new Integer(98),INTEGERS[2],new Short((short)88),new Integer(94)}
- );
- lblAddressY = insertLabel("lblAddressY",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblAddressY_value,"lblAddressY",new Integer(170),new Integer(114),INTEGERS[2],new Short((short)89),new Integer(94)}
- );
- lblTitle2 = insertLabel("lblTitle2",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor6,INTEGER_16,resources.reslblTitle2_value,Boolean.TRUE,"lblTitle2",new Integer(91),INTEGERS[8],INTEGERS[2],new Short((short)91),new Integer(212)}
- );
- }
+ }
- public void buildStep3() {
- lstLetterNorm = insertListBox("lstLetterNorm", LSTLETTERNORM_ACTION_PERFORMED,LSTLETTERNORM_ITEM_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,"HID:" + ( HID + 21 ),"lstLetterNorm",new Integer(210),new Integer(34),INTEGERS[3],new Short((short)21),new Integer(74)}
- );
- chkUseLogo = insertCheckBox("chkUseLogo", CHKUSELOGO_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 22 ),resources.reschkUseLogo_value,"chkUseLogo",new Integer(97),new Integer(54),new Short((short)0),INTEGERS[3],new Short((short)22),new Integer(212)}
- );
- chkUseAddressReceiver = insertCheckBox("chkUseAddressReceiver", CHKUSEADDRESSRECEIVER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 23 ),resources.reschkUseAddressReceiver_value,"chkUseAddressReceiver",new Integer(97),new Integer(69),new Short((short)0),INTEGERS[3],new Short((short)23),new Integer(212)}
- );
- chkUseSigns = insertCheckBox("chkUseSigns", CHKUSESIGNS_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 24 ),resources.reschkUseSigns_value,"chkUseSigns",new Integer(97),new Integer(82),new Short((short)0),INTEGERS[3],new Short((short)24),new Integer(212)}
- );
- chkUseSubject = insertCheckBox("chkUseSubject", CHKUSESUBJECT_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 25 ),resources.reschkUseSubject_value,"chkUseSubject",new Integer(97),new Integer(98),new Short((short)0),INTEGERS[3],new Short((short)25),new Integer(212)}
- );
- chkUseSalutation = insertCheckBox("chkUseSalutation", CHKUSESALUTATION_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 26 ),resources.reschkUseSalutation_value,"chkUseSalutation",new Integer(97),new Integer(113),new Short((short)0),INTEGERS[3],new Short((short)26),new Integer(66)}
- );
- lstSalutation = insertComboBox("lstSalutation", LSTSALUTATION_ACTION_PERFORMED,LSTSALUTATION_ITEM_CHANGED,LSTSALUTATION_TEXT_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,"HID:" + ( HID + 27 ),"lstSalutation",new Integer(210),new Integer(110),INTEGERS[3],new Short((short)27),new Integer(74)}
- );
- chkUseBendMarks = insertCheckBox("chkUseBendMarks", CHKUSEBENDMARKS_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 28 ),resources.reschkUseBendMarks_value,"chkUseBendMarks",new Integer(97),new Integer(127),new Short((short)0),INTEGERS[3],new Short((short)28),new Integer(212)}
- );
- chkUseGreeting = insertCheckBox("chkUseGreeting", CHKUSEGREETING_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 29 ),resources.reschkUseGreeting_value,"chkUseGreeting",new Integer(97),new Integer(142),new Short((short)0),INTEGERS[3],new Short((short)29),new Integer(66)}
- );
- lstGreeting = insertComboBox("lstGreeting", LSTGREETING_ACTION_PERFORMED,LSTGREETING_ITEM_CHANGED,LSTGREETING_TEXT_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12,"HID:" + ( HID + 30 ),"lstGreeting",new Integer(210),new Integer(141),INTEGERS[3],new Short((short)30),new Integer(74)}
- );
- chkUseFooter = insertCheckBox("chkUseFooter", CHKUSEFOOTER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 31 ),resources.reschkUseFooter_value,"chkUseFooter",new Integer(97),new Integer(158),new Short((short)0),INTEGERS[3],new Short((short)31),new Integer(212)}
- );
- lblLetterNorm = insertLabel("lblLetterNorm",
- new String[] {"Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_16,resources.reslblLetterNorm_value,Boolean.TRUE,"lblLetterNorm",new Integer(97),new Integer(28),INTEGERS[3],new Short((short)50),new Integer(109)}
- );
- lblTitle3 = insertLabel("lblTitle3",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor6,INTEGER_16,resources.reslblTitle3_value,Boolean.TRUE,"lblTitle3",new Integer(91),INTEGERS[8],INTEGERS[3],new Short((short)90),new Integer(212)}
- );
- }
+ public void buildStep2()
+ {
+ chkPaperCompanyLogo = insertCheckBox("chkPaperCompanyLogo", CHKPAPERCOMPANYLOGO_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 8), resources.reschkPaperCompanyLogo_value, "chkPaperCompanyLogo", new Integer(97), new Integer(28), new Short((short) 0), INTEGERS[2], new Short((short) 8), new Integer(68)
+ });
+ numLogoHeight = insertNumericField("numLogoHeight", NUMLOGOHEIGHT_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "StrictFormat", "TabIndex", "Value", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 9), "numLogoHeight", new Integer(138), INTEGER_40, Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 9), INTEGERS[3], new Integer(30)
+ });
+ numLogoX = insertNumericField("numLogoX", NUMLOGOX_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 10), "numLogoX", new Integer(266), INTEGER_40, Boolean.TRUE, INTEGERS[2], new Short((short) 10), INTEGERS[0], new Integer(30)
+ });
+ numLogoWidth = insertNumericField("numLogoWidth", NUMLOGOWIDTH_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 11), "numLogoWidth", new Integer(138), new Integer(56), Boolean.TRUE, INTEGERS[2], new Short((short) 11), new Double(3.8), new Integer(30)
+ });
+ numLogoY = insertNumericField("numLogoY", NUMLOGOY_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 12), "numLogoY", new Integer(266), new Integer(56), Boolean.TRUE, INTEGERS[2], new Short((short) 12), new Double(-3.4), new Integer(30)
+ });
+ chkPaperCompanyAddress = insertCheckBox("chkPaperCompanyAddress", CHKPAPERCOMPANYADDRESS_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 13), resources.reschkPaperCompanyAddress_value, "chkPaperCompanyAddress", new Integer(98), new Integer(84), new Short((short) 0), INTEGERS[2], new Short((short) 13), new Integer(68)
+ });
+ numAddressHeight = insertNumericField("numAddressHeight", NUMADDRESSHEIGHT_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "StrictFormat", "TabIndex", "Value", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 14), "numAddressHeight", new Integer(138), new Integer(96), Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 14), INTEGERS[3], new Integer(30)
+ });
+ numAddressX = insertNumericField("numAddressX", NUMADDRESSX_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 15), "numAddressX", new Integer(266), new Integer(96), Boolean.TRUE, INTEGERS[2], new Short((short) 15), new Double(3.8), new Integer(30)
+ });
+ numAddressWidth = insertNumericField("numAddressWidth", NUMADDRESSWIDTH_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 16), "numAddressWidth", new Integer(138), new Integer(112), Boolean.TRUE, INTEGERS[2], new Short((short) 16), new Double(13.8), new Integer(30)
+ });
+ numAddressY = insertNumericField("numAddressY", NUMADDRESSY_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 17), "numAddressY", new Integer(266), new Integer(112), Boolean.TRUE, INTEGERS[2], new Short((short) 17), new Double(-3.4), new Integer(30)
+ });
+ chkCompanyReceiver = insertCheckBox("chkCompanyReceiver", CHKCOMPANYRECEIVER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 18), resources.reschkCompanyReceiver_value, "chkCompanyReceiver", new Integer(103), new Integer(131), new Short((short) 0), INTEGERS[2], new Short((short) 18), new Integer(185)
+ });
+ chkPaperFooter = insertCheckBox("chkPaperFooter", CHKPAPERFOOTER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 19), resources.reschkPaperFooter_value, "chkPaperFooter", new Integer(97), new Integer(158), new Short((short) 0), INTEGERS[2], new Short((short) 19), new Integer(68)
+ });
+ numFooterHeight = insertNumericField("numFooterHeight", NUMFOOTERHEIGHT_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Spin", "Step", "TabIndex", "Value", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 20), "numFooterHeight", new Integer(236), new Integer(156), Boolean.TRUE, INTEGERS[2], new Short((short) 20), INTEGERS[5], new Integer(30)
+ });
+ lblLogoHeight = insertLabel("lblLogoHeight",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblLogoHeight_value, "lblLogoHeight", new Integer(103), new Integer(42), INTEGERS[2], new Short((short) 68), new Integer(32)
+ });
+ lblLogoWidth = insertLabel("lblLogoWidth",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblLogoWidth_value, "lblLogoWidth", new Integer(103), new Integer(58), INTEGERS[2], new Short((short) 69), new Integer(32)
+ });
+ FixedLine5 = insertFixedLine("FixedLine5",
+ new String[]
+ {
+ "Height", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[2], "FixedLine5", new Integer(90), new Integer(78), INTEGERS[2], new Short((short) 70), new Integer(215)
+ });
+ FixedLine6 = insertFixedLine("FixedLine6",
+ new String[]
+ {
+ "Height", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[2], "FixedLine6", new Integer(90), new Integer(150), INTEGERS[2], new Short((short) 71), new Integer(215)
+ });
+ lblFooterHeight = insertLabel("lblFooterHeight",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblFooterHeight_value, "lblFooterHeight", new Integer(200), new Integer(158), INTEGERS[2], new Short((short) 72), new Integer(32)
+ });
+ lblLogoX = insertLabel("lblLogoX",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblLogoX_value, "lblLogoX", new Integer(170), new Integer(42), INTEGERS[2], new Short((short) 84), new Integer(94)
+ });
+ lblLogoY = insertLabel("lblLogoY",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblLogoY_value, "lblLogoY", new Integer(170), new Integer(58), INTEGERS[2], new Short((short) 85), new Integer(94)
+ });
+ lblAddressHeight = insertLabel("lblAddressHeight",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblAddressHeight_value, "lblAddressHeight", new Integer(103), new Integer(98), INTEGERS[2], new Short((short) 86), new Integer(32)
+ });
+ lblAddressWidth = insertLabel("lblAddressWidth",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblAddressWidth_value, "lblAddressWidth", new Integer(103), new Integer(114), INTEGERS[2], new Short((short) 87), new Integer(32)
+ });
+ lblAddressX = insertLabel("lblAddressX",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblAddressX_value, "lblAddressX", new Integer(170), new Integer(98), INTEGERS[2], new Short((short) 88), new Integer(94)
+ });
+ lblAddressY = insertLabel("lblAddressY",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblAddressY_value, "lblAddressY", new Integer(170), new Integer(114), INTEGERS[2], new Short((short) 89), new Integer(94)
+ });
+ lblTitle2 = insertLabel("lblTitle2",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor6, INTEGER_16, resources.reslblTitle2_value, Boolean.TRUE, "lblTitle2", new Integer(91), INTEGERS[8], INTEGERS[2], new Short((short) 91), new Integer(212)
+ });
+ }
- public void buildStep4() {
- optSenderPlaceholder = insertRadioButton("optSenderPlaceholder", OPTSENDERPLACEHOLDER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 32 ),resources.resoptSenderPlaceholder_value,"optSenderPlaceholder",new Integer(104),new Integer(42),INTEGERS[4],new Short((short)32),new Integer(149)}
- );
- optSenderDefine = insertRadioButton("optSenderDefine", OPTSENDERDEFINE_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 33 ),resources.resoptSenderDefine_value,"optSenderDefine",new Integer(104),new Integer(54),INTEGERS[4],new Short((short)33),new Integer(149)}
- );
- txtSenderName = insertTextField("txtSenderName", TXTSENDERNAME_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 34 ),"txtSenderName",new Integer(182),new Integer(67),INTEGERS[4],new Short((short)34),new Integer(119)}
- );
- txtSenderStreet = insertTextField("txtSenderStreet", TXTSENDERSTREET_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 35 ),"txtSenderStreet",new Integer(182),new Integer(81),INTEGERS[4],new Short((short)35),new Integer(119)}
- );
- txtSenderPostCode = insertTextField("txtSenderPostCode", TXTSENDERPOSTCODE_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 36 ),"txtSenderPostCode",new Integer(182),new Integer(95),INTEGERS[4],new Short((short)36),new Integer(25)}
- );
- txtSenderState = insertTextField("txtSenderState", TXTSENDERSTATE_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 37 ),"txtSenderState",new Integer(211),new Integer(95),INTEGERS[4],new Short((short)37),new Integer(21)}
- );
- txtSenderCity = insertTextField("txtSenderCity", TXTSENDERCITY_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 38 ),"txtSenderCity",new Integer(236),new Integer(95),INTEGERS[4],new Short((short)38),new Integer(65)}
- );
- optReceiverPlaceholder = insertRadioButton("optReceiverPlaceholder", OPTRECEIVERPLACEHOLDER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 39 ),resources.resoptReceiverPlaceholder_value,"optReceiverPlaceholder",new Integer(104),new Integer(145),INTEGERS[4],new Short((short)39),new Integer(200)}
- );
- optReceiverDatabase = insertRadioButton("optReceiverDatabase", OPTRECEIVERDATABASE_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 40 ),resources.resoptReceiverDatabase_value,"optReceiverDatabase",new Integer(104),new Integer(157),INTEGERS[4],new Short((short)40),new Integer(200)}
- );
- lblSenderAddress = insertLabel("lblSenderAddress",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblSenderAddress_value,"lblSenderAddress",new Integer(97),new Integer(28),INTEGERS[4],new Short((short)64),new Integer(136)}
- );
- FixedLine2 = insertFixedLine("FixedLine2",
- new String[] {"Height", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[5],"FixedLine2",new Integer(90),new Integer(126),INTEGERS[4],new Short((short)75),new Integer(212)}
- );
- lblReceiverAddress = insertLabel("lblReceiverAddress",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblReceiverAddress_value,"lblReceiverAddress",new Integer(97),new Integer(134),INTEGERS[4],new Short((short)76),new Integer(136)}
- );
- lblSenderName = insertLabel("lblSenderName",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblSenderName_value,"lblSenderName",new Integer(113),new Integer(69),INTEGERS[4],new Short((short)77),new Integer(68)}
- );
- lblSenderStreet = insertLabel("lblSenderStreet",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblSenderStreet_value,"lblSenderStreet",new Integer(113),new Integer(82),INTEGERS[4],new Short((short)78),new Integer(68)}
- );
- lblPostCodeCity = insertLabel("lblPostCodeCity",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblPostCodeCity_value,"lblPostCodeCity",new Integer(113),new Integer(97),INTEGERS[4],new Short((short)79),new Integer(68)}
- );
- lblTitle4 = insertLabel("lblTitle4",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor6,INTEGER_16,resources.reslblTitle4_value,Boolean.TRUE,"lblTitle4",new Integer(91),INTEGERS[8],INTEGERS[4],new Short((short)92),new Integer(212)}
- );
- }
+ public void buildStep3()
+ {
+ lstLetterNorm = insertListBox("lstLetterNorm", LSTLETTERNORM_ACTION_PERFORMED, LSTLETTERNORM_ITEM_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + (HID + 21), "lstLetterNorm", new Integer(210), new Integer(34), INTEGERS[3], new Short((short) 21), new Integer(74)
+ });
+ chkUseLogo = insertCheckBox("chkUseLogo", CHKUSELOGO_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 22), resources.reschkUseLogo_value, "chkUseLogo", new Integer(97), new Integer(54), new Short((short) 0), INTEGERS[3], new Short((short) 22), new Integer(212)
+ });
+ chkUseAddressReceiver = insertCheckBox("chkUseAddressReceiver", CHKUSEADDRESSRECEIVER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 23), resources.reschkUseAddressReceiver_value, "chkUseAddressReceiver", new Integer(97), new Integer(69), new Short((short) 0), INTEGERS[3], new Short((short) 23), new Integer(212)
+ });
+ chkUseSigns = insertCheckBox("chkUseSigns", CHKUSESIGNS_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 24), resources.reschkUseSigns_value, "chkUseSigns", new Integer(97), new Integer(82), new Short((short) 0), INTEGERS[3], new Short((short) 24), new Integer(212)
+ });
+ chkUseSubject = insertCheckBox("chkUseSubject", CHKUSESUBJECT_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 25), resources.reschkUseSubject_value, "chkUseSubject", new Integer(97), new Integer(98), new Short((short) 0), INTEGERS[3], new Short((short) 25), new Integer(212)
+ });
+ chkUseSalutation = insertCheckBox("chkUseSalutation", CHKUSESALUTATION_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 26), resources.reschkUseSalutation_value, "chkUseSalutation", new Integer(97), new Integer(113), new Short((short) 0), INTEGERS[3], new Short((short) 26), new Integer(66)
+ });
+ lstSalutation = insertComboBox("lstSalutation", LSTSALUTATION_ACTION_PERFORMED, LSTSALUTATION_ITEM_CHANGED, LSTSALUTATION_TEXT_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + (HID + 27), "lstSalutation", new Integer(210), new Integer(110), INTEGERS[3], new Short((short) 27), new Integer(74)
+ });
+ chkUseBendMarks = insertCheckBox("chkUseBendMarks", CHKUSEBENDMARKS_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 28), resources.reschkUseBendMarks_value, "chkUseBendMarks", new Integer(97), new Integer(127), new Short((short) 0), INTEGERS[3], new Short((short) 28), new Integer(212)
+ });
+ chkUseGreeting = insertCheckBox("chkUseGreeting", CHKUSEGREETING_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 29), resources.reschkUseGreeting_value, "chkUseGreeting", new Integer(97), new Integer(142), new Short((short) 0), INTEGERS[3], new Short((short) 29), new Integer(66)
+ });
+ lstGreeting = insertComboBox("lstGreeting", LSTGREETING_ACTION_PERFORMED, LSTGREETING_ITEM_CHANGED, LSTGREETING_TEXT_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + (HID + 30), "lstGreeting", new Integer(210), new Integer(141), INTEGERS[3], new Short((short) 30), new Integer(74)
+ });
+ chkUseFooter = insertCheckBox("chkUseFooter", CHKUSEFOOTER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 31), resources.reschkUseFooter_value, "chkUseFooter", new Integer(97), new Integer(158), new Short((short) 0), INTEGERS[3], new Short((short) 31), new Integer(212)
+ });
+ lblLetterNorm = insertLabel("lblLetterNorm",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_16, resources.reslblLetterNorm_value, Boolean.TRUE, "lblLetterNorm", new Integer(97), new Integer(28), INTEGERS[3], new Short((short) 50), new Integer(109)
+ });
+ lblTitle3 = insertLabel("lblTitle3",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor6, INTEGER_16, resources.reslblTitle3_value, Boolean.TRUE, "lblTitle3", new Integer(91), INTEGERS[8], INTEGERS[3], new Short((short) 90), new Integer(212)
+ });
+ }
- public void buildStep5() {
- txtFooter = insertTextField("txtFooter", TXTFOOTER_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(47),"HID:" + ( HID + 41 ),Boolean.TRUE,"txtFooter",new Integer(97),INTEGER_40,INTEGERS[5],new Short((short)41),new Integer(203)}
- );
- chkFooterNextPages = insertCheckBox("chkFooterNextPages", CHKFOOTERNEXTPAGES_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 42 ),resources.reschkFooterNextPages_value,"chkFooterNextPages",new Integer(97),new Integer(92),new Short((short)0),INTEGERS[5],new Short((short)42),new Integer(202)}
- );
- chkFooterPageNumbers = insertCheckBox("chkFooterPageNumbers", CHKFOOTERPAGENUMBERS_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 43 ),resources.reschkFooterPageNumbers_value,"chkFooterPageNumbers",new Integer(97),new Integer(106),new Short((short)0),INTEGERS[5],new Short((short)43),new Integer(201)}
- );
- lblFooter = insertLabel("lblFooter",
- new String[] {"FontDescriptor", "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor5,INTEGERS[8],resources.reslblFooter_value,"lblFooter",new Integer(97),new Integer(28),INTEGERS[5],new Short((short)52),new Integer(116)}
- );
- lblTitle5 = insertLabel("lblTitle5",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor6,INTEGER_16,resources.reslblTitle5_value,Boolean.TRUE,"lblTitle5",new Integer(91),INTEGERS[8],INTEGERS[5],new Short((short)93),new Integer(212)}
- );
- }
+ public void buildStep4()
+ {
+ optSenderPlaceholder = insertRadioButton("optSenderPlaceholder", OPTSENDERPLACEHOLDER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 32), resources.resoptSenderPlaceholder_value, "optSenderPlaceholder", new Integer(104), new Integer(42), INTEGERS[4], new Short((short) 32), new Integer(149)
+ });
+ optSenderDefine = insertRadioButton("optSenderDefine", OPTSENDERDEFINE_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 33), resources.resoptSenderDefine_value, "optSenderDefine", new Integer(104), new Integer(54), INTEGERS[4], new Short((short) 33), new Integer(149)
+ });
+ txtSenderName = insertTextField("txtSenderName", TXTSENDERNAME_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 34), "txtSenderName", new Integer(182), new Integer(67), INTEGERS[4], new Short((short) 34), new Integer(119)
+ });
+ txtSenderStreet = insertTextField("txtSenderStreet", TXTSENDERSTREET_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 35), "txtSenderStreet", new Integer(182), new Integer(81), INTEGERS[4], new Short((short) 35), new Integer(119)
+ });
+ txtSenderPostCode = insertTextField("txtSenderPostCode", TXTSENDERPOSTCODE_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 36), "txtSenderPostCode", new Integer(182), new Integer(95), INTEGERS[4], new Short((short) 36), new Integer(25)
+ });
+ txtSenderState = insertTextField("txtSenderState", TXTSENDERSTATE_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 37), "txtSenderState", new Integer(211), new Integer(95), INTEGERS[4], new Short((short) 37), new Integer(21)
+ });
+ txtSenderCity = insertTextField("txtSenderCity", TXTSENDERCITY_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 38), "txtSenderCity", new Integer(236), new Integer(95), INTEGERS[4], new Short((short) 38), new Integer(65)
+ });
+ optReceiverPlaceholder = insertRadioButton("optReceiverPlaceholder", OPTRECEIVERPLACEHOLDER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 39), resources.resoptReceiverPlaceholder_value, "optReceiverPlaceholder", new Integer(104), new Integer(145), INTEGERS[4], new Short((short) 39), new Integer(200)
+ });
+ optReceiverDatabase = insertRadioButton("optReceiverDatabase", OPTRECEIVERDATABASE_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 40), resources.resoptReceiverDatabase_value, "optReceiverDatabase", new Integer(104), new Integer(157), INTEGERS[4], new Short((short) 40), new Integer(200)
+ });
+ lblSenderAddress = insertLabel("lblSenderAddress",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSenderAddress_value, "lblSenderAddress", new Integer(97), new Integer(28), INTEGERS[4], new Short((short) 64), new Integer(136)
+ });
+ FixedLine2 = insertFixedLine("FixedLine2",
+ new String[]
+ {
+ "Height", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[5], "FixedLine2", new Integer(90), new Integer(126), INTEGERS[4], new Short((short) 75), new Integer(212)
+ });
+ lblReceiverAddress = insertLabel("lblReceiverAddress",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblReceiverAddress_value, "lblReceiverAddress", new Integer(97), new Integer(134), INTEGERS[4], new Short((short) 76), new Integer(136)
+ });
+ lblSenderName = insertLabel("lblSenderName",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSenderName_value, "lblSenderName", new Integer(113), new Integer(69), INTEGERS[4], new Short((short) 77), new Integer(68)
+ });
+ lblSenderStreet = insertLabel("lblSenderStreet",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSenderStreet_value, "lblSenderStreet", new Integer(113), new Integer(82), INTEGERS[4], new Short((short) 78), new Integer(68)
+ });
+ lblPostCodeCity = insertLabel("lblPostCodeCity",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblPostCodeCity_value, "lblPostCodeCity", new Integer(113), new Integer(97), INTEGERS[4], new Short((short) 79), new Integer(68)
+ });
+ lblTitle4 = insertLabel("lblTitle4",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor6, INTEGER_16, resources.reslblTitle4_value, Boolean.TRUE, "lblTitle4", new Integer(91), INTEGERS[8], INTEGERS[4], new Short((short) 92), new Integer(212)
+ });
+ }
- public void buildStep6() {
- txtTemplateName = insertTextField("txtTemplateName", TXTTEMPLATENAME_TEXT_CHANGED,
- new String[] {"Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"},
- new Object[] { INTEGER_12,"HID:" + ( HID + 44 ),"txtTemplateName",new Integer(202),new Integer(56),INTEGERS[6],new Short((short)44),resources.restxtTemplateName_value,new Integer(100)}
- );
- optCreateLetter = insertRadioButton("optCreateLetter", OPTCREATELETTER_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 45 ),resources.resoptCreateLetter_value,"optCreateLetter",new Integer(104),new Integer(111),INTEGERS[6],new Short((short)50),new Integer(198)}
- );
- optMakeChanges = insertRadioButton("optMakeChanges", OPTMAKECHANGES_ITEM_CHANGED,
- new String[] {"Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],"HID:" + ( HID + 46 ),resources.resoptMakeChanges_value,"optMakeChanges",new Integer(104),new Integer(123),INTEGERS[6],new Short((short)51),new Integer(198)}
- );
- lblFinalExplanation1 = insertLabel("lblFinalExplanation1",
- new String[] {"Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(26),resources.reslblFinalExplanation1_value,Boolean.TRUE,"lblFinalExplanation1",new Integer(97),new Integer(28),INTEGERS[6],new Short((short)52),new Integer(205)}
- );
- lblProceed = insertLabel("lblProceed",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblProceed_value,"lblProceed",new Integer(97),new Integer(100),INTEGERS[6],new Short((short)53),new Integer(204)}
- );
- lblFinalExplanation2 = insertLabel("lblFinalExplanation2",
- new String[] {"Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(33),resources.reslblFinalExplanation2_value,Boolean.TRUE,"lblFinalExplanation2",new Integer(104),new Integer(145),INTEGERS[6],new Short((short)54),new Integer(199)}
- );
- ImageControl2 = insertImage("ImageControl2",
- new String[] {"Border", "Height", "ImageURL", "Name", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"},
- new Object[] { new Short((short)0),INTEGERS[10],"private:resource/dbu/image/19205","ImageControl2",new Integer(92),new Integer(145),Boolean.FALSE,INTEGERS[6],new Short((short)66),INTEGERS[10]}
- );
- lblTemplateName = insertLabel("lblTemplateName",
- new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblTemplateName_value,"lblTemplateName",new Integer(97),new Integer(58),INTEGERS[6],new Short((short)82),new Integer(101)}
- );
- lblTitle6 = insertLabel("lblTitle6",
- new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor6,INTEGER_16,resources.reslblTitle6_value,Boolean.TRUE,"lblTitle6",new Integer(91),INTEGERS[8],INTEGERS[6],new Short((short)94),new Integer(212)}
- );
+ public void buildStep5()
+ {
+ txtFooter = insertTextField("txtFooter", TXTFOOTER_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(47), "HID:" + (HID + 41), Boolean.TRUE, "txtFooter", new Integer(97), INTEGER_40, INTEGERS[5], new Short((short) 41), new Integer(203)
+ });
+ chkFooterNextPages = insertCheckBox("chkFooterNextPages", CHKFOOTERNEXTPAGES_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 42), resources.reschkFooterNextPages_value, "chkFooterNextPages", new Integer(97), new Integer(92), new Short((short) 0), INTEGERS[5], new Short((short) 42), new Integer(202)
+ });
+ chkFooterPageNumbers = insertCheckBox("chkFooterPageNumbers", CHKFOOTERPAGENUMBERS_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 43), resources.reschkFooterPageNumbers_value, "chkFooterPageNumbers", new Integer(97), new Integer(106), new Short((short) 0), INTEGERS[5], new Short((short) 43), new Integer(201)
+ });
+ lblFooter = insertLabel("lblFooter",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor5, INTEGERS[8], resources.reslblFooter_value, "lblFooter", new Integer(97), new Integer(28), INTEGERS[5], new Short((short) 52), new Integer(116)
+ });
+ lblTitle5 = insertLabel("lblTitle5",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor6, INTEGER_16, resources.reslblTitle5_value, Boolean.TRUE, "lblTitle5", new Integer(91), INTEGERS[8], INTEGERS[5], new Short((short) 93), new Integer(212)
+ });
+ }
- }
+ public void buildStep6()
+ {
+ txtTemplateName = insertTextField("txtTemplateName", TXTTEMPLATENAME_TEXT_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + (HID + 44), "txtTemplateName", new Integer(202), new Integer(56), INTEGERS[6], new Short((short) 44), resources.restxtTemplateName_value, new Integer(100)
+ });
+ optCreateLetter = insertRadioButton("optCreateLetter", OPTCREATELETTER_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 45), resources.resoptCreateLetter_value, "optCreateLetter", new Integer(104), new Integer(111), INTEGERS[6], new Short((short) 50), new Integer(198)
+ });
+ optMakeChanges = insertRadioButton("optMakeChanges", OPTMAKECHANGES_ITEM_CHANGED,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + (HID + 46), resources.resoptMakeChanges_value, "optMakeChanges", new Integer(104), new Integer(123), INTEGERS[6], new Short((short) 51), new Integer(198)
+ });
+ lblFinalExplanation1 = insertLabel("lblFinalExplanation1",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(26), resources.reslblFinalExplanation1_value, Boolean.TRUE, "lblFinalExplanation1", new Integer(97), new Integer(28), INTEGERS[6], new Short((short) 52), new Integer(205)
+ });
+ lblProceed = insertLabel("lblProceed",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblProceed_value, "lblProceed", new Integer(97), new Integer(100), INTEGERS[6], new Short((short) 53), new Integer(204)
+ });
+ lblFinalExplanation2 = insertLabel("lblFinalExplanation2",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(33), resources.reslblFinalExplanation2_value, Boolean.TRUE, "lblFinalExplanation2", new Integer(104), new Integer(145), INTEGERS[6], new Short((short) 54), new Integer(199)
+ });
+ ImageControl2 = insertImage("ImageControl2",
+ new String[]
+ {
+ "Border", "Height", "ImageURL", "Name", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Short((short) 0), INTEGERS[10], "private:resource/dbu/image/19205", "ImageControl2", new Integer(92), new Integer(145), Boolean.FALSE, INTEGERS[6], new Short((short) 66), INTEGERS[10]
+ });
+ lblTemplateName = insertLabel("lblTemplateName",
+ new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblTemplateName_value, "lblTemplateName", new Integer(97), new Integer(58), INTEGERS[6], new Short((short) 82), new Integer(101)
+ });
+ lblTitle6 = insertLabel("lblTitle6",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor6, INTEGER_16, resources.reslblTitle6_value, Boolean.TRUE, "lblTitle6", new Integer(91), INTEGERS[8], INTEGERS[6], new Short((short) 94), new Integer(212)
+ });
+ }
} \ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java
index 3d85953f1443..74aec498b10a 100755
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java
@@ -1,5 +1,39 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LetterWizardDialogConst.java,v $
+ *
+ * $Revision: 1.4.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
-public interface LetterWizardDialogConst {
+
+public interface LetterWizardDialogConst
+{
+
public static final String OPTBUSINESSLETTER_ITEM_CHANGED = "optBusinessLetterItemChanged";
public static final String OPTPRIVOFFICIALLETTER_ITEM_CHANGED = "optPrivOfficialLetterItemChanged";
public static final String OPTPRIVATELETTER_ITEM_CHANGED = "optPrivateLetterItemChanged";
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java
index 0e1256afb83a..d81bd4b1d06b 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java
@@ -1,6 +1,39 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LetterWizardDialogEvents.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
-public interface LetterWizardDialogEvents {
+public interface LetterWizardDialogEvents
+{
+
public static final String OPTBUSINESSLETTER_ITEM_CHANGED = null;
public static final String OPTPRIVOFFICIALLETTER_ITEM_CHANGED = null;
public static final String OPTPRIVATELETTER_ITEM_CHANGED = null;
@@ -57,5 +90,4 @@ public interface LetterWizardDialogEvents {
public static final String imageURLImageControl1 = "images/ImageControl1";
public static final String imageURLImageControl2 = "images/ImageControl2";
public static final String imageURLImageControl3 = "images/ImageControl3";
-
}
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
index 3f689dc2bf42..aac291740eda 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LetterWizardDialogImpl.java,v $
+ *
+ * $Revision: 1.19.36.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
import java.util.Vector;
@@ -34,32 +65,31 @@ import com.sun.star.wizards.ui.*;
import com.sun.star.wizards.ui.event.*;
import com.sun.star.wizards.common.Helper;
+public class LetterWizardDialogImpl extends LetterWizardDialog
+{
-public class LetterWizardDialogImpl extends LetterWizardDialog {
-
-protected void enterStep(int OldStep, int NewStep){}
-protected void leaveStep(int OldStep, int NewStep){}
+ protected void enterStep(int OldStep, int NewStep)
+ {
+ }
+ protected void leaveStep(int OldStep, int NewStep)
+ {
+ }
static LetterDocument myLetterDoc;
static boolean running;
-
XMultiServiceFactory xmsf;
-
XTextDocument xTextDocument;
PathSelection myPathSelection;
-
CGLetterWizard myConfig;
Vector mainDA = new Vector();
Vector letterDA = new Vector();
Vector businessDA = new Vector();
-
String[][] BusinessFiles;
String[][] OfficialFiles;
String[][] PrivateFiles;
String[] Norms;
- String[] NormPaths;
+ String[] NormPaths;
String[] NormNames;
-
String sTemplatePath;
String sUserTemplatePath;
String sBitmapPath;
@@ -71,12 +101,10 @@ protected void leaveStep(int OldStep, int NewStep){}
boolean bEditTemplate;
boolean bSaveSuccess = false;
private boolean filenameChanged = false;
-
LetterDocument.BusinessPaperObject BusCompanyLogo = null;
LetterDocument.BusinessPaperObject BusCompanyAddress = null;
LetterDocument.BusinessPaperObject BusCompanyAddressReceiver = null;
LetterDocument.BusinessPaperObject BusFooter = null;
-
final static int RM_TYPESTYLE = 1;
final static int RM_BUSINESSPAPER = 2;
final static int RM_ELEMENTS = 3;
@@ -84,31 +112,40 @@ protected void leaveStep(int OldStep, int NewStep){}
final static int RM_FOOTER = 5;
final static int RM_FINALSETTINGS = 6;
- public LetterWizardDialogImpl(XMultiServiceFactory xmsf) {
+ public LetterWizardDialogImpl(XMultiServiceFactory xmsf)
+ {
super(xmsf);
this.xmsf = xmsf;
}
- public static void main(String args[]) {
+ public static void main(String args[])
+ {
//only being called when starting wizard remotely
- String ConnectStr = "uno:socket,host=127.0.0.1,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
- XMultiServiceFactory xLocMSF = null;
- try {
- xLocMSF = Desktop.connect(ConnectStr);
- } catch (Exception e) {
- e.printStackTrace();
- } catch (java.lang.Exception e) {
- e.printStackTrace();
- }
- LetterWizardDialogImpl lw = new LetterWizardDialogImpl(xLocMSF);
- lw.startWizard(xLocMSF, null);
+ String ConnectStr = "uno:socket,host=127.0.0.1,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
+ XMultiServiceFactory xLocMSF = null;
+ try
+ {
+ xLocMSF = Desktop.connect(ConnectStr);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ catch (java.lang.Exception e)
+ {
+ e.printStackTrace();
+ }
+ LetterWizardDialogImpl lw = new LetterWizardDialogImpl(xLocMSF);
+ lw.startWizard(xLocMSF, null);
}
- public void startWizard(XMultiServiceFactory xMSF, Object[] CurPropertyValue) {
+ public void startWizard(XMultiServiceFactory xMSF, Object[] CurPropertyValue)
+ {
running = true;
- try {
+ try
+ {
//Number of steps on WizardDialog:
setMaxStep(6);
@@ -143,29 +180,38 @@ protected void leaveStep(int OldStep, int NewStep){}
myConfig.cp_PrivateLetter.cp_Norm = oL;
initializeTemplates(xMSF);
- if (myConfig.cp_BusinessLetter.cp_Greeting.equals("")){
+ if (myConfig.cp_BusinessLetter.cp_Greeting.equals(""))
+ {
myConfig.cp_BusinessLetter.cp_Greeting = resources.GreetingLabels[0];
}
- if (myConfig.cp_BusinessLetter.cp_Salutation.equals("")){
+ if (myConfig.cp_BusinessLetter.cp_Salutation.equals(""))
+ {
myConfig.cp_BusinessLetter.cp_Salutation = resources.SalutationLabels[0];
}
- if (myConfig.cp_PrivateOfficialLetter.cp_Greeting.equals("")){
+ if (myConfig.cp_PrivateOfficialLetter.cp_Greeting.equals(""))
+ {
myConfig.cp_PrivateOfficialLetter.cp_Greeting = resources.GreetingLabels[1];
}
- if (myConfig.cp_PrivateOfficialLetter.cp_Salutation.equals("")){
+ if (myConfig.cp_PrivateOfficialLetter.cp_Salutation.equals(""))
+ {
myConfig.cp_PrivateOfficialLetter.cp_Salutation = resources.SalutationLabels[1];
}
- if (myConfig.cp_PrivateLetter.cp_Greeting.equals("")){
+ if (myConfig.cp_PrivateLetter.cp_Greeting.equals(""))
+ {
myConfig.cp_PrivateLetter.cp_Greeting = resources.GreetingLabels[2];
}
- if (myConfig.cp_PrivateLetter.cp_Salutation.equals("")){
+ if (myConfig.cp_PrivateLetter.cp_Salutation.equals(""))
+ {
myConfig.cp_PrivateLetter.cp_Salutation = resources.SalutationLabels[2];
}
//update the dialog UI according to the loaded Configuration
updateUI();
- if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ {
+ myPathSelection.initializePath();
+ }
XWindow xContainerWindow = myLetterDoc.xFrame.getContainerWindow();
XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
@@ -191,27 +237,32 @@ protected void leaveStep(int OldStep, int NewStep){}
closeDocument();
running = false;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
removeTerminateListener();
exception.printStackTrace(System.out);
- running=false;
+ running = false;
return;
}
}
-
- public void cancelWizard() {
+ public void cancelWizard()
+ {
xDialog.endExecute();
running = false;
}
- public void finishWizard() {
- switchToStep(getCurrentStep(),getMaxStep());
- try {
+ public void finishWizard()
+ {
+ switchToStep(getCurrentStep(), getMaxStep());
+ try
+ {
//myLetterDoc.xTextDocument.lockControllers();
FileAccess fileAccess = new FileAccess(xMSF);
sPath = myPathSelection.getSelectedPath();
- if (sPath.equals("")) {
+ if (sPath.equals(""))
+ {
myPathSelection.triggerPathPicker();
sPath = myPathSelection.getSelectedPath();
}
@@ -221,27 +272,36 @@ protected void leaveStep(int OldStep, int NewStep){}
//it is coming from a saved session, check if the
// file exists and warn the user.
if (!filenameChanged)
- if (fileAccess.exists(sPath, true)) {
+ {
+ if (fileAccess.exists(sPath, true))
+ {
int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resOverwriteWarning);
if (answer == 3) // user said: no, do not overwrite....
+ {
return;
+ }
}
+ }
myLetterDoc.setWizardTemplateDocInfo(resources.resLetterWizardDialog_title, resources.resTemplateDescription);
myLetterDoc.killEmptyUserFields();
myLetterDoc.keepLogoFrame = (chkUseLogo.getState() != 0);
- if ((chkBusinessPaper.getState() != 0) && (chkPaperCompanyLogo.getState() !=0)) {
+ if ((chkBusinessPaper.getState() != 0) && (chkPaperCompanyLogo.getState() != 0))
+ {
myLetterDoc.keepLogoFrame = false;
}
myLetterDoc.keepBendMarksFrame = (chkUseBendMarks.getState() != 0);
myLetterDoc.keepLetterSignsFrame = (chkUseSigns.getState() != 0);
myLetterDoc.keepSenderAddressRepeatedFrame = (chkUseAddressReceiver.getState() != 0);
- if (optBusinessLetter.getState()) {
- if ((chkBusinessPaper.getState() != 0) && (chkCompanyReceiver.getState() !=0)) {
+ if (optBusinessLetter.getState())
+ {
+ if ((chkBusinessPaper.getState() != 0) && (chkCompanyReceiver.getState() != 0))
+ {
myLetterDoc.keepSenderAddressRepeatedFrame = false;
}
- if ((chkBusinessPaper.getState() != 0) && (chkPaperCompanyAddress.getState() !=0)) {
+ if ((chkBusinessPaper.getState() != 0) && (chkPaperCompanyAddress.getState() != 0))
+ {
myLetterDoc.keepAddressFrame = false;
}
}
@@ -251,7 +311,8 @@ protected void leaveStep(int OldStep, int NewStep){}
bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath, "writer8_template", false, "Template could not be saved to " + sPath);
- if (bSaveSuccess) {
+ if (bSaveSuccess)
+ {
saveConfiguration();
XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
PropertyValue loadValues[] = new PropertyValue[4];
@@ -259,17 +320,20 @@ protected void leaveStep(int OldStep, int NewStep){}
loadValues[0].Name = "AsTemplate";
loadValues[1] = new PropertyValue();
loadValues[1].Name = "MacroExecutionMode";
- loadValues[1].Value = new Short (MacroExecMode.ALWAYS_EXECUTE);
+ loadValues[1].Value = new Short(MacroExecMode.ALWAYS_EXECUTE);
loadValues[2] = new PropertyValue();
loadValues[2].Name = "UpdateDocMode";
- loadValues[2].Value = new Short (com.sun.star.document.UpdateDocMode.FULL_UPDATE);
+ loadValues[2].Value = new Short(com.sun.star.document.UpdateDocMode.FULL_UPDATE);
loadValues[3] = new PropertyValue();
loadValues[3].Name = "InteractionHandler";
loadValues[3].Value = xIH;
- if (bEditTemplate) {
+ if (bEditTemplate)
+ {
loadValues[0].Value = Boolean.FALSE;
- } else {
+ }
+ else
+ {
loadValues[0].Value = Boolean.TRUE;
}
Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), sPath, "_default", loadValues);
@@ -277,31 +341,41 @@ protected void leaveStep(int OldStep, int NewStep){}
XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
ViewHandler myViewHandler = new ViewHandler(xDocMSF, xTextDocument);
myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.OPTIMAL));
- } else {
+ }
+ else
+ {
//TODO: Error Handling
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
- finally {
+ finally
+ {
xDialog.endExecute();
running = false;
}
}
- public void closeDocument() {
- try {
+ public void closeDocument()
+ {
+ try
+ {
//xComponent.dispose();
XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myLetterDoc.xFrame);
xCloseable.close(false);
- } catch (CloseVetoException e) {
+ }
+ catch (CloseVetoException e)
+ {
e.printStackTrace();
}
}
- public void optBusinessLetterItemChanged() {
- DataAware.setDataObject(letterDA,myConfig.cp_BusinessLetter,true);
+ public void optBusinessLetterItemChanged()
+ {
+ DataAware.setDataObject(letterDA, myConfig.cp_BusinessLetter, true);
setControlProperty("lblBusinessStyle", "Enabled", Boolean.TRUE);
setControlProperty("lstBusinessStyle", "Enabled", Boolean.TRUE);
setControlProperty("chkBusinessPaper", "Enabled", Boolean.TRUE);
@@ -312,11 +386,15 @@ protected void leaveStep(int OldStep, int NewStep){}
lstBusinessStyleItemChanged();
enableSenderReceiver();
setPossibleFooter(true);
- if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ {
+ myPathSelection.initializePath();
+ }
}
- public void optPrivOfficialLetterItemChanged() {
- DataAware.setDataObject(letterDA,myConfig.cp_PrivateOfficialLetter,true);
+ public void optPrivOfficialLetterItemChanged()
+ {
+ DataAware.setDataObject(letterDA, myConfig.cp_PrivateOfficialLetter, true);
setControlProperty("lblBusinessStyle", "Enabled", Boolean.FALSE);
setControlProperty("lstBusinessStyle", "Enabled", Boolean.FALSE);
setControlProperty("chkBusinessPaper", "Enabled", Boolean.FALSE);
@@ -328,11 +406,15 @@ protected void leaveStep(int OldStep, int NewStep){}
disableBusinessPaper();
enableSenderReceiver();
setPossibleFooter(true);
- if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ {
+ myPathSelection.initializePath();
+ }
}
- public void optPrivateLetterItemChanged() {
- DataAware.setDataObject(letterDA,myConfig.cp_PrivateLetter,true);
+ public void optPrivateLetterItemChanged()
+ {
+ DataAware.setDataObject(letterDA, myConfig.cp_PrivateLetter, true);
setControlProperty("lblBusinessStyle", "Enabled", Boolean.FALSE);
setControlProperty("lstBusinessStyle", "Enabled", Boolean.FALSE);
setControlProperty("chkBusinessPaper", "Enabled", Boolean.FALSE);
@@ -344,10 +426,14 @@ protected void leaveStep(int OldStep, int NewStep){}
disableBusinessPaper();
disableSenderReceiver();
setPossibleFooter(false);
- if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ {
+ myPathSelection.initializePath();
+ }
}
- public void optSenderPlaceholderItemChanged() {
+ public void optSenderPlaceholderItemChanged()
+ {
setControlProperty("lblSenderName", "Enabled", Boolean.FALSE);
setControlProperty("lblSenderStreet", "Enabled", Boolean.FALSE);
setControlProperty("lblPostCodeCity", "Enabled", Boolean.FALSE);
@@ -359,7 +445,8 @@ protected void leaveStep(int OldStep, int NewStep){}
myLetterDoc.fillSenderWithUserData();
}
- public void optSenderDefineItemChanged() {
+ public void optSenderDefineItemChanged()
+ {
setControlProperty("lblSenderName", "Enabled", Boolean.TRUE);
setControlProperty("lblSenderStreet", "Enabled", Boolean.TRUE);
setControlProperty("lblPostCodeCity", "Enabled", Boolean.TRUE);
@@ -375,24 +462,29 @@ protected void leaveStep(int OldStep, int NewStep){}
txtSenderCityTextChanged();
}
- public void optCreateLetterItemChanged() {
+ public void optCreateLetterItemChanged()
+ {
bEditTemplate = false;
}
- public void optMakeChangesItemChanged() {
+ public void optMakeChangesItemChanged()
+ {
bEditTemplate = true;
}
- public void optReceiverPlaceholderItemChanged() {
+ public void optReceiverPlaceholderItemChanged()
+ {
OfficeDocument.attachEventCall(xTextDocument, "OnNew", "StarBasic", "macro:///Template.Correspondence.Placeholder()");
}
- public void optReceiverDatabaseItemChanged() {
+ public void optReceiverDatabaseItemChanged()
+ {
OfficeDocument.attachEventCall(xTextDocument, "OnNew", "StarBasic", "macro:///Template.Correspondence.Database()");
}
- public void lstBusinessStyleItemChanged() {
- xTextDocument = myLetterDoc.loadAsPreview(BusinessFiles[1][lstBusinessStyle.getSelectedItemPos()], false );
+ public void lstBusinessStyleItemChanged()
+ {
+ xTextDocument = myLetterDoc.loadAsPreview(BusinessFiles[1][lstBusinessStyle.getSelectedItemPos()], false);
myLetterDoc.xTextDocument.lockControllers();
initializeElements();
chkBusinessPaperItemChanged();
@@ -401,8 +493,9 @@ protected void leaveStep(int OldStep, int NewStep){}
activate();
}
- public void lstPrivOfficialStyleItemChanged() {
- xTextDocument = myLetterDoc.loadAsPreview(OfficialFiles[1][lstPrivOfficialStyle.getSelectedItemPos()] , false );
+ public void lstPrivOfficialStyleItemChanged()
+ {
+ xTextDocument = myLetterDoc.loadAsPreview(OfficialFiles[1][lstPrivOfficialStyle.getSelectedItemPos()], false);
myLetterDoc.xTextDocument.lockControllers();
initializeElements();
setPossibleSenderData(true);
@@ -411,8 +504,9 @@ protected void leaveStep(int OldStep, int NewStep){}
activate();
}
- public void lstPrivateStyleItemChanged() {
- xTextDocument = myLetterDoc.loadAsPreview(PrivateFiles[1][lstPrivateStyle.getSelectedItemPos()] , false );
+ public void lstPrivateStyleItemChanged()
+ {
+ xTextDocument = myLetterDoc.loadAsPreview(PrivateFiles[1][lstPrivateStyle.getSelectedItemPos()], false);
myLetterDoc.xTextDocument.lockControllers();
initializeElements();
setElements(true);
@@ -420,59 +514,72 @@ protected void leaveStep(int OldStep, int NewStep){}
activate();
}
- public void numLogoHeightTextChanged() {
+ public void numLogoHeightTextChanged()
+ {
BusCompanyLogo.iHeight = (int) (numLogoHeight.getValue() * 1000);
BusCompanyLogo.setFramePosition();
}
- public void numLogoWidthTextChanged() {
+ public void numLogoWidthTextChanged()
+ {
BusCompanyLogo.iWidth = (int) (numLogoWidth.getValue() * 1000);
BusCompanyLogo.setFramePosition();
}
- public void numLogoXTextChanged() {
+ public void numLogoXTextChanged()
+ {
BusCompanyLogo.iXPos = (int) (numLogoX.getValue() * 1000);
BusCompanyLogo.setFramePosition();
}
- public void numLogoYTextChanged() {
+ public void numLogoYTextChanged()
+ {
BusCompanyLogo.iYPos = (int) (numLogoY.getValue() * 1000);
BusCompanyLogo.setFramePosition();
}
- public void numAddressWidthTextChanged() {
+ public void numAddressWidthTextChanged()
+ {
BusCompanyAddress.iWidth = (int) (numAddressWidth.getValue() * 1000);
BusCompanyAddress.setFramePosition();
}
- public void numAddressXTextChanged() {
+ public void numAddressXTextChanged()
+ {
BusCompanyAddress.iXPos = (int) (numAddressX.getValue() * 1000);
BusCompanyAddress.setFramePosition();
}
- public void numAddressYTextChanged() {
+ public void numAddressYTextChanged()
+ {
BusCompanyAddress.iYPos = (int) (numAddressY.getValue() * 1000);
BusCompanyAddress.setFramePosition();
}
- public void numAddressHeightTextChanged() {
+ public void numAddressHeightTextChanged()
+ {
BusCompanyAddress.iHeight = (int) (numAddressHeight.getValue() * 1000);
BusCompanyAddress.setFramePosition();
}
- public void numFooterHeightTextChanged() {
+ public void numFooterHeightTextChanged()
+ {
BusFooter.iHeight = (int) (numFooterHeight.getValue() * 1000);
BusFooter.iYPos = myLetterDoc.DocSize.Height - BusFooter.iHeight;
BusFooter.setFramePosition();
}
- public void chkPaperCompanyLogoItemChanged() {
- if (chkPaperCompanyLogo.getState() != 0) {
+ public void chkPaperCompanyLogoItemChanged()
+ {
+ if (chkPaperCompanyLogo.getState() != 0)
+ {
//minimal value is required, otherwise the frame creation fails
- if (numLogoWidth.getValue() == 0) {
+ if (numLogoWidth.getValue() == 0)
+ {
numLogoWidth.setValue(0.1);
}
- if (numLogoHeight.getValue() == 0) {
+ if (numLogoHeight.getValue() == 0)
+ {
numLogoHeight.setValue(0.1);
}
BusCompanyLogo = myLetterDoc.new BusinessPaperObject("Company Logo", (int) (numLogoWidth.getValue() * 1000), (int) (numLogoHeight.getValue() * 1000), (int) (numLogoX.getValue() * 1000), (int) (numLogoY.getValue() * 1000));
@@ -485,8 +592,11 @@ protected void leaveStep(int OldStep, int NewStep){}
setControlProperty("numLogoY", "Enabled", Boolean.TRUE);
setControlProperty("lblCompanyLogoY", "Enabled", Boolean.TRUE);
setPossibleLogo(false);
- } else {
- if (BusCompanyLogo != null) {
+ }
+ else
+ {
+ if (BusCompanyLogo != null)
+ {
BusCompanyLogo.removeFrame();
}
setControlProperty("numLogoHeight", "Enabled", Boolean.FALSE);
@@ -501,13 +611,17 @@ protected void leaveStep(int OldStep, int NewStep){}
}
}
- public void chkPaperCompanyAddressItemChanged() {
- if (chkPaperCompanyAddress.getState() != 0) {
+ public void chkPaperCompanyAddressItemChanged()
+ {
+ if (chkPaperCompanyAddress.getState() != 0)
+ {
// minimal value is required, otherwise the frame creation fails
- if (numAddressWidth.getValue() == 0) {
+ if (numAddressWidth.getValue() == 0)
+ {
numAddressWidth.setValue(0.1);
}
- if (numAddressHeight.getValue() == 0) {
+ if (numAddressHeight.getValue() == 0)
+ {
numAddressHeight.setValue(0.1);
}
BusCompanyAddress = myLetterDoc.new BusinessPaperObject("Company Address", (int) (numAddressWidth.getValue() * 1000), (int) (numAddressHeight.getValue() * 1000), (int) (numAddressX.getValue() * 1000), (int) (numAddressY.getValue() * 1000));
@@ -519,14 +633,19 @@ protected void leaveStep(int OldStep, int NewStep){}
setControlProperty("lblCompanyAddressX", "Enabled", Boolean.TRUE);
setControlProperty("numAddressY", "Enabled", Boolean.TRUE);
setControlProperty("lblCompanyAddressY", "Enabled", Boolean.TRUE);
- if (myLetterDoc.hasElement("Sender Address")) {
+ if (myLetterDoc.hasElement("Sender Address"))
+ {
myLetterDoc.switchElement("Sender Address", (false));
}
- if (chkCompanyReceiver.getState() != 0) {
+ if (chkCompanyReceiver.getState() != 0)
+ {
setPossibleSenderData(false);
}
- } else {
- if (BusCompanyAddress != null) {
+ }
+ else
+ {
+ if (BusCompanyAddress != null)
+ {
BusCompanyAddress.removeFrame();
}
setControlProperty("numAddressHeight", "Enabled", Boolean.FALSE);
@@ -537,20 +656,30 @@ protected void leaveStep(int OldStep, int NewStep){}
setControlProperty("lblCompanyAddressX", "Enabled", Boolean.FALSE);
setControlProperty("numAddressY", "Enabled", Boolean.FALSE);
setControlProperty("lblCompanyAddressY", "Enabled", Boolean.FALSE);
- if (myLetterDoc.hasElement("Sender Address")) {
+ if (myLetterDoc.hasElement("Sender Address"))
+ {
myLetterDoc.switchElement("Sender Address", (true));
}
setPossibleSenderData(true);
- if (optSenderDefine.getState()) {optSenderDefineItemChanged();}
- if (optSenderPlaceholder.getState()) {optSenderPlaceholderItemChanged();}
+ if (optSenderDefine.getState())
+ {
+ optSenderDefineItemChanged();
+ }
+ if (optSenderPlaceholder.getState())
+ {
+ optSenderPlaceholderItemChanged();
+ }
}
}
- public void chkCompanyReceiverItemChanged() {
+ public void chkCompanyReceiverItemChanged()
+ {
XTextFrame xReceiverFrame = null;
- if (chkCompanyReceiver.getState() != 0) {
- try {
+ if (chkCompanyReceiver.getState() != 0)
+ {
+ try
+ {
xReceiverFrame = TextFrameHandler.getFrameByName("Receiver Address", xTextDocument);
Integer FrameWidth = (Integer) Helper.getUnoPropertyValue(xReceiverFrame, "Width");
int iFrameWidth = FrameWidth.intValue();
@@ -564,39 +693,59 @@ protected void leaveStep(int OldStep, int NewStep){}
BusCompanyAddressReceiver = myLetterDoc.new BusinessPaperObject(" ", iFrameWidth, iReceiverHeight, iFrameX, (iFrameY - iReceiverHeight));
setPossibleAddressReceiver(false);
- } catch (NoSuchElementException e) {
+ }
+ catch (NoSuchElementException e)
+ {
// TODO Error Message: Template modified!
e.printStackTrace();
- } catch (WrappedTargetException e) {
+ }
+ catch (WrappedTargetException e)
+ {
e.printStackTrace();
}
- if (chkPaperCompanyAddress.getState() != 0) {
+ if (chkPaperCompanyAddress.getState() != 0)
+ {
setPossibleSenderData(false);
}
- } else {
- if (BusCompanyAddressReceiver != null) {
+ }
+ else
+ {
+ if (BusCompanyAddressReceiver != null)
+ {
BusCompanyAddressReceiver.removeFrame();
}
setPossibleAddressReceiver(true);
setPossibleSenderData(true);
- if (optSenderDefine.getState()) {optSenderDefineItemChanged();}
- if (optSenderPlaceholder.getState()) {optSenderPlaceholderItemChanged();}
+ if (optSenderDefine.getState())
+ {
+ optSenderDefineItemChanged();
+ }
+ if (optSenderPlaceholder.getState())
+ {
+ optSenderPlaceholderItemChanged();
+ }
}
}
- public void chkPaperFooterItemChanged() {
+ public void chkPaperFooterItemChanged()
+ {
- if (chkPaperFooter.getState() != 0) {
+ if (chkPaperFooter.getState() != 0)
+ {
//minimal value is required, otherwise the frame creation fails
- if (numFooterHeight.getValue() == 0) {
+ if (numFooterHeight.getValue() == 0)
+ {
numFooterHeight.setValue(0.1);
}
BusFooter = myLetterDoc.new BusinessPaperObject("Footer", (int) myLetterDoc.DocSize.Width, (int) (numFooterHeight.getValue() * 1000), (int) 0, (int) (myLetterDoc.DocSize.Height - (numFooterHeight.getValue() * 1000)));
this.setControlProperty("numFooterHeight", "Enabled", Boolean.TRUE);
this.setControlProperty("lblFooterHeight", "Enabled", Boolean.TRUE);
setPossibleFooter(false);
- } else {
- if (BusFooter != null) {
+ }
+ else
+ {
+ if (BusFooter != null)
+ {
BusFooter.removeFrame();
}
setControlProperty("numFooterHeight", "Enabled", Boolean.FALSE);
@@ -606,54 +755,75 @@ protected void leaveStep(int OldStep, int NewStep){}
}
//switch Elements on/off -------------------------------------------------------
- public void chkUseLogoItemChanged() {
- try {
- if (myLetterDoc.hasElement("Company Logo")) {
+ public void chkUseLogoItemChanged()
+ {
+ try
+ {
+ if (myLetterDoc.hasElement("Company Logo"))
+ {
boolean logostatus = AnyConverter.toBoolean(getControlProperty("chkUseLogo", "Enabled")) && (chkUseLogo.getState() != 0);
myLetterDoc.switchElement("Company Logo", logostatus);
}
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
e.printStackTrace();
}
}
- public void chkUseAddressReceiverItemChanged() {
- try {
- if (myLetterDoc.hasElement("Sender Address Repeated")) {
+ public void chkUseAddressReceiverItemChanged()
+ {
+ try
+ {
+ if (myLetterDoc.hasElement("Sender Address Repeated"))
+ {
boolean rstatus = AnyConverter.toBoolean(getControlProperty("chkUseAddressReceiver", "Enabled")) && (chkUseAddressReceiver.getState() != 0);
myLetterDoc.switchElement("Sender Address Repeated", rstatus);
}
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
e.printStackTrace();
}
}
- public void chkUseSignsItemChanged() {
- if (myLetterDoc.hasElement("Letter Signs")) {
+ public void chkUseSignsItemChanged()
+ {
+ if (myLetterDoc.hasElement("Letter Signs"))
+ {
myLetterDoc.switchElement("Letter Signs", (chkUseSigns.getState() != 0));
}
}
- public void chkUseSubjectItemChanged() {
- if (myLetterDoc.hasElement("Subject Line")) {
+ public void chkUseSubjectItemChanged()
+ {
+ if (myLetterDoc.hasElement("Subject Line"))
+ {
myLetterDoc.switchElement("Subject Line", (chkUseSubject.getState() != 0));
}
}
- public void chkUseBendMarksItemChanged() {
- if (myLetterDoc.hasElement("Bend Marks")) {
+ public void chkUseBendMarksItemChanged()
+ {
+ if (myLetterDoc.hasElement("Bend Marks"))
+ {
myLetterDoc.switchElement("Bend Marks", (chkUseBendMarks.getState() != 0));
}
}
- public void chkUseFooterItemChanged() {
- try {
+ public void chkUseFooterItemChanged()
+ {
+ try
+ {
boolean bFooterPossible = (chkUseFooter.getState() != 0) && AnyConverter.toBoolean(getControlProperty("chkUseFooter", "Enabled"));
- if (chkFooterNextPages.getState() != 0) {
- myLetterDoc.switchFooter("First Page", false, (chkFooterPageNumbers.getState() != 0),txtFooter.getText());
+ if (chkFooterNextPages.getState() != 0)
+ {
+ myLetterDoc.switchFooter("First Page", false, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
myLetterDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
- } else {
+ }
+ else
+ {
myLetterDoc.switchFooter("First Page", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
myLetterDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
}
@@ -662,145 +832,175 @@ protected void leaveStep(int OldStep, int NewStep){}
XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER);
Helper.setUnoPropertyValue(BPaperItem, "Enabled", new Boolean(bFooterPossible));
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
-
- public void chkFooterNextPagesItemChanged() {
+ public void chkFooterNextPagesItemChanged()
+ {
chkUseFooterItemChanged();
}
- public void chkFooterPageNumbersItemChanged() {
+ public void chkFooterPageNumbersItemChanged()
+ {
chkUseFooterItemChanged();
}
- private void setPossibleFooter(boolean bState) {
+ private void setPossibleFooter(boolean bState)
+ {
setControlProperty("chkUseFooter", "Enabled", new Boolean(bState));
chkUseFooterItemChanged();
}
- private void setPossibleAddressReceiver(boolean bState) {
- if (myLetterDoc.hasElement("Sender Address Repeated")) {
+ private void setPossibleAddressReceiver(boolean bState)
+ {
+ if (myLetterDoc.hasElement("Sender Address Repeated"))
+ {
setControlProperty("chkUseAddressReceiver", "Enabled", new Boolean(bState));
chkUseAddressReceiverItemChanged();
}
}
- private void setPossibleLogo(boolean bState) {
- if (myLetterDoc.hasElement("Company Logo")) {
+ private void setPossibleLogo(boolean bState)
+ {
+ if (myLetterDoc.hasElement("Company Logo"))
+ {
setControlProperty("chkUseLogo", "Enabled", new Boolean(bState));
chkUseLogoItemChanged();
}
}
- public void txtFooterTextChanged() {
+ public void txtFooterTextChanged()
+ {
chkUseFooterItemChanged();
}
- public void txtSenderNameTextChanged() {
+ public void txtSenderNameTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("Company", txtSenderName.getText());
}
- public void txtSenderStreetTextChanged() {
+ public void txtSenderStreetTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("Street", txtSenderStreet.getText());
}
- public void txtSenderCityTextChanged() {
+ public void txtSenderCityTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("City", txtSenderCity.getText());
}
- public void txtSenderPostCodeTextChanged() {
+ public void txtSenderPostCodeTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("PostCode", txtSenderPostCode.getText());
}
- public void txtSenderStateTextChanged() {
+ public void txtSenderStateTextChanged()
+ {
TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
myFieldHandler.changeUserFieldContent("State", txtSenderState.getText());
}
- public void txtTemplateNameTextChanged() {
+ public void txtTemplateNameTextChanged()
+ {
XDocumentInfoSupplier xDocInfoSuppl = (XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDocument);
XDocumentInfo xDocInfo = xDocInfoSuppl.getDocumentInfo();
String TitleName = txtTemplateName.getText();
Helper.setUnoPropertyValue(xDocInfo, "Title", TitleName);
}
-
-
- public void chkUseSalutationItemChanged() {
+ public void chkUseSalutationItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
myLetterDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
setControlProperty("lstSalutation", "Enabled", new Boolean(chkUseSalutation.getState() != 0));
}
- public void lstSalutationItemChanged() {
+ public void lstSalutationItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
myLetterDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
}
- public void lstSalutationTextChanged() {
+ public void lstSalutationTextChanged()
+ {
}
- public void chkUseGreetingItemChanged() {
+ public void chkUseGreetingItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
myLetterDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
setControlProperty("lstGreeting", "Enabled", new Boolean(chkUseGreeting.getState() != 0));
}
- private void setDefaultForGreetingAndSalutation() {
+ private void setDefaultForGreetingAndSalutation()
+ {
XTextComponent xTextComponent;
xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
- if (xTextComponent.getText().equals("")) {
+ if (xTextComponent.getText().equals(""))
+ {
xTextComponent.setText(resources.SalutationLabels[0]);
}
xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
- if (xTextComponent.getText().equals("")) {
+ if (xTextComponent.getText().equals(""))
+ {
xTextComponent.setText(resources.GreetingLabels[0]);
}
}
- public void lstGreetingItemChanged() {
+ public void lstGreetingItemChanged()
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
myLetterDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
}
- public void lstGreetingTextChanged() {
+ public void lstGreetingTextChanged()
+ {
}
// ----------------------------------------------------------------------------
-
- public void chkBusinessPaperItemChanged() {
+ public void chkBusinessPaperItemChanged()
+ {
//enable/disable Roadmap Entry Business Paper
- if (chkBusinessPaper.getState() != 0) {
+ if (chkBusinessPaper.getState() != 0)
+ {
enableBusinessPaper();
- } else {
+ }
+ else
+ {
disableBusinessPaper();
setPossibleSenderData(true);
}
}
- private int getOfficeLinguistic() {
+ private int getOfficeLinguistic()
+ {
int oL = 0;
boolean found = false;
String OfficeLinguistic = Configuration.getOfficeLinguistic(xMSF);
- for (int i = 0; i < Norms.length; i++){
- if (Norms[i].equalsIgnoreCase(OfficeLinguistic)) {
+ for (int i = 0; i < Norms.length; i++)
+ {
+ if (Norms[i].equalsIgnoreCase(OfficeLinguistic))
+ {
oL = i;
found = true;
break;
}
}
- if (!found) {
+ if (!found)
+ {
//fall back to English:
- for (int i = 0; i < Norms.length; i++){
- if (Norms[i].equalsIgnoreCase("en-US")) {
+ for (int i = 0; i < Norms.length; i++)
+ {
+ if (Norms[i].equalsIgnoreCase("en-US"))
+ {
oL = i;
found = true;
break;
@@ -810,11 +1010,13 @@ protected void leaveStep(int OldStep, int NewStep){}
return oL;
}
- private void setPossibleSenderData(boolean bState) {
+ private void setPossibleSenderData(boolean bState)
+ {
setControlProperty("optSenderDefine", "Enabled", new Boolean(bState));
setControlProperty("optSenderPlaceholder", "Enabled", new Boolean(bState));
setControlProperty("lblSenderAddress", "Enabled", new Boolean(bState));
- if ( !bState) {
+ if (!bState)
+ {
setControlProperty("txtSenderCity", "Enabled", new Boolean(bState));
setControlProperty("txtSenderName", "Enabled", new Boolean(bState));
setControlProperty("txtSenderPostCode", "Enabled", new Boolean(bState));
@@ -827,17 +1029,20 @@ protected void leaveStep(int OldStep, int NewStep){}
}
}
- private void enableSenderReceiver() {
+ private void enableSenderReceiver()
+ {
XInterface BPaperItem = getRoadmapItemByID(RM_SENDERRECEIVER);
Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.TRUE);
}
- private void disableSenderReceiver() {
+ private void disableSenderReceiver()
+ {
XInterface BPaperItem = getRoadmapItemByID(RM_SENDERRECEIVER);
Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.FALSE);
}
- private void enableBusinessPaper() {
+ private void enableBusinessPaper()
+ {
XInterface BPaperItem = getRoadmapItemByID(RM_BUSINESSPAPER);
Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.TRUE);
chkPaperCompanyLogoItemChanged();
@@ -846,70 +1051,97 @@ protected void leaveStep(int OldStep, int NewStep){}
chkCompanyReceiverItemChanged();
}
- private void disableBusinessPaper() {
+ private void disableBusinessPaper()
+ {
XInterface BPaperItem = getRoadmapItemByID(RM_BUSINESSPAPER);
Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.FALSE);
- if (BusCompanyLogo != null) {
+ if (BusCompanyLogo != null)
+ {
BusCompanyLogo.removeFrame();
}
- if (BusCompanyAddress != null) {
+ if (BusCompanyAddress != null)
+ {
BusCompanyAddress.removeFrame();
}
- if (BusFooter != null) {
+ if (BusFooter != null)
+ {
BusFooter.removeFrame();
}
- if (BusCompanyAddressReceiver != null) {
+ if (BusCompanyAddressReceiver != null)
+ {
BusCompanyAddressReceiver.removeFrame();
}
setPossibleAddressReceiver(true);
setPossibleFooter(true);
setPossibleLogo(true);
- if (myLetterDoc.hasElement("Sender Address")) {
+ if (myLetterDoc.hasElement("Sender Address"))
+ {
myLetterDoc.switchElement("Sender Address", (true));
}
}
- public void lstLetterNormItemChanged() {
+ public void lstLetterNormItemChanged()
+ {
//when the norm changes, the correct template needs to be reloaded
sCurrentNorm = Norms[getCurrentLetter().cp_Norm];
initializeTemplates(xMSF);
- if (optBusinessLetter.getState()) {
+ if (optBusinessLetter.getState())
+ {
lstBusinessStyleItemChanged();
}
- if (optPrivOfficialLetter.getState()) {
+ if (optPrivOfficialLetter.getState())
+ {
lstPrivOfficialStyleItemChanged();
}
- if (optPrivateLetter.getState()) {
+ if (optPrivateLetter.getState())
+ {
lstPrivateStyleItemChanged();
}
}
- public void initializeSalutation() {
+ public void initializeSalutation()
+ {
setControlProperty("lstSalutation", "StringItemList", resources.SalutationLabels);
}
- public void initializeGreeting() {
+ public void initializeGreeting()
+ {
setControlProperty("lstGreeting", "StringItemList", resources.GreetingLabels);
}
- public void initializeNorms() {
+ public void initializeNorms()
+ {
LocaleCodes lc = new LocaleCodes(xmsf);
- String [] allLocales = lc.getIDs();
- Object [] nameList = {"",""};
- String [] nameList1 = {"",""};
- String [] nameList1b = {"",""};
- String [] nameList2 = {"",""};
- Vector allPaths = new Vector();
+ String[] allLocales = lc.getIDs();
+ Object[] nameList =
+ {
+ "", ""
+ };
+ String[] nameList1 =
+ {
+ "", ""
+ };
+ String[] nameList1b =
+ {
+ "", ""
+ };
+ String[] nameList2 =
+ {
+ "", ""
+ };
+ Vector allPaths = new Vector();
String sLetterSubPath = "/wizard/letter/";
- try {
+ try
+ {
sTemplatePath = FileAccess.deleteLastSlashfromUrl(sTemplatePath);
- String [] PathParts = sTemplatePath.split("/");
- String nuString ="";
- String sMainPath;
- for (int i=0; i<(PathParts.length -1); i++) {
+ String[] PathParts = sTemplatePath.split("/");
+ String nuString = "";
+ String sMainPath;
+ for (int i = 0; i < (PathParts.length - 1); i++)
+ {
nuString = nuString + PathParts[i] + "/";
}
String sLocLetterPath;
@@ -923,155 +1155,195 @@ protected void leaveStep(int OldStep, int NewStep){}
com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = (com.sun.star.ucb.XSimpleFileAccess) UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface);
nameList1 = xSimpleFileAccess.getFolderContents(sMainPath, true);
nameList2 = xSimpleFileAccess.getFolderContents(sLetterPath, true);
- for (int i=0;i<nameList1.length;i++) {
- String theFileName = FileAccess.getFilename(nameList1[i]);
- if (!theFileName.equalsIgnoreCase("wizard")) {
+ for (int i = 0; i < nameList1.length; i++)
+ {
+ String theFileName = FileAccess.getFilename(nameList1[i]);
+ if (!theFileName.equalsIgnoreCase("wizard"))
+ {
sLocLetterPath = FileAccess.deleteLastSlashfromUrl(nameList1[i] + sLetterSubPath);
- try{
+ try
+ {
nameList1b = xSimpleFileAccess.getFolderContents(sLocLetterPath, true);
- for (int j=0;j<nameList1b.length;j++) {
+ for (int j = 0; j < nameList1b.length; j++)
+ {
String theFileNameb = FileAccess.getFilename(nameList1b[j]);
- allPaths.add(nameList1[i]+ sLetterSubPath + theFileNameb);
+ allPaths.add(nameList1[i] + sLetterSubPath + theFileNameb);
}
}
- catch(Exception e)
+ catch (Exception e)
{
//if the path is invalid an exception is thrown - try the fallback below then
}
}
}
- for (int i=0;i<nameList2.length;i++) {
+ for (int i = 0; i < nameList2.length; i++)
+ {
boolean found = false;
- for (int t=0;t<nameList1.length;t++) {
- if (FileAccess.getFilename(nameList2[i]).equalsIgnoreCase(FileAccess.getFilename(nameList1[t])) ) {
+ for (int t = 0; t < nameList1.length; t++)
+ {
+ if (FileAccess.getFilename(nameList2[i]).equalsIgnoreCase(FileAccess.getFilename(nameList1[t])))
+ {
found = true;
}
}
- if (!found) {
+ if (!found)
+ {
allPaths.add(nameList2[i]);
}
}
nameList = allPaths.toArray();
- } catch (CommandAbortedException e) {
+ }
+ catch (CommandAbortedException e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
//} catch (NoValidPathException e) {
- // TODO Auto-generated catch block
+ // TODO Auto-generated catch block
// e.printStackTrace();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
- Vector NormsVector = new Vector();
- Vector NormsPathVector = new Vector();
- Vector LanguageLabelsVector = new Vector();
- String [] LanguageLabels;
+ Vector NormsVector = new Vector();
+ Vector NormsPathVector = new Vector();
+ Vector LanguageLabelsVector = new Vector();
+ String[] LanguageLabels;
boolean found = false;
String cIsoCode = "";
String MSID = "";
- int z = 0;
- for (int i=0; i < nameList.length; i++) {
+ int z = 0;
+ for (int i = 0; i < nameList.length; i++)
+ {
found = false;
- cIsoCode = FileAccess.getFilename((String)nameList[i]);
- for (int t=0; t < allLocales.length; t++) {
- String [] aLang = allLocales[t].split(";");
- if (cIsoCode.equalsIgnoreCase(aLang[1])) {
- MSID= aLang[2];
+ cIsoCode = FileAccess.getFilename((String) nameList[i]);
+ for (int t = 0; t < allLocales.length; t++)
+ {
+ String[] aLang = allLocales[t].split(";");
+ if (cIsoCode.equalsIgnoreCase(aLang[1]))
+ {
+ MSID = aLang[2];
found = true;
t = allLocales.length;
}
}
- if (!found) {
- for (int t=0; t < allLocales.length; t++) {
- String [] aLang = allLocales[t].split(";");
- if (cIsoCode.equalsIgnoreCase(aLang[1].substring(0,2))) {
- MSID= aLang[2];
+ if (!found)
+ {
+ for (int t = 0; t < allLocales.length; t++)
+ {
+ String[] aLang = allLocales[t].split(";");
+ if (cIsoCode.equalsIgnoreCase(aLang[1].substring(0, 2)))
+ {
+ MSID = aLang[2];
found = true;
t = allLocales.length;
}
}
}
- if (found) {
- NormsVector.add(cIsoCode);
- NormsPathVector.add((String) nameList[i]);
- LanguageLabelsVector.add(lc.getLanguageString(MSID));
- /*
- Norms[z] = cIsoCode;
- NormPaths[z] = (String) nameList[i];
- LanguageLabels[z] = lc.getLanguageString(MSID);
- z++;
- **/
- }
+ if (found)
+ {
+ NormsVector.add(cIsoCode);
+ NormsPathVector.add((String) nameList[i]);
+ LanguageLabelsVector.add(lc.getLanguageString(MSID));
+ /*
+ Norms[z] = cIsoCode;
+ NormPaths[z] = (String) nameList[i];
+ LanguageLabels[z] = lc.getLanguageString(MSID);
+ z++;
+ **/
+ }
}
- Norms = new String[NormsVector.size()];
- NormsVector.toArray(Norms);
+ Norms = new String[NormsVector.size()];
+ NormsVector.toArray(Norms);
- NormPaths = new String[NormsPathVector.size()];
- NormsPathVector.toArray(NormPaths);
+ NormPaths = new String[NormsPathVector.size()];
+ NormsPathVector.toArray(NormPaths);
- LanguageLabels = new String[LanguageLabelsVector.size()];
- LanguageLabelsVector.toArray(LanguageLabels);
+ LanguageLabels = new String[LanguageLabelsVector.size()];
+ LanguageLabelsVector.toArray(LanguageLabels);
- //Norms = new String[nameList.length];
- //NormPaths = new String[nameList.length];
+ //Norms = new String[nameList.length];
+ //NormPaths = new String[nameList.length];
//LanguageLabels = new String[Norms.length];
setControlProperty("lstLetterNorm", "StringItemList", LanguageLabels);
}
- private CGLetter getCurrentLetter() {
- switch (myConfig.cp_LetterType) {
- case 0 : return myConfig.cp_BusinessLetter;
- case 1 : return myConfig.cp_PrivateOfficialLetter;
- case 2 : return myConfig.cp_PrivateLetter;
- default : return null;
+ private CGLetter getCurrentLetter()
+ {
+ switch (myConfig.cp_LetterType)
+ {
+ case 0:
+ return myConfig.cp_BusinessLetter;
+ case 1:
+ return myConfig.cp_PrivateOfficialLetter;
+ case 2:
+ return myConfig.cp_PrivateLetter;
+ default:
+ return null;
}
}
- private void initializePaths() {
- try {
+ private void initializePaths()
+ {
+ try
+ {
sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", "");
sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap");
- } catch (NoValidPathException e) {
+ }
+ catch (NoValidPathException e)
+ {
e.printStackTrace();
}
}
- public boolean initializeTemplates(XMultiServiceFactory xMSF) {
- sCurrentNorm = Norms[getCurrentLetter().cp_Norm];
- //creation of the language independent path:
- String sLetterPath = NormPaths[getCurrentLetter().cp_Norm];
-
- // try
- // {
- BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus", sLetterPath);
- OfficialFiles = FileAccess.getFolderTitles(xMSF, "off", sLetterPath);
- PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", sLetterPath);
-
- setControlProperty("lstBusinessStyle", "StringItemList", BusinessFiles[0]);
- setControlProperty("lstPrivOfficialStyle", "StringItemList", OfficialFiles[0]);
- setControlProperty("lstPrivateStyle", "StringItemList", PrivateFiles[0]);
-
- setControlProperty("lstBusinessStyle", "SelectedItems", new short[]{0});
- setControlProperty("lstPrivOfficialStyle", "SelectedItems", new short[]{0});
- setControlProperty("lstPrivateStyle", "SelectedItems", new short[]{0});
+ public boolean initializeTemplates(XMultiServiceFactory xMSF)
+ {
+ sCurrentNorm = Norms[getCurrentLetter().cp_Norm];
+ //creation of the language independent path:
+ String sLetterPath = NormPaths[getCurrentLetter().cp_Norm];
+
+ // try
+ // {
+ BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus", sLetterPath);
+ OfficialFiles = FileAccess.getFolderTitles(xMSF, "off", sLetterPath);
+ PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", sLetterPath);
+
+ setControlProperty("lstBusinessStyle", "StringItemList", BusinessFiles[0]);
+ setControlProperty("lstPrivOfficialStyle", "StringItemList", OfficialFiles[0]);
+ setControlProperty("lstPrivateStyle", "StringItemList", PrivateFiles[0]);
+
+ setControlProperty("lstBusinessStyle", "SelectedItems", new short[]
+ {
+ 0
+ });
+ setControlProperty("lstPrivOfficialStyle", "SelectedItems", new short[]
+ {
+ 0
+ });
+ setControlProperty("lstPrivateStyle", "SelectedItems", new short[]
+ {
+ 0
+ });
// }
// catch (com.sun.star.wizards.common.NoValidPathException e)
// {
// return false;
// }
- return true;
+ return true;
}
- public void initializeElements() {
+ public void initializeElements()
+ {
setControlProperty("chkUseLogo", "Enabled", new Boolean(myLetterDoc.hasElement("Company Logo")));
setControlProperty("chkUseBendMarks", "Enabled", new Boolean(myLetterDoc.hasElement("Bend Marks")));
setControlProperty("chkUseAddressReceiver", "Enabled", new Boolean(myLetterDoc.hasElement("Sender Address Repeated")));
@@ -1080,24 +1352,35 @@ protected void leaveStep(int OldStep, int NewStep){}
myLetterDoc.updateDateFields();
}
- public void setConfiguration() {
+ public void setConfiguration()
+ {
//set correct Configuration tree:
- if (optBusinessLetter.getState()) {
+ if (optBusinessLetter.getState())
+ {
optBusinessLetterItemChanged();
}
- if (optPrivOfficialLetter.getState()) {
+ if (optPrivOfficialLetter.getState())
+ {
optPrivOfficialLetterItemChanged();
}
- if (optPrivateLetter.getState()) {
+ if (optPrivateLetter.getState())
+ {
optPrivateLetterItemChanged();
}
}
- public void setElements(boolean privLetter) {
+ public void setElements(boolean privLetter)
+ {
//UI relevant:
- if (optSenderDefine.getState()) {optSenderDefineItemChanged();}
- if (optSenderPlaceholder.getState()) {optSenderPlaceholderItemChanged();}
+ if (optSenderDefine.getState())
+ {
+ optSenderDefineItemChanged();
+ }
+ if (optSenderPlaceholder.getState())
+ {
+ optSenderPlaceholderItemChanged();
+ }
chkUseSignsItemChanged();
chkUseSubjectItemChanged();
chkUseSalutationItemChanged();
@@ -1107,13 +1390,26 @@ protected void leaveStep(int OldStep, int NewStep){}
txtTemplateNameTextChanged();
//not UI relevant:
- if (optReceiverDatabase.getState() && !privLetter) {optReceiverDatabaseItemChanged();}
- if (optReceiverPlaceholder.getState() && !privLetter) {optReceiverPlaceholderItemChanged();}
- if (optCreateLetter.getState()) {optCreateLetterItemChanged();}
- if (optMakeChanges.getState()) {optMakeChangesItemChanged();}
+ if (optReceiverDatabase.getState() && !privLetter)
+ {
+ optReceiverDatabaseItemChanged();
+ }
+ if (optReceiverPlaceholder.getState() && !privLetter)
+ {
+ optReceiverPlaceholderItemChanged();
+ }
+ if (optCreateLetter.getState())
+ {
+ optCreateLetterItemChanged();
+ }
+ if (optMakeChanges.getState())
+ {
+ optMakeChangesItemChanged();
+ }
}
- public void insertRoadmap() {
+ public void insertRoadmap()
+ {
addRoadmap();
int i = 0;
i = insertRoadmapItem(0, true, resources.RoadmapLabels[RM_TYPESTYLE], RM_TYPESTYLE);
@@ -1127,31 +1423,40 @@ protected void leaveStep(int OldStep, int NewStep){}
setCurrentRoadmapItemID((short) 1);
}
- private class myPathSelectionListener implements XPathSelectionListener {
- public void validatePath() {
- if (myPathSelection.usedPathPicker) {
+ private class myPathSelectionListener implements XPathSelectionListener
+ {
+
+ public void validatePath()
+ {
+ if (myPathSelection.usedPathPicker)
+ {
filenameChanged = true;
}
myPathSelection.usedPathPicker = false;
}
}
- public void insertPathSelectionControl() {
+ public void insertPathSelectionControl()
+ {
myPathSelection = new PathSelection(xMSF, this, PathSelection.TransferMode.SAVE, PathSelection.DialogTypes.FILE);
- myPathSelection.insert(6, 97, 70, 205, (short) 45, resources.reslblTemplatePath_value, true, "HID:" + ( HID + 47 ), "HID:" + ( HID + 48 ));
+ myPathSelection.insert(6, 97, 70, 205, (short) 45, resources.reslblTemplatePath_value, true, "HID:" + (HID + 47), "HID:" + (HID + 48));
myPathSelection.sDefaultDirectory = sUserTemplatePath;
myPathSelection.sDefaultName = "myLetterTemplate.ott";
myPathSelection.sDefaultFilter = "writer8_template";
myPathSelection.addSelectionListener(new myPathSelectionListener());
}
-
- public void initConfiguration() {
- try {
+ public void initConfiguration()
+ {
+ try
+ {
myConfig = new CGLetterWizard();
Object root = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.Office.Writer/Wizards/Letter", false);
myConfig.readConfiguration(root, "cp_");
- mainDA.add(RadioDataAware.attachRadioButtons(myConfig, "cp_LetterType", new Object[] { optBusinessLetter, optPrivOfficialLetter, optPrivateLetter }, null, true));
+ mainDA.add(RadioDataAware.attachRadioButtons(myConfig, "cp_LetterType", new Object[]
+ {
+ optBusinessLetter, optPrivOfficialLetter, optPrivateLetter
+ }, null, true));
mainDA.add(UnoDataAware.attachListBox(myConfig.cp_BusinessLetter, "cp_Style", lstBusinessStyle, null, true));
mainDA.add(UnoDataAware.attachListBox(myConfig.cp_PrivateOfficialLetter, "cp_Style", lstPrivOfficialStyle, null, true));
mainDA.add(UnoDataAware.attachListBox(myConfig.cp_PrivateLetter, "cp_Style", lstPrivateStyle, null, true));
@@ -1188,40 +1493,55 @@ protected void leaveStep(int OldStep, int NewStep){}
letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintFooter", chkUseFooter, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_Salutation", lstSalutation, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_Greeting", lstGreeting, null, true));
- letterDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_SenderAddressType", new Object[] { optSenderDefine, optSenderPlaceholder }, null, true));
+ letterDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_SenderAddressType", new Object[]
+ {
+ optSenderDefine, optSenderPlaceholder
+ }, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderCompanyName", txtSenderName, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderStreet", txtSenderStreet, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderPostCode", txtSenderPostCode, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderState", txtSenderState, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_SenderCity", txtSenderCity, null, true));
- letterDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_ReceiverAddressType", new Object[] { optReceiverDatabase, optReceiverPlaceholder }, null, true));
+ letterDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_ReceiverAddressType", new Object[]
+ {
+ optReceiverDatabase, optReceiverPlaceholder
+ }, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_Footer", txtFooter, null, true));
letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_FooterOnlySecondPage", chkFooterNextPages, null, true));
letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_FooterPageNumbers", chkFooterPageNumbers, null, true));
- letterDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_CreationType", new Object[] { optCreateLetter, optMakeChanges }, null, true));
+ letterDA.add(RadioDataAware.attachRadioButtons(cgl, "cp_CreationType", new Object[]
+ {
+ optCreateLetter, optMakeChanges
+ }, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_TemplateName", txtTemplateName, null, true));
letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_TemplatePath", myPathSelection.xSaveTextBox, null, true));
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace();
}
}
- private void updateUI() {
+ private void updateUI()
+ {
UnoDataAware.updateUI(mainDA);
UnoDataAware.updateUI(letterDA);
UnoDataAware.updateUI(businessDA);
}
- public void saveConfiguration() {
- try {
+ public void saveConfiguration()
+ {
+ try
+ {
Object root = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.Office.Writer/Wizards/Letter", true);
myConfig.writeConfiguration(root, "cp_");
Configuration.commit(root);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
-
}
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java
index bfc1a66d76d2..381baae0e0f9 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java
@@ -1,9 +1,41 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LetterWizardDialogResources.java,v $
+ *
+ * $Revision: 1.7.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.Resource;
-public class LetterWizardDialogResources extends Resource {
+public class LetterWizardDialogResources extends Resource
+{
final static String UNIT_NAME = "dbwizres";
final static String MODULE_NAME = "dbw";
@@ -13,15 +45,12 @@ public class LetterWizardDialogResources extends Resource {
final static int RID_LETTERWIZARDROADMAP_START = 3100;
final static int RID_LETTERWIZARDLANGUAGE_START = 3110;
final static int RID_RID_COMMON_START = 500;
-
protected String[] RoadmapLabels = new String[7];
protected String[] SalutationLabels = new String[3];
protected String[] GreetingLabels = new String[3];
protected String[] LanguageLabels = new String[16];
-
String resOverwriteWarning;
String resTemplateDescription;
-
String resLetterWizardDialog_title;
String resLabel9_value;
String resoptBusinessLetter_value;
@@ -80,7 +109,9 @@ public class LetterWizardDialogResources extends Resource {
String reslblTitle4_value;
String reslblTitle5_value;
String reslblTitle6_value;
- public LetterWizardDialogResources(XMultiServiceFactory xmsf) {
+
+ public LetterWizardDialogResources(XMultiServiceFactory xmsf)
+ {
super(xmsf, UNIT_NAME, MODULE_NAME);
resLetterWizardDialog_title = getResText(RID_LETTERWIZARDDIALOG_START + 1);
@@ -148,27 +179,33 @@ public class LetterWizardDialogResources extends Resource {
loadCommonResources();
}
- private void loadCommonResources() {
+ private void loadCommonResources()
+ {
resOverwriteWarning = getResText(RID_RID_COMMON_START + 19);
resTemplateDescription = getResText(RID_RID_COMMON_START + 20);
}
- private void loadRoadmapResources() {
- for (int i = 1; i < 7; i++) {
+ private void loadRoadmapResources()
+ {
+ for (int i = 1; i < 7; i++)
+ {
RoadmapLabels[i] = getResText(RID_LETTERWIZARDROADMAP_START + i);
}
}
- private void loadSalutationResources() {
- for (int i = 1; i < 4; i++) {
- SalutationLabels[i-1] = getResText(RID_LETTERWIZARDSALUTATION_START + i);
+ private void loadSalutationResources()
+ {
+ for (int i = 1; i < 4; i++)
+ {
+ SalutationLabels[i - 1] = getResText(RID_LETTERWIZARDSALUTATION_START + i);
}
}
- private void loadGreetingResources() {
- for (int i = 1; i < 4; i++) {
- GreetingLabels[i-1] = getResText(RID_LETTERWIZARDGREETING_START + i);
+ private void loadGreetingResources()
+ {
+ for (int i = 1; i < 4; i++)
+ {
+ GreetingLabels[i - 1] = getResText(RID_LETTERWIZARDGREETING_START + i);
}
}
-
}
diff --git a/wizards/com/sun/star/wizards/letter/LocaleCodes.java b/wizards/com/sun/star/wizards/letter/LocaleCodes.java
index a8e58a927bfa..7cc7b811e26a 100644
--- a/wizards/com/sun/star/wizards/letter/LocaleCodes.java
+++ b/wizards/com/sun/star/wizards/letter/LocaleCodes.java
@@ -1,32 +1,69 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LocaleCodes.java,v $
+ *
+ * $Revision: 1.7.52.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.letter;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.Resource;
import com.sun.star.beans.PropertyValue;
-public class LocaleCodes extends Resource {
+public class LocaleCodes extends Resource
+{
final static String UNIT_NAME = "svtres";
final static String MODULE_NAME = "svt";
- PropertyValue [] allLanguageStrings;
+ PropertyValue[] allLanguageStrings;
- public LocaleCodes (XMultiServiceFactory xmsf) {
+ public LocaleCodes(XMultiServiceFactory xmsf)
+ {
super(xmsf, UNIT_NAME, MODULE_NAME);
allLanguageStrings = getStringList(16300); // STR_ARR_SVT_LANGUAGE_TABLE from svtools/source/misc/langtab.src
}
- public String getLanguageString(String MSID) {
+ public String getLanguageString(String MSID)
+ {
String LS = "unknown Language";
- for (int i=0; i < allLanguageStrings.length; i++) {
- if (allLanguageStrings[i].Value.toString().equalsIgnoreCase(MSID)) {
+ for (int i = 0; i < allLanguageStrings.length; i++)
+ {
+ if (allLanguageStrings[i].Value.toString().equalsIgnoreCase(MSID))
+ {
LS = allLanguageStrings[i].Name;
}
}
return LS;
}
- public String[] getIDs() {
- String []Ids = new String [134];
+ public String[] getIDs()
+ {
+ String[] Ids = new String[134];
Ids[0] = "Afrikaans;af;1078";
Ids[1] = "Albanian;sq;1052";
@@ -165,5 +202,4 @@ public class LocaleCodes extends Resource {
return Ids;
}
-
}
diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
index 136f397a2064..dd9170fb741f 100644
--- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -41,7 +41,8 @@ import com.sun.star.wizards.common.Properties;
* (<CODE>__writeRegistryServiceInfo</CODE>).
* @author Bertram Nolte
*/
-public class CallQueryWizard {
+public class CallQueryWizard
+{
/** Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -56,10 +57,13 @@ public class CallQueryWizard {
* structures) of a single
* registry key accessible.
*/
- public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey) {
+ public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey)
+ {
com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null;
if (stringImplementationName.equals(QueryWizardImplementation.class.getName()))
+ {
xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(QueryWizardImplementation.class, QueryWizardImplementation.__serviceName, xMSF, xregistrykey);
+ }
return xsingleservicefactory;
}
@@ -71,14 +75,16 @@ public class CallQueryWizard {
* structures) of a single
* registry key accessible.
*/
- public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey) {
+ public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey)
+ {
return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(QueryWizardImplementation.class.getName(), QueryWizardImplementation.__serviceName, xregistrykey);
}
/** This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
- public static class QueryWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor {
+ public static class QueryWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor
+ {
PropertyValue[] databaseproperties;
public XComponent Document = null;
@@ -88,39 +94,45 @@ public class CallQueryWizard {
* @param xmultiservicefactoryInitialization A special service factory
* could be introduced while initializing.
*/
- public QueryWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) {
+ public QueryWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
super();
xmultiservicefactory = xmultiservicefactoryInitialization;
- registerProperty("Document", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
- registerProperty("DocumentDefinition", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
+ registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
+ registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
}
- public void trigger(String sEvent) {
- try {
- if (sEvent.compareTo("start") == 0) {
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.compareTo("start") == 0)
+ {
QueryWizard CurQueryWizard = new QueryWizard(xmultiservicefactory);
XComponent[] obj = CurQueryWizard.startQueryWizard(xmultiservicefactory, databaseproperties);
- if ( obj != null ){
+ if (obj != null)
+ {
DocumentDefinition = obj[1];
Document = obj[0];
}
CurQueryWizard = null;
}
- else if (sEvent.compareTo("end") == 0) {
+ else if (sEvent.compareTo("end") == 0)
+ {
DocumentDefinition = null;
Document = null;
databaseproperties = null;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
System.gc();
}
-
/** The service name, that must be used to get an instance of this service.
*/
private static final String __serviceName = "com.sun.star.wizards.query.CallQueryWizard";
-
/** The service manager, that gives access to all registered services.
*/
private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
@@ -132,14 +144,16 @@ public class CallQueryWizard {
* @throws Exception Every exception will not be handled, but will be
* passed to the caller.
*/
- public void initialize(Object[] object) throws com.sun.star.uno.Exception {
+ public void initialize(Object[] object) throws com.sun.star.uno.Exception
+ {
databaseproperties = Properties.convertToPropertyValueArray(object);
}
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
- public java.lang.String[] getSupportedServiceNames() {
+ public java.lang.String[] getSupportedServiceNames()
+ {
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
@@ -152,10 +166,12 @@ public class CallQueryWizard {
* @param stringService Service name.
* @return True, if the given service name will be supported.
*/
- public boolean supportsService(String stringService) {
+ public boolean supportsService(String stringService)
+ {
boolean booleanSupportsService = false;
- if (stringService.equals(__serviceName)) {
+ if (stringService.equals(__serviceName))
+ {
booleanSupportsService = true;
}
return (booleanSupportsService);
@@ -172,13 +188,18 @@ public class CallQueryWizard {
* whole combination of objects.
* @return Array of bytes, in order to distinguish between two sets.
*/
- public byte[] getImplementationId() {
- byte[] byteReturn = {
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
};
- try {
+ try
+ {
byteReturn = new String("" + this.hashCode()).getBytes();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
@@ -188,7 +209,8 @@ public class CallQueryWizard {
/** Return the class name of the component.
* @return Class name of the component.
*/
- public java.lang.String getImplementationName() {
+ public java.lang.String getImplementationName()
+ {
return (QueryWizardImplementation.class.getName());
}
@@ -197,13 +219,21 @@ public class CallQueryWizard {
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- public Type[] getTypes() {
- Type[] typeReturn = {
+ public Type[] getTypes()
+ {
+ Type[] typeReturn =
+ {
};
- try {
- typeReturn = new Type[] { new Type(com.sun.star.task.XJobExecutor.class), new Type(com.sun.star.lang.XTypeProvider.class), new Type(com.sun.star.lang.XServiceInfo.class), new Type(com.sun.star.lang.XInitialization.class)};
- } catch (Exception exception) {
+ try
+ {
+ typeReturn = new Type[]
+ {
+ new Type(com.sun.star.task.XJobExecutor.class), new Type(com.sun.star.lang.XTypeProvider.class), new Type(com.sun.star.lang.XServiceInfo.class), new Type(com.sun.star.lang.XInitialization.class)
+ };
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java
index 7056c690f10f..8535b2a4a876 100644
--- a/wizards/com/sun/star/wizards/query/Finalizer.java
+++ b/wizards/com/sun/star/wizards/query/Finalizer.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -38,17 +38,19 @@ import com.sun.star.sdb.CommandType;
import com.sun.star.uno.*;
import com.sun.star.wizards.ui.*;
-public class Finalizer {
- QueryWizard CurUnoDialog;
- String resQuery;
- Object txtSummary;
- Object txtTitle;
- XRadioButton xRadioDisplayQuery;
- XRadioButton xRadioModifyQuery;
+public class Finalizer
+{
- QuerySummary CurDBMetaData;
+ private QueryWizard CurUnoDialog;
+ private String resQuery;
+ private Object m_aTxtSummary;
+ private Object m_aTxtTitle;
+ private XRadioButton xRadioDisplayQuery;
+ private XRadioButton xRadioModifyQuery;
+ private QuerySummary CurDBMetaData;
- public Finalizer(QueryWizard _CurUnoDialog, QuerySummary _CurDBMetaData) {
+ public Finalizer(QueryWizard _CurUnoDialog, QuerySummary _CurDBMetaData)
+ {
short curtabindex = (short) (100 * QueryWizard.SOSUMMARYPAGE);
String reslblQueryTitle;
String resoptDisplayQuery;
@@ -65,68 +67,122 @@ public class Finalizer {
resQuery = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 1);
int curHelpIndex = 40955;
- CurUnoDialog.insertLabel("lblQueryTitle", new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(52)});
- txtTitle = CurUnoDialog.insertTextField("txtQueryTitle", 0, null, new String[] { "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(90)});
- CurUnoDialog.insertLabel("lblHowGoOn", new String[] { "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(112)});
+ CurUnoDialog.insertLabel("lblQueryTitle", new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(52)
+ });
+ m_aTxtTitle = CurUnoDialog.insertTextField("txtQueryTitle", 0, null, new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(12), "HID:" + curHelpIndex++, new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(90)
+ });
+ CurUnoDialog.insertLabel("lblHowGoOn", new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(16), reslblHowGoOn, Boolean.TRUE, new Integer(192), new Integer(27), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(112)
+ });
this.xRadioDisplayQuery = CurUnoDialog.insertRadioButton("optDisplayQuery",
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(9), "HID:" + curHelpIndex++, resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118)
+ });
this.xRadioModifyQuery = CurUnoDialog.insertRadioButton("optModifyQuery",
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118)});
- CurUnoDialog.insertFixedLine("flnSummary", new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(10), resflnSummary, new Integer(95), new Integer(68), new Integer(8), new Short(curtabindex++), new Integer(209)});
- txtSummary = CurUnoDialog.insertTextField("txtSummary", 0, null, new String[] { "Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "ReadOnly", "Step", "VScroll", "Width" },
- new Object[] { new Integer(96), "HID:" + curHelpIndex++, Boolean.TRUE, new Integer(95), new Integer(80), Boolean.TRUE, new Integer(8), Boolean.TRUE, new Integer(209)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:" + curHelpIndex++, resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARYPAGE), new Short(curtabindex++), new Integer(118)
+ });
+ CurUnoDialog.insertFixedLine("flnSummary", new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), resflnSummary, new Integer(95), new Integer(68), new Integer(8), new Short(curtabindex++), new Integer(209)
+ });
+ m_aTxtSummary = CurUnoDialog.insertTextField("txtSummary", 0, null, new String[]
+ {
+ "Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "ReadOnly", "Step", "VScroll", "Width"
+ },
+ new Object[]
+ {
+ new Integer(96), "HID:" + curHelpIndex++, Boolean.TRUE, new Integer(95), new Integer(80), Boolean.TRUE, new Integer(8), Boolean.TRUE, new Integer(209)
+ });
}
/* TODO: The title textbox always has to be updated when
- a new Table has been selected if it is clear that the user has not made any input meanwhile
- */
- protected String initialize() {
- try {
- String sCurQueryName = AnyConverter.toString(Helper.getUnoPropertyValue(UnoDialog.getModel(txtTitle), "Text"));
- if (sCurQueryName != null) {
- if (sCurQueryName.equals("")) {
+ a new Table has been selected if it is clear that the user has not made any input meanwhile
+ */
+ protected String initialize()
+ {
+ try
+ {
+ String sCurQueryName = AnyConverter.toString(Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text"));
+ if (sCurQueryName != null)
+ {
+ if (sCurQueryName.equals(""))
+ {
String[] sCommandNames = CurDBMetaData.getIncludedCommandNames();
sCurQueryName = resQuery + "_" + sCommandNames[0];
- sCurQueryName = CurDBMetaData.ConnectionTools.getObjectNames().suggestName(CommandType.QUERY,sCurQueryName);
- Helper.setUnoPropertyValue(UnoDialog.getModel(txtTitle), "Text", sCurQueryName);
+ sCurQueryName = CurDBMetaData.ConnectionTools.getObjectNames().suggestName(CommandType.QUERY, sCurQueryName);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text", sCurQueryName);
}
}
CurDBMetaData.setSummaryString();
CurUnoDialog.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString());
return sCurQueryName;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return "";
}
}
- private String getTitle() {
- return (String) Helper.getUnoPropertyValue(UnoDialog.getModel(txtTitle), "Text");
+ private String getTitle()
+ {
+ final String sTitle = (String) Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text");
+ return sTitle;
}
- public XComponent[] finish() {
+ public XComponent[] finish()
+ {
XComponent[] ret = null;
- try {
+ try
+ {
CurDBMetaData.oSQLQueryComposer = new SQLQueryComposer(CurDBMetaData);
String queryname = getTitle();
boolean bsuccess = CurDBMetaData.oSQLQueryComposer.setQueryCommand(queryname, CurUnoDialog.xWindow, true, true);
- if (bsuccess) {
+ if (bsuccess)
+ {
bsuccess = CurDBMetaData.createQuery(CurDBMetaData.oSQLQueryComposer, queryname);
- if ( bsuccess ){
+ if (bsuccess)
+ {
short igoon = AnyConverter.toShort(Helper.getUnoPropertyValue(UnoDialog.getModel(xRadioDisplayQuery), "State"));
if (igoon == (short) 1)
{
ret = CurDBMetaData.switchtoDataViewmode(queryname,
- CommandType.QUERY,
- CurUnoDialog.getCurFrame());
+ CommandType.QUERY,
+ CurUnoDialog.getCurFrame());
}
else
{
@@ -140,7 +196,9 @@ public class Finalizer {
CurDBMetaData.oSQLQueryComposer = null;
CurDBMetaData = null;
CurUnoDialog = null;
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
e.printStackTrace();
}
return ret;
diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java
index 1251ad71fb22..07e66d0a7e1c 100644
--- a/wizards/com/sun/star/wizards/query/QuerySummary.java
+++ b/wizards/com/sun/star/wizards/query/QuerySummary.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,31 +26,34 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.query;
+ ************************************************************************/
+package com.sun.star.wizards.query;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.*;
-import com.sun.star.wizards.ui.FilterComponent;
+//import com.sun.star.wizards.ui.FilterComponent;
import com.sun.star.wizards.ui.*;
import com.sun.star.wizards.db.*;
import com.sun.star.beans.*;
-public class QuerySummary extends QueryMetaData {
+public class QuerySummary extends QueryMetaData
+{
+
final protected int RID_QUERY = 2300;
final protected int RID_REPORT = 2400;
String sSummary;
Resource oResource;
- XMultiServiceFactory xMSF;
+ // XMultiServiceFactory xMSF;
private String sSeparator;
private String sReturnChar;
private String sAnd;
private String sOr;
-
- public QuerySummary(XMultiServiceFactory _xMSF, Resource _oResource) {
+ public QuerySummary(XMultiServiceFactory _xMSF, Resource _oResource)
+ {
super(_xMSF);
this.oResource = _oResource;
- this.xMSF = _xMSF;
+ // this.xMSF = _xMSF;
sAnd = oResource.getResText(RID_QUERY + 33);
sOr = oResource.getResText(RID_QUERY + 34);
sSeparator = oResource.getResText(RID_QUERY + 91);
@@ -58,17 +61,18 @@ public class QuerySummary extends QueryMetaData {
}
/* boolean bAssignAliases = xDBMetaData.supportsColumnAliasing();
- boolean bSupportsGroupByUnrelated = xDBMetaData.supportsGroupByUnrelated();
- boolean bSupportsOrderByUnrelated = xDBMetaData.supportsOrderByUnrelated();
- boolean bSupportsNumericFunctions = xDBMetaData.getNumericFunctions() != "";
- xDBMetaData.getMaxColumnsInGroupBy();
- xDBMetaData.getMaxColumnsInOrderBy();
- xDBMetaData.getMaxColumnsInSelect();
- xDBMetaData.getMaxCharLiteralLength(); // gef?hrlich, da h?chstwahrscheinlich nicht sauber in jedem Treiber implementiert!!!!!
- * */
-
- public void setSummaryString() {
- try {
+ boolean bSupportsGroupByUnrelated = xDBMetaData.supportsGroupByUnrelated();
+ boolean bSupportsOrderByUnrelated = xDBMetaData.supportsOrderByUnrelated();
+ boolean bSupportsNumericFunctions = xDBMetaData.getNumericFunctions() != "";
+ xDBMetaData.getMaxColumnsInGroupBy();
+ xDBMetaData.getMaxColumnsInOrderBy();
+ xDBMetaData.getMaxColumnsInSelect();
+ xDBMetaData.getMaxCharLiteralLength(); // gef?hrlich, da h?chstwahrscheinlich nicht sauber in jedem Treiber implementiert!!!!!
+ * */
+ public void setSummaryString()
+ {
+ try
+ {
String sFieldNamesFraction = "";
String sSortingFraction = "";
String sFilterFraction = "";
@@ -76,44 +80,57 @@ public class QuerySummary extends QueryMetaData {
String sGroupByFraction = "";
String sHavingFraction = "";
sFieldNamesFraction = combineFieldNameFraction() + sReturnChar;
- sSortingFraction = combinePartString(RID_QUERY + 51, getSortFieldNames(), RID_QUERY + 52, RID_QUERY + 93, new String[] { "<FIELDNAME>", "<SORTMODE>" }) + sReturnChar;
+ sSortingFraction = combinePartString(RID_QUERY + 51, getSortFieldNames(), RID_QUERY + 52, RID_QUERY + 93, new String[]
+ {
+ "<FIELDNAME>", "<SORTMODE>"
+ }) + sReturnChar;
sFilterFraction = combineFilterNameFraction(this.getFilterConditions(), RID_QUERY + 53, RID_QUERY + 54) + sReturnChar;
// if (xDBMetaData.getNumericFunctions().length() > 0)
// sAggregateFraction = combinePartString(RID_QUERY + 55, AggregateFieldNames, RID_QUERY + 56, RID_QUERY + 95, new String[]{ "<CALCULATEDFUNCTION>", "<FIELDNAME>"}) + sReturnChar;
- if (xDBMetaData.supportsGroupBy()) {
+ if (xDBMetaData.supportsGroupBy())
+ {
sGroupByFraction = combinePartString(RID_QUERY + 57, GroupFieldNames, RID_QUERY + 58) + sReturnChar;
sHavingFraction = combineFilterNameFraction(getGroupByFilterConditions(), RID_QUERY + 59, RID_QUERY + 60);
}
// TODO: remove the last return from the string
sSummary = sFieldNamesFraction + sSortingFraction + sFilterFraction + sAggregateFraction + sGroupByFraction + sHavingFraction;
sSummary = JavaTools.replaceSubString(sSummary, "", "~");
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
- public String getSummaryString() {
+ public String getSummaryString()
+ {
return sSummary;
}
-
- private String combineFilterNameFraction(PropertyValue[][] _filterconditions, int _InitResID, int _AlternativeResID) {
- if (_filterconditions != null) {
- if (_filterconditions.length > 0) {
+ private String combineFilterNameFraction(PropertyValue[][] _filterconditions, int _InitResID, int _AlternativeResID)
+ {
+ if (_filterconditions != null)
+ {
+ if (_filterconditions.length > 0)
+ {
String sconditions = "";
String sStart = oResource.getResText(_InitResID);
String BaseString = oResource.getResText(RID_QUERY + 96);
- if (_filterconditions.length == 1) {
+ if (_filterconditions.length == 1)
+ {
PropertyValue[] curfilterconditions = _filterconditions[0];
- for (int i = 0; i < curfilterconditions.length; i++) {
+ for (int i = 0; i < curfilterconditions.length; i++)
+ {
sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[0][i], this);
sconditions = appendClauseSeparator(sconditions, " " + sAnd + " ", i, curfilterconditions.length);
}
- } else {
+ }
+ else
+ {
- for (int i = 0; i < _filterconditions.length; i++) {
- sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0],this);
+ for (int i = 0; i < _filterconditions.length; i++)
+ {
+ sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0], this);
sconditions = appendClauseSeparator(sconditions, " " + sOr + " ", i, _filterconditions.length);
}
}
@@ -124,87 +141,115 @@ public class QuerySummary extends QueryMetaData {
return oResource.getResText(_AlternativeResID);
}
- private String combineFieldNameFraction() {
+ private String combineFieldNameFraction()
+ {
String CurString = "";
String sReturn = oResource.getResText(RID_QUERY + 50);
String BaseString = oResource.getResText(RID_QUERY + 92);
- for (int i = 0; i < FieldColumns.length; i++) {
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
CurString = BaseString;
- FieldColumn CurDBFieldColumn = super.getFieldColumnByDisplayName(FieldColumns[i].DisplayFieldName);
- int iAggregate = getAggregateIndex(FieldColumns[i].FieldName);
- if (iAggregate > -1) {
+ FieldColumn CurDBFieldColumn = super.getFieldColumnByDisplayName(FieldColumns[i].getDisplayFieldName());
+ int iAggregate = getAggregateIndex(FieldColumns[i].m_sFieldName);
+ if (iAggregate > -1)
+ {
String sAggregateDisplay = AggregateFieldNames[iAggregate][1] + "(" + AggregateFieldNames[iAggregate][0] + ")";
CurString = JavaTools.replaceSubString(CurString, sAggregateDisplay, "<FIELDNAME>");
}
else
- CurString = JavaTools.replaceSubString(CurString, CurDBFieldColumn.DisplayFieldName, "<FIELDNAME>");
- sReturn += JavaTools.replaceSubString(CurString, CurDBFieldColumn.FieldTitle, "<FIELDTITLE>");
+ {
+ CurString = JavaTools.replaceSubString(CurString, CurDBFieldColumn.getDisplayFieldName(), "<FIELDNAME>");
+ }
+ sReturn += JavaTools.replaceSubString(CurString, CurDBFieldColumn.getFieldTitle(), "<FIELDTITLE>");
sReturn = appendClauseSeparator(sReturn, sSeparator, i, FieldColumns.length);
}
return sReturn;
}
-
- private String appendClauseSeparator(String _basestring, String _suffix, int _i, int _fieldcount) {
+ private String appendClauseSeparator(String _basestring, String _suffix, int _i, int _fieldcount)
+ {
if (_i < _fieldcount - 1)
+ {
_basestring += _suffix;
+ }
return _basestring;
}
-
-
// TODO: How can you merge the following two methods to a single one in a smarter way??
- public String combinePartString(int _InitResID, String[] _FieldNames, int _AlternativeResID) {
- if (_FieldNames != null) {
- if (_FieldNames.length > 0) {
+ public String combinePartString(int _InitResID, String[] _FieldNames, int _AlternativeResID)
+ {
+ if (_FieldNames != null)
+ {
+ if (_FieldNames.length > 0)
+ {
return ArrayFieldsToString(_InitResID, _FieldNames);
}
}
return oResource.getResText(_AlternativeResID);
}
- protected String ArrayFieldsToString(int _InitResID, String[] _FieldNames) {
+ protected String ArrayFieldsToString(int _InitResID, String[] _FieldNames)
+ {
String sReturn = oResource.getResText(_InitResID);
int FieldCount = _FieldNames.length;
- for (int i = 0; i < FieldCount; i++) {
- sReturn += this.getFieldColumnByDisplayName(_FieldNames[i]).FieldTitle;
+ for (int i = 0; i < FieldCount; i++)
+ {
+ sReturn += this.getFieldColumnByDisplayName(_FieldNames[i]).getFieldTitle();
if (i < FieldCount - 1)
+ {
sReturn += sSeparator;
+ }
}
return (sReturn);
}
- public String combinePartString(int _InitResID, String[][] _FieldNames, int _AlternativeResID, int _BaseStringID, String[] _ReplaceTags) {
- if (_FieldNames != null) {
+ public String combinePartString(int _InitResID, String[][] _FieldNames, int _AlternativeResID, int _BaseStringID, String[] _ReplaceTags)
+ {
+ if (_FieldNames != null)
+ {
if (_FieldNames.length > 0)
+ {
return ArrayFieldsToString(_InitResID, _FieldNames, _BaseStringID, _ReplaceTags);
+ }
}
return oResource.getResText(_AlternativeResID);
}
- public String ArrayFieldsToString(int _InitResID, String[][] _FieldNames, int _BaseStringID, String[] _ReplaceTags) {
+ public String ArrayFieldsToString(int _InitResID, String[][] _FieldNames, int _BaseStringID, String[] _ReplaceTags)
+ {
String CurString = "";
String sReturn = oResource.getResText(_InitResID);
int FieldCount = _FieldNames.length;
- if (FieldCount > 0) {
+ if (FieldCount > 0)
+ {
int DimCount = _FieldNames[0].length;
String BaseString = oResource.getResText(_BaseStringID);
- for (int i = 0; i < FieldCount; i++) {
- for (int a = 0; a < DimCount; a++) {
- if (a == 0){
- int iAggregate = getAggregateIndex(this.getFieldColumnByDisplayName(_FieldNames[i][a]).DisplayFieldName);
- if (iAggregate > -1){
+ for (int i = 0; i < FieldCount; i++)
+ {
+ for (int a = 0; a < DimCount; a++)
+ {
+ if (a == 0)
+ {
+ int iAggregate = getAggregateIndex(this.getFieldColumnByDisplayName(_FieldNames[i][a]).getDisplayFieldName());
+ if (iAggregate > -1)
+ {
String sAggregateDisplay = AggregateFieldNames[iAggregate][1] + "(" + AggregateFieldNames[iAggregate][0] + ")";
CurString = JavaTools.replaceSubString(BaseString, sAggregateDisplay, _ReplaceTags[a]);
}
else
- CurString = JavaTools.replaceSubString(BaseString, this.getFieldColumnByDisplayName(_FieldNames[i][a]).FieldTitle, _ReplaceTags[a]);
+ {
+ CurString = JavaTools.replaceSubString(BaseString, this.getFieldColumnByDisplayName(_FieldNames[i][a]).getFieldTitle(), _ReplaceTags[a]);
+ }
}
else
+ {
CurString = JavaTools.replaceSubString(CurString, _FieldNames[i][a], _ReplaceTags[a]);
+ }
}
sReturn += CurString;
if (i < FieldCount - 1)
+ {
sReturn += sSeparator;
+ }
}
}
return sReturn;
diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java
index 7ee4d68a9229..778faeb08903 100644
--- a/wizards/com/sun/star/wizards/query/QueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/QueryWizard.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -43,16 +43,16 @@ import com.sun.star.wizards.ui.*;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.uno.UnoRuntime;
-public class QueryWizard extends WizardDialog {
+public class QueryWizard extends WizardDialog
+{
private XFrame CurFrame;
- public XFrame getCurFrame() {
+ public XFrame getCurFrame()
+ {
return CurFrame;
}
-
public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox";
-
public static final int SOFIELDSELECTIONPAGE = 1;
public static final int SOSORTINGPAGE = 2;
public static final int SOFILTERPAGE = 3;
@@ -61,7 +61,6 @@ public class QueryWizard extends WizardDialog {
public static final int SOGROUPFILTERPAGE = 6;
public static final int SOTITLESPAGE = 7;
public static final int SOSUMMARYPAGE = 8;
-
CommandFieldSelection CurDBCommandFieldSelection;
SortingComponent CurSortingComponent;
FieldSelection CurGroupFieldSelection;
@@ -82,23 +81,24 @@ public class QueryWizard extends WizardDialog {
String resQueryWizard;
String reslblGroupBy;
String resmsgNonNumericAsGroupBy;
-
- XComponent[] components = null;
-
- //Resources Object
+ XComponent[] components = null; //Resources Object
short CurTabIndex = 0;
- public QueryWizard(XMultiServiceFactory xMSF) {
+ public QueryWizard(XMultiServiceFactory xMSF)
+ {
super(xMSF, 40970);
addResourceHandler("QueryWizard", "dbw");
CurDBMetaData = new QuerySummary(xMSF, m_oResource);
}
- public static void main(String args[]) {
+ public static void main(String args[])
+ {
String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; // //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- try {
+ try
+ {
XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
- if (xLocMSF != null) {
+ if (xLocMSF != null)
+ {
PropertyValue[] curproperties = new PropertyValue[1];
curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/Mydbwizard2DocAssign.odb"); //Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb MyDBase.odb; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1");
curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///x:/bc/nyt1.odb"); //Mydbwizard2DocAssign.odb; MyDBase.odb, Mydbwizard2DocAssign.odb MyDBase.odb; Mydbwizard2DocAssign.odb; NewAccessDatabase, MyDocAssign baseLocation ); "DataSourceName", "db1");
@@ -108,12 +108,12 @@ public class QueryWizard extends WizardDialog {
QueryWizard CurQueryWizard = new QueryWizard(xLocMSF);
CurQueryWizard.startQueryWizard(xLocMSF, curproperties);
}
- } catch (java.lang.Exception jexception) {
+ }
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
}
}
-
-
//!<<<<<<< QueryWizard.java
//! public void startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues) {
//! try {
@@ -144,30 +144,43 @@ public class QueryWizard extends WizardDialog {
//! insertQueryRelatedSteps();
//! short RetValue = executeDialog(CurFrame.getContainerWindow().getPosSize());
//!=======
- public XComponent[] startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues) {
- try {
- if (CurDBMetaData.getConnection(CurPropertyValues)){
+ public XComponent[] startQueryWizard(XMultiServiceFactory xMSF, PropertyValue[] CurPropertyValues)
+ {
+ try
+ {
+ if (CurDBMetaData.getConnection(CurPropertyValues))
+ {
reslblFields = m_oResource.getResText(UIConsts.RID_QUERY + 4);
reslblFieldHeader = m_oResource.getResText(UIConsts.RID_QUERY + 19); //Fielnames in AliasComponent
reslblAliasHeader = m_oResource.getResText(UIConsts.RID_QUERY + 20); //Fieldtitles header in AliasComponent
reslblSelFields = m_oResource.getResText(UIConsts.RID_QUERY + 50);
reslblTables = m_oResource.getResText(UIConsts.RID_QUERY + 3);
- reslblGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 18);
+ reslblGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 18);
resQueryWizard = m_oResource.getResText(UIConsts.RID_QUERY + 2);
resmsgNonNumericAsGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 88);
- Helper.setUnoPropertyValues(xDialogModel, new String[] { "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width" },
- new Object[] { new Integer(210), Boolean.TRUE, "DialogQuery", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), resQueryWizard, new Integer(310)});
+ Helper.setUnoPropertyValues(xDialogModel, new String[]
+ {
+ "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width"
+ },
+ new Object[]
+ {
+ new Integer(210), Boolean.TRUE, "DialogQuery", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), resQueryWizard, new Integer(310)
+ });
drawNaviBar();
setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8);
this.setMaxStep(8);
buildSteps();
this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValues, false);
if (Properties.hasPropertyValue(CurPropertyValues, "ParentFrame"))
- CurFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class,Properties.getPropertyValue(CurPropertyValues, "ParentFrame"));
+ {
+ CurFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, Properties.getPropertyValue(CurPropertyValues, "ParentFrame"));
+ }
else
+ {
CurFrame = Desktop.getActiveFrame(xMSF);
- // CurFrame = OfficeDocument.createNewFrame(xMSF, this);
- // desktopFrame = Desktop.findAFrame(xMSF, CurFrame, desktopFrame);
+ }
+ // CurFrame = OfficeDocument.createNewFrame(xMSF, this);
+ // desktopFrame = Desktop.findAFrame(xMSF, CurFrame, desktopFrame);
XWindowPeer windowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, CurFrame.getContainerWindow());
this.xMSF = xMSF;
@@ -176,7 +189,9 @@ public class QueryWizard extends WizardDialog {
insertQueryRelatedSteps();
executeDialog(CurFrame.getContainerWindow().getPosSize());
}
- } catch (java.lang.Exception jexception) {
+ }
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
//!>>>>>>> 1.14
}
@@ -195,46 +210,61 @@ public class QueryWizard extends WizardDialog {
return ret;
}
-
- public void enableRoadmapItems(String[] _FieldNames, boolean _bEnabled) {
- try {
+ public void enableRoadmapItems(String[] _FieldNames, boolean _bEnabled)
+ {
+ try
+ {
Object oRoadmapItem;
int CurStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, "Step"));
boolean bEnabled = false;
int CurItemID;
- for (int i = 0; i < getRMItemCount(); i++) {
+ for (int i = 0; i < getRMItemCount(); i++)
+ {
oRoadmapItem = this.xIndexContRoadmap.getByIndex(i);
CurItemID = AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmapItem, "ID"));
- switch (CurItemID) {
- case SOAGGREGATEPAGE :
+ switch (CurItemID)
+ {
+ case SOAGGREGATEPAGE:
if (_bEnabled == true)
+ {
bEnabled = ((CurDBMetaData.hasNumericalFields()) && (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar()));
+ }
break;
- case SOGROUPSELECTIONPAGE :
+ case SOGROUPSELECTIONPAGE:
bEnabled = CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY;
break;
- case SOGROUPFILTERPAGE :
+ case SOGROUPFILTERPAGE:
bEnabled = false;
if (_bEnabled == true)
+ {
bEnabled = (CurDBMetaData.GroupByFilterConditions.length > 0);
+ }
break;
- default :
+ default:
if (CurItemID > CurStep)
+ {
bEnabled = _bEnabled;
+ }
else
+ {
bEnabled = true;
+ }
break;
}
super.setStepEnabled(CurItemID, bEnabled);
}
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void insertQueryRelatedSteps() {
- try {
+ public void insertQueryRelatedSteps()
+ {
+ try
+ {
// String[] sRMItemLabels = getRMItemLabels();
setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80);
addRoadmap();
@@ -243,8 +273,11 @@ public class QueryWizard extends WizardDialog {
i = insertRoadmapItem(i, false, SOSORTINGPAGE - 1, SOSORTINGPAGE); // Orderby is always supported
i = insertRoadmapItem(i, false, SOFILTERPAGE - 1, SOFILTERPAGE);
if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar())
+ {
i = insertRoadmapItem(i, CurDBMetaData.hasNumericalFields(), SOAGGREGATEPAGE - 1, SOAGGREGATEPAGE);
- if (CurDBMetaData.xDBMetaData.supportsGroupBy()) {
+ }
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
i = insertRoadmapItem(i, false, SOGROUPSELECTIONPAGE - 1, SOGROUPSELECTIONPAGE);
i = insertRoadmapItem(i, false, SOGROUPFILTERPAGE - 1, SOGROUPFILTERPAGE);
}
@@ -254,13 +287,17 @@ public class QueryWizard extends WizardDialog {
setRoadmapInteractive(true);
setRoadmapComplete(true);
setCurrentRoadmapItemID((short) 1);
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
Resource.showCommonResourceError(xMSF);
}
}
- public void buildSteps() {
- try {
+ public void buildSteps()
+ {
+ try
+ {
// curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411);
// curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
@@ -272,8 +309,11 @@ public class QueryWizard extends WizardDialog {
CurFilterComponent.addNumberFormats();
if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar())
+ {
CurAggregateComponent = new AggregateComponent(this, CurDBMetaData, SOAGGREGATEPAGE, 97, 69, 209, 5, 40895);
- if (CurDBMetaData.xDBMetaData.supportsGroupBy()) {
+ }
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
CurGroupFieldSelection = new FieldSelection(this, SOGROUPSELECTIONPAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false);
CurGroupFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
CurGroupFilterComponent = new FilterComponent(this, xMSF, SOGROUPFILTERPAGE, 97, 27, 209, 3, CurDBMetaData, 40923);
@@ -281,93 +321,109 @@ public class QueryWizard extends WizardDialog {
CurTitlesComponent = new TitlesComponent(this, SOTITLESPAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940);
CurFinalizer = new Finalizer(this, CurDBMetaData);
enableNavigationButtons(false, false, false);
- } catch (com.sun.star.uno.Exception exception){
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
Resource.showCommonResourceError(xMSF);
}
}
-
- public void finishWizard() {
+ public void finishWizard()
+ {
int ncurStep = getCurrentStep();
if ((switchToStep(ncurStep, SOSUMMARYPAGE)) || (ncurStep == SOSUMMARYPAGE))
+ {
components = CurFinalizer.finish();
+ }
}
-
- protected void enterStep(int nOldStep, int nNewStep) {
- try {
- if (nOldStep <= SOGROUPSELECTIONPAGE && nNewStep > SOGROUPSELECTIONPAGE) {
- if (CurDBMetaData.xDBMetaData.supportsGroupBy()) {
- CurDBMetaData.setGroupFieldNames(CurGroupFieldSelection.getSelectedFieldNames());
- CurDBMetaData.GroupFieldNames = JavaTools.removeOutdatedFields(CurDBMetaData.GroupFieldNames, CurDBMetaData.NonAggregateFieldNames);
- CurDBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.GroupFieldNames);
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ try
+ {
+ if (nOldStep <= SOGROUPSELECTIONPAGE && nNewStep > SOGROUPSELECTIONPAGE)
+ {
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
+ CurDBMetaData.setGroupFieldNames(CurGroupFieldSelection.getSelectedFieldNames());
+ CurDBMetaData.GroupFieldNames = JavaTools.removeOutdatedFields(CurDBMetaData.GroupFieldNames, CurDBMetaData.NonAggregateFieldNames);
+ CurDBMetaData.GroupByFilterConditions = JavaTools.removeOutdatedFields(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.GroupFieldNames);
+ }
+ }
+ switch (nNewStep)
+ {
+ case SOFIELDSELECTIONPAGE:
+ break;
+ case SOSORTINGPAGE:
+ CurSortingComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.getSortFieldNames());
+ break;
+ case SOFILTERPAGE:
+ CurFilterComponent.initialize(CurDBMetaData.getFilterConditions(), CurDBMetaData.getDisplayFieldNames());
+ break;
+ case SOAGGREGATEPAGE:
+ CurAggregateComponent.initialize();
+ break;
+ case SOGROUPSELECTIONPAGE:
+ break;
+ case SOGROUPFILTERPAGE:
+ CurGroupFilterComponent.initialize(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.getGroupFieldNames());
+ break;
+ case SOTITLESPAGE:
+ CurTitlesComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.FieldTitleSet);
+ break;
+ case SOSUMMARYPAGE:
+ CurFinalizer.initialize();
+ break;
+ default:
+ break;
}
}
- switch (nNewStep) {
- case SOFIELDSELECTIONPAGE :
- break;
- case SOSORTINGPAGE :
- CurSortingComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.getSortFieldNames());
- break;
- case SOFILTERPAGE :
- CurFilterComponent.initialize(CurDBMetaData.FilterConditions, CurDBMetaData.getDisplayFieldNames());
- break;
- case SOAGGREGATEPAGE :
- CurAggregateComponent.initialize();
- break;
- case SOGROUPSELECTIONPAGE :
- break;
- case SOGROUPFILTERPAGE :
- CurGroupFilterComponent.initialize(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.getGroupFieldNames());
- break;
- case SOTITLESPAGE :
- CurTitlesComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.FieldTitleSet);
- break;
- case SOSUMMARYPAGE :
- CurFinalizer.initialize();
- break;
- default :
- break;
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
}
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- }}
-
+ }
- protected void leaveStep(int nOldStep, int nNewStep) {
- switch (nOldStep) {
- case SOFIELDSELECTIONPAGE :
- CurDBMetaData.reorderFieldColumns(CurDBCommandFieldSelection.getSelectedFieldNames());
- CurDBMetaData.initializeFieldTitleSet(true);
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+ switch (nOldStep)
+ {
+ case SOFIELDSELECTIONPAGE:
+ CurDBMetaData.reorderFieldColumns(CurDBCommandFieldSelection.getSelectedFieldNames());
+ CurDBMetaData.initializeFieldTitleSet(true);
CurDBMetaData.setNumericFields();
searchForOutdatedFields();
break;
- case SOSORTINGPAGE :
+ case SOSORTINGPAGE:
CurDBMetaData.setSortFieldNames(CurSortingComponent.getSortFieldNames());
break;
- case SOFILTERPAGE :
+ case SOFILTERPAGE:
CurDBMetaData.setFilterConditions(CurFilterComponent.getFilterConditions());
break;
- case SOAGGREGATEPAGE :
+ case SOAGGREGATEPAGE:
CurDBMetaData.AggregateFieldNames = CurAggregateComponent.getAggregateFieldNames();
break;
- case SOGROUPSELECTIONPAGE :
+ case SOGROUPSELECTIONPAGE:
break;
- case SOGROUPFILTERPAGE :
+ case SOGROUPFILTERPAGE:
CurDBMetaData.setGroupByFilterConditions(this.CurGroupFilterComponent.getFilterConditions());
break;
- case SOTITLESPAGE :
+ case SOTITLESPAGE:
CurDBMetaData.setFieldTitles(CurTitlesComponent.getFieldTitles());
break;
- case SOSUMMARYPAGE :
+ case SOSUMMARYPAGE:
break;
- default :
+ default:
break;
}
- if (nOldStep < SOGROUPSELECTIONPAGE && nNewStep >= SOGROUPSELECTIONPAGE){
- try {
- if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY){
- if (CurDBMetaData.xDBMetaData.supportsGroupBy()) {
+ if (nOldStep < SOGROUPSELECTIONPAGE && nNewStep >= SOGROUPSELECTIONPAGE)
+ {
+ try
+ {
+ if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)
+ {
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
CurDBMetaData.setNonAggregateFieldNames();
CurGroupFieldSelection.initialize(CurDBMetaData.getUniqueAggregateFieldNames(), false, CurDBMetaData.xDBMetaData.getMaxColumnsInGroupBy());
CurGroupFieldSelection.intializeSelectedFields(CurDBMetaData.NonAggregateFieldNames);
@@ -375,7 +431,9 @@ public class QueryWizard extends WizardDialog {
setStepEnabled(SOGROUPFILTERPAGE, CurAggregateComponent.isGroupingpossible() && CurDBMetaData.NonAggregateFieldNames.length > 0);
}
}
- } catch (SQLException e) {
+ }
+ catch (SQLException e)
+ {
e.printStackTrace();
}
}
@@ -385,30 +443,36 @@ public class QueryWizard extends WizardDialog {
{
String[] sFieldNames = CurDBMetaData.getFieldNames();
String[][] sRemovedFields = JavaTools.removeOutdatedFields(CurDBMetaData.getSortFieldNames(), sFieldNames);
- CurDBMetaData.setSortFieldNames( sRemovedFields );
- CurDBMetaData.FilterConditions = JavaTools.removeOutdatedFields(CurDBMetaData.FilterConditions, sFieldNames);
+ CurDBMetaData.setSortFieldNames(sRemovedFields);
+ CurDBMetaData.setFilterConditions(JavaTools.removeOutdatedFields(CurDBMetaData.getFilterConditions(), sFieldNames));
CurDBMetaData.AggregateFieldNames = JavaTools.removeOutdatedFields(CurDBMetaData.AggregateFieldNames, sFieldNames);
}
- private void enableWizardSteps(String[] NewItems) {
+ private void enableWizardSteps(String[] NewItems)
+ {
boolean bEnabled = NewItems.length > 0;
setControlProperty("btnWizardNext", "Enabled", new Boolean(bEnabled));
setControlProperty("btnWizardFinish", "Enabled", new Boolean(bEnabled));
enableRoadmapItems(NewItems, bEnabled); // Note: Performancewise this could be improved
}
+ public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ {
- public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener {
protected int ID;
- public int getID() {
+ public int getID()
+ {
return ID;
}
- public void setID(String sIncSuffix) {
+ public void setID(String sIncSuffix)
+ {
ID = 1;
- if (sIncSuffix != null) {
- if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_"))) {
+ if (sIncSuffix != null)
+ {
+ if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
+ {
String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
ID = Integer.parseInt(sID);
int a = 0;
@@ -416,21 +480,27 @@ public class QueryWizard extends WizardDialog {
}
}
- public void shiftFromLeftToRight(String[] SelItems, String[] NewItems) {
- if (ID == 1) {
- CurDBMetaData.addSeveralFieldColumns(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (ID == 1)
+ {
+ CurDBMetaData.addSeveralFieldColumns(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
enableWizardSteps(NewItems);
- CurDBCommandFieldSelection.changeSelectedFieldNames(CurDBMetaData.getDisplayFieldNames());
+ CurDBCommandFieldSelection.changeSelectedFieldNames(CurDBMetaData.getDisplayFieldNames());
CurDBCommandFieldSelection.toggleCommandListBox(NewItems);
- } else {
+ }
+ else
+ {
boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTERPAGE), "Enabled", new Boolean(bEnabled));
}
}
- public void shiftFromRightToLeft(String[] SelItems, String[] NewItems) {
+ public void shiftFromRightToLeft(String[] SelItems, String[] NewItems)
+ {
// TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox
- if (ID == 1) {
+ if (ID == 1)
+ {
enableWizardSteps(NewItems);
//! <<<<<<< QueryWizard.java
//! String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
@@ -441,28 +511,39 @@ public class QueryWizard extends WizardDialog {
//! =======
String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
CurDBCommandFieldSelection.addItemsToFieldsListbox(sSelfieldNames);
- CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems);
+ CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems);
//! >>>>>>> 1.14
CurDBCommandFieldSelection.toggleCommandListBox(NewItems);
- } else {
+ }
+ else
+ {
boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
String CurDisplayFieldName = SelItems[0];
- if (JavaTools.FieldInList(CurDBMetaData.NonAggregateFieldNames, CurDisplayFieldName) > -1) {
- showMessageBox( "ErrorBox", VclWindowPeerAttribute.OK, resmsgNonNumericAsGroupBy);
+ if (JavaTools.FieldInList(CurDBMetaData.NonAggregateFieldNames, CurDisplayFieldName) > -1)
+ {
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, resmsgNonNumericAsGroupBy);
CurGroupFieldSelection.xSelFieldsListBox.addItems(SelItems, CurGroupFieldSelection.xSelFieldsListBox.getItemCount());
String FieldList[] = CurGroupFieldSelection.xFieldsListBox.getItems();
int index = JavaTools.FieldInList(FieldList, CurDisplayFieldName);
if (index > -1)
+ {
CurGroupFieldSelection.xFieldsListBox.removeItems((short) index, (short) 1);
- } else
+ }
+ }
+ else
+ {
Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTERPAGE), "Enabled", new Boolean(bEnabled));
+ }
}
}
- public void moveItemDown(String item) {
+
+ public void moveItemDown(String item)
+ {
}
- public void moveItemUp(String item) {
+ public void moveItemUp(String item)
+ {
}
}
}
diff --git a/wizards/com/sun/star/wizards/query/XCallQueryWizard.java b/wizards/com/sun/star/wizards/query/XCallQueryWizard.java
index 4afc21c52865..04cb6303db3f 100644
--- a/wizards/com/sun/star/wizards/query/XCallQueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/XCallQueryWizard.java
@@ -1,9 +1,42 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XCallQueryWizard.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.query;
-public interface XCallQueryWizard extends com.sun.star.uno.XInterface {
+public interface XCallQueryWizard extends com.sun.star.uno.XInterface
+{
// Methods
- public void CallQueryDialog();
-
- // static Member
- public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = { new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallQueryDialog", 0, 0)};
+ public void CallQueryDialog(); // static Member
+ public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] =
+ {
+ new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallQueryDialog", 0, 0)
+ };
}
diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java
index 35f10ac4926b..914ef13f0c75 100644
--- a/wizards/com/sun/star/wizards/report/CallReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java
@@ -29,7 +29,6 @@
************************************************************************/
package com.sun.star.wizards.report;
-
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.PropertyAttribute;
import com.sun.star.uno.Type;
@@ -38,8 +37,6 @@ import com.sun.star.text.XTextDocument;
import com.sun.star.wizards.common.Properties;
import com.sun.star.lang.XComponent;
-
-
/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>) and a
* method, that writes the information into the given registry key
@@ -48,6 +45,7 @@ import com.sun.star.lang.XComponent;
*/
public class CallReportWizard
{
+
static boolean bWizardstartedalready;
/** Gives a factory for creating the service.
@@ -64,19 +62,19 @@ public class CallReportWizard
* registry key accessible.
*/
public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey)
+ {
+ com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null;
+ if (stringImplementationName.equals(
+ ReportWizardImplementation.class.getName()))
{
- com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null;
- if ( stringImplementationName.equals(
- ReportWizardImplementation.class.getName() ) )
- {
- xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(
+ xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(
ReportWizardImplementation.class,
ReportWizardImplementation.__serviceName,
xMSF,
- xregistrykey );
- }
- return xsingleservicefactory;
+ xregistrykey);
}
+ return xsingleservicefactory;
+ }
/** Writes the service information into the given registry key.
* This method is called by the <code>JavaLoader</code>.
@@ -87,18 +85,19 @@ public class CallReportWizard
* registry key accessible.
*/
public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey)
- {
- return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
+ {
+ return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
ReportWizardImplementation.class.getName(),
ReportWizardImplementation.__serviceName,
- xregistrykey );
- }
+ xregistrykey);
+ }
/** This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
public static class ReportWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor
{
+
PropertyValue[] databaseproperties;
public XComponent DocumentDefinition = null;
public XComponent Document = null;
@@ -108,16 +107,16 @@ public class CallReportWizard
* could be introduced while initializing.
*/
public ReportWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
- {
- super();
- xmultiservicefactory = xmultiservicefactoryInitialization;
- registerProperty("Document", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
- registerProperty("DocumentDefinition", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
- }
+ {
+ super();
+ xmultiservicefactory = xmultiservicefactoryInitialization;
+ registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
+ registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
+ }
public void trigger(String sEvent)
- {
- try
+ {
+ try
{
com.sun.star.frame.XComponentLoader xcomponentloader = (com.sun.star.frame.XComponentLoader) com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.frame.XComponentLoader.class, xmultiservicefactory.createInstance("com.sun.star.frame.Desktop"));
if (sEvent.compareTo("start") == 0)
@@ -126,10 +125,17 @@ public class CallReportWizard
{
ReportWizard CurReportWizard = new ReportWizard(xmultiservicefactory);
XComponent[] obj = CurReportWizard.startReportWizard(xmultiservicefactory, databaseproperties);
- if ( obj != null )
+ if (obj != null)
{
DocumentDefinition = obj[0];
- Document = obj[1];
+ if (obj.length > 1)
+ {
+ Document = obj[1];
+ }
+ else
+ {
+ Document = null;
+ }
}
}
bWizardstartedalready = false;
@@ -144,36 +150,32 @@ public class CallReportWizard
{
Dataimport CurDataimport = new Dataimport(xmultiservicefactory);
XTextDocument xTextDocument = null;
- if ( databaseproperties != null )
+ if (databaseproperties != null)
{
- for( int i=0;i < databaseproperties.length;++i)
+ for (int i = 0; i < databaseproperties.length; ++i)
{
- if ( databaseproperties[i].Name.equals("TextDocument") )
+ if (databaseproperties[i].Name.equals("TextDocument"))
{
xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, databaseproperties[i].Value);
}
}
- if ( xTextDocument != null )
+ if (xTextDocument != null)
{
- CurDataimport.createReport(xmultiservicefactory,xTextDocument,databaseproperties);
+ CurDataimport.createReport(xmultiservicefactory, xTextDocument, databaseproperties);
}
}
}
}
-
- catch( Exception exception )
- {
- System.err.println( exception );
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+ System.gc();
}
- System.gc();
- }
-
-
/** The service name, that must be used to get an instance of this service.
*/
private static final String __serviceName = "com.sun.star.wizards.report.CallReportWizard";
-
/** The service manager, that gives access to all registered services.
*/
private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
@@ -186,23 +188,23 @@ public class CallReportWizard
* passed to the caller.
*/
public void initialize(Object[] object) throws com.sun.star.uno.Exception
- {
- this.databaseproperties = Properties.convertToPropertyValueArray(object);
+ {
+ this.databaseproperties = Properties.convertToPropertyValueArray(object);
- // xmultiservicefactory = (XMultiservicefactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, object[0]);
- }
+ // xmultiservicefactory = (XMultiservicefactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, object[0]);
+ }
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
public java.lang.String[] getSupportedServiceNames()
- {
- String []stringSupportedServiceNames = new String[ 1 ];
+ {
+ String[] stringSupportedServiceNames = new String[1];
- stringSupportedServiceNames[ 0 ] = __serviceName;
+ stringSupportedServiceNames[ 0] = __serviceName;
- return( stringSupportedServiceNames );
- }
+ return (stringSupportedServiceNames);
+ }
/** This method returns true, if the given service will be
* supported by the component.
@@ -210,15 +212,15 @@ public class CallReportWizard
* @return True, if the given service name will be supported.
*/
public boolean supportsService(String stringService)
- {
- boolean booleanSupportsService = false;
+ {
+ boolean booleanSupportsService = false;
- if ( stringService.equals( __serviceName ) )
- {
- booleanSupportsService = true;
- }
- return( booleanSupportsService );
+ if (stringService.equals(__serviceName))
+ {
+ booleanSupportsService = true;
}
+ return (booleanSupportsService);
+ }
/** This method returns an array of bytes, that can be used to
* unambiguously distinguish between two sets of types, e.g.
@@ -232,27 +234,30 @@ public class CallReportWizard
* @return Array of bytes, in order to distinguish between two sets.
*/
public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
{
- byte[] byteReturn = {};
-
- try
- {
- byteReturn = new String( "" + this.hashCode() ).getBytes();
- }
- catch( Exception exception ) {
- System.err.println( exception );
- }
+ };
- return( byteReturn );
+ try
+ {
+ byteReturn = new String("" + this.hashCode()).getBytes();
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
}
+ return (byteReturn);
+ }
+
/** Return the class name of the component.
* @return Class name of the component.
*/
public java.lang.String getImplementationName()
- {
- return( ReportWizardImplementation.class.getName() );
- }
+ {
+ return (ReportWizardImplementation.class.getName());
+ }
/** Provides a sequence of all types (usually interface types)
* provided by the object.
@@ -260,23 +265,28 @@ public class CallReportWizard
* service.
*/
public Type[] getTypes()
+ {
+ Type[] typeReturn =
{
- Type[] typeReturn = {};
+ };
- try
- {
- typeReturn = new Type[] {
- new Type( com.sun.star.task.XJobExecutor.class ) ,
- new Type( com.sun.star.lang.XTypeProvider.class ),
- new Type( com.sun.star.lang.XServiceInfo.class ),
- new Type( com.sun.star.lang.XInitialization.class )
- };
- } catch( Exception exception ) {
- System.err.println( exception );
- }
-
- return( typeReturn );
+ try
+ {
+ typeReturn = new Type[]
+ {
+ new Type(com.sun.star.task.XJobExecutor.class),
+ new Type(com.sun.star.lang.XTypeProvider.class),
+ new Type(com.sun.star.lang.XServiceInfo.class),
+ new Type(com.sun.star.lang.XInitialization.class)
+ };
}
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
}
}
diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java
index 04dca6bd5b60..5377a62168c2 100644
--- a/wizards/com/sun/star/wizards/report/DBColumn.java
+++ b/wizards/com/sun/star/wizards/report/DBColumn.java
@@ -27,8 +27,8 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.report;
+
import com.sun.star.beans.PropertyState;
import com.sun.star.beans.XPropertySet;
import com.sun.star.beans.XPropertyState;
@@ -54,7 +54,6 @@ import com.sun.star.wizards.text.TextDocument;
import com.sun.star.wizards.text.TextTableHandler;
import com.sun.star.wizards.text.TextFieldHandler;
-
public class DBColumn
{
@@ -80,420 +79,404 @@ public class DBColumn
TextDocument oTextDocument;
RecordParser CurDBMetaData;
RecordTable CurRecordTable;
- TextTableHandler oTextTableHandler;
+ TextTableHandler oTextTableHandler;
public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) throws Exception
- {
- CurRecordTable = new RecordTable(_oTextTableHandler);
- initializeRecordTableMembers(CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, false);
- }
+ {
+ CurRecordTable = new RecordTable(_oTextTableHandler);
+ initializeRecordTableMembers(CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, false);
+ }
+ public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bforce) throws Exception
+ {
+ initializeRecordTableMembers(_CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, _bforce);
+ }
- public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bforce) throws Exception
+ public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) throws Exception
+ {
+ initializeRecordTableMembers(_CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, false);
+ }
+
+ private void initializeRecordTableMembers(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bForce) throws Exception
+ {
+ this.oTextTableHandler = _oTextTableHandler;
+ this.CurDBMetaData = _CurDBMetaData;
+ this.CurRecordTable = _CurRecordTable;
+ bIsGroupColumn = false;
+ if (CurDBMetaData.RecordFieldColumns != null)
{
- initializeRecordTableMembers(_CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, _bforce);
+ CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.RecordFieldColumns[i].m_sFieldName);
}
-
-
- public DBColumn(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) throws Exception
+ else
{
- initializeRecordTableMembers(_CurRecordTable, _oTextTableHandler, _CurDBMetaData, i, false);
+ CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.getRecordFieldName(i));
}
-
-
-
- private void initializeRecordTableMembers(RecordTable _CurRecordTable, TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i, boolean _bForce) throws Exception
+ if (_bForce)
{
- this.oTextTableHandler = _oTextTableHandler;
- this.CurDBMetaData = _CurDBMetaData;
- this.CurRecordTable = _CurRecordTable;
- bIsGroupColumn = false;
- if (CurDBMetaData.RecordFieldColumns != null)
- {
- CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.RecordFieldColumns[i].FieldName);
- }
- else
- {
- CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.getRecordFieldName(i));
- }
- if (_bForce)
+ assignCells(i, true);
+ }
+ else
+ {
+ for (int n = 0; n < CurRecordTable.xTableColumns.getCount(); n++)
{
- assignCells(i, true);
- }
- else
- {
- for (int n = 0; n < CurRecordTable.xTableColumns.getCount(); n++)
- {
- assignCells(n, false);
- }
+ assignCells(n, false);
}
}
+ }
private boolean assignCells(int _nColumn, boolean _bforce)
+ {
+ try
{
- try
+ XCell xCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 0);
+ XTextRange xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
+ String CompString = "Column";
+ XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
+ if (isNameCell(xLocCellCursor, CurDBField.m_sFieldName, CompString) || (_bforce))
{
- XCell xCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn,0);
- XTextRange xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
- String CompString = "Column";
- XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
- if (isNameCell(xLocCellCursor, CurDBField.FieldName, CompString) || (_bforce))
- {
- xNameCell = xCell;
- xNameTextCell = xTextCell;
- xValCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn,1);
- xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell);
- xValCellCursor = TextDocument.createTextCursor(xValCell);
- ValColumn = _nColumn;
- return true;
- }
- }
- catch (Exception e)
- {
- e.printStackTrace(System.out);
+ xNameCell = xCell;
+ xNameTextCell = xTextCell;
+ xValCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 1);
+ xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell);
+ xValCellCursor = TextDocument.createTextCursor(xValCell);
+ ValColumn = _nColumn;
+ return true;
}
- return false;
}
-
-
- public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, int GroupIndex, String TableName, DBColumn OldDBColumn) throws Exception
+ catch (Exception e)
{
- this.oTextTableHandler = _oTextTableHandler;
- this.CurDBMetaData = _CurDBMetaData;
- CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_FieldName);
- bIsGroupColumn = true;
- getTableColumns(TableName);
- xNameCell = OldDBColumn.xNameCell;
- xNameTextCell = OldDBColumn.xNameTextCell;
- xValCell = OldDBColumn.xValCell;
- xValTextCell = OldDBColumn.xValTextCell;
- xValCellCursor = TextDocument.createTextCursor(xValCell);
- ValColumn = OldDBColumn.ValColumn;
- ValRow = OldDBColumn.ValRow;
- initializeNumberFormat();
+ e.printStackTrace(System.out);
}
+ return false;
+ }
+ public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, int GroupIndex, String TableName, DBColumn OldDBColumn) throws Exception
+ {
+ this.oTextTableHandler = _oTextTableHandler;
+ this.CurDBMetaData = _CurDBMetaData;
+ CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_FieldName);
+ bIsGroupColumn = true;
+ getTableColumns(TableName);
+ xNameCell = OldDBColumn.xNameCell;
+ xNameTextCell = OldDBColumn.xNameTextCell;
+ xValCell = OldDBColumn.xValCell;
+ xValTextCell = OldDBColumn.xValTextCell;
+ xValCellCursor = TextDocument.createTextCursor(xValCell);
+ ValColumn = OldDBColumn.ValColumn;
+ ValRow = OldDBColumn.ValRow;
+ initializeNumberFormat();
+ }
public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, String _FieldName, int GroupIndex, String TableName) throws Exception
+ {
+ this.oTextTableHandler = _oTextTableHandler;
+ this.CurDBMetaData = _CurDBMetaData;
+ CurDBField = CurDBMetaData.getFieldColumnByFieldName(_FieldName);
+ bIsGroupColumn = true;
+ XTextRange xTextCell;
+ XCell xCell;
+ getTableColumns(TableName);
+
+ XTableRows xRows = null;
+ try
{
- this.oTextTableHandler = _oTextTableHandler;
- this.CurDBMetaData = _CurDBMetaData;
- CurDBField = CurDBMetaData.getFieldColumnByFieldName(_FieldName);
- bIsGroupColumn = true;
- XTextRange xTextCell;
- XCell xCell;
- getTableColumns(TableName);
-
- XTableRows xRows = null;
- try
- {
- xRows = xTextTable.getRows();
- }
- catch (java.lang.NullPointerException e)
- {
- e.printStackTrace();
+ xRows = xTextTable.getRows();
+ }
+ catch (java.lang.NullPointerException e)
+ {
+ e.printStackTrace();
// TODO: handle the nullpointer right
// return;
- }
- for (int n = 0; n < xTableColumns.getCount(); n++)
+ }
+ for (int n = 0; n < xTableColumns.getCount(); n++)
+ {
+ for (int m = 0; m < xRows.getCount(); m++)
{
- for (int m = 0; m < xRows.getCount(); m++)
+ xCell = xCellRange.getCellByPosition(n, m);
+ xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
+ String CompString = TableName.substring(4);
+ XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
+ if (isNameCell(xLocCellCursor, CurDBField.m_sFieldName, CompString))
{
- xCell = xCellRange.getCellByPosition(n,m);
- xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
- String CompString = TableName.substring(4);
- XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
- if (isNameCell(xLocCellCursor, CurDBField.FieldName, CompString))
- {
- xNameCell = xCell;
- xNameTextCell = xTextCell;
- }
- else
- { //In Grouping Sections only two cells are allowed ' if (CellString.equals(CurFieldString)){
- xValCell = xCell;
- xValTextCell = xTextCell;
- xValCellCursor = xLocCellCursor;
- ValColumn = n;
- ValRow = m;
- checkforLeftAlignment();
- }
+ xNameCell = xCell;
+ xNameTextCell = xTextCell;
+ }
+ else
+ { //In Grouping Sections only two cells are allowed ' if (CellString.equals(CurFieldString)){
+ xValCell = xCell;
+ xValTextCell = xTextCell;
+ xValCellCursor = xLocCellCursor;
+ ValColumn = n;
+ ValRow = m;
+ checkforLeftAlignment();
}
}
}
+ }
-
- private void getTableColumns(String TableName)
+ private void getTableColumns(String TableName)
+ {
+ try
{
- try
+ XNameAccess xAllTextTables = oTextTableHandler.xTextTablesSupplier.getTextTables();
+ if (xAllTextTables.hasByName(TableName) == true)
{
- XNameAccess xAllTextTables = oTextTableHandler.xTextTablesSupplier.getTextTables();
- if (xAllTextTables.hasByName(TableName) == true)
- {
- Object oTextTable = xAllTextTables.getByName(TableName);
- xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oTextTable);
- xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTextTable);
- xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextTable);
- xTableColumns = xTextTable.getColumns();
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
+ Object oTextTable = xAllTextTables.getByName(TableName);
+ xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oTextTable);
+ xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTextTable);
+ xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextTable);
+ xTableColumns = xTextTable.getColumns();
}
}
-
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
public void initializeNumberFormat()
+ {
+ if (CurDBField.isBoolean())
{
- if (CurDBField.isBoolean()){
- NumberFormatter oNumberFormatter = oTextTableHandler.getNumberFormatter();
- int iLogicalFormatKey = oNumberFormatter.setBooleanReportDisplayNumberFormat();
- oNumberFormatter.setNumberFormat(xValCell, iLogicalFormatKey, oNumberFormatter);
- }
- else
- {
- oTextTableHandler.getNumberFormatter().setNumberFormat(xValCell, CurDBField.DBFormatKey, CurDBMetaData.getNumberFormatter());
- }
- setCellFont();
+ NumberFormatter oNumberFormatter = oTextTableHandler.getNumberFormatter();
+ int iLogicalFormatKey = oNumberFormatter.setBooleanReportDisplayNumberFormat();
+ oNumberFormatter.setNumberFormat(xValCell, iLogicalFormatKey, oNumberFormatter);
}
-
-
- public void insertColumnData(TextFieldHandler oTextFieldHandler, boolean _bIsLandscape)
+ else
{
- insertUserFieldToTableCell(oTextFieldHandler);
- replaceValueCellofTable(_bIsLandscape);
+ oTextTableHandler.getNumberFormatter().setNumberFormat(xValCell, CurDBField.DBFormatKey, CurDBMetaData.getNumberFormatter());
}
+ setCellFont();
+ }
+ public void insertColumnData(TextFieldHandler oTextFieldHandler, boolean _bIsLandscape)
+ {
+ insertUserFieldToTableCell(oTextFieldHandler);
+ replaceValueCellofTable(_bIsLandscape);
+ }
public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler)
- {
- XTextCursor xTextCursor = TextDocument.createTextCursor(xNameCell);
- xTextCursor.gotoStart(false);
- xTextCursor.gotoEnd(true);
- xTextCursor.setString("");
- oTextFieldHandler.insertUserField(xTextCursor, CurDBField.FieldName, CurDBField.FieldTitle);
- }
-
+ {
+ XTextCursor xTextCursor = TextDocument.createTextCursor(xNameCell);
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(true);
+ xTextCursor.setString("");
+ oTextFieldHandler.insertUserField(xTextCursor, CurDBField.m_sFieldName, CurDBField.getFieldTitle());
+ }
public void insertUserFieldToTableCell(TextFieldHandler oTextFieldHandler, XCell xCell)
- {
- XTextCursor xTextCursor = TextDocument.createTextCursor(xCell);
- xTextCursor.gotoStart(false);
- xTextCursor.gotoEnd(true);
- xTextCursor.setString("");
- oTextFieldHandler.insertUserField(xTextCursor, CurDBField.FieldName, CurDBField.FieldTitle);
- }
-
+ {
+ XTextCursor xTextCursor = TextDocument.createTextCursor(xCell);
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(true);
+ xTextCursor.setString("");
+ oTextFieldHandler.insertUserField(xTextCursor, CurDBField.m_sFieldName, CurDBField.getFieldTitle());
+ }
public void formatValueCell()
+ {
+ initializeNumberFormat();
+ if (checkforLeftAlignment())
{
- initializeNumberFormat();
- if (checkforLeftAlignment())
- {
- bAlignLeft = true;
- }
+ bAlignLeft = true;
}
+ }
private boolean checkforLeftAlignment()
- {
- bAlignLeft = ((CurDBField.bIsNumberFormat) && (ValColumn == xTableColumns.getCount()-1));
- return bAlignLeft;
- }
-
+ {
+ bAlignLeft = ((CurDBField.bIsNumberFormat) && (ValColumn == xTableColumns.getCount() - 1));
+ return bAlignLeft;
+ }
public void modifyCellContent(XCellRange xCellRange, Object CurGroupValue)
+ {
+ try
{
- try
+ xValCell = xCellRange.getCellByPosition(ValColumn, ValRow);
+ xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell);
+ modifyCellContent(CurGroupValue);
+ if (bAlignLeft)
{
- xValCell = xCellRange.getCellByPosition(ValColumn, ValRow);
- xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell);
- modifyCellContent(CurGroupValue);
- if (bAlignLeft)
- {
- xValCellCursor = TextDocument.createTextCursor(xValCell);
- Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(com.sun.star.style.ParagraphAdjust.LEFT_value));
- }
- }
- catch( Exception exception )
- {
- exception.printStackTrace(System.out);
+ xValCellCursor = TextDocument.createTextCursor(xValCell);
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(com.sun.star.style.ParagraphAdjust.LEFT_value));
}
}
-
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
public void modifyCellContent(Object CurGroupValue)
+ {
+ double dblValue = 0;
+ try
{
- double dblValue = 0;
- try
+ if (xValCell != null)
{
- if (xValCell != null)
+ if (AnyConverter.isString(CurGroupValue))
{
- if (AnyConverter.isString(CurGroupValue))
+ String sValue = AnyConverter.toString(CurGroupValue);
+ xValTextCell.setString(sValue);
+ }
+ else
+ {
+ if (AnyConverter.isBoolean(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toInt(CurGroupValue);
+ }
+ if (AnyConverter.isByte(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toByte(CurGroupValue);
+ }
+ else if (AnyConverter.isDouble(CurGroupValue))
+ {
+ dblValue = AnyConverter.toDouble(CurGroupValue);
+ }
+ else if (AnyConverter.isFloat(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toFloat(CurGroupValue);
+ }
+ else if (AnyConverter.isInt(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toInt(CurGroupValue);
+ }
+ else if (AnyConverter.isLong(CurGroupValue))
{
- String sValue = AnyConverter.toString(CurGroupValue);
- xValTextCell.setString(sValue);
+ dblValue = (double) AnyConverter.toLong(CurGroupValue);
}
- else
+ else if (AnyConverter.isShort(CurGroupValue))
{
- if (AnyConverter.isBoolean(CurGroupValue))
- {
- dblValue = (double) AnyConverter.toInt(CurGroupValue);
- }
- if (AnyConverter.isByte(CurGroupValue))
- {
- dblValue = (double) AnyConverter.toByte(CurGroupValue);
- }
- else if (AnyConverter.isDouble(CurGroupValue))
- {
- dblValue = AnyConverter.toDouble(CurGroupValue);
- }
- else if (AnyConverter.isFloat(CurGroupValue))
- {
- dblValue = (double) AnyConverter.toFloat(CurGroupValue);
- }
- else if (AnyConverter.isInt(CurGroupValue))
- {
- dblValue = (double) AnyConverter.toInt(CurGroupValue);
- }
- else if (AnyConverter.isLong(CurGroupValue))
- {
- dblValue = (double) AnyConverter.toLong(CurGroupValue);
- }
- else if (AnyConverter.isShort(CurGroupValue))
- {
- dblValue = (double) AnyConverter.toShort(CurGroupValue);
- }
- xValCell.setValue(dblValue);
+ dblValue = (double) AnyConverter.toShort(CurGroupValue);
}
+ xValCell.setValue(dblValue);
}
}
- catch( Exception exception )
- {
- System.err.println( exception);
- }
}
-
-
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+ }
// If the parameter CurGroupValue is null the placeholders are inserted
public void replaceValueCellofTable(boolean _bIsLandscape)
+ {
+ try
{
- try
+ Object CurGroupValue;
+ if (bIsGroupColumn == false && CurDBField.bIsNumberFormat == false)
{
- Object CurGroupValue;
- if (bIsGroupColumn == false && CurDBField.bIsNumberFormat == false)
- {
- CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.FieldTitle, CurDBField.FieldWidth, _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames());
- }
- else
- {
- CurGroupValue = CurDBField.getDefaultValue();
- }
- modifyCellContent(CurGroupValue);
- if (bAlignLeft)
+ CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.FieldWidth, _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames());
+ }
+ else
+ {
+ CurGroupValue = CurDBField.getDefaultValue();
+ }
+ modifyCellContent(CurGroupValue);
+ if (bAlignLeft)
+ {
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.LEFT_value));
+ }
+
+ if ((CurDBField.FieldType == com.sun.star.sdbc.DataType.BIT) || (CurDBField.FieldType == com.sun.star.sdbc.DataType.BOOLEAN))
+ {
+ CharFontName = "StarSymbol";
+ Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
+ if (bIsGroupColumn == false)
{
- Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.LEFT_value));
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.CENTER_value));
}
-
- if ((CurDBField.FieldType == com.sun.star.sdbc.DataType.BIT) || (CurDBField.FieldType == com.sun.star.sdbc.DataType.BOOLEAN))
+ }
+ else
+ {
+ if (PropertyState == com.sun.star.beans.PropertyState.DEFAULT_VALUE)
{
- CharFontName = "StarSymbol";
- Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
- if (bIsGroupColumn == false)
- {
- Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.CENTER_value));
- }
+ XPropertyState xPropState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
+ xPropState.setPropertyToDefault("CharFontName");
}
else
{
- if (PropertyState == com.sun.star.beans.PropertyState.DEFAULT_VALUE)
+ if (PropertyState == com.sun.star.beans.PropertyState.DIRECT_VALUE)
{
- XPropertyState xPropState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
- xPropState.setPropertyToDefault("CharFontName");
- }
- else
- {
- if (PropertyState == com.sun.star.beans.PropertyState.DIRECT_VALUE)
- {
- Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
- }
+ Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
}
}
}
- catch(com.sun.star.beans.UnknownPropertyException exception)
- {
- exception.printStackTrace(System.out);
- }
}
-
+ catch (com.sun.star.beans.UnknownPropertyException exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
public void setCellFont()
+ {
+ try
{
- try
+ XPropertyState xPropertyState;
+ int FieldType = CurDBField.FieldType;
+ if ((FieldType == com.sun.star.sdbc.DataType.BIT) || (CurDBField.FieldType == com.sun.star.sdbc.DataType.BOOLEAN))
{
- XPropertyState xPropertyState;
- int FieldType = CurDBField.FieldType;
- if ((FieldType == com.sun.star.sdbc.DataType.BIT) || (CurDBField.FieldType == com.sun.star.sdbc.DataType.BOOLEAN))
- {
- CharFontName = "StarSymbol";
- PropertyState = com.sun.star.beans.PropertyState.DIRECT_VALUE;
- xValCellCursor.gotoStart(false);
- xValCellCursor.gotoEnd(true);
- Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
- }
- else
- {
- xPropertyState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
- PropertyState = xPropertyState.getPropertyState("CharFontName");
- CharFontName = AnyConverter.toString(Helper.getUnoPropertyValue(xValCellCursor, "CharFontName"));
- }
+ CharFontName = "StarSymbol";
+ PropertyState = com.sun.star.beans.PropertyState.DIRECT_VALUE;
+ xValCellCursor.gotoStart(false);
+ xValCellCursor.gotoEnd(true);
+ Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
}
- catch(Exception exception)
+ else
{
- exception.printStackTrace(System.out);
+ xPropertyState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
+ PropertyState = xPropertyState.getPropertyState("CharFontName");
+ CharFontName = AnyConverter.toString(Helper.getUnoPropertyValue(xValCellCursor, "CharFontName"));
}
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
}
private boolean isNameCell(XTextCursor xCellCursor, String CurFieldName, String CompString)
+ {
+ try
{
- try
+ xCellCursor.gotoStart(false);
+ XTextRange xTextRange = xCellCursor.getEnd();
+ Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
+ if (AnyConverter.isVoid(oTextField))
{
- xCellCursor.gotoStart(false);
- XTextRange xTextRange = xCellCursor.getEnd();
- Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
- if (AnyConverter.isVoid(oTextField))
+ return false;
+ }
+ else
+ {
+ XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
+ XPropertySet xMaster = xDependent.getTextFieldMaster();
+ String UserFieldName = (String) xMaster.getPropertyValue("Name");
+ boolean bIsNameCell = false;
+ if ((UserFieldName.startsWith(CompString)) || (UserFieldName.equals(CurFieldName)))
{
- return false;
+ bIsNameCell = true;
}
else
{
- XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
- XPropertySet xMaster = xDependent.getTextFieldMaster();
- String UserFieldName = (String) xMaster.getPropertyValue("Name");
- boolean bIsNameCell = false;
- if ((UserFieldName.startsWith(CompString)) || (UserFieldName.equals(CurFieldName)))
+ // stupid hack, 'Title' is not a real good Table-Cell-Name
+ // take a look at xmloff/source/text/txtvfldi.txt, there exists 2 '_renamed_' strings
+ String sLocalCurFieldName = CurFieldName + "_renamed_";
+ if (UserFieldName.startsWith(sLocalCurFieldName))
{
bIsNameCell = true;
}
- else
- {
- // stupid hack, 'Title' is not a real good Table-Cell-Name
- // take a look at xmloff/source/text/txtvfldi.txt, there exists 2 '_renamed_' strings
- String sLocalCurFieldName = CurFieldName + "_renamed_";
- if (UserFieldName.startsWith(sLocalCurFieldName))
- {
- bIsNameCell = true;
- }
- }
- return bIsNameCell;
}
+ return bIsNameCell;
}
- // Todo: Insert a resource; Exception should be thrown to the calling routine
- catch( Exception exception)
- {
+ }
+ // Todo: Insert a resource; Exception should be thrown to the calling routine
+ catch (Exception exception)
+ {
// sMsgInvalidTextField = oResource.getResText(UIConsts.RID_REPORT + 73);
// SystemDialog.showMessageBox(oTextTableHandler.xMSFDoc, "ErrorBox", VclWindowPeerAttribute.OK, sMsgInvalidTextField);
- exception.printStackTrace(System.out);
- return true; //most probably this is really the Namecell!!!!
- }
+ exception.printStackTrace(System.out);
+ return true; //most probably this is really the Namecell!!!!
}
+ }
}
diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java
index 0f980200ff41..59b79b2c2496 100644
--- a/wizards/com/sun/star/wizards/report/Dataimport.java
+++ b/wizards/com/sun/star/wizards/report/Dataimport.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -40,12 +40,11 @@ import com.sun.star.wizards.document.*;
import com.sun.star.wizards.text.*;
import com.sun.star.uno.Exception;
-public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionListener{ // extends ReportWizard
+public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionListener
+{ // extends ReportWizard
// ReportTextDocument CurReportDocument;
- IReportDocument CurReportDocument;
-
-// PropertyValue[] CurProperties;
+ IReportDocument CurReportDocument;// PropertyValue[] CurProperties;
static boolean bStopProcess;
static String sProgressDBConnection;
static String sProgressDataImport;
@@ -62,25 +61,24 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
// public static final String COPYOFTBLGROUPSECTION = ReportTextDocument.COPYOFTBLGROUPSECTION;
// public static final String COPYOFRECORDSECTION = ReportTextDocument.COPYOFRECORDSECTION;
// public static final String COPYOFGROUPSECTION = ReportTextDocument.COPYOFGROUPSECTION;
-
-
public Dataimport(XMultiServiceFactory _xMSF)
- {
- super(_xMSF);
- super.addResourceHandler("ReportWizard", "dbw");
- sProgressDBConnection = m_oResource.getResText(UIConsts.RID_DB_COMMON + 34);
- sProgressDataImport = m_oResource.getResText(UIConsts.RID_REPORT + 67);
- sProgressTitle = m_oResource.getResText(UIConsts.RID_REPORT + 62);
- sProgressBaseCurRecord = m_oResource.getResText(UIConsts.RID_REPORT + 63);
- sStop = m_oResource.getResText(UIConsts.RID_DB_COMMON + 21);
-
- }
+ {
+ super(_xMSF);
+ super.addResourceHandler("ReportWizard", "dbw");
+ sProgressDBConnection = m_oResource.getResText(UIConsts.RID_DB_COMMON + 34);
+ sProgressDataImport = m_oResource.getResText(UIConsts.RID_REPORT + 67);
+ sProgressTitle = m_oResource.getResText(UIConsts.RID_REPORT + 62);
+ sProgressBaseCurRecord = m_oResource.getResText(UIConsts.RID_REPORT + 63);
+ sStop = m_oResource.getResText(UIConsts.RID_DB_COMMON + 21);
- public void disposing(com.sun.star.lang.EventObject eventObject){
}
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
- public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) {
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
// bStopProcess = true;
CurReportDocument.StopProcess();
}
@@ -117,84 +115,112 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
// javaexception.printStackTrace(System.out);
// }
// }
-
public void showProgressDisplay(XMultiServiceFactory xMSF, boolean bgetConnection)
+ {
+ try
{
- try
+ Helper.setUnoPropertyValues(xDialogModel,
+ new String[]
+ {
+ "Height", "Step", "Title", "Width"
+ },
+ new Object[]
+ {
+ new Integer(84), new Integer(0), sProgressTitle, new Integer(180)
+ });
+ com.sun.star.awt.FontDescriptor oFontDesc = new com.sun.star.awt.FontDescriptor();
+ oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD;
+ if (bgetConnection)
{
- Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Height", "Step", "Title", "Width" },
- new Object[] { new Integer(84), new Integer(0), sProgressTitle, new Integer(180)});
- com.sun.star.awt.FontDescriptor oFontDesc = new com.sun.star.awt.FontDescriptor();
- oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD;
- if (bgetConnection)
- {
- insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDBConnection",
- new String[] { "FontDescriptor", "Height", "Label", "PositionX", "PositionY", "Step", "Width" },
- new Object[] { oFontDesc, new Integer(10), sProgressDBConnection, new Integer(6), new Integer(6), new Integer(0), new Integer(150)});
-
- insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport",
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "Width" },
- new Object[] { new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120)});
- }
- else
- {
- insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport",
- new String[] { "FontDescriptor", "Height", "Label", "PositionX", "PositionY", "Step", "Width" },
- new Object[] { oFontDesc, new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120)});
- }
- insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblCurProgress",
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "Width" },
- new Object[] { new Integer(10), "", new Integer(12), new Integer(42), new Integer(0), new Integer(120)});
-
- insertButton("cmdCancel", 10000, this,
- new String[] { "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width", "Label" },
- new Object[] { new Integer(14), "HID:34321", new Integer(74), new Integer(58), new Integer(0), new Short((short) 1), new Integer(40), sStop });
- createWindowPeer(CurReportDocument.getWizardParent());
- calculateDialogPosition(CurReportDocument.getFrame().getComponentWindow().getPosSize());
- xWindow.setVisible(true);
- super.xReschedule.reschedule();
- return;
+ insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDBConnection",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ oFontDesc, new Integer(10), sProgressDBConnection, new Integer(6), new Integer(6), new Integer(0), new Integer(150)
+ });
+
+ insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120)
+ });
}
- catch (Exception exception)
+ else
{
- exception.printStackTrace(System.out);
- // return;
+ insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ oFontDesc, new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120)
+ });
}
- catch (java.lang.Exception jexception)
- {
- jexception.printStackTrace(System.out);
- // return;
- }
+ insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblCurProgress",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "", new Integer(12), new Integer(42), new Integer(0), new Integer(120)
+ });
+
+ insertButton("cmdCancel", 10000, this,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width", "Label"
+ },
+ new Object[]
+ {
+ new Integer(14), "HID:34321", new Integer(74), new Integer(58), new Integer(0), new Short((short) 1), new Integer(40), sStop
+ });
+ createWindowPeer(CurReportDocument.getWizardParent());
+ calculateDialogPosition(CurReportDocument.getFrame().getComponentWindow().getPosSize());
+ xWindow.setVisible(true);
+ super.xReschedule.reschedule();
+ return;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ // return;
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ // return;
+ }
}
- // public void importReportData(final XMultiServiceFactory xMSF, final Dataimport CurDataimport, final ReportTextDocument CurReportDocument.getDoc()) {
+ // public void importReportData(final XMultiServiceFactory xMSF, final Dataimport CurDataimport, final ReportTextDocument CurReportDocument.getDoc()) {
public void importReportData(final XMultiServiceFactory _xMSF, final Dataimport _CurDataimport, IReportDocument _CurReportDocument, PropertyValue[] _properties)
+ {
+ if (CurReportDocument.reconnectToDatabase(_xMSF, _properties))
{
- if (CurReportDocument.reconnectToDatabase(_xMSF, _properties))
- {
- // The following calls to remove the Sections must occur after the connection to the database
- modifyFontWeight("lblProgressDBConnection", com.sun.star.awt.FontWeight.NORMAL);
- modifyFontWeight("lblProgressDataImport", com.sun.star.awt.FontWeight.BOLD);
- CurReportDocument.insertDatabaseDatatoReportDocument(_xMSF);
- }
- xComponent.dispose();
- CurReportDocument.getRecordParser().dispose();
+ // The following calls to remove the Sections must occur after the connection to the database
+ modifyFontWeight("lblProgressDBConnection", com.sun.star.awt.FontWeight.NORMAL);
+ modifyFontWeight("lblProgressDataImport", com.sun.star.awt.FontWeight.BOLD);
+ CurReportDocument.insertDatabaseDatatoReportDocument(_xMSF);
}
+ xComponent.dispose();
+ CurReportDocument.getRecordParser().dispose();
+ }
-
- public void createReport(final XMultiServiceFactory xMSF,XTextDocument _textDocument, PropertyValue[] properties)
- {
- // CurReportDocument = new ReportTextDocument(xMSF, _textDocument,m_oResource);
- CurReportDocument = ReportTextImplementation.create(xMSF, _textDocument,m_oResource);
+ public void createReport(final XMultiServiceFactory xMSF, XTextDocument _textDocument, PropertyValue[] properties)
+ {
+ // CurReportDocument = new ReportTextDocument(xMSF, _textDocument,m_oResource);
+ CurReportDocument = ReportTextImplementation.create(xMSF, _textDocument, m_oResource);
// CurProperties = properties;
- showProgressDisplay(xMSF, true);
- importReportData(xMSF, this, CurReportDocument, properties);
- }
-
-
-
-
-
-
+ showProgressDisplay(xMSF, true);
+ importReportData(xMSF, this, CurReportDocument, properties);
+ }
}
diff --git a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
index 229421359d33..5d4f1199e41b 100644
--- a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
+++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.report;
import com.sun.star.wizards.common.JavaTools;
@@ -36,9 +35,9 @@ import com.sun.star.wizards.db.*;
import java.util.Vector;
-
public class GroupFieldHandler extends FieldSelection
{
+
IReportDocument CurReportDocument;
private Vector GroupFieldVector = new Vector();
QueryMetaData CurDBMetaData;
@@ -46,155 +45,155 @@ public class GroupFieldHandler extends FieldSelection
static final short MAXSELFIELDS = 4;
public GroupFieldHandler(IReportDocument _CurReportDocument, WizardDialog _CurUnoDialog)
- {
- super(_CurUnoDialog, ReportWizard.SOGROUPPAGE, 95, 27, 210, 127,
- _CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 19),
- _CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 50), 34340, false);
+ {
+ super(_CurUnoDialog, ReportWizard.SOGROUPPAGE, 95, 27, 210, 127,
+ _CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 19),
+ _CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 50), 34340, false);
- try
- {
- this.oWizardDialog = _CurUnoDialog;
- this.CurReportDocument = _CurReportDocument;
- this.CurDBMetaData = CurReportDocument.getRecordParser();
- CurUnoDialog.setControlProperty("lstFields_2", "MultiSelection", new Boolean(false));
- CurUnoDialog.setControlProperty("lstSelFields_2", "MultiSelection", new Boolean(false));
- addFieldSelectionListener(new FieldSelectionListener());
- String sNote = ReportWizard.getBlindTextNote(_CurReportDocument, _CurUnoDialog.m_oResource);
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_1",
- new String[] {"Enabled", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"},
- new Object[] {new Boolean(false), new Integer(18), sNote, new Boolean(true), new Integer(95), new Integer(158), new Integer(ReportWizard.SOGROUPPAGE), new Integer(209)});
- }
- catch( Exception exception )
- {
- exception.printStackTrace(System.out);
- }
+ try
+ {
+ this.oWizardDialog = _CurUnoDialog;
+ this.CurReportDocument = _CurReportDocument;
+ this.CurDBMetaData = CurReportDocument.getRecordParser();
+ CurUnoDialog.setControlProperty("lstFields_2", "MultiSelection", new Boolean(false));
+ CurUnoDialog.setControlProperty("lstSelFields_2", "MultiSelection", new Boolean(false));
+ addFieldSelectionListener(new FieldSelectionListener());
+ String sNote = ReportWizard.getBlindTextNote(_CurReportDocument, _CurUnoDialog.m_oResource);
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_1",
+ new String[]
+ {
+ "Enabled", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(false), new Integer(18), sNote, new Boolean(true), new Integer(95), new Integer(158), new Integer(ReportWizard.SOGROUPPAGE), new Integer(209)
+ });
}
-
-
- public boolean isGroupField(String _FieldName)
+ catch (Exception exception)
{
- return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1);
+ exception.printStackTrace(System.out);
}
+ }
+
+ public boolean isGroupField(String _FieldName)
+ {
+ return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1);
+ }
public void initialize()
+ {
+ try
{
- try
+ Vector NormalFieldsVector = new Vector();
+ Vector SelFieldsVector = new Vector();
+ String[] sFieldNames = CurDBMetaData.getFieldNames();
+ for (int i = 0; i < sFieldNames.length; i++)
{
- Vector NormalFieldsVector = new Vector();
- Vector SelFieldsVector = new Vector();
- String[] sFieldNames = CurDBMetaData.getFieldNames();
- for (int i = 0; i < sFieldNames.length; i++)
+ String sfieldtitle = sFieldNames[i]; // CurDBMetaData.getFieldTitle(sFieldNames[i]);
+ if (isGroupField(sFieldNames[i]))
{
- String sfieldtitle = sFieldNames[i]; // CurDBMetaData.getFieldTitle(sFieldNames[i]);
- if (isGroupField(sFieldNames[i]))
- {
- SelFieldsVector.add(sfieldtitle);
- }
- else
- {
- NormalFieldsVector.add(sfieldtitle);
- }
+ SelFieldsVector.add(sfieldtitle);
+ }
+ else
+ {
+ NormalFieldsVector.add(sfieldtitle);
}
- String[] SelFields = new String[SelFieldsVector.size()];
- SelFieldsVector.toArray(SelFields);
- String[] NormalFields = new String[NormalFieldsVector.size()];
- NormalFieldsVector.toArray(NormalFields);
- super.initialize(NormalFields, SelFields, true);
- }
- catch( Exception exception )
- {
- exception.printStackTrace(System.out);
}
+ String[] SelFields = new String[SelFieldsVector.size()];
+ SelFieldsVector.toArray(SelFields);
+ String[] NormalFields = new String[NormalFieldsVector.size()];
+ NormalFieldsVector.toArray(NormalFields);
+ super.initialize(NormalFields, SelFields, true);
}
-
-
- public void removeGroupFieldNames()
- {
- emptyFieldsListBoxes();
- GroupFieldVector.removeAllElements();
- CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(false));
- }
-
- public void getGroupFieldNames(CommandMetaData CurDBMetaData)
+ catch (Exception exception)
{
- String[] GroupFieldNames = new String[GroupFieldVector.size()];
- GroupFieldVector.copyInto(GroupFieldNames);
- CurDBMetaData.GroupFieldNames = GroupFieldNames;
+ exception.printStackTrace(System.out);
}
+ }
+ public void removeGroupFieldNames()
+ {
+ emptyFieldsListBoxes();
+ GroupFieldVector.removeAllElements();
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(false));
+ }
+ public void getGroupFieldNames(CommandMetaData CurDBMetaData)
+ {
+ String[] GroupFieldNames = new String[GroupFieldVector.size()];
+ GroupFieldVector.copyInto(GroupFieldNames);
+ CurDBMetaData.GroupFieldNames = GroupFieldNames;
+ }
// @Override
protected void toggleListboxButtons(short iFieldsSelIndex, short iSelFieldsSelIndex)
+ {
+ super.toggleListboxButtons(iFieldsSelIndex, iSelFieldsSelIndex);
+ int iSelCount = xSelFieldsListBox.getItemCount();
+ if (iSelCount >= MAXSELFIELDS)
{
- super.toggleListboxButtons(iFieldsSelIndex, iSelFieldsSelIndex);
- int iSelCount = xSelFieldsListBox.getItemCount();
- if (iSelCount >= MAXSELFIELDS)
- {
- CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, "Enabled", Boolean.FALSE);
- }
+ CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, "Enabled", Boolean.FALSE);
}
-
+ }
public void selectFields(boolean bMoveAll)
+ {
+ int iSelCount = xSelFieldsListBox.getItemCount();
+ if (iSelCount < MAXSELFIELDS)
{
- int iSelCount = xSelFieldsListBox.getItemCount();
- if (iSelCount < MAXSELFIELDS)
- {
- super.selectFields(bMoveAll);
- }
-
+ super.selectFields(bMoveAll);
}
+ }
+
/* protected */ class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
{
public void moveItemDown(String Selitem)
- {
- CurReportDocument.refreshGroupFields(xSelFieldsListBox.getItems());
- }
+ {
+ CurReportDocument.refreshGroupFields(xSelFieldsListBox.getItems());
+ }
public void moveItemUp(String item)
- {
- CurReportDocument.refreshGroupFields(xSelFieldsListBox.getItems());
- }
+ {
+ CurReportDocument.refreshGroupFields(xSelFieldsListBox.getItems());
+ }
public void shiftFromLeftToRight(String[] Selitems, String[] Newitems)
+ {
+ String CurGroupTitle = Selitems[0];
+ int iSelCount = xSelFieldsListBox.getItemCount();
+ String[] CurGroupNames = xFieldsListBox.getItems();
+ CurReportDocument.liveupdate_addGroupNametoDocument(CurGroupNames, CurGroupTitle, GroupFieldVector, CurReportDocument.getReportPath(), iSelCount);
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(true));
+ if (iSelCount >= MAXSELFIELDS)
{
- String CurGroupTitle = Selitems[0];
- int iSelCount = xSelFieldsListBox.getItemCount();
- String[] CurGroupNames = xFieldsListBox.getItems();
- CurReportDocument.liveupdate_addGroupNametoDocument(CurGroupNames, CurGroupTitle, GroupFieldVector, CurReportDocument.getReportPath(), iSelCount);
- CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(true));
- if (iSelCount >= MAXSELFIELDS)
- {
- toggleMoveButtons(false, false);
- }
+ toggleMoveButtons(false, false);
}
+ }
public void shiftFromRightToLeft(String[] OldSelitems, String[] Newitems)
+ {
+ int iSelPos = OldSelitems.length;
+ if (iSelPos > 0)
{
- int iSelPos = OldSelitems.length;
- if (iSelPos > 0)
- {
- String OldGroupTitle = OldSelitems[0];
- String[] NewSelList = xSelFieldsListBox.getItems();
- CurReportDocument.liveupdate_removeGroupName(NewSelList, OldGroupTitle, GroupFieldVector);
- String[] NewSelGroupNames = xSelFieldsListBox.getItems();
- CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(NewSelGroupNames.length == 0));
+ String OldGroupTitle = OldSelitems[0];
+ String[] NewSelList = xSelFieldsListBox.getItems();
+ CurReportDocument.liveupdate_removeGroupName(NewSelList, OldGroupTitle, GroupFieldVector);
+ String[] NewSelGroupNames = xSelFieldsListBox.getItems();
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(NewSelGroupNames.length == 0));
- // CurReportDocument.refreshGroupFields(xSelFieldsListBox.getItems());
- }
+ // CurReportDocument.refreshGroupFields(xSelFieldsListBox.getItems());
}
+ }
public int getID()
- {
- // TODO: here is a good place for a comment, isn't it?
- return 2;
- }
+ {
+ // TODO: here is a good place for a comment, isn't it?
+ return 2;
+ }
public void setID(String sIncSuffix)
- {
- }
-
+ {
+ }
}
}
diff --git a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
index dac7fa7f9f1a..a6a13071f10f 100755
--- a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
+++ b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
@@ -9,7 +9,7 @@
*
* $RCSfile: IReportBuilderLayouter.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,7 +30,6 @@
*
* **********************************************************************
*/
-
package com.sun.star.wizards.report;
/**
@@ -38,7 +37,8 @@ package com.sun.star.wizards.report;
* Only these less methods are allowed to access from the ReportBuilderImplementation.
* @author ll93751
*/
-public interface IReportBuilderLayouter {
+public interface IReportBuilderLayouter
+{
/**
* Get the internal name of the current layout.
@@ -46,6 +46,7 @@ public interface IReportBuilderLayouter {
* @return the internal layout name.
*/
public String getName();
+
/**
* Get the localized name of the layout, which is shown in the layout page of the report wizard.
* This name comes out of the resource and will be translate in different languages.
@@ -95,7 +96,7 @@ public interface IReportBuilderLayouter {
* Insert the titles of the field names. This names are free formed
* @param _aFieldTitles
*/
- public void insertFieldTitles(String[]_aFieldTitles);
+ public void insertFieldTitles(String[] _aFieldTitles);
/**
* Insert the names of the groups, the group names are names out of the field names.
diff --git a/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
index f4bad52893c6..8e32b5d853ab 100755
--- a/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
+++ b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
@@ -9,7 +9,7 @@
*
* $RCSfile: IReportDefinitionReadAccess.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,8 +29,7 @@
* for a copy of the LGPLv3 License.
*
***********************************************************************
- */
-
+ */
package com.sun.star.wizards.report;
import com.sun.star.lang.XMultiServiceFactory;
@@ -44,12 +43,14 @@ import com.sun.star.report.XReportDefinition;
*/
public interface IReportDefinitionReadAccess
{
+
/**
* Gives access to a ReportDefinition, if initialized.
* @return a ReportDefinition or null.
*/
public XReportDefinition getReportDefinition(); /* should throw NullPointerException but does not. */
+
/**
* This ServiceFactory is the 'global' Service Factory, which knows all and every thing in the program.
* @return the global service factory of the program
diff --git a/wizards/com/sun/star/wizards/report/IReportDocument.java b/wizards/com/sun/star/wizards/report/IReportDocument.java
index e3c7e4ddca20..b4e7ac32e9c1 100644
--- a/wizards/com/sun/star/wizards/report/IReportDocument.java
+++ b/wizards/com/sun/star/wizards/report/IReportDocument.java
@@ -9,7 +9,7 @@
*
* $RCSfile: IReportDocument.java,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.3.6.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.report;
import com.sun.star.beans.PropertyValue;
@@ -47,8 +46,6 @@ import java.util.Vector;
public interface IReportDocument
{
// public ReportTextDocument getDoc();
-
-
// -------------------------------------------------------------------------
// initialisation
// -------------------------------------------------------------------------
@@ -56,16 +53,15 @@ public interface IReportDocument
// -------------------------------------------------------------------------
// opening the dialog
// -------------------------------------------------------------------------
-
// -------------------------------------------------------------------------
// Access Helper
// -------------------------------------------------------------------------
-
/**
* Gives access to the DB Values
* @return
*/
public com.sun.star.wizards.db.RecordParser getRecordParser();
+
/**
* Give access to the parent document
* It is a document in the old Wizard
@@ -73,17 +69,18 @@ public interface IReportDocument
* @return
*/
public com.sun.star.awt.XWindowPeer getWizardParent();
+
/**
*
* @return the Frame of the document Window or Report Builder Window
*/
public com.sun.star.frame.XFrame getFrame();
+
public XComponent getComponent();
// -------------------------------------------------------------------------
// First step: After entering the table name, select fields
// -------------------------------------------------------------------------
-
/**
* Is called after first step, set Tablename and the fields, which should occur in the Report.
* @param _aType
@@ -120,14 +117,11 @@ public interface IReportDocument
* @param TitleName
*/
public void liveupdate_changeUserFieldContent(final String FieldName, final String TitleName);
-
// -------------------------------------------------------------------------
// Third step: Grouping
// -------------------------------------------------------------------------
-
/* Grouping Page */
// Document should not hold the grouping information!
-
/**
* Called by press ('greater then') add a group to the group list
* @param GroupNames
@@ -141,7 +135,6 @@ public interface IReportDocument
public void refreshGroupFields(String[] _sNewNames);
// public boolean isGroupField(String _FieldName);
-
/**
* Called by press ('less then') Removes an already set Groupname out of the list
* @param NewSelGroupNames
@@ -162,17 +155,19 @@ public interface IReportDocument
* Set the list how to sort
* @param aSort
*/
- public void setSorting(String [][] aSort);
-
+ public void setSorting(String[][] aSort);
// -------------------------------------------------------------------------
// Fivth step: Templates / Layout
// -------------------------------------------------------------------------
/* Template Page */
public void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException;
- public int getDefaultPageOrientation();
+
+ public int getDefaultPageOrientation();
public ArrayList getReportPath();
+
public String getLayoutPath();
+
public String getContentPath();
/**
@@ -180,6 +175,7 @@ public interface IReportDocument
* @param LayoutTemplatePath
*/
public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/);
+
/**
* Called if a new Template is selected
* @param ContentTemplatePath
@@ -189,15 +185,13 @@ public interface IReportDocument
// public String[] getLayoutTemplates();
// public String[] getContentTemplates();
public void layout_selectFirstPage();
- public void layout_setupRecordSection(String TemplateName);
-
+ public void layout_setupRecordSection(String TemplateName);
// -------------------------------------------------------------------------
// finishing
// -------------------------------------------------------------------------
// preview (update titlenames)
// addTextListener
-
/**
* Set the Title into the document from the 'Create Report Page'
* BUG: The Title is empty after create Report.
@@ -229,14 +223,11 @@ public interface IReportDocument
* @return
*/
public XComponent[] createFinalReportDocument(String Name, boolean _bAsTemplate, boolean _bOpenInDesign);
- public void dispose();
-
-
+ public void dispose();
// -------------------------------------------------------------------------
// Garbage dump
// -------------------------------------------------------------------------
-
/* DataImport */
// ???
// public void addTextSectionCopies();
@@ -246,7 +237,6 @@ public interface IReportDocument
public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF);
// ???
// public com.sun.star.lang.XMultiServiceFactory getDocumentServiceFactory();
-
/**
* set a internal variable to stop a maybe longer DB access.
*/
@@ -265,5 +255,6 @@ public interface IReportDocument
public String[][] getHeaderLayout();
public void setCommandType(int CommandType);
+
public void setCommand(String Command);
}
diff --git a/wizards/com/sun/star/wizards/report/RecordTable.java b/wizards/com/sun/star/wizards/report/RecordTable.java
index 984d12a0cd95..7ac6aa65ec2c 100644
--- a/wizards/com/sun/star/wizards/report/RecordTable.java
+++ b/wizards/com/sun/star/wizards/report/RecordTable.java
@@ -28,6 +28,7 @@
*
************************************************************************/
package com.sun.star.wizards.report;
+
import com.sun.star.container.XIndexAccess;
import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNamed;
@@ -41,9 +42,9 @@ import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.text.TextTableHandler;
import com.sun.star.wizards.text.ViewHandler;
-
public class RecordTable
{
+
String CurFieldName;
String LabelDescription;
public XNamed xTableName;
@@ -53,52 +54,49 @@ public class RecordTable
public XTableColumns xTableColumns;
public XTableRows xTableRows;
-
-
public RecordTable(TextTableHandler _oTextTableHandler)
+ {
+ try
{
- try
+ this.oTextTableHandler = _oTextTableHandler;
+ String[] TableNames = oTextTableHandler.xTextTablesSupplier.getTextTables().getElementNames();
+ XNameAccess xAllTextTables = oTextTableHandler.xTextTablesSupplier.getTextTables();
+ if ((xAllTextTables.hasByName(ReportTextDocument.TBLRECORDSECTION)) || (xAllTextTables.hasByName(ReportTextDocument.COPYOFTBLRECORDSECTION)))
{
- this.oTextTableHandler = _oTextTableHandler;
- String[] TableNames = oTextTableHandler.xTextTablesSupplier.getTextTables().getElementNames();
- XNameAccess xAllTextTables = oTextTableHandler.xTextTablesSupplier.getTextTables();
- if ((xAllTextTables.hasByName(ReportTextDocument.TBLRECORDSECTION)) || (xAllTextTables.hasByName(ReportTextDocument.COPYOFTBLRECORDSECTION)))
+ Object oTable;
+ if (xAllTextTables.hasByName(ReportTextDocument.COPYOFTBLRECORDSECTION))
{
- Object oTable;
- if (xAllTextTables.hasByName(ReportTextDocument.COPYOFTBLRECORDSECTION))
- {
- oTable = xAllTextTables.getByName(ReportTextDocument.COPYOFTBLRECORDSECTION);
- }
- else
- {
- oTable = xAllTextTables.getByName(ReportTextDocument.TBLRECORDSECTION);
- }
- xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
- xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
+ oTable = xAllTextTables.getByName(ReportTextDocument.COPYOFTBLRECORDSECTION);
}
else
{
- XIndexAccess xTableIndex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xAllTextTables);
- int n = xTableIndex.getCount()-1;
- Object x = xTableIndex.getByIndex(n);
- xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, x);
- xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
- xTableName.setName(ReportTextDocument.TBLRECORDSECTION);
+ oTable = xAllTextTables.getByName(ReportTextDocument.TBLRECORDSECTION);
}
- xTableRows = xTextTable.getRows();
- xTableColumns = xTextTable.getColumns();
- xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
+ xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
+ xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
}
- catch(Exception exception)
+ else
{
- exception.printStackTrace(System.out);
+ XIndexAccess xTableIndex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xAllTextTables);
+ int n = xTableIndex.getCount() - 1;
+ Object x = xTableIndex.getByIndex(n);
+ xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, x);
+ xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
+ xTableName.setName(ReportTextDocument.TBLRECORDSECTION);
}
+ xTableRows = xTextTable.getRows();
+ xTableColumns = xTextTable.getColumns();
+ xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
}
-
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
public void adjustOptimalTableWidths(XMultiServiceFactory _xMSF, ViewHandler oViewHandler)
- { // setTableColumnSeparators(){
- oTextTableHandler.adjustOptimalTableWidths(_xMSF, xTextTable);
- oViewHandler.collapseViewCursorToStart();
- }
+ { // setTableColumnSeparators(){
+ oTextTableHandler.adjustOptimalTableWidths(_xMSF, xTextTable);
+ oViewHandler.collapseViewCursorToStart();
+ }
}
diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
index aa6187beb810..8c0df7c36c5c 100644
--- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java
+++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
@@ -8,7 +8,7 @@
*
* $RCSfile: ReportFinalizer.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -28,7 +28,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.report;
//import com.sun.star.ucb.CommandAbortedException;
import com.sun.star.ucb.XSimpleFileAccess;
@@ -47,15 +46,13 @@ import com.sun.star.awt.XTextComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.db.RecordParser;
//import com.sun.star.wizards.document.OfficeDocument;
-
public class ReportFinalizer
{
- WizardDialog CurUnoDialog;
+ WizardDialog CurUnoDialog;
XTextComponent xTitleTextBox;
XTextComponent[] xSaveTextBox = new XTextComponent[2];
Object chkTemplate;
-
String CHANGEREPORTTITLE_FUNCNAME = "changeReportTitle";
String TOGGLESUBTEMPLATECONTROLS_FUNCNAME = "toggleSubTemplateControls";
// String slblHowProceed;
@@ -70,87 +67,130 @@ public class ReportFinalizer
// Desktop.OfficePathRetriever curofficepath;
// short curtabindex;
// String sMsgReportDocumentNameDuplicate;
-
public static final int SOCREATEDOCUMENT = 1;
public static final int SOCREATETEMPLATE = 2;
public static final int SOUSETEMPLATE = 3;
-
private XMultiServiceFactory m_xMSF;
-
// public Finalizer(ReportTextDocument _CurReportDocument, WizardDialog _CurUnoDialog) {
public ReportFinalizer(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, WizardDialog _CurUnoDialog)
- {
- m_xMSF = _xMSF;
-
- this.CurUnoDialog = _CurUnoDialog;
- this.CurReportDocument = _CurReportDocument;
- short curtabindex = (short) (ReportWizard.SOSTOREPAGE * 100);
- Desktop odesktop = new Desktop();
- // curofficepath = odesktop.new OfficePathRetriever(m_xMSF);
-
-String sSaveAsTemplate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 40);
-String sUseTemplate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 41);
-String sEditTemplate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 42);
-String sSaveAsDocument = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 43);
+ {
+ m_xMSF = _xMSF;
+
+ this.CurUnoDialog = _CurUnoDialog;
+ this.CurReportDocument = _CurReportDocument;
+ short curtabindex = (short) (ReportWizard.SOSTOREPAGE * 100);
+ Desktop odesktop = new Desktop();
+ // curofficepath = odesktop.new OfficePathRetriever(m_xMSF);
+
+ String sSaveAsTemplate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 40);
+ String sUseTemplate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 41);
+ String sEditTemplate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 42);
+ String sSaveAsDocument = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 43);
// String sSaveAs = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 44);
-String sReportTitle = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 33);
-String slblHowProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 78);
-String slblChooseReportKind = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 79);
+ String sReportTitle = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 33);
+ String slblHowProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 78);
+ String slblChooseReportKind = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 79);
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblTitle",
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), sReportTitle, new Integer(95), new Integer(27), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(68)});
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblTitle",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), sReportTitle, new Integer(95), new Integer(27), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(68)
+ });
- xTitleTextBox = CurUnoDialog.insertTextField("txtTitle", CHANGEREPORTTITLE_FUNCNAME, this,
- new String[] { "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(12), "HID:34362", new Integer(95), new Integer(37), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)});
+ xTitleTextBox = CurUnoDialog.insertTextField("txtTitle", CHANGEREPORTTITLE_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(12), "HID:34362", new Integer(95), new Integer(37), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ });
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblChooseReportKind",
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), slblChooseReportKind, new Integer(95), new Integer(57), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)});
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblChooseReportKind",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblChooseReportKind, new Integer(95), new Integer(57), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ });
- CurUnoDialog.insertRadioButton("optCreateDocument", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(10), "HID:34371", sSaveAsDocument, new Integer(95), new Integer(69), new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138)});
+ CurUnoDialog.insertRadioButton("optCreateDocument", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34371", sSaveAsDocument, new Integer(95), new Integer(69), new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138)
+ });
- CurUnoDialog.insertRadioButton("optCreateReportTemplate",TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), "HID:34370", sSaveAsTemplate, new Integer(95), new Integer(81), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)});
+ CurUnoDialog.insertRadioButton("optCreateReportTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), "HID:34370", sSaveAsTemplate, new Integer(95), new Integer(81), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ });
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblHowProceed",
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), slblHowProceed, new Integer(105), new Integer(93), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)});
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblHowProceed",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblHowProceed, new Integer(105), new Integer(93), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ });
- CurUnoDialog.insertRadioButton("optEditTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(10), "HID:34374", sEditTemplate, new Integer(111), new Integer(105), new Integer(6), new Short(curtabindex++), new Integer(138)});
+ CurUnoDialog.insertRadioButton("optEditTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34374", sEditTemplate, new Integer(111), new Integer(105), new Integer(6), new Short(curtabindex++), new Integer(138)
+ });
- CurUnoDialog.insertRadioButton("optUseTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(10), "HID:34375", sUseTemplate, new Integer(111), new Integer(115), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138)});
- }
+ CurUnoDialog.insertRadioButton("optUseTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34375", sUseTemplate, new Integer(111), new Integer(115), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138)
+ });
+ }
/*
* This function is called if one of the radio buttons is pressed
*/
public void toggleSubTemplateControls()
- {
- // String sStorePath = "";
- Short iState = (Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", "State");
- boolean bDoTemplateEnable = iState.shortValue() == 1;
- CurUnoDialog.setControlProperty("optEditTemplate", "Enabled", new Boolean(bDoTemplateEnable));
- CurUnoDialog.setControlProperty("optUseTemplate", "Enabled", new Boolean(bDoTemplateEnable));
- CurUnoDialog.setControlProperty("lblHowProceed", "Enabled", new Boolean(bDoTemplateEnable));
-
- String sTitle = xTitleTextBox.getText();
- boolean bDoEnable = sTitle.equals("");
- CurUnoDialog.enableFinishButton(!bDoEnable);
- }
-
-
+ {
+ // String sStorePath = "";
+ Short iState = (Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", "State");
+ boolean bDoTemplateEnable = iState.shortValue() == 1;
+ CurUnoDialog.setControlProperty("optEditTemplate", "Enabled", new Boolean(bDoTemplateEnable));
+ CurUnoDialog.setControlProperty("optUseTemplate", "Enabled", new Boolean(bDoTemplateEnable));
+ CurUnoDialog.setControlProperty("lblHowProceed", "Enabled", new Boolean(bDoTemplateEnable));
+
+ String sTitle = xTitleTextBox.getText();
+ boolean bDoEnable = sTitle.equals("");
+ CurUnoDialog.enableFinishButton(!bDoEnable);
+ }
// private boolean fileexists(XMultiServiceFactory _xMSF, String _spath){
// try {
// XInterface xUcbInterface = (XInterface) _xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
@@ -160,98 +200,90 @@ String slblChooseReportKind = CurUnoDialog.m_oResource.getResText(UIC
// exception.printStackTrace(System.out);
// return false;
// }}
-
-
public void initialize(RecordParser _CurDBMetaData)
+ {
+ String FirstCommandName = (_CurDBMetaData.getIncludedCommandNames())[0];
+ DefaultName = Desktop.getUniqueName(_CurDBMetaData.getReportDocuments(), FirstCommandName);
+ if (DefaultName.equals(OldDefaultName) == false)
{
- String FirstCommandName = (_CurDBMetaData.getIncludedCommandNames())[0];
- DefaultName = Desktop.getUniqueName(_CurDBMetaData.getReportDocuments(), FirstCommandName);
- if (DefaultName.equals(OldDefaultName) == false)
- {
- OldDefaultName = DefaultName;
- }
- xTitleTextBox.setText(DefaultName);
+ OldDefaultName = DefaultName;
}
-
+ xTitleTextBox.setText(DefaultName);
+ }
public String getStoreName()
+ {
+ if (CurUnoDialog != null)
{
- if (CurUnoDialog != null)
+ String LocStoreName = xTitleTextBox.getText();
+ if (!LocStoreName.equals(""))
{
- String LocStoreName = xTitleTextBox.getText();
- if (!LocStoreName.equals(""))
- {
- StoreName = LocStoreName;
- }
+ StoreName = LocStoreName;
}
- return (StoreName);
}
-
+ return (StoreName);
+ }
public String getStorePath()
+ {
+ try
{
- try
- {
- StoreName = getStoreName();
- String StorePath;
- XInterface xInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
- XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
- StorePath = FileAccess.getOfficePath(m_xMSF, "Temp", xSimpleFileAccess) + "/" + StoreName;
- return StorePath;
- }
- catch (Exception e)
- {
- e.printStackTrace(System.out);
- return "";
- }
+ StoreName = getStoreName();
+ String StorePath;
+ XInterface xInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
+ StorePath = FileAccess.getOfficePath(m_xMSF, "Temp", xSimpleFileAccess) + "/" + StoreName;
+ return StorePath;
}
-
-
- public void changeReportTitle()
+ catch (Exception e)
{
- String TitleName = xTitleTextBox.getText();
- CurReportDocument.liveupdate_updateReportTitle(TitleName);
+ e.printStackTrace(System.out);
+ return "";
}
+ }
+ public void changeReportTitle()
+ {
+ String TitleName = xTitleTextBox.getText();
+ CurReportDocument.liveupdate_updateReportTitle(TitleName);
+ }
public int getReportOpenMode()
+ {
+ int ReportMode = SOCREATEDOCUMENT;
+ boolean bcreateTemplate = ((Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", "State")).shortValue() == (short) 1;
+ if (bcreateTemplate)
{
- int ReportMode = SOCREATEDOCUMENT;
- boolean bcreateTemplate = ((Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", "State")).shortValue() == (short) 1;
- if (bcreateTemplate)
- {
- ReportMode = SOCREATETEMPLATE;
- }
- boolean buseTemplate = ((Short) CurUnoDialog.getControlProperty("optUseTemplate", "State")).shortValue() == (short) 1;
- if (buseTemplate)
- {
- ReportMode = SOUSETEMPLATE;
- }
- boolean buseDocument = ((Short) CurUnoDialog.getControlProperty("optCreateDocument", "State")).shortValue() == (short) 1;
- if (buseDocument)
- {
- ReportMode = SOCREATEDOCUMENT;
- }
- return ReportMode;
+ ReportMode = SOCREATETEMPLATE;
}
-
-
+ boolean buseTemplate = ((Short) CurUnoDialog.getControlProperty("optUseTemplate", "State")).shortValue() == (short) 1;
+ if (buseTemplate)
+ {
+ ReportMode = SOUSETEMPLATE;
+ }
+ boolean buseDocument = ((Short) CurUnoDialog.getControlProperty("optCreateDocument", "State")).shortValue() == (short) 1;
+ if (buseDocument)
+ {
+ ReportMode = SOCREATEDOCUMENT;
+ }
+ return ReportMode;
+ }
public boolean finish()
+ {
+ StoreName = getStoreName();
+ if (CurReportDocument.getRecordParser().getReportDocuments().hasByHierarchicalName(StoreName))
{
- StoreName = getStoreName();
- if (CurReportDocument.getRecordParser().getReportDocuments().hasByHierarchicalName(StoreName))
- {
- String sMsgReportDocumentNameDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 76);
- String sShowMsgReportNameisDuplicate = JavaTools.replaceSubString(sMsgReportDocumentNameDuplicate, StoreName, "%REPORTNAME");
- /* int iMsg = */ CurUnoDialog.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sShowMsgReportNameisDuplicate);
- return false;
- }
- else
- {
- CurReportDocument.store(StoreName, getReportOpenMode());
- ReportWizard.bCloseDocument = false;
- return true;
- }
+ String sMsgReportDocumentNameDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 76);
+ String sShowMsgReportNameisDuplicate = JavaTools.replaceSubString(sMsgReportDocumentNameDuplicate, StoreName, "%REPORTNAME");
+ /* int iMsg = */ CurUnoDialog.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sShowMsgReportNameisDuplicate);
+ return false;
+ }
+ else
+ {
+ CurReportDocument.store(StoreName, getReportOpenMode());
+ ReportWizard.bCloseDocument = false;
+ return true;
}
+ }
}
diff --git a/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
index d0d52dc9836b..417c43a45dc4 100644
--- a/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
+++ b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
@@ -9,7 +9,7 @@
*
* $RCSfile: ReportImplementationHelper.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.report;
import com.sun.star.lang.XMultiServiceFactory;
@@ -41,6 +40,7 @@ import com.sun.star.wizards.db.RecordParser;
*/
public class ReportImplementationHelper
{
+
private RecordParser m_aCurDBMetaData;
private XMultiServiceFactory m_xMSF;
protected int m_nDefaultPageOrientation;
@@ -64,9 +64,9 @@ public class ReportImplementationHelper
}
return m_aCurDBMetaData;
}
+
public XMultiServiceFactory getMSF()
{
return m_xMSF;
}
-
}
diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java
index 484f0530fb04..27e88e287585 100644
--- a/wizards/com/sun/star/wizards/report/ReportLayouter.java
+++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java
@@ -38,13 +38,13 @@ import com.sun.star.wizards.ui.*;
public class ReportLayouter
{
+
UnoDialog CurUnoDialog;
// static String sOrientationHeader;
// static String sOrientVertical;
// static String sOrientHorizontal;
final int SOTXTTITLE = 28;
final int SOCONTENTLST = 29;
-
final static public int SOOPTLANDSCAPE = 30;
final static public int SOOPTPORTRAIT = 31;
final int SOLAYOUTLST = 32;
@@ -61,144 +61,200 @@ public class ReportLayouter
public String[][] LayoutFiles;
public String[][] ContentFiles;
// private Desktop.OfficePathRetriever curofficepath;
- Object aOrientationImage;
- // boolean m_bLandscape = true;
-
+ Object aOrientationImage; // boolean m_bLandscape = true;
private XMultiServiceFactory m_xMSF;
public ReportLayouter(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, UnoDialog _CurUnoDialog)
+ {
+ m_xMSF = _xMSF;
+ try
{
- m_xMSF = _xMSF;
- try
- {
- short curtabindex = (short) (100 * ReportWizard.SOTEMPLATEPAGE);
- this.CurUnoDialog = _CurUnoDialog;
- this.CurReportDocument = _CurReportDocument;
- //TODO the constructor for the OfficePathRetriever is redundant and should be instantiated elsewhere
- // Desktop odesktop = new Desktop();
- // curofficepath = odesktop.new OfficePathRetriever(m_xMSF);
- String slblDataStructure = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 15);
-String slblPageLayout = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 16);
+ short curtabindex = (short) (100 * ReportWizard.SOTEMPLATEPAGE);
+ this.CurUnoDialog = _CurUnoDialog;
+ this.CurReportDocument = _CurReportDocument;
+ //TODO the constructor for the OfficePathRetriever is redundant and should be instantiated elsewhere
+ // Desktop odesktop = new Desktop();
+ // curofficepath = odesktop.new OfficePathRetriever(m_xMSF);
+ String slblDataStructure = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 15);
+ String slblPageLayout = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 16);
// String sOrganizeFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 19);
-String sOrientationHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 22);
-String sOrientVertical = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 23);
-String sOrientHorizontal = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 24);
+ String sOrientationHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 22);
+ String sOrientVertical = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 23);
+ String sOrientHorizontal = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 24);
- // XInterface xUcbInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
- // XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
- // boolean bcntexists = xSimpleFileAccess.exists(CurReportDocument.getReportPath() + "/cnt-default.ott");
- // boolean bstlexists = xSimpleFileAccess.exists(CurReportDocument.getReportPath() + "/stl-default.ott");
- // if ((bcntexists == false) || (bstlexists == false))
- // throw new NoValidPathException(CurReportDocument.xMSF);
+ // XInterface xUcbInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ // XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
+ // boolean bcntexists = xSimpleFileAccess.exists(CurReportDocument.getReportPath() + "/cnt-default.ott");
+ // boolean bstlexists = xSimpleFileAccess.exists(CurReportDocument.getReportPath() + "/stl-default.ott");
+ // if ((bcntexists == false) || (bstlexists == false))
+ // throw new NoValidPathException(CurReportDocument.xMSF);
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblContent",
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), slblDataStructure, new Integer(95), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99)});
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblContent",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblDataStructure, new Integer(95), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99)
+ });
- short iSelPos = 0;
+ short iSelPos = 0;
// ContentFiles = FileAccess.getFolderTitles(m_xMSF, "cnt", CurReportDocument.getReportPath());
- ContentFiles = CurReportDocument.getDataLayout();
- iSelPos = (short) JavaTools.FieldInList(ContentFiles[1], CurReportDocument.getContentPath());
- if (iSelPos < 0)
- {
- iSelPos = 0;
- }
- iOldContentPos = (int) iSelPos;
- xContentListBox = CurUnoDialog.insertListBox("lstContent", SOCONTENTLST, new ActionListenerImpl(), new ItemListenerImpl(),
- new String[] { "Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width" },
- new Object[] { new Integer(108), "HID:34363", new Integer(95), new Integer(37), new short[] { iSelPos }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), new Integer(99)
- });
+ ContentFiles = CurReportDocument.getDataLayout();
+ iSelPos = (short) JavaTools.FieldInList(ContentFiles[1], CurReportDocument.getContentPath());
+ if (iSelPos < 0)
+ {
+ iSelPos = 0;
+ }
+ iOldContentPos = (int) iSelPos;
+ xContentListBox = CurUnoDialog.insertListBox("lstContent", SOCONTENTLST, new ActionListenerImpl(), new ItemListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(108), "HID:34363", new Integer(95), new Integer(37), new short[]
+ {
+ iSelPos
+ }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), new Integer(99)
+ });
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblLayout",
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), slblPageLayout, new Integer(205), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99)});
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblLayout",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblPageLayout, new Integer(205), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99)
+ });
- short iSelLayoutPos = 0;
+ short iSelLayoutPos = 0;
// LayoutFiles = FileAccess.getFolderTitles(m_xMSF, "stl", CurReportDocument.getReportPath());
- LayoutFiles = CurReportDocument.getHeaderLayout();
- iSelLayoutPos = (short) JavaTools.FieldInList(LayoutFiles[1], CurReportDocument.getLayoutPath());
+ LayoutFiles = CurReportDocument.getHeaderLayout();
+ iSelLayoutPos = (short) JavaTools.FieldInList(LayoutFiles[1], CurReportDocument.getLayoutPath());
+ if (iSelLayoutPos < 0)
+ {
+ iSelLayoutPos = (short) JavaTools.FieldInList(LayoutFiles[0], CurReportDocument.getLayoutPath());
if (iSelLayoutPos < 0)
{
- iSelLayoutPos = (short) JavaTools.FieldInList(LayoutFiles[0], CurReportDocument.getLayoutPath());
- if (iSelLayoutPos < 0)
- {
- iSelLayoutPos = 0;
- }
+ iSelLayoutPos = 0;
}
- xLayoutListBox = CurUnoDialog.insertListBox("lstLayout", SOLAYOUTLST, new ActionListenerImpl(), new ItemListenerImpl(),
- new String[] { "Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width" },
- new Object[] { new Integer(108), "HID:34364", new Integer(205), new Integer(37), new short[] { iSelLayoutPos }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), new Integer(99)
- });
- iOldLayoutPos = (int) iSelPos;
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation",
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), sOrientationHeader, new Integer(95), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(74)});
+ }
+ xLayoutListBox = CurUnoDialog.insertListBox("lstLayout", SOLAYOUTLST, new ActionListenerImpl(), new ItemListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "SelectedItems", "Step", "StringItemList", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(108), "HID:34364", new Integer(205), new Integer(37), new short[]
+ {
+ iSelLayoutPos
+ }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), new Integer(99)
+ });
+ iOldLayoutPos = (int) iSelPos;
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), sOrientationHeader, new Integer(95), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(74)
+ });
- short m_nLandscapeState = CurReportDocument.getDefaultPageOrientation() == SOOPTLANDSCAPE ? (short)1 : 0;
- CurUnoDialog.insertRadioButton("optLandscape", SOOPTLANDSCAPE, new ItemListenerImpl(),
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(10), "HID:34365", sOrientHorizontal, new Integer(101), new Integer(158), new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60)});
+ short m_nLandscapeState = CurReportDocument.getDefaultPageOrientation() == SOOPTLANDSCAPE ? (short) 1 : 0;
+ CurUnoDialog.insertRadioButton("optLandscape", SOOPTLANDSCAPE, new ItemListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34365", sOrientHorizontal, new Integer(101), new Integer(158), new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60)
+ });
- short m_nPortraitState = CurReportDocument.getDefaultPageOrientation() == SOOPTPORTRAIT ? (short)1 : (short)0;
- CurUnoDialog.insertRadioButton("optPortrait", SOOPTPORTRAIT, new ItemListenerImpl(),
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(10), "HID:34366", sOrientVertical, new Integer(101), new Integer(171), new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60)});
+ short m_nPortraitState = CurReportDocument.getDefaultPageOrientation() == SOOPTPORTRAIT ? (short) 1 : (short) 0;
+ CurUnoDialog.insertRadioButton("optPortrait", SOOPTPORTRAIT, new ItemListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), "HID:34366", sOrientVertical, new Integer(101), new Integer(171), new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60)
+ });
- aOrientationImage = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgOrientation",
- new String[] { "Border", "Height", "PositionX", "PositionY", "ScaleImage", "Step", "Width" },
- new Object[] { new Short("0"), new Integer(23), new Integer(164), new Integer(158), new Boolean(false), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(30)});
+ aOrientationImage = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgOrientation",
+ new String[]
+ {
+ "Border", "Height", "PositionX", "PositionY", "ScaleImage", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Short("0"), new Integer(23), new Integer(164), new Integer(158), new Boolean(false), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(30)
+ });
- String sNote = ReportWizard.getBlindTextNote(CurReportDocument, CurUnoDialog.m_oResource);
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_2",
- new String[] { "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width" },
- new Object[] { new Integer(34), sNote, new Boolean(true), new Integer(205), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(99)});
- if (m_nLandscapeState == 1)
- {
- CurUnoDialog.getPeerConfiguration().setImageUrl(aOrientationImage, 1002, 1003);
- }
- else
- {
- CurUnoDialog.getPeerConfiguration().setImageUrl(aOrientationImage, 1000, 1001);
- }
+ String sNote = ReportWizard.getBlindTextNote(CurReportDocument, CurUnoDialog.m_oResource);
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_2",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(34), sNote, new Boolean(true), new Integer(205), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(99)
+ });
+ if (m_nLandscapeState == 1)
+ {
+ CurUnoDialog.getPeerConfiguration().setImageUrl(aOrientationImage, 1002, 1003);
}
- catch (Exception exception)
+ else
{
- exception.printStackTrace(System.out);
+ CurUnoDialog.getPeerConfiguration().setImageUrl(aOrientationImage, 1000, 1001);
}
}
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
public void initialize(String _defaultTemplatePath)
- {
+ {
// CurReportDocument.getDoc().xTextDocument.lockControllers();
- CurReportDocument.layout_setupRecordSection(_defaultTemplatePath);
- if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals(""))
- {
- String[] sCommandNames = CurReportDocument.getRecordParser().getIncludedCommandNames();
- CurUnoDialog.setControlProperty("txtTitle", "Text", sCommandNames[0]);
- }
- // CurReportDocument.getDoc().oViewHandler.selectFirstPage(CurReportDocument.getDoc().oTextTableHandler);
- CurReportDocument.layout_selectFirstPage();
- CurUnoDialog.setFocus("lblContent");
-// CurReportDocument.getDoc().unlockallControllers();
+ CurReportDocument.layout_setupRecordSection(_defaultTemplatePath);
+ if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals(""))
+ {
+ String[] sCommandNames = CurReportDocument.getRecordParser().getIncludedCommandNames();
+ CurUnoDialog.setControlProperty("txtTitle", "Text", sCommandNames[0]);
}
+ // CurReportDocument.getDoc().oViewHandler.selectFirstPage(CurReportDocument.getDoc().oTextTableHandler);
+ CurReportDocument.layout_selectFirstPage();
+ CurUnoDialog.setFocus("lblContent");
+// CurReportDocument.getDoc().unlockallControllers();
+ }
class ItemListenerImpl implements com.sun.star.awt.XItemListener
{
public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
+ try
{
- try
+ int iPos;
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(false));
+ // LLA: should we lock controllers here?
+ // CurReportDocument.getDoc().xTextDocument.lockControllers();
+ int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
+ switch (iKey)
{
- int iPos;
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(false));
- // LLA: should we lock controllers here?
- // CurReportDocument.getDoc().xTextDocument.lockControllers();
- int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
- switch (iKey)
- {
- case SOCONTENTLST :
+ case SOCONTENTLST:
iPos = xContentListBox.getSelectedItemPos();
if (iPos != iOldContentPos)
{
@@ -207,7 +263,7 @@ String sOrientHorizontal = CurUnoDialog.m_oResource.getResText(UI
}
break;
- case SOLAYOUTLST :
+ case SOLAYOUTLST:
iPos = xLayoutListBox.getSelectedItemPos();
if (iPos != iOldLayoutPos)
{
@@ -216,72 +272,72 @@ String sOrientHorizontal = CurUnoDialog.m_oResource.getResText(UI
}
break;
- case SOOPTLANDSCAPE :
+ case SOOPTLANDSCAPE:
// CurReportDocument.getDoc().changePageOrientation(true);
try
{
CurReportDocument.setPageOrientation(SOOPTLANDSCAPE);
}
- catch(com.sun.star.lang.IllegalArgumentException e)
- {}
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ }
Helper.setUnoPropertyValue(aOrientationImage, "ImageURL", CurUnoDialog.getWizardImageUrl(1002, 1003));
break;
- case SOOPTPORTRAIT :
+ case SOOPTPORTRAIT:
// CurReportDocument.getDoc().changePageOrientation( false);
try
{
CurReportDocument.setPageOrientation(SOOPTPORTRAIT);
}
- catch(com.sun.star.lang.IllegalArgumentException e)
- {}
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ }
CurUnoDialog.setControlProperty("imgOrientation", "ImageURL", Desktop.getBitmapPath(m_xMSF) + "/portrait.gif");
Helper.setUnoPropertyValue(aOrientationImage, "ImageURL", CurUnoDialog.getWizardImageUrl(1000, 1001));
break;
- default :
+ default:
break;
- }
- }
- catch (RuntimeException e)
- {
- e.printStackTrace();
}
- // CurReportDocument.getDoc().unlockallControllers();
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(true));
}
-
- public void disposing(EventObject eventObject)
+ catch (RuntimeException e)
{
+ e.printStackTrace();
}
+ // CurReportDocument.getDoc().unlockallControllers();
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(true));
+ }
+
+ public void disposing(EventObject eventObject)
+ {
+ }
}
class ActionListenerImpl implements com.sun.star.awt.XActionListener
{
public void disposing(EventObject eventObject)
- {
- }
+ {
+ }
public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ try
{
- try
- {
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(false));
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(false));
// CurReportDocument.getDoc().xTextDocument.lockControllers();
- boolean blandscape = (((Short) CurUnoDialog.getControlProperty("optLandscape", "State")).shortValue() == 1);
- CurReportDocument.setPageOrientation((blandscape == true) ? SOOPTLANDSCAPE : SOOPTPORTRAIT );
- }
- catch (Exception exception)
- {
- exception.printStackTrace(System.out);
- }
-// CurReportDocument.getDoc().unlockallControllers();
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(true));
+ boolean blandscape = (((Short) CurUnoDialog.getControlProperty("optLandscape", "State")).shortValue() == 1);
+ CurReportDocument.setPageOrientation((blandscape == true) ? SOOPTLANDSCAPE : SOOPTPORTRAIT);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
}
+// CurReportDocument.getDoc().unlockallControllers();
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(true));
+ }
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
index e13071e8eabe..6feda9d5f63f 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
@@ -8,7 +8,7 @@
*
* $RCSfile: ReportTextDocument.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -28,7 +28,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.report;
import com.sun.star.lang.IllegalArgumentException;
@@ -59,12 +58,10 @@ import com.sun.star.wizards.text.TextFieldHandler;
import com.sun.star.wizards.text.ViewHandler;
import com.sun.star.wizards.document.FormHandler;
-
class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implements Comparator
{
// private XMultiServiceFactory xMSF;
// private XMultiServiceFactory xMSFDoc;
-
private Object ReportPageStyle;
private Object FirstPageStyle;
private int PageWidth;
@@ -94,729 +91,700 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
public static final String COPYOFTBLGROUPSECTION = "CopyOf" + TBLGROUPSECTION;
public static final String COPYOFRECORDSECTION = "CopyOf" + RECORDSECTION;
public static final String COPYOFGROUPSECTION = "CopyOf" + GROUPSECTION;
-
private RecordParser CurDBMetaData;
-
/** Creates new ReportDocument */
- public ReportTextDocument(XMultiServiceFactory xMSF,XTextDocument _textDocument, Resource oResource, RecordParser _aRP)
- {
- super(xMSF, _textDocument, false);
- lateInit(oResource, _aRP);
- }
-
- public ReportTextDocument(XMultiServiceFactory xMSF, String _sPreviewURL, Resource oResource, RecordParser _aRP )
- {
- super(xMSF, _sPreviewURL, true, null);
- lateInit(oResource, _aRP);
- }
+ public ReportTextDocument(XMultiServiceFactory xMSF, XTextDocument _textDocument, Resource oResource, RecordParser _aRP)
+ {
+ super(xMSF, _textDocument, false);
+ lateInit(oResource, _aRP);
+ }
+
+ public ReportTextDocument(XMultiServiceFactory xMSF, String _sPreviewURL, Resource oResource, RecordParser _aRP)
+ {
+ super(xMSF, _sPreviewURL, true, null);
+ lateInit(oResource, _aRP);
+ }
void lateInit(Resource oResource, RecordParser _aRecordParser)
- {
- oTextTableHandler = new TextTableHandler(xMSFDoc, xTextDocument);
- oTextSectionHandler = new TextSectionHandler(xMSFDoc, xTextDocument);
- oFormHandler = new FormHandler(xMSFDoc, xTextDocument);
- oTextStyleHandler = new TextStyleHandler(xMSFDoc, xTextDocument);
- oViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
- oTextFieldHandler = new TextFieldHandler(xMSFDoc, xTextDocument);
- DBColumnsVector = new java.util.Vector();
- oNumberFormatter = oTextTableHandler.getNumberFormatter();
- // CurDBMetaData = new RecordParser(xMSF); //, CharLocale, oNumberFormatter);
- CurDBMetaData = _aRecordParser;
- long lDateCorrection = oNumberFormatter.getNullDateCorrection();
- oNumberFormatter.setBooleanReportDisplayNumberFormat();
- oNumberFormatter.setNullDateCorrection(lDateCorrection);
- // sMsgInvalidTextField = oResource.getResText(UIConsts.RID_REPORT + 73);
- sMsgTableNotExisting = oResource.getResText(UIConsts.RID_REPORT + 61);
- sMsgCommonReportError = oResource.getResText(UIConsts.RID_REPORT + 72);
- sMsgCommonReportError = JavaTools.replaceSubString(sMsgCommonReportError, String.valueOf((char)13), "<BR>");
- sMsgEndAutopilot = oResource.getResText(UIConsts.RID_DB_COMMON + 33);
- sMsgTableNotExisting = sMsgTableNotExisting + (char) 13 + sMsgEndAutopilot;
- bIsCurLandscape = true;
- getReportPageStyles();
- }
-
+ {
+ oTextTableHandler = new TextTableHandler(xMSFDoc, xTextDocument);
+ oTextSectionHandler = new TextSectionHandler(xMSFDoc, xTextDocument);
+ oFormHandler = new FormHandler(xMSFDoc, xTextDocument);
+ oTextStyleHandler = new TextStyleHandler(xMSFDoc, xTextDocument);
+ oViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
+ oTextFieldHandler = new TextFieldHandler(xMSFDoc, xTextDocument);
+ DBColumnsVector = new java.util.Vector();
+ oNumberFormatter = oTextTableHandler.getNumberFormatter();
+ // CurDBMetaData = new RecordParser(xMSF); //, CharLocale, oNumberFormatter);
+ CurDBMetaData = _aRecordParser;
+ long lDateCorrection = oNumberFormatter.getNullDateCorrection();
+ oNumberFormatter.setBooleanReportDisplayNumberFormat();
+ oNumberFormatter.setNullDateCorrection(lDateCorrection);
+ // sMsgInvalidTextField = oResource.getResText(UIConsts.RID_REPORT + 73);
+ sMsgTableNotExisting = oResource.getResText(UIConsts.RID_REPORT + 61);
+ sMsgCommonReportError = oResource.getResText(UIConsts.RID_REPORT + 72);
+ sMsgCommonReportError = JavaTools.replaceSubString(sMsgCommonReportError, String.valueOf((char) 13), "<BR>");
+ sMsgEndAutopilot = oResource.getResText(UIConsts.RID_DB_COMMON + 33);
+ sMsgTableNotExisting = sMsgTableNotExisting + (char) 13 + sMsgEndAutopilot;
+ bIsCurLandscape = true;
+ getReportPageStyles();
+ }
public NumberFormatter getNumberFormatter()
- {
- return oNumberFormatter;
- }
-
+ {
+ return oNumberFormatter;
+ }
- public boolean checkReportLayoutMode( String[] GroupFieldNames)
+ public boolean checkReportLayoutMode(String[] GroupFieldNames)
+ {
+ try
{
- try
+ XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections();
+ Object oTextSection;
+ if (GroupFieldNames.length > 0)
{
- XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections();
- Object oTextSection;
- if (GroupFieldNames.length > 0)
- {
- oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(1));
- }
- else
- {
- oTextSection = xTextSections.getByName(RECORDSECTION);
- }
- boolean bLayoutMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, "IsVisible"));
- return bLayoutMode;
+ oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(1));
}
- catch( Exception exception )
+ else
{
- exception.printStackTrace(System.out);
- // In doubt we rather suggest this is LayoutMode...
- return true;
+ oTextSection = xTextSections.getByName(RECORDSECTION);
}
+ boolean bLayoutMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, "IsVisible"));
+ return bLayoutMode;
}
-
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ // In doubt we rather suggest this is LayoutMode...
+ return true;
+ }
+ }
public void swapContentTemplate(String ContentTemplatePath)
- {
+ {
// unlockallControllers();
- //xProgressBar.start("", 10);
- this.ContentTemplatePath = ContentTemplatePath;
- loadSectionsfromTemplate(ContentTemplatePath);
- // xProgressBar.setValue(40);
- oTextStyleHandler.loadStyleTemplates(ContentTemplatePath, "LoadTextStyles");
- // xProgressBar.setValue(70);
- if (CurRecordTable != null)
- {
- CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
- }
- // xProgressBar.setValue(100);
- oViewHandler.selectFirstPage(oTextTableHandler);
- // xProgressBar.end();
+ //xProgressBar.start("", 10);
+ this.ContentTemplatePath = ContentTemplatePath;
+ loadSectionsfromTemplate(ContentTemplatePath);
+ // xProgressBar.setValue(40);
+ oTextStyleHandler.loadStyleTemplates(ContentTemplatePath, "LoadTextStyles");
+ // xProgressBar.setValue(70);
+ if (CurRecordTable != null)
+ {
+ CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
}
-
+ // xProgressBar.setValue(100);
+ oViewHandler.selectFirstPage(oTextTableHandler);
+ // xProgressBar.end();
+ }
public void swapLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/)
+ {
+ try
+ {
+ // xProgressBar.start("", 10);
+ this.LayoutTemplatePath = LayoutTemplatePath;
+ boolean bOldIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape"));
+ oTextStyleHandler.loadStyleTemplates(LayoutTemplatePath, "LoadPageStyles");
+ // xProgressBar.setValue(60);
+ changePageOrientation(bOldIsCurLandscape);
+ // xProgressBar.setValue(100);
+ oViewHandler.selectFirstPage(oTextTableHandler);
+ // xProgressBar.end();
+ }
+ catch (Exception exception)
{
- try
- {
- // xProgressBar.start("", 10);
- this.LayoutTemplatePath = LayoutTemplatePath;
- boolean bOldIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape"));
- oTextStyleHandler.loadStyleTemplates(LayoutTemplatePath, "LoadPageStyles");
- // xProgressBar.setValue(60);
- changePageOrientation(bOldIsCurLandscape);
- // xProgressBar.setValue(100);
- oViewHandler.selectFirstPage(oTextTableHandler);
- // xProgressBar.end();
- }
- catch( Exception exception )
- {
- exception.printStackTrace(System.out);
- }
+ exception.printStackTrace(System.out);
}
-
+ }
public void createReportForm(String SOREPORTFORMNAME)
+ {
+ com.sun.star.container.XNameContainer xNamedForm = oFormHandler.insertFormbyName(SOREPORTFORMNAME);
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNamedForm);
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "CommandType", new String(Integer.toString(CurDBMetaData.getCommandType())));
+ if (CurDBMetaData.getCommandType() == CommandType.QUERY)
{
- com.sun.star.container.XNameContainer xNamedForm = oFormHandler.insertFormbyName(SOREPORTFORMNAME);
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNamedForm);
- oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "CommandType", new String(Integer.toString(CurDBMetaData.getCommandType())));
- if (CurDBMetaData.getCommandType() == CommandType.QUERY)
- {
- oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "QueryName", CurDBMetaData.getCommandName());
- // oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", "");
- DBMetaData.CommandObject oCommand = CurDBMetaData.getQueryByName(CurDBMetaData.getCommandName());
- oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", CurDBMetaData.Command);
- }
- else
- {
- oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "QueryName", "");
- oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", CurDBMetaData.Command);
- }
- oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "GroupFieldNames", JavaTools.ArraytoString(CurDBMetaData.GroupFieldNames));
- oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "FieldNames", JavaTools.ArraytoString(CurDBMetaData.getFieldNames()));
- oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "RecordFieldNames", JavaTools.ArraytoString(CurDBMetaData.getRecordFieldNames()));
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "QueryName", CurDBMetaData.getCommandName());
+ // oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", "");
+ DBMetaData.CommandObject oCommand = CurDBMetaData.getQueryByName(CurDBMetaData.getCommandName());
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", CurDBMetaData.Command);
}
-
-
- public void updateReportTitle(String _sTitleName)
+ else
{
- Helper.setUnoPropertyValue(xDocInfo, "Title", _sTitleName);
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "QueryName", "");
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Command", CurDBMetaData.Command);
}
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "GroupFieldNames", JavaTools.ArraytoString(CurDBMetaData.GroupFieldNames));
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "FieldNames", JavaTools.ArraytoString(CurDBMetaData.getFieldNames()));
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "RecordFieldNames", JavaTools.ArraytoString(CurDBMetaData.getRecordFieldNames()));
+ }
+ public void updateReportTitle(String _sTitleName)
+ {
+ Helper.setUnoPropertyValue(xDocInfo, "Title", _sTitleName);
+ }
public void getReportPageStyles()
+ {
+ try
{
- try
- {
- Object oPageStyleFamily = oTextStyleHandler.xStyleFamiliesSupplier.getStyleFamilies().getByName("PageStyles");
- ReportPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "Standard");
- FirstPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "First Page");
- }
- catch(Exception exception)
- {
- exception.printStackTrace(System.out);
- }
+ Object oPageStyleFamily = oTextStyleHandler.xStyleFamiliesSupplier.getStyleFamilies().getByName("PageStyles");
+ ReportPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "Standard");
+ FirstPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "First Page");
}
-
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
public void changePageOrientation(boolean bNewLandscape)
+ {
+ try
{
- try
- {
- com.sun.star.awt.Size oNewSize;
- getReportPageStyles();
- com.sun.star.awt.Size oLocSize = (com.sun.star.awt.Size) Helper.getUnoStructValue(ReportPageStyle, "Size");
- bIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape"));
- if (bIsCurLandscape != bNewLandscape)
+ com.sun.star.awt.Size oNewSize;
+ getReportPageStyles();
+ com.sun.star.awt.Size oLocSize = (com.sun.star.awt.Size) Helper.getUnoStructValue(ReportPageStyle, "Size");
+ bIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape"));
+ if (bIsCurLandscape != bNewLandscape)
+ {
+ oNewSize = new com.sun.star.awt.Size(oLocSize.Height, oLocSize.Width);
+ Helper.setUnoPropertyValue(ReportPageStyle, "IsLandscape", new Boolean(bNewLandscape));
+ Helper.setUnoPropertyValue(ReportPageStyle, "Size", oNewSize);
+ Helper.setUnoPropertyValue(FirstPageStyle, "IsLandscape", new Boolean(bNewLandscape));
+ Helper.setUnoPropertyValue(FirstPageStyle, "Size", oNewSize);
+ int iLeftMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "LeftMargin"));
+ int iRightMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "RightMargin"));
+ PageWidth = oNewSize.Width - iLeftMargin - iRightMargin;
+ if (CurRecordTable != null)
{
- oNewSize = new com.sun.star.awt.Size(oLocSize.Height, oLocSize.Width);
- Helper.setUnoPropertyValue(ReportPageStyle, "IsLandscape", new Boolean(bNewLandscape));
- Helper.setUnoPropertyValue(ReportPageStyle, "Size", oNewSize);
- Helper.setUnoPropertyValue(FirstPageStyle, "IsLandscape", new Boolean(bNewLandscape));
- Helper.setUnoPropertyValue(FirstPageStyle, "Size", oNewSize);
- int iLeftMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "LeftMargin"));
- int iRightMargin = AnyConverter.toInt(Helper.getUnoPropertyValue(ReportPageStyle, "RightMargin"));
- PageWidth = oNewSize.Width - iLeftMargin - iRightMargin;
- if (CurRecordTable != null)
- {
- CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
- }
+ CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
}
}
- catch(Exception exception)
- {
- exception.printStackTrace(System.out);
- }
}
-
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
public boolean loadSectionsfromTemplate(String sTemplateUrl)
+ {
+ try
{
- try
+ int i;
+ DBColumn CurDBColumn;
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ CurRecordTable = null;
+ for (i = 0; i < GroupCount; i++)
{
- int i;
- DBColumn CurDBColumn;
- int GroupCount = CurDBMetaData.GroupFieldNames.length;
- CurRecordTable = null;
- for (i = 0; i< GroupCount; i++)
- {
- String SectionName = GROUPSECTION + Integer.toString(i + 1);
- oTextTableHandler.renameTextTable("Tbl_" + SectionName, "MyTextTable");
- oTextSectionHandler.linkSectiontoTemplate(sTemplateUrl, SectionName);
- oTextTableHandler.renameTextTable("MyTextTable", "Tbl_" + SectionName);
- }
- if (oTextSectionHandler.xTextSectionsSupplier.getTextSections().getElementNames().length > CurDBMetaData.GroupFieldNames.length)
+ String SectionName = GROUPSECTION + Integer.toString(i + 1);
+ oTextTableHandler.renameTextTable("Tbl_" + SectionName, "MyTextTable");
+ oTextSectionHandler.linkSectiontoTemplate(sTemplateUrl, SectionName);
+ oTextTableHandler.renameTextTable("MyTextTable", "Tbl_" + SectionName);
+ }
+ if (oTextSectionHandler.xTextSectionsSupplier.getTextSections().getElementNames().length > CurDBMetaData.GroupFieldNames.length)
+ {
+ oTextSectionHandler.linkSectiontoTemplate(sTemplateUrl, RECORDSECTION);
+ CurRecordTable = new RecordTable(oTextTableHandler);
+ insertColumnstoRecordTable();
+ }
+ for (i = 0; i < GroupCount; i++)
+ {
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], i, TBLGROUPSECTION + (i + 1));
+ if (CurDBColumn == null)
{
- oTextSectionHandler.linkSectiontoTemplate(sTemplateUrl, RECORDSECTION);
- CurRecordTable = new RecordTable(oTextTableHandler);
- insertColumnstoRecordTable();
+ return false;
}
- for (i = 0; i < GroupCount; i++)
+ else
{
- CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], i, TBLGROUPSECTION + (i + 1));
- if (CurDBColumn == null)
- {
- return false;
- }
- else
- {
- CurDBColumn.formatValueCell();
- DBColumnsVector.set(i, CurDBColumn);
- replaceFieldValueInGroupTable(CurDBColumn, i);
- }
+ CurDBColumn.formatValueCell();
+ DBColumnsVector.set(i, CurDBColumn);
+ replaceFieldValueInGroupTable(CurDBColumn, i);
}
- return true;
- }
- catch( Exception exception )
- {
- exception.printStackTrace(System.out);
- return false;
}
+ return true;
}
-
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return false;
+ }
+ }
public void setupRecordSection(String TemplateName)
+ {
+ this.ContentTemplatePath = TemplateName;
+ if (CurDBMetaData.getRecordFieldNames().length > 0)
{
- this.ContentTemplatePath = TemplateName;
- if (CurDBMetaData.getRecordFieldNames().length > 0)
+ boolean bAddParagraph = true;
+ if (CurDBMetaData.GroupFieldNames != null)
{
- boolean bAddParagraph = true;
- if (CurDBMetaData.GroupFieldNames != null)
- {
- bAddParagraph = (CurDBMetaData.GroupFieldNames.length == 0);
- }
- oTextSectionHandler.insertTextSection(RECORDSECTION, TemplateName, bAddParagraph);
- CurRecordTable = new RecordTable(oTextTableHandler);
- insertColumnstoRecordTable();
- if (CurRecordTable != null)
- {
- CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
- }
+ bAddParagraph = (CurDBMetaData.GroupFieldNames.length == 0);
}
- else
+ oTextSectionHandler.insertTextSection(RECORDSECTION, TemplateName, bAddParagraph);
+ CurRecordTable = new RecordTable(oTextTableHandler);
+ insertColumnstoRecordTable();
+ if (CurRecordTable != null)
{
- CurRecordTable = null;
+ CurRecordTable.adjustOptimalTableWidths(xMSF, oViewHandler);
}
}
-
+ else
+ {
+ CurRecordTable = null;
+ }
+ }
public void refreshGroupFields(String[] _sNewNames)
+ {
+ int nSize = DBColumnsVector.size();
+ for (int i = 0; i < nSize; i++)
{
- int nSize = DBColumnsVector.size();
- for (int i = 0; i < nSize ; i++)
+ DBColumn CurDBColumn = (DBColumn) DBColumnsVector.elementAt(i);
+ String sFieldName = CurDBColumn.CurDBField.m_sFieldName;
+ if (!sFieldName.equals(_sNewNames[i]))
{
- DBColumn CurDBColumn = (DBColumn) DBColumnsVector.elementAt(i);
- String sFieldName = CurDBColumn.CurDBField.FieldName;
- if (!sFieldName.equals(_sNewNames[i]))
- {
- CurDBColumn.CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_sNewNames[i]);
- CurDBColumn.insertColumnData(oTextFieldHandler, bIsCurLandscape);
- }
+ CurDBColumn.CurDBField = CurDBMetaData.getFieldColumnByDisplayName(_sNewNames[i]);
+ CurDBColumn.insertColumnData(oTextFieldHandler, bIsCurLandscape);
}
}
-
-
+ }
//public boolean isGroupField(String _FieldName)
// {
// return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1);
// }
-
public void replaceFieldValueInRecordSection(int RecordCount)
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ int FieldCount = CurDBMetaData.getFieldNames().length;
+ for (int i = GroupCount; i < FieldCount; i++)
{
- int GroupCount = CurDBMetaData.GroupFieldNames.length;
- int FieldCount = CurDBMetaData.getFieldNames().length;
- for (int i = GroupCount; i < FieldCount; i++)
- {
- ((DBColumn) DBColumnsVector.elementAt(i)).insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
- }
+ ((DBColumn) DBColumnsVector.elementAt(i)).insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
}
-
+ }
public void updateTextSections(String[] SelGroupNames) throws Exception
- {
- String TableName;
- DBColumn OldDBColumn;
- DBColumn CurDBColumn;
- XNameAccess xTableNames = oTextTableHandler.xTextTablesSupplier.getTextTables();
- int GroupFieldCount = SelGroupNames.length;
- for (int i = 0; i < GroupFieldCount; i++)
- {
- TableName = TBLGROUPSECTION + Integer.toString(i + 1);
- OldDBColumn = (DBColumn) DBColumnsVector.get(i);
- CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, SelGroupNames[i], i, TableName, OldDBColumn);
- CurDBColumn.formatValueCell();
- DBColumnsVector.setElementAt(CurDBColumn, i);
- CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
- }
+ {
+ String TableName;
+ DBColumn OldDBColumn;
+ DBColumn CurDBColumn;
+ XNameAccess xTableNames = oTextTableHandler.xTextTablesSupplier.getTextTables();
+ int GroupFieldCount = SelGroupNames.length;
+ for (int i = 0; i < GroupFieldCount; i++)
+ {
+ TableName = TBLGROUPSECTION + Integer.toString(i + 1);
+ OldDBColumn = (DBColumn) DBColumnsVector.get(i);
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, SelGroupNames[i], i, TableName, OldDBColumn);
+ CurDBColumn.formatValueCell();
+ DBColumnsVector.setElementAt(CurDBColumn, i);
+ CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
}
-
+ }
public void replaceFieldValueInGroupTable(DBColumn CurDBColumn, int TableIndex)
+ {
+ String TableName = TBLGROUPSECTION + (TableIndex + 1);
+ // Note: for some reason the table might lose its name and has to be renamed therefor
+ String OldTableName = CurDBColumn.xTableName.getName();
+ if (OldTableName.compareTo(TableName) != 0)
{
- String TableName = TBLGROUPSECTION + (TableIndex + 1);
- // Note: for some reason the table might lose its name and has to be renamed therefor
- String OldTableName = CurDBColumn.xTableName.getName();
- if (OldTableName.compareTo(TableName) != 0)
- {
- CurDBColumn.xTableName.setName(TableName);
- }
- CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
- CurDBColumn.setCellFont();
+ CurDBColumn.xTableName.setName(TableName);
}
-
+ CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ CurDBColumn.setCellFont();
+ }
public void replaceFieldValueInRecordTable()
+ {
+ String TableName = TBLRECORDSECTION;
+ String OldTableName = CurRecordTable.xTableName.getName();
+ if (OldTableName.compareTo(TableName) != 0)
{
- String TableName = TBLRECORDSECTION;
+ CurRecordTable.xTableName.setName(TableName);
+ }
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ int RecordCount = CurDBMetaData.getRecordFieldNames().length;
+ for (int i = GroupCount; i < RecordCount; i++)
+ {
+ ((DBColumn) DBColumnsVector.elementAt(i)).insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ }
+ }
+
+ public void insertColumnstoRecordTable()
+ {
+ try
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ DBColumn CurDBColumn;
+ // Note for some reason the table might lose its name and has to be renamed therefor
String OldTableName = CurRecordTable.xTableName.getName();
- if (OldTableName.compareTo(TableName) != 0)
+ if (OldTableName.compareTo(TBLRECORDSECTION) != 0)
{
- CurRecordTable.xTableName.setName(TableName);
+ CurRecordTable = new RecordTable(oTextTableHandler);
}
- int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ com.sun.star.table.XTableColumns xColumns = CurRecordTable.xTextTable.getColumns();
+ int ColCount = xColumns.getCount();
int RecordCount = CurDBMetaData.getRecordFieldNames().length;
- for (int i = GroupCount; i < RecordCount; i++)
+ if (ColCount > RecordCount)
{
- ((DBColumn) DBColumnsVector.elementAt(i)).insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ int RemoveCount = ColCount - RecordCount;
+ xColumns.removeByIndex(0, RemoveCount);
}
- }
-
-
- public void insertColumnstoRecordTable()
- {
- try
+ else if (ColCount < RecordCount)
{
- int GroupCount = CurDBMetaData.GroupFieldNames.length;
- DBColumn CurDBColumn;
- // Note for some reason the table might lose its name and has to be renamed therefor
- String OldTableName = CurRecordTable.xTableName.getName();
- if (OldTableName.compareTo(TBLRECORDSECTION) != 0)
- {
- CurRecordTable = new RecordTable(oTextTableHandler);
- }
- com.sun.star.table.XTableColumns xColumns = CurRecordTable.xTextTable.getColumns();
- int ColCount = xColumns.getCount();
- int RecordCount = CurDBMetaData.getRecordFieldNames().length;
- if (ColCount > RecordCount)
+ int AddCount = RecordCount - ColCount;
+ CurRecordTable.xTextTable.getColumns().insertByIndex(ColCount, AddCount);
+ }
+ for (int i = 0; i < RecordCount; i++)
+ {
+ CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i, true);
+ CurDBColumn.initializeNumberFormat();
+ CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
+ if (DBColumnsVector.size() <= (i + GroupCount))
{
- int RemoveCount = ColCount - RecordCount;
- xColumns.removeByIndex(0, RemoveCount);
+ DBColumnsVector.add(CurDBColumn);
}
- else if (ColCount < RecordCount)
+ else
{
- int AddCount = RecordCount - ColCount;
- CurRecordTable.xTextTable.getColumns().insertByIndex(ColCount, AddCount);
- }
- for (int i = 0; i < RecordCount; i++)
- {
- CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i, true);
- CurDBColumn.initializeNumberFormat();
- CurDBColumn.insertColumnData(oTextFieldHandler, this.bIsCurLandscape);
- if (DBColumnsVector.size() <= (i + GroupCount))
- {
- DBColumnsVector.add(CurDBColumn);
- }
- else
- {
- DBColumnsVector.set(i + GroupCount, CurDBColumn);
- }
+ DBColumnsVector.set(i + GroupCount, CurDBColumn);
}
}
- catch(Exception exception)
- {
- showCommonReportErrorBox(exception);
- }
}
+ catch (Exception exception)
+ {
+ showCommonReportErrorBox(exception);
+ }
+ }
public boolean addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount)
+ {
+ DBColumn CurDBColumn = null;
+ int GroupCount = GroupFieldVector.size();
+ if (GroupCount < 4)
{
- DBColumn CurDBColumn = null;
- int GroupCount = GroupFieldVector.size();
- if (GroupCount < 4)
+ removeGroupNamesofRecordTable(iSelCount);
+ FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle);
+ GroupFieldVector.addElement(CurFieldColumn.m_sFieldName);
+ GroupCount += 1;
+ try
{
- removeGroupNamesofRecordTable(iSelCount);
- FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle);
- GroupFieldVector.addElement(CurFieldColumn.FieldName);
- GroupCount += 1;
- try
+ String sPath = FileAccess.getPathFromList(xMSF, ReportPath, "cnt-default.ott");
+ oTextSectionHandler.insertTextSection(GROUPSECTION + GroupCount, sPath, GroupCount == 1);
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.m_sFieldName, GroupCount - 1, TBLGROUPSECTION + (GroupCount));
+ CurDBColumn.formatValueCell();
+ if (CurDBColumn != null)
{
- String sPath = FileAccess.getPathFromList(xMSF, ReportPath, "cnt-default.ott");
- oTextSectionHandler.insertTextSection(GROUPSECTION + GroupCount, sPath, GroupCount == 1);
- CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurFieldColumn.FieldName, GroupCount-1, TBLGROUPSECTION + (GroupCount));
- CurDBColumn.formatValueCell();
- if (CurDBColumn != null)
- {
- DBColumnsVector.addElement(CurDBColumn);
- replaceFieldValueInGroupTable(CurDBColumn, GroupCount-1);
- }
- else
- {
- String sMessage = JavaTools.replaceSubString(sMsgTableNotExisting, TBLGROUPSECTION + (GroupCount), "<TABLENAME>");
- CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage);
- }
+ DBColumnsVector.addElement(CurDBColumn);
+ replaceFieldValueInGroupTable(CurDBColumn, GroupCount - 1);
}
- catch(Exception exception)
+ else
{
- showCommonReportErrorBox(exception);
+ String sMessage = JavaTools.replaceSubString(sMsgTableNotExisting, TBLGROUPSECTION + (GroupCount), "<TABLENAME>");
+ CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage);
}
-
+ }
+ catch (Exception exception)
+ {
+ showCommonReportErrorBox(exception);
}
- return (CurDBColumn != null);
}
+ return (CurDBColumn != null);
+ }
public void removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, java.util.Vector GroupFieldVector)
+ {
+ removeGroupNamesofRecordTable(NewSelGroupNames.length + 1);
+ FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle);
+ GroupFieldVector.removeElement(CurFieldColumn.m_sFieldName);
+ try
{
- removeGroupNamesofRecordTable(NewSelGroupNames.length + 1);
- FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle);
- GroupFieldVector.removeElement(CurFieldColumn.FieldName);
- try
- {
- oTextSectionHandler.removeLastTextSection();
- oTextTableHandler.removeLastTextTable();
- // if the previously selected item is somewhere in the middle of the listbox (and not at the end) the
- // Textsections have to be updated
- if (JavaTools.FieldInList(NewSelGroupNames, CurGroupTitle) == -1)
- {
- updateTextSections(NewSelGroupNames);
- }
- int iSelItemCount = NewSelGroupNames.length;
- DBColumnsVector.remove(iSelItemCount);
- }
- catch(Exception exception)
+ oTextSectionHandler.removeLastTextSection();
+ oTextTableHandler.removeLastTextTable();
+ // if the previously selected item is somewhere in the middle of the listbox (and not at the end) the
+ // Textsections have to be updated
+ if (JavaTools.FieldInList(NewSelGroupNames, CurGroupTitle) == -1)
{
- showCommonReportErrorBox(exception);
+ updateTextSections(NewSelGroupNames);
}
+ int iSelItemCount = NewSelGroupNames.length;
+ DBColumnsVector.remove(iSelItemCount);
}
-
-
+ catch (Exception exception)
+ {
+ showCommonReportErrorBox(exception);
+ }
+ }
public void removeGroupNamesofRecordTable(int GroupFieldCount)
+ {
+ int CurFieldCount = DBColumnsVector.size();
+ if (CurFieldCount > GroupFieldCount)
{
- int CurFieldCount = DBColumnsVector.size();
- if (CurFieldCount > GroupFieldCount)
+ for (int i = CurFieldCount - 1; i >= GroupFieldCount; i--)
{
- for (int i = CurFieldCount-1; i >= GroupFieldCount; i--)
- {
- DBColumnsVector.removeElementAt(i);
- }
+ DBColumnsVector.removeElementAt(i);
}
}
-
+ }
public void showCommonReportErrorBox(Exception exception)
- {
- String SystemContentPath = JavaTools.convertfromURLNotation(ContentTemplatePath);
- String sMsgCurCommonReportError = JavaTools.replaceSubString(sMsgCommonReportError, SystemContentPath, "%PATH");
- CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgCurCommonReportError);
- exception.printStackTrace(System.out);
- }
-
-
+ {
+ String SystemContentPath = JavaTools.convertfromURLNotation(ContentTemplatePath);
+ String sMsgCurCommonReportError = JavaTools.replaceSubString(sMsgCommonReportError, SystemContentPath, "%PATH");
+ CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgCurCommonReportError);
+ exception.printStackTrace(System.out);
+ }
public void getallDBColumns()
+ {
+ try
{
- try
+ DBColumn CurDBColumn;
+ for (int i = 0; i < CurDBMetaData.FieldColumns.length; i++)
{
- DBColumn CurDBColumn;
- for (int i = 0; i < CurDBMetaData.FieldColumns.length; i++)
+ if (i < CurDBMetaData.GroupFieldNames.length)
+ {
+ CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], i, COPYOFTBLGROUPSECTION + (i + 1));
+ }
+ else
{
- if (i < CurDBMetaData.GroupFieldNames.length)
+ if (CurRecordTable == null)
{
- CurDBColumn = new DBColumn(oTextTableHandler, CurDBMetaData, CurDBMetaData.GroupFieldNames[i], i, COPYOFTBLGROUPSECTION + (i + 1));
+ CurRecordTable = new RecordTable(oTextTableHandler);
}
- else
+ CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i - CurDBMetaData.GroupFieldNames.length);
+ }
+ if (CurDBColumn != null)
+ {
+ if (CurDBColumn.xNameCell != null)
{
- if (CurRecordTable == null)
- {
- CurRecordTable = new RecordTable(oTextTableHandler);
- }
- CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i-CurDBMetaData.GroupFieldNames.length);
+ DBColumnsVector.addElement(CurDBColumn);
}
- if (CurDBColumn != null)
+ else
{
- if (CurDBColumn.xNameCell != null)
+ String DelFieldName;
+ if (i < CurDBMetaData.GroupFieldNames.length)
{
- DBColumnsVector.addElement(CurDBColumn);
+ DelFieldName = CurDBMetaData.GroupFieldNames[i];
+ CurDBMetaData.GroupFieldNames = JavaTools.removefromList(CurDBMetaData.GroupFieldNames, new String[]
+ {
+ DelFieldName
+ });
+ CurDBMetaData.GroupFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.GroupFieldColumns);
}
else
{
- String DelFieldName;
- if (i < CurDBMetaData.GroupFieldNames.length)
- {
- DelFieldName = CurDBMetaData.GroupFieldNames[i];
- CurDBMetaData.GroupFieldNames = JavaTools.removefromList(CurDBMetaData.GroupFieldNames, new String[] {DelFieldName});
- CurDBMetaData.GroupFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.GroupFieldColumns);
- }
- else
- {
- DelFieldName = CurDBMetaData.getRecordFieldName(i-CurDBMetaData.GroupFieldNames.length);
- String []aNewList = JavaTools.removefromList(CurDBMetaData.getRecordFieldNames(), new String[] {DelFieldName});
- CurDBMetaData.setRecordFieldNames(aNewList);
- CurDBMetaData.RecordFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.RecordFieldColumns);
- CurDBMetaData.FieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.FieldColumns);
-
- }
- i--;
+ DelFieldName = CurDBMetaData.getRecordFieldName(i - CurDBMetaData.GroupFieldNames.length);
+ String[] aNewList = JavaTools.removefromList(CurDBMetaData.getRecordFieldNames(), new String[]
+ {
+ DelFieldName
+ });
+ CurDBMetaData.setRecordFieldNames(aNewList);
+ CurDBMetaData.RecordFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.RecordFieldColumns);
+ CurDBMetaData.FieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.FieldColumns);
+
}
- }
- else
- {
- String sMessage = JavaTools.replaceSubString(sMsgTableNotExisting, TBLGROUPSECTION + (CurDBMetaData.GroupFieldNames.length), "<TABLENAME>");
- CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage);
+ i--;
}
}
- java.util.Arrays.sort(CurDBMetaData.RecordFieldColumns, this);
- }
- catch(Exception exception)
- {
- showCommonReportErrorBox(exception);
+ else
+ {
+ String sMessage = JavaTools.replaceSubString(sMsgTableNotExisting, TBLGROUPSECTION + (CurDBMetaData.GroupFieldNames.length), "<TABLENAME>");
+ CurDBMetaData.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage);
+ }
}
+ java.util.Arrays.sort(CurDBMetaData.RecordFieldColumns, this);
}
-
+ catch (Exception exception)
+ {
+ showCommonReportErrorBox(exception);
+ }
+ }
public int compare(Object _oObject1, Object _oObject2)
+ {
+ FieldColumn oFieldColumn1 = (FieldColumn) _oObject1;
+ FieldColumn oFieldColumn2 = (FieldColumn) _oObject2;
+ DBColumn oDBColumn1 = getDBColumnByName(oFieldColumn1.m_sFieldName);
+ DBColumn oDBColumn2 = getDBColumnByName(oFieldColumn2.m_sFieldName);
+ if (oDBColumn1.ValColumn < oDBColumn2.ValColumn)
{
- FieldColumn oFieldColumn1 = (FieldColumn) _oObject1;
- FieldColumn oFieldColumn2 = (FieldColumn) _oObject2;
- DBColumn oDBColumn1 = getDBColumnByName(oFieldColumn1.FieldName);
- DBColumn oDBColumn2 = getDBColumnByName(oFieldColumn2.FieldName);
- if (oDBColumn1.ValColumn < oDBColumn2.ValColumn)
- {
- return -1;
- }
- else if (oDBColumn1.ValColumn == oDBColumn2.ValColumn)
- {
- return 0;
- }
- else
- {
- return 1;
- }
+ return -1;
}
-
+ else if (oDBColumn1.ValColumn == oDBColumn2.ValColumn)
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+ }
private DBColumn getDBColumnByName(String _FieldName)
+ {
+ for (int i = 0; i < DBColumnsVector.size(); i++)
{
- for (int i = 0; i < DBColumnsVector.size(); i++)
+ DBColumn oDBColumn = (DBColumn) DBColumnsVector.get(i);
+ if (oDBColumn.CurDBField.m_sFieldName.equals(_FieldName))
{
- DBColumn oDBColumn = (DBColumn) DBColumnsVector.get(i);
- if (oDBColumn.CurDBField.FieldName.equals(_FieldName))
- {
- return oDBColumn;
- }
+ return oDBColumn;
}
- return null;
}
-
+ return null;
+ }
public static FieldColumn[] removeFieldColumnByFieldName(String _FieldName, FieldColumn[] _FieldColumns)
+ {
+ try
{
- try
+ Vector aFieldColumns = new Vector();
+ for (int i = 0; i < _FieldColumns.length; i++)
{
- Vector aFieldColumns = new Vector();
- for (int i = 0; i < _FieldColumns.length; i++)
+ FieldColumn CurFieldColumn = _FieldColumns[i];
+ if (!CurFieldColumn.m_sFieldName.equals(_FieldName))
{
- FieldColumn CurFieldColumn = _FieldColumns[i];
- if (!CurFieldColumn.FieldName.equals(_FieldName))
- {
- aFieldColumns.add(CurFieldColumn);
- }
+ aFieldColumns.add(CurFieldColumn);
}
- FieldColumn[] aRetList = new FieldColumn[aFieldColumns.size()];
- aFieldColumns.toArray(aRetList);
- return aRetList;
- }
- catch (RuntimeException e)
- {
- e.printStackTrace(System.out);
- return null;
}
+ FieldColumn[] aRetList = new FieldColumn[aFieldColumns.size()];
+ aFieldColumns.toArray(aRetList);
+ return aRetList;
}
-
-
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
public void removeAllVisibleTextSections()
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ String[] sInvisibleSectionNames = new String[GroupCount + 1];
+ sInvisibleSectionNames[0] = RECORDSECTION;
+ for (int i = 1; i <= GroupCount; i++)
{
- int GroupCount = CurDBMetaData.GroupFieldNames.length;
- String[] sInvisibleSectionNames = new String[GroupCount + 1];
- sInvisibleSectionNames[0] = RECORDSECTION;
- for (int i = 1; i <= GroupCount; i++)
- {
- sInvisibleSectionNames[i] = GROUPSECTION + i;
- }
- XNameAccess xNameAccessTextSections = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextSectionHandler.xTextSectionsSupplier.getTextSections());
- String[] sSectionNames = xNameAccessTextSections.getElementNames();
- for (int i = 0; i < sSectionNames.length; i++)
+ sInvisibleSectionNames[i] = GROUPSECTION + i;
+ }
+ XNameAccess xNameAccessTextSections = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextSectionHandler.xTextSectionsSupplier.getTextSections());
+ String[] sSectionNames = xNameAccessTextSections.getElementNames();
+ for (int i = 0; i < sSectionNames.length; i++)
+ {
+ String sSectionName = sSectionNames[i];
+ if (JavaTools.FieldInList(sInvisibleSectionNames, sSectionName) < 0)
{
- String sSectionName = sSectionNames[i];
- if (JavaTools.FieldInList(sInvisibleSectionNames, sSectionName) < 0)
- {
- oTextSectionHandler.removeTextSectionbyName(sSectionName);
- }
+ oTextSectionHandler.removeTextSectionbyName(sSectionName);
}
}
+ }
private String[] getLayoutTextTableNames()
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ String[] sLayoutTableNames = new String[GroupCount + 1];
+ for (int i = 0; i < GroupCount; i++)
{
- int GroupCount = CurDBMetaData.GroupFieldNames.length;
- String[] sLayoutTableNames = new String[GroupCount + 1];
- for (int i = 0; i < GroupCount; i++)
- {
- sLayoutTableNames[i] = TBLGROUPSECTION + (i + 1);
- }
- sLayoutTableNames[GroupCount] = TBLRECORDSECTION;
- return sLayoutTableNames;
+ sLayoutTableNames[i] = TBLGROUPSECTION + (i + 1);
}
-
+ sLayoutTableNames[GroupCount] = TBLRECORDSECTION;
+ return sLayoutTableNames;
+ }
public void removeNonLayoutTextTables()
+ {
+ String[] sLayoutTableNames = getLayoutTextTableNames();
+ XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
+ String[] sTableNames = xNameAccessTextTables.getElementNames();
+ for (int i = 0; i < sTableNames.length; i++)
{
- String[] sLayoutTableNames = getLayoutTextTableNames();
- XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
- String[] sTableNames = xNameAccessTextTables.getElementNames();
- for (int i = 0; i < sTableNames.length; i++)
+ String sTableName = sTableNames[i];
+ if (JavaTools.FieldInList(sLayoutTableNames, sTableName) < 0)
{
- String sTableName = sTableNames[i];
- if (JavaTools.FieldInList(sLayoutTableNames, sTableName) < 0)
- {
- oTextTableHandler.removeTextTablebyName(sTableName);
- }
+ oTextTableHandler.removeTextTablebyName(sTableName);
}
}
+ }
public void removeLayoutTextTables()
+ {
+ String[] sLayoutTableNames = getLayoutTextTableNames();
+ XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
+ XRelativeTextContentRemove xRelativeTextContentRemove = (XRelativeTextContentRemove) UnoRuntime.queryInterface(XRelativeTextContentRemove.class, xText);
+ String[] sTableNames = xNameAccessTextTables.getElementNames();
+ for (int i = 0; i < sTableNames.length; i++)
{
- String[] sLayoutTableNames = getLayoutTextTableNames();
- XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
- XRelativeTextContentRemove xRelativeTextContentRemove = (XRelativeTextContentRemove) UnoRuntime.queryInterface(XRelativeTextContentRemove.class, xText);
- String[] sTableNames = xNameAccessTextTables.getElementNames();
- for (int i = 0; i < sTableNames.length; i++)
+ String sTableName = sTableNames[i];
+ if (JavaTools.FieldInList(sLayoutTableNames, sTableName) > -1)
{
- String sTableName = sTableNames[i];
- if (JavaTools.FieldInList(sLayoutTableNames, sTableName) > -1)
+ if (!sTableName.equals(sLayoutTableNames[0]))
{
- if (!sTableName.equals(sLayoutTableNames[0]))
+ XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName));
+ boolean bleaveloop = false;
+ while (!bleaveloop)
{
- XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName));
- boolean bleaveloop = false;
- while (!bleaveloop)
+ try
{
- try
- {
// xRelativeTextContentRemove.removeTextContentBefore(xTextContent);
- xRelativeTextContentRemove.removeTextContentAfter(xTextContent);
- // IllegalArgumentException may be thrown when no paragraphbreak is there
- }
- catch (IllegalArgumentException iexception)
- {
- bleaveloop = true;
- }
+ xRelativeTextContentRemove.removeTextContentAfter(xTextContent);
+ // IllegalArgumentException may be thrown when no paragraphbreak is there
+ }
+ catch (IllegalArgumentException iexception)
+ {
+ bleaveloop = true;
}
}
- oTextTableHandler.removeTextTablebyName(sTableName);
}
+ oTextTableHandler.removeTextTablebyName(sTableName);
}
}
-
+ }
public void setLayoutSectionsVisible(boolean _IsVisible)
+ {
+ try
{
- try
+ XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections();
+ Object oTextSection;
+ int GroupFieldCount = CurDBMetaData.GroupFieldNames.length;
+ for (int i = 0; i < GroupFieldCount; i++)
{
- XNameAccess xTextSections = oTextSectionHandler.xTextSectionsSupplier.getTextSections();
- Object oTextSection;
- int GroupFieldCount = CurDBMetaData.GroupFieldNames.length;
- for (int i = 0; i < GroupFieldCount; i++)
- {
- oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(i + 1));
- Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible));
- }
- if (xTextSections.hasByName(RECORDSECTION))
- {
- oTextSection = xTextSections.getByName(RECORDSECTION);
- Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible));
- }
+ oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(i + 1));
+ Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible));
}
- catch (Exception exception)
+ if (xTextSections.hasByName(RECORDSECTION))
{
- exception.printStackTrace(System.out);
+ oTextSection = xTextSections.getByName(RECORDSECTION);
+ Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible));
}
}
-
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
public void removeCopiedTextSections()
+ {
+ int GroupCount = CurDBMetaData.GroupFieldNames.length;
+ String[] sCopyTextSections = new String[GroupCount + 1];
+ String[] sCopyTextTables = new String[GroupCount + 1];
+ sCopyTextSections[0] = COPYOFRECORDSECTION;
+ sCopyTextTables[0] = COPYOFTBLRECORDSECTION;
+ for (int i = 1; i <= GroupCount; i++)
{
- int GroupCount = CurDBMetaData.GroupFieldNames.length;
- String[] sCopyTextSections = new String[GroupCount + 1];
- String[] sCopyTextTables = new String[GroupCount + 1];
- sCopyTextSections[0] = COPYOFRECORDSECTION;
- sCopyTextTables[0] = COPYOFTBLRECORDSECTION;
- for (int i = 1; i <= GroupCount; i++)
- {
- sCopyTextSections[i] = COPYOFGROUPSECTION + (i);
- sCopyTextTables[i] = COPYOFTBLGROUPSECTION + (i);
- }
- for (int i = 0; i <= GroupCount; i++)
- {
- oTextTableHandler.removeTextTablebyName(sCopyTextTables[i]);
- oTextSectionHandler.removeTextSectionbyName(sCopyTextSections[i]);
- }
+ sCopyTextSections[i] = COPYOFGROUPSECTION + (i);
+ sCopyTextTables[i] = COPYOFTBLGROUPSECTION + (i);
}
-
+ for (int i = 0; i <= GroupCount; i++)
+ {
+ oTextTableHandler.removeTextTablebyName(sCopyTextTables[i]);
+ oTextSectionHandler.removeTextSectionbyName(sCopyTextSections[i]);
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
index 9baf05570896..d7f38eb37b9c 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -9,7 +9,7 @@
*
* $RCSfile: ReportTextImplementation.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.report;
import com.sun.star.awt.VclWindowPeerAttribute;
@@ -71,8 +70,8 @@ import java.util.Vector;
*/
public class ReportTextImplementation extends ReportImplementationHelper implements IReportDocument
{
- private ReportTextDocument m_aDoc;
+ private ReportTextDocument m_aDoc;
private Object m_aInitialDoc;
private Resource m_aResource;
@@ -80,6 +79,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
{
m_aInitialDoc = _aDoc;
}
+
/**
* This is a TEMPORARY function to give direct access to the old text document.
* We have to remove this!!!
@@ -91,11 +91,11 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
{
if (m_aInitialDoc instanceof XTextDocument)
{
- m_aDoc = new ReportTextDocument(getMSF(), (XTextDocument)m_aInitialDoc, m_aResource, getRecordParser() );
+ m_aDoc = new ReportTextDocument(getMSF(), (XTextDocument) m_aInitialDoc, m_aResource, getRecordParser());
}
else if (m_aInitialDoc instanceof String)
{
- m_aDoc = new ReportTextDocument(getMSF(), (String)m_aInitialDoc, m_aResource, getRecordParser() );
+ m_aDoc = new ReportTextDocument(getMSF(), (String) m_aInitialDoc, m_aResource, getRecordParser());
}
else
{
@@ -111,8 +111,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
/*CurReportDocument.*/ getDoc().oTextSectionHandler.removeAllTextSections();
/*CurReportDocument.*/ getDoc().oTextTableHandler.removeAllTextTables();
/*CurReportDocument.*/ getDoc().DBColumnsVector = new Vector();
- //getRecordParser().setGroupFieldNames(new String[]{});
- // CurGroupFieldHandler.removeGroupFieldNames();
+ //getRecordParser().setGroupFieldNames(new String[]{});
+ // CurGroupFieldHandler.removeGroupFieldNames();
}
private ReportTextImplementation(XMultiServiceFactory _xMSF, Resource _oResource)
@@ -121,7 +121,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
m_aResource = _oResource;
}
- static IReportDocument create(XMultiServiceFactory _xMSF /*, String _sPreviewURL */ , Resource _oResource )
+ static IReportDocument create(XMultiServiceFactory _xMSF /*, String _sPreviewURL */, Resource _oResource)
{
ReportTextImplementation a = new ReportTextImplementation(_xMSF, _oResource);
String sPreviewURL = a.getLayoutPath(); // a.getReportPath() + "/stl-default.ott";
@@ -129,7 +129,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
a.initialResources();
return a;
}
- static IReportDocument create(XMultiServiceFactory _xMSF, XTextDocument _aDoc, Resource _oResource )
+
+ static IReportDocument create(XMultiServiceFactory _xMSF, XTextDocument _aDoc, Resource _oResource)
{
ReportTextImplementation a = new ReportTextImplementation(_xMSF, _oResource);
a.setInitialDocument(_aDoc);
@@ -142,7 +143,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
// throw new UnsupportedOperationException("Not supported yet.");
return getDoc().xWindowPeer;
}
-
static String sMsgQueryCreationImpossible;
static String sReportFormNotExisting;
static String sMsgHiddenControlMissing;
@@ -153,287 +153,287 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
private void initialResources()
{
- sReportFormNotExisting = m_aResource.getResText(UIConsts.RID_REPORT + 64);
- sMsgQueryCreationImpossible = m_aResource.getResText(UIConsts.RID_REPORT + 65);
- sMsgHiddenControlMissing = m_aResource.getResText(UIConsts.RID_REPORT + 66);
- sMsgEndAutopilot = m_aResource.getResText(UIConsts.RID_DB_COMMON + 33);
- sMsgNoConnection = m_aResource.getResText(UIConsts.RID_DB_COMMON + 14);
+ sReportFormNotExisting = m_aResource.getResText(UIConsts.RID_REPORT + 64);
+ sMsgQueryCreationImpossible = m_aResource.getResText(UIConsts.RID_REPORT + 65);
+ sMsgHiddenControlMissing = m_aResource.getResText(UIConsts.RID_REPORT + 66);
+ sMsgEndAutopilot = m_aResource.getResText(UIConsts.RID_DB_COMMON + 33);
+ sMsgNoConnection = m_aResource.getResText(UIConsts.RID_DB_COMMON + 14);
}
public void addTextSectionCopies()
+ {
+ m_aDoc.setLayoutSectionsVisible(false);
+ XTextCursor xTextCursor = ReportTextDocument.createTextCursor(m_aDoc.xTextDocument.getText());
+ xTextCursor.gotoStart(false);
+ for (int i = 0; i < getRecordParser().GroupFieldNames.length; i++)
{
- m_aDoc.setLayoutSectionsVisible(false);
- XTextCursor xTextCursor = ReportTextDocument.createTextCursor(m_aDoc.xTextDocument.getText());
- xTextCursor.gotoStart(false);
- for (int i = 0; i < getRecordParser().GroupFieldNames.length; i++)
- {
- XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(i + 1), null, null);
- xNamedTextSection.setName(ReportTextDocument.COPYOFGROUPSECTION + (i+1));
- renameTableofLastSection(ReportTextDocument.COPYOFTBLGROUPSECTION + (i+1));
- }
- if( getRecordParser().getRecordFieldNames().length > 0)
- {
- XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, ReportTextDocument.RECORDSECTION, null, null);
- xNamedTextSection.setName(ReportTextDocument.COPYOFRECORDSECTION);
- renameTableofLastSection(ReportTextDocument.COPYOFTBLRECORDSECTION);
- }
+ XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(i + 1), null, null);
+ xNamedTextSection.setName(ReportTextDocument.COPYOFGROUPSECTION + (i + 1));
+ renameTableofLastSection(ReportTextDocument.COPYOFTBLGROUPSECTION + (i + 1));
+ }
+ if (getRecordParser().getRecordFieldNames().length > 0)
+ {
+ XNamed xNamedTextSection = addLinkedTextSection(xTextCursor, ReportTextDocument.RECORDSECTION, null, null);
+ xNamedTextSection.setName(ReportTextDocument.COPYOFRECORDSECTION);
+ renameTableofLastSection(ReportTextDocument.COPYOFTBLRECORDSECTION);
}
+ }
+
private XNamed addLinkedTextSection(XTextCursor xTextCursor, String sLinkRegion, DBColumn CurDBColumn, Object CurGroupValue)
+ {
+ XNamed xNamedTextSection = null;
+ try
{
- XNamed xNamedTextSection = null;
- try
+ XInterface xTextSection = (XInterface) getDocumentServiceFactory().createInstance("com.sun.star.text.TextSection");
+ XTextContent xTextSectionContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
+ xNamedTextSection = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextSection);
+ xTextCursor.gotoEnd(false);
+ xTextCursor.getText().insertTextContent(xTextCursor, xTextSectionContent, true);
+ Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion);
+ if (CurDBColumn != null)
{
- XInterface xTextSection = (XInterface) getDocumentServiceFactory().createInstance("com.sun.star.text.TextSection");
- XTextContent xTextSectionContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
- xNamedTextSection = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextSection);
- xTextCursor.gotoEnd(false);
- xTextCursor.getText().insertTextContent(xTextCursor, xTextSectionContent, true);
- Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion);
- if (CurDBColumn != null)
+ boolean bIsGroupTable = (sLinkRegion.equals(ReportTextDocument.RECORDSECTION) != true);
+ if (bIsGroupTable == true)
{
- boolean bIsGroupTable = (sLinkRegion.equals(ReportTextDocument.RECORDSECTION) != true);
- if (bIsGroupTable == true)
- {
- XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
- XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
- CurDBColumn.modifyCellContent(xCellRange, CurGroupValue);
- }
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
+ CurDBColumn.modifyCellContent(xCellRange, CurGroupValue);
}
}
- catch (Exception exception)
- {
- exception.printStackTrace(System.out);
- }
- return xNamedTextSection;
}
- private void renameTableofLastSection(String _snewname)
+ catch (Exception exception)
{
- XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
- XNamed xNamedTable = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
- xNamedTable.setName(_snewname);
+ exception.printStackTrace(System.out);
}
+ return xNamedTextSection;
+ }
+
+ private void renameTableofLastSection(String _snewname)
+ {
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ XNamed xNamedTable = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
+ xNamedTable.setName(_snewname);
+ }
- private int showMessageBox(String windowServiceName, int windowAttribute, String MessageText) {
+ private int showMessageBox(String windowServiceName, int windowAttribute, String MessageText)
+ {
return SystemDialog.showMessageBox(getMSF(), getWizardParent(), windowServiceName, windowAttribute, MessageText);
}
public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] _properties)
+ {
+ try
{
- try
+ XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms();
+ Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME);
+ boolean bgetConnection;
+ String sQueryName = "";
+ if (oDBForm != null)
{
- XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms();
- Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME);
- boolean bgetConnection;
- String sQueryName = "";
- if (oDBForm != null)
+ String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot;
+ XNameAccess xNamedForm = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oDBForm);
+ getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Command", sMsg);
+ String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "CommandType", sMsg);
+ String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg);
+ String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames", sMsg);
+ String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames", sMsg);
+ if (xNamedForm.hasByName("QueryName"))
+ {
+ sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName", sMsg);
+ }
+ String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, ";");
+ String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, ";");
+ getRecordParser().setRecordFieldNames(sNewList);
+ getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, ";");
+ getRecordParser().setCommandType(Integer.valueOf(sCommandType).intValue());
+ sMsgQueryCreationImpossible = JavaTools.replaceSubString(sMsgQueryCreationImpossible, getRecordParser().Command, "<STATEMENT>");
+ bgetConnection = getRecordParser().getConnection(_properties);
+ int nCommandType = com.sun.star.sdb.CommandType.COMMAND;
+ boolean bexecute = false;
+ if (bgetConnection)
{
- String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot;
- XNameAccess xNamedForm = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oDBForm);
- getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Command", sMsg);
- String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "CommandType", sMsg);
- String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg);
- String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames", sMsg);
- String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames", sMsg);
- if (xNamedForm.hasByName("QueryName"))
- {
- sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName", sMsg);
- }
- String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, ";");
- String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, ";");
- getRecordParser().setRecordFieldNames(sNewList);
- getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, ";");
- getRecordParser().setCommandType(Integer.valueOf(sCommandType).intValue());
- sMsgQueryCreationImpossible = JavaTools.replaceSubString(sMsgQueryCreationImpossible, getRecordParser().Command, "<STATEMENT>");
- bgetConnection = getRecordParser().getConnection(_properties);
- int nCommandType = com.sun.star.sdb.CommandType.COMMAND;
- boolean bexecute = false;
- if (bgetConnection)
- {
- if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals("")))
+ if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals("")))
+ {
+ getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser());
+ DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
+ if (getRecordParser().hasEscapeProcessing(oCommand.xPropertySet))
{
- getRecordParser().oSQLQueryComposer = new SQLQueryComposer(getRecordParser());
- DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
- if (getRecordParser().hasEscapeProcessing(oCommand.xPropertySet))
- {
- getRecordParser().Command = (String) oCommand.xPropertySet.getPropertyValue("Command");
- getRecordParser().oSQLQueryComposer.xQueryAnalyzer.setQuery(getRecordParser().Command);
- getRecordParser().oSQLQueryComposer.prependSortingCriteria();
- }
- else
- {
- nCommandType = com.sun.star.sdb.CommandType.QUERY;
- getRecordParser().Command = sQueryName;
- }
+ getRecordParser().Command = (String) oCommand.xPropertySet.getPropertyValue("Command");
+ getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(getRecordParser().Command);
+ getRecordParser().oSQLQueryComposer.prependSortingCriteria();
}
-
- bexecute = getRecordParser().executeCommand(nCommandType); //sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot, sFieldNameList, true);
- if (bexecute)
+ else
{
- bexecute = getRecordParser().getFields(sFieldNameList, true);
+ nCommandType = com.sun.star.sdb.CommandType.QUERY;
+ getRecordParser().Command = sQueryName;
}
- return bexecute;
}
- else
+
+ bexecute = getRecordParser().executeCommand(nCommandType); //sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot, sFieldNameList, true);
+ if (bexecute)
{
- return false;
+ bexecute = getRecordParser().getFields(sFieldNameList, true);
}
+ return bexecute;
}
else
{
- sReportFormNotExisting = JavaTools.replaceSubString(sReportFormNotExisting, ReportWizard.SOREPORTFORMNAME, "<REPORTFORM>");
- showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sReportFormNotExisting + (char) 13 + sMsgEndAutopilot);
return false;
}
}
- catch (InvalidQueryException queryexception)
- {
- return false;
- }
- catch (java.lang.Exception javaexception)
- {
- javaexception.printStackTrace(System.out);
- return false;
- }
- catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException exception)
+ else
{
+ sReportFormNotExisting = JavaTools.replaceSubString(sReportFormNotExisting, ReportWizard.SOREPORTFORMNAME, "<REPORTFORM>");
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sReportFormNotExisting + (char) 13 + sMsgEndAutopilot);
return false;
}
}
-
- private boolean m_bStopProcess;
- public void StopProcess()
+ catch (InvalidQueryException queryexception)
{
- m_bStopProcess = true;
+ return false;
}
+ catch (java.lang.Exception javaexception)
+ {
+ javaexception.printStackTrace(System.out);
+ return false;
+ }
+ catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException exception)
+ {
+ return false;
+ }
+ }
+ private boolean m_bStopProcess;
+
+ public void StopProcess()
+ {
+ m_bStopProcess = true;
+ }
- public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF)
+ public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF)
+ {
+ try
{
- try
- {
- int ColIndex;
- boolean breset;
- Object oTable;
- Vector DataVector = new Vector();
- DBColumn CurDBColumn;
- Object CurGroupValue;
- String CurGroupTableName;
+ int ColIndex;
+ boolean breset;
+ Object oTable;
+ Vector DataVector = new Vector();
+ DBColumn CurDBColumn;
+ Object CurGroupValue;
+ String CurGroupTableName;
// RecordParser CurDBMetaData = getRecordParser();
- com.sun.star.style.BreakType CorrBreakValue = null;
- String CorrPageDescName = "";
- getDoc().oTextFieldHandler.fixDateFields(true);
- getDoc().removeAllVisibleTextSections();
- getDoc().removeNonLayoutTextTables();
- addTextSectionCopies();
- getDoc().getallDBColumns();
- int GroupFieldCount = getRecordParser().GroupFieldNames.length;
- int FieldCount = getRecordParser().FieldColumns.length;
- Object[] OldGroupFieldValues = new Object[GroupFieldCount];
- XTextTable[] xGroupBaseTables = new XTextTable[GroupFieldCount];
- int RecordFieldCount = FieldCount - GroupFieldCount;
- XTextDocument xTextDocument = getDoc().xTextDocument;
- XTextCursor xTextCursor = ReportTextDocument.createTextCursor(getDoc().xTextDocument.getText());
- xTextDocument.lockControllers();
-
- if (getRecordParser().ResultSet.next() == true)
+ com.sun.star.style.BreakType CorrBreakValue = null;
+ String CorrPageDescName = "";
+ getDoc().oTextFieldHandler.fixDateFields(true);
+ getDoc().removeAllVisibleTextSections();
+ getDoc().removeNonLayoutTextTables();
+ addTextSectionCopies();
+ getDoc().getallDBColumns();
+ int GroupFieldCount = getRecordParser().GroupFieldNames.length;
+ int FieldCount = getRecordParser().FieldColumns.length;
+ Object[] OldGroupFieldValues = new Object[GroupFieldCount];
+ XTextTable[] xGroupBaseTables = new XTextTable[GroupFieldCount];
+ int RecordFieldCount = FieldCount - GroupFieldCount;
+ XTextDocument xTextDocument = getDoc().xTextDocument;
+ XTextCursor xTextCursor = ReportTextDocument.createTextCursor(getDoc().xTextDocument.getText());
+ xTextDocument.lockControllers();
+
+ if (getRecordParser().ResultSet.next() == true)
+ {
+ replaceUserFields();
+ Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
+ for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
{
- replaceUserFields();
- Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
- for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
- {
- CurGroupTableName = ReportTextDocument.TBLGROUPSECTION + Integer.toString(ColIndex + 1);
- oTable = getDoc().oTextTableHandler.xTextTablesSupplier.getTextTables().getByName(CurGroupTableName);
- xGroupBaseTables[ColIndex] = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
- CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex);
- OldGroupFieldValues[ColIndex] = CurGroupValue;
- CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
- addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue); //COPYOF!!!!
- }
- if (getRecordParser().getcurrentRecordData(DataVector) == true)
+ CurGroupTableName = ReportTextDocument.TBLGROUPSECTION + Integer.toString(ColIndex + 1);
+ oTable = getDoc().oTextTableHandler.xTextTablesSupplier.getTextTables().getByName(CurGroupTableName);
+ xGroupBaseTables[ColIndex] = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
+ CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex);
+ OldGroupFieldValues[ColIndex] = CurGroupValue;
+ CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
+ addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue); //COPYOF!!!!
+ }
+ if (getRecordParser().getcurrentRecordData(DataVector) == true)
+ {
+ // int RowIndex = 1;
+ m_bStopProcess = false;
+ while ((getRecordParser().ResultSet.next() == true) && (m_bStopProcess == false))
{
- // int RowIndex = 1;
- m_bStopProcess = false;
- while ((getRecordParser().ResultSet.next() == true) && (m_bStopProcess == false))
+ // RowIndex += 1;
+ breset = false;
+ for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
{
- // RowIndex += 1;
- breset = false;
- for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
+ CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex);
+ if ((CurGroupValue.equals(OldGroupFieldValues[ColIndex]) == false) || (breset))
{
- CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex);
- if ((CurGroupValue.equals(OldGroupFieldValues[ColIndex]) == false) || (breset))
- {
- breset = true;
- insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount);
- CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
- addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue);
- OldGroupFieldValues[ColIndex] = CurGroupValue;
- breset = !(ColIndex == GroupFieldCount - 1);
- }
+ breset = true;
+ insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount);
+ CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
+ addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue);
+ OldGroupFieldValues[ColIndex] = CurGroupValue;
+ breset = !(ColIndex == GroupFieldCount - 1);
}
- getRecordParser().getcurrentRecordData(DataVector);
- // updateProgressDisplay(RowIndex);
}
- insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount);
- }
- else
- {
- getDoc().unlockallControllers();
- return;
+ getRecordParser().getcurrentRecordData(DataVector);
+ // updateProgressDisplay(RowIndex);
}
+ insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount);
}
else
{
- for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
- {
- CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
- Object oValue = "";
- addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, oValue);
- }
- addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null);
- Object[][] RecordArray = new Object[1][RecordFieldCount];
- for (int i = 0; i < RecordArray[0].length; i++)
- {
- RecordArray[0][i] = Any.VOID;
- }
- XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
- OfficeDocument.ArraytoCellRange(RecordArray, xTextTable, 0, 1);
+ getDoc().unlockallControllers();
+ return;
}
- getDoc().oTextSectionHandler.breakLinkofTextSections();
}
- catch (Exception exception)
+ else
{
+ for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
+ {
+ CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
+ Object oValue = "";
+ addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, oValue);
+ }
+ addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null);
+ Object[][] RecordArray = new Object[1][RecordFieldCount];
+ for (int i = 0; i < RecordArray[0].length; i++)
+ {
+ RecordArray[0][i] = Any.VOID;
+ }
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ OfficeDocument.ArraytoCellRange(RecordArray, xTextTable, 0, 1);
}
+ getDoc().oTextSectionHandler.breakLinkofTextSections();
+ }
+ catch (Exception exception)
+ {
+ }
// catch (java.lang.Exception javaexception)
// {
// javaexception.printStackTrace(System.out);
// }
- getDoc().unlockallControllers();
- getDoc().setLayoutSectionsVisible(false);
- getDoc().removeCopiedTextSections();
- getDoc().oTextSectionHandler.removeInvisibleTextSections();
- getDoc().removeLayoutTextTables();
- }
+ getDoc().unlockallControllers();
+ getDoc().setLayoutSectionsVisible(false);
+ getDoc().removeCopiedTextSections();
+ getDoc().oTextSectionHandler.removeInvisibleTextSections();
+ getDoc().removeLayoutTextTables();
+ }
private void insertDataToRecordTable(XTextCursor xTextCursor, Vector DataVector, int FieldCount)
+ {
+ int DataLength = DataVector.size();
+ if ((FieldCount > 0) && (DataLength > 0))
{
- int DataLength = DataVector.size();
- if ((FieldCount > 0) && (DataLength > 0))
+ addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null);
+ Object[][] RecordArray = new Object[DataLength][FieldCount];
+ DataVector.copyInto(RecordArray);
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ if (DataLength > 1)
{
- addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null);
- Object[][] RecordArray = new Object[DataLength][FieldCount];
- DataVector.copyInto(RecordArray);
- XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
- if (DataLength > 1)
- {
- xTextTable.getRows().insertByIndex(xTextTable.getRows().getCount(), DataLength - 1);
- }
- OfficeDocument.ArraytoCellRange(RecordArray, xTextTable, 0, 1);
+ xTextTable.getRows().insertByIndex(xTextTable.getRows().getCount(), DataLength - 1);
}
- DataVector.removeAllElements();
+ OfficeDocument.ArraytoCellRange(RecordArray, xTextTable, 0, 1);
}
-
-
-
+ DataVector.removeAllElements();
+ }
// public void updateProgressDisplay(int iCounter)
// {
// try
@@ -450,27 +450,25 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
// jexception.printStackTrace(System.out);
// }
// }
-
-
private void replaceUserFields()
+ {
+ DBColumn CurDBColumn;
+ XTextCursor xNameCellCursor;
+ String FieldContent;
+ int iCount = getDoc().DBColumnsVector.size();
+ for (int i = 0; i < iCount; i++)
{
- DBColumn CurDBColumn;
- XTextCursor xNameCellCursor;
- String FieldContent;
- int iCount = getDoc().DBColumnsVector.size();
- for (int i = 0; i < iCount; i++)
+ CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(i);
+ xNameCellCursor = ReportTextDocument.createTextCursor(CurDBColumn.xNameCell);
+ xNameCellCursor.gotoStart(false);
+ FieldContent = getDoc().oTextFieldHandler.getUserFieldContent(xNameCellCursor);
+ if (!FieldContent.equals(""))
{
- CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(i);
- xNameCellCursor = ReportTextDocument.createTextCursor(CurDBColumn.xNameCell);
- xNameCellCursor.gotoStart(false);
- FieldContent = getDoc().oTextFieldHandler.getUserFieldContent(xNameCellCursor);
- if (!FieldContent.equals(""))
- {
- xNameCellCursor.goRight((short) 1, true);
- xNameCellCursor.setString(FieldContent);
- }
+ xNameCellCursor.goRight((short) 1, true);
+ xNameCellCursor.setString(FieldContent);
}
}
+ }
public XFrame getFrame()
{
@@ -481,17 +479,18 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
{
return m_aDoc.xMSFDoc;
}
+
public void store(String _sName, int _nOpenMode)
{
- getDoc().createReportForm(ReportWizard.SOREPORTFORMNAME);
- // int nOpenMode = getReportOpenMode();
- getDoc().oTextFieldHandler.updateDateFields();
- getDoc().oTextFieldHandler.fixDateFields(false);
- if ((_nOpenMode == ReportFinalizer.SOCREATETEMPLATE || _nOpenMode == ReportFinalizer.SOUSETEMPLATE))
- {
- getDoc().oTextSectionHandler.breakLinkofTextSections();
- getRecordParser().storeDatabaseDocumentToTempPath(getComponent(), _sName);
- }
+ getDoc().createReportForm(ReportWizard.SOREPORTFORMNAME);
+ // int nOpenMode = getReportOpenMode();
+ getDoc().oTextFieldHandler.updateDateFields();
+ getDoc().oTextFieldHandler.fixDateFields(false);
+ if ((_nOpenMode == ReportFinalizer.SOCREATETEMPLATE || _nOpenMode == ReportFinalizer.SOUSETEMPLATE))
+ {
+ getDoc().oTextSectionHandler.breakLinkofTextSections();
+ getRecordParser().storeDatabaseDocumentToTempPath(getComponent(), _sName);
+ }
}
public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount)
@@ -508,7 +507,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
// {
// return getDoc().isGroupField(_FieldName);
// }
-
public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, Vector GroupFieldVector)
{
getDoc().removeGroupName(NewSelGroupNames, CurGroupTitle, GroupFieldVector);
@@ -530,7 +528,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
{
throw new com.sun.star.lang.IllegalArgumentException("Unknown Orientation.");
}
- // CurReportDocument.getDoc().unlockallControllers();
+ // CurReportDocument.getDoc().unlockallControllers();
}
public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/)
@@ -553,6 +551,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
getDoc().oTextSectionHandler.removeTextSectionbyName("RecordSection");
getDoc().oTextTableHandler.removeTextTablebyName("Tbl_RecordSection");
}
+
public void layout_selectFirstPage()
{
getDoc().oViewHandler.selectFirstPage(getDoc().oTextTableHandler);
@@ -560,7 +559,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public void dispose()
{
- OfficeDocument.dispose(getMSF(), getComponent() );
+ OfficeDocument.dispose(getMSF(), getComponent());
}
public XComponent getComponent()
@@ -576,15 +575,13 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public void liveupdate_updateReportTitle(String _sTitleName)
{
int dummy = 0;
- // getDoc().updateReportTitle(_sTitleName);
+ // getDoc().updateReportTitle(_sTitleName);
}
// public void finish()
// {
// throw new UnsupportedOperationException("Not supported yet.");
// }
-
-
public void addReportToDBView()
{
getRecordParser().addReportDocument(getComponent(), true);
@@ -609,25 +606,23 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public void setSorting(String[][] aSortFieldNames)
{
- getRecordParser().setSortFieldNames( aSortFieldNames );
+ getRecordParser().setSortFieldNames(aSortFieldNames);
}
public void setGrouping(String[] aGroupFieldNames)
{
getRecordParser().prependSortFieldNames(aGroupFieldNames);
- }
-
-// TODO: we have to change to String List!!!!
+ }// TODO: we have to change to String List!!!!
private ArrayList m_aReportPath = null;
public ArrayList getReportPath()
{
if (m_aReportPath == null)
{
- // Check general availability of office paths
+ // Check general availability of office paths
try
{
- m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template","share", "/wizard");
+ m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
// m_sReportPath = FileAccess.combinePaths(getMSF(), m_sReportPath, "/wizard/report");
FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report");
}
@@ -641,9 +636,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public String getContentPath()
{
ArrayList aReportPath = getReportPath();
- for (int i=0;i<aReportPath.size();i++)
+ for (int i = 0; i < aReportPath.size(); i++)
{
- String sPath = (String)aReportPath.get(i);
+ String sPath = (String) aReportPath.get(i);
sPath += "/cnt-default.ott";
if (FileAccess.isPathValid(getMSF(), sPath))
{
@@ -656,9 +651,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
public String getLayoutPath()
{
ArrayList aReportPath = getReportPath();
- for (int i=0;i<aReportPath.size();i++)
+ for (int i = 0; i < aReportPath.size(); i++)
{
- String sPath = (String)aReportPath.get(i);
+ String sPath = (String) aReportPath.get(i);
sPath += "/stl-default.ott";
if (FileAccess.isPathValid(getMSF(), sPath))
{
@@ -715,7 +710,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
return LayoutFiles;
}
-
public void importReportData(ReportWizard _aWizard)
{
Dataimport CurDataimport = new Dataimport(_aWizard.xMSF);
@@ -728,9 +722,10 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
{
// already set somewhere else
}
+
public void setCommand(String _sCommand)
{
getRecordParser().Command = _sCommand;
- // throw new UnsupportedOperationException("Not supported yet.");
+ // throw new UnsupportedOperationException("Not supported yet.");
}
}
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java
index 3cb47b1aff0b..7d9db8c76488 100644
--- a/wizards/com/sun/star/wizards/report/ReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -8,7 +8,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: ReportWizard.java,v $
- * $Revision: 1.76.16.1 $
+ * $Revision: 1.76.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -28,7 +28,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.report;
// import java.util.Vector;
@@ -66,7 +65,6 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.util.Map;
-
public class ReportWizard extends WizardDialog implements XTextListener, XCompletion
{
// XMultiServiceFactory xMSF;
@@ -83,30 +81,24 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
String sCommandName = "";
int nCommandType = -1;
int nReportMode = ReportFinalizer.SOCREATEDOCUMENT;
- String sReportName = "";
-
+ private String m_sReportName = "";
public static final String SOREPORTFORMNAME = "ReportSource";
final int SOSELGROUPLST = 33;
final int SOTXTCOLTITLE = 48;
final int SOTITLESCROLLBAR = 49;
-
public static final int SONULLPAGE = 0;
public static final int SOMAINPAGE = 1;
public static final int SOTITLEPAGE = 2;
public static final int SOGROUPPAGE = 3;
public static final int SOSORTPAGE = 4;
public static final int SOTEMPLATEPAGE = 5;
- public static final int SOSTOREPAGE = 6;
-
- // ReportTextDocument CurReportDocument;
+ public static final int SOSTOREPAGE = 6; // ReportTextDocument CurReportDocument;
// ReportTextImplementation CurReportDocument;
IReportDocument CurReportDocument;
-
static String sMsgWizardName;
static String slblFields;
static String slblSelFields;
static String sShowBinaryFields;
-
static String sGroupings;
String[] WizardHeaderText = new String[6];
static String[] WizardTitle = new String[6];
@@ -127,33 +119,36 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
public static boolean bCloseDocument;
public boolean bHasEscapeProcessing = true;
-
-
public ReportWizard(XMultiServiceFactory xMSF)
+ {
+ super(xMSF, 34320);
+ super.addResourceHandler("Report Wizard", "dbw");
+ if (getReportResources(false) == true)
{
- super(xMSF, 34320);
- super.addResourceHandler("Report Wizard", "dbw");
- if (getReportResources( false) == true)
- {
- Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Height","Moveable","Name","PositionX","PositionY","Step","TabIndex","Title","Width"},
- new Object[] { new Integer(210),Boolean.TRUE, "DialogReport", new Integer(102),new Integer(41),new Integer(1), new Short((short)0), sMsgWizardName, new Integer(310)} );
- drawNaviBar();
- setRightPaneHeaders(this.WizardHeaderText);
- }
+ Helper.setUnoPropertyValues(xDialogModel,
+ new String[]
+ {
+ "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width"
+ },
+ new Object[]
+ {
+ new Integer(210), Boolean.TRUE, "DialogReport", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), sMsgWizardName, new Integer(310)
+ });
+ drawNaviBar();
+ setRightPaneHeaders(this.WizardHeaderText);
}
-
+ }
protected void enterStep(int nOldStep, int nNewStep)
+ {
+ if ((nOldStep >= SOTEMPLATEPAGE) && (nNewStep < SOTEMPLATEPAGE))
+ {
+ // CurReportDocument.getDoc().oTextSectionHandler.removeTextSectionbyName("RecordSection");
+ // CurReportDocument.getDoc().oTextTableHandler.removeTextTablebyName("Tbl_RecordSection");
+ CurReportDocument.removeTextTableAndTextSection();
+ }
+ switch (nNewStep)
{
- if ((nOldStep >= SOTEMPLATEPAGE) && (nNewStep < SOTEMPLATEPAGE))
- {
- // CurReportDocument.getDoc().oTextSectionHandler.removeTextSectionbyName("RecordSection");
- // CurReportDocument.getDoc().oTextTableHandler.removeTextTablebyName("Tbl_RecordSection");
- CurReportDocument.removeTextTableAndTextSection();
- }
- switch (nNewStep)
- {
case SOMAINPAGE:
CurDBCommandFieldSelection.setModified(false);
break;
@@ -186,14 +181,14 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
default:
break;
- }
}
+ }
protected void leaveStep(int nOldStep, int nNewStep)
- {
+ {
- switch (nOldStep)
- {
+ switch (nOldStep)
+ {
case SOMAINPAGE:
String[] aSelectedFieldNames = CurDBCommandFieldSelection.getSelectedFieldNames();
String aTableName = CurDBCommandFieldSelection.getSelectedCommandName();
@@ -211,7 +206,9 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
// CurReportDocument.getDoc().oTextSectionHandler.removeAllTextSections();
// CurReportDocument.getDoc().oTextTableHandler.removeAllTextTables();
// CurReportDocument.getDoc().DBColumnsVector = new Vector();
- CurReportDocument.getRecordParser().setGroupFieldNames(new String[]{});
+ CurReportDocument.getRecordParser().setGroupFieldNames(new String[]
+ {
+ });
CurGroupFieldHandler.removeGroupFieldNames();
}
break;
@@ -247,15 +244,15 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
default:
break;
- }
+ }
- if ((nOldStep < SOTEMPLATEPAGE) && (super.getNewStep() >= SOTEMPLATEPAGE))
- {
+ if ((nOldStep < SOTEMPLATEPAGE) && (super.getNewStep() >= SOTEMPLATEPAGE))
+ {
// this is called before SOTEMPLATEPAGE, after SOGROUPPAGE
- CurReportDocument.getRecordParser().createRecordFieldNames();
- CurReportLayouter.initialize(CurReportDocument.getContentPath());
- }
+ CurReportDocument.getRecordParser().createRecordFieldNames();
+ CurReportLayouter.initialize(CurReportDocument.getContentPath());
}
+ }
private XComponent[] dialogFinish(short RetValue)
{
@@ -267,20 +264,22 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
case 0:
// via Cancelbutton or via sourceCode with "endExecute"
this.xComponent.dispose();
- if (bCloseDocument == true) {
+ if (bCloseDocument == true)
+ {
// OfficeDocument.dispose(xMSF, CurReportDocument.getDoc().xComponent);
CurReportDocument.dispose();
return ret;
}
- if ((nReportMode == ReportFinalizer.SOCREATETEMPLATE) || (nReportMode == ReportFinalizer.SOUSETEMPLATE)) {
+ if ((nReportMode == ReportFinalizer.SOCREATETEMPLATE) || (nReportMode == ReportFinalizer.SOUSETEMPLATE))
+ {
bdisposeDialog = false;
// Add Report to the DB View
// old: CurReportDocument.getRecordParser().addReportDocument(CurReportDocument.getComponent(), true);
CurReportDocument.addReportToDBView();
- boolean bOpenInDesign = ( nReportMode == ReportFinalizer.SOCREATETEMPLATE );
+ boolean bOpenInDesign = (nReportMode == ReportFinalizer.SOCREATETEMPLATE);
// Create Report
// old: ret = CurReportDocument.getRecordParser().openReportDocument(sReportName, true, bOpenInDesign);
- ret = CurReportDocument.createFinalReportDocument(sReportName, true, bOpenInDesign);
+ ret = CurReportDocument.createFinalReportDocument(m_sReportName, true, bOpenInDesign);
}
else
{
@@ -291,7 +290,7 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
// CurDataimport.showProgressDisplay(xMSF, false);
// importReportData(xMSF, CurDataimport);
// old: ret = CurReportDocument.getRecordParser().openReportDocument(sReportName, false, false);
- ret = CurReportDocument.createFinalReportDocument(sReportName, false, false);
+ ret = CurReportDocument.createFinalReportDocument(m_sReportName, false, false);
}
return ret;
case 1:
@@ -304,94 +303,91 @@ public class ReportWizard extends WizardDialog implements XTextListener, XComple
return null;
}
-
private boolean executeQuery()
+ {
+ boolean bQueryCreated = false;
+ if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE)
{
- boolean bQueryCreated = false;
- if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE)
- {
- bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(sMsgWizardName, this.xWindow, false, false);
+ bQueryCreated = CurReportDocument.getRecordParser().oSQLQueryComposer.setQueryCommand(sMsgWizardName, this.xWindow, false, false);
- CurReportDocument.setCommandType( CommandType.COMMAND );
- String sQuery = CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery();
- CurReportDocument.setCommand( sQuery );
- }
- else
+ CurReportDocument.setCommandType(CommandType.COMMAND);
+ String sQuery = CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery();
+ CurReportDocument.setCommand(sQuery);
+ }
+ else
+ {
+ try
{
- try
+ String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
+ DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName);
+ bHasEscapeProcessing = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.xPropertySet);
+ String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command");
+ if (bHasEscapeProcessing)
{
- String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
- DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName);
- bHasEscapeProcessing = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.xPropertySet);
- String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command");
- if (bHasEscapeProcessing)
- {
- // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command");
- bQueryCreated = (!sCommand.equals(""));
- CurReportDocument.getRecordParser().oSQLQueryComposer.xQueryAnalyzer.setQuery(sCommand);
- CurReportDocument.getRecordParser().oSQLQueryComposer.prependSortingCriteria();
+ // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command");
+ bQueryCreated = (!sCommand.equals(""));
+ CurReportDocument.getRecordParser().oSQLQueryComposer.m_xQueryAnalyzer.setQuery(sCommand);
+ CurReportDocument.getRecordParser().oSQLQueryComposer.prependSortingCriteria();
// TODO: check with query
- CurReportDocument.setCommandType( CommandType.COMMAND );
- CurReportDocument.setCommand( CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery() );
- bQueryCreated = true;
- }
- else
- {
- CurReportDocument.setCommandType( CommandType.COMMAND );
- CurReportDocument.setCommand( sCommand );
- bQueryCreated = true;
- }
+ CurReportDocument.setCommandType(CommandType.COMMAND);
+ CurReportDocument.setCommand(CurReportDocument.getRecordParser().oSQLQueryComposer.getQuery());
+ bQueryCreated = true;
}
- catch (Exception e)
+ else
{
- e.printStackTrace(System.out);
+ CurReportDocument.setCommandType(CommandType.COMMAND);
+ CurReportDocument.setCommand(sCommand);
+ bQueryCreated = true;
}
}
- if (!bQueryCreated)
+ catch (Exception e)
{
- super.vetoableChange(null);
+ e.printStackTrace(System.out);
}
- return bQueryCreated;
}
-
-
+ if (!bQueryCreated)
+ {
+ super.vetoableChange(null);
+ }
+ return bQueryCreated;
+ }
public static void main(String args[])
+ {
+ String ConnectStr = "uno:socket,host=localhost,port=8107;urp;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
+ try
{
- String ConnectStr = "uno:socket,host=localhost,port=8107;urp;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- try
- {
- XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
+ XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
- tests(xLocMSF);
+ tests(xLocMSF);
- ReportWizard CurReportWizard = new ReportWizard(xLocMSF);
- if(xLocMSF != null)
- {
- System.out.println("Connected to "+ ConnectStr);
- PropertyValue[] curproperties = new PropertyValue[1];
- // curproperties[0] = Properties.createProperty(
- // "DatabaseLocation",
- // "file:///localhome/bc93774/NewDatabase2" +
- // "C:/Documents and Settings/ll93751/My Documents/RptWizard01_DB.odb");
- // "file://C:/Documents%20and%20Settings/ll93751/My%20Documents/RptWizard01_DB.odb");
-// "C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); //MyDocAssign.odb; baseLocation ); "DataSourceName", "db1");
- // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
- curproperties[0] = Properties.createProperty("DataSourceName", "RptWizard01_DB");
- CurReportWizard.startReportWizard(xLocMSF, curproperties, true);
- }
- }
- catch(Exception exception)
+ ReportWizard CurReportWizard = new ReportWizard(xLocMSF);
+ if (xLocMSF != null)
{
- exception.printStackTrace(System.out);
+ System.out.println("Connected to " + ConnectStr);
+ PropertyValue[] curproperties = new PropertyValue[1];
+ // curproperties[0] = Properties.createProperty(
+ // "DatabaseLocation",
+ // "file:///localhome/bc93774/NewDatabase2" +
+ // "C:/Documents and Settings/ll93751/My Documents/RptWizard01_DB.odb");
+ // "file://C:/Documents%20and%20Settings/ll93751/My%20Documents/RptWizard01_DB.odb");
+// "C:/Documents and Settings/bc93774.EHAM02-DEV/My Documents/MyHSQL.odb"); //MyDocAssign.odb; baseLocation ); "DataSourceName", "db1");
+ // curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
+ curproperties[0] = Properties.createProperty("DataSourceName", "RptWizard01_DB");
+ CurReportWizard.startReportWizard(xLocMSF, curproperties, true);
}
- System.exit(1);
}
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ System.exit(1);
+ }
-private static void tests(XMultiServiceFactory _xMSF)
-{
- try
- {
+ private static void tests(XMultiServiceFactory _xMSF)
+ {
+ try
+ {
// String[] sServices = _xMSF.getAvailableServiceNames();
// File aFile = new File("C:/temp/services.txt");
// aFile.delete();
@@ -430,112 +426,116 @@ private static void tests(XMultiServiceFactory _xMSF)
// xWindow.setVisible(true);
// aWindowPeer.setBackground(0x00000000);
- Object aControlContainer = _xMSF.createInstance("com.sun.star.awt.UnoControlContainer");
- // XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface(XControlContainer.class, aControlContainer);
+ Object aControlContainer = _xMSF.createInstance("com.sun.star.awt.UnoControlContainer");
+ // XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface(XControlContainer.class, aControlContainer);
- Object aFixedTextModel = _xMSF.createInstance("com.sun.star.awt.UnoControlFixedTextModel");
- XControlModel xFixedTextModel = (XControlModel)UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel);
+ Object aFixedTextModel = _xMSF.createInstance("com.sun.star.awt.UnoControlFixedTextModel");
+ XControlModel xFixedTextModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel);
// nicht das Model, sondern gleich den FixedText nehmen??
// XMultiServiceFactory xMSF = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, xFixedTextModel);
- Object aFixedText = _xMSF.createInstance("com.sun.star.awt.UnoControlFixedText");
- XServiceInfo xServiceInfo2 = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, aFixedText);
- String[] sServices2 = xServiceInfo2.getSupportedServiceNames();
+ Object aFixedText = _xMSF.createInstance("com.sun.star.awt.UnoControlFixedText");
+ XServiceInfo xServiceInfo2 = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, aFixedText);
+ String[] sServices2 = xServiceInfo2.getSupportedServiceNames();
- XWindow xWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, aFixedText);
- xWindow.setVisible(true);
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, aFixedText);
+ xWindow.setVisible(true);
- XFixedText xFixedText = (XFixedText)UnoRuntime.queryInterface(XFixedText.class, aFixedText);
- xFixedText.setText("Dies ist ein String");
+ XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
+ xFixedText.setText("Dies ist ein String");
- XControl xControl = (XControl)UnoRuntime.queryInterface(XControl.class, xFixedText);
- xControl.setModel(xFixedTextModel);
+ XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, xFixedText);
+ xControl.setModel(xFixedTextModel);
- XLayoutConstrains xLayoutConstrains = (XLayoutConstrains)UnoRuntime.queryInterface(XLayoutConstrains.class, aFixedText);
- Size aSize = xLayoutConstrains.getPreferredSize();
+ XLayoutConstrains xLayoutConstrains = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, aFixedText);
+ Size aSize = xLayoutConstrains.getPreferredSize();
- // xToolkit.createScreenCompatibleDevice(_nWidth, _nWidth).
- // XWindow x = getReportDefinition().getCurrentController().getFrame().getContainerWindow();
- // Object aObj = _xSection.getParent();
- int dummy = 0;
- }
- catch (Exception e)
- {
- int dummy = 0;
- }
-
-}
- public void buildSteps()
+ // xToolkit.createScreenCompatibleDevice(_nWidth, _nWidth).
+ // XWindow x = getReportDefinition().getCurrentController().getFrame().getContainerWindow();
+ // Object aObj = _xSection.getParent();
+ int dummy = 0;
+ }
+ catch (Exception e)
{
- // CurReportDocument.getDoc().xProgressBar.setValue(30);
- CurDBCommandFieldSelection = new CommandFieldSelection(this, CurReportDocument.getRecordParser(), 100, slblFields, slblSelFields, slblTables, true, 34330);
- CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
- insertLabel("lblBinaryFields",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"},
- new Object[] {new Integer(16), sShowBinaryFields, new Integer(95), new Integer(162), new Integer(1), new Integer(210)});
- // CurReportDocument.getDoc().xProgressBar.setValue(40);
- CurTitlesComponent = new TitlesComponent(this, SOTITLEPAGE, 97, 37, 210, 7, slblColumnNames, slblColumnTitles, 34381);
- CurTitlesComponent.addTextListener(this);
- // CurReportDocument.getDoc().xProgressBar.setValue(50);
- CurGroupFieldHandler = new GroupFieldHandler(CurReportDocument, this);
- // CurReportDocument.getDoc().xProgressBar.setValue(60);
- CurSortingComponent = new SortingComponent(this, SOSORTPAGE, 95, 30, 210, 34346);
- // CurReportDocument.getDoc().xProgressBar.setValue(70);
- CurReportLayouter = new ReportLayouter(xMSF, CurReportDocument, this);
- // CurReportDocument.getDoc().xProgressBar.setValue(80);
- CurReportFinalizer = new ReportFinalizer(xMSF, CurReportDocument, this);
- // CurReportDocument.getDoc().xProgressBar.setValue(100);
- bCloseDocument = true;
- // CurReportDocument.getDoc().xProgressBar.end();
- enableNavigationButtons(false, false, false);
+ int dummy = 0;
}
+ }
+
+ public void buildSteps()
+ {
+ // CurReportDocument.getDoc().xProgressBar.setValue(30);
+ CurDBCommandFieldSelection = new CommandFieldSelection(this, CurReportDocument.getRecordParser(), 100, slblFields, slblSelFields, slblTables, true, 34330);
+ CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
+ insertLabel("lblBinaryFields",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(16), sShowBinaryFields, new Integer(95), new Integer(162), new Integer(1), new Integer(210)
+ });
+ // CurReportDocument.getDoc().xProgressBar.setValue(40);
+ CurTitlesComponent = new TitlesComponent(this, SOTITLEPAGE, 97, 37, 210, 7, slblColumnNames, slblColumnTitles, 34381);
+ CurTitlesComponent.addTextListener(this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(50);
+ CurGroupFieldHandler = new GroupFieldHandler(CurReportDocument, this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(60);
+ CurSortingComponent = new SortingComponent(this, SOSORTPAGE, 95, 30, 210, 34346);
+ // CurReportDocument.getDoc().xProgressBar.setValue(70);
+ CurReportLayouter = new ReportLayouter(xMSF, CurReportDocument, this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(80);
+ CurReportFinalizer = new ReportFinalizer(xMSF, CurReportDocument, this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(100);
+ bCloseDocument = true;
+ // CurReportDocument.getDoc().xProgressBar.end();
+ enableNavigationButtons(false, false, false);
+ }
public void finishWizard()
+ {
+ int ncurStep = getCurrentStep();
+ if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE))
{
- int ncurStep = getCurrentStep();
- if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE))
+ if (this.executeQuery())
{
- if (this.executeQuery())
+ if (CurReportFinalizer.finish())
{
- if (CurReportFinalizer.finish())
- {
- nReportMode = CurReportFinalizer.getReportOpenMode();
- sReportName = CurReportFinalizer.getStoreName();
- xDialog.endExecute();
- }
+ nReportMode = CurReportFinalizer.getReportOpenMode();
+ m_sReportName = CurReportFinalizer.getStoreName();
+ xDialog.endExecute();
}
}
}
-
+ }
public void cancelWizard()
- {
- xDialog.endExecute();
- }
-
+ {
+ xDialog.endExecute();
+ }
public void insertQueryRelatedSteps()
- {
- setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80);
- addRoadmap();
- int i = 0;
- i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_QUERY + 80), SOMAINPAGE);
- i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 68), SOTITLEPAGE);
- i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 11), SOGROUPPAGE);
- i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 12), SOSORTPAGE); // Orderby is always supported
- i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 13), SOTEMPLATEPAGE);
- i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 14), SOSTOREPAGE);
- setRoadmapInteractive(true);
- setRoadmapComplete(true);
- setCurrentRoadmapItemID((short) 1);
- }
+ {
+ setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80);
+ addRoadmap();
+ int i = 0;
+ i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_QUERY + 80), SOMAINPAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 68), SOTITLEPAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 11), SOGROUPPAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 12), SOSORTPAGE); // Orderby is always supported
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 13), SOTEMPLATEPAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_REPORT + 14), SOSTOREPAGE);
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ }
private boolean isReportBuilderInstalled()
{
//! Check if the new Report Builder Extension is available
- XContentEnumerationAccess a = (XContentEnumerationAccess)com.sun.star.uno.UnoRuntime.queryInterface(XContentEnumerationAccess.class, xMSF);
+ XContentEnumerationAccess a = (XContentEnumerationAccess) com.sun.star.uno.UnoRuntime.queryInterface(XContentEnumerationAccess.class, xMSF);
com.sun.star.container.XEnumeration e = a.createContentEnumeration("com.sun.star.report.pentaho.SOReportJobFactory");
if (e == null)
{
@@ -548,195 +548,204 @@ private static void tests(XMultiServiceFactory _xMSF)
return false;
}
-/**
- * Return the path to the "com.sun.reportdesigner" extension
- * @param _xMSF
- * @return
- */
-public static String getPathToExtension(XMultiServiceFactory _xMSF)
-{
- // Get the path to the extension and try to add the path to the class loader
- final XComponentContext xComponentContext = Helper.getComponentContext(_xMSF);
- final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider");
- XPackageInformationProvider xProvider = (XPackageInformationProvider)UnoRuntime.queryInterface(XPackageInformationProvider.class, aSingleton);
- // String[][] aStrListList = xProvider.getExtensionList();
- final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner");
- return sLocation;
-}
-
+ /**
+ * Return the path to the "com.sun.reportdesigner" extension
+ * @param _xMSF
+ * @return
+ */
+ public static String getPathToExtension(XMultiServiceFactory _xMSF)
+ {
+ // Get the path to the extension and try to add the path to the class loader
+ final XComponentContext xComponentContext = Helper.getComponentContext(_xMSF);
+ final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider");
+ XPackageInformationProvider xProvider = (XPackageInformationProvider) UnoRuntime.queryInterface(XPackageInformationProvider.class, aSingleton);
+ // String[][] aStrListList = xProvider.getExtensionList();
+ final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner");
+ return sLocation;
+ }
-public XComponent[] startReportWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue)
-{
- return startReportWizard(_xMSF, CurPropertyValue, false);
-}
+ public XComponent[] startReportWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue)
+ {
+ return startReportWizard(_xMSF, CurPropertyValue, false);
+ }
-public XComponent[] startReportWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue, boolean _bDebug)
-{
- XComponent[] ret = null;
- this.xMSF = _xMSF;
- DBGPROPERTYVALUE = CurPropertyValue;
- // CurReportDocument = new ReportTextDocument(xMSF, ReportPath + "/stl-default.ott", m_oResource );
- // if (isReportBuilderInstalled())
- // {
- // CurReportDocument = ReportBuilderImplementation.create(xMSF, m_oResource);
- // }
- // else
- // {
- // CurReportDocument = ReportTextImplementation.create(xMSF, m_oResource );
- // }
- boolean bUseOld = false;
- if (!isReportBuilderInstalled())
+ public XComponent[] startReportWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue, boolean _bDebug)
+ {
+ XComponent[] ret = null;
+ this.xMSF = _xMSF;
+ DBGPROPERTYVALUE = CurPropertyValue;
+ // CurReportDocument = new ReportTextDocument(xMSF, ReportPath + "/stl-default.ott", m_oResource );
+ // if (isReportBuilderInstalled())
+ // {
+ // CurReportDocument = ReportBuilderImplementation.create(xMSF, m_oResource);
+ // }
+ // else
+ // {
+ // CurReportDocument = ReportTextImplementation.create(xMSF, m_oResource );
+ // }
+ boolean bUseOld = false;
+ if (!isReportBuilderInstalled())
+ {
+ bUseOld = true;
+ }
+ if (_bDebug == true && !bUseOld)
+ {
+ try
{
- bUseOld = true;
+ Class a = Class.forName("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
+ Method aMethod = a.getMethod("create", new Class[]
+ {
+ XMultiServiceFactory.class, Resource.class
+ });
+ CurReportDocument = (IReportDocument) aMethod.invoke(a, new Object[]
+ {
+ xMSF, m_oResource
+ });
}
- if (_bDebug == true && !bUseOld)
+ catch (Exception e)
{
- try
- {
- Class a = Class.forName("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
- Method aMethod = a.getMethod("create", new Class[]{XMultiServiceFactory.class, Resource.class});
- CurReportDocument = (IReportDocument) aMethod.invoke(a, new Object[]{xMSF, m_oResource});
- }
- catch (Exception e)
- {
- int dummy = 0;
- }
+ int dummy = 0;
}
- else
+ }
+ else
+ {
+ if (!bUseOld)
{
- if (!bUseOld)
- {
- // debug == false
+ // debug == false
- // Get the path to the extension and try to add the path to the class loader
- String sLocation = getPathToExtension(xMSF);
- // TODO: Umlaut in filename!
- if (sLocation.length() > 0)
+ // Get the path to the extension and try to add the path to the class loader
+ String sLocation = getPathToExtension(xMSF);
+ // TODO: Umlaut in filename!
+ if (sLocation.length() > 0)
+ {
+ try
{
- try
- {
- URI aLocationURI = URI.create(sLocation + "/" + "reportbuilderwizard.jar");
-
- URL[] aURLs = new URL[1];
- aURLs[0] = aLocationURI.toURL();
- URLClassLoader aClassLoader = new URLClassLoader(aURLs, this.getClass().getClassLoader());
- Class a = aClassLoader.loadClass("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
- Method aMethod = a.getMethod("create", new Class[]{XMultiServiceFactory.class, Resource.class});
- CurReportDocument = (IReportDocument) aMethod.invoke(a, new Object[]{xMSF, m_oResource});
- }
- catch (Exception e)
- {
- // TODO: Exception not handled.
- int dummy = 0;
- // Maybe problems in URI create() if a wrong char is used like '[' ']', ...
- System.out.println("There could be a problem with the path '" + sLocation + "'");
- }
+ URI aLocationURI = URI.create(sLocation + "/" + "reportbuilderwizard.jar");
+
+ URL[] aURLs = new URL[1];
+ aURLs[0] = aLocationURI.toURL();
+ URLClassLoader aClassLoader = new URLClassLoader(aURLs, this.getClass().getClassLoader());
+ Class a = aClassLoader.loadClass("com.sun.star.wizards.reportbuilder.ReportBuilderImplementation");
+ Method aMethod = a.getMethod("create", new Class[]
+ {
+ XMultiServiceFactory.class, Resource.class
+ });
+ CurReportDocument = (IReportDocument) aMethod.invoke(a, new Object[]
+ {
+ xMSF, m_oResource
+ });
+ }
+ catch (Exception e)
+ {
+ // TODO: Exception not handled.
+ int dummy = 0;
+ // Maybe problems in URI create() if a wrong char is used like '[' ']', ...
+ System.out.println("There could be a problem with the path '" + sLocation + "'");
}
}
}
- try
+ }
+ try
+ {
+ if (CurReportDocument == null)
{
- if (CurReportDocument == null)
- {
- // Fallback, if there is no reportbuilder wizard implementation, we use the old wizard
- CurReportDocument = ReportTextImplementation.create(xMSF, m_oResource );
- }
+ // Fallback, if there is no reportbuilder wizard implementation, we use the old wizard
+ CurReportDocument = ReportTextImplementation.create(xMSF, m_oResource);
+ }
- // CurDBMetaData = CurReportDocument.getRecordParser();
+ // CurDBMetaData = CurReportDocument.getRecordParser();
// tests();
- if (CurReportDocument.getRecordParser().getConnection(CurPropertyValue))
- {
- // CurReportDocument.getDoc().xProgressBar.setValue(20);
- CurReportDocument.getRecordParser().oSQLQueryComposer = new SQLQueryComposer(CurReportDocument.getRecordParser());
- buildSteps();
- this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValue, false);
+ if (CurReportDocument.getRecordParser().getConnection(CurPropertyValue))
+ {
+ // CurReportDocument.getDoc().xProgressBar.setValue(20);
+ CurReportDocument.getRecordParser().oSQLQueryComposer = new SQLQueryComposer(CurReportDocument.getRecordParser());
+ buildSteps();
+ this.CurDBCommandFieldSelection.preselectCommand(CurPropertyValue, false);
- createWindowPeer(CurReportDocument.getWizardParent());
+ createWindowPeer(CurReportDocument.getWizardParent());
- CurReportDocument.getRecordParser().setWindowPeer(this.xControl.getPeer());
- insertQueryRelatedSteps();
- short RetValue = executeDialog(CurReportDocument.getFrame().getComponentWindow().getPosSize());
- ret = dialogFinish(RetValue);
- }
- CurReportDocument.getRecordParser().dispose();
- }
- catch(java.lang.Exception jexception )
- {
- jexception.printStackTrace(System.out);
+ CurReportDocument.getRecordParser().setWindowPeer(this.xControl.getPeer());
+ insertQueryRelatedSteps();
+ short RetValue = executeDialog(CurReportDocument.getFrame().getComponentWindow().getPosSize());
+ ret = dialogFinish(RetValue);
}
- return ret;
+ CurReportDocument.getRecordParser().dispose();
}
-
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ return ret;
+ }
public void importReportData(final XMultiServiceFactory xMSF, final Dataimport CurDataimport)
+ {
+ boolean bDocisStored = false;
+ try
{
- boolean bDocisStored = false;
- try
+ boolean bexecute = false;
+ if (!bHasEscapeProcessing)
{
- boolean bexecute = false;
- if (!bHasEscapeProcessing)
- {
- bexecute = CurReportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.QUERY); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
- }
- else
- {
- bexecute = CurReportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.COMMAND); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
- }
- if (bexecute)
- {
- bexecute = CurReportDocument.getRecordParser().getFields(CurReportDocument.getRecordParser().getFieldNames(), false);
- }
- if (bexecute)
- {
- // CurDataimport.insertDatabaseDatatoReportDocument(xMSF);
- CurReportDocument.insertDatabaseDatatoReportDocument(xMSF);
- }
-
- if (CurReportFinalizer.getReportOpenMode() == ReportFinalizer.SOCREATEDOCUMENT)
- {
- bDocisStored = CurReportDocument.getRecordParser().storeDatabaseDocumentToTempPath(CurReportDocument.getComponent(), CurReportFinalizer.getStoreName());
- }
+ bexecute = CurReportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.QUERY); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
}
- catch (com.sun.star.wizards.common.InvalidQueryException queryexception)
+ else
{
+ bexecute = CurReportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.COMMAND); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
}
- CurDataimport.xComponent.dispose();
- if (bDocisStored)
+ if (bexecute)
{
- CurReportDocument.getRecordParser().addReportDocument(CurReportDocument.getComponent(), false);
+ bexecute = CurReportDocument.getRecordParser().getFields(CurReportDocument.getRecordParser().getFieldNames(), false);
+ }
+ if (bexecute)
+ {
+ // CurDataimport.insertDatabaseDatatoReportDocument(xMSF);
+ CurReportDocument.insertDatabaseDatatoReportDocument(xMSF);
}
- CurReportDocument.getRecordParser().dispose();
+ if (CurReportFinalizer.getReportOpenMode() == ReportFinalizer.SOCREATEDOCUMENT)
+ {
+ bDocisStored = CurReportDocument.getRecordParser().storeDatabaseDocumentToTempPath(CurReportDocument.getComponent(), CurReportFinalizer.getStoreName());
+ }
+ }
+ catch (com.sun.star.wizards.common.InvalidQueryException queryexception)
+ {
+ }
+ CurDataimport.xComponent.dispose();
+ if (bDocisStored)
+ {
+ CurReportDocument.getRecordParser().addReportDocument(CurReportDocument.getComponent(), false);
}
+ CurReportDocument.getRecordParser().dispose();
+ }
public boolean getReportResources(boolean bgetProgressResourcesOnly)
+ {
+ sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_REPORT);
+ if (bgetProgressResourcesOnly == false)
{
- sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_REPORT);
- if (bgetProgressResourcesOnly == false)
- {
- sShowBinaryFields = m_oResource.getResText(UIConsts.RID_REPORT + 60);
- slstDatabasesDefaultText = m_oResource.getResText(UIConsts.RID_DB_COMMON + 37);
- slstTablesDefaultText = m_oResource.getResText(UIConsts.RID_DB_COMMON + 38);
- sMsgErrorOccured = m_oResource.getResText(UIConsts.RID_DB_COMMON + 6);
- slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6);
- slblFields = m_oResource.getResText(UIConsts.RID_FORM + 12);
- slblSelFields = m_oResource.getResText(UIConsts.RID_REPORT + 9);
- WizardHeaderText[0] = m_oResource.getResText(UIConsts.RID_REPORT + 28);
- WizardHeaderText[1] = m_oResource.getResText(UIConsts.RID_REPORT + 69);
- WizardHeaderText[2] = m_oResource.getResText(UIConsts.RID_REPORT + 29);
- WizardHeaderText[3] = m_oResource.getResText(UIConsts.RID_REPORT + 30);
- WizardHeaderText[4] = m_oResource.getResText(UIConsts.RID_REPORT + 31);
- WizardHeaderText[5] = m_oResource.getResText(UIConsts.RID_REPORT + 32);
- sMsgSavingImpossible = m_oResource.getResText(UIConsts.RID_DB_COMMON + 30);
- }
- sMsgFilePathInvalid = m_oResource.getResText(UIConsts.RID_DB_COMMON + 36);
- slblColumnTitles = m_oResource.getResText(UIConsts.RID_REPORT + 70);
- slblColumnNames = m_oResource.getResText(UIConsts.RID_REPORT + 71);
+ sShowBinaryFields = m_oResource.getResText(UIConsts.RID_REPORT + 60);
+ slstDatabasesDefaultText = m_oResource.getResText(UIConsts.RID_DB_COMMON + 37);
+ slstTablesDefaultText = m_oResource.getResText(UIConsts.RID_DB_COMMON + 38);
+ sMsgErrorOccured = m_oResource.getResText(UIConsts.RID_DB_COMMON + 6);
+ slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6);
+ slblFields = m_oResource.getResText(UIConsts.RID_FORM + 12);
+ slblSelFields = m_oResource.getResText(UIConsts.RID_REPORT + 9);
+ WizardHeaderText[0] = m_oResource.getResText(UIConsts.RID_REPORT + 28);
+ WizardHeaderText[1] = m_oResource.getResText(UIConsts.RID_REPORT + 69);
+ WizardHeaderText[2] = m_oResource.getResText(UIConsts.RID_REPORT + 29);
+ WizardHeaderText[3] = m_oResource.getResText(UIConsts.RID_REPORT + 30);
+ WizardHeaderText[4] = m_oResource.getResText(UIConsts.RID_REPORT + 31);
+ WizardHeaderText[5] = m_oResource.getResText(UIConsts.RID_REPORT + 32);
+ sMsgSavingImpossible = m_oResource.getResText(UIConsts.RID_DB_COMMON + 30);
+ }
+ sMsgFilePathInvalid = m_oResource.getResText(UIConsts.RID_DB_COMMON + 36);
+ slblColumnTitles = m_oResource.getResText(UIConsts.RID_REPORT + 70);
+ slblColumnNames = m_oResource.getResText(UIConsts.RID_REPORT + 71);
// sBlindTextNote = m_oResource.getResText(UIConsts.RID_REPORT + 75);
// sBlindTextNote = JavaTools.replaceSubString( sBlindTextNote, String.valueOf((char)13), "<BR>");
- return true;
- }
+ return true;
+ }
public static String getBlindTextNote(Object _aDocument, Resource _oResource)
{
@@ -744,162 +753,156 @@ public XComponent[] startReportWizard(XMultiServiceFactory _xMSF, PropertyValue[
if (_aDocument instanceof ReportTextImplementation)
{
sBlindTextNote = _oResource.getResText(UIConsts.RID_REPORT + 75);
- sBlindTextNote = JavaTools.replaceSubString( sBlindTextNote, String.valueOf((char)13), "<BR>");
+ sBlindTextNote = JavaTools.replaceSubString(sBlindTextNote, String.valueOf((char) 13), "<BR>");
}
return sBlindTextNote;
}
- public void enableRoadmapItems(boolean _bEnabled )
+ public void enableRoadmapItems(boolean _bEnabled)
+ {
+ try
{
- try
- {
- Object oRoadmapItem = null;
- int CurStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, "Step"));
- boolean bEnabled = false;
- int CurItemID;
- for (int i = 0; i < getRMItemCount(); i++)
+ Object oRoadmapItem = null;
+ int CurStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, "Step"));
+ boolean bEnabled = false;
+ int CurItemID;
+ for (int i = 0; i < getRMItemCount(); i++)
+ {
+ oRoadmapItem = this.xIndexContRoadmap.getByIndex(i);
+ CurItemID = AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmapItem, "ID"));
+ if (CurItemID > CurStep)
{
- oRoadmapItem = this.xIndexContRoadmap.getByIndex(i);
- CurItemID = AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmapItem, "ID"));
- if (CurItemID > CurStep)
- {
- bEnabled = _bEnabled;
- }
- else
- {
- bEnabled = true;
- }
-
- Helper.setUnoPropertyValue(oRoadmapItem , "Enabled", new Boolean(bEnabled));
+ bEnabled = _bEnabled;
}
- }
- catch( com.sun.star.uno.Exception exception )
- {
- exception.printStackTrace(System.out);
+ else
+ {
+ bEnabled = true;
+ }
+
+ Helper.setUnoPropertyValue(oRoadmapItem, "Enabled", new Boolean(bEnabled));
}
}
-
-
-
- private void enableWizardSteps(String[] NewItems)
+ catch (com.sun.star.uno.Exception exception)
{
- boolean bEnabled = NewItems.length > 0;
- setControlProperty("btnWizardNext", "Enabled", new Boolean(bEnabled));
- setControlProperty("btnWizardFinish", "Enabled", new Boolean(bEnabled));
- enableRoadmapItems(bEnabled); // Note: Performancewise this could be improved
+ exception.printStackTrace(System.out);
}
+ }
+ private void enableWizardSteps(String[] NewItems)
+ {
+ boolean bEnabled = NewItems.length > 0;
+ setControlProperty("btnWizardNext", "Enabled", new Boolean(bEnabled));
+ setControlProperty("btnWizardFinish", "Enabled", new Boolean(bEnabled));
+ enableRoadmapItems(bEnabled); // Note: Performancewise this could be improved
+ }
public void textChanged(TextEvent xTextEvent)
+ {
+ try
{
- try
- {
- Object oModel = UnoDialog.getModel(xTextEvent.Source);
- String sContent = (String) Helper.getUnoPropertyValue(oModel, "Text");
- String fieldname = this.CurTitlesComponent.getFieldNameByTitleControl(oModel);
- // CurReportDocument.getDoc().oTextFieldHandler.changeUserFieldContent(fieldname, sfieldtitle);
- CurReportDocument.liveupdate_changeUserFieldContent(fieldname, sContent);
- }
- catch (Exception exception)
- {
- exception.printStackTrace(System.out);
- }
+ Object oModel = UnoDialog.getModel(xTextEvent.Source);
+ String sContent = (String) Helper.getUnoPropertyValue(oModel, "Text");
+ String fieldname = this.CurTitlesComponent.getFieldNameByTitleControl(oModel);
+ // CurReportDocument.getDoc().oTextFieldHandler.changeUserFieldContent(fieldname, sfieldtitle);
+ CurReportDocument.liveupdate_changeUserFieldContent(fieldname, sContent);
}
-
- public void disposing(EventObject EventObject)
+ catch (Exception exception)
{
+ exception.printStackTrace(System.out);
}
+ }
+ public void disposing(EventObject EventObject)
+ {
+ }
public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue)
+ {
+ switch (_ndialogpage)
{
- switch(_ndialogpage)
- {
case SOMAINPAGE:
break;
default:
break;
- }
}
-
+ }
private void toggleSortingPage()
+ {
+ int nlCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType();
+ boolean bdoenable = (nlCommandType == CommandType.TABLE);
+ if (!bdoenable)
{
- int nlCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType();
- boolean bdoenable = (nlCommandType == CommandType.TABLE);
- if (!bdoenable)
- {
- String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
- DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName);
- bdoenable = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.xPropertySet);
- }
- super.setStepEnabled(SOSORTPAGE, bdoenable);
-
- // int nCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType();
- // super.setStepEnabled(SOSORTPAGE, (nCommandType == CommandType.TABLE));
+ String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
+ DBMetaData.CommandObject oCommand = CurReportDocument.getRecordParser().getQueryByName(sQueryName);
+ bdoenable = CurReportDocument.getRecordParser().hasEscapeProcessing(oCommand.xPropertySet);
}
+ super.setStepEnabled(SOSORTPAGE, bdoenable);
+ // int nCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType();
+ // super.setStepEnabled(SOSORTPAGE, (nCommandType == CommandType.TABLE));
+ }
public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
{
+
protected int m_nID;
public int getID()
- {
- return m_nID;
- }
+ {
+ return m_nID;
+ }
public void setID(String sIncSuffix)
+ {
+ m_nID = 1;
+ if (sIncSuffix != null)
{
- m_nID = 1;
- if (sIncSuffix != null)
+ if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
{
- if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
- {
- String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
- m_nID = Integer.parseInt(sID);
- }
+ String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
+ m_nID = Integer.parseInt(sID);
}
}
+ }
public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (m_nID == 1)
{
- if (m_nID == 1)
- {
- CurDBCommandFieldSelection.setModified(true);
- enableWizardSteps(NewItems);
- toggleSortingPage();
- }
- else
- {
- boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
- Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), "Enabled", new Boolean(bEnabled));
- }
+ CurDBCommandFieldSelection.setModified(true);
+ enableWizardSteps(NewItems);
+ toggleSortingPage();
}
-
-
- public void shiftFromRightToLeft(String[] SelItems, String[] NewItems )
+ else
{
- // TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox
- if (m_nID == 1)
- {
- enableWizardSteps(NewItems);
- CurDBCommandFieldSelection.setModified(true);
- }
- else
- {
- boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
- Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), "Enabled", new Boolean(bEnabled));
- }
+ boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), "Enabled", new Boolean(bEnabled));
}
+ }
- public void moveItemDown(String item)
+ public void shiftFromRightToLeft(String[] SelItems, String[] NewItems)
+ {
+ // TODO When the ListFieldbox is refilled only fields of the current Command may be merged into the Listbox
+ if (m_nID == 1)
{
+ enableWizardSteps(NewItems);
+ CurDBCommandFieldSelection.setModified(true);
}
-
- public void moveItemUp(String item)
+ else
{
+ boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), "Enabled", new Boolean(bEnabled));
}
+ }
+
+ public void moveItemDown(String item)
+ {
+ }
+
+ public void moveItemUp(String item)
+ {
+ }
}
// public void tests()
// {
diff --git a/wizards/com/sun/star/wizards/report/XCallReportWizard.java b/wizards/com/sun/star/wizards/report/XCallReportWizard.java
index b9f70b86eef6..562ce506cc56 100644
--- a/wizards/com/sun/star/wizards/report/XCallReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/XCallReportWizard.java
@@ -9,7 +9,7 @@
*
* $RCSfile: XCallReportWizard.java,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.8.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,14 +29,14 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.report;
public interface XCallReportWizard extends com.sun.star.uno.XInterface
{
// Methods
- public void CallReportDialog();
-
- // static Member
- public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = { new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallReportDialog", 0, 0)};
+ public void CallReportDialog(); // static Member
+ public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] =
+ {
+ new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallReportDialog", 0, 0)
+ };
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
index f35e0324b420..184bd7cd9fea 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
@@ -9,7 +9,7 @@
*
* $RCSfile: ReportBuilderImplementation.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.reportbuilder;
// import com.sun.star.deployment.XPackageInformationProvider;
@@ -70,30 +69,28 @@ import java.util.Vector;
// import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.common.FileAccess;
// import com.sun.star.wizards.common.Configuration;
-
-
/**
* This class use the IReportDocument Interface to communicate between the UI
* and the ReportBuilderLayouter which communicates to the new Sun Report Builder.
*
* @author ll93751
*/
-public class ReportBuilderImplementation extends ReportImplementationHelper
+public class ReportBuilderImplementation extends ReportImplementationHelper
implements IReportDocument, IReportDefinitionReadAccess
{
+
private static final int MAXIMUM_GROUPCOUNT = 4;
// public ReportTextDocument getDoc()
// {
// throw new UnsupportedOperationException("Not supported yet.");
// }
-
public void clearDocument()
{
// throw new UnsupportedOperationException("Not supported yet.");
}
-
private Resource m_aResource;
- public ReportBuilderImplementation()
+
+ public ReportBuilderImplementation()
{
// super(null, ReportLayouter.SOOPTPORTRAIT);
super(null, ReportLayouter.SOOPTLANDSCAPE);
@@ -126,20 +123,18 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
// {
// throw new UnsupportedOperationException("Not supported yet.");
// }
-
public XWindowPeer getWizardParent()
{
// throw new UnsupportedOperationException("Not supported yet.");
// com.sun.star.frame.XFrame xFrame = thisComponent;
- // openReportBuilderView();
- // XInterface xInterface = (XInterface) getMSF().createInstance("com.sun.star.frame.Desktop");
- // XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface);
- // XFrame xFrame = xDesktop.getCurrentFrame();
+ // openReportBuilderView();
+ // XInterface xInterface = (XInterface) getMSF().createInstance("com.sun.star.frame.Desktop");
+ // XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface);
+ // XFrame xFrame = xDesktop.getCurrentFrame();
final XWindowPeer aWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, getFrame().getComponentWindow());
return aWindowPeer;
}
-
private XFrame m_xFrame = null;
// private ReportBuilderLayouter m_aReportBuilderLayouter = null;
private String m_sReportBuilderLayoutName = "";
@@ -153,18 +148,16 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
{
// if (m_aReportBuilderLayouter == null)
// {
- // m_aReportBuilderLayouter = ReportBuilderLayouter.create(getRecordParser().getReportDocuments(), getConnection());
- // m_aReportBuilderLayouter = ReportBuilderLayouter.create(m_xReportDefinition /* , getConnection() */ );
- final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter)getLayoutMap().get(m_sReportBuilderLayoutName);
+ // m_aReportBuilderLayouter = ReportBuilderLayouter.create(getRecordParser().getReportDocuments(), getConnection());
+ // m_aReportBuilderLayouter = ReportBuilderLayouter.create(m_xReportDefinition /* , getConnection() */ );
+ final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) getLayoutMap().get(m_sReportBuilderLayoutName);
return aReportBuilderLayouter;
- // }
+ // }
}
-
private Object m_aReportDocument;
private XPropertySet m_aDocumentDefinition;
private XReportDefinition m_xReportDefinition;
-
/**
* initialize the Report Builder and open it representation
* @param _aDoc
@@ -189,14 +182,14 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
args[1] = aConnection;
XReportDefinition xReportDefinition = null;
- final XMultiServiceFactory xMSF = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, /* getRecordParser().getReportDocuments() */ _aDoc );
+ final XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, /* getRecordParser().getReportDocuments() */ _aDoc);
try
{
final Object aObj = xMSF.createInstanceWithArguments("com.sun.star.sdb.DocumentDefinition", args);
- final XPropertySet aDocumentDefinition = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, aObj);
+ final XPropertySet aDocumentDefinition = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, aObj);
m_aDocumentDefinition = aDocumentDefinition;
- final XCommandProcessor xProcessor = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, aObj);
+ final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, aObj);
final com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command();
aCommand.Name = "openDesign";
final com.sun.star.ucb.OpenCommandArgument2 aOpenCommand = new com.sun.star.ucb.OpenCommandArgument2();
@@ -204,7 +197,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
aCommand.Argument = aOpenCommand;
// com.sun.star.usb.XCommandEnvironment xEnv = new com.sun.star.ucb.XCommandEnvironment();
final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null);
- xReportDefinition = (XReportDefinition)UnoRuntime.queryInterface(XReportDefinition.class, aObj2 );
+ xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj2);
}
catch (com.sun.star.uno.Exception e)
{
@@ -214,23 +207,24 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
switchOffPropertyBrowser();
switchOffAddFieldWindow();
- setPageOrientation(m_nDefaultPageOrientation, false /* NO_LAYOUT*/ );
- // try
- // {
- // Thread.sleep(1000);
- // }
- // catch (java.lang.InterruptedException e)
- // {
- // }
+ setPageOrientation(m_nDefaultPageOrientation, false /* NO_LAYOUT*/);
+ // try
+ // {
+ // Thread.sleep(1000);
+ // }
+ // catch (java.lang.InterruptedException e)
+ // {
+ // }
}
private XModeSelector getModeSelector()
{
final XController xController = getReportDefinition().getCurrentController();
- final XModeSelector xModeSelector = (XModeSelector)UnoRuntime.queryInterface(XModeSelector.class, xController);
+ final XModeSelector xModeSelector = (XModeSelector) UnoRuntime.queryInterface(XModeSelector.class, xController);
return xModeSelector;
}
+
private void switchOffAddFieldWindow()
{
try
@@ -242,6 +236,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
int dummy = 0;
}
}
+
private void switchOnAddFieldWindow()
{
try
@@ -256,25 +251,26 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
private void sleep(int _nSeconds)
{
- try
- {
- Thread.sleep(_nSeconds * 1000);
- }
- catch (java.lang.InterruptedException e)
- {
- }
+ try
+ {
+ Thread.sleep(_nSeconds * 1000);
+ }
+ catch (java.lang.InterruptedException e)
+ {
+ }
}
+
private void switchOffPropertyBrowser()
{
try
{
final XController xController = getReportDefinition().getCurrentController();
- final XDispatchProvider xDP = (XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class, xController);
+ final XDispatchProvider xDP = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, xController);
// Create special service for parsing of given URL.
final Object aURLTransformer = getMSF().createInstance("com.sun.star.util.URLTransformer");
- final XURLTransformer xURLTransformer = (XURLTransformer)UnoRuntime.queryInterface(com.sun.star.util.XURLTransformer.class, aURLTransformer );
+ final XURLTransformer xURLTransformer = (XURLTransformer) UnoRuntime.queryInterface(com.sun.star.util.XURLTransformer.class, aURLTransformer);
com.sun.star.util.URL[] aURL = new com.sun.star.util.URL[1];
aURL[0] = new com.sun.star.util.URL();
@@ -291,16 +287,16 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
}
}
-private void switchOnPropertyBrowser()
-{
- // This is implemented with a toggle algorithm.
- switchOffPropertyBrowser();
-}
+ private void switchOnPropertyBrowser()
+ {
+ // This is implemented with a toggle algorithm.
+ switchOffPropertyBrowser();
+ }
-/**
- * Returns the Frame of the underlieing Document
- * @return Returns the Frame of the parent (underlieing) Document
- */
+ /**
+ * Returns the Frame of the underlieing Document
+ * @return Returns the Frame of the parent (underlieing) Document
+ */
public XFrame getFrame()
{
if (m_xFrame == null)
@@ -308,7 +304,7 @@ private void switchOnPropertyBrowser()
initialize(getRecordParser().getReportDocuments(), getConnection());
// m_xFrame = getFrame();
m_xFrame = getReportDefinition().getCurrentController().getFrame();
- setPageOrientation(m_nDefaultPageOrientation, true /* NO_LAYOUT*/ );
+ setPageOrientation(m_nDefaultPageOrientation, true /* NO_LAYOUT*/);
}
return m_xFrame;
}
@@ -322,7 +318,6 @@ private void switchOnPropertyBrowser()
// {
// throw new UnsupportedOperationException("Not supported yet.");
// }
-
public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] Properties)
{
throw new UnsupportedOperationException("Not supported yet.");
@@ -343,7 +338,7 @@ private void switchOnPropertyBrowser()
// throw new UnsupportedOperationException("Not supported yet.");
// getReportBuilderLayouter().store(Name);
// store into the ZIP Storage
- if (OpenMode == 1 /* static Report */ )
+ if (OpenMode == 1 /* static Report */)
{
// we will store later
return;
@@ -351,18 +346,18 @@ private void switchOnPropertyBrowser()
try
{
- final XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, m_aReportDocument);
+ final XNameAccess aNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, m_aReportDocument);
final String[] aNames = aNameAccess.getElementNames();
// m_xReportDefinition.storeToStorage(m_xReportDefinition.getDocumentStorage(), m_xReportDefinition.getArgs());
- final XCommandProcessor xProcessor = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition);
+ final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition);
com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command();
aCommand.Name = "storeOwn";
final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null);
- final XNameContainer aNameContainer = (XNameContainer)UnoRuntime.queryInterface(XNameContainer.class, m_aReportDocument);
+ final XNameContainer aNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, m_aReportDocument);
// aNameContainer.insertByName(Name, m_xReportDefinition);
aNameContainer.insertByName(Name, m_aDocumentDefinition);
}
@@ -380,7 +375,7 @@ private void switchOnPropertyBrowser()
{
// removeGroupNamesofRecordTable(iSelCount);
final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle);
- GroupFieldVector.addElement(CurFieldColumn.FieldName);
+ GroupFieldVector.addElement(CurFieldColumn.m_sFieldName);
}
return true;
}
@@ -394,12 +389,11 @@ private void switchOnPropertyBrowser()
// {
// throw new UnsupportedOperationException("Not supported yet.");
// }
-
public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, Vector GroupFieldVector)
{
// throw new UnsupportedOperationException("Not supported yet.");
final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle);
- GroupFieldVector.removeElement(CurFieldColumn.FieldName);
+ GroupFieldVector.removeElement(CurFieldColumn.m_sFieldName);
}
private void setPageOrientation(int nOrientation, boolean bDoLayout)
@@ -410,6 +404,7 @@ private void switchOnPropertyBrowser()
getReportBuilderLayouter().layout();
}
}
+
public void setPageOrientation(int nOrientation)
{
// throw new UnsupportedOperationException("Not supported yet.");
@@ -435,7 +430,7 @@ private void switchOnPropertyBrowser()
public void setReportBuilderLayouterName(String _sName)
{
final IReportBuilderLayouter aCurrentLayouter = getReportBuilderLayouter();
- final IReportBuilderLayouter aNewLayouter = (IReportBuilderLayouter)m_aLayoutMap.get(_sName);
+ final IReportBuilderLayouter aNewLayouter = (IReportBuilderLayouter) m_aLayoutMap.get(_sName);
if (aNewLayouter != null)
{
m_sReportBuilderLayoutName = _sName;
@@ -443,12 +438,14 @@ private void switchOnPropertyBrowser()
aNewLayouter.layout();
}
}
+
public void liveupdate_changeContentTemplate(String ContentTemplatePath)
{
// throw new UnsupportedOperationException("Not supported yet.");
/* Left Listbox */
setReportBuilderLayouterName(ContentTemplatePath);
}
+
public void layout_setupRecordSection(String TemplateName)
{
// throw new UnsupportedOperationException("Not supported yet.");
@@ -480,12 +477,12 @@ private void switchOnPropertyBrowser()
// XDispatchProvider xDispatcher = (XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class, xController);
// xDispatcher.queryDispatch();
- final XComponent xDocumentComponent = (XComponent)UnoRuntime.queryInterface(XComponent.class, m_aDocumentDefinition);
+ final XComponent xDocumentComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, m_aDocumentDefinition);
xDocumentComponent.dispose();
m_xReportDefinition = null;
- // TODO: dispose() office will be killed.
- // m_xReportDefinition.dispose();
+ // TODO: dispose() office will be killed.
+ // m_xReportDefinition.dispose();
}
catch (Exception e)
{
@@ -514,7 +511,6 @@ private void switchOnPropertyBrowser()
// {
// throw new UnsupportedOperationException("Not supported yet.");
// }
-
public void addReportToDBView()
{
// throw new UnsupportedOperationException("Not supported yet.");
@@ -540,13 +536,17 @@ private void switchOnPropertyBrowser()
// // aProperties[1].Value = Integer.valueOf(com.sun.star.ucb.OpenMode.DOCUMENT);
aProperties[1].Value = aOpenCommand;
- final XCommandProcessor xProcessor = (XCommandProcessor)UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition);
+// aProperties[2] = new PropertyValue();
+// aProperties[2].Name = "Title"; // This name is 'Schall und Rauch'
+// aProperties[2].Value = Name;
+
+ final XCommandProcessor xProcessor = (XCommandProcessor) UnoRuntime.queryInterface(XCommandProcessor.class, m_aDocumentDefinition);
com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command();
aCommand.Name = "open";
aCommand.Argument = aProperties;
final Object aObj2 = xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null);
- xComponents[0] = (XComponent)UnoRuntime.queryInterface(XComponent.class, aObj2);
+ xComponents[0] = (XComponent) UnoRuntime.queryInterface(XComponent.class, aObj2);
}
catch (com.sun.star.uno.Exception e)
{
@@ -560,13 +560,13 @@ private void switchOnPropertyBrowser()
// XComponent[] xComponents = getReportBuilderLayouter().createFinalReportDocument(Name, getRecordParser().DBConnection ,_bAsTemplate, _bOpenInDesign);
if (_bAsTemplate == true && _bOpenInDesign == false)
{
- final XComponent[] xComponents = createFinalReportDocument(Name, getRecordParser().DBConnection ,_bAsTemplate, _bOpenInDesign);
+ final XComponent[] xComponents = createFinalReportDocument(Name, getRecordParser().DBConnection, _bAsTemplate, _bOpenInDesign);
dispose();
return xComponents;
}
else if (_bAsTemplate == false)
{
- final XComponent[] xComponents = createFinalReportDocument(Name, getRecordParser().DBConnection ,_bAsTemplate, _bOpenInDesign);
+ final XComponent[] xComponents = createFinalReportDocument(Name, getRecordParser().DBConnection, _bAsTemplate, _bOpenInDesign);
boolean bDocisStored = getRecordParser().storeDatabaseDocumentToTempPath(xComponents[0], Name);
if (bDocisStored)
{
@@ -597,7 +597,7 @@ private void switchOnPropertyBrowser()
final com.sun.star.wizards.db.RecordParser a = getRecordParser();
int[] FieldTypes = new int[FieldNames.length];
int[] FieldWidths = new int[FieldNames.length];
- for (int i=0;i<FieldNames.length;i++)
+ for (int i = 0; i < FieldNames.length; i++)
{
FieldTypes[i] = a.FieldColumns[i].FieldType;
FieldWidths[i] = a.FieldColumns[i].FieldWidth;
@@ -622,9 +622,10 @@ private void switchOnPropertyBrowser()
public void setSorting(String[][] _aSortFieldNames)
{
- getRecordParser().setSortFieldNames( _aSortFieldNames );
+ getRecordParser().setSortFieldNames(_aSortFieldNames);
// getRecordParser().createRecordFieldNames();
}
+
public void setGrouping(String[] _aGroupFieldNames)
{
getRecordParser().prependSortFieldNames(_aGroupFieldNames);
@@ -643,11 +644,12 @@ private void switchOnPropertyBrowser()
return "default";
}
private ArrayList m_aReportPath;
+
public ArrayList getReportPath()
{
if (m_aReportPath == null)
{
- // Check general availability of office paths
+ // Check general availability of office paths
try
{
m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
@@ -658,12 +660,14 @@ private void switchOnPropertyBrowser()
}
}
return m_aReportPath;
- // return "";
+ // return "";
}
+
public String getContentPath()
{
return "";
}
+
public int getDefaultPageOrientation()
{
return m_nDefaultPageOrientation;
@@ -682,11 +686,14 @@ private void switchOnPropertyBrowser()
// TODO: Use Package.getPackages(...)
final Class a = Class.forName(_sClassName);
- final Constructor cTor = a.getConstructor(new Class[]{IReportDefinitionReadAccess.class, Resource.class});
+ final Constructor cTor = a.getConstructor(new Class[]
+ {
+ IReportDefinitionReadAccess.class, Resource.class
+ });
Object[] aParams = new Object[2];
aParams[0] = this;
aParams[1] = m_aResource;
- final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter)cTor.newInstance(aParams);
+ final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) cTor.newInstance(aParams);
return aReportBuilderLayouter;
}
catch (Exception e)
@@ -723,7 +730,6 @@ private void switchOnPropertyBrowser()
// }
return null;
}
-
private LinkedHashMap m_aLayoutMap = null;
private void insertIntoLayoutMap(IReportBuilderLayouter _aLayout)
@@ -743,6 +749,7 @@ private void switchOnPropertyBrowser()
m_aLayoutMap.put(sName, _aLayout);
}
}
+
/**
* Initialize all well known com.sun.star.wizards.report.layout.ReportBuilderLayouter Objects and create exact one instance.
*/
@@ -771,17 +778,17 @@ private void switchOnPropertyBrowser()
return m_aLayoutMap;
}
-/**
- * Return a string array array with all found layouts
- * At the moment these layout are hard coded
- * @return
- */
+ /**
+ * Return a string array array with all found layouts
+ * At the moment these layout are hard coded
+ * @return
+ */
public String[][] getDataLayout()
{
String[][] ContentFiles;
ContentFiles = new String[2][];
- String[] a = new String[ getLayoutMap().size() ];
- String[] b = new String[ getLayoutMap().size() ];
+ String[] a = new String[getLayoutMap().size()];
+ String[] b = new String[getLayoutMap().size()];
// run through the whole layoutmap and
final Set aKeys = getLayoutMap().keySet();
@@ -789,9 +796,9 @@ private void switchOnPropertyBrowser()
int i = 0;
while (aKeyIterator.hasNext())
{
- final String sKey = (String)aKeyIterator.next();
+ final String sKey = (String) aKeyIterator.next();
a[i] = sKey;
- final IReportBuilderLayouter aLayouter = (IReportBuilderLayouter)m_aLayoutMap.get(sKey);
+ final IReportBuilderLayouter aLayouter = (IReportBuilderLayouter) m_aLayoutMap.get(sKey);
b[i++] = aLayouter.getLocalizedName();
}
@@ -799,16 +806,15 @@ private void switchOnPropertyBrowser()
ContentFiles[0] = b;
return ContentFiles;
}
-
-
private String m_sDefaultHeaderLayoutPath;
+
public String[][] getHeaderLayout()
{
String[][] LayoutFiles;
try
{
// TODO: check different languages in header layouts
- ArrayList aReportPath = FileAccess.getOfficePaths(getMSF(), "Template","share", "/wizard");
+ ArrayList aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
FileAccess.combinePaths(getMSF(), aReportPath, "/wizard/report");
LayoutFiles = FileAccess.getFolderTitles(getMSF(), null, aReportPath, ".otr");
@@ -824,7 +830,7 @@ private void switchOnPropertyBrowser()
LayoutFiles[1] = a;
LayoutFiles[0] = b;
}
- for (int i=0;i<LayoutFiles[0].length;i++)
+ for (int i = 0; i < LayoutFiles[0].length; i++)
{
if (LayoutFiles[0][i].equals("default"))
{
@@ -863,13 +869,13 @@ private void switchOnPropertyBrowser()
{
getRecordParser().Command = _sCommand;
getReportDefinition().setCommand(_sCommand);
- // throw new UnsupportedOperationException("Not supported yet.");
+ // throw new UnsupportedOperationException("Not supported yet.");
}
+
public void setCommandType(int _nCommand)
{
getReportDefinition().setCommandType(_nCommand);
}
-
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
index 490b47418ccf..1488a9ca32a5 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
@@ -9,7 +9,7 @@
*
* $RCSfile: ColumnarSingleColumn.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
@@ -42,8 +41,9 @@ import com.sun.star.wizards.ui.UIConsts;
*
* @author ll93751
*/
-public class ColumnarSingleColumn extends ReportBuilderLayouter
+public class ColumnarSingleColumn extends ReportBuilderLayouter
{
+
public ColumnarSingleColumn(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
{
super(_xDefinitionAccess, _aResource);
@@ -87,7 +87,7 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter
final int nWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups()) - nLabelWidth;
- for (int i=0;i<aFieldNames.length;i++)
+ for (int i = 0; i < aFieldNames.length; i++)
{
aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
final String sLabel = aFieldTitleNames[i];
@@ -100,9 +100,9 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter
xSection.setHeight(aRect.Y);
doNotBreakInTable(xSection);
}
+
protected void insertDetailFieldTitles()
{
// we won't extra field titles
}
-
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
index ed5b90c6e2dc..b185c6c990fa 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
@@ -9,7 +9,7 @@
*
* $RCSfile: ColumnarThreeColumns.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,7 +30,6 @@
*
* **********************************************************************
*/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.wizards.common.Resource;
@@ -43,6 +42,7 @@ import com.sun.star.wizards.ui.*;
*/
public class ColumnarThreeColumns extends ColumnarTwoColumns
{
+
public ColumnarThreeColumns(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
{
super(_xDefinitionAccess, _aResource);
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
index f2cd5409efb3..98147e93c095 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
@@ -9,7 +9,7 @@
*
* $RCSfile: ColumnarTwoColumns.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
@@ -44,6 +43,7 @@ import com.sun.star.wizards.ui.UIConsts;
*/
public class ColumnarTwoColumns extends ReportBuilderLayouter
{
+
public ColumnarTwoColumns(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
{
super(_xDefinitionAccess, _aResource);
@@ -92,7 +92,7 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter
final int nLabelWidth = getMaxLabelWidth(); // 3000;
final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups());
- int i=0;
+ int i = 0;
int nRows = aFieldNames.length / _nColumns;
if ((aFieldNames.length % _nColumns) != 0)
{
@@ -108,10 +108,10 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter
final SectionObject aSOLabel = getDesignTemplate().getDetailLabel();
aSOLabel.setFontToBold();
final SectionObject aSOTextField = getDesignTemplate().getDetailTextField();
- for (int x=0;x<_nColumns;x++)
+ for (int x = 0; x < _nColumns; x++)
{
aRect.Y = 0;
- for (int y=0;y<nRows;y++)
+ for (int y = 0; y < nRows; y++)
{
aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()) + x * (nWidth + nLabelWidth);
if (i < aFieldNames.length)
@@ -130,9 +130,9 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter
xSection.setHeight(aRect.Y);
doNotBreakInTable(xSection);
}
+
protected void insertDetailFieldTitles()
{
// we won't extra field titles
}
-
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
index a52be8dc55ff..0b6fe8d4d13b 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
@@ -9,7 +9,7 @@
*
* $RCSfile: DesignTemplate.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,7 +30,6 @@
*
* **********************************************************************
*/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.beans.PropertyValue;
@@ -53,13 +52,14 @@ import com.sun.star.wizards.common.Properties;
*/
public class DesignTemplate
{
+
private XReportDefinition m_xReportDefinition;
XMultiServiceFactory m_xGlobalMSF;
String m_sFilename;
private DesignTemplate()
- {}
-
+ {
+ }
// -------------------------------------------------------------------------
// All functions from XReportDefinition, we use
// -------------------------------------------------------------------------
@@ -67,44 +67,51 @@ public class DesignTemplate
{
return m_xReportDefinition.getGroups();
}
+
XSection getDetail()
{
return m_xReportDefinition.getDetail();
}
+
boolean getReportHeaderOn()
{
return m_xReportDefinition.getReportHeaderOn();
}
+
XSection getReportHeader() throws com.sun.star.container.NoSuchElementException
{
return m_xReportDefinition.getReportHeader();
}
+
boolean getReportFooterOn()
{
return m_xReportDefinition.getReportFooterOn();
}
+
XSection getReportFooter() throws com.sun.star.container.NoSuchElementException
{
return m_xReportDefinition.getReportFooter();
}
+
boolean getPageHeaderOn()
{
return m_xReportDefinition.getPageHeaderOn();
}
+
XSection getPageHeader() throws com.sun.star.container.NoSuchElementException
{
return m_xReportDefinition.getPageHeader();
}
+
boolean getPageFooterOn()
{
return m_xReportDefinition.getPageFooterOn();
}
+
XSection getPageFooter() throws com.sun.star.container.NoSuchElementException
{
return m_xReportDefinition.getPageFooter();
- }
-
- // -------------------------------------------------------------------------
+ } // -------------------------------------------------------------------------
private SectionObject m_aDetailLabel;
private SectionObject m_aDetailTextField;
private SectionObject[] m_aGroupLabel;
@@ -118,6 +125,7 @@ public class DesignTemplate
}
return m_aDetailLabel;
}
+
SectionObject getDetailTextField()
{
if (m_aDetailTextField == null)
@@ -167,7 +175,7 @@ public class DesignTemplate
{
final XSection xDetailSection = m_xReportDefinition.getDetail();
final int nDetailCount = xDetailSection.getCount();
- for (int i=0;i<nDetailCount;i++)
+ for (int i = 0; i < nDetailCount; i++)
{
try
{
@@ -176,17 +184,17 @@ public class DesignTemplate
// is aObj a textfield
// m_aDetailLabel_FD
// m_aDetailTextField_FD
- XFixedText aFixedText = (XFixedText)UnoRuntime.queryInterface(XFixedText.class, aObj);
+ XFixedText aFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aObj);
if (aFixedText != null &&
- m_aDetailLabel == null )
+ m_aDetailLabel == null)
{
m_aDetailLabel = SectionLabel.create(aFixedText);
}
else
{
- XFormattedField aFormattedField = (XFormattedField)UnoRuntime.queryInterface(XFormattedField.class, aObj);
+ XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj);
if (aFormattedField != null &&
- m_aDetailTextField == null )
+ m_aDetailTextField == null)
{
m_aDetailTextField = SectionTextField.create(aFormattedField);
}
@@ -208,33 +216,33 @@ public class DesignTemplate
m_aGroupLabel = new SectionObject[nGroupCount];
m_aGroupTextField = new SectionObject[nGroupCount];
- for (int nGroup=0; nGroup<nGroupCount; nGroup++)
+ for (int nGroup = 0; nGroup < nGroupCount; nGroup++)
{
try
{
Object aGroup = xGroups.getByIndex(nGroup);
- XGroup xGroup = (XGroup)UnoRuntime.queryInterface(XGroup.class, aGroup);
+ XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup);
XSection xGroupSection = xGroup.getHeader();
final int nCount = xGroupSection.getCount();
- for (int i=0;i<nCount;i++)
+ for (int i = 0; i < nCount; i++)
{
try
{
Object aObj = xGroupSection.getByIndex(i);
- XFixedText aFixedText = (XFixedText)UnoRuntime.queryInterface(XFixedText.class, aObj);
+ XFixedText aFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aObj);
// is aObj a label
// is aObj a textfield
if (aFixedText != null &&
- m_aGroupLabel[nGroup] == null )
+ m_aGroupLabel[nGroup] == null)
{
m_aGroupLabel[nGroup] = SectionLabel.create(aFixedText);
}
else
{
- XFormattedField aFormattedField = (XFormattedField)UnoRuntime.queryInterface(XFormattedField.class, aObj);
+ XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj);
if (aFormattedField != null &&
- m_aGroupTextField[nGroup] == null )
+ m_aGroupTextField[nGroup] == null)
{
m_aGroupTextField[nGroup] = SectionTextField.create(aFormattedField);
}
@@ -274,6 +282,7 @@ public class DesignTemplate
{
}
}
+
/**
* create a new DesignTemplate by try to load a otr file from the given path.
* Internally we store the loaded ReportDefinition.
@@ -311,7 +320,7 @@ public class DesignTemplate
m_xGlobalMSF = _xMSF;
m_sFilename = _sPath;
final Object aObj = _xMSF.createInstance("com.sun.star.report.ReportDefinition");
- m_xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj );
+ m_xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj);
PropertyValue[] aLoadProps = new PropertyValue[2];
aLoadProps[0] = Properties.createProperty("URL", _sPath);
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
index 96aca45400c7..df5228e18e4d 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
@@ -9,7 +9,7 @@
*
* $RCSfile: InBlocksLabelsAbove.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,7 +30,6 @@
*
* **********************************************************************
*/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
@@ -45,6 +44,7 @@ import com.sun.star.wizards.ui.*;
*/
public class InBlocksLabelsAbove extends ColumnarTwoColumns
{
+
public InBlocksLabelsAbove(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
{
super(_xDefinitionAccess, _aResource);
@@ -85,7 +85,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns
final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups());
- int i=0;
+ int i = 0;
int nCount = aFieldTitleNames.length;
// int x = 0;
aRectLabels.Y = 0;
@@ -106,7 +106,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns
// aRectLabels.X += nFieldWidth;
final int nNextX = aRectFields.X + nFieldWidth;
- if (nNextX > (getPageWidth() - getRightPageIndent()) )
+ if (nNextX > (getPageWidth() - getRightPageIndent()))
{
// all other values are not from interest.
break;
@@ -159,6 +159,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns
xSection.setHeight(aRectFields.Y);
doNotBreakInTable(xSection);
}
+
protected void insertDetailFieldTitles()
{
// we won't extra field titles
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
index 94ceb4032ed5..f6f93e11e574 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
@@ -9,7 +9,7 @@
*
* $RCSfile: InBlocksLabelsLeft.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,7 +30,6 @@
*
* **********************************************************************
*/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
@@ -45,6 +44,7 @@ import com.sun.star.wizards.ui.*;
*/
public class InBlocksLabelsLeft extends ColumnarTwoColumns
{
+
public InBlocksLabelsLeft(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
{
super(_xDefinitionAccess, _aResource);
@@ -95,7 +95,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns
nDelta = nDeltaTotal / nFactor;
}
- int i=0;
+ int i = 0;
int nCount = aFieldTitleNames.length;
// int x = 0;
aRectLabelFields.Y = 0;
@@ -114,7 +114,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns
aRectLabelFields = insertFormattedField(xSection, sFieldName, aRectLabelFields, nFieldWidth, aSOTextField);
final int nNextX = aRectLabelFields.X + nLabelWidth + nFieldWidth;
- if (nNextX > (getPageWidth() - getRightPageIndent()) )
+ if (nNextX > (getPageWidth() - getRightPageIndent()))
{
// TODO: label height is fix
aRectLabelFields.Y += aSOTextField.getHeight(500);
@@ -127,6 +127,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns
xSection.setHeight(aRectLabelFields.Y);
doNotBreakInTable(xSection);
}
+
protected void insertDetailFieldTitles()
{
// we won't extra field titles
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
index c35e7e8d4f5d..7b0c69c51115 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
@@ -9,7 +9,7 @@
*
* $RCSfile: ReportBuilderLayouter.java,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.3.6.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.FontDescriptor;
@@ -74,19 +73,16 @@ import com.sun.star.wizards.ui.UIConsts;
import java.util.HashMap;
import java.util.Locale;
-
/**
* This class is abstract and more like a helper for create different layouts for Report Builder Wizard.
* @author ll93751
- */
-
-// TODO: let a little bit place between 2 formatted fields
+ */// TODO: let a little bit place between 2 formatted fields
// TODO: move all sectionobjects which have a connect to the right max page width to left if there is a orientation change.
-
abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
+
private IReportDefinitionReadAccess m_xReportDefinitionReadAccess;
- private Resource m_aResource;
+ private Resource m_aResource;
/**
* dispose the ReportBuilderLayouter
@@ -95,7 +91,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
closeDesignTemplate();
m_xReportDefinitionReadAccess = null;
- // m_xReportBuilderLayouter = null;
+ // m_xReportBuilderLayouter = null;
}
/**
@@ -118,6 +114,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// we have to ask our parent for this value
return m_xReportDefinitionReadAccess.getReportDefinition();
}
+
/**
* Access to the global MultiServiceFactory
* @return the global Service Factory
@@ -127,7 +124,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return m_xReportDefinitionReadAccess.getGlobalMSF();
}
-
/**
* Layout the complete report new, by all information we know until this time.
*
@@ -173,7 +169,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
int dummy = 0;
}
}
-
// -------------------------------------------------------------------------
/**
* Remove all Groups
@@ -190,15 +185,15 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.uno.Exception e)
{
- // Exception not set. Not from interest here.
+ // Exception not set. Not from interest here.
}
}
}
// -------------------------------------------------------------------------
- /**
- * Remove all fields
- * @param _xSectionToClear
- */
+ /**
+ * Remove all fields
+ * @param _xSectionToClear
+ */
private void emptySection(XSection _xSectionToClear)
{
if (_xSectionToClear == null)
@@ -211,7 +206,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aObj = _xSectionToClear.getByIndex(0);
- final XShape aShape = (XShape)UnoRuntime.queryInterface(XShape.class, aObj);
+ final XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aObj);
_xSectionToClear.remove(aShape);
}
catch (com.sun.star.uno.Exception e)
@@ -222,17 +217,15 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
+
private void clearDetails()
{
final XSection xSection = getReportDefinition().getDetail();
emptySection(xSection);
}
-
// public void clearFieldTitles()
// {
// }
-
-
/**
*
* @param _nGroupCount
@@ -253,7 +246,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
return nIndent;
}
-
/**
* Get left page indent.
* The left indent is the area on the left side which will no be printed.
@@ -261,6 +253,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
* @return the left indent in 1/100mm
*/
int m_nLeftIndent = -1;
+
protected int getLeftPageIndent()
{
if (m_nLeftIndent < 0)
@@ -269,7 +262,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
return m_nLeftIndent;
}
-
/**
* Get right page indent.
* The right indent is the area on the right side which will no be printed.
@@ -277,6 +269,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
* @return the right indent in 1/100mm
*/
int m_nRightIndent = -1;
+
protected int getRightPageIndent()
{
if (m_nRightIndent < 0)
@@ -298,7 +291,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// get all Page Styles
final Object aPageStylesObj = xNameAccess.getByName(_sStyleName);
- final XNameAccess xContainer = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aPageStylesObj);
+ final XNameAccess xContainer = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, aPageStylesObj);
// step over all Page Styles, search the one which is in use
final String[] aElementNames = xContainer.getElementNames();
@@ -306,7 +299,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
final String sName = aElementNames[i];
final Object aObj = xContainer.getByName(sName);
- final XStyle xStyle = (XStyle)UnoRuntime.queryInterface(XStyle.class, aObj);
+ final XStyle xStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, aObj);
if (xStyle.isInUse())
{
aUsedStyle = xStyle;
@@ -344,12 +337,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
aHelper.setPropertyValueDontThrow(_sStyleName, _aObj);
}
}
-
/**
* Get page width. The default is 21000 1/100mm what is 21cm of DIN A4.
* @return the Width of the page in 1/100mm
*/
int m_nPageWidth = -1;
+
protected int getPageWidth()
{
if (m_nPageWidth < 0)
@@ -367,23 +360,24 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
m_aGroupNames = _aGroupNames;
}
+
protected void copyGroupProperties(int _nGroup)
{
- if (getDesignTemplate() != null )
+ if (getDesignTemplate() != null)
{
try
{
final XGroups xForeignGroups = getDesignTemplate().getGroups();
int nGroups = xForeignGroups.getCount();
Object aForeignGroup = xForeignGroups.getByIndex(_nGroup);
- XGroup xForeignGroup = (XGroup)UnoRuntime.queryInterface(XGroup.class, aForeignGroup);
+ XGroup xForeignGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aForeignGroup);
XSection xForeignGroupSection = xForeignGroup.getHeader();
if (xForeignGroupSection != null)
{
final XGroups xGroups = getReportDefinition().getGroups();
Object aGroup = xGroups.getByIndex(_nGroup);
- XGroup xGroup = (XGroup)UnoRuntime.queryInterface(XGroup.class, aGroup);
+ XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup);
XSection xGroupSection = xGroup.getHeader();
// copy Properties
@@ -413,64 +407,64 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// after done with all groups, we need access to the last group, for set property 'KeepTogether' so we remember it.
XGroup aLastGroup = null;
- for (int i=0;i<m_aGroupNames.length;i++)
+ for (int i = 0; i < m_aGroupNames.length; i++)
{
- final XGroup xGroup = xGroups.createGroup();
- aLastGroup = xGroup;
+ final XGroup xGroup = xGroups.createGroup();
+ aLastGroup = xGroup;
- // TODO: debug what the m_aGroupNames are, "field:[...]" or the "fieldname"
- xGroup.setExpression(m_aGroupNames[i]);
- xGroup.setHeaderOn(true);
- // we don't want any group footer (default off)
- // xGroup.setFooterOn(true);
+ // TODO: debug what the m_aGroupNames are, "field:[...]" or the "fieldname"
+ xGroup.setExpression(m_aGroupNames[i]);
+ xGroup.setHeaderOn(true);
+ // we don't want any group footer (default off)
+ // xGroup.setFooterOn(true);
- try
- {
- // we need to append by hand
- // TODO: documentation is unclear here, that we have to insert by hand
- int nCount = xGroups.getCount();
- xGroups.insertByIndex(nCount, xGroup);
+ try
+ {
+ // we need to append by hand
+ // TODO: documentation is unclear here, that we have to insert by hand
+ int nCount = xGroups.getCount();
+ xGroups.insertByIndex(nCount, xGroup);
- final XSection xGroupSection = xGroup.getHeader();
- copyGroupProperties(nCount);
+ final XSection xGroupSection = xGroup.getHeader();
+ copyGroupProperties(nCount);
- Rectangle aRect = new Rectangle();
- aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
- SectionObject aSO = getDesignTemplate().getGroupLabel(i);
- int nLabelHeight = 0;
+ Rectangle aRect = new Rectangle();
+ aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
+ SectionObject aSO = getDesignTemplate().getGroupLabel(i);
+ int nLabelHeight = 0;
// if (aSO != null)
// {
- nLabelHeight = aSO.getHeight(500);
- aRect = insertLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth, aSO);
+ nLabelHeight = aSO.getHeight(500);
+ aRect = insertLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth, aSO);
// }
// else
// {
// nLabelHeight = 500;
// aRect = insertBoldLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth);
// }
- final String sGroupName = convertToFieldName(m_aGroupNames[i]);
- aSO = getDesignTemplate().getGroupTextField(i);
- insertFormattedField(xGroupSection, sGroupName, aRect, nFieldWidth, aSO);
-
- // draw a line under the label/formattedfield
- aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
- aRect.Y = nLabelHeight;
- final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X;
- final int nLineHeight = 250;
- insertHorizontalLine(xGroupSection, aRect, nLineWidth, nLineHeight);
- xGroupSection.setHeight(nLabelHeight + nLineHeight);
- }
- catch (com.sun.star.uno.Exception e)
- {
- // TODO: Exception not set.
- }
- }
-
- // hold the inner group together
- if (aLastGroup != null)
- {
+ final String sGroupName = convertToFieldName(m_aGroupNames[i]);
+ aSO = getDesignTemplate().getGroupTextField(i);
+ insertFormattedField(xGroupSection, sGroupName, aRect, nFieldWidth, aSO);
+
+ // draw a line under the label/formattedfield
+ aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
+ aRect.Y = nLabelHeight;
+ final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X;
+ final int nLineHeight = 250;
+ insertHorizontalLine(xGroupSection, aRect, nLineWidth, nLineHeight);
+ xGroupSection.setHeight(nLabelHeight + nLineHeight);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // TODO: Exception not set.
+ }
+ }
+
+ // hold the inner group together
+ if (aLastGroup != null)
+ {
doNotBreakInTable(aLastGroup);
- }
+ }
}
// -------------------------------------------------------------------------
@@ -486,7 +480,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// -------------------------------------------------------------------------
protected String getTitleFromFieldName(String _sField)
{
- for (int i=0;i<m_aFieldNames.length;i++)
+ for (int i = 0; i < m_aFieldNames.length; i++)
{
if (m_aFieldNames[i].equals(_sField))
{
@@ -495,9 +489,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
return "";
}
+
protected boolean listContains(String[] _aList, String _aValue)
{
- for (int i=0;i<_aList.length;i++)
+ for (int i = 0; i < _aList.length; i++)
{
if (_aList[i].equals(_aValue))
{
@@ -517,7 +512,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
if (_aList == null /* || _aGetResultsFrom == null */)
{
- return new String[]{}; /* empty list */
+ return new String[]
+ {
+ }; /* empty list */
}
if (getCountOfGroups() == 0)
{
@@ -529,8 +526,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
final int nNewLength = _aList.length - getCountOfGroups();
String[] aNewList = new String[nNewLength];
- int j=0;
- for (int i=0;i<_aList.length;i++)
+ int j = 0;
+ for (int i = 0; i < _aList.length; i++)
{
final String sField = _aList[i];
if (listContains(m_aGroupNames, sField) == true)
@@ -563,6 +560,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
return nWidth;
}
+
protected String[] getFieldTitleNames()
{
return getNamesWithoutGroupNames(m_aFieldNames, m_aFieldTitleNames);
@@ -583,12 +581,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
m_aFieldTypes = _aFieldTypes;
}
+
public void insertFieldWidths(int[] _aFieldWidths)
{
m_aFieldWidths = _aFieldWidths;
}
-
protected int getCountOfGroups()
{
return ((m_aGroupNames == null) ? 0 : m_aGroupNames.length);
@@ -599,11 +597,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
return getNamesWithoutGroupNames(m_aFieldNames, null);
}
+
abstract protected void insertDetailFields();
protected void copyDetailProperties()
{
- if (getDesignTemplate() != null )
+ if (getDesignTemplate() != null)
{
try
{
@@ -622,7 +621,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
// -------------------------------------------------------------------------
-
protected Rectangle insertLabel(XSection _xSection, String _sLabel, Rectangle _aRect, int _nWidth, SectionObject _aSO)
{
if (_xSection != null)
@@ -630,7 +628,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText");
- final XFixedText xFixedText = (XFixedText)UnoRuntime.queryInterface(XFixedText.class, aFixedText);
+ final XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
int nHeight = 500; // default height of label is fixed.
@@ -699,8 +697,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
*/
protected Rectangle insertFormattedField(XSection _xSection, String _sFormattedfield, Rectangle _aRect, int _nWidth, SectionObject _aSO)
{
- return insertFormattedField(_xSection, _sFormattedfield, _aRect, _nWidth, _aSO, (short)com.sun.star.awt.TextAlign.LEFT);
+ return insertFormattedField(_xSection, _sFormattedfield, _aRect, _nWidth, _aSO, (short) com.sun.star.awt.TextAlign.LEFT);
}
+
protected Rectangle insertFormattedField(XSection _xSection, String _sFormattedfield, Rectangle _aRect, int _nWidth, SectionObject _aSO, short _nAlignment)
{
if (_xSection != null)
@@ -708,7 +707,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aFormattedField = getMSFofReportDefinition().createInstance("com.sun.star.report.FormattedField");
- final XFormattedField xFormattedField = (XFormattedField)UnoRuntime.queryInterface(XFormattedField.class, aFormattedField);
+ final XFormattedField xFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aFormattedField);
// #i86907# not documented right in idl description.
xFormattedField.setDataField(_sFormattedfield);
int nHeight = 500;
@@ -736,7 +735,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
XNumberFormatsSupplier x = xFormattedField.getFormatsSupplier();
XNumberFormats xFormats = x.getNumberFormats();
- XNumberFormatTypes x3 = (XNumberFormatTypes)UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats);
+ XNumberFormatTypes x3 = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats);
Locale.getDefault();
com.sun.star.lang.Locale aLocale = new com.sun.star.lang.Locale();
aLocale.Country = Locale.getDefault().getCountry();
@@ -746,12 +745,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
xFormattedField.setFormatKey(nFormat);
}
_xSection.add(xFormattedField);
- }
- catch (com.sun.star.uno.Exception e)
- {
- // TODO: Exception not set.
- int dummy = 0;
- }
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // TODO: Exception not set.
+ int dummy = 0;
+ }
}
return _aRect;
}
@@ -766,15 +765,14 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// getReportDefinition().setCommandType(com.sun.star.sdb.CommandType.TABLE);
getReportDefinition().setCommandType(_aType);
getReportDefinition().setCommand(_sTableName);
- }
-
- // -------------------------------------------------------------------------
+ } // -------------------------------------------------------------------------
protected XMultiServiceFactory m_xMSF;
+
protected XMultiServiceFactory getMSFofReportDefinition()
{
if (m_xMSF == null)
{
- final XMultiServiceFactory xMSF = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, getReportDefinition() );
+ final XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, getReportDefinition());
m_xMSF = xMSF;
}
return m_xMSF;
@@ -784,10 +782,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
return insertLine(_xSection, _aRect, _nWidth, _nHeight, 1);
}
+
protected Rectangle insertHorizontalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight)
{
return insertLine(_xSection, _aRect, _nWidth, _nHeight, 0);
}
+
protected Rectangle insertLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight, int _nOrientation)
{
if (_xSection != null)
@@ -795,7 +795,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aFixedLine = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedLine");
- final XFixedLine xFixedLine = (XFixedLine)UnoRuntime.queryInterface(XFixedLine.class, aFixedLine);
+ final XFixedLine xFixedLine = (XFixedLine) UnoRuntime.queryInterface(XFixedLine.class, aFixedLine);
xFixedLine.setOrientation(_nOrientation);
// TODO: line width is fixed
@@ -811,13 +811,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.uno.Exception e)
{
- // TODO: Exception not set.
+ // TODO: Exception not set.
int dummy = 0;
}
}
return _aRect;
}
-
// -------------------------------------------------------------------------
protected void clearReportHeader()
{
@@ -867,6 +866,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
}
+
protected void clearReportFooter()
{
XSection xSection;
@@ -883,6 +883,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// Exception not set. Not really from interest.
}
}
+
protected void insertReportFooter()
{
if (getDesignTemplate() != null)
@@ -914,7 +915,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
}
-
// -------------------------------------------------------------------------
protected void clearPageHeader()
{
@@ -974,7 +974,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
////
//
// }
-
protected void clearPageFooter()
{
XSection xSection;
@@ -989,7 +988,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
catch (com.sun.star.container.NoSuchElementException e)
{
// Exception not set. Should not from interest here.
-
}
}
@@ -1020,24 +1018,24 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
m_nPageWidth = -1;
}
-/**
- * Returns the width and height of a given string (_sText) in 1/100mm drawn in the given font descriptor.
- * TODO: This function is a performance leak, we could store already calculated values in a map, to build a cache. Access should be much faster then.
- *
- * @param _sText
- * @param _aFont
- * @return width of given text in 1/100mm
- */
+ /**
+ * Returns the width and height of a given string (_sText) in 1/100mm drawn in the given font descriptor.
+ * TODO: This function is a performance leak, we could store already calculated values in a map, to build a cache. Access should be much faster then.
+ *
+ * @param _sText
+ * @param _aFont
+ * @return width of given text in 1/100mm
+ */
Size getPreferredSize(String _sText, FontDescriptor _aFont)
{
- Size aSizeMM_100TH = new Size(0,0);
+ Size aSizeMM_100TH = new Size(0, 0);
try
{
// Object aControlContainer = getGlobalMSF().createInstance("com.sun.star.awt.UnoControlContainer");
// XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface(XControlContainer.class, aControlContainer);
final Object aFixedTextModel = getGlobalMSF().createInstance("com.sun.star.awt.UnoControlFixedTextModel");
- final XControlModel xFixedTextModel = (XControlModel)UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel);
+ final XControlModel xFixedTextModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel);
final PropertySetHelper aPropertySetHelper = new PropertySetHelper(xFixedTextModel);
// aPropertySetHelper.showProperties();
@@ -1047,40 +1045,39 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// XServiceInfo xServiceInfo2 = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, aUnoCtrlFixedText);
// String[] sServices2 = xServiceInfo2.getSupportedServiceNames();
- final XWindow xWindow = (XWindow)UnoRuntime.queryInterface(XWindow.class, aUnoCtrlFixedText);
+ final XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, aUnoCtrlFixedText);
xWindow.setVisible(false);
- final XControl xControl = (XControl)UnoRuntime.queryInterface(XControl.class, aUnoCtrlFixedText);
+ final XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, aUnoCtrlFixedText);
xControl.setModel(xFixedTextModel);
- final com.sun.star.awt.XFixedText xFixedText = (com.sun.star.awt.XFixedText)UnoRuntime.queryInterface(com.sun.star.awt.XFixedText.class, aUnoCtrlFixedText);
+ final com.sun.star.awt.XFixedText xFixedText = (com.sun.star.awt.XFixedText) UnoRuntime.queryInterface(com.sun.star.awt.XFixedText.class, aUnoCtrlFixedText);
xFixedText.setText(_sText);
- final XLayoutConstrains xLayoutConstraints = (XLayoutConstrains)UnoRuntime.queryInterface(XLayoutConstrains.class, aUnoCtrlFixedText);
+ final XLayoutConstrains xLayoutConstraints = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, aUnoCtrlFixedText);
final Size aSizeInPixel = xLayoutConstraints.getPreferredSize();
- final XWindowPeer xPeerOfReportDefinition = (XWindowPeer)UnoRuntime.queryInterface(XWindowPeer.class, getReportDefinition().getCurrentController().getFrame().getComponentWindow());
+ final XWindowPeer xPeerOfReportDefinition = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, getReportDefinition().getCurrentController().getFrame().getComponentWindow());
xControl.createPeer(null, xPeerOfReportDefinition);
final XWindowPeer x = xControl.getPeer();
- final XUnitConversion xConversion = (XUnitConversion)UnoRuntime.queryInterface(XUnitConversion.class, x);
+ final XUnitConversion xConversion = (XUnitConversion) UnoRuntime.queryInterface(XUnitConversion.class, x);
aSizeMM_100TH = xConversion.convertSizeToLogic(aSizeInPixel, com.sun.star.util.MeasureUnit.MM_100TH);
// xToolkit.createScreenCompatibleDevice(_nWidth, _nWidth).
// XWindow x = getReportDefinition().getCurrentController().getFrame().getContainerWindow();
// Object aObj = _xSection.getParent();
// we don't need the created objects any longer
- final XComponent xFixedTextDeleter = (XComponent)UnoRuntime.queryInterface(XComponent.class, xFixedText);
+ final XComponent xFixedTextDeleter = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFixedText);
xFixedTextDeleter.dispose();
- final XComponent xFixedTextModelDeleter = (XComponent)UnoRuntime.queryInterface(XComponent.class, aFixedTextModel);
+ final XComponent xFixedTextModelDeleter = (XComponent) UnoRuntime.queryInterface(XComponent.class, aFixedTextModel);
xFixedTextModelDeleter.dispose();
}
- catch(Exception e)
+ catch (Exception e)
{
// TODO: Exception not set.
-
}
return aSizeMM_100TH;
}
@@ -1111,21 +1108,21 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return sFirstName + " " + sLastName;
}
-/**
- * Helper function, to copy all not read only properties of _xFromSection to _xToSection
- * @param _xFromSection
- * @param _xToSection
- */
+ /**
+ * Helper function, to copy all not read only properties of _xFromSection to _xToSection
+ * @param _xFromSection
+ * @param _xToSection
+ */
private void copyProperties(Object _aFrom, Object _aTo)
{
- XPropertySet xFrom = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, _aFrom);
- XPropertySet xTo = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, _aTo);
+ XPropertySet xFrom = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aFrom);
+ XPropertySet xTo = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aTo);
XPropertySetInfo xForeignPropInfo = xFrom.getPropertySetInfo();
XPropertySetInfo xSectionPropInfo = xTo.getPropertySetInfo();
Property[] aAllProperties = xForeignPropInfo.getProperties();
- for(int i=0;i<aAllProperties.length;i++)
+ for (int i = 0; i < aAllProperties.length; i++)
{
String sPropertyName = aAllProperties[i].Name;
if (xSectionPropInfo.hasPropertyByName(sPropertyName))
@@ -1145,11 +1142,11 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
-/**
- * Helper Funktion to copy the whole content of _xFromSection to the _xToSection
- * @param _xFromSection
- * @param _xToSection
- */
+ /**
+ * Helper Funktion to copy the whole content of _xFromSection to the _xToSection
+ * @param _xFromSection
+ * @param _xToSection
+ */
private void copySection(XSection _xFromSection, XSection _xToSection)
{
copyProperties(_xFromSection, _xToSection);
@@ -1160,7 +1157,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
while (xEnum.hasMoreElements())
{
Object aEnumObj = xEnum.nextElement();
- XReportComponent aComponent = (XReportComponent)UnoRuntime.queryInterface(XReportComponent.class, aEnumObj);
+ XReportComponent aComponent = (XReportComponent) UnoRuntime.queryInterface(XReportComponent.class, aEnumObj);
// XCloneable aClone = (XCloneable)UnoRuntime.queryInterface(XCloneable.class, aEnumObj);
if (aComponent != null)
@@ -1172,7 +1169,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
com.sun.star.awt.Point aPosition = aComponent.getPosition();
Size aSize = aComponent.getSize();
- XShape aShape = (XShape)UnoRuntime.queryInterface(XShape.class, aClone);
+ XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aClone);
String sShapeType = aShape.getShapeType();
com.sun.star.awt.Point aShapePoint = aShape.getPosition();
Size aShapeSize = aShape.getSize();
@@ -1191,8 +1188,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
catch (Exception e)
{
}
- // String sName = xForeignSection.getName();
- // int dummy = 0;
+ // String sName = xForeignSection.getName();
+ // int dummy = 0;
}
protected void insertPageHeader()
@@ -1378,7 +1375,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
final int nWidth = nUsablePageWidth;
aRect.X = getLeftPageIndent();
- aRect = insertFormattedField(xSection, "rpt:" + sNoFirstUnusedQuotes, aRect, nWidth, null, (short)com.sun.star.awt.TextAlign.CENTER);
+ aRect = insertFormattedField(xSection, "rpt:" + sNoFirstUnusedQuotes, aRect, nWidth, null, (short) com.sun.star.awt.TextAlign.CENTER);
aRect.Y += 500 + 250;
xSection.setHeight(aRect.Y);
@@ -1389,18 +1386,18 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
}
+
protected Resource getResource()
{
return m_aResource;
}
-
- protected int m_aCommandType; // Table or Query
- protected String m_sTableName;
+ protected int m_aCommandType; // Table or Query
+ protected String m_sTableName;
protected String[] m_aGroupNames;
protected String[] m_aFieldNames;
protected String[] m_aFieldTitleNames;
- protected int[] m_aFieldWidths;
- protected int[] m_aFieldTypes;
+ protected int[] m_aFieldWidths;
+ protected int[] m_aFieldTypes;
// protected int[] m_nLeftIndent;
private DesignTemplate m_xDesignTemplate = null;
@@ -1408,14 +1405,14 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
if (_aOther instanceof ReportBuilderLayouter)
{
- final ReportBuilderLayouter aOther = (ReportBuilderLayouter)_aOther;
+ final ReportBuilderLayouter aOther = (ReportBuilderLayouter) _aOther;
m_aCommandType = aOther.m_aCommandType;
- m_sTableName = aOther.m_sTableName;
+ m_sTableName = aOther.m_sTableName;
m_aGroupNames = aOther.m_aGroupNames;
m_aFieldNames = aOther.m_aFieldNames;
m_aFieldTitleNames = aOther.m_aFieldTitleNames;
m_aFieldWidths = aOther.m_aFieldWidths;
- m_aFieldTypes = aOther.m_aFieldTypes;
+ m_aFieldTypes = aOther.m_aFieldTypes;
// m_nLeftIndent = aOther.m_nLeftIndent;
m_xDesignTemplate = aOther.m_xDesignTemplate;
@@ -1432,12 +1429,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
int nWidth = 0;
final String[] aFieldTitles = m_aFieldTitleNames; // we want all Field Titles here // getFieldTitleNames();
- for (int i=0; i<aFieldTitles.length; i++)
+ for (int i = 0; i < aFieldTitles.length; i++)
{
final String sLabel = aFieldTitles[i];
nWidth = Math.max(nWidth, getLabelWidth(sLabel));
}
- for (int i=0;i<m_aGroupNames.length;i++)
+ for (int i = 0; i < m_aGroupNames.length; i++)
{
final String sGroupName = m_aGroupNames[i];
final SectionObject a = getDesignTemplate().getGroupLabel(i);
@@ -1465,7 +1462,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
return getLabelWidth(_sLabel, 0.0f, 0.0f);
}
-
XFixedText m_aFixedTextHelper = null;
HashMap m_aLabelWidthMap;
@@ -1495,7 +1491,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
if (m_aLabelWidthMap.containsKey(sKey))
{
final Object aWidth = m_aLabelWidthMap.get(sKey);
- final Integer aIntegerWidth = (Integer)aWidth;
+ final Integer aIntegerWidth = (Integer) aWidth;
nWidth = aIntegerWidth.intValue();
}
else
@@ -1505,7 +1501,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
if (m_aFixedTextHelper == null)
{
final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText");
- m_aFixedTextHelper = (XFixedText)UnoRuntime.queryInterface(XFixedText.class, aFixedText);
+ m_aFixedTextHelper = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
}
m_aFixedTextHelper.setLabel(_sLabel);
@@ -1537,8 +1533,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// try
// {
// _xSection.setKeepTogether(true);
- final PropertySetHelper aHelper = new PropertySetHelper(_xSectionOrGroup);
- aHelper.setPropertyValueDontThrow("KeepTogether", Boolean.TRUE);
+ final PropertySetHelper aHelper = new PropertySetHelper(_xSectionOrGroup);
+ aHelper.setPropertyValueDontThrow("KeepTogether", Boolean.TRUE);
// }
// catch (com.sun.star.uno.Exception e)
// {
@@ -1546,7 +1542,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// }
}
-
protected DesignTemplate getDesignTemplate()
{
if (m_xDesignTemplate == null)
@@ -1555,7 +1550,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
String sDefaultHeaderLayout = m_xReportDefinitionReadAccess.getDefaultHeaderLayout();
loadAndSetBackgroundTemplate(sDefaultHeaderLayout);
- // copy all functions from the design template to the current report definition
+ // copy all functions from the design template to the current report definition
// XFunctions xOtherFunctions = m_xDesignTemplate.getReportDefinition().getFunctions();
// final int nFunctionCount = xOtherFunctions.getCount();
// for (int i=0;i<nFunctionCount;i++)
@@ -1586,6 +1581,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
return m_xDesignTemplate;
}
+
/**
* If there already exists a foreign report definition, which we use to get the layout from
* close it.
@@ -1599,6 +1595,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
m_xDesignTemplate = null;
}
}
+
/**
* load the given string as a template and use it's content to paint the other
* @param LayoutTemplatePath
@@ -1609,7 +1606,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
String sName = FileAccess.getFilename(LayoutTemplatePath);
if (sName.toLowerCase().equals("default.otr_") ||
- LayoutTemplatePath.equals("DefaultLayoutOfHeaders"))
+ LayoutTemplatePath.equals("DefaultLayoutOfHeaders"))
{
// this is the default layout, we don't want to have a layout for this.
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
index cf40352648cc..aa777253a7f7 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
@@ -9,7 +9,7 @@
*
* $RCSfile: SectionEmptyObject.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,7 +30,6 @@
*
* **********************************************************************
*/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.FontDescriptor;
@@ -41,6 +40,7 @@ import com.sun.star.awt.FontDescriptor;
*/
public class SectionEmptyObject extends SectionObject
{
+
protected SectionEmptyObject()
{
m_aParentObject = null;
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
index 65ee9e65f818..821ccf5a180d 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
@@ -9,7 +9,7 @@
*
* $RCSfile: SectionLabel.java,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.3.6.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,23 +30,22 @@
*
* **********************************************************************
*/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.FontDescriptor;
import com.sun.star.report.XFixedText;
// import com.sun.star.wizards.common.PropertySetHelper;
-
/**
*
* @author ll93751
*/
public class SectionLabel extends SectionObject
{
+
protected SectionLabel(XFixedText _aFixedText)
{
m_aParentObject = _aFixedText;
- // We would like to know, what properties are in this object.
+ // We would like to know, what properties are in this object.
// PropertySetHelper aHelper = new PropertySetHelper(_aFixedText);
// aHelper.showProperties();
}
@@ -66,15 +65,14 @@ public class SectionLabel extends SectionObject
FontDescriptor a = null;
try
{
- final XFixedText aLabel = (XFixedText)getParent();
- a= aLabel.getFontDescriptor();
+ final XFixedText aLabel = (XFixedText) getParent();
+ a = aLabel.getFontDescriptor();
}
catch (com.sun.star.beans.UnknownPropertyException e)
{
}
return a;
}
-
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
index f0eb46fe729a..2bdc2cf8c929 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
@@ -9,7 +9,7 @@
*
* $RCSfile: SectionObject.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,19 +30,18 @@
*
* **********************************************************************
*/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.FontDescriptor;
import com.sun.star.wizards.common.PropertySetHelper;
-
/**
*
* @author ll93751
*/
abstract public class SectionObject
{
+
Object m_aParentObject; // this could be FixedText or FormattedField or null
PropertySetHelper m_aPropertySetHelper;
@@ -55,6 +54,7 @@ abstract public class SectionObject
{
return m_aParentObject;
}
+
abstract public FontDescriptor getFontDescriptor();
private PropertySetHelper getPropertySetHelper()
@@ -65,20 +65,24 @@ abstract public class SectionObject
}
return m_aPropertySetHelper;
}
+
public int getHeight(int _nDefault)
{
final int nHeight = getPropertySetHelper().getPropertyValueAsInteger("Height", 500);
return nHeight;
}
+
public float getCharWeight(float _nDefault)
{
final float fCharWeight = (float) getPropertySetHelper().getPropertyValueAsDouble("CharWeight", _nDefault);
return fCharWeight;
}
+
public void setFontToBold()
{
setPropertyValue("CharWeight", new Float(com.sun.star.awt.FontWeight.BOLD));
}
+
public void setPropertyValue(String _sKey, Object _nValue)
{
getPropertySetHelper().setPropertyValueDontThrow(_sKey, _nValue);
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
index 11a050a7940c..ebf11abacdf7 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
@@ -9,7 +9,7 @@
*
* $RCSfile: SectionTextField.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -30,7 +30,6 @@
*
* **********************************************************************
*/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.FontDescriptor;
@@ -40,12 +39,13 @@ import com.sun.star.report.XFormattedField;
*
* @author ll93751
*/
-public class SectionTextField extends SectionObject
+public class SectionTextField extends SectionObject
{
+
protected SectionTextField(XFormattedField _aFormattedField)
{
m_aParentObject = _aFormattedField;
- // We would like to know, what properties are in this object.
+ // We would like to know, what properties are in this object.
}
public static SectionObject create(XFormattedField _aFormattedField)
@@ -59,7 +59,7 @@ public class SectionTextField extends SectionObject
FontDescriptor a = null;
try
{
- XFormattedField aField = (XFormattedField)getParent();
+ XFormattedField aField = (XFormattedField) getParent();
a = aField.getFontDescriptor();
}
catch (com.sun.star.beans.UnknownPropertyException e)
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
index e2d5dd11756b..b5ebc38a0453 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
@@ -9,7 +9,7 @@
*
* $RCSfile: Tabular.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.2.36.1 $
*
* This file is part of OpenOffice.org.
*
@@ -29,7 +29,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
@@ -47,6 +46,7 @@ import com.sun.star.wizards.ui.UIConsts;
*/
public class Tabular extends ReportBuilderLayouter
{
+
public Tabular(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
{
super(_xDefinitionAccess, _aResource);
@@ -86,7 +86,7 @@ public class Tabular extends ReportBuilderLayouter
final int nWidth = calculateFieldWidth(getLeftGroupIndent(getCountOfGroups()), aFieldNames.length);
final SectionObject aSO = getDesignTemplate().getDetailTextField();
- for (int i=0;i<aFieldNames.length;i++)
+ for (int i = 0; i < aFieldNames.length; i++)
{
final String sFieldName = convertToFieldName(aFieldNames[i]);
aRect = insertFormattedField(xSection, sFieldName, aRect, nWidth, aSO);
@@ -95,7 +95,6 @@ public class Tabular extends ReportBuilderLayouter
xSection.setHeight(nHeight);
}
-
protected void insertDetailFieldTitles()
{
final String[] aFieldTitleNames = getFieldTitleNames();
@@ -130,7 +129,7 @@ public class Tabular extends ReportBuilderLayouter
final XGroups xGroups = getReportDefinition().getGroups();
// we insert the titles in the last group
final Object aGroup = xGroups.getByIndex(nGroups - 1);
- final XGroup xGroup = (XGroup)UnoRuntime.queryInterface(XGroup.class, aGroup);
+ final XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup);
xSection = xGroup.getHeader();
// We don't need to copy the GroupProperties, because this is done in the insertGroup() member function
@@ -145,7 +144,7 @@ public class Tabular extends ReportBuilderLayouter
aRect.Y = aSO.getHeight(500) + 250; // group height + a little empty line
final int nWidth = calculateFieldWidth(getLeftGroupIndent(getCountOfGroups()), aFieldTitleNames.length);
- for (int i=0;i<aFieldTitleNames.length;i++)
+ for (int i = 0; i < aFieldTitleNames.length; i++)
{
aRect = insertLabel(xSection, aFieldTitleNames[i], aRect, nWidth, aSO);
}
@@ -155,6 +154,4 @@ public class Tabular extends ReportBuilderLayouter
{
}
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/table/CGCategory.java b/wizards/com/sun/star/wizards/table/CGCategory.java
index 2397dc0c7fa0..ba5e9a0be31b 100644
--- a/wizards/com/sun/star/wizards/table/CGCategory.java
+++ b/wizards/com/sun/star/wizards/table/CGCategory.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.table;
+ ************************************************************************/
+package com.sun.star.wizards.table;
import com.sun.star.container.NoSuchElementException;
import com.sun.star.container.XNameAccess;
@@ -47,8 +48,8 @@ import com.sun.star.wizards.common.Properties;
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
// import com.sun.star.wizards.common.ConfigGroup;
-
-public class CGCategory{
+public class CGCategory
+{
public String Name;
public int Index;
@@ -59,29 +60,36 @@ public class CGCategory{
XNameAccess xNameAccessCurBusinessNode;
Object oconfigView;
- public CGCategory(XMultiServiceFactory _xMSF){
+ public CGCategory(XMultiServiceFactory _xMSF)
+ {
xMSF = _xMSF;
}
+ public void initialize(int _index)
+ {
+ try
+ {
+ oconfigView = Configuration.getConfigurationRoot(xMSF, CGROOTPATH, false); //business/Tables
+ xNameAccessCurBusinessNode = Configuration.getChildNodebyIndex(oconfigView, _index);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public void initialize(int _index){
- try {
- oconfigView = Configuration.getConfigurationRoot(xMSF, CGROOTPATH, false); //business/Tables
- xNameAccessCurBusinessNode = Configuration.getChildNodebyIndex(oconfigView, _index);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- public String[] getTableNames(){
- try {
- xNameAccessTablesNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNameAccessCurBusinessNode.getByName("Tables"));
- String[] sTableNames = Configuration.getNodeDisplayNames(xNameAccessTablesNode);
- return sTableNames;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return null;
- }}
-
-
+ public String[] getTableNames()
+ {
+ try
+ {
+ xNameAccessTablesNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNameAccessCurBusinessNode.getByName("Tables"));
+ String[] sTableNames = Configuration.getNodeDisplayNames(xNameAccessTablesNode);
+ return sTableNames;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/table/CGTable.java b/wizards/com/sun/star/wizards/table/CGTable.java
index b8033a4f5b8f..50e12debb279 100644
--- a/wizards/com/sun/star/wizards/table/CGTable.java
+++ b/wizards/com/sun/star/wizards/table/CGTable.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,8 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.table;
-
+ ************************************************************************/
+package com.sun.star.wizards.table;
import com.sun.star.awt.XListBox;
import com.sun.star.container.NoSuchElementException;
@@ -40,8 +40,9 @@ import com.sun.star.wizards.common.Configuration;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.Helper;
+public class CGTable
+{
-public class CGTable{
XMultiServiceFactory xMSF;
XNameAccess xNameAccessFieldsNode;
XNameAccess xNameAccessTableNode;
@@ -50,39 +51,54 @@ public class CGTable{
private Object oconfigView;
private final String CGROOTPATH = "/org.openoffice.Office.TableWizard/TableWizard/";
-
- public CGTable(XMultiServiceFactory _xMSF){
+ public CGTable(XMultiServiceFactory _xMSF)
+ {
xMSF = _xMSF;
}
- public void initialize(XNameAccess _xNameAccessParentNode, int _index){
- try {
- xNameAccessTableNode = Configuration.getChildNodebyIndex( _xNameAccessParentNode, _index);
- xNameAccessFieldsNode = Configuration.getChildNodebyName(xNameAccessTableNode, "Fields");
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ public void initialize(XNameAccess _xNameAccessParentNode, int _index)
+ {
+ try
+ {
+ xNameAccessTableNode = Configuration.getChildNodebyIndex(_xNameAccessParentNode, _index);
+ xNameAccessFieldsNode = Configuration.getChildNodebyName(xNameAccessTableNode, "Fields");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public String[] getFieldNames(boolean _bgetbyShortName, int _imaxcolumnchars){
- try {
- String[] fieldnames = null;
- if (_bgetbyShortName){
- fieldnames = Configuration.getNodeChildNames(xNameAccessFieldsNode, "ShortName");
- for (int i = 0; i < fieldnames.length; i++){
- if (fieldnames[i].length() > _imaxcolumnchars)
- fieldnames[i]= fieldnames[i].substring(0, _imaxcolumnchars);
+ public String[] getFieldNames(boolean _bgetbyShortName, int _imaxcolumnchars)
+ {
+ try
+ {
+ String[] fieldnames = null;
+ if (_bgetbyShortName)
+ {
+ fieldnames = Configuration.getNodeChildNames(xNameAccessFieldsNode, "ShortName");
+ for (int i = 0; i < fieldnames.length; i++)
+ {
+ if (fieldnames[i].length() > _imaxcolumnchars)
+ {
+ fieldnames[i] = fieldnames[i].substring(0, _imaxcolumnchars);
+ }
+ }
+ }
+ else
+ {
+ fieldnames = Configuration.getNodeChildNames(xNameAccessFieldsNode, "Name");
+ }
+ for (int i = 0; i < fieldnames.length; i++)
+ {
+ fieldnames[i] = Desktop.removeSpecialCharacters(xMSF, Configuration.getOfficeLocale(xMSF), fieldnames[i]);
}
+ return fieldnames;
}
- else
- fieldnames = Configuration.getNodeChildNames(xNameAccessFieldsNode, "Name");
-
- for (int i = 0;i < fieldnames.length; i++){
- fieldnames[i] = Desktop.removeSpecialCharacters(xMSF, Configuration.getOfficeLocale(xMSF), fieldnames[i]);
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return null;
}
- return fieldnames;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return null;
- }}
+ }
}
diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java
index ccc56e4acb97..7455df894c73 100644
--- a/wizards/com/sun/star/wizards/table/CallTableWizard.java
+++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -41,7 +41,8 @@ import com.sun.star.wizards.common.Properties;
* (<CODE>__writeRegistryServiceInfo</CODE>).
* @author Bertram Nolte
*/
-public class CallTableWizard {
+public class CallTableWizard
+{
/** Gives a factory for creating the service.
* This method is called by the <code>JavaLoader</code>
@@ -56,10 +57,13 @@ public class CallTableWizard {
* structures) of a single
* registry key accessible.
*/
- public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey) {
+ public static com.sun.star.lang.XSingleServiceFactory __getServiceFactory(String stringImplementationName, com.sun.star.lang.XMultiServiceFactory xMSF, com.sun.star.registry.XRegistryKey xregistrykey)
+ {
com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null;
if (stringImplementationName.equals(TableWizardImplementation.class.getName()))
+ {
xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(TableWizardImplementation.class, TableWizardImplementation.__serviceName, xMSF, xregistrykey);
+ }
return xsingleservicefactory;
}
@@ -71,54 +75,63 @@ public class CallTableWizard {
* structures) of a single
* registry key accessible.
*/
- public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey) {
+ public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey)
+ {
return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(TableWizardImplementation.class.getName(), TableWizardImplementation.__serviceName, xregistrykey);
}
/** This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
- public static class TableWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor {
+ public static class TableWizardImplementation extends com.sun.star.lib.uno.helper.PropertySet implements com.sun.star.lang.XInitialization, com.sun.star.lang.XServiceInfo, com.sun.star.lang.XTypeProvider, com.sun.star.task.XJobExecutor
+ {
PropertyValue[] databaseproperties;
public XComponent Document = null;
public XComponent DocumentDefinition = null;
+
/** The constructor of the inner class has a XMultiServiceFactory parameter.
* @param xmultiservicefactoryInitialization A special service factory
* could be introduced while initializing.
*/
- public TableWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization) {
+ public TableWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
super();
xmultiservicefactory = xmultiservicefactoryInitialization;
- registerProperty("Document", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
- registerProperty("DocumentDefinition", (short)(PropertyAttribute.READONLY|PropertyAttribute.MAYBEVOID));
+ registerProperty("Document", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
+ registerProperty("DocumentDefinition", (short) (PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID));
}
- public void trigger(String sEvent) {
- try {
- if (sEvent.compareTo("start") == 0) {
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.compareTo("start") == 0)
+ {
TableWizard CurTableWizard = new TableWizard(xmultiservicefactory);
XComponent[] obj = CurTableWizard.startTableWizard(xmultiservicefactory, databaseproperties);
- if ( obj != null ){
+ if (obj != null)
+ {
DocumentDefinition = obj[1];
Document = obj[0];
}
}
- else if (sEvent.compareTo("end") == 0) {
+ else if (sEvent.compareTo("end") == 0)
+ {
DocumentDefinition = null;
Document = null;
databaseproperties = null;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
System.gc();
}
-
/** The service name, that must be used to get an instance of this service.
*/
private static final String __serviceName = "com.sun.star.wizards.table.CallTableWizard";
-
/** The service manager, that gives access to all registered services.
*/
private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
@@ -130,14 +143,16 @@ public class CallTableWizard {
* @throws Exception Every exception will not be handled, but will be
* passed to the caller.
*/
- public void initialize(Object[] object) throws com.sun.star.uno.Exception {
+ public void initialize(Object[] object) throws com.sun.star.uno.Exception
+ {
databaseproperties = Properties.convertToPropertyValueArray(object);
}
/** This method returns an array of all supported service names.
* @return Array of supported service names.
*/
- public java.lang.String[] getSupportedServiceNames() {
+ public java.lang.String[] getSupportedServiceNames()
+ {
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
@@ -150,10 +165,12 @@ public class CallTableWizard {
* @param stringService Service name.
* @return True, if the given service name will be supported.
*/
- public boolean supportsService(String stringService) {
+ public boolean supportsService(String stringService)
+ {
boolean booleanSupportsService = false;
- if (stringService.equals(__serviceName)) {
+ if (stringService.equals(__serviceName))
+ {
booleanSupportsService = true;
}
return (booleanSupportsService);
@@ -170,13 +187,18 @@ public class CallTableWizard {
* whole combination of objects.
* @return Array of bytes, in order to distinguish between two sets.
*/
- public byte[] getImplementationId() {
- byte[] byteReturn = {
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
};
- try {
+ try
+ {
byteReturn = new String("" + this.hashCode()).getBytes();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
@@ -186,7 +208,8 @@ public class CallTableWizard {
/** Return the class name of the component.
* @return Class name of the component.
*/
- public java.lang.String getImplementationName() {
+ public java.lang.String getImplementationName()
+ {
return (TableWizardImplementation.class.getName());
}
@@ -195,13 +218,21 @@ public class CallTableWizard {
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- public Type[] getTypes() {
- Type[] typeReturn = {
+ public Type[] getTypes()
+ {
+ Type[] typeReturn =
+ {
};
- try {
- typeReturn = new Type[] { new Type(com.sun.star.task.XJobExecutor.class), new Type(com.sun.star.lang.XTypeProvider.class), new Type(com.sun.star.lang.XServiceInfo.class), new Type(com.sun.star.lang.XInitialization.class)};
- } catch (Exception exception) {
+ try
+ {
+ typeReturn = new Type[]
+ {
+ new Type(com.sun.star.task.XJobExecutor.class), new Type(com.sun.star.lang.XTypeProvider.class), new Type(com.sun.star.lang.XServiceInfo.class), new Type(com.sun.star.lang.XInitialization.class)
+ };
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
diff --git a/wizards/com/sun/star/wizards/table/FieldDescription.java b/wizards/com/sun/star/wizards/table/FieldDescription.java
index 4901e0b37470..3cb22c7535ea 100644
--- a/wizards/com/sun/star/wizards/table/FieldDescription.java
+++ b/wizards/com/sun/star/wizards/table/FieldDescription.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -45,8 +45,9 @@ import com.sun.star.wizards.common.Configuration;
import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.Properties;
+public class FieldDescription
+{
-public class FieldDescription{
int category;
private String tablename = "";
// String fieldname;
@@ -63,7 +64,8 @@ public class FieldDescription{
private XMultiServiceFactory xMSF;
private Locale aLocale;
- public FieldDescription(XMultiServiceFactory _xMSF, Locale _aLocale, ScenarioSelector _curscenarioselector, String _fieldname, String _keyname, int _nmaxcharCount){
+ public FieldDescription(XMultiServiceFactory _xMSF, Locale _aLocale, ScenarioSelector _curscenarioselector, String _fieldname, String _keyname, int _nmaxcharCount)
+ {
xMSF = _xMSF;
aLocale = _aLocale;
category = _curscenarioselector.getCategory();
@@ -74,25 +76,32 @@ public class FieldDescription{
xNameAccessTableNode = _curscenarioselector.oCGTable.xNameAccessFieldsNode;
XNameAccess xNameAccessFieldNode;
if (_curscenarioselector.bcolumnnameislimited)
- xNameAccessFieldNode = Configuration.getChildNodebyDisplayName(xMSF, aLocale, xNameAccessTableNode,keyname, "ShortName", _nmaxcharCount);
+ {
+ xNameAccessFieldNode = Configuration.getChildNodebyDisplayName(xMSF, aLocale, xNameAccessTableNode, keyname, "ShortName", _nmaxcharCount);
+ }
else
- xNameAccessFieldNode = Configuration.getChildNodebyDisplayName(xMSF, aLocale, xNameAccessTableNode,keyname, "Name", _nmaxcharCount);
+ {
+ xNameAccessFieldNode = Configuration.getChildNodebyDisplayName(xMSF, aLocale, xNameAccessTableNode, keyname, "Name", _nmaxcharCount);
+ }
setFieldProperties(xNameAccessFieldNode);
}
- public FieldDescription(String _fieldname){
+ public FieldDescription(String _fieldname)
+ {
Name = _fieldname;
aPropertyValues = new Vector();
Type = new Integer(com.sun.star.sdbc.DataType.VARCHAR);
- aPropertyValues.addElement(Properties.createProperty("Name", _fieldname) );
- aPropertyValues.addElement(Properties.createProperty("Type", Type) );
+ aPropertyValues.addElement(Properties.createProperty("Name", _fieldname));
+ aPropertyValues.addElement(Properties.createProperty("Type", Type));
}
-
- public void setName(String _newfieldname){
- for (int i = 0; i < aPropertyValues.size(); i++){
+ public void setName(String _newfieldname)
+ {
+ for (int i = 0; i < aPropertyValues.size(); i++)
+ {
PropertyValue aPropertyValue = (PropertyValue) aPropertyValues.get(i);
- if (aPropertyValue.Name.equals("Name")){
+ if (aPropertyValue.Name.equals("Name"))
+ {
aPropertyValue.Value = _newfieldname;
aPropertyValues.set(i, aPropertyValue);
Name = _newfieldname;
@@ -101,55 +110,74 @@ public class FieldDescription{
}
}
- public String getName(){
+ public String getName()
+ {
return Name;
}
- public String gettablename(){
+ public String gettablename()
+ {
return tablename;
}
-
- private boolean propertyexists(String _propertyname){
- boolean bexists = false;
- try {
- if (xPropertySet.getPropertySetInfo().hasPropertyByName(_propertyname)){
- Object oValue = xPropertySet.getPropertyValue(_propertyname);
- bexists = (!com.sun.star.uno.AnyConverter.isVoid(oValue));
+ private boolean propertyexists(String _propertyname)
+ {
+ boolean bexists = false;
+ try
+ {
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName(_propertyname))
+ {
+ Object oValue = xPropertySet.getPropertyValue(_propertyname);
+ bexists = (!com.sun.star.uno.AnyConverter.isVoid(oValue));
+ }
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return bexists;
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return bexists;
}
-
- public void setFieldProperties(XNameAccess _xNameAccessFieldNode){
- try {
- xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xNameAccessFieldNode);
+ public void setFieldProperties(XNameAccess _xNameAccessFieldNode)
+ {
+ try
+ {
+ xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xNameAccessFieldNode);
// Integer Index = (Integer) xPropertySet.getPropertyValue("Index");
- if (propertyexists("Name"))
- aPropertyValues.addElement(Properties.createProperty("Name", Name));
-
- if (propertyexists("Type"))
- aPropertyValues.addElement(Properties.createProperty("Type", (Integer) xPropertySet.getPropertyValue("Type")));
- if (propertyexists("Scale"))
- aPropertyValues.addElement(Properties.createProperty("Scale", (Integer) xPropertySet.getPropertyValue("Scale")));
+ if (propertyexists("Name"))
+ {
+ aPropertyValues.addElement(Properties.createProperty("Name", Name));
+ }
+ if (propertyexists("Type"))
+ {
+ aPropertyValues.addElement(Properties.createProperty("Type", (Integer) xPropertySet.getPropertyValue("Type")));
+ }
+ if (propertyexists("Scale"))
+ {
+ aPropertyValues.addElement(Properties.createProperty("Scale", (Integer) xPropertySet.getPropertyValue("Scale")));
// Scale =
- if (propertyexists("Precision"))
- aPropertyValues.addElement(Properties.createProperty("Precision", (Integer) xPropertySet.getPropertyValue("Precision")));
+ }
+ if (propertyexists("Precision"))
+ {
+ aPropertyValues.addElement(Properties.createProperty("Precision", (Integer) xPropertySet.getPropertyValue("Precision")));
// Precision = (Integer) xPropertySet.getPropertyValue("Precision");
- if (propertyexists("DefaultValue"))
- aPropertyValues.addElement(Properties.createProperty("DefaultValue",(Boolean) xPropertySet.getPropertyValue("DefaultValue")));
-// DefaultValue = (Boolean) xPropertySet.getPropertyValue("DefaultValue");
- //Type = new Integer(4); // TODO wo ist der Fehler?(Integer) xPropertySet.getPropertyValue("Type");
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
+ }
+ if (propertyexists("DefaultValue"))
+ {
+ aPropertyValues.addElement(Properties.createProperty("DefaultValue", (Boolean) xPropertySet.getPropertyValue("DefaultValue")));// DefaultValue = (Boolean) xPropertySet.getPropertyValue("DefaultValue");
+ //Type = new Integer(4); // TODO wo ist der Fehler?(Integer) xPropertySet.getPropertyValue("Type");
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public PropertyValue[] getPropertyValues(){
- if (aPropertyValues != null){
+ public PropertyValue[] getPropertyValues()
+ {
+ if (aPropertyValues != null)
+ {
PropertyValue[] aProperties = new PropertyValue[aPropertyValues.size()];
aPropertyValues.toArray(aProperties);
return aProperties;
diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java
index 8e918eadcb2d..faa736977679 100644
--- a/wizards/com/sun/star/wizards/table/FieldFormatter.java
+++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.table;
+ ************************************************************************/
+package com.sun.star.wizards.table;
import com.sun.star.awt.FontDescriptor;
import com.sun.star.awt.ItemEvent;
@@ -58,7 +59,9 @@ import com.sun.star.wizards.ui.PeerConfig;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.UnoDialog;
-public class FieldFormatter implements XItemListener{
+public class FieldFormatter implements XItemListener
+{
+
TableWizard CurUnoDialog;
TableDescriptor curTableDescriptor;
Object oColumnDescriptorModel;
@@ -77,7 +80,8 @@ public class FieldFormatter implements XItemListener{
String suntitled;
Integer IFieldFormatStep;
- public FieldFormatter(TableWizard _CurUnoDialog, TableDescriptor _curTableDescriptor) {
+ public FieldFormatter(TableWizard _CurUnoDialog, TableDescriptor _curTableDescriptor)
+ {
this.CurUnoDialog = _CurUnoDialog;
curtabindex = (short) (TableWizard.SOFIELDSFORMATPAGE * 100);
IFieldFormatStep = new Integer(TableWizard.SOFIELDSFORMATPAGE);
@@ -90,14 +94,29 @@ public class FieldFormatter implements XItemListener{
suntitled = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 43);
CurUnoDialog.insertLabel("lblFieldNames",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], sFieldNames, new Integer(91), new Integer(27),IFieldFormatStep, new Short(curtabindex++), new Integer(90)});
-
- try {
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], sFieldNames, new Integer(91), new Integer(27), IFieldFormatStep, new Short(curtabindex++), new Integer(90)
+ });
+
+ try
+ {
xlstFieldNames = CurUnoDialog.insertListBox("lstfieldnames", 3, null, this,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(133),"HID:41220", new Integer(92), new Integer(37), IFieldFormatStep, new Short(curtabindex++), new Integer(62)});
- } catch (Exception e) {
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(133), "HID:41220", new Integer(92), new Integer(37), IFieldFormatStep, new Short(curtabindex++), new Integer(62)
+ });
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
@@ -105,72 +124,127 @@ public class FieldFormatter implements XItemListener{
oFontDesc.Name = "StarSymbol";
btnShiftUp = CurUnoDialog.insertButton("btnShiftUp", "shiftFieldNameUp", this,
- new String[] { "Enabled", "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { Boolean.FALSE, oFontDesc, new Integer(14), "HID:41221", String.valueOf((char) 8743), new Integer(158), new Integer(139), IFieldFormatStep, new Short(curtabindex++), new Integer(14)});
+ new String[]
+ {
+ "Enabled", "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, oFontDesc, new Integer(14), "HID:41221", String.valueOf((char) 8743), new Integer(158), new Integer(139), IFieldFormatStep, new Short(curtabindex++), new Integer(14)
+ });
btnShiftDown = CurUnoDialog.insertButton("btnShiftDown", "shiftFieldNameDown", this,
- new String[] { "Enabled", "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { Boolean.FALSE, oFontDesc, new Integer(14), "HID:41222", String.valueOf((char) 8744), new Integer(158), new Integer(156), IFieldFormatStep, new Short(curtabindex++), new Integer(14) });
+ new String[]
+ {
+ "Enabled", "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, oFontDesc, new Integer(14), "HID:41222", String.valueOf((char) 8744), new Integer(158), new Integer(156), IFieldFormatStep, new Short(curtabindex++), new Integer(14)
+ });
oFontDesc = new FontDescriptor();
oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD;
oFontDesc.Height = (short) 13;
btnminus = CurUnoDialog.insertButton("btnminus", "removeFieldName", this,
- new String[] {"FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] {oFontDesc, new Integer(14), "HID:41223", "-", new Integer(118), new Integer(175), IFieldFormatStep, new Short(curtabindex++), new Integer(14) });
+ new String[]
+ {
+ "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ oFontDesc, new Integer(14), "HID:41223", "-", new Integer(118), new Integer(175), IFieldFormatStep, new Short(curtabindex++), new Integer(14)
+ });
btnplus = CurUnoDialog.insertButton("btnplus", "addFieldName", this,
- new String[] {"FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { oFontDesc, new Integer(14), "HID:41224", "+", new Integer(137), new Integer(175), IFieldFormatStep, new Short(curtabindex++), new Integer(14) });
+ new String[]
+ {
+ "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ oFontDesc, new Integer(14), "HID:41224", "+", new Integer(137), new Integer(175), IFieldFormatStep, new Short(curtabindex++), new Integer(14)
+ });
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "ColDescriptorHeader",
- new String[] { "Height", "Label", "Orientation", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), sfieldinfo, new Integer(0), new Integer(158), new Integer(27), IFieldFormatStep, new Short(curtabindex++), new Integer(165) });
+ new String[]
+ {
+ "Height", "Label", "Orientation", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), sfieldinfo, new Integer(0), new Integer(158), new Integer(27), IFieldFormatStep, new Short(curtabindex++), new Integer(165)
+ });
CurUnoDialog.insertLabel("lblFieldName",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], sFieldName, new Integer(158), new Integer(39),IFieldFormatStep, new Short(curtabindex++), new Integer(94)});
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], sFieldName, new Integer(158), new Integer(39), IFieldFormatStep, new Short(curtabindex++), new Integer(94)
+ });
txtfieldname = CurUnoDialog.insertTextField("txtfieldname", MODIFYFIELDNAME, this,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"},
- new Object[] { UIConsts.INTEGER_12, "HID:41225", new Integer(274), new Integer(37), IFieldFormatStep, new Short(curtabindex++),"", new Integer(50)});
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGER_12, "HID:41225", new Integer(274), new Integer(37), IFieldFormatStep, new Short(curtabindex++), "", new Integer(50)
+ });
txtfieldname.addTextListener(CurUnoDialog);
CurUnoDialog.getPeerConfiguration().setAccessibleName(btnplus, sbtnplushelptext);
CurUnoDialog.getPeerConfiguration().setAccessibleName(btnminus, sbtnminushelptext);
}
-
- public void initialize(TableDescriptor _curTableDescriptor, String[] _fieldnames){
- if (oColumnDescriptorModel == null){
+ public void initialize(TableDescriptor _curTableDescriptor, String[] _fieldnames)
+ {
+ if (oColumnDescriptorModel == null)
+ {
oColumnDescriptorModel = CurUnoDialog.insertControlModel("com.sun.star.sdb.ColumnDescriptorControlModel", "oColumnDescriptor",
- new String[] {"Height", "PositionX", "PositionY", "Step", "TabIndex", "Width", "EditWidth"}, // "HelpURL"
- new Object[] {new Integer(85), new Integer(158), new Integer(49), IFieldFormatStep, new Short(curtabindex++), new Integer(166), new Integer(50)}); //, "HID:41226"
+ new String[]
+ {
+ "Height", "PositionX", "PositionY", "Step", "TabIndex", "Width", "EditWidth"
+ }, // "HelpURL"
+ new Object[]
+ {
+ new Integer(85), new Integer(158), new Integer(49), IFieldFormatStep, new Short(curtabindex++), new Integer(166), new Integer(50)
+ }); //, "HID:41226"
curTableDescriptor = _curTableDescriptor;
Helper.setUnoPropertyValue(oColumnDescriptorModel, "ActiveConnection", _curTableDescriptor.DBConnection);
txtfieldname.setMaxTextLen((short) this.curTableDescriptor.getMaxColumnNameLength());
}
- else {
+ else
+ {
int nStep = ((Integer) Helper.getUnoPropertyValue(oColumnDescriptorModel, "Step")).intValue();
- if (nStep > IFieldFormatStep.intValue()){
+ if (nStep > IFieldFormatStep.intValue())
+ {
Helper.setUnoPropertyValue(oColumnDescriptorModel, "Step", IFieldFormatStep);
CurUnoDialog.repaintDialogStep();
}
}
Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", _fieldnames);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] {0});
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ {
+ 0
+ });
updateColumnDescriptor(_fieldnames[0], curTableDescriptor.getByName(_fieldnames[0]));
toggleButtons();
CurUnoDialog.setFocus("lstfieldnames");
}
-
- public void toggleButtons(){
+ public void toggleButtons()
+ {
boolean benableShiftUpButton = false;
boolean benableShiftDownButton = false;
boolean bfieldnameisselected = Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems") != null;
int ilistcount = UnoDialog.getListBoxItemCount(xlstFieldNames);
boolean blistispopulated = (ilistcount > 0);
- if (bfieldnameisselected){
+ if (bfieldnameisselected)
+ {
int iselpos = xlstFieldNames.getSelectedItemPos();
benableShiftUpButton = (iselpos != 0);
benableShiftDownButton = (iselpos != ilistcount - 1);
@@ -181,13 +255,17 @@ public class FieldFormatter implements XItemListener{
CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, blistispopulated);
}
-
- public void addFieldName(){
+ public void addFieldName()
+ {
String snewfieldname = Desktop.getUniqueName(xlstFieldNames.getItems(), suntitled, "");
short icount = xlstFieldNames.getItemCount();
- if (CurUnoDialog.verifyfieldcount(icount)){
+ if (CurUnoDialog.verifyfieldcount(icount))
+ {
xlstFieldNames.addItem(snewfieldname, icount);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] {icount});
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ {
+ icount
+ });
toggleButtons();
FieldDescription curfielddescription = new FieldDescription(snewfieldname);
CurUnoDialog.fielditems.put(snewfieldname, curfielddescription);
@@ -198,8 +276,8 @@ public class FieldFormatter implements XItemListener{
}
}
-
- public void removeFieldName(){
+ public void removeFieldName()
+ {
String[] fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
short ipos = UnoDialog.getSelectedItemPos(xlstFieldNames);
String fieldname = fieldnames[ipos];
@@ -207,22 +285,34 @@ public class FieldFormatter implements XItemListener{
CurUnoDialog.fielditems.remove(fieldname);
int ilistcount = UnoDialog.getListBoxItemCount(xlstFieldNames);
if ((ipos) < ilistcount)
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] {ipos});
- else{
- if (ilistcount > -1){
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ {
+ ipos
+ });
+ }
+ else
+ {
+ if (ilistcount > -1)
+ {
ipos = (short) ((short) ilistcount - (short) 1);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] {ipos});
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ {
+ ipos
+ });
}
}
curTableDescriptor.dropColumnbyName(fieldname);
fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
boolean benable = ((ipos > -1) && (ipos < fieldnames.length));
- if (benable){
+ if (benable)
+ {
String snewfieldname = fieldnames[ipos];
updateColumnDescriptor(snewfieldname, curTableDescriptor.getByName(snewfieldname));
toggleButtons();
}
- else{
+ else
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", "");
Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), "Enabled", new Boolean(benable));
CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, benable);
@@ -232,12 +322,14 @@ public class FieldFormatter implements XItemListener{
CurUnoDialog.repaintDialogStep();
}
-
- public void modifyFieldName(){
+ public void modifyFieldName()
+ {
String newfieldname = txtfieldname.getText();
String oldfieldname = xlstFieldNames.getSelectedItem();
- if (!newfieldname.equals(oldfieldname)){
- if (curTableDescriptor.modifyColumnName(oldfieldname, newfieldname)){
+ if (!newfieldname.equals(oldfieldname))
+ {
+ if (curTableDescriptor.modifyColumnName(oldfieldname, newfieldname))
+ {
Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column");
Helper.setUnoPropertyValue(oColumn, "Name", newfieldname);
FieldDescription curfielddescription = (FieldDescription) CurUnoDialog.fielditems.get(oldfieldname);
@@ -248,39 +340,51 @@ public class FieldFormatter implements XItemListener{
short ipos = xlstFieldNames.getSelectedItemPos();
fieldnames[ipos] = newfieldname;
Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", fieldnames);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] {ipos});
- }
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ {
+ ipos
+ });
+ }
}
}
-
- public void shiftFieldNameUp(){
+ public void shiftFieldNameUp()
+ {
short ipos = xlstFieldNames.getSelectedItemPos();
String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, -1);
Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", snewlist);
- if ((ipos - 1) > -1){
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] {(short) (ipos-1)});
- curTableDescriptor.moveColumn(ipos, ipos-1);
+ if ((ipos - 1) > -1)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ {
+ (short) (ipos - 1)
+ });
+ curTableDescriptor.moveColumn(ipos, ipos - 1);
}
toggleButtons();
}
-
- public void shiftFieldNameDown(){
+ public void shiftFieldNameDown()
+ {
short ipos = xlstFieldNames.getSelectedItemPos();
String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, 1);
Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", snewlist);
- if ((ipos + 1) < xlstFieldNames.getItemCount()){
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[] {(short) (ipos+1)});
- curTableDescriptor.moveColumn(ipos, ipos+1);
+ if ((ipos + 1) < xlstFieldNames.getItemCount())
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ {
+ (short) (ipos + 1)
+ });
+ curTableDescriptor.moveColumn(ipos, ipos + 1);
}
toggleButtons();
}
-
- public String[] shiftArrayItem(String[] _slist, int _oldindex, int _shiftcount){
+ public String[] shiftArrayItem(String[] _slist, int _oldindex, int _shiftcount)
+ {
int newindex = _oldindex + _shiftcount;
- if ((newindex >= 0) && (newindex < _slist.length)){
+ if ((newindex >= 0) && (newindex < _slist.length))
+ {
String buffer = _slist[newindex];
_slist[newindex] = _slist[_oldindex];
_slist[_oldindex] = buffer;
@@ -288,53 +392,59 @@ public class FieldFormatter implements XItemListener{
return _slist;
}
-
- public boolean updateColumnofColumnDescriptor(){
+ public boolean updateColumnofColumnDescriptor()
+ {
Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column");
XPropertySet xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn);
- if (xColPropertySet != null){
+ if (xColPropertySet != null)
+ {
curTableDescriptor.modifyColumn(txtfieldname.getText(), xColPropertySet);
return true;
}
return false;
}
- private void updateColumnDescriptor(String _ColumnName, XPropertySet _xColumn){
+ private void updateColumnDescriptor(String _ColumnName, XPropertySet _xColumn)
+ {
updateColumnofColumnDescriptor();
XPropertySet xNewPropertySet = curTableDescriptor.clonePropertySet(_ColumnName, _xColumn);
if (xNewPropertySet != null)
+ {
Helper.setUnoPropertyValue(oColumnDescriptorModel, "Column", xNewPropertySet);
+ }
txtfieldname.setText(_ColumnName);
}
-
- public XPropertySet clonePropertySet(XPropertySet _xPropertySet){
+ public XPropertySet clonePropertySet(XPropertySet _xPropertySet)
+ {
XPropertySet xlocpropertyset = null;
return xlocpropertyset;
}
- public void itemStateChanged(ItemEvent arg0) {
+ public void itemStateChanged(ItemEvent arg0)
+ {
String fieldname = xlstFieldNames.getSelectedItem();
XPropertySet xColumn = curTableDescriptor.getByName(fieldname);
updateColumnDescriptor(fieldname, xColumn);
toggleButtons();
}
-
- public boolean iscompleted(){
+ public boolean iscompleted()
+ {
String[] sfieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
return sfieldnames.length > 0;
}
-
- public String[] getFieldNames(){
+ public String[] getFieldNames()
+ {
return (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
}
/* (non-Javadoc)
* @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
*/
- public void disposing(EventObject arg0) {
+ public void disposing(EventObject arg0)
+ {
// TODO Auto-generated method stub
}
}
diff --git a/wizards/com/sun/star/wizards/table/Finalizer.java b/wizards/com/sun/star/wizards/table/Finalizer.java
index ff07acbcdb0f..dec58408d2fc 100644
--- a/wizards/com/sun/star/wizards/table/Finalizer.java
+++ b/wizards/com/sun/star/wizards/table/Finalizer.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -53,8 +53,9 @@ import com.sun.star.wizards.db.TableDescriptor;
import com.sun.star.wizards.ui.UIConsts;
import com.sun.star.wizards.ui.*;
+public class Finalizer
+{
-public class Finalizer{
TableWizard CurUnoDialog;
short curtabindex;
XRadioButton optModifyTable;
@@ -69,9 +70,10 @@ public class Finalizer{
public static int MODIFYTABLEMODE = 1;
public static int STARTFORMWIZARDMODE = 2;
-
- public Finalizer(TableWizard _CurUnoDialog, TableDescriptor _curtabledescriptor) {
- try {
+ public Finalizer(TableWizard _CurUnoDialog, TableDescriptor _curtabledescriptor)
+ {
+ try
+ {
this.CurUnoDialog = _CurUnoDialog;
this.curtabledescriptor = _curtabledescriptor;
curtabindex = (short) (TableWizard.SOFINALPAGE * 100);
@@ -81,7 +83,7 @@ public class Finalizer{
String sWorkWithTable = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 38);
String sStartFormWizard = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 39);
String sModifyTable = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 37);
- String sCongratulations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 35);
+ String sCongratulations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 35);
String slblCatalog = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 49);
String slblSchema = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 50);
String[] sCatalogNames = curtabledescriptor.getCatalogNames();
@@ -92,174 +94,289 @@ public class Finalizer{
boolean bsupportsCatalogs = false;
CurUnoDialog.insertLabel("lblTableName",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "Width"},
- new Object[] { UIConsts.INTEGERS[8], slblTableName, new Integer(97), new Integer(25), IFINALSTEP, new Integer(220)}
- );
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], slblTableName, new Integer(97), new Integer(25), IFINALSTEP, new Integer(220)
+ });
txtTableName = CurUnoDialog.insertTextField("txtTableName", SETCOMPLETIONFLAG, this,
- new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"},
- new Object[] { UIConsts.INTEGER_12, "HID:41240", new Integer(97), new Integer(35),IFINALSTEP, new Short(curtabindex++),"", new Integer(223)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Text", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGER_12, "HID:41240", new Integer(97), new Integer(35), IFINALSTEP, new Short(curtabindex++), "", new Integer(223)
+ });
txtTableName.addTextListener(CurUnoDialog);
txtTableName.setMaxTextLen((short) this.curtabledescriptor.getMaxTableNameLength());
- if (this.curtabledescriptor.xDBMetaData.supportsCatalogsInTableDefinitions()){
- if (sCatalogNames != null){
- if (sCatalogNames.length > 0){
+ if (this.curtabledescriptor.xDBMetaData.supportsCatalogsInTableDefinitions())
+ {
+ if (sCatalogNames != null)
+ {
+ if (sCatalogNames.length > 0)
+ {
bsupportsCatalogs = true;
String sCatalog = "";
- try {
+ try
+ {
sCatalog = curtabledescriptor.DBConnection.getCatalog();
- } catch (SQLException e1) {
+ }
+ catch (SQLException e1)
+ {
e1.printStackTrace(System.out);
}
CurUnoDialog.insertLabel("lblCatalog",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] {new Integer(8), slblCatalog, new Integer(nListBoxPosX), new Integer(52), IFINALSTEP, new Short(curtabindex++), new Integer(120) });
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblCatalog, new Integer(nListBoxPosX), new Integer(52), IFINALSTEP, new Short(curtabindex++), new Integer(120)
+ });
- try {
+ try
+ {
xCatalogListBox = CurUnoDialog.insertListBox("lstCatalog", null, null,
- new String[] { "Dropdown", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width" },
- new Object[] { Boolean.TRUE, new Integer(12), "HID:41244", new Short("7"), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sCatalogNames, new Short(curtabindex++), new Integer(80)});
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(12), "HID:41244", new Short("7"), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sCatalogNames, new Short(curtabindex++), new Integer(80)
+ });
int isel = JavaTools.FieldInList(sCatalogNames, sCatalog);
if (isel < 0)
+ {
isel = 0;
- CurUnoDialog.setControlProperty("lstCatalog", "SelectedItems", new short[]{(short) isel});
- } catch (Exception e) {
+ }
+ CurUnoDialog.setControlProperty("lstCatalog", "SelectedItems", new short[]
+ {
+ (short) isel
+ });
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
nListBoxPosX = 200;
}
}
}
- if (this.curtabledescriptor.xDBMetaData.supportsSchemasInTableDefinitions()){
- if (sSchemaNames != null){
- if (sSchemaNames.length > 0){
+ if (this.curtabledescriptor.xDBMetaData.supportsSchemasInTableDefinitions())
+ {
+ if (sSchemaNames != null)
+ {
+ if (sSchemaNames.length > 0)
+ {
bsupportsSchemata = true;
String sSchema = "";
- try {
+ try
+ {
sSchema = (String) curtabledescriptor.xDataSourcePropertySet.getPropertyValue("User");
- } catch (Exception e1) {
+ }
+ catch (Exception e1)
+ {
e1.printStackTrace(System.out);
}
CurUnoDialog.insertLabel("lblSchema",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] {new Integer(8), slblSchema, new Integer(nListBoxPosX), new Integer(52), IFINALSTEP, new Short(curtabindex++), new Integer(80) });
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblSchema, new Integer(nListBoxPosX), new Integer(52), IFINALSTEP, new Short(curtabindex++), new Integer(80)
+ });
- try {
+ try
+ {
xSchemaListBox = CurUnoDialog.insertListBox("lstSchema", null, null,
- new String[] { "Dropdown", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width" },
- new Object[] { Boolean.TRUE, new Integer(12), "HID:41245", new Short("7"), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sSchemaNames, new Short(curtabindex++), new Integer(80)});
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(12), "HID:41245", new Short("7"), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sSchemaNames, new Short(curtabindex++), new Integer(80)
+ });
int isel = JavaTools.FieldInList(sSchemaNames, sSchema);
if (isel < 0)
+ {
isel = 0;
- CurUnoDialog.setControlProperty("lstSchema", "SelectedItems", new short[]{(short) isel});
- } catch (Exception e){
+ }
+ CurUnoDialog.setControlProperty("lstSchema", "SelectedItems", new short[]
+ {
+ (short) isel
+ });
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
}
}
- if ((!bsupportsCatalogs) && (!bsupportsSchemata)) {
+ if ((!bsupportsCatalogs) && (!bsupportsSchemata))
+ {
CurUnoDialog.insertLabel("lblcongratulations",
- new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(16), sCongratulations, Boolean.TRUE, new Integer(97), new Integer(62),IFINALSTEP, new Short(curtabindex++), new Integer(226)});
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(16), sCongratulations, Boolean.TRUE, new Integer(97), new Integer(62), IFINALSTEP, new Short(curtabindex++), new Integer(226)
+ });
}
- else{
+ else
+ {
ndiffPosY = 10;
}
CurUnoDialog.insertLabel("lblProceed",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(82+ndiffPosY),IFINALSTEP, new Short(curtabindex++), new Integer(227)}
- );
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(82 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), new Integer(227)
+ });
optWorkWithTable = CurUnoDialog.insertRadioButton("optWorkWithTable", null,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], "HID:41242", sWorkWithTable, new Integer(101), new Integer(97+ndiffPosY), new Short((short)1),IFINALSTEP, new Short(curtabindex++), new Integer(177)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41242", sWorkWithTable, new Integer(101), new Integer(97 + ndiffPosY), new Short((short) 1), IFINALSTEP, new Short(curtabindex++), new Integer(177)
+ });
optModifyTable = CurUnoDialog.insertRadioButton("optModifyTable", null,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], "HID:41241", sModifyTable, new Integer(101), new Integer(109+ndiffPosY),IFINALSTEP, new Short(curtabindex++), new Integer(177)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41241", sModifyTable, new Integer(101), new Integer(109 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), new Integer(177)
+ });
optStartFormWizard = CurUnoDialog.insertRadioButton("optStartFormWizard", null,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], "HID:41243", sStartFormWizard, new Integer(101), new Integer(121+ndiffPosY),IFINALSTEP, new Short(curtabindex++), new Integer(177)}
- );
- } catch (SQLException e) {
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41243", sStartFormWizard, new Integer(101), new Integer(121 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), new Integer(177)
+ });
+ }
+ catch (SQLException e)
+ {
e.printStackTrace(System.out);
}
}
- public void initialize(String _firsttablename){
+ public void initialize(String _firsttablename)
+ {
setTableName(_firsttablename);
}
- public int finish(){
+ public int finish()
+ {
if (optWorkWithTable.getState())
+ {
return WORKWITHTABLEMODE;
+ }
else if (optModifyTable.getState())
+ {
return MODIFYTABLEMODE;
+ }
else
+ {
return STARTFORMWIZARDMODE;
+ }
}
-
- public String getComposedTableName(String _stablename){
+ public String getComposedTableName(String _stablename)
+ {
String scatalogname = null;
String sschemaname = null;
if (xCatalogListBox != null)
+ {
scatalogname = xCatalogListBox.getSelectedItem();
+ }
if (xSchemaListBox != null)
+ {
sschemaname = xSchemaListBox.getSelectedItem();
+ }
return curtabledescriptor.getComposedTableName(scatalogname, sschemaname, _stablename);
}
-
- public void setTableName(String _tablename){
- if (txtTableName.getText().equals("")){
+ public void setTableName(String _tablename)
+ {
+ if (txtTableName.getText().equals(""))
+ {
String ssuffix = Desktop.getIncrementSuffix(curtabledescriptor.xTableNames, getComposedTableName(_tablename));
txtTableName.setText(_tablename + ssuffix);
setCompletionFlag();
}
}
-
- public String getTableName(){
+ public String getTableName()
+ {
return txtTableName.getText();
}
- public String getTableName(String _firsttablename){
+ public String getTableName(String _firsttablename)
+ {
if (txtTableName.getText().equals(""))
+ {
setTableName(_firsttablename);
+ }
return txtTableName.getText();
}
-
- public String getSchemaName(){
+ public String getSchemaName()
+ {
if (xSchemaListBox != null)
+ {
return this.xSchemaListBox.getSelectedItem();
+ }
else
+ {
return "";
+ }
}
-
- public String getCatalogName(){
+ public String getCatalogName()
+ {
if (xCatalogListBox != null)
+ {
return this.xCatalogListBox.getSelectedItem();
+ }
else
+ {
return "";
+ }
}
-
- public boolean iscompleted(){
+ public boolean iscompleted()
+ {
return (txtTableName.getText().length() > 0);
}
-
- public void setCompletionFlag(){
+ public void setCompletionFlag()
+ {
CurUnoDialog.setcompleted(TableWizard.SOFINALPAGE, iscompleted());
}
- public void setFocusToTableNameControl(){
+ public void setFocusToTableNameControl()
+ {
CurUnoDialog.setFocus("txtTableName");
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
index f2ab6d10a5b3..2e896ebc3c2d 100644
--- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
+++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -51,8 +51,8 @@ import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.WizardDialog;
import com.sun.star.wizards.ui.XFieldSelectionListener;
-
-public class PrimaryKeyHandler implements XFieldSelectionListener {
+public class PrimaryKeyHandler implements XFieldSelectionListener
+{
TableWizard CurUnoDialog;
short curtabindex;
@@ -66,7 +66,6 @@ public class PrimaryKeyHandler implements XFieldSelectionListener {
XCheckBox chkcreatePrimaryKey;
XCheckBox chkApplyAutoValueExisting;
XCheckBox chkApplyAutoValueAutomatic;
-
XListBox lstSinglePrimeKey;
XFixedText lblPrimeFieldName;
FieldSelection curPrimaryKeySelection;
@@ -76,13 +75,14 @@ public class PrimaryKeyHandler implements XFieldSelectionListener {
boolean bAutoPrimaryKeysupportsAutoIncrmentation;
final String SAUTOMATICKEYFIELDNAME = "ID";
- public PrimaryKeyHandler(TableWizard _CurUnoDialog, TableDescriptor _curTableDescriptor){
+ public PrimaryKeyHandler(TableWizard _CurUnoDialog, TableDescriptor _curTableDescriptor)
+ {
this.CurUnoDialog = _CurUnoDialog;
curTableDescriptor = _curTableDescriptor;
bAutoPrimaryKeysupportsAutoIncrmentation = isAutoPrimeKeyAutoIncrementationsupported();
curtabindex = (short) ((TableWizard.SOPRIMARYKEYPAGE * 100) - 20);
Integer IPRIMEKEYSTEP = new Integer(TableWizard.SOPRIMARYKEYPAGE);
- String sExplanations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 26);
+ String sExplanations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 26);
String screatePrimaryKey = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 27);
String slblPrimeFieldName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 31);
String sApplyAutoValue = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 33);
@@ -92,91 +92,153 @@ public class PrimaryKeyHandler implements XFieldSelectionListener {
String slblAvailableFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 4);
String slblSelPrimaryFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 32);
CurUnoDialog.insertLabel("lblExplanation",
- new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(40), sExplanations, Boolean.TRUE, new Integer(91), new Integer(27),IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(233)}
- );
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(40), sExplanations, Boolean.TRUE, new Integer(91), new Integer(27), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(233)
+ });
chkcreatePrimaryKey = CurUnoDialog.insertCheckBox("chkcreatePrimaryKey", SPRIMEKEYMODE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] {UIConsts.INTEGERS[8], "HID:41227", screatePrimaryKey, new Integer(97), new Integer(70), new Short((short)1), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(160)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41227", screatePrimaryKey, new Integer(97), new Integer(70), new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(160)
+ });
optAddAutomatically = CurUnoDialog.insertRadioButton("optAddAutomatically", SPRIMEKEYMODE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], "HID:41228", sAddAutomatically, new Integer(106), new Integer(82), new Short((short)1),IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41228", sAddAutomatically, new Integer(106), new Integer(82), new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200)
+ });
optUseExisting = CurUnoDialog.insertRadioButton("optUseExisting", SPRIMEKEYMODE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, //94
- new Object[] { UIConsts.INTEGERS[8], "HID:41230", sUseExisting, new Integer(106), new Integer(104),IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ }, //94
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41230", sUseExisting, new Integer(106), new Integer(104), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200)
+ });
optUseSeveral = CurUnoDialog.insertRadioButton("optUseSeveral", SPRIMEKEYMODE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], "HID:41233", sUseSeveral, new Integer(106), new Integer(132),IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41233", sUseSeveral, new Integer(106), new Integer(132), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200)
+ });
chkApplyAutoValueAutomatic = CurUnoDialog.insertCheckBox("chkApplyAutoValueAutomatic", SPRIMEKEYMODE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, //107
- new Object[] {UIConsts.INTEGERS[8], "HID:41229", sApplyAutoValue, new Integer(116), new Integer(92), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(68)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ }, //107
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41229", sApplyAutoValue, new Integer(116), new Integer(92), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(68)
+ });
lblPrimeFieldName = CurUnoDialog.insertLabel("lblPrimeFieldName",
- new String[] {"Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.FALSE, UIConsts.INTEGERS[8], slblPrimeFieldName, new Integer(116), new Integer(117), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(46)}
- );
+ new String[]
+ {
+ "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, UIConsts.INTEGERS[8], slblPrimeFieldName, new Integer(116), new Integer(117), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(46)
+ });
lstSinglePrimeKey = CurUnoDialog.insertListBox("lstSinglePrimeKey", "onPrimeKeySelected", null, this,
- new String[] {"Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {Boolean.TRUE, Boolean.FALSE, new Integer(12), "HID:41231", new Integer(162), new Integer(115), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(80)});
+ new String[]
+ {
+ "Dropdown", "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, Boolean.FALSE, new Integer(12), "HID:41231", new Integer(162), new Integer(115), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(80)
+ });
chkApplyAutoValueExisting = CurUnoDialog.insertCheckBox("chkApplyAutoValueExisting", SPRIMEKEYMODE, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"}, //107
- new Object[] {UIConsts.INTEGERS[8], "HID:41232", sApplyAutoValue, new Integer(248), new Integer(117), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(66)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ }, //107
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41232", sApplyAutoValue, new Integer(248), new Integer(117), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(66)
+ });
curPrimaryKeySelection = new FieldSelection(CurUnoDialog, IPRIMEKEYSTEP.intValue(), 116, 142, 208, 47, slblAvailableFields, slblSelPrimaryFields, 41234, false);
curPrimaryKeySelection.addFieldSelectionListener(this);
}
-
- public void initialize(){
+ public void initialize()
+ {
boolean breselect;
fieldnames = curTableDescriptor.getNonBinaryFieldNames();
String[] skeyfieldnames = curPrimaryKeySelection.getSelectedFieldNames();
curPrimaryKeySelection.initialize(fieldnames, false);
- if (skeyfieldnames != null){
- if (skeyfieldnames.length > 0){
+ if (skeyfieldnames != null)
+ {
+ if (skeyfieldnames.length > 0)
+ {
String[] snewkeyfieldnames = JavaTools.removeOutdatedFields(skeyfieldnames, fieldnames);
curPrimaryKeySelection.setSelectedFieldNames(snewkeyfieldnames);
}
}
String selfield = lstSinglePrimeKey.getSelectedItem();
Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), "StringItemList", fieldnames);
- if ( selfield != null){
+ if (selfield != null)
+ {
if (JavaTools.FieldInList(fieldnames, selfield) > -1)
+ {
lstSinglePrimeKey.selectItem(selfield, true);
+ }
}
togglePrimeKeyFields();
}
-
- private boolean isAutoPrimeKeyAutoIncrementationsupported(){
+ private boolean isAutoPrimeKeyAutoIncrementationsupported()
+ {
TypeInspector.TypeInfo aAutoPrimeTypeInfo;
aAutoPrimeTypeInfo = curTableDescriptor.oTypeInspector.findAutomaticPrimaryKeyType();
return aAutoPrimeTypeInfo.bisAutoIncrementable;
}
- public boolean iscompleted(){
+ public boolean iscompleted()
+ {
if (chkcreatePrimaryKey.getState() == 0)
+ {
return true;
+ }
if (this.optAddAutomatically.getState())
+ {
return true;
- if (optUseExisting.getState()){
+ }
+ if (optUseExisting.getState())
+ {
fieldnames = curTableDescriptor.getNonBinaryFieldNames();
String selfield = lstSinglePrimeKey.getSelectedItem();
- if ( selfield != null){
+ if (selfield != null)
+ {
return (JavaTools.FieldInList(fieldnames, selfield) > -1);
}
}
- if (optUseSeveral.getState()){
+ if (optUseSeveral.getState())
+ {
fieldnames = curTableDescriptor.getNonBinaryFieldNames();
String[] skeyfieldnames = curPrimaryKeySelection.getSelectedFieldNames();
String[] snewkeyfieldnames = JavaTools.removeOutdatedFields(skeyfieldnames, fieldnames);
@@ -185,7 +247,8 @@ public class PrimaryKeyHandler implements XFieldSelectionListener {
return false;
}
- public void togglePrimeKeyFields(){
+ public void togglePrimeKeyFields()
+ {
boolean bdoEnable = (this.chkcreatePrimaryKey.getState() == 1);
Helper.setUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), "Enabled", new Boolean(bdoEnable));
Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), "Enabled", new Boolean(bAutoPrimaryKeysupportsAutoIncrmentation && bdoEnable));
@@ -199,86 +262,122 @@ public class PrimaryKeyHandler implements XFieldSelectionListener {
curPrimaryKeySelection.toggleListboxControls(new Boolean(benableSeveralPrimekeyControls));
// toggle the following steps of the dialog...
if (!bdoEnable)
+ {
CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, true);
- else{
+ }
+ else
+ {
if (benableSeveralPrimekeyControls)
+ {
CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, (curPrimaryKeySelection.getSelectedFieldNames().length > 0));
+ }
else if (benableSinglePrimekeyControls)
+ {
CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, UnoDialog.isListBoxSelected(lstSinglePrimeKey)); //.getSelectedItemPos() != -1);
+ }
else if (optAddAutomatically.getState())
+ {
CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, true);
+ }
}
}
-
- private boolean isAutoIncrementatable(String _fieldname){
- boolean bisAutoIncrementable = false;
- try {
- XPropertySet xColPropertySet = curTableDescriptor.getByName(_fieldname);
- if (xColPropertySet != null){
- if (curTableDescriptor.getDBDataTypeInspector() != null)
- return curTableDescriptor.getDBDataTypeInspector().isAutoIncrementable(xColPropertySet);
+ private boolean isAutoIncrementatable(String _fieldname)
+ {
+ boolean bisAutoIncrementable = false;
+ try
+ {
+ XPropertySet xColPropertySet = curTableDescriptor.getByName(_fieldname);
+ if (xColPropertySet != null)
+ {
+ if (curTableDescriptor.getDBDataTypeInspector() != null)
+ {
+ return curTableDescriptor.getDBDataTypeInspector().isAutoIncrementable(xColPropertySet);
+ }
+ }
}
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return false;
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return false;
}
- public boolean isAutomaticMode(){
+ public boolean isAutomaticMode()
+ {
boolean bisAutomaticMode = false;
- if (chkcreatePrimaryKey.getState() == 1){
- bisAutomaticMode = ((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), "State")).shortValue() == (short) 1;
+ if (chkcreatePrimaryKey.getState() == 1)
+ {
+ bisAutomaticMode = ((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), "State")).shortValue() == (short) 1;
}
return bisAutomaticMode;
}
- public String getAutomaticFieldName(){
- return SAUTOMATICKEYFIELDNAME;
+ public String getAutomaticFieldName()
+ {
+ return SAUTOMATICKEYFIELDNAME;
}
-
- public boolean isAutoIncremented(){
- boolean bischecked = false;
- if (chkcreatePrimaryKey.getState() == 1){
- boolean bisAutomaticMode = ((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), "State")).shortValue() == (short) 1;
- boolean bisExistingMode = ((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(optUseExisting), "State")).shortValue() == (short) 1;
- if (bisAutomaticMode)
- bischecked = chkApplyAutoValueAutomatic.getState() == (short)1;
- else if (bisExistingMode)
- bischecked = chkApplyAutoValueExisting.getState() == (short)1;
+ public boolean isAutoIncremented()
+ {
+ boolean bischecked = false;
+ if (chkcreatePrimaryKey.getState() == 1)
+ {
+ boolean bisAutomaticMode = ((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), "State")).shortValue() == (short) 1;
+ boolean bisExistingMode = ((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(optUseExisting), "State")).shortValue() == (short) 1;
+ if (bisAutomaticMode)
+ {
+ bischecked = chkApplyAutoValueAutomatic.getState() == (short) 1;
+ }
+ else if (bisExistingMode)
+ {
+ bischecked = chkApplyAutoValueExisting.getState() == (short) 1;
+ }
+ }
+ return bischecked;
}
- return bischecked;
+
+ public void onPrimeKeySelected()
+ {
+ try
+ {
+ String selfieldname = lstSinglePrimeKey.getSelectedItem();
+ boolean bdoenable = isAutoIncrementatable(selfieldname);
+ CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, lstSinglePrimeKey.getSelectedItemPos() != -1);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), "Enabled", new Boolean(bdoenable));
+ XPropertySet xColPropertySet = curTableDescriptor.getByName(selfieldname);
+ boolean bIsAutoIncremented = ((Boolean) xColPropertySet.getPropertyValue("IsAutoIncrement")).booleanValue();
+ if (bIsAutoIncremented)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), "State", new Short((short) 1));
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), "State", new Short((short) 0));
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
}
+ private void toggleAutomaticAutoValueCheckBox()
+ {
+ try
+ {
+ boolean bisAutomaticMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), "Enabled"));
+ boolean bdoenable = bAutoPrimaryKeysupportsAutoIncrmentation && optAddAutomatically.getState() && bisAutomaticMode;
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), "Enabled", new Boolean(bdoenable));
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public void onPrimeKeySelected(){
- try {
- String selfieldname = lstSinglePrimeKey.getSelectedItem();
- boolean bdoenable = isAutoIncrementatable(selfieldname);
- CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, lstSinglePrimeKey.getSelectedItemPos() != -1);
- Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), "Enabled", new Boolean(bdoenable));
- XPropertySet xColPropertySet = curTableDescriptor.getByName(selfieldname);
- boolean bIsAutoIncremented = ((Boolean) xColPropertySet.getPropertyValue("IsAutoIncrement")).booleanValue();
- if (bIsAutoIncremented)
- Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), "State", new Short((short) 1));
- else
- Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), "State", new Short((short) 0));
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- private void toggleAutomaticAutoValueCheckBox(){
- try {
- boolean bisAutomaticMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), "Enabled"));
- boolean bdoenable = bAutoPrimaryKeysupportsAutoIncrmentation && optAddAutomatically.getState() && bisAutomaticMode;
- Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), "Enabled", new Boolean(bdoenable));
- } catch (IllegalArgumentException e) {
- e.printStackTrace(System.out);
- }}
-
- private void toggleSinglePrimeKeyFields(boolean _bdoenable){
+ private void toggleSinglePrimeKeyFields(boolean _bdoenable)
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(lblPrimeFieldName), "Enabled", new Boolean(_bdoenable));
Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), "Enabled", new Boolean(_bdoenable));
Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), "Enabled", new Boolean(_bdoenable));
@@ -286,51 +385,67 @@ public class PrimaryKeyHandler implements XFieldSelectionListener {
Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), "Enabled", new Boolean(bdoenableAutoValueCheckBox));
}
-
- private void toggleSeveralPrimeKeyFields(){
+ private void toggleSeveralPrimeKeyFields()
+ {
boolean bdoEnable = (this.optUseSeveral.getState());
curPrimaryKeySelection.toggleListboxControls(new Boolean(bdoEnable));
}
-
- public String[] getPrimaryKeyFields(TableDescriptor _curtabledescriptor){
- if (chkcreatePrimaryKey.getState() == 0){
+ public String[] getPrimaryKeyFields(TableDescriptor _curtabledescriptor)
+ {
+ if (chkcreatePrimaryKey.getState() == 0)
+ {
return null;
}
if (fieldnames == null)
+ {
initialize();
+ }
if (optUseSeveral.getState())
+ {
return curPrimaryKeySelection.getSelectedFieldNames();
+ }
else if (optUseExisting.getState())
- return (new String[]{lstSinglePrimeKey.getSelectedItem()});
- else if (optAddAutomatically.getState()){
- return (new String[]{SAUTOMATICKEYFIELDNAME});
+ {
+ return (new String[]
+ {
+ lstSinglePrimeKey.getSelectedItem()
+ });
+ }
+ else if (optAddAutomatically.getState())
+ {
+ return (new String[]
+ {
+ SAUTOMATICKEYFIELDNAME
+ });
}
return null;
}
-
- public int getID() {
+ public int getID()
+ {
return 0;
}
- public void moveItemDown(String Selitem) {
-
+ public void moveItemDown(String Selitem)
+ {
}
- public void moveItemUp(String Selitem) {
-
+ public void moveItemUp(String Selitem)
+ {
}
- public void setID(String sIncSuffix) {
-
+ public void setID(String sIncSuffix)
+ {
}
- public void shiftFromLeftToRight(String[] SelItems, String[] NewItems) {
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, (curPrimaryKeySelection.getSelectedFieldNames().length > 0));
}
- public void shiftFromRightToLeft(String[] OldSelItems, String[] NewItems) {
+ public void shiftFromRightToLeft(String[] OldSelItems, String[] NewItems)
+ {
CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, (curPrimaryKeySelection.getSelectedFieldNames().length > 0));
}
}
diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
index 9c0fd48a1074..90702e74c65d 100644
--- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java
+++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.table;
+ ************************************************************************/
+package com.sun.star.wizards.table;
import java.util.Hashtable;
import java.util.Vector;
@@ -57,14 +58,14 @@ import com.sun.star.wizards.ui.UnoDialog;
import com.sun.star.wizards.ui.WizardDialog;
import com.sun.star.wizards.ui.XFieldSelectionListener;
-
/**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
-public class ScenarioSelector extends FieldSelection implements XItemListener, XFieldSelectionListener{
+public class ScenarioSelector extends FieldSelection implements XItemListener, XFieldSelectionListener
+{
XFixedText lblExplanation;
XFixedText lblCategories;
@@ -84,108 +85,163 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
Locale aLocale;
XMultiServiceFactory xMSF;
- public ScenarioSelector(TableWizard _CurUnoDialog, TableDescriptor _curtabledescriptor, String _reslblFields, String _reslblSelFields) {
- super(_CurUnoDialog, TableWizard.SOMAINPAGE, 91, 108, 230, 80, _reslblFields, _reslblSelFields, 41209, true );
+ public ScenarioSelector(TableWizard _CurUnoDialog, TableDescriptor _curtabledescriptor, String _reslblFields, String _reslblSelFields)
+ {
+ super(_CurUnoDialog, TableWizard.SOMAINPAGE, 91, 108, 230, 80, _reslblFields, _reslblSelFields, 41209, true);
CurUnoDialog = (TableWizard) _CurUnoDialog;
xMSF = CurUnoDialog.xMSF;
aLocale = Configuration.getOfficeLocale(xMSF);
curtabledescriptor = _curtabledescriptor;
imaxcolumnchars = this.curtabledescriptor.getMaxColumnNameLength();
bcolumnnameislimited = (imaxcolumnchars > 0) && (imaxcolumnchars < 16);
- addFieldSelectionListener( this);
+ addFieldSelectionListener(this);
short pretabindex = (short) (50);
String sExplanation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 14);
String sCategories = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 15);
- String sBusiness = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 16);
- String sPrivate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 17);
+ String sBusiness = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 16);
+ String sPrivate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 17);
String sTableNames = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 18);
smytable = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 44);
Integer IMAINSTEP = new Integer(TableWizard.SOMAINPAGE);
oCGCategory = new CGCategory(CurUnoDialog.xMSF);
oCGTable = new CGTable(CurUnoDialog.xMSF);
lblExplanation = CurUnoDialog.insertLabel("lblScenarioExplanation",
- new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {new Integer(32), sExplanation, Boolean.TRUE, new Integer(91), new Integer(27), IMAINSTEP, new Short(pretabindex++), new Integer(233)}
- );
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(32), sExplanation, Boolean.TRUE, new Integer(91), new Integer(27), IMAINSTEP, new Short(pretabindex++), new Integer(233)
+ });
lblCategories = CurUnoDialog.insertLabel("lblCategories",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {new Integer(8), sCategories, new Integer(91), new Integer(60), IMAINSTEP, new Short(pretabindex++), new Integer(100)}
- );
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), sCategories, new Integer(91), new Integer(60), IMAINSTEP, new Short(pretabindex++), new Integer(100)
+ });
optBusiness = CurUnoDialog.insertRadioButton("optBusiness", SELECTCATEGORY, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], "HID:41206", sBusiness, new Integer(98), new Integer(70), new Short((short)1),IMAINSTEP, new Short(pretabindex++), new Integer(78)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41206", sBusiness, new Integer(98), new Integer(70), new Short((short) 1), IMAINSTEP, new Short(pretabindex++), new Integer(78)
+ });
optPrivate = CurUnoDialog.insertRadioButton("optPrivate", SELECTCATEGORY, this,
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { UIConsts.INTEGERS[8], "HID:41207", sPrivate, new Integer(182), new Integer(70),IMAINSTEP, new Short(pretabindex++), new Integer(90)}
- );
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8], "HID:41207", sPrivate, new Integer(182), new Integer(70), IMAINSTEP, new Short(pretabindex++), new Integer(90)
+ });
CurUnoDialog.insertLabel("lblTableNames",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] {new Integer(8), sTableNames, new Integer(91), new Integer(82), IMAINSTEP, new Short(pretabindex++), new Integer(80) });
-
- try {
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), sTableNames, new Integer(91), new Integer(82), IMAINSTEP, new Short(pretabindex++), new Integer(80)
+ });
+
+ try
+ {
xTableListBox = CurUnoDialog.insertListBox("lstTableNames", 3, null, this,
- new String[] { "Dropdown", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { Boolean.TRUE, new Integer(12), "HID:41208", new Short("7"), new Integer(91), new Integer(92), IMAINSTEP, new Short(pretabindex++), getListboxWidth()});
- } catch (Exception e) {
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(12), "HID:41208", new Short("7"), new Integer(91), new Integer(92), IMAINSTEP, new Short(pretabindex++), getListboxWidth()
+ });
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
initializeCategory(0);
}
-
- public int getCategory(){
+ public int getCategory()
+ {
if (optBusiness.getState())
+ {
curcategory = 0;
+ }
else
+ {
curcategory = 1;
+ }
return curcategory;
}
-
- public void selectCategory(){
+ public void selectCategory()
+ {
if (optBusiness.getState())
+ {
initializeCategory(0);
+ }
else
+ {
initializeCategory(1);
+ }
}
+ public void initializeCategory(int _iCategory)
+ {
+ try
+ {
+ oCGCategory.initialize(_iCategory);
+ xTableListBox.removeItems((short) 0, xTableListBox.getItemCount());
+ xTableListBox.addItems(oCGCategory.getTableNames(), (short) _iCategory);
+ initializeTable(0);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- public void initializeCategory(int _iCategory){
- try {
- oCGCategory.initialize(_iCategory);
- xTableListBox.removeItems((short) 0, xTableListBox.getItemCount());
- xTableListBox.addItems(oCGCategory.getTableNames(),(short) _iCategory);
- initializeTable(0);
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
-
- public void initializeTable(int _iTable){
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]{(short)_iTable});
+ public void initializeTable(int _iTable)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]
+ {
+ (short) _iTable
+ });
oCGTable.initialize(oCGCategory.xNameAccessTablesNode, _iTable);
super.initialize(oCGTable.getFieldNames(bcolumnnameislimited, imaxcolumnchars), true);
}
-
- public String[] getSelectedFieldNames(){
+ public String[] getSelectedFieldNames()
+ {
String[] displayfieldnames = super.getSelectedFieldNames();
Vector afieldnameVector = new Vector();
int a = 0;
- for (int i = 0; i < displayfieldnames.length; i++){
- try {
+ for (int i = 0; i < displayfieldnames.length; i++)
+ {
+ try
+ {
FieldDescription ofielddescription = (FieldDescription) CurUnoDialog.fielditems.get(displayfieldnames[i]);
- if (ofielddescription != null){
+ if (ofielddescription != null)
+ {
afieldnameVector.addElement(ofielddescription.getName());
a++;
}
- } catch (RuntimeException e) {
+ }
+ catch (RuntimeException e)
+ {
e.printStackTrace(System.out);
}
}
@@ -194,56 +250,69 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
return fieldnames;
}
-
- public boolean iscompleted(){
+ public boolean iscompleted()
+ {
return getSelectedFieldNames().length > 0;
}
-
- public void addColumnsToDescriptor(){
+ public void addColumnsToDescriptor()
+ {
XNameAccess xNameAccessFieldNode;
String[] fieldnames = getSelectedFieldNames();
- for (int i = 0; i < fieldnames.length; i++){
- try {
+ for (int i = 0; i < fieldnames.length; i++)
+ {
+ try
+ {
FieldDescription curfielddescription = (FieldDescription) CurUnoDialog.fielditems.get(fieldnames[i]);
PropertyValue[] aProperties = curfielddescription.getPropertyValues();
this.curtabledescriptor.addColumn(aProperties);
- } catch (RuntimeException e) {
+ }
+ catch (RuntimeException e)
+ {
e.printStackTrace(System.out);
}
}
}
-
- public String getTableName(){
+ public String getTableName()
+ {
return xTableListBox.getSelectedItem();
}
-
- public String getFirstTableName(){
+ public String getFirstTableName()
+ {
String[] fieldnames = super.getSelectedFieldNames();
- if ((fieldnames.length) > 0){
- for (int i = 0; i < CurUnoDialog.fielditems.size(); i++){
+ if ((fieldnames.length) > 0)
+ {
+ for (int i = 0; i < CurUnoDialog.fielditems.size(); i++)
+ {
String stablename = "";
- try {
+ try
+ {
FieldDescription ofielddescription = (FieldDescription) CurUnoDialog.fielditems.get(fieldnames[i]);
stablename = ofielddescription.gettablename();
- } catch (RuntimeException e) {
+ }
+ catch (RuntimeException e)
+ {
e.printStackTrace(System.out);
}
if (!stablename.equals(""))
+ {
return stablename;
+ }
}
}
return smytable;
}
- public void fillupTables(){
+ public void fillupTables()
+ {
// if (optBusiness.getState())
// else
}
- public void fillupFieldsListbox(){
+ public void fillupFieldsListbox()
+ {
super.emptyFieldsListBoxes();
}
@@ -251,30 +320,34 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
/* (non-Javadoc)
* @see com.sun.star.awt.XItemListener#itemStateChanged(com.sun.star.awt.ItemEvent)
*/
- public void itemStateChanged(ItemEvent arg0) {
+ public void itemStateChanged(ItemEvent arg0)
+ {
initializeTable((int) xTableListBox.getSelectedItemPos());
}
/* (non-Javadoc)
* @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
*/
- public void disposing(EventObject arg0) {
+ public void disposing(EventObject arg0)
+ {
}
+ protected int ID;
+ public int getID()
+ {
+ return ID;
+ }
- protected int ID;
-
- public int getID(){
- return ID;
- }
-
- public void setID(String sIncSuffix){
- }
-
+ public void setID(String sIncSuffix)
+ {
+ }
- public void shiftFromLeftToRight(String[] SelItems, String[] NewItems) {
- if (!CurUnoDialog.verifyfieldcount(NewItems.length)){
- for (int i = 0; i < SelItems.length; i++){
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (!CurUnoDialog.verifyfieldcount(NewItems.length))
+ {
+ for (int i = 0; i < SelItems.length; i++)
+ {
int selindex = JavaTools.FieldInList(NewItems, SelItems[i]);
super.xSelFieldsListBox.removeItems((short) selindex, (short) 1);
/**TODO In this context the items should be better placed at their original position.
@@ -283,12 +356,16 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
super.xFieldsListBox.addItem(SelItems[i], xFieldsListBox.getItemCount());
}
}
- else{
- for (int i = 0; i < NewItems.length; i++){
+ else
+ {
+ for (int i = 0; i < NewItems.length; i++)
+ {
int iduplicate;
- if (CurUnoDialog.fielditems.containsKey(NewItems[i])){
+ if (CurUnoDialog.fielditems.containsKey(NewItems[i]))
+ {
iduplicate = JavaTools.getDuplicateFieldIndex(NewItems, NewItems[i]);
- if (iduplicate != -1){
+ if (iduplicate != -1)
+ {
XNameAccess xNameAccessFieldNode;
String sdisplayname = Desktop.getUniqueName(NewItems, NewItems[iduplicate], "");
FieldDescription curfielddescription = new FieldDescription(xMSF, aLocale, this, sdisplayname, NewItems[iduplicate], imaxcolumnchars);
@@ -298,27 +375,32 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
}
}
else
+ {
CurUnoDialog.fielditems.put(NewItems[i], new FieldDescription(xMSF, aLocale, this, NewItems[i], NewItems[i], imaxcolumnchars));
+ }
}
}
CurUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0);
- }
-
-
+ }
- public void shiftFromRightToLeft(String[] SelItems, String[] NewItems ) {
- for (int i = 0; i < SelItems.length; i++){
- if (CurUnoDialog.fielditems.containsKey(SelItems[i])){
+ public void shiftFromRightToLeft(String[] SelItems, String[] NewItems)
+ {
+ for (int i = 0; i < SelItems.length; i++)
+ {
+ if (CurUnoDialog.fielditems.containsKey(SelItems[i]))
+ {
CurUnoDialog.fielditems.remove(SelItems[i]);
this.curtabledescriptor.dropColumnbyName(SelItems[i]);
}
}
CurUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0);
- }
+ }
- public void moveItemDown(String item){
- }
+ public void moveItemDown(String item)
+ {
+ }
- public void moveItemUp(String item){
- }
+ public void moveItemUp(String item)
+ {
+ }
}
diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java
index 302ff8dd221d..624eb0473074 100644
--- a/wizards/com/sun/star/wizards/table/TableWizard.java
+++ b/wizards/com/sun/star/wizards/table/TableWizard.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -48,8 +48,8 @@ import com.sun.star.wizards.common.*;
import com.sun.star.wizards.db.TableDescriptor;
import com.sun.star.wizards.ui.*;
-
-public class TableWizard extends WizardDialog implements XTextListener, XCompletion{
+public class TableWizard extends WizardDialog implements XTextListener, XCompletion
+{
static String slblFields;
static String slblSelFields;
@@ -73,26 +73,35 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet
private String sMsgColumnAlreadyExists = "";
XComponent[] components = null;
XFrame CurFrame;
-
String WizardHeaderText[] = new String[8];
- public TableWizard(XMultiServiceFactory xMSF) {
+ public TableWizard(XMultiServiceFactory xMSF)
+ {
super(xMSF, 41200);
super.addResourceHandler("TableWizard", "dbw");
String sTitle = m_oResource.getResText(UIConsts.RID_TABLE + 1);
Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Height","Moveable","Name","PositionX","PositionY","Step","TabIndex","Title","Width"},
- new Object[] { new Integer(218),Boolean.TRUE, "DialogTable", new Integer(102),new Integer(41),new Integer(1), new Short((short)0), sTitle, new Integer(330)} );
+ new String[]
+ {
+ "Height", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width"
+ },
+ new Object[]
+ {
+ new Integer(218), Boolean.TRUE, "DialogTable", new Integer(102), new Integer(41), new Integer(1), new Short((short) 0), sTitle, new Integer(330)
+ });
drawNaviBar();
fielditems = new Hashtable();
//TODO if reportResouces cannot be gotten dispose officedocument
if (getTableResources() == true)
+ {
setRightPaneHeaders(m_oResource, UIConsts.RID_TABLE + 8, 4);
+ }
}
-
- protected void leaveStep(int nOldStep, int nNewStep){
- switch (nOldStep){
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+ switch (nOldStep)
+ {
case SOMAINPAGE:
curScenarioSelector.addColumnsToDescriptor();
break;
@@ -108,12 +117,13 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet
break;
default:
break;
- }
+ }
}
-
- protected void enterStep(int nOldStep, int nNewStep) {
- switch (nNewStep){
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ switch (nNewStep)
+ {
case SOMAINPAGE:
break;
case SOFIELDSFORMATPAGE:
@@ -134,15 +144,19 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#iscompleted(int)
*/
- public boolean iscompleted(int _ndialogpage) {
- switch (_ndialogpage){
+ public boolean iscompleted(int _ndialogpage)
+ {
+ switch (_ndialogpage)
+ {
case SOMAINPAGE:
return curScenarioSelector.iscompleted();
case SOFIELDSFORMATPAGE:
return this.curFieldFormatter.iscompleted();
case SOPRIMARYKEYPAGE:
if (curPrimaryKeyHandler != null)
+ {
return this.curPrimaryKeyHandler.iscompleted();
+ }
case SOFINALPAGE:
return this.curFinalizer.iscompleted();
default:
@@ -154,183 +168,236 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean)
*/
- public void setcompleted(int _ndialogpage, boolean _biscompleted) {
+ public void setcompleted(int _ndialogpage, boolean _biscompleted)
+ {
boolean bScenarioiscompleted = _biscompleted;
boolean bFieldFormatsiscompleted = _biscompleted;
boolean bPrimaryKeysiscompleted = _biscompleted;
boolean bFinalPageiscompleted = _biscompleted;
if (_ndialogpage == SOMAINPAGE)
+ {
curFinalizer.initialize(curScenarioSelector.getFirstTableName());
+ }
else
+ {
bScenarioiscompleted = iscompleted(SOMAINPAGE);
-
- if (_ndialogpage != TableWizard.SOFIELDSFORMATPAGE){
+ }
+ if (_ndialogpage != TableWizard.SOFIELDSFORMATPAGE)
+ {
bFieldFormatsiscompleted = iscompleted(SOFIELDSFORMATPAGE);
if (!bFieldFormatsiscompleted) // it might be that the Fieldformatter has not yet been initialized
+ {
bFieldFormatsiscompleted = bScenarioiscompleted; // in this case query the scenarioselector
+ }
}
if (_ndialogpage != TableWizard.SOPRIMARYKEYPAGE && (this.curPrimaryKeyHandler != null))
+ {
bPrimaryKeysiscompleted = iscompleted(SOPRIMARYKEYPAGE);
+ }
if (_ndialogpage != TableWizard.SOFINALPAGE)
+ {
bFinalPageiscompleted = iscompleted(SOFINALPAGE); // Basically the finalpage is always enabled
- if (bScenarioiscompleted){
+ }
+ if (bScenarioiscompleted)
+ {
super.setStepEnabled(SOFIELDSFORMATPAGE, true);
super.setStepEnabled(SOPRIMARYKEYPAGE, true);
- if (bPrimaryKeysiscompleted){
+ if (bPrimaryKeysiscompleted)
+ {
super.enablefromStep(SOFINALPAGE, true);
super.enableFinishButton(bFinalPageiscompleted);
}
- else{
+ else
+ {
super.enablefromStep(SOFINALPAGE, false);
enableNextButton(false);
}
}
+ else if (_ndialogpage == SOFIELDSFORMATPAGE)
+ {
+ super.enablefromStep(super.getCurrentStep() + 1, iscompleted(SOFIELDSFORMATPAGE));
+ }
else
- if (_ndialogpage == SOFIELDSFORMATPAGE)
- super.enablefromStep(super.getCurrentStep()+1, iscompleted(SOFIELDSFORMATPAGE));
- else
- super.enablefromStep(super.getCurrentStep()+1, false);
+ {
+ super.enablefromStep(super.getCurrentStep() + 1, false);
+ }
}
-
- public static void main(String args[]) {
- String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
- PropertyValue[] curproperties = null;
- try {
- XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
- TableWizard CurTableWizard = new TableWizard(xLocMSF);
- if(xLocMSF != null){
- System.out.println("Connected to "+ ConnectStr);
- curproperties = new PropertyValue[1];
- curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
- //curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///path/to/database.odb");
- CurTableWizard.startTableWizard(xLocMSF, curproperties);
+ public static void main(String args[])
+ {
+ String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
+ PropertyValue[] curproperties = null;
+ try
+ {
+ XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
+ TableWizard CurTableWizard = new TableWizard(xLocMSF);
+ if (xLocMSF != null)
+ {
+ System.out.println("Connected to " + ConnectStr);
+ curproperties = new PropertyValue[1];
+ curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
+ //curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///path/to/database.odb");
+ CurTableWizard.startTableWizard(xLocMSF, curproperties);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
}
}
- catch(Exception exception){
- exception.printStackTrace(System.out);
- }}
-
- public void buildSteps(){
+ public void buildSteps()
+ {
curScenarioSelector = new ScenarioSelector(this, this.curTableDescriptor, slblFields, slblSelFields);
- curFieldFormatter = new FieldFormatter(this, curTableDescriptor );
+ curFieldFormatter = new FieldFormatter(this, curTableDescriptor);
if (this.curTableDescriptor.supportsCoreSQLGrammar())
+ {
curPrimaryKeyHandler = new PrimaryKeyHandler(this, curTableDescriptor);
+ }
curFinalizer = new Finalizer(this, curTableDescriptor);
enableNavigationButtons(false, false, false);
}
-
- public boolean createTable(){
+ public boolean createTable()
+ {
boolean bIsSuccessfull = true;
boolean bTableCreated = false;
String schemaname = curFinalizer.getSchemaName();
String catalogname = curFinalizer.getCatalogName();
- if (curTableDescriptor.supportsCoreSQLGrammar()){
+ if (curTableDescriptor.supportsCoreSQLGrammar())
+ {
String[] keyfieldnames = curPrimaryKeyHandler.getPrimaryKeyFields(curTableDescriptor);
- if (keyfieldnames != null){
- if (keyfieldnames.length > 0){
+ if (keyfieldnames != null)
+ {
+ if (keyfieldnames.length > 0)
+ {
boolean bIsAutoIncrement = curPrimaryKeyHandler.isAutoIncremented();
bIsSuccessfull = curTableDescriptor.createTable(catalogname, schemaname, tablename, keyfieldnames, bIsAutoIncrement, curScenarioSelector.getSelectedFieldNames());
bTableCreated = true;
}
}
}
- if (!bTableCreated){
+ if (!bTableCreated)
+ {
bIsSuccessfull = curTableDescriptor.createTable(catalogname, schemaname, tablename, curScenarioSelector.getSelectedFieldNames());
}
- if ((!bIsSuccessfull) && (curPrimaryKeyHandler.isAutomaticMode())){
- curTableDescriptor.dropColumnbyName(curPrimaryKeyHandler.getAutomaticFieldName());
+ if ((!bIsSuccessfull) && (curPrimaryKeyHandler.isAutomaticMode()))
+ {
+ curTableDescriptor.dropColumnbyName(curPrimaryKeyHandler.getAutomaticFieldName());
}
return bIsSuccessfull;
}
-
- public void finishWizard(){
+ public void finishWizard()
+ {
super.switchToStep(super.getCurrentStep(), SOFINALPAGE);
tablename = curFinalizer.getTableName(curScenarioSelector.getFirstTableName());
scomposedtablename = curFinalizer.getComposedTableName(tablename);
if (this.curTableDescriptor.isSQL92CheckEnabled())
+ {
Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getOfficeLocale(this.curTableDescriptor.xMSF), tablename);
- if (tablename != ""){
- if (!curTableDescriptor.hasTableByName(scomposedtablename)){
+ }
+ if (tablename != "")
+ {
+ if (!curTableDescriptor.hasTableByName(scomposedtablename))
+ {
wizardmode = curFinalizer.finish();
- if (createTable()){
+ if (createTable())
+ {
if (wizardmode == Finalizer.MODIFYTABLEMODE)
- components = curTableDescriptor.switchtoDesignmode(curTableDescriptor.getComposedTableName(), com.sun.star.sdb.CommandType.TABLE,CurFrame);
+ {
+ components = curTableDescriptor.switchtoDesignmode(curTableDescriptor.getComposedTableName(), com.sun.star.sdb.CommandType.TABLE, CurFrame);
+ }
else if (wizardmode == Finalizer.WORKWITHTABLEMODE)
- components = curTableDescriptor.switchtoDataViewmode(curTableDescriptor.getComposedTableName(), com.sun.star.sdb.CommandType.TABLE,CurFrame);
+ {
+ components = curTableDescriptor.switchtoDataViewmode(curTableDescriptor.getComposedTableName(), com.sun.star.sdb.CommandType.TABLE, CurFrame);
+ }
super.xDialog.endExecute();
}
}
- else{
+ else
+ {
String smessage = JavaTools.replaceSubString(serrTableNameexists, tablename, "%TABLENAME");
- super.showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage );
+ super.showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage);
curFinalizer.setFocusToTableNameControl();
}
}
}
+ private void callFormWizard()
+ {
+ try
+ {
+ Object oFormWizard = this.xMSF.createInstance("com.sun.star.wizards.form.CallFormWizard");
+ PropertyValue[] aProperties = new PropertyValue[4];
+ aProperties[0] = Properties.createProperty("ActiveConnection", curTableDescriptor.DBConnection);
+ aProperties[1] = Properties.createProperty("DataSource", curTableDescriptor.xDataSource);
+ aProperties[2] = Properties.createProperty("CommandType", new Integer(CommandType.TABLE));
+ aProperties[3] = Properties.createProperty("Command", scomposedtablename);
+ XInitialization xInitialization = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oFormWizard);
+ xInitialization.initialize(aProperties);
+ XJobExecutor xJobExecutor = (XJobExecutor) UnoRuntime.queryInterface(XJobExecutor.class, oFormWizard);
+ xJobExecutor.trigger("start");
+ XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xJobExecutor);
+ components[0] = (XComponent) prop.getPropertyValue("Document");
+ components[1] = (XComponent) prop.getPropertyValue("DocumentDefinition");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
- private void callFormWizard(){
- try {
- Object oFormWizard = this.xMSF.createInstance("com.sun.star.wizards.form.CallFormWizard");
- PropertyValue[] aProperties = new PropertyValue[4];
- aProperties[0] = Properties.createProperty("ActiveConnection", curTableDescriptor.DBConnection);
- aProperties[1] = Properties.createProperty("DataSource", curTableDescriptor.xDataSource);
- aProperties[2] = Properties.createProperty("CommandType", new Integer(CommandType.TABLE));
- aProperties[3] = Properties.createProperty("Command", scomposedtablename);
- XInitialization xInitialization = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, oFormWizard);
- xInitialization.initialize(aProperties);
- XJobExecutor xJobExecutor = (XJobExecutor) UnoRuntime.queryInterface(XJobExecutor.class, oFormWizard);
- xJobExecutor.trigger("start");
- XPropertySet prop = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,xJobExecutor);
- components[0] = (XComponent)prop.getPropertyValue("Document");
- components[1] = (XComponent)prop.getPropertyValue("DocumentDefinition");
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }}
-
-
- public void cancelWizard() {
+ public void cancelWizard()
+ {
xDialog.endExecute();
}
-
- public void insertFormRelatedSteps(){
+ public void insertFormRelatedSteps()
+ {
addRoadmap();
int i = 0;
i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_TABLE + 2), SOMAINPAGE);
i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_TABLE + 3), SOFIELDSFORMATPAGE);
if (this.curTableDescriptor.supportsCoreSQLGrammar())
+ {
i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_TABLE + 4), SOPRIMARYKEYPAGE);
- i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_TABLE + 5), SOFINALPAGE); // Orderby is always supported
+ }
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_TABLE + 5), SOFINALPAGE); // Orderby is always supported
setRoadmapInteractive(true);
setRoadmapComplete(true);
setCurrentRoadmapItemID((short) 1);
}
-
- public XComponent[] startTableWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue){
- try{
+ public XComponent[] startTableWizard(XMultiServiceFactory _xMSF, PropertyValue[] CurPropertyValue)
+ {
+ try
+ {
curTableDescriptor = new TableDescriptor(xMSF, super.xWindow, this.sMsgColumnAlreadyExists);
- if (curTableDescriptor.getConnection(CurPropertyValue)){
+ if (curTableDescriptor.getConnection(CurPropertyValue))
+ {
if (Properties.hasPropertyValue(CurPropertyValue, "ParentFrame"))
- CurFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class,Properties.getPropertyValue(CurPropertyValue, "ParentFrame"));
+ {
+ CurFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, Properties.getPropertyValue(CurPropertyValue, "ParentFrame"));
+ }
else
+ {
CurFrame = Desktop.getActiveFrame(xMSF);
+ }
buildSteps();
createWindowPeer();
curTableDescriptor.setWindowPeer(this.xControl.getPeer());
- // setAutoMnemonic("lblDialogHeader", false);
+ // setAutoMnemonic("lblDialogHeader", false);
insertFormRelatedSteps();
short RetValue = executeDialog();
xComponent.dispose();
- switch (RetValue){
+ switch (RetValue)
+ {
case 0: // via Cancelbutton or via sourceCode with "endExecute"
if (wizardmode == Finalizer.STARTFORMWIZARDMODE)
+ {
callFormWizard();
+ }
break;
case 1:
@@ -338,49 +405,56 @@ public class TableWizard extends WizardDialog implements XTextListener, XComplet
}
}
}
- catch(java.lang.Exception jexception ){
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
}
return components;
}
-
- public boolean getTableResources(){
- sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_TABLE+1);
+ public boolean getTableResources()
+ {
+ sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_TABLE + 1);
slblFields = m_oResource.getResText(UIConsts.RID_TABLE + 19);
- slblSelFields = m_oResource.getResText(UIConsts.RID_TABLE + 25);
+ slblSelFields = m_oResource.getResText(UIConsts.RID_TABLE + 25);
serrToManyFields = m_oResource.getResText(UIConsts.RID_TABLE + 47);
serrTableNameexists = m_oResource.getResText(UIConsts.RID_TABLE + 48);
sMsgColumnAlreadyExists = m_oResource.getResText(UIConsts.RID_TABLE + 51);
return true;
}
- public boolean verifyfieldcount( int _icount ){
- try{
- int maxfieldcount = curTableDescriptor.getMaxColumnsInTable();
- if (_icount >= (maxfieldcount - 1)){ // keep one column as reserve for the automaticcally created key
- String smessage = serrToManyFields;
- smessage = JavaTools.replaceSubString(smessage, String.valueOf(maxfieldcount), "%COUNT");
- showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, smessage);
- return false;
+ public boolean verifyfieldcount(int _icount)
+ {
+ try
+ {
+ int maxfieldcount = curTableDescriptor.getMaxColumnsInTable();
+ if (_icount >= (maxfieldcount - 1))
+ { // keep one column as reserve for the automaticcally created key
+ String smessage = serrToManyFields;
+ smessage = JavaTools.replaceSubString(smessage, String.valueOf(maxfieldcount), "%COUNT");
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, smessage);
+ return false;
+ }
}
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- }
- return true;
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return true;
}
/* (non-Javadoc)
* @see com.sun.star.awt.XTextListener#textChanged(com.sun.star.awt.TextEvent)
*/
- public void textChanged(TextEvent aTextEvent) {
- if (this.curTableDescriptor.isSQL92CheckEnabled()){
+ public void textChanged(TextEvent aTextEvent)
+ {
+ if (this.curTableDescriptor.isSQL92CheckEnabled())
+ {
Object otextcomponent = UnoDialog.getModel(aTextEvent.Source);
String sName = (String) Helper.getUnoPropertyValue(otextcomponent, "Text");
sName = Desktop.removeSpecialCharacters(curTableDescriptor.xMSF, Configuration.getOfficeLocale(curTableDescriptor.xMSF), sName);
Helper.setUnoPropertyValue(otextcomponent, "Text", sName);
}
}
-
}
diff --git a/wizards/com/sun/star/wizards/table/XCallTableWizard.java b/wizards/com/sun/star/wizards/table/XCallTableWizard.java
index 99434fda1e75..47cba7da9314 100644
--- a/wizards/com/sun/star/wizards/table/XCallTableWizard.java
+++ b/wizards/com/sun/star/wizards/table/XCallTableWizard.java
@@ -1,9 +1,42 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XCallTableWizard.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.table;
-public interface XCallTableWizard extends com.sun.star.uno.XInterface {
+public interface XCallTableWizard extends com.sun.star.uno.XInterface
+{
// Methods
- public void CallTableDialog();
-
- // static Member
- public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] = { new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallTableDialog", 0, 0)};
+ public void CallTableDialog(); // static Member
+ public static final com.sun.star.lib.uno.typeinfo.TypeInfo UNOTYPEINFO[] =
+ {
+ new com.sun.star.lib.uno.typeinfo.MethodTypeInfo("CallTableDialog", 0, 0)
+ };
}
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java
index 1e5167ce2c12..229e30751bac 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.java
+++ b/wizards/com/sun/star/wizards/text/TextDocument.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.text;
import java.util.Calendar;
@@ -82,7 +81,9 @@ import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.Helper.DateUtils;
import com.sun.star.wizards.document.OfficeDocument;
-public class TextDocument {
+public class TextDocument
+{
+
public XComponent xComponent;
public com.sun.star.text.XTextDocument xTextDocument;
public com.sun.star.util.XNumberFormats NumberFormats;
@@ -102,26 +103,31 @@ public class TextDocument {
public XStorable xStorable;
// creates an instance of TextDocument and creates a named frame. No document is actually loaded into this frame.
- public TextDocument(XMultiServiceFactory xMSF, XTerminateListener listener, String FrameName) {
+ public TextDocument(XMultiServiceFactory xMSF, XTerminateListener listener, String FrameName)
+ {
this.xMSF = xMSF;
xFrame = OfficeDocument.createNewFrame(xMSF, listener, FrameName);
}
// creates an instance of TextDocument by loading a given URL as preview
- public TextDocument(XMultiServiceFactory xMSF, String _sPreviewURL, boolean bShowStatusIndicator, XTerminateListener listener ) {
+ public TextDocument(XMultiServiceFactory xMSF, String _sPreviewURL, boolean bShowStatusIndicator, XTerminateListener listener)
+ {
this.xMSF = xMSF;
xFrame = OfficeDocument.createNewFrame(xMSF, listener);
- xTextDocument = loadAsPreview( _sPreviewURL, true );
- xComponent = (XComponent)UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ xTextDocument = loadAsPreview(_sPreviewURL, true);
+ xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
- if ( bShowStatusIndicator )
+ if (bShowStatusIndicator)
+ {
showStatusIndicator();
+ }
init();
}
// creates an instance of TextDocument from the desktop's current frame
- public TextDocument( XMultiServiceFactory xMSF, boolean bShowStatusIndicator, XTerminateListener listener ) {
+ public TextDocument(XMultiServiceFactory xMSF, boolean bShowStatusIndicator, XTerminateListener listener)
+ {
this.xMSF = xMSF;
XDesktop xDesktop = Desktop.getDesktop(xMSF);
@@ -130,75 +136,83 @@ public class TextDocument {
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
- if ( bShowStatusIndicator )
+ if (bShowStatusIndicator)
+ {
showStatusIndicator();
+ }
init();
}
public static class ModuleIdentifier
{
- private String m_identifier;
+
+ private String m_identifier;
protected final String getIdentifier()
{
return m_identifier;
}
- public ModuleIdentifier( String _identifier )
+ public ModuleIdentifier(String _identifier)
{
m_identifier = _identifier;
}
};
// creates an instance of TextDocument containing a blank text document
- public TextDocument(XMultiServiceFactory xMSF, ModuleIdentifier _moduleIdentifier, boolean bShowStatusIndicator ) {
+ public TextDocument(XMultiServiceFactory xMSF, ModuleIdentifier _moduleIdentifier, boolean bShowStatusIndicator)
+ {
this.xMSF = xMSF;
try
{
// create the empty document, and set its module identifier
- xTextDocument = (XTextDocument)UnoRuntime.queryInterface( XTextDocument.class,
- xMSF.createInstance( "com.sun.star.text.TextDocument" ) );
+ xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,
+ xMSF.createInstance("com.sun.star.text.TextDocument"));
- XLoadable xLoadable = (XLoadable)UnoRuntime.queryInterface(XLoadable.class, xTextDocument);
+ XLoadable xLoadable = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, xTextDocument);
xLoadable.initNew();
- XModule xModule = (XModule)UnoRuntime.queryInterface( XModule.class,
- xTextDocument );
- xModule.setIdentifier( _moduleIdentifier.getIdentifier() );
+ XModule xModule = (XModule) UnoRuntime.queryInterface(XModule.class,
+ xTextDocument);
+ xModule.setIdentifier(_moduleIdentifier.getIdentifier());
// load the document into a blank frame
XDesktop xDesktop = Desktop.getDesktop(xMSF);
- XComponentLoader xLoader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, xDesktop );
+ XComponentLoader xLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xDesktop);
PropertyValue[] loadArgs = new PropertyValue[]
{
new PropertyValue("Model", -1, xTextDocument, com.sun.star.beans.PropertyState.DIRECT_VALUE)
};
- xLoader.loadComponentFromURL("private:object", "_blank", 0, loadArgs );
+ xLoader.loadComponentFromURL("private:object", "_blank", 0, loadArgs);
// remember some things for later usage
xFrame = xTextDocument.getCurrentController().getFrame();
- xComponent = (XComponent)UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
}
- catch( Exception e )
+ catch (Exception e)
{
// TODO: it seems the whole project does not really have an error handling. Other menthods
// seem to generally silence errors, so we can't do anything else here ...
}
if (bShowStatusIndicator)
+ {
showStatusIndicator();
+ }
init();
}
//creates an instance of TextDocument from a given XTextDocument
- public TextDocument(XMultiServiceFactory xMSF,XTextDocument _textDocument, boolean bshowStatusIndicator) {
+ public TextDocument(XMultiServiceFactory xMSF, XTextDocument _textDocument, boolean bshowStatusIndicator)
+ {
this.xMSF = xMSF;
- xFrame = _textDocument.getCurrentController().getFrame();
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _textDocument);
- xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ xFrame = _textDocument.getCurrentController().getFrame();
+ xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _textDocument);
+ xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
//PosSize = xFrame.getComponentWindow().getPosSize();
- if (bshowStatusIndicator) {
+ if (bshowStatusIndicator)
+ {
XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
xProgressBar = xStatusIndicatorFactory.createStatusIndicator();
xProgressBar.start("", 100);
@@ -214,8 +228,8 @@ public class TextDocument {
xText = xTextDocument.getText();
}
-
- private void init() {
+ private void init()
+ {
xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
@@ -226,14 +240,16 @@ public class TextDocument {
xText = xTextDocument.getText();
}
- private void showStatusIndicator() {
+ private void showStatusIndicator()
+ {
XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
xProgressBar = xStatusIndicatorFactory.createStatusIndicator();
xProgressBar.start("", 100);
xProgressBar.setValue(5);
}
- public XTextDocument loadAsPreview(String sDefaultTemplate, boolean asTemplate) {
+ public XTextDocument loadAsPreview(String sDefaultTemplate, boolean asTemplate)
+ {
PropertyValue loadValues[] = new PropertyValue[3];
// open document in the Preview mode
loadValues[0] = new PropertyValue();
@@ -247,11 +263,15 @@ public class TextDocument {
loadValues[2].Value = Boolean.TRUE;
//set the preview document to non-modified mode in order to avoid the 'do u want to save' box
- if (xTextDocument != null){
- try {
+ if (xTextDocument != null)
+ {
+ try
+ {
XModifiable xModi = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xTextDocument);
xModi.setModified(false);
- } catch (PropertyVetoException e1) {
+ }
+ catch (PropertyVetoException e1)
+ {
e1.printStackTrace(System.out);
}
}
@@ -261,9 +281,12 @@ public class TextDocument {
xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
ViewHandler myViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
- try {
+ try
+ {
myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE));
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
@@ -274,8 +297,10 @@ public class TextDocument {
}
- public Size getPageSize() {
- try {
+ public Size getPageSize()
+ {
+ try
+ {
XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
com.sun.star.container.XNameAccess xNameAccess = null;
xNameAccess = xStyleFamiliesSupplier.getStyleFamilies();
@@ -284,18 +309,21 @@ public class TextDocument {
XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName("First Page"));
return (Size) Helper.getUnoPropertyValue(xPageStyle, "Size");
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
//creates an instance of TextDocument and creates a frame and loads a document
- public TextDocument(XMultiServiceFactory xMSF, String URL, PropertyValue[] xArgs, XTerminateListener listener) {
+ public TextDocument(XMultiServiceFactory xMSF, String URL, PropertyValue[] xArgs, XTerminateListener listener)
+ {
this.xMSF = xMSF;
XDesktop xDesktop = Desktop.getDesktop(xMSF);
- xFrame = OfficeDocument.createNewFrame(xMSF,listener);
+ xFrame = OfficeDocument.createNewFrame(xMSF, listener);
Object oDoc = OfficeDocument.load(xFrame, URL, "_self", xArgs);
xTextDocument = (XTextDocument) oDoc;
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
@@ -310,8 +338,8 @@ public class TextDocument {
CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale");
}
-
- public static XTextCursor createTextCursor(Object oCursorContainer) {
+ public static XTextCursor createTextCursor(Object oCursorContainer)
+ {
XSimpleText xText = (XSimpleText) UnoRuntime.queryInterface(XSimpleText.class, oCursorContainer);
XTextCursor xTextCursor = xText.createTextCursor();
return xTextCursor;
@@ -324,8 +352,8 @@ public class TextDocument {
// two sequences of tablenames you can find out the tablename of the last inserted Table
// Todo: This method is unsecure because the last index is not necessarily the last section
-
- public int getCharWidth(String ScaleString) {
+ public int getCharWidth(String ScaleString)
+ {
int iScale = 200;
xTextDocument.lockControllers();
int iScaleLen = ScaleString.length();
@@ -347,13 +375,16 @@ public class TextDocument {
return iScale;
}
- public void unlockallControllers() {
- while (xTextDocument.hasControllersLocked() == true) {
+ public void unlockallControllers()
+ {
+ while (xTextDocument.hasControllersLocked() == true)
+ {
xTextDocument.unlockControllers();
}
}
- public void refresh () {
+ public void refresh()
+ {
XRefreshable xRefreshable = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, xTextDocument);
xRefreshable.refresh();
}
@@ -365,60 +396,70 @@ public class TextDocument {
* @param TemplateDescription The old Description which is being appended with another sentence.
* @return void.
*/
- public void setWizardTemplateDocInfo(String WizardName, String TemplateDescription) {
- try {
+ public void setWizardTemplateDocInfo(String WizardName, String TemplateDescription)
+ {
+ try
+ {
Object uD = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.UserProfile/Data", false);
XNameAccess xNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, uD);
Object gn = xNA.getByName("givenname");
Object sn = xNA.getByName("sn");
- String fullname = (String)gn + " " + (String)sn;
+ String fullname = (String) gn + " " + (String) sn;
Calendar cal = new GregorianCalendar();
int year = cal.get(Calendar.YEAR);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
DateTime currentDate = new DateTime();
- currentDate.Day = (short)day;
- currentDate.Month = (short)month;
- currentDate.Year = (short)year;
+ currentDate.Day = (short) day;
+ currentDate.Month = (short) month;
+ currentDate.Year = (short) year;
DateUtils du = new DateUtils(xMSF, this.xTextDocument);
- int ff = du.getFormat( NumberFormatIndex.DATE_SYS_DDMMYY );
+ int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY);
String myDate = du.format(ff, currentDate);
XDocumentInfoSupplier xDocInfoSuppl = (XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xTextDocument);
XDocumentInfo xDocInfo2 = xDocInfoSuppl.getDocumentInfo();
Helper.setUnoPropertyValue(xDocInfo2, "Author", fullname);
Helper.setUnoPropertyValue(xDocInfo2, "ModifiedBy", fullname);
- String description = (String)Helper.getUnoPropertyValue(xDocInfo2, "Description");
+ String description = (String) Helper.getUnoPropertyValue(xDocInfo2, "Description");
description = description + " " + TemplateDescription;
description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>");
description = JavaTools.replaceSubString(description, myDate, "<current_date>");
Helper.setUnoPropertyValue(xDocInfo2, "Description", description);
- } catch (NoSuchElementException e) {
+ }
+ catch (NoSuchElementException e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (WrappedTargetException e) {
+ }
+ catch (WrappedTargetException e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
-
-
/**
* removes an arbitrary Object which supports the 'XTextContent' interface
* @param oTextContent
* @return
*/
- public boolean removeTextContent(Object oTextContent){
- try {
+ public boolean removeTextContent(Object oTextContent)
+ {
+ try
+ {
XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextContent);
xText.removeTextContent(xTextContent);
return true;
- } catch (NoSuchElementException e) {
+ }
+ catch (NoSuchElementException e)
+ {
e.printStackTrace(System.out);
return false;
}
@@ -431,17 +472,17 @@ public class TextDocument {
* @param model the document model.
* @return the page count of the document.
*/
- public static int getPageCount(Object model) {
- XModel xModel = (XModel)UnoRuntime.queryInterface(XModel.class, model);
+ public static int getPageCount(Object model)
+ {
+ XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, model);
XController xController = xModel.getCurrentController();
- XTextViewCursorSupplier xTextVCS = (XTextViewCursorSupplier)
- UnoRuntime.queryInterface(XTextViewCursorSupplier.class,xController);
+ XTextViewCursorSupplier xTextVCS = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
XTextViewCursor xTextVC = xTextVCS.getViewCursor();
- XPageCursor xPC = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class,xTextVC);
+ XPageCursor xPC = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class, xTextVC);
xPC.jumpToLastPage();
return xPC.getPage();
}
/* Possible Values for "OptionString" are: "LoadCellStyles", "LoadTextStyles", "LoadFrameStyles",
- "LoadPageStyles", "LoadNumberingStyles", "OverwriteStyles" */
+ "LoadPageStyles", "LoadNumberingStyles", "OverwriteStyles" */
}
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
index aeb802d0fe53..fc260b88834c 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -58,31 +58,31 @@ import com.sun.star.util.XRefreshable;
import com.sun.star.util.XUpdatable;
import com.sun.star.wizards.common.Helper;
-public class TextFieldHandler {
+public class TextFieldHandler
+{
public XTextFieldsSupplier xTextFieldsSupplier;
private XMultiServiceFactory xMSFDoc;
-
/**
* Creates a new instance of TextFieldHandler
* @param xMSF
* @param xTextDocument
*/
- public TextFieldHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument) {
+ public TextFieldHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
+ {
this.xMSFDoc = xMSF;
xTextFieldsSupplier = (XTextFieldsSupplier) UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument);
}
-
public void refreshTextFields()
{
XRefreshable xUp = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, xTextFieldsSupplier.getTextFields());
xUp.refresh();
}
-
- public String getUserFieldContent(XTextCursor xTextCursor) {
+ public String getUserFieldContent(XTextCursor xTextCursor)
+ {
try
{
XTextRange xTextRange = xTextCursor.getEnd();
@@ -106,7 +106,8 @@ public class TextFieldHandler {
return "";
}
- public void insertUserField(XTextCursor xTextCursor, String FieldName, String FieldTitle) {
+ public void insertUserField(XTextCursor xTextCursor, String FieldName, String FieldTitle)
+ {
try
{
XInterface xField = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextField.User");
@@ -135,12 +136,12 @@ public class TextFieldHandler {
// }
}
- catch (com.sun.star.uno.Exception exception) {
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
public XPropertySet createUserField(String FieldName, String FieldTitle) throws com.sun.star.uno.Exception
{
Object oMaster = xMSFDoc.createInstance("com.sun.star.text.FieldMaster.User");
@@ -154,67 +155,64 @@ public class TextFieldHandler {
return xPSet;
}
-
-
private XDependentTextField[] getTextFieldsByProperty(String _PropertyName, Object _aPropertyValue, String _TypeName) throws Exception
{
try
{
- XDependentTextField[] xDependentFields;
- Vector xDependentVector = new Vector();
+ XDependentTextField[] xDependentFields;
+ Vector xDependentVector = new Vector();
if (xTextFieldsSupplier.getTextFields().hasElements())
{
- XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
+ XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
while (xEnum.hasMoreElements())
{
- Object oTextField = xEnum.nextElement();
- XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
- XPropertySet xPropertySet = xDependent.getTextFieldMaster();
+ Object oTextField = xEnum.nextElement();
+ XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
+ XPropertySet xPropertySet = xDependent.getTextFieldMaster();
if (xPropertySet.getPropertySetInfo().hasPropertyByName(_PropertyName))
{
- Object oValue = xPropertySet.getPropertyValue(_PropertyName);
- // TODO replace the following comparison via com.sun.star.uno.Any.Type
- if(AnyConverter.isString(oValue))
+ Object oValue = xPropertySet.getPropertyValue(_PropertyName);
+ // TODO replace the following comparison via com.sun.star.uno.Any.Type
+ if (AnyConverter.isString(oValue))
{
if (_TypeName.equals("String"))
{
- String sValue = AnyConverter.toString(oValue);
- if (sValue.equals(_aPropertyValue))
+ String sValue = AnyConverter.toString(oValue);
+ if (sValue.equals(_aPropertyValue))
{
- xDependentVector.addElement(xDependent);
- }
- }
+ xDependentVector.addElement(xDependent);
+ }
+ }
}
else if (AnyConverter.isShort(oValue))
{
if (_TypeName.equals("Short"))
{
- short iShortParam = ((Short) _aPropertyValue).shortValue();
- short ishortValue = AnyConverter.toShort(oValue);
- if (ishortValue == iShortParam)
+ short iShortParam = ((Short) _aPropertyValue).shortValue();
+ short ishortValue = AnyConverter.toShort(oValue);
+ if (ishortValue == iShortParam)
{
- xDependentVector.addElement(xDependent);
+ xDependentVector.addElement(xDependent);
+ }
+ }
}
}
}
}
- }
- }
if (xDependentVector.size() > 0)
{
- xDependentFields = new XDependentTextField[xDependentVector.size()];
- xDependentVector.toArray(xDependentFields);
- return xDependentFields;
+ xDependentFields = new XDependentTextField[xDependentVector.size()];
+ xDependentVector.toArray(xDependentFields);
+ return xDependentFields;
+ }
}
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace(System.out);
}
- catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace(System.out);
+ return null;
}
- return null;
- }
-
-
public void changeUserFieldContent(String _FieldName, String _FieldContent)
{
@@ -236,31 +234,38 @@ public class TextFieldHandler {
}
}
-
- public void updateDocInfoFields() {
- try {
+ public void updateDocInfoFields()
+ {
+ try
+ {
XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
- while (xEnum.hasMoreElements()) {
+ while (xEnum.hasMoreElements())
+ {
Object oTextField = xEnum.nextElement();
XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
- if (xSI.supportsService("com.sun.star.text.TextField.ExtendedUser")) {
+ if (xSI.supportsService("com.sun.star.text.TextField.ExtendedUser"))
+ {
XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
xUp.update();
}
- if (xSI.supportsService("com.sun.star.text.TextField.User")) {
+ if (xSI.supportsService("com.sun.star.text.TextField.User"))
+ {
XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
xUp.update();
}
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
-
- public void updateDateFields() {
- try {
+ public void updateDateFields()
+ {
+ try
+ {
XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
Calendar cal = new GregorianCalendar();
DateTime dt = new DateTime();
@@ -269,58 +274,66 @@ public class TextFieldHandler {
dt.Month = (short) cal.get(Calendar.MONTH);
dt.Month++;
- while (xEnum.hasMoreElements()) {
+ while (xEnum.hasMoreElements())
+ {
Object oTextField = xEnum.nextElement();
XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
- if (xSI.supportsService("com.sun.star.text.TextField.DateTime")) {
+ if (xSI.supportsService("com.sun.star.text.TextField.DateTime"))
+ {
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTextField);
xPSet.setPropertyValue("IsFixed", Boolean.FALSE);
xPSet.setPropertyValue("DateTimeValue", dt);
}
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
- public void fixDateFields(boolean _bSetFixed) {
- try {
- XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
- while (xEnum.hasMoreElements()) {
- Object oTextField = xEnum.nextElement();
- XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
- if (xSI.supportsService("com.sun.star.text.TextField.DateTime")) {
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTextField);
- xPSet.setPropertyValue("IsFixed", new Boolean(_bSetFixed));
+ public void fixDateFields(boolean _bSetFixed)
+ {
+ try
+ {
+ XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
+ while (xEnum.hasMoreElements())
+ {
+ Object oTextField = xEnum.nextElement();
+ XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
+ if (xSI.supportsService("com.sun.star.text.TextField.DateTime"))
+ {
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTextField);
+ xPSet.setPropertyValue("IsFixed", new Boolean(_bSetFixed));
+ }
}
}
- } catch (Exception e) {
- e.printStackTrace();
- }}
-
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
public void removeUserFieldByContent(String _FieldContent)
{
try
{
- XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String");
- if (xDependentTextFields != null)
+ XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String");
+ if (xDependentTextFields != null)
{
- for (int i = 0; i < xDependentTextFields.length; i++)
+ for (int i = 0; i < xDependentTextFields.length; i++)
{
- xDependentTextFields[i].dispose();
+ xDependentTextFields[i].dispose();
}
}
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ e.printStackTrace(System.out);
}
}
-
-
public void changeExtendedUserFieldContent(short UserDataPart, String _FieldContent)
{
try
@@ -334,7 +347,9 @@ public class TextFieldHandler {
}
}
refreshTextFields();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
diff --git a/wizards/com/sun/star/wizards/text/TextFrameHandler.java b/wizards/com/sun/star/wizards/text/TextFrameHandler.java
index 302d05c43160..f79e341990d1 100644
--- a/wizards/com/sun/star/wizards/text/TextFrameHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextFrameHandler.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TextFrameHandler.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.text;
import com.sun.star.container.NoSuchElementException;
@@ -7,16 +38,18 @@ import com.sun.star.text.XTextFrame;
import com.sun.star.text.XTextFramesSupplier;
import com.sun.star.uno.UnoRuntime;
-public class TextFrameHandler {
+public class TextFrameHandler
+{
- public static XTextFrame getFrameByName(String sFrameName, XTextDocument xTD) throws NoSuchElementException, WrappedTargetException {
+ public static XTextFrame getFrameByName(String sFrameName, XTextDocument xTD) throws NoSuchElementException, WrappedTargetException
+ {
XTextFramesSupplier xFrameSupplier = (XTextFramesSupplier) UnoRuntime.queryInterface(XTextFramesSupplier.class, xTD);
- if (xFrameSupplier.getTextFrames().hasByName(sFrameName)) {
+ if (xFrameSupplier.getTextFrames().hasByName(sFrameName))
+ {
Object oTextFrame = xFrameSupplier.getTextFrames().getByName(sFrameName);
XTextFrame xTextFrame = (XTextFrame) UnoRuntime.queryInterface(XTextFrame.class, oTextFrame);
return xTextFrame;
}
return null;
}
-
}
diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.java b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
index 883bf8ac4f0e..1b7b514a4eae 100644
--- a/wizards/com/sun/star/wizards/text/TextSectionHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.text;
+ ************************************************************************/
+package com.sun.star.wizards.text;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XIndexAccess;
@@ -46,7 +47,8 @@ import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.wizards.common.Helper;
-public class TextSectionHandler {
+public class TextSectionHandler
+{
public XTextSectionsSupplier xTextSectionsSupplier;
private XMultiServiceFactory xMSFDoc;
@@ -54,151 +56,218 @@ public class TextSectionHandler {
private XText xText;
/** Creates a new instance of TextSectionHandler */
- public TextSectionHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument) {
+ public TextSectionHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
+ {
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
xText = xTextDocument.getText();
xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDocument);
}
- public void removeTextSectionbyName(String SectionName) {
- try {
+ public void removeTextSectionbyName(String SectionName)
+ {
+ try
+ {
XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections();
- if (xAllTextSections.hasByName(SectionName) == true) {
+ if (xAllTextSections.hasByName(SectionName) == true)
+ {
Object oTextSection = xTextSectionsSupplier.getTextSections().getByName(SectionName);
removeTextSection(oTextSection);
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public boolean hasTextSectionByName(String SectionName) {
+ public boolean hasTextSectionByName(String SectionName)
+ {
com.sun.star.container.XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections();
return xAllTextSections.hasByName(SectionName);
}
- public void removeLastTextSection() {
- try {
+ public void removeLastTextSection()
+ {
+ try
+ {
XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
Object oTextSection = xAllTextSections.getByIndex(xAllTextSections.getCount() - 1);
removeTextSection(oTextSection);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
+ public void removeTextSection(Object _oTextSection)
+ {
+ try
+ {
+ XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, _oTextSection);
+ xText.removeTextContent(xTextContentTextSection);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
- public void removeTextSection(Object _oTextSection){
- try{
- XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, _oTextSection);
- xText.removeTextContent(xTextContentTextSection);
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- }}
-
-
- public void removeInvisibleTextSections() {
- try {
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
- int TextSectionCount = xAllTextSections.getCount();
- for (int i = TextSectionCount - 1; i >= 0; i--) {
- XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
- XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
- boolean bRemoveTextSection = (!AnyConverter.toBoolean(xTextSectionPropertySet.getPropertyValue("IsVisible")));
- if (bRemoveTextSection){
- xText.removeTextContent(xTextContentTextSection);
+ public void removeInvisibleTextSections()
+ {
+ try
+ {
+ XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ int TextSectionCount = xAllTextSections.getCount();
+ for (int i = TextSectionCount - 1; i >= 0; i--)
+ {
+ XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
+ XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
+ boolean bRemoveTextSection = (!AnyConverter.toBoolean(xTextSectionPropertySet.getPropertyValue("IsVisible")));
+ if (bRemoveTextSection)
+ {
+ xText.removeTextContent(xTextContentTextSection);
+ }
}
}
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- }}
-
-
- public void removeAllTextSections() {
- try {
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
- int TextSectionCount = xAllTextSections.getCount();
- for (int i = TextSectionCount - 1; i >= 0; i--) {
- XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
- XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
- xText.removeTextContent(xTextContentTextSection);
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
}
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- }}
+ }
+ public void removeAllTextSections()
+ {
+ try
+ {
+ XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ int TextSectionCount = xAllTextSections.getCount();
+ for (int i = TextSectionCount - 1; i >= 0; i--)
+ {
+ XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
+ XPropertySet xTextSectionPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
+ xText.removeTextContent(xTextContentTextSection);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
- public void breakLinkofTextSections() {
- try {
+ public void breakLinkofTextSections()
+ {
+ try
+ {
Object oTextSection;
XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
int iSectionCount = xAllTextSections.getCount();
SectionFileLink oSectionLink = new SectionFileLink();
oSectionLink.FileURL = "";
- for (int i = 0; i < iSectionCount; i++) {
+ for (int i = 0; i < iSectionCount; i++)
+ {
oTextSection = xAllTextSections.getByIndex(i);
- Helper.setUnoPropertyValues(oTextSection, new String[] { "FileLink", "LinkRegion" }, new Object[] { oSectionLink, "" });
+ Helper.setUnoPropertyValues(oTextSection, new String[]
+ {
+ "FileLink", "LinkRegion"
+ }, new Object[]
+ {
+ oSectionLink, ""
+ });
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void breakLinkOfTextSection(Object oTextSection) {
+ public void breakLinkOfTextSection(Object oTextSection)
+ {
SectionFileLink oSectionLink = new SectionFileLink();
oSectionLink.FileURL = "";
- Helper.setUnoPropertyValues(oTextSection, new String[] { "FileLink", "LinkRegion" }, new Object[] { oSectionLink, "" });
+ Helper.setUnoPropertyValues(oTextSection, new String[]
+ {
+ "FileLink", "LinkRegion"
+ }, new Object[]
+ {
+ oSectionLink, ""
+ });
}
- public void linkSectiontoTemplate(String TemplateName, String SectionName) {
- try {
+ public void linkSectiontoTemplate(String TemplateName, String SectionName)
+ {
+ try
+ {
Object oTextSection = xTextSectionsSupplier.getTextSections().getByName(SectionName);
linkSectiontoTemplate(oTextSection, TemplateName, SectionName);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
- public void linkSectiontoTemplate(Object oTextSection, String TemplateName, String SectionName) {
+ public void linkSectiontoTemplate(Object oTextSection, String TemplateName, String SectionName)
+ {
SectionFileLink oSectionLink = new SectionFileLink();
oSectionLink.FileURL = TemplateName;
- Helper.setUnoPropertyValues(oTextSection, new String[] { "FileLink", "LinkRegion" }
- , new Object[] { oSectionLink, SectionName });
+ Helper.setUnoPropertyValues(oTextSection, new String[]
+ {
+ "FileLink", "LinkRegion"
+ }, new Object[]
+ {
+ oSectionLink, SectionName
+ });
XNamed xSectionName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextSection);
String NewSectionName = xSectionName.getName();
if (NewSectionName.compareTo(SectionName) != 0)
+ {
xSectionName.setName(SectionName);
+ }
}
- public void insertTextSection(String GroupName, String TemplateName, boolean _bAddParagraph) {
- try {
- if (_bAddParagraph){
- XTextCursor xTextCursor = xText.createTextCursor();
- xText.insertControlCharacter(xTextCursor, ControlCharacter.PARAGRAPH_BREAK, false);
- // Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
- xTextCursor.collapseToEnd();
- }
- XTextCursor xSecondTextCursor = xText.createTextCursor();
- xSecondTextCursor.gotoEnd(false);
- insertTextSection( GroupName, TemplateName, xSecondTextCursor );
+ public void insertTextSection(String GroupName, String TemplateName, boolean _bAddParagraph)
+ {
+ try
+ {
+ if (_bAddParagraph)
+ {
+ XTextCursor xTextCursor = xText.createTextCursor();
+ xText.insertControlCharacter(xTextCursor, ControlCharacter.PARAGRAPH_BREAK, false);
+ // Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
+ xTextCursor.collapseToEnd();
+ }
+ XTextCursor xSecondTextCursor = xText.createTextCursor();
+ xSecondTextCursor.gotoEnd(false);
+ insertTextSection(GroupName, TemplateName, xSecondTextCursor);
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
}
- catch (IllegalArgumentException e) {
- e.printStackTrace(System.out);
- }}
- public void insertTextSection( String sectionName, String templateName, XTextCursor position ) {
- try {
+ public void insertTextSection(String sectionName, String templateName, XTextCursor position)
+ {
+ try
+ {
Object xTextSection;
if (xTextSectionsSupplier.getTextSections().hasByName(sectionName) == true)
+ {
xTextSection = xTextSectionsSupplier.getTextSections().getByName(sectionName);
- else {
+ }
+ else
+ {
xTextSection = xMSFDoc.createInstance("com.sun.star.text.TextSection");
XTextContent xTextContentSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
- position.getText().insertTextContent(position , xTextContentSection, false);
+ position.getText().insertTextContent(position, xTextContentSection, false);
}
linkSectiontoTemplate(xTextSection, templateName, sectionName);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
diff --git a/wizards/com/sun/star/wizards/text/TextStyleHandler.java b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
index 6f4b16835d93..b43d7cd2a7a6 100644
--- a/wizards/com/sun/star/wizards/text/TextStyleHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -44,59 +44,76 @@ import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
-public class TextStyleHandler {
+public class TextStyleHandler
+{
+
public XStyleFamiliesSupplier xStyleFamiliesSupplier;
private XMultiServiceFactory xMSFDoc;
private XTextDocument xTextDocument;
/** Creates a new instance of TextStyleHandler */
- public TextStyleHandler(com.sun.star.lang.XMultiServiceFactory xMSF, XTextDocument xTextDocument) {
+ public TextStyleHandler(com.sun.star.lang.XMultiServiceFactory xMSF, XTextDocument xTextDocument)
+ {
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
xStyleFamiliesSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
}
- public void loadStyleTemplates(String sTemplateUrl, String OptionString) {
- try {
+ public void loadStyleTemplates(String sTemplateUrl, String OptionString)
+ {
+ try
+ {
XStyleLoader xStyleLoader = (XStyleLoader) UnoRuntime.queryInterface(XStyleLoader.class, xStyleFamiliesSupplier.getStyleFamilies());
com.sun.star.beans.PropertyValue[] StyleOptions = xStyleLoader.getStyleLoaderOptions();
String CurOptionName = "";
int PropCount = StyleOptions.length;
- for (int i = 0; i < PropCount; i++) {
+ for (int i = 0; i < PropCount; i++)
+ {
CurOptionName = StyleOptions[i].Name;
StyleOptions[i].Value = new Boolean((CurOptionName.compareTo(OptionString) == 0) || (CurOptionName.compareTo("OverwriteStyles") == 0));
}
xStyleLoader.loadStylesFromURL(sTemplateUrl, StyleOptions);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public XPropertySet getStyleByName(String sStyleFamily, String sStyleName){
- try {
- XPropertySet xPropertySet = null;
- Object oStyleFamily = xStyleFamiliesSupplier.getStyleFamilies().getByName(sStyleFamily);
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oStyleFamily);
- if (xNameAccess.hasByName(sStyleName))
- xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess.getByName(sStyleName));
- return xPropertySet;
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- return null;
+ public XPropertySet getStyleByName(String sStyleFamily, String sStyleName)
+ {
+ try
+ {
+ XPropertySet xPropertySet = null;
+ Object oStyleFamily = xStyleFamiliesSupplier.getStyleFamilies().getByName(sStyleFamily);
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oStyleFamily);
+ if (xNameAccess.hasByName(sStyleName))
+ {
+ xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess.getByName(sStyleName));
+ }
+ return xPropertySet;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return null;
}
-
- public Size changePageAlignment(XPropertySet _xPropPageStyle, boolean _bIsLandscape){
- try {
+ public Size changePageAlignment(XPropertySet _xPropPageStyle, boolean _bIsLandscape)
+ {
+ try
+ {
_xPropPageStyle.setPropertyValue("IsLandscape", new Boolean(_bIsLandscape));
Size aPageSize = (Size) AnyConverter.toObject(Size.class, _xPropPageStyle.getPropertyValue("Size"));
int nPageWidth = aPageSize.Width;
int nPageHeight = aPageSize.Height;
Size aSize = new Size(nPageHeight, nPageWidth);
_xPropPageStyle.setPropertyValue("Size", aSize);
- return (Size) AnyConverter.toObject(Size.class,_xPropPageStyle.getPropertyValue("Size"));
- } catch (Exception e) {
+ return (Size) AnyConverter.toObject(Size.class, _xPropPageStyle.getPropertyValue("Size"));
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
return null;
}
diff --git a/wizards/com/sun/star/wizards/text/TextTableHandler.java b/wizards/com/sun/star/wizards/text/TextTableHandler.java
index 40c6521cedde..acdd150c748c 100644
--- a/wizards/com/sun/star/wizards/text/TextTableHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,7 +26,9 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.text;
+ ************************************************************************/
+package com.sun.star.wizards.text;
+
import com.sun.star.container.XIndexAccess;
import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNamed;
@@ -52,8 +54,9 @@ import com.sun.star.wizards.common.Desktop;
import com.sun.star.wizards.common.Helper;
import com.sun.star.wizards.common.NumberFormatter;
+public class TextTableHandler
+{
-public class TextTableHandler {
public XTextTablesSupplier xTextTablesSupplier;
public XMultiServiceFactory xMSFDoc;
public XTextDocument xTextDocument;
@@ -62,128 +65,166 @@ public class TextTableHandler {
private NumberFormatter oNumberFormatter;
private Locale aCharLocale;
-
-
/** Creates a new instance of TextTableHandler */
- public TextTableHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument) {
- try {
- this.xMSFDoc = xMSF;
- this.xTextDocument = xTextDocument;
- xText = xTextDocument.getText();
- xTextTablesSupplier = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
- xSimpleText = (XSimpleText) UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText());
- XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
- aCharLocale = (Locale) Helper.getUnoStructValue((Object) xTextDocument, "CharLocale");
- oNumberFormatter = new NumberFormatter(xNumberFormatsSupplier, aCharLocale );
- } catch (java.lang.Exception e) {
- e.printStackTrace(System.out);
+ public TextTableHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
+ {
+ try
+ {
+ this.xMSFDoc = xMSF;
+ this.xTextDocument = xTextDocument;
+ xText = xTextDocument.getText();
+ xTextTablesSupplier = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
+ xSimpleText = (XSimpleText) UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText());
+ XNumberFormatsSupplier xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ aCharLocale = (Locale) Helper.getUnoStructValue((Object) xTextDocument, "CharLocale");
+ oNumberFormatter = new NumberFormatter(xNumberFormatsSupplier, aCharLocale);
+ }
+ catch (java.lang.Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
}
-}
- public NumberFormatter getNumberFormatter(){
+ public NumberFormatter getNumberFormatter()
+ {
return oNumberFormatter;
}
-
- public XTextTable getByName(String _sTableName){
+ public XTextTable getByName(String _sTableName)
+ {
XTextTable xTextTable = null;
- try{
- XNameAccess xAllTextTables = xTextTablesSupplier.getTextTables();
- if (xAllTextTables.hasByName(_sTableName)){
- Object oTable = xAllTextTables.getByName(_sTableName);
- xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
- }
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- }
+ try
+ {
+ XNameAccess xAllTextTables = xTextTablesSupplier.getTextTables();
+ if (xAllTextTables.hasByName(_sTableName))
+ {
+ Object oTable = xAllTextTables.getByName(_sTableName);
+ xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
return xTextTable;
}
-
- public com.sun.star.text.XTextTable getlastTextTable() {
- try {
+ public com.sun.star.text.XTextTable getlastTextTable()
+ {
+ try
+ {
XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
int MaxIndex = xAllTextTables.getCount() - 1;
Object oTable = xAllTextTables.getByIndex(MaxIndex);
XTextTable xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
return xTextTable;
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public void insertTextTable(com.sun.star.text.XTextCursor xTextCursor) {
- try {
+ public void insertTextTable(com.sun.star.text.XTextCursor xTextCursor)
+ {
+ try
+ {
com.sun.star.uno.XInterface xTextTable = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextTable");
XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextTable);
- if (xTextCursor == null) {
+ if (xTextCursor == null)
+ {
xTextCursor = xTextDocument.getText().createTextCursor();
xTextCursor.gotoEnd(false);
}
xTextCursor.getText().insertTextContent(xTextCursor, xTextContentTable, false);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void removeAllTextTables() {
- try {
+ public void removeAllTextTables()
+ {
+ try
+ {
XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
int TextTableCount = xAllTextTables.getCount();
- for (int i = TextTableCount - 1; i >= 0; i--) {
+ for (int i = TextTableCount - 1; i >= 0; i--)
+ {
removeTextTable(xAllTextTables.getByIndex(i));
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void removeLastTextTable() {
- try {
+ public void removeLastTextTable()
+ {
+ try
+ {
XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
Object oTextTable = xAllTextTables.getByIndex(xAllTextTables.getCount() - 1);
removeTextTable(oTextTable);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
+ public void removeTextTable(Object oTextTable)
+ {
+ try
+ {
+ XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTable);
+ xTextDocument.getText().removeTextContent(xTextContentTable);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
- public void removeTextTable(Object oTextTable){
- try {
- XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTable);
- xTextDocument.getText().removeTextContent(xTextContentTable);
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- }}
-
-
- public void removeTextTablebyName(String TableName) {
- try {
+ public void removeTextTablebyName(String TableName)
+ {
+ try
+ {
XNameAccess xAllTextTables = xTextTablesSupplier.getTextTables();
- if (xAllTextTables.hasByName(TableName) == true) {
+ if (xAllTextTables.hasByName(TableName) == true)
+ {
removeTextTable(xAllTextTables.getByName(TableName));
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void renameTextTable(String OldTableName, String NewTableName) {
- try {
+ public void renameTextTable(String OldTableName, String NewTableName)
+ {
+ try
+ {
XNameAccess xTextTableNames = xTextTablesSupplier.getTextTables();
- if (xTextTableNames.hasByName(OldTableName)) {
+ if (xTextTableNames.hasByName(OldTableName))
+ {
Object oTextTable = xTextTableNames.getByName(OldTableName);
XNamed xTextTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextTable);
xTextTableName.setName(NewTableName);
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public static BreakType resetBreakTypeofTextTable(Object oTextTable) {
+ public static BreakType resetBreakTypeofTextTable(Object oTextTable)
+ {
BreakType CorrBreakValue = null;
BreakType BreakValue = (BreakType) com.sun.star.wizards.common.Helper.getUnoStructValue(oTextTable, "BreakType");
// if (BreakValue.equals(BreakType.NONE) == false){
@@ -193,21 +234,24 @@ public class TextTableHandler {
return BreakType.NONE;
}
-
- public void adjustOptimalTableWidths(XMultiServiceFactory _xMSF, XTextTable xTextTable){ // setTableColumnSeparators(){
- try{
- XFrame xFrame = this.xTextDocument.getCurrentController().getFrame();
- int ColCount = xTextTable.getColumns().getCount();
- XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
- XCellRange xLocCellRange = xCellRange.getCellRangeByPosition(0, 0, ColCount-1, 1);
- short iHoriOrient = AnyConverter.toShort(Helper.getUnoPropertyValue(xTextTable, "HoriOrient"));
- XSelectionSupplier xSelection = (XSelectionSupplier) UnoRuntime.queryInterface(XSelectionSupplier.class, xTextDocument.getCurrentController());
- xSelection.select(xLocCellRange);
- Desktop.dispatchURL(_xMSF, ".Uno:DistributeColumns", xFrame);
- Desktop.dispatchURL(_xMSF, ".Uno:SetOptimalColumnWidth", xFrame);
- Helper.setUnoPropertyValue(xTextTable, "HoriOrient", new Short(iHoriOrient));
+ public void adjustOptimalTableWidths(XMultiServiceFactory _xMSF, XTextTable xTextTable)
+ { // setTableColumnSeparators(){
+ try
+ {
+ XFrame xFrame = this.xTextDocument.getCurrentController().getFrame();
+ int ColCount = xTextTable.getColumns().getCount();
+ XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
+ XCellRange xLocCellRange = xCellRange.getCellRangeByPosition(0, 0, ColCount - 1, 1);
+ short iHoriOrient = AnyConverter.toShort(Helper.getUnoPropertyValue(xTextTable, "HoriOrient"));
+ XSelectionSupplier xSelection = (XSelectionSupplier) UnoRuntime.queryInterface(XSelectionSupplier.class, xTextDocument.getCurrentController());
+ xSelection.select(xLocCellRange);
+ Desktop.dispatchURL(_xMSF, ".Uno:DistributeColumns", xFrame);
+ Desktop.dispatchURL(_xMSF, ".Uno:SetOptimalColumnWidth", xFrame);
+ Helper.setUnoPropertyValue(xTextTable, "HoriOrient", new Short(iHoriOrient));
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
}
- catch( Exception exception ){
- exception.printStackTrace(System.out);
- }}
}
diff --git a/wizards/com/sun/star/wizards/text/ViewHandler.java b/wizards/com/sun/star/wizards/text/ViewHandler.java
index 97785b822931..37aa876498f5 100644
--- a/wizards/com/sun/star/wizards/text/ViewHandler.java
+++ b/wizards/com/sun/star/wizards/text/ViewHandler.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -48,7 +48,9 @@ import com.sun.star.uno.UnoRuntime;
import com.sun.star.view.XViewSettingsSupplier;
import com.sun.star.wizards.common.Helper;
-public class ViewHandler {
+public class ViewHandler
+{
+
private XTextViewCursorSupplier xTextViewCursorSupplier;
private XMultiServiceFactory xMSFDoc;
private XTextDocument xTextDocument;
@@ -56,7 +58,8 @@ public class ViewHandler {
private XViewSettingsSupplier xViewSettingsSupplier;
/** Creates a new instance of View */
- public ViewHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument) {
+ public ViewHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
+ {
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
xTextViewCursorSupplier = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
@@ -64,8 +67,10 @@ public class ViewHandler {
xStyleFamiliesSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
}
- public void selectFirstPage(TextTableHandler oTextTableHandler) {
- try {
+ public void selectFirstPage(TextTableHandler oTextTableHandler)
+ {
+ try
+ {
XPageCursor xPageCursor = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class, xTextViewCursorSupplier.getViewCursor());
XTextCursor xViewTextCursor = (XTextCursor) UnoRuntime.queryInterface(XTextCursor.class, xPageCursor);
xPageCursor.jumpToFirstPage();
@@ -84,28 +89,30 @@ public class ViewHandler {
// }
// }
XTextRange xHeaderRange = (XTextRange) Helper.getUnoPropertyValue(oPageStyle, "HeaderText", XTextRange.class);
- if (!com.sun.star.uno.AnyConverter.isVoid(xHeaderRange)) {
+ if (!com.sun.star.uno.AnyConverter.isVoid(xHeaderRange))
+ {
xViewTextCursor.gotoRange(xHeaderRange, false);
xViewTextCursor.collapseToStart();
- } else
+ }
+ else
+ {
System.out.println("No Headertext available");
-
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void setViewSetting(String Setting, Object Value) throws UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException {
+ public void setViewSetting(String Setting, Object Value) throws UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException
+ {
xViewSettingsSupplier.getViewSettings().setPropertyValue(Setting, Value);
}
- public void collapseViewCursorToStart() {
+ public void collapseViewCursorToStart()
+ {
XTextViewCursor xTextViewCursor = xTextViewCursorSupplier.getViewCursor();
xTextViewCursor.collapseToStart();
}
-
-
-
-
-
}
diff --git a/wizards/com/sun/star/wizards/ui/AggregateComponent.java b/wizards/com/sun/star/wizards/ui/AggregateComponent.java
index a1883c306397..3b2d4649e89e 100644
--- a/wizards/com/sun/star/wizards/ui/AggregateComponent.java
+++ b/wizards/com/sun/star/wizards/ui/AggregateComponent.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui;
+ ************************************************************************/
+package com.sun.star.wizards.ui;
import java.util.Vector;
import com.sun.star.wizards.common.*;
@@ -39,11 +40,15 @@ import com.sun.star.uno.AnyConverter;
import com.sun.star.awt.*;
-
-public class AggregateComponent extends ControlScroller{
+public class AggregateComponent extends ControlScroller
+{
String[] sFunctions;
- String[] sFunctionOperators = new String[] {"SUM", "AVG", "MIN", "MAX"};;
+ String[] sFunctionOperators = new String[]
+ {
+ "SUM", "AVG", "MIN", "MAX"
+ };
+ ;
QueryMetaData CurDBMetaData;
XButton optDetailQuery;
XButton optSummaryQuery;
@@ -64,103 +69,146 @@ public class AggregateComponent extends ControlScroller{
String LISTBOXFUNCTIONS_ITEM_CHANGED;
String LISTBOXFIELDNAMES_ACTION_PERFORMED;
String LISTBOXFIELDNAMES_ITEM_CHANGED;
- String COMMANDBUTTONPLUS_ACTION_PERFORMED = "addRow";
- String COMMANDBUTTONMINUS_ACTION_PERFORMED = "removeRow";
+ String COMMANDBUTTONPLUS_ACTION_PERFORMED = "addRow";
+ String COMMANDBUTTONMINUS_ACTION_PERFORMED = "removeRow";
Vector ControlRows;
int curHelpID;
int lastHelpIndex;
-
-
/** Creates a new instance of AggrgateComponent */
- public AggregateComponent(WizardDialog _CurUnoDialog, QueryMetaData _CurDBMetaData, int _iStep, int _iPosX, int _iPosY, int _iWidth, int _uitextfieldcount, int _firstHelpID){
- super(_CurUnoDialog, _CurDBMetaData.xMSF, _iStep, _iPosX+10, _iPosY, _iWidth-12, _uitextfieldcount, 18, _firstHelpID+2);
- try{
- curHelpID = _firstHelpID;
- this.CurDBMetaData = _CurDBMetaData;;
- Count = 1;
- optDetailQuery = CurUnoDialog.insertRadioButton("optDetailQuery", 0, new ActionListenerImpl(),
- new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(8), "HID:" + curHelpID, soptDetailQuery, new Integer(_iPosX), new Integer(iCompPosY-42), new Short((short)1), IStep, new Short(curtabindex++), new Integer(iCompWidth)}
- );
-
- optSummaryQuery = CurUnoDialog.insertRadioButton("optSummaryQuery", 0, new ActionListenerImpl(),
- new String[] {"Height", "HelpURL", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(16), "HID:" + (curHelpID+1), soptSummaryQuery, Boolean.TRUE, new Integer(_iPosX), new Integer(iCompPosY-32), IStep, new Short(curtabindex++), new Integer(iCompWidth)}
- );
- CurUnoDialog.insertLabel("lblAggregate",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(8),slblAggregate, new Integer( iCompPosX + 5), new Integer(iCompPosY-10), IStep, new Short(curtabindex++), new Integer(90)}
- );
- CurUnoDialog.insertLabel("lblFieldnames",
- new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {new Integer(8),slblFieldNames, new Integer(iCompPosX + 101), new Integer(iCompPosY-10),IStep, new Short(curtabindex++), new Integer(90)}
- );
- this.setTotalFieldCount(1);
- FontDescriptor oFontDescriptor = new FontDescriptor();
- oFontDescriptor.Weight = com.sun.star.awt.FontWeight.BOLD;
- oFontDescriptor.Height = (short) 14;
-
- int iButtonPosY = iCompPosY + iCompHeight + 3;
- CurUnoDialog.insertButton("btnplus", SOADDROW, new ActionListenerImpl(),
- new String[] {"FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {oFontDescriptor, new Integer(14), "HID:" + (lastHelpIndex+1), "+", new Integer(_iPosX + iCompWidth - 36), new Integer(iButtonPosY), IStep, new Short((curtabindex++)), new Integer(16)}
- );
- CurUnoDialog.insertButton("btnminus", SOREMOVEROW, new ActionListenerImpl(),
- new String[] {"FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] {oFontDescriptor, new Integer(14), "HID:" + (lastHelpIndex+2), "-" , new Integer(_iPosX + iCompWidth - 16), new Integer(iButtonPosY), IStep, new Short(curtabindex++), new Integer(16)}
- );
- CurDBMetaData.Type = getQueryType();
+ public AggregateComponent(WizardDialog _CurUnoDialog, QueryMetaData _CurDBMetaData, int _iStep, int _iPosX, int _iPosY, int _iWidth, int _uitextfieldcount, int _firstHelpID)
+ {
+ super(_CurUnoDialog, _CurDBMetaData.xMSF, _iStep, _iPosX + 10, _iPosY, _iWidth - 12, _uitextfieldcount, 18, _firstHelpID + 2);
+ try
+ {
+ curHelpID = _firstHelpID;
+ this.CurDBMetaData = _CurDBMetaData;
+ ;
+ Count = 1;
+ optDetailQuery = CurUnoDialog.insertRadioButton("optDetailQuery", 0, new ActionListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), "HID:" + curHelpID, soptDetailQuery, new Integer(_iPosX), new Integer(iCompPosY - 42), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(iCompWidth)
+ });
+
+ optSummaryQuery = CurUnoDialog.insertRadioButton("optSummaryQuery", 0, new ActionListenerImpl(),
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(16), "HID:" + (curHelpID + 1), soptSummaryQuery, Boolean.TRUE, new Integer(_iPosX), new Integer(iCompPosY - 32), IStep, new Short(curtabindex++), new Integer(iCompWidth)
+ });
+ CurUnoDialog.insertLabel("lblAggregate",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblAggregate, new Integer(iCompPosX + 5), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), new Integer(90)
+ });
+ CurUnoDialog.insertLabel("lblFieldnames",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblFieldNames, new Integer(iCompPosX + 101), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), new Integer(90)
+ });
+ this.setTotalFieldCount(1);
+ FontDescriptor oFontDescriptor = new FontDescriptor();
+ oFontDescriptor.Weight = com.sun.star.awt.FontWeight.BOLD;
+ oFontDescriptor.Height = (short) 14;
+
+ int iButtonPosY = iCompPosY + iCompHeight + 3;
+ CurUnoDialog.insertButton("btnplus", SOADDROW, new ActionListenerImpl(),
+ new String[]
+ {
+ "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ oFontDescriptor, new Integer(14), "HID:" + (lastHelpIndex + 1), "+", new Integer(_iPosX + iCompWidth - 36), new Integer(iButtonPosY), IStep, new Short((curtabindex++)), new Integer(16)
+ });
+ CurUnoDialog.insertButton("btnminus", SOREMOVEROW, new ActionListenerImpl(),
+ new String[]
+ {
+ "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ oFontDescriptor, new Integer(14), "HID:" + (lastHelpIndex + 2), "-", new Integer(_iPosX + iCompWidth - 16), new Integer(iButtonPosY), IStep, new Short(curtabindex++), new Integer(16)
+ });
+ CurDBMetaData.Type = getQueryType();
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ Resource.showCommonResourceError(CurDBMetaData.xMSF);
+ }
}
- catch(com.sun.star.uno.Exception exception){
- Resource.showCommonResourceError(CurDBMetaData.xMSF);
- }}
-
- public int getQueryType(){
+ public int getQueryType()
+ {
if (((Short) CurUnoDialog.getControlProperty("optDetailQuery", "State")).intValue() == 1)
+ {
return QueryMetaData.QueryType.SODETAILQUERY;
+ }
else
+ {
return QueryMetaData.QueryType.SOSUMMARYQUERY;
+ }
}
+ class ActionListenerImpl implements com.sun.star.awt.XActionListener
+ {
-
- class ActionListenerImpl implements com.sun.star.awt.XActionListener{
-
- public void disposing(EventObject eventObject){
+ public void disposing(EventObject eventObject)
+ {
}
- public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent){
- try{
- int iKey = CurUnoDialog.getControlKey(actionEvent.Source, CurUnoDialog.ControlList);
- switch (iKey){
- case SOADDROW:
- addRow();
- break;
-
- case SOREMOVEROW:
- removeRow();
- break;
-
- default:
- toggleComponent();
- break;
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ try
+ {
+ int iKey = CurUnoDialog.getControlKey(actionEvent.Source, CurUnoDialog.ControlList);
+ switch (iKey)
+ {
+ case SOADDROW:
+ addRow();
+ break;
+
+ case SOREMOVEROW:
+ removeRow();
+ break;
+
+ default:
+ toggleComponent();
+ break;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
}
}
- catch( Exception exception ){
- exception.printStackTrace(System.out);
- }}
}
-
- public int getCount(){
+ public int getCount()
+ {
return Count;
}
-
- protected void insertControlGroup(int i, int ypos){
- if (i == 0){
+ protected void insertControlGroup(int i, int ypos)
+ {
+ if (i == 0)
+ {
int BaseID = 2300;
soptDetailQuery = CurUnoDialog.m_oResource.getResText(BaseID + 11);
soptSummaryQuery = CurUnoDialog.m_oResource.getResText(BaseID + 12);
@@ -171,32 +219,38 @@ public class AggregateComponent extends ControlScroller{
sDuplicateAggregateFunction = CurUnoDialog.m_oResource.getResText(BaseID + 90);
}
if (ControlRowVector == null)
+ {
ControlRowVector = new Vector();
+ }
int locHelpID = curHelpIndex + (i * 2);
ControlRow oControlRow = new ControlRow(i, ypos, locHelpID);
ControlRowVector.add(oControlRow);
}
-
- protected void setControlGroupVisible(int _index, boolean _bIsVisible){
+ protected void setControlGroupVisible(int _index, boolean _bIsVisible)
+ {
ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(_index);
oControlRow.setVisible(_bIsVisible);
if (_index >= (this.CurDBMetaData.AggregateFieldNames.length))
+ {
oControlRow.settovoid();
+ }
}
-
- protected void addRow(){
+ protected void addRow()
+ {
int fieldcount = super.getTotalFieldCount();
registerControlGroupAtIndex(fieldcount);
- if ( fieldcount < super.getBlockIncrementation()){
+ if (fieldcount < super.getBlockIncrementation())
+ {
ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(fieldcount);
oControlRow.setVisible(true);
oControlRow.settovoid();
}
- else{
- ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(super.getBlockIncrementation()-1);
- super.setScrollValue(getScrollValue() + 1, (fieldcount+1));
+ else
+ {
+ ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(super.getBlockIncrementation() - 1);
+ super.setScrollValue(getScrollValue() + 1, (fieldcount + 1));
oControlRow.settovoid();
}
fieldcount++;
@@ -205,17 +259,19 @@ public class AggregateComponent extends ControlScroller{
CurUnoDialog.repaintDialogStep();
}
-
- protected void removeRow(){
+ protected void removeRow()
+ {
int fieldcount = super.getTotalFieldCount();
- if ( fieldcount > 0){
+ if (fieldcount > 0)
+ {
ControlRow oControlRow;
fieldcount--;
- if ((fieldcount+1) <= super.getBlockIncrementation()){
+ if ((fieldcount + 1) <= super.getBlockIncrementation())
+ {
oControlRow = (ControlRow) ControlRowVector.elementAt(fieldcount);
oControlRow.setVisible(false);
}
- super.setScrollValue(getScrollValue()-1, (fieldcount));
+ super.setScrollValue(getScrollValue() - 1, (fieldcount));
super.unregisterControlGroup(fieldcount);
}
@@ -223,23 +279,24 @@ public class AggregateComponent extends ControlScroller{
CurUnoDialog.repaintDialogStep();
}
-
- protected void toggleButtons(){
+ protected void toggleButtons()
+ {
ControlRow curcontrolrow = null;
boolean biscomplete = true;
CurDBMetaData.Type = getQueryType();
- CurUnoDialog.setControlProperty("btnminus", "Enabled", new Boolean((super.getTotalFieldCount()> 0) && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)));
+ CurUnoDialog.setControlProperty("btnminus", "Enabled", new Boolean((super.getTotalFieldCount() > 0) && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)));
int fieldcount = super.getCurFieldCount();
- if (fieldcount > 0){
- curcontrolrow = (ControlRow) ControlRowVector.elementAt(super.getCurFieldCount()-1);
+ if (fieldcount > 0)
+ {
+ curcontrolrow = (ControlRow) ControlRowVector.elementAt(super.getCurFieldCount() - 1);
biscomplete = curcontrolrow.isComplete();
}
- CurUnoDialog.setControlProperty("btnplus", "Enabled", new Boolean(biscomplete && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)));
+ CurUnoDialog.setControlProperty("btnplus", "Enabled", new Boolean(biscomplete && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)));
togglefollowingDialogSteps();
}
-
- public void toggleComponent(){
+ public void toggleComponent()
+ {
CurDBMetaData.Type = getQueryType();
boolean benableComponent = isAggregateComponentEnabled();
CurUnoDialog.setControlProperty("lblAggregate", "Enabled", new Boolean(benableComponent));
@@ -250,112 +307,139 @@ public class AggregateComponent extends ControlScroller{
togglefollowingDialogSteps();
}
-
- private boolean isAggregateComponentEnabled(){
- return(CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY);
+ private boolean isAggregateComponentEnabled()
+ {
+ return (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY);
}
-
- public boolean isGroupingpossible(){
- try {
- boolean benableGroupPage = isAggregateComponentEnabled() && CurDBMetaData.xDBMetaData.supportsGroupBy() && hasonlycompletefunctions();
- String[][] sAggregateFieldNames = this.getAggregateFieldNames();
- if (benableGroupPage){
- for (int i = 0; i < CurDBMetaData.NumericFieldNames.length; i++){
- boolean bisthere = (JavaTools.FieldInTable(sAggregateFieldNames, CurDBMetaData.NumericFieldNames[i]) > -1);
- if (!bisthere)
- return true;
+ public boolean isGroupingpossible()
+ {
+ try
+ {
+ boolean benableGroupPage = isAggregateComponentEnabled() && CurDBMetaData.xDBMetaData.supportsGroupBy() && hasonlycompletefunctions();
+ String[][] sAggregateFieldNames = this.getAggregateFieldNames();
+ if (benableGroupPage)
+ {
+ for (int i = 0; i < CurDBMetaData.NumericFieldNames.length; i++)
+ {
+ boolean bisthere = (JavaTools.FieldInTable(sAggregateFieldNames, CurDBMetaData.NumericFieldNames[i]) > -1);
+ if (!bisthere)
+ {
+ return true;
+ }
+ }
}
}
- } catch (SQLException e) {
- e.printStackTrace(System.out);
- }
- return false;
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return false;
}
-
- private void togglefollowingDialogSteps(){
+ private void togglefollowingDialogSteps()
+ {
boolean benabletherest = true;
boolean benableGroupPage = isGroupingpossible();
CurUnoDialog.setStepEnabled(UIConsts.SOGROUPSELECTIONPAGE, benableGroupPage);
CurUnoDialog.setStepEnabled(UIConsts.SOGROUPFILTERPAGE, benableGroupPage && CurDBMetaData.GroupFieldNames.length > 0);
if (isAggregateComponentEnabled())
+ {
benabletherest = hasonlycompletefunctions();
+ }
CurUnoDialog.enablefromStep(UIConsts.SOTITLESPAGE, benabletherest);
CurUnoDialog.enableNextButton(benabletherest);
}
-
- private void hideControlRowsfromindex(int _index){
- if (_index < this.ControlRowVector.size()){
- for (int i = _index; i < ControlRowVector.size();i++){
+ private void hideControlRowsfromindex(int _index)
+ {
+ if (_index < this.ControlRowVector.size())
+ {
+ for (int i = _index; i < ControlRowVector.size(); i++)
+ {
ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(i);
// if (i == _index)
// oControlRow.settovoid();
// else
- oControlRow.setVisible(false);
+ oControlRow.setVisible(false);
}
}
}
- public String[][] getAggregateFieldNames(){
- try{
- CurDBMetaData.Type = getQueryType();
- if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY){
- Vector aggregatevector = new Vector();
- PropertyValue[][] aggregatelist = this.getScrollFieldValues();
- PropertyValue[] currowproperties;
- PropertyValue curaggregateproperty;
- int a = 0;
- if (CurDBMetaData.AggregateFieldNames != null){
- for (int i = 0; i < aggregatelist.length; i++){
- currowproperties = aggregatelist[i];
- if ((currowproperties[0].Value != null) && (currowproperties[1].Value != null)){
- short[] iselfield = (short[]) AnyConverter.toArray(currowproperties[1].Value);
- short[] iselfunction = (short[]) AnyConverter.toArray(currowproperties[0].Value);
- if ((iselfield.length > 0) && (iselfunction.length > 0)){
- String[] curaggregatename = new String[2];
- curaggregatename[0] = CurDBMetaData.NumericFieldNames[iselfield[0]];
- curaggregatename[1] = this.sFunctionOperators[iselfunction[0]];
- aggregatevector.add(curaggregatename);
- a++;
+ public String[][] getAggregateFieldNames()
+ {
+ try
+ {
+ CurDBMetaData.Type = getQueryType();
+ if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)
+ {
+ Vector aggregatevector = new Vector();
+ PropertyValue[][] aggregatelist = this.getScrollFieldValues();
+ PropertyValue[] currowproperties;
+ PropertyValue curaggregateproperty;
+ int a = 0;
+ if (CurDBMetaData.AggregateFieldNames != null)
+ {
+ for (int i = 0; i < aggregatelist.length; i++)
+ {
+ currowproperties = aggregatelist[i];
+ if ((currowproperties[0].Value != null) && (currowproperties[1].Value != null))
+ {
+ short[] iselfield = (short[]) AnyConverter.toArray(currowproperties[1].Value);
+ short[] iselfunction = (short[]) AnyConverter.toArray(currowproperties[0].Value);
+ if ((iselfield.length > 0) && (iselfunction.length > 0))
+ {
+ String[] curaggregatename = new String[2];
+ curaggregatename[0] = CurDBMetaData.NumericFieldNames[iselfield[0]];
+ curaggregatename[1] = this.sFunctionOperators[iselfunction[0]];
+ aggregatevector.add(curaggregatename);
+ a++;
+ }
}
}
}
+ CurDBMetaData.AggregateFieldNames = new String[a][2];
+ aggregatevector.toArray(CurDBMetaData.AggregateFieldNames);
}
- CurDBMetaData.AggregateFieldNames = new String[a][2];
- aggregatevector.toArray(CurDBMetaData.AggregateFieldNames);
- }
- int iduplicate = JavaTools.getDuplicateFieldIndex(CurDBMetaData.AggregateFieldNames);
- if (iduplicate != -1){
- sDuplicateAggregateFunction = JavaTools.replaceSubString(sDuplicateAggregateFunction, CurDBMetaData.AggregateFieldNames[iduplicate][0], "<NUMERICFIELD>");
- int index = JavaTools.FieldInList(sFunctionOperators, CurDBMetaData.AggregateFieldNames[iduplicate][1]);
- String sDisplayFunction = sFunctions[index];
- sDuplicateAggregateFunction = JavaTools.replaceSubString(sDuplicateAggregateFunction, sDisplayFunction, "<FUNCTION>");
- CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sDuplicateAggregateFunction);
- CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2)));
- return new String[][]{};
+ int iduplicate = JavaTools.getDuplicateFieldIndex(CurDBMetaData.AggregateFieldNames);
+ if (iduplicate != -1)
+ {
+ sDuplicateAggregateFunction = JavaTools.replaceSubString(sDuplicateAggregateFunction, CurDBMetaData.AggregateFieldNames[iduplicate][0], "<NUMERICFIELD>");
+ int index = JavaTools.FieldInList(sFunctionOperators, CurDBMetaData.AggregateFieldNames[iduplicate][1]);
+ String sDisplayFunction = sFunctions[index];
+ sDuplicateAggregateFunction = JavaTools.replaceSubString(sDuplicateAggregateFunction, sDisplayFunction, "<FUNCTION>");
+ CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sDuplicateAggregateFunction);
+ CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2)));
+ return new String[][]
+ {
+ };
+ }
+ else
+ {
+ return CurDBMetaData.AggregateFieldNames;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return null;
}
- else
- return CurDBMetaData.AggregateFieldNames;
}
- catch (Exception exception){
- exception.printStackTrace(System.out);
- return null;
- }}
-
- public void initialize(){
+ public void initialize()
+ {
CurDBMetaData.setNumericFields();
initializeScrollFields();
int icount = CurDBMetaData.AggregateFieldNames.length;
- if (icount == 0){
+ if (icount == 0)
+ {
super.initialize(1);
hideControlRowsfromindex(1);
}
- else{
+ else
+ {
super.initialize(icount);
hideControlRowsfromindex(icount);
}
@@ -363,130 +447,168 @@ public class AggregateComponent extends ControlScroller{
CurUnoDialog.repaintDialogStep();
}
-
- protected void initializeScrollFields(){
+ protected void initializeScrollFields()
+ {
ControlRow curControlRow;
- if (CurDBMetaData.AggregateFieldNames != null){
- for (int i = 0; i < this.getBlockIncrementation(); i++){
+ if (CurDBMetaData.AggregateFieldNames != null)
+ {
+ for (int i = 0; i < this.getBlockIncrementation(); i++)
+ {
curControlRow = (ControlRow) ControlRowVector.elementAt(i);
curControlRow.insertFieldNames();
}
for (int i = 0; i <= CurDBMetaData.AggregateFieldNames.length; i++)
+ {
registerControlGroupAtIndex(i);
+ }
}
}
-
- private void registerControlGroupAtIndex(int _index){
- short[] iselfunctionlist = new short[]{};
- short[] iselfieldslist = new short[]{};
+ private void registerControlGroupAtIndex(int _index)
+ {
+ short[] iselfunctionlist = new short[]
+ {
+ };
+ short[] iselfieldslist = new short[]
+ {
+ };
PropertyValue[] currowproperties = new PropertyValue[2];
- if (_index < CurDBMetaData.AggregateFieldNames.length){
- short iselfieldsindex = (short) JavaTools.FieldInList(CurDBMetaData.NumericFieldNames, CurDBMetaData.AggregateFieldNames[_index][0] );
- iselfieldslist = new short[]{iselfieldsindex};
- short iselfunctionindex = (short) JavaTools.FieldInList(sFunctionOperators, CurDBMetaData.AggregateFieldNames[_index][1] );
- iselfunctionlist = new short[]{iselfunctionindex};
- }
- currowproperties[0] = Properties.createProperty( getFunctionControlName(_index), iselfunctionlist, _index);
- currowproperties[1] = Properties.createProperty( getFieldsControlName(_index), iselfieldslist, _index); //getTitleName(i)
+ if (_index < CurDBMetaData.AggregateFieldNames.length)
+ {
+ short iselfieldsindex = (short) JavaTools.FieldInList(CurDBMetaData.NumericFieldNames, CurDBMetaData.AggregateFieldNames[_index][0]);
+ iselfieldslist = new short[]
+ {
+ iselfieldsindex
+ };
+ short iselfunctionindex = (short) JavaTools.FieldInList(sFunctionOperators, CurDBMetaData.AggregateFieldNames[_index][1]);
+ iselfunctionlist = new short[]
+ {
+ iselfunctionindex
+ };
+ }
+ currowproperties[0] = Properties.createProperty(getFunctionControlName(_index), iselfunctionlist, _index);
+ currowproperties[1] = Properties.createProperty(getFieldsControlName(_index), iselfieldslist, _index); //getTitleName(i)
super.registerControlGroup(currowproperties, _index);
}
-
- private String getFunctionControlName(int _index){
+ private String getFunctionControlName(int _index)
+ {
String namesuffix = "_" + String.valueOf(_index + 1);
return "lstfunctions" + namesuffix;
}
- private String getFieldsControlName(int _index){
+ private String getFieldsControlName(int _index)
+ {
String namesuffix = "_" + String.valueOf(_index + 1);
return "lstFieldnames" + namesuffix;
}
-
- private boolean hasonlycompletefunctions(){
+ private boolean hasonlycompletefunctions()
+ {
int maxfieldcount = super.getCurFieldCount();
- if (maxfieldcount > 0){
- ControlRow curcontrolrow = (ControlRow) this.ControlRowVector.elementAt(maxfieldcount-1);
+ if (maxfieldcount > 0)
+ {
+ ControlRow curcontrolrow = (ControlRow) this.ControlRowVector.elementAt(maxfieldcount - 1);
return curcontrolrow.isComplete();
}
else
+ {
return false;
+ }
}
+ protected class ControlRow
+ {
-
- protected class ControlRow{
private XListBox xFieldListBox;
private XListBox xFunctionListBox;
private int index;
- protected ControlRow(int _index, int ypos, int _curHelpID){
- try{
- this.index = _index;
- xFunctionListBox = CurUnoDialog.insertListBox(getFunctionControlName(index), 1, null, new ItemListenerImpl(),
- new String[] { "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE, new Integer(12), "HID:" + _curHelpID++, new Integer(iCompPosX+4), new Integer(ypos), UIConsts.INVISIBLESTEP, sFunctions, new Short(curtabindex++), new Integer(88)}
- );
-
- xFieldListBox = CurUnoDialog.insertListBox(getFieldsControlName(index),1, null, new ItemListenerImpl(),
- new String[] {"Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE, new Integer(12), "HID:" + _curHelpID++, new Integer(iCompPosX + 98), new Integer(ypos), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(86)}
- );
- lastHelpIndex = _curHelpID-1;
- }
- catch( Exception exception ){
- exception.printStackTrace(System.out);
- }}
-
+ protected ControlRow(int _index, int ypos, int _curHelpID)
+ {
+ try
+ {
+ this.index = _index;
+ xFunctionListBox = CurUnoDialog.insertListBox(getFunctionControlName(index), 1, null, new ItemListenerImpl(),
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(12), "HID:" + _curHelpID++, new Integer(iCompPosX + 4), new Integer(ypos), UIConsts.INVISIBLESTEP, sFunctions, new Short(curtabindex++), new Integer(88)
+ });
+
+ xFieldListBox = CurUnoDialog.insertListBox(getFieldsControlName(index), 1, null, new ItemListenerImpl(),
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(12), "HID:" + _curHelpID++, new Integer(iCompPosX + 98), new Integer(ypos), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(86)
+ });
+ lastHelpIndex = _curHelpID - 1;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
- private String getSelectedFieldName(){
+ private String getSelectedFieldName()
+ {
return xFieldListBox.getSelectedItem();
}
-
- private String getSelectedFunction(){
+ private String getSelectedFunction()
+ {
return xFunctionListBox.getSelectedItem();
}
-
- private void setVisible(boolean _bvisible){
+ private void setVisible(boolean _bvisible)
+ {
CurUnoDialog.setControlVisible(getFunctionControlName(index), _bvisible);
CurUnoDialog.setControlVisible(getFieldsControlName(index), _bvisible);
}
-
- private void insertFieldNames(){
+ private void insertFieldNames()
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(xFieldListBox), "StringItemList", CurDBMetaData.NumericFieldNames);
}
- private boolean isComplete(){
+ private boolean isComplete()
+ {
boolean bfieldnameisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFieldListBox), "SelectedItems") != null);
boolean bfunctionisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFunctionListBox), "SelectedItems") != null);
return (bfieldnameisselected && bfunctionisselected);
}
-
- private void settovoid(){
+ private void settovoid()
+ {
CurUnoDialog.deselectListBox(xFieldListBox);
CurUnoDialog.deselectListBox(xFunctionListBox);
}
+ protected class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
- protected class ItemListenerImpl implements com.sun.star.awt.XItemListener{
-
- public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject){
- try{
- toggleButtons();
- togglefollowingDialogSteps();
+ public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
+ try
+ {
+ toggleButtons();
+ togglefollowingDialogSteps();
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
}
- catch (Exception exception){
- exception.printStackTrace(System.out);
- }}
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
}
-
}
}
diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
index 6dce29035130..d5d787744fd5 100644
--- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.ui;
import com.sun.star.wizards.common.*;
@@ -44,7 +43,9 @@ import java.text.Collator;
import java.util.Comparator;
import java.util.Locale;
-public class CommandFieldSelection extends FieldSelection implements Comparator{
+public class CommandFieldSelection extends FieldSelection implements Comparator
+{
+
CommandMetaData CurDBMetaData;
XListBox xTableListBox;
XFixedText xlblTable;
@@ -61,27 +62,32 @@ public class CommandFieldSelection extends FieldSelection implements Comparator{
WizardDialog oWizardDialog;
private Collator aCollator = null;
- class ItemListenerImpl implements com.sun.star.awt.XItemListener {
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
- public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) {
+ public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
short[] SelItems = (short[]) CurUnoDialog.getControlProperty(sTableListBoxName, "SelectedItems");
- if (SelItems.length > 0) {
+ if (SelItems.length > 0)
+ {
iOldSelPos = iSelPos;
iSelPos = SelItems[0];
- if ((iSelPos > -1) && (iSelPos != iOldSelPos)){
+ if ((iSelPos > -1) && (iSelPos != iOldSelPos))
+ {
if (!AppendMode)
+ {
oWizardDialog.enablefromStep(IStep.intValue() + 1, false);
+ }
fillUpFieldsListbox();
}
}
}
-
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
}
-
/**
* instantiates a CommandFieldSelection with a preselected command
* @param _CurUnoDialog
@@ -94,13 +100,13 @@ public class CommandFieldSelection extends FieldSelection implements Comparator{
* @param _bgetQueries
* @param _ifirstHID
*/
- public CommandFieldSelection(WizardDialog _CurUnoDialog, CommandMetaData _CurDBMetaData, int iStep, int _iHeight, String _reslblFields, String _reslblSelFields, String _reslblTables, boolean _bgetQueries, int _ifirstHID) {
+ public CommandFieldSelection(WizardDialog _CurUnoDialog, CommandMetaData _CurDBMetaData, int iStep, int _iHeight, String _reslblFields, String _reslblSelFields, String _reslblTables, boolean _bgetQueries, int _ifirstHID)
+ {
super(_CurUnoDialog, iStep, 95, 57, 210, _iHeight, _reslblFields, _reslblSelFields, (_ifirstHID + 1), true);
insertControls(_CurDBMetaData, _bgetQueries, _reslblTables);
oWizardDialog = (WizardDialog) CurUnoDialog;
}
-
/**
* instantiates a CommandFieldSelection with a preselected command
* @param _CurUnoDialog
@@ -112,15 +118,17 @@ public class CommandFieldSelection extends FieldSelection implements Comparator{
* @param _bgetQueries
* @param _ifirstHID
*/
- public CommandFieldSelection(UnoDialog _CurUnoDialog, CommandMetaData _CurDBMetaData, int _iHeight, String _reslblFields, String _reslblSelFields, String _reslblTables, boolean _bgetQueries, int _ifirstHID) {
+ public CommandFieldSelection(UnoDialog _CurUnoDialog, CommandMetaData _CurDBMetaData, int _iHeight, String _reslblFields, String _reslblSelFields, String _reslblTables, boolean _bgetQueries, int _ifirstHID)
+ {
super(_CurUnoDialog, 1, 95, 57, 210, _iHeight, _reslblFields, _reslblSelFields, (_ifirstHID + 1), true);
insertControls(_CurDBMetaData, _bgetQueries, _reslblTables);
oWizardDialog = (WizardDialog) CurUnoDialog;
}
-
- private void insertControls(CommandMetaData _CurDBMetaData, boolean _bgetQueries, String _reslblTables){
- try {
+ private void insertControls(CommandMetaData _CurDBMetaData, boolean _bgetQueries, String _reslblTables)
+ {
+ try
+ {
this.AppendMode = !_bgetQueries;
this.bgetQueries = _bgetQueries;
this.CurDBMetaData = _CurDBMetaData;
@@ -131,14 +139,28 @@ public class CommandFieldSelection extends FieldSelection implements Comparator{
sQueryPrefix = getQueryPrefix();
Integer LabelWidth = new Integer(getListboxWidth().intValue() + 6);
xlblTable = CurUnoDialog.insertLabel(sTableLabelName,
- new String[] { "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { Boolean.FALSE, new Integer(8), _reslblTables, new Integer(95), new Integer(27), IStep, new Short((short) 3), LabelWidth });
+ new String[]
+ {
+ "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, new Integer(8), _reslblTables, new Integer(95), new Integer(27), IStep, new Short((short) 3), LabelWidth
+ });
xTableListBox = CurUnoDialog.insertListBox(sTableListBoxName, 0, null, new ItemListenerImpl(),
- new String[] { "Dropdown", "Enabled", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { Boolean.TRUE, Boolean.FALSE, new Integer(12), "HID:" + (super.FirstHelpIndex-1), new Short("7"), new Integer(95), new Integer(37), IStep, new Short((short) 4), getListboxWidth()});
+ new String[]
+ {
+ "Dropdown", "Enabled", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, Boolean.FALSE, new Integer(12), "HID:" + (super.FirstHelpIndex - 1), new Short("7"), new Integer(95), new Integer(37), IStep, new Short((short) 4), getListboxWidth()
+ });
XWindow xTableListBoxWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTableListBox);
fillupCommandListBox();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
@@ -146,126 +168,177 @@ public class CommandFieldSelection extends FieldSelection implements Comparator{
/**
* @return Returns the sQueryPrefix.
*/
- public String getQueryPrefix() {
+ public String getQueryPrefix()
+ {
if (sQueryPrefix == null)
+ {
sQueryPrefix = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 22);
+ }
return sQueryPrefix;
}
-
- private String getCommandPrefix(int _nCommandType){
+ private String getCommandPrefix(int _nCommandType)
+ {
if (_nCommandType == CommandType.TABLE)
+ {
return getTablePrefix();
+ }
else if (_nCommandType == CommandType.QUERY)
+ {
return getQueryPrefix();
- else return "";
+ }
+ else
+ {
+ return "";
+ }
}
-
/**
* @return Returns the sTablePrefix.
*/
- public String getTablePrefix() {
+ public String getTablePrefix()
+ {
if (sTablePrefix == null)
+ {
sTablePrefix = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 21);
+ }
return sTablePrefix;
}
- private short getselectedItemPos(){
+ private short getselectedItemPos()
+ {
short[] iSelPoses = ((short[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems"));
if (iSelPoses.length > 0)
+ {
return iSelPoses[0];
- else{
- if (this.bpreselectCommand){
- String[] sItemList= ((String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList"));
+ }
+ else
+ {
+ if (this.bpreselectCommand)
+ {
+ String[] sItemList = ((String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList"));
if (sItemList.length > 0)
+ {
return (short) 0;
+ }
}
return (short) -1;
}
}
- public void fillUpFieldsListbox() {
- try {
- boolean binitialize = false;
- String curCommandName = "";
- //As the peer of the control might not yet exist we have to query the model for the SelectedItems
- String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, "StringItemList");
- short iSelPos = getselectedItemPos();
- if (!bgetQueries){
- curCommandName = sLocList[iSelPos];
- CurDBMetaData.setTableByName(curCommandName);
- binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode);
- }
- else {
- if (sLocList[iSelPos].startsWith(sTablePrefix)){
- CurDBMetaData.setCommandType(CommandType.TABLE);
- curCommandName = JavaTools.replaceSubString(sLocList[iSelPos], "", sTablePrefix);
+ public void fillUpFieldsListbox()
+ {
+ try
+ {
+ boolean binitialize = false;
+ String curCommandName = "";
+ //As the peer of the control might not yet exist we have to query the model for the SelectedItems
+ String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, "StringItemList");
+ short iSelPos = getselectedItemPos();
+ if (!bgetQueries)
+ {
+ curCommandName = sLocList[iSelPos];
CurDBMetaData.setTableByName(curCommandName);
binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode);
}
- else {
- CurDBMetaData.setCommandType(CommandType.QUERY);
- curCommandName = JavaTools.replaceSubString(sLocList[iSelPos], "", sQueryPrefix);
- CurDBMetaData.setQueryByName(curCommandName);
- binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.QUERY, AppendMode);
+ else
+ {
+ if (sLocList[iSelPos].startsWith(sTablePrefix))
+ {
+ CurDBMetaData.setCommandType(CommandType.TABLE);
+ curCommandName = JavaTools.replaceSubString(sLocList[iSelPos], "", sTablePrefix);
+ CurDBMetaData.setTableByName(curCommandName);
+ binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode);
+ }
+ else
+ {
+ CurDBMetaData.setCommandType(CommandType.QUERY);
+ curCommandName = JavaTools.replaceSubString(sLocList[iSelPos], "", sQueryPrefix);
+ CurDBMetaData.setQueryByName(curCommandName);
+ binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.QUERY, AppendMode);
+ }
}
- }
- if (binitialize){
- CurDBMetaData.setCommandName(curCommandName);
- if (CurDBMetaData.AllFieldNames != null){
- if (CurDBMetaData.AllFieldNames.length > 0) {
- initialize(CurDBMetaData.AllFieldNames, AppendMode, CurDBMetaData.getMaxColumnsInSelect());
- return;
+ if (binitialize)
+ {
+ CurDBMetaData.setCommandName(curCommandName);
+ if (CurDBMetaData.AllFieldNames != null)
+ {
+ if (CurDBMetaData.AllFieldNames.length > 0)
+ {
+ initialize(CurDBMetaData.AllFieldNames, AppendMode, CurDBMetaData.getMaxColumnsInSelect());
+ return;
+ }
}
}
+ emptyFieldsListBoxes();
}
- emptyFieldsListBoxes();
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- }}
-
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
/** returns the selected entry index in the commandListbox
*
* @return
* @throws com.sun.star.wizards.common.TerminateWizardException
*/
- private short fillupCommandListBox() throws com.sun.star.wizards.common.TerminateWizardException {
+ private short fillupCommandListBox() throws com.sun.star.wizards.common.TerminateWizardException
+ {
short[] iSelArray = new short[0];
boolean bgetFields = false;
String[] ContentList = new String[0];
CurDBMetaData.setCommandNames();
- if (bgetQueries) {
+ if (bgetQueries)
+ {
ContentList = new String[CurDBMetaData.TableNames.length + CurDBMetaData.QueryNames.length];
System.arraycopy(CurDBMetaData.QueryNames, 0, ContentList, CurDBMetaData.TableNames.length, CurDBMetaData.QueryNames.length);
ContentList = setPrefixinArray(ContentList, sQueryPrefix, CurDBMetaData.TableNames.length, CurDBMetaData.QueryNames.length);
- } else
+ }
+ else
+ {
ContentList = new String[CurDBMetaData.TableNames.length];
+ }
System.arraycopy(CurDBMetaData.TableNames, 0, ContentList, 0, CurDBMetaData.TableNames.length);
if (bgetQueries)
+ {
ContentList = setPrefixinArray(ContentList, sTablePrefix, 0, CurDBMetaData.TableNames.length);
+ }
java.util.Arrays.sort(ContentList, this);
Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList", ContentList);
short iSelPos = getselectedItemPos();
- if (bpreselectCommand) {
- if (iSelPos > -1) {
+ if (bpreselectCommand)
+ {
+ if (iSelPos > -1)
+ {
bgetFields = true;
- iSelArray = new short[] { iSelPos };
+ iSelArray = new short[]
+ {
+ iSelPos
+ };
}
- } else {
+ }
+ else
+ {
emptyFieldsListBoxes();
- iSelArray = new short[] {(short) iSelPos };
+ iSelArray = new short[]
+ {
+ (short) iSelPos
+ };
}
Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", iSelArray);
toggleCommandListBox(true);
if (bgetFields)
+ {
fillUpFieldsListbox();
+ }
return iSelPos;
}
- private Collator getCollator() {
- if (this.aCollator == null) {
+ private Collator getCollator()
+ {
+ if (this.aCollator == null)
+ {
com.sun.star.lang.Locale aOfficeLocale = Configuration.getOfficeLocale(this.CurDBMetaData.xMSF);
java.util.Locale aJavaLocale = new java.util.Locale(aOfficeLocale.Language, aOfficeLocale.Country, aOfficeLocale.Variant);
//Get the Collator for US English and set its strength to PRIMARY
@@ -275,90 +348,134 @@ public class CommandFieldSelection extends FieldSelection implements Comparator{
return aCollator;
}
- public int compare(Object _oObject1, Object _oObject2){
+ public int compare(Object _oObject1, Object _oObject2)
+ {
return this.getCollator().compare(_oObject1, _oObject2);
}
-
- private String[] setPrefixinArray(String[] _ContentList, String _sprefix, int _startindex, int _nlen) {
+ private String[] setPrefixinArray(String[] _ContentList, String _sprefix, int _startindex, int _nlen)
+ {
for (int i = _startindex; i < _startindex + _nlen; i++)
+ {
_ContentList[i] = _sprefix + _ContentList[i];
+ }
return _ContentList;
}
-
- public void toggleCommandListBox(String[] _NewItems) {
+ public void toggleCommandListBox(String[] _NewItems)
+ {
boolean bdoenable = !(QueryMetaData.getIncludedCommandNames(_NewItems).length >= CurDBMetaData.getMaxTablesInSelect());
toggleCommandListBox(bdoenable);
}
-
- public void toggleCommandListBox(boolean _bdoenable) {
+ public void toggleCommandListBox(boolean _bdoenable)
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "Enabled", new Boolean(_bdoenable));
Helper.setUnoPropertyValue(UnoDialog.getModel(xlblTable), "Enabled", new Boolean(_bdoenable));
}
- public String getSelectedCommandName(){
+ public String getSelectedCommandName()
+ {
String sCommandname = xTableListBox.getSelectedItem();
if (sCommandname.startsWith(this.sTablePrefix))
+ {
return sCommandname.substring(sTablePrefix.length());
+ }
else if ((sCommandname.startsWith(this.sQueryPrefix)))
+ {
return sCommandname.substring(sQueryPrefix.length());
+ }
else
+ {
return sCommandname;
+ }
}
-
- public int getSelectedCommandType(){
+ public int getSelectedCommandType()
+ {
String sCommandname = xTableListBox.getSelectedItem();
if (sCommandname.startsWith(this.sTablePrefix))
+ {
return CommandType.TABLE;
+ }
else
+ {
return CommandType.QUERY;
+ }
}
+ public void preselectCommand(PropertyValue[] _aPropertyValue, boolean _bReadOnly)
+ {
+ try
+ {
+ if (Properties.hasPropertyValue(_aPropertyValue, "CommandType"))
+ {
+ int nCommandType = AnyConverter.toInt(Properties.getPropertyValue(_aPropertyValue, "CommandType"));
+ String sCommand = AnyConverter.toString(Properties.getPropertyValue(_aPropertyValue, "Command"));
+ if (sCommand != null)
+ {
+ preselectCommand(sCommand, nCommandType, _bReadOnly);
+ }
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace();
+ }
+ }
- public void preselectCommand(PropertyValue[] _aPropertyValue, boolean _bReadOnly){
- try {
- if (Properties.hasPropertyValue(_aPropertyValue, "CommandType")){
- int nCommandType = AnyConverter.toInt(Properties.getPropertyValue(_aPropertyValue, "CommandType"));
- String sCommand = AnyConverter.toString(Properties.getPropertyValue(_aPropertyValue, "Command"));
- if (sCommand != null)
- preselectCommand(sCommand, nCommandType, _bReadOnly );
- }
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- }}
-
-
-
- public void preselectCommand(String _selitem, int _nCommandType, boolean _bReadOnly){
- if (_selitem.length() > 0){
+ public void preselectCommand(String _selitem, int _nCommandType, boolean _bReadOnly)
+ {
+ if (_selitem.length() > 0)
+ {
String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList");
String sPrefix = getCommandPrefix(_nCommandType);
short iselpos = (short) JavaTools.FieldInList(sitems, sPrefix + _selitem);
if (iselpos > -1)
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]{iselpos});
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]
+ {
+ iselpos
+ });
+ }
this.fillUpFieldsListbox();
}
else
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]{});
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]
+ {
+ });
+ }
if (_bReadOnly)
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "ReadOnly", new Boolean(_selitem.length() > 0));
+ }
}
-
- public void preselectCommand(String _selitem, boolean _bReadOnly){
- if (_selitem.length() > 0){
+ public void preselectCommand(String _selitem, boolean _bReadOnly)
+ {
+ if (_selitem.length() > 0)
+ {
String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList");
short iselpos = (short) JavaTools.FieldInList(sitems, getTablePrefix() + _selitem);
if (iselpos > -1)
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]{iselpos});
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]
+ {
+ iselpos
+ });
+ }
this.fillUpFieldsListbox();
}
else
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]{});
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]
+ {
+ });
+ }
if (_bReadOnly)
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "ReadOnly", new Boolean(_selitem.length() > 0));
+ }
}
}
diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.java b/wizards/com/sun/star/wizards/ui/ControlScroller.java
index 30074157ec62..38fdca98edd7 100644
--- a/wizards/com/sun/star/wizards/ui/ControlScroller.java
+++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java
@@ -26,7 +26,9 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui;
+ ************************************************************************/
+package com.sun.star.wizards.ui;
+
import com.sun.star.awt.FocusEvent;
import com.sun.star.awt.XFocusListener;
import com.sun.star.awt.XScrollBar;
@@ -40,7 +42,9 @@ import com.sun.star.wizards.common.*;
import java.util.*;
-public abstract class ControlScroller {
+public abstract class ControlScroller
+{
+
protected WizardDialog CurUnoDialog;
protected XMultiServiceFactory xMSF;
private Object oImgControl;
@@ -71,12 +75,15 @@ public abstract class ControlScroller {
protected Vector ControlGroupVector = new Vector();
protected PeerConfig oTitlePeerConfig;
- class AdjustmentListenerImpl implements com.sun.star.awt.XAdjustmentListener {
+ class AdjustmentListenerImpl implements com.sun.star.awt.XAdjustmentListener
+ {
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
- public void adjustmentValueChanged(AdjustmentEvent AdjustEvent) {
+ public void adjustmentValueChanged(AdjustmentEvent AdjustEvent)
+ {
scrollControls();
}
}
@@ -93,7 +100,8 @@ public abstract class ControlScroller {
* @author bc93774
*/
// TODO add parameters for tabindices and helpindex
- protected ControlScroller(WizardDialog _CurUnoDialog, XMultiServiceFactory _xMSF, int _iStep, int _iCompPosX, int _iCompPosY, int _iCompWidth, int _nblockincrement, int _nlinedistance, int _firsthelpindex) {
+ protected ControlScroller(WizardDialog _CurUnoDialog, XMultiServiceFactory _xMSF, int _iStep, int _iCompPosX, int _iCompPosY, int _iCompWidth, int _nblockincrement, int _nlinedistance, int _firsthelpindex)
+ {
this.xMSF = _xMSF;
this.nblockincrement = _nblockincrement;
this.CurUnoDialog = _CurUnoDialog;
@@ -114,27 +122,48 @@ public abstract class ControlScroller {
nlineincrement = 1;
sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.xDlgNameAccess, "imgBackground");
oImgControl = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgBackground" + sIncSuffix,
- new String[] { "Border", "Height", "PositionX", "PositionY", "Step", "Width" },
- new Object[] { new Short("1"), new Integer(iCompHeight), ICompPosX, new Integer(iCompPosY), IStep, ICompWidth });
+ new String[]
+ {
+ "Border", "Height", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Short("1"), new Integer(iCompHeight), ICompPosX, new Integer(iCompPosY), IStep, ICompWidth
+ });
oImgControl = CurUnoDialog.xDlgContainer.getControl("imgBackground" + sIncSuffix);
setComponentMouseTransparent();
xScrollBar = CurUnoDialog.insertScrollBar("TitleScrollBar" + sIncSuffix, 0,
new AdjustmentListenerImpl(),
- new String[] { "Border", "Enabled", "Height", "HelpURL", "Orientation", "PositionX", "PositionY", "Step", "Width" },
- new Object[] { new Short((short)0), new Boolean(true), new Integer(ScrollHeight), "HID:" + curHelpIndex, new Integer(ScrollBarOrientation.VERTICAL), new Integer(iCompPosX + iCompWidth - iScrollBarWidth - 1), new Integer(iCompPosY + 1), IStep, new Integer(iScrollBarWidth)});
+ new String[]
+ {
+ "Border", "Enabled", "Height", "HelpURL", "Orientation", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Short((short) 0), new Boolean(true), new Integer(ScrollHeight), "HID:" + curHelpIndex, new Integer(ScrollBarOrientation.VERTICAL), new Integer(iCompPosX + iCompWidth - iScrollBarWidth - 1), new Integer(iCompPosY + 1), IStep, new Integer(iScrollBarWidth)
+ });
scrollfields = new Vector();
int ypos = iStartPosY + SORELFIRSTPOSY;
- for (int i = 0; i < nblockincrement; i++) {
+ for (int i = 0; i < nblockincrement; i++)
+ {
insertControlGroup(i, ypos);
ypos += linedistance;
}
}
- public void setComponentMouseTransparent(){
- CurUnoDialog.getPeerConfiguration().setPeerProperties(oImgControl, new String[] { "MouseTransparent" }, new Boolean[] { Boolean.TRUE });
+ public void setComponentMouseTransparent()
+ {
+ CurUnoDialog.getPeerConfiguration().setPeerProperties(oImgControl, new String[]
+ {
+ "MouseTransparent"
+ }, new Boolean[]
+ {
+ Boolean.TRUE
+ });
}
- protected void setScrollBarOrientationHorizontal() {
+ protected void setScrollBarOrientationHorizontal()
+ {
Helper.setUnoPropertyValue(xScrollBar, "Orientation", new Integer(ScrollBarOrientation.HORIZONTAL));
}
@@ -142,95 +171,152 @@ public abstract class ControlScroller {
* @author bc93774
* @param _ntotfieldcount: The number of fields that are to be administered by the ControlScroller
*/
- protected void initialize(int _ntotfieldcount) {
- try {
+ protected void initialize(int _ntotfieldcount)
+ {
+ try
+ {
boolean bisVisible;
ntotfieldcount = _ntotfieldcount;
setCurFieldCount();
nscrollvalue = 0;
Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("ScrollValue"), new Integer(nscrollvalue));
if (ntotfieldcount > nblockincrement)
- Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[] { "Enabled", "BlockIncrement", "LineIncrement", "ScrollValue", "ScrollValueMax" }, new Object[] { Boolean.TRUE, new Integer(nblockincrement), new Integer(nlineincrement), new Integer(nscrollvalue), new Integer(ntotfieldcount - nblockincrement)});
+ {
+ Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[]
+ {
+ "Enabled", "BlockIncrement", "LineIncrement", "ScrollValue", "ScrollValueMax"
+ }, new Object[]
+ {
+ Boolean.TRUE, new Integer(nblockincrement), new Integer(nlineincrement), new Integer(nscrollvalue), new Integer(ntotfieldcount - nblockincrement)
+ });
+ }
else
- Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[] { "Enabled", "ScrollValue" }, new Object[] { Boolean.FALSE, new Integer(nscrollvalue)});
+ {
+ Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[]
+ {
+ "Enabled", "ScrollValue"
+ }, new Object[]
+ {
+ Boolean.FALSE, new Integer(nscrollvalue)
+ });
+ }
fillupControls(true);
- } catch (java.lang.Exception ex) {
+ }
+ catch (java.lang.Exception ex)
+ {
ex.printStackTrace();
}
}
- protected void fillupControls(boolean binitialize) {
+ protected void fillupControls(boolean binitialize)
+ {
int newindex;
PropertyValue[] oldproperties;
PropertyValue[] newproperties;
- for (int a = 0; a < this.nblockincrement; a++) {
+ for (int a = 0; a < this.nblockincrement; a++)
+ {
if (a < ncurfieldcount)
+ {
fillupControls(a);
+ }
if (binitialize)
+ {
setControlGroupVisible(a, (a < this.ncurfieldcount));
+ }
}
if (binitialize)
+ {
CurUnoDialog.repaintDialogStep();
-
+ }
}
- protected void fillupControls(int guiRow) {
+ protected void fillupControls(int guiRow)
+ {
PropertyValue[] nameProps = (PropertyValue[]) scrollfields.get(guiRow);
PropertyValue[] valueProps = (PropertyValue[]) scrollfields.get(guiRow + nscrollvalue);
- for (int n = 0; n < nameProps.length; n++) {
+ for (int n = 0; n < nameProps.length; n++)
+ {
if (CurUnoDialog.xDlgNameAccess.hasByName(nameProps[n].Name))
+ {
setControlData(nameProps[n].Name, valueProps[n].Value);
+ }
else
+ {
throw new IllegalArgumentException("No such control !");
+ }
}
}
-
- protected void setScrollValue(int _nscrollvalue) {
- if (_nscrollvalue >= 0) {
+ protected void setScrollValue(int _nscrollvalue)
+ {
+ if (_nscrollvalue >= 0)
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("ScrollValue"), new Integer(_nscrollvalue));
scrollControls();
}
}
- protected void setScrollValue(int _nscrollvalue, int _ntotfieldcount) {
+ protected void setScrollValue(int _nscrollvalue, int _ntotfieldcount)
+ {
setTotalFieldCount(_ntotfieldcount);
setScrollValue(_nscrollvalue);
}
- protected int getTotalFieldCount() {
+ protected int getTotalFieldCount()
+ {
return ntotfieldcount;
}
- protected int getCurFieldCount() {
+ protected int getCurFieldCount()
+ {
return ncurfieldcount;
}
- private void setCurFieldCount() {
+ private void setCurFieldCount()
+ {
if (ntotfieldcount > nblockincrement)
+ {
ncurfieldcount = nblockincrement;
+ }
else
+ {
ncurfieldcount = ntotfieldcount;
+ }
}
- protected void setTotalFieldCount(int _ntotfieldcount) {
+ protected void setTotalFieldCount(int _ntotfieldcount)
+ {
this.ntotfieldcount = _ntotfieldcount;
setCurFieldCount();
if (ntotfieldcount > nblockincrement)
- Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[] { "Enabled", "ScrollValueMax" }, new Object[] { Boolean.TRUE, new Integer(ntotfieldcount - nblockincrement)});
+ {
+ Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[]
+ {
+ "Enabled", "ScrollValueMax"
+ }, new Object[]
+ {
+ Boolean.TRUE, new Integer(ntotfieldcount - nblockincrement)
+ });
+ }
else
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "Enabled", Boolean.FALSE);
+ }
}
- protected void toggleComponent(boolean _bdoenable) {
+ protected void toggleComponent(boolean _bdoenable)
+ {
boolean bdoenable = _bdoenable && (ntotfieldcount > nblockincrement);
CurUnoDialog.setControlProperty("TitleScrollBar" + sIncSuffix, "Enabled", new Boolean(bdoenable));
}
- protected void toggleControls(boolean _bdoenable) {
- for (int n = 0; n < scrollfields.size(); n++) {
+ protected void toggleControls(boolean _bdoenable)
+ {
+ for (int n = 0; n < scrollfields.size(); n++)
+ {
PropertyValue[] curproperties = (PropertyValue[]) scrollfields.elementAt(n);
- for (int m = 0; m < curproperties.length; m++) {
+ for (int m = 0; m < curproperties.length; m++)
+ {
PropertyValue curproperty = curproperties[m];
CurUnoDialog.setControlProperty(curproperty.Name, "Enabled", new Boolean(_bdoenable));
}
@@ -238,50 +324,71 @@ public abstract class ControlScroller {
}
- protected int getScrollValue() {
+ protected int getScrollValue()
+ {
return nscrollvalue;
}
- protected void setLineIncrementation(int _nlineincrement) {
+ protected void setLineIncrementation(int _nlineincrement)
+ {
this.nlineincrement = _nlineincrement;
Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("LineIncrement"), new Integer(nlineincrement));
}
- protected int getLineIncrementation() {
+ protected int getLineIncrementation()
+ {
return nlineincrement;
}
- protected void setBlockIncrementation(int _nblockincrement) {
+ protected void setBlockIncrementation(int _nblockincrement)
+ {
this.nblockincrement = _nblockincrement;
- Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[] { "Enabled", "BlockIncrement", "ScrollValueMax" }, new Object[] { new Boolean(ntotfieldcount > nblockincrement), new Integer(nblockincrement), new Integer(ntotfieldcount - nblockincrement)});
+ Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[]
+ {
+ "Enabled", "BlockIncrement", "ScrollValueMax"
+ }, new Object[]
+ {
+ new Boolean(ntotfieldcount > nblockincrement), new Integer(nblockincrement), new Integer(ntotfieldcount - nblockincrement)
+ });
}
- protected int getBlockIncrementation() {
+ protected int getBlockIncrementation()
+ {
return nblockincrement;
}
- private void scrollControls() {
- try {
+ private void scrollControls()
+ {
+ try
+ {
scrollRowsInfo();
nscrollvalue = ((Integer) Helper.getUnoPropertyValue(UnoDialog.getModel(xScrollBar), "ScrollValue")).intValue();
if (nscrollvalue + nblockincrement >= ntotfieldcount)
+ {
nscrollvalue = (ntotfieldcount) - nblockincrement;
+ }
fillupControls(false);
- } catch (java.lang.Exception ex) {
+ }
+ catch (java.lang.Exception ex)
+ {
ex.printStackTrace();
}
}
- protected void scrollRowsInfo() {
+ protected void scrollRowsInfo()
+ {
int cols =
- scrollfields.size() > 0
- ? ((PropertyValue[])scrollfields.get(0)).length
- : 0;
+ scrollfields.size() > 0
+ ? ((PropertyValue[]) scrollfields.get(0)).length
+ : 0;
for (int a = 0; a < ncurfieldcount; a++)
+ {
for (int n = 0; n < cols; n++)
- fieldInfo(a,n);
-
+ {
+ fieldInfo(a, n);
+ }
+ }
}
/**
@@ -292,74 +399,103 @@ public abstract class ControlScroller {
* @return the propertyValue object corresponding to
* this control.
*/
- protected PropertyValue fieldInfo(int guiRow, int column) {
- if (guiRow + nscrollvalue < scrollfields.size()) {
- PropertyValue pv = fieldInfo (
- ((PropertyValue[]) scrollfields.elementAt(guiRow + nscrollvalue )) [column],
- ((PropertyValue[]) scrollfields.elementAt(guiRow)) [column]
-
- );
- //System.out.println("getting field info for : " + guiRow + "/" + column + ":" + pv.Value + "(" + pv.Name + ")" );
+ protected PropertyValue fieldInfo(int guiRow, int column)
+ {
+ if (guiRow + nscrollvalue < scrollfields.size())
+ {
+ PropertyValue pv = fieldInfo(
+ ((PropertyValue[]) scrollfields.elementAt(guiRow + nscrollvalue))[column],
+ ((PropertyValue[]) scrollfields.elementAt(guiRow))[column]);
+ //System.out.println("getting field info for : " + guiRow + "/" + column + ":" + pv.Value + "(" + pv.Name + ")" );
return pv;
}
- else return null;
+ else
+ {
+ return null;
+ }
}
- protected PropertyValue fieldInfo(PropertyValue valueProp, PropertyValue nameProp) {
+ protected PropertyValue fieldInfo(PropertyValue valueProp, PropertyValue nameProp)
+ {
if (CurUnoDialog.xDlgNameAccess.hasByName(nameProp.Name))
+ {
valueProp.Value = getControlData(nameProp.Name);
+ }
else
+ {
valueProp.Value = nameProp.Value;
+ }
return valueProp;
}
- protected void unregisterControlGroup(int _index) {
+ protected void unregisterControlGroup(int _index)
+ {
scrollfields.remove(_index);
}
- protected void registerControlGroup(PropertyValue[] _currowproperties, int _i) {
+ protected void registerControlGroup(PropertyValue[] _currowproperties, int _i)
+ {
if (_i == 0)
+ {
scrollfields.removeAllElements();
+ }
if (_i >= scrollfields.size())
+ {
scrollfields.addElement(_currowproperties);
+ }
else
+ {
scrollfields.setElementAt(_currowproperties, _i);
+ }
}
- protected PropertyValue[] getControlGroupInfo(int _i) {
+ protected PropertyValue[] getControlGroupInfo(int _i)
+ {
return (PropertyValue[]) scrollfields.elementAt(_i);
}
- protected void setControlData(String controlname, Object newvalue) {
+ protected void setControlData(String controlname, Object newvalue)
+ {
Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname));
String propertyname = UnoDialog.getDisplayProperty(oControlModel);
- if (propertyname != "") {
+ if (propertyname != "")
+ {
CurUnoDialog.setControlProperty(controlname, propertyname, newvalue);
}
}
- protected Object getControlData(String controlname) {
+ protected Object getControlData(String controlname)
+ {
Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname));
String propertyname = UnoDialog.getDisplayProperty(oControlModel);
if (propertyname != "")
+ {
return CurUnoDialog.getControlProperty(controlname, propertyname);
+ }
else
+ {
return null;
+ }
}
- protected PropertyValue[][] getScrollFieldValues() {
+ protected PropertyValue[][] getScrollFieldValues()
+ {
scrollRowsInfo();
PropertyValue[] curproperties;
PropertyValue[][] retproperties;
retproperties = new PropertyValue[scrollfields.size()][];
- try {
- for (int i = 0; i < scrollfields.size(); i++) {
+ try
+ {
+ for (int i = 0; i < scrollfields.size(); i++)
+ {
curproperties = (PropertyValue[]) scrollfields.elementAt(i);
retproperties[i] = curproperties;
}
return retproperties;
- } catch (java.lang.Exception ex) {
+ }
+ catch (java.lang.Exception ex)
+ {
ex.printStackTrace(System.out);
return null;
}
@@ -377,6 +513,4 @@ public abstract class ControlScroller {
protected abstract void insertControlGroup(int _index, int npos);
protected abstract void setControlGroupVisible(int _index, boolean _bIsVisible);
-
-
}
diff --git a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
index 8dcc9844780a..40323852f3e7 100644
--- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui;
+ ************************************************************************/
+package com.sun.star.wizards.ui;
import com.sun.star.awt.XListBox;
import com.sun.star.lang.XMultiServiceFactory;
@@ -39,7 +40,9 @@ import com.sun.star.wizards.common.JavaTools;
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
-public abstract class DBLimitedFieldSelection {
+public abstract class DBLimitedFieldSelection
+{
+
protected XMultiServiceFactory xMSF;
protected WizardDialog CurUnoDialog;
protected String sNoField;
@@ -55,11 +58,11 @@ public abstract class DBLimitedFieldSelection {
protected int iCompPosX;
protected int MaxSelIndex;
-
- public DBLimitedFieldSelection(WizardDialog _CurUnoDialog, int iStep, int _iCompPosX, int iCompPosY, int iCompWidth, int _FirstHelpIndex){
+ public DBLimitedFieldSelection(WizardDialog _CurUnoDialog, int iStep, int _iCompPosX, int iCompPosY, int iCompWidth, int _FirstHelpIndex)
+ {
this.CurUnoDialog = _CurUnoDialog;
xMSF = CurUnoDialog.xMSF;
- FirstHelpIndex = _FirstHelpIndex;
+ FirstHelpIndex = _FirstHelpIndex;
curtabindex = (short) (iStep * 100);
sNoField = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 8);
IStep = new Integer(iStep);
@@ -69,12 +72,12 @@ public abstract class DBLimitedFieldSelection {
ICompWidth = new Integer(iCompWidth);
boolean bDoEnable;
iCurPosY = iCompPosY;
- for (int i = 0; i < rowcount; i++) {
+ for (int i = 0; i < rowcount; i++)
+ {
insertControlGroup(i);
}
}
-
protected abstract void insertControlGroup(int index);
protected abstract void toggleControlRow(int CurIndex, boolean bDoEnable);
@@ -85,55 +88,82 @@ public abstract class DBLimitedFieldSelection {
protected abstract void setMaxSelIndex();
-
- protected void moveupSelectedItems(int CurIndex, boolean bDoEnable){
+ protected void moveupSelectedItems(int CurIndex, boolean bDoEnable)
+ {
short iNextItemPos;
- if ((bDoEnable == false) && (MAXSELINDEX > CurIndex)) {
- for (int i = CurIndex; i < MAXSELINDEX; i++) {
+ if ((bDoEnable == false) && (MAXSELINDEX > CurIndex))
+ {
+ for (int i = CurIndex; i < MAXSELINDEX; i++)
+ {
updateFromNextControlRow(i);
}
if (MaxSelIndex < rowcount - 2)
+ {
toggleControlRow(MaxSelIndex + 2, false);
- } else
+ }
+ }
+ else
+ {
toggleControlRow(CurIndex + 1, bDoEnable);
+ }
}
-
- protected String[] addNoneFieldItemToList(String[] _FieldNames){
+ protected String[] addNoneFieldItemToList(String[] _FieldNames)
+ {
int FieldCount = _FieldNames.length;
String[] ViewFieldNames = new String[FieldCount + 1];
ViewFieldNames[0] = sNoField;
for (int i = 0; i < FieldCount; i++)
+ {
ViewFieldNames[i + 1] = _FieldNames[i];
+ }
return ViewFieldNames;
}
-
- protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String[] _SelFieldNames, int curindex){
+ protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String[] _SelFieldNames, int curindex)
+ {
short[] SelList = null;
- Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox),"StringItemList", _AllFieldNames);
- if (_SelFieldNames != null){
- if (curindex < _SelFieldNames.length){
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "StringItemList", _AllFieldNames);
+ if (_SelFieldNames != null)
+ {
+ if (curindex < _SelFieldNames.length)
+ {
int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldNames[curindex]);
if (index > -1)
- SelList = new short[] {(short) (index)};
+ {
+ SelList = new short[]
+ {
+ (short) (index)
+ };
+ }
else
- SelList = new short[] {(short) (0)};
+ {
+ SelList = new short[]
+ {
+ (short) (0)
+ };
+ }
Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList);
return;
}
}
- SelList = new short[] {(short) (0)};
+ SelList = new short[]
+ {
+ (short) (0)
+ };
Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList);
}
-
- protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String _SelFieldName){
- Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox),"StringItemList", _AllFieldNames);
+ protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String _SelFieldName)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "StringItemList", _AllFieldNames);
short[] SelList = null;
int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldName);
- SelList = new short[] {(short) (index)};
+ SelList = new short[]
+ {
+ (short) (index)
+ };
Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList);
}
}
diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.java b/wizards/com/sun/star/wizards/ui/DocumentPreview.java
index 13df75b5aced..11aef9b6c0dc 100644
--- a/wizards/com/sun/star/wizards/ui/DocumentPreview.java
+++ b/wizards/com/sun/star/wizards/ui/DocumentPreview.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui;
+ ************************************************************************/
+package com.sun.star.wizards.ui;
import com.sun.star.awt.*;
import com.sun.star.beans.PropertyValue;
@@ -47,7 +48,9 @@ import com.sun.star.wizards.common.Properties;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class DocumentPreview {
+public class DocumentPreview
+{
+
/**
* The window in which the preview is showed.
*/
@@ -60,23 +63,20 @@ public class DocumentPreview {
* The content component of the frame.
*/
private XComponent xComponent;
-
private XControl xControl;
-
private int step;
-
private PropertyValue[] loadArgs;
private String url;
-
public static final int PREVIEW_MODE = 1;
/*********************************************************************
- main
+ main
- - create new frame with window inside
- - load a component as preview into this frame
+ - create new frame with window inside
+ - load a component as preview into this frame
*/
- public DocumentPreview(XMultiServiceFactory xmsf, Object control) throws Exception {
+ public DocumentPreview(XMultiServiceFactory xmsf, Object control) throws Exception
+ {
//((XWindow)UnoRuntime.queryInterface(XWindow.class,control)).addPaintListener(this);
xControl = (XControl) UnoRuntime.queryInterface(XControl.class, control);
@@ -86,55 +86,71 @@ public class DocumentPreview {
createPreviewFrame(xmsf, xControl);
}
- protected XComponent setDocument(String url_, String[] propNames, Object[] propValues) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException {
+ protected XComponent setDocument(String url_, String[] propNames, Object[] propValues) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException
+ {
url = url_;
Properties ps = new Properties();
for (int i = 0; i < propNames.length; i++)
+ {
ps.put(propNames[i], propValues[i]);
-
+ }
return setDocument(url, ps.getProperties());
}
- protected XComponent setDocument(String url, PropertyValue[] lArgs) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException {
+ protected XComponent setDocument(String url, PropertyValue[] lArgs) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException
+ {
loadArgs = lArgs;
XComponentLoader xCompLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xFrame);
xFrame.activate();
return xComponent = xCompLoader.loadComponentFromURL(url, "_self", 0, loadArgs);
}
- public void reload(XMultiServiceFactory xmsf) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException, com.sun.star.uno.Exception {
+ public void reload(XMultiServiceFactory xmsf) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException, com.sun.star.uno.Exception
+ {
closeFrame();
createPreviewFrame(xmsf, xControl);
//System.out.println(xControl);
setDocument(url, loadArgs);
}
- private void closeFrame() throws CloseVetoException {
+ private void closeFrame() throws CloseVetoException
+ {
if (xFrame != null)
- ((XCloseable) UnoRuntime.queryInterface(XCloseable.class, xFrame)).close(false);
+ {
+ ((XCloseable) UnoRuntime.queryInterface(XCloseable.class, xFrame)).close(false);
+ }
}
- public XComponent setDocument(String url, int mode) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException {
- switch (mode) {
- case PREVIEW_MODE :
- return setDocument(url, new String[] { "Preview", "ReadOnly" }, new Object[] { Boolean.TRUE, Boolean.TRUE });
+ public XComponent setDocument(String url, int mode) throws com.sun.star.lang.IllegalArgumentException, IOException, CloseVetoException
+ {
+ switch (mode)
+ {
+ case PREVIEW_MODE:
+ return setDocument(url, new String[]
+ {
+ "Preview", "ReadOnly"
+ }, new Object[]
+ {
+ Boolean.TRUE, Boolean.TRUE
+ });
}
return null;
}
/*********************************************************************
- create a new frame with a new container window inside,
- which isnt part of the global frame tree.
-
- Attention:
- a) This frame wont be destroyed by the office. It must be closed by you!
- Do so - please call XCloseable::close().
- b) The container window is part of the frame. Dont hold it alive - nor try to kill it.
- It will be destroyed inside close().
+ create a new frame with a new container window inside,
+ which isnt part of the global frame tree.
+
+ Attention:
+ a) This frame wont be destroyed by the office. It must be closed by you!
+ Do so - please call XCloseable::close().
+ b) The container window is part of the frame. Dont hold it alive - nor try to kill it.
+ It will be destroyed inside close().
*/
- public void createPreviewFrame(XMultiServiceFactory xmsf, XControl xControl) throws com.sun.star.uno.Exception, com.sun.star.lang.IllegalArgumentException {
+ public void createPreviewFrame(XMultiServiceFactory xmsf, XControl xControl) throws com.sun.star.uno.Exception, com.sun.star.lang.IllegalArgumentException
+ {
XWindowPeer controlPeer = xControl.getPeer();
XWindow controlWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xControl);
Rectangle r = controlWindow.getPosSize();
@@ -160,14 +176,15 @@ public class DocumentPreview {
xWindow.setVisible(true);
}
-
- public void dispose() {
- try {
+ public void dispose()
+ {
+ try
+ {
closeFrame();
- } catch (CloseVetoException ex) {
+ }
+ catch (CloseVetoException ex)
+ {
ex.printStackTrace();
}
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java
index e6e67e556747..652eb5f44392 100644
--- a/wizards/com/sun/star/wizards/ui/FieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java
@@ -28,6 +28,7 @@
*
************************************************************************/
package com.sun.star.wizards.ui;
+
import com.sun.star.awt.FontDescriptor;
import com.sun.star.awt.XListBox;
// import com.sun.star.wizards.common.*;
@@ -39,7 +40,9 @@ import java.util.*;
*
* @author bc93774
*/
-public class FieldSelection {
+public class FieldSelection
+{
+
public UnoDialog CurUnoDialog;
public XListBox xFieldsListBox;
public XListBox xSelFieldsListBox;
@@ -62,7 +65,6 @@ public class FieldSelection {
final int SOCMDMOVEDOWN = 6;
final int SOFLDSLST = 7;
final int SOSELFLDSLST = 8;
-
final int cmdButtonWidth = 16;
final int cmdButtonHoriDist = 4;
final int cmdButtonHeight = 14;
@@ -74,97 +76,113 @@ public class FieldSelection {
int CompHeight;
int CompWidth;
- class ItemListenerImpl implements com.sun.star.awt.XItemListener {
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
- public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) {
+ public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
// int iPos;
com.sun.star.wizards.common.Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", Boolean.FALSE);
int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
- switch (iKey) {
+ switch (iKey)
+ {
- case SOFLDSLST :
+ case SOFLDSLST:
toggleListboxButtons((short) - 1, (short) - 1);
break;
- case SOSELFLDSLST :
+ case SOSELFLDSLST:
toggleListboxButtons((short) - 1, (short) - 1);
break;
- default :
+ default:
break;
}
com.sun.star.wizards.common.Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", Boolean.TRUE);
}
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
}
- class ActionListenerImpl implements com.sun.star.awt.XActionListener {
+ class ActionListenerImpl implements com.sun.star.awt.XActionListener
+ {
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
- public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) {
- try {
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ try
+ {
int iKey = CurUnoDialog.getControlKey(actionEvent.Source, CurUnoDialog.ControlList);
- switch (iKey) {
- case SOFLDSLST :
+ switch (iKey)
+ {
+ case SOFLDSLST:
selectFields(false);
break;
- case SOSELFLDSLST :
+ case SOSELFLDSLST:
deselectFields(false);
break;
- case SOCMDMOVESEL :
+ case SOCMDMOVESEL:
selectFields(false);
break;
- case SOCMDMOVEALL :
+ case SOCMDMOVEALL:
selectFields(true);
break;
- case SOCMDREMOVESEL :
+ case SOCMDREMOVESEL:
deselectFields(false);
break;
- case SOCMDREMOVEALL :
+ case SOCMDREMOVEALL:
deselectFields(true);
break;
- case SOCMDMOVEUP :
+ case SOCMDMOVEUP:
changeSelectionOrder(-1);
break;
- case SOCMDMOVEDOWN :
+ case SOCMDMOVEDOWN:
changeSelectionOrder(1);
break;
- default :
+ default:
// System.err.println( exception);
break;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
}
- public void addFieldSelectionListener(XFieldSelectionListener xFieldSelection) {
+ public void addFieldSelectionListener(XFieldSelectionListener xFieldSelection)
+ {
this.xFieldSelection = xFieldSelection;
this.xFieldSelection.setID(sIncSuffix);
}
- public void setAppendMode(boolean _AppendMode) {
+ public void setAppendMode(boolean _AppendMode)
+ {
AppendMode = _AppendMode;
}
- public boolean getAppendMode() {
+ public boolean getAppendMode()
+ {
return AppendMode;
}
- public FieldSelection(UnoDialog CurUnoDialog, int iStep, int CompPosX, int CompPosY, int CompWidth, int CompHeight, String slblFields, String slblSelFields, int _FirstHelpIndex, boolean bshowFourButtons) {
- try {
+ public FieldSelection(UnoDialog CurUnoDialog, int iStep, int CompPosX, int CompPosY, int CompWidth, int CompHeight, String slblFields, String slblSelFields, int _FirstHelpIndex, boolean bshowFourButtons)
+ {
+ try
+ {
String AccessTextMoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 39);
String AccessTextRemoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 40);
String AccessTextMoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 41);
@@ -189,7 +207,8 @@ public class FieldSelection {
Integer ListBoxHeight = new Integer(CompHeight - 8 - 2);
SelListBoxPosX = new Integer(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist);
IStep = new Integer(iStep);
- if (bshowFourButtons == true) {
+ if (bshowFourButtons == true)
+ {
ShiftButtonCount = 4;
}
Integer[] ShiftButtonPosY = getYButtonPositions(ShiftButtonCount);
@@ -201,52 +220,112 @@ public class FieldSelection {
sIncSuffix = "_" + com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.xDlgNameAccess, "lblFields_");
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblFields" + sIncSuffix,
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), new Integer(109)});
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), new Integer(109)
+ });
xFieldsListBox = CurUnoDialog.insertListBox("lstFields" + sIncSuffix, SOFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(),
- new String[] { "Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { ListBoxHeight, "HID:" + Integer.toString(_FirstHelpIndex), Boolean.TRUE, new Integer(CompPosX), ListBoxPosY, IStep, new Short((curtabindex++)), ListBoxWidth });
+ new String[]
+ {
+ "Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ ListBoxHeight, "HID:" + Integer.toString(_FirstHelpIndex), Boolean.TRUE, new Integer(CompPosX), ListBoxPosY, IStep, new Short((curtabindex++)), ListBoxWidth
+ });
Object btnmoveselected = CurUnoDialog.insertButton("cmdMoveSelected" + sIncSuffix, SOCMDMOVESEL, new ActionListenerImpl(),
- new String[] { "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { Boolean.FALSE, new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex+1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth });
+ new String[]
+ {
+ "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex + 1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
+ });
if (bshowFourButtons == true)
{
btnmoveall = CurUnoDialog.insertButton("cmdMoveAll" + sIncSuffix, SOCMDMOVEALL, new ActionListenerImpl(),
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex+2), ">>", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth });
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex + 2), ">>", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
+ });
}
Object btnremoveselected = CurUnoDialog.insertButton("cmdRemoveSelected" + sIncSuffix, SOCMDREMOVESEL, new ActionListenerImpl(),
- new String[] { "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { Boolean.FALSE, new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex+3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth });
+ new String[]
+ {
+ "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex + 3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
+ });
if (bshowFourButtons == true)
{
btnremoveall = CurUnoDialog.insertButton("cmdRemoveAll" + sIncSuffix, SOCMDREMOVEALL, new ActionListenerImpl(),
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex+4), "<<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth });
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex + 4), "<<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
+ });
}
FontDescriptor oFontDesc = new FontDescriptor();
oFontDesc.Name = "StarSymbol";
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSelFields" + sIncSuffix,
- new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(8), slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth });
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth
+ });
xSelFieldsListBox = CurUnoDialog.insertListBox("lstSelFields" + sIncSuffix, SOSELFLDSLST, new ActionListenerImpl(), new ItemListenerImpl(),
- new String[] { "Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { ListBoxHeight, "HID:" + Integer.toString(_FirstHelpIndex+5), Boolean.TRUE, SelListBoxPosX, ListBoxPosY, IStep, new Short(curtabindex++), ListBoxWidth });
+ new String[]
+ {
+ "Height", "HelpURL", "MultiSelection", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ ListBoxHeight, "HID:" + Integer.toString(_FirstHelpIndex + 5), Boolean.TRUE, SelListBoxPosX, ListBoxPosY, IStep, new Short(curtabindex++), ListBoxWidth
+ });
Object btnmoveup = CurUnoDialog.insertButton("cmdMoveUp" + sIncSuffix, SOCMDMOVEUP, new ActionListenerImpl(),
- new String[] { "Enabled", "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { Boolean.FALSE, oFontDesc, new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex+6), String.valueOf((char) 8743), cmdMoveButtonPosX, MoveButtonPosY[0], IStep, new Short(curtabindex++), CmdButtonWidth });
+ new String[]
+ {
+ "Enabled", "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, oFontDesc, new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex + 6), String.valueOf((char) 8743), cmdMoveButtonPosX, MoveButtonPosY[0], IStep, new Short(curtabindex++), CmdButtonWidth
+ });
Object btnmovedown = CurUnoDialog.insertButton("cmdMoveDown" + sIncSuffix, SOCMDMOVEDOWN, new ActionListenerImpl(),
- new String[] { "Enabled", "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { Boolean.FALSE, oFontDesc, new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex+7), String.valueOf((char) 8744), cmdMoveButtonPosX, MoveButtonPosY[1], IStep, new Short(curtabindex++), CmdButtonWidth });
+ new String[]
+ {
+ "Enabled", "FontDescriptor", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, oFontDesc, new Integer(14), "HID:" + Integer.toString(_FirstHelpIndex + 7), String.valueOf((char) 8744), cmdMoveButtonPosX, MoveButtonPosY[1], IStep, new Short(curtabindex++), CmdButtonWidth
+ });
CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveselected, AccessTextMoveSelected);
CurUnoDialog.getPeerConfiguration().setAccessibleName(btnremoveselected, AccessTextRemoveSelected);
@@ -266,22 +345,28 @@ public class FieldSelection {
}
if (btnmovedown != null)
{
- CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmovedown, AccessMoveFieldDown );
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmovedown, AccessMoveFieldDown);
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
// Todo: If Value is getting smaller than zero -> throw exception
- private Integer[] getYButtonPositions(int ButtonCount) {
+ private Integer[] getYButtonPositions(int ButtonCount)
+ {
Integer[] YPosArray;
- if (ButtonCount > 0) {
+ if (ButtonCount > 0)
+ {
YPosArray = new Integer[ButtonCount];
YPosArray[0] = new Integer((int) (CompPosY + 10 + (((CompHeight - 10) - (ButtonCount * cmdButtonHeight) - ((ButtonCount - 1) * cmdButtonVertiDist)) / 2)));
- if (ButtonCount > 1) {
- for (int i = 1; i < ButtonCount; i++) {
+ if (ButtonCount > 1)
+ {
+ for (int i = 1; i < ButtonCount; i++)
+ {
YPosArray[i] = new Integer(YPosArray[i - 1].intValue() + cmdButtonHeight + cmdButtonVertiDist);
}
}
@@ -290,16 +375,17 @@ public class FieldSelection {
return null;
}
-
- public Integer getListboxWidth() {
+ public Integer getListboxWidth()
+ {
return this.ListBoxWidth;
}
-
- private void changeSelectionOrder(int iNeighbor) {
+ private void changeSelectionOrder(int iNeighbor)
+ {
short[] iSelIndices = xSelFieldsListBox.getSelectedItemsPos();
// Todo: we are assuming that the array starts with the lowest index. Verfy this assumption!!!!!
- if (iSelIndices.length == 1) {
+ if (iSelIndices.length == 1)
+ {
short iSelIndex = iSelIndices[0];
String[] NewItemList = xSelFieldsListBox.getItems();
String CurItem = NewItemList[iSelIndex];
@@ -308,7 +394,8 @@ public class FieldSelection {
NewItemList[iSelIndex] = NeighborItem;
CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", NewItemList);
xSelFieldsListBox.selectItem(CurItem, true);
- if (xFieldSelection != null){
+ if (xFieldSelection != null)
+ {
if (iNeighbor < 0)
{
xFieldSelection.moveItemUp(CurItem);
@@ -321,8 +408,10 @@ public class FieldSelection {
}
}
- public void toggleListboxControls(Boolean BDoEnable) {
- try {
+ public void toggleListboxControls(Boolean BDoEnable)
+ {
+ try
+ {
CurUnoDialog.setControlProperty("lblFields" + sIncSuffix, "Enabled", BDoEnable);
CurUnoDialog.setControlProperty("lblSelFields" + sIncSuffix, "Enabled", BDoEnable);
CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, "Enabled", BDoEnable);
@@ -332,20 +421,25 @@ public class FieldSelection {
{
toggleListboxButtons((short) - 1, (short) - 1);
}
- else {
+ else
+ {
CurUnoDialog.setControlProperty("cmdRemoveAll" + sIncSuffix, "Enabled", BDoEnable);
CurUnoDialog.setControlProperty("cmdRemoveSelected" + sIncSuffix, "Enabled", BDoEnable);
toggleMoveButtons(BDoEnable.booleanValue(), BDoEnable.booleanValue());
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
// Enable or disable the buttons used for moving the available
// fields between the two list boxes.
- protected void toggleListboxButtons(short iFieldsSelIndex, short iSelFieldsSelIndex) {
- try {
+ protected void toggleListboxButtons(short iFieldsSelIndex, short iSelFieldsSelIndex)
+ {
+ try
+ {
boolean bmoveUpenabled = false;
boolean bmoveDownenabled = false;
CurUnoDialog.selectListBoxItem(xFieldsListBox, iFieldsSelIndex);
@@ -356,7 +450,8 @@ public class FieldSelection {
int FieldCount = xFieldsListBox.getItemCount();
boolean bSelectSelected = (SelListBoxSelLength > 0);
int SelectCount = xSelFieldsListBox.getItemCount();
- if (bSelectSelected) {
+ if (bSelectSelected)
+ {
short[] iSelIndices = xSelFieldsListBox.getSelectedItemsPos();
bmoveUpenabled = ((iSelIndices[0] > 0) && (iSelIndices.length == 1));
bmoveDownenabled = (((iSelIndices[SelListBoxSelLength - 1]) < (short) (SelectCount - 1)) && (iSelIndices.length == 1));
@@ -366,48 +461,59 @@ public class FieldSelection {
toggleMoveButtons((FieldCount >= 1), bIsFieldSelected);
CurUnoDialog.setControlProperty("cmdMoveUp" + sIncSuffix, "Enabled", new Boolean(bmoveUpenabled));
CurUnoDialog.setControlProperty("cmdMoveDown" + sIncSuffix, "Enabled", new Boolean(bmoveDownenabled));
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
- protected void toggleMoveButtons(boolean _btoggleMoveAll, boolean _btoggleMoveSelected) {
+ protected void toggleMoveButtons(boolean _btoggleMoveAll, boolean _btoggleMoveSelected)
+ {
boolean btoggleMoveAll = (((xFieldsListBox.getItemCount() + xSelFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveAll));
boolean btoggleMoveSelected = (((xFieldsListBox.getSelectedItems().length + xSelFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveSelected));
CurUnoDialog.setControlProperty("cmdMoveAll" + sIncSuffix, "Enabled", new Boolean(btoggleMoveAll));
CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, "Enabled", new Boolean(btoggleMoveSelected));
}
-
- public void setMultipleMode(boolean _bisMultiple) {
+ public void setMultipleMode(boolean _bisMultiple)
+ {
xFieldsListBox.setMultipleMode(_bisMultiple);
xSelFieldsListBox.setMultipleMode(_bisMultiple);
}
- public void emptyFieldsListBoxes() {
- try {
+ public void emptyFieldsListBoxes()
+ {
+ try
+ {
toggleListboxControls(Boolean.FALSE);
- CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", new String[]{});
- CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, "StringItemList", new String[]{});
- } catch (Exception exception) {
+ CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", new String[]
+ {
+ });
+ CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, "StringItemList", new String[]
+ {
+ });
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void mergeList(String[] AllFieldNames, String[] SecondList) {
+ public void mergeList(String[] AllFieldNames, String[] SecondList)
+ {
int MaxIndex = SecondList.length;
xFieldsListBox.addItems(AllFieldNames, (short) 0);
toggleListboxButtons((short) - 1, (short) - 1);
}
- public void intializeSelectedFields(String[] _SelectedFieldNames) {
+ public void intializeSelectedFields(String[] _SelectedFieldNames)
+ {
xSelFieldsListBox.addItems(_SelectedFieldNames, xSelFieldsListBox.getItemCount());
}
-
-
// Note Boolean Parameter
- public void initialize(String[] _AllFieldNames, boolean _AppendMode) {
+ public void initialize(String[] _AllFieldNames, boolean _AppendMode)
+ {
AppendMode = _AppendMode;
xFieldsListBox.removeItems((short) 0, xFieldsListBox.getItemCount());
xFieldsListBox.addItems(_AllFieldNames, (short) 0);
@@ -419,8 +525,8 @@ public class FieldSelection {
toggleListboxControls(Boolean.TRUE);
}
-
- public void initialize(String[][] _AllFieldNamesTable, boolean _AppendMode, int _maxfieldcount) {
+ public void initialize(String[][] _AllFieldNamesTable, boolean _AppendMode, int _maxfieldcount)
+ {
String[] AllFieldNames_ = new String[_AllFieldNamesTable.length];
for (int i = 0; i < _AllFieldNamesTable.length; i++)
{
@@ -429,30 +535,32 @@ public class FieldSelection {
initialize(AllFieldNames_, _AppendMode, _maxfieldcount);
}
-
- public void initialize(String[] _AllFieldNames, boolean _AppendMode, int _maxfieldcount) {
+ public void initialize(String[] _AllFieldNames, boolean _AppendMode, int _maxfieldcount)
+ {
maxfieldcount = _maxfieldcount;
initialize(_AllFieldNames, _AppendMode);
}
-
- public void initialize(String[] _AllFieldNames, String[] _SelFieldNames, boolean _AppendMode){
+ public void initialize(String[] _AllFieldNames, String[] _SelFieldNames, boolean _AppendMode)
+ {
xSelFieldsListBox.removeItems((short) 0, xSelFieldsListBox.getItemCount());
xSelFieldsListBox.addItems(_SelFieldNames, (short) 0);
- initialize( _AllFieldNames,_AppendMode);
+ initialize(_AllFieldNames, _AppendMode);
}
-
- public void selectFields(boolean bMoveAll) {
+ public void selectFields(boolean bMoveAll)
+ {
// int CurIndex;
short iFieldSelected = (short) - 1;
short iSelFieldSelected = (short) - 1;
// int MaxCurTarget = xSelFieldsListBox.getItemCount();
String[] SelFieldItems;
- if (bMoveAll) {
+ if (bMoveAll)
+ {
SelFieldItems = xFieldsListBox.getItems();
xFieldsListBox.removeItems((short) 0, xFieldsListBox.getItemCount());
- if (!AppendMode){
+ if (!AppendMode)
+ {
xSelFieldsListBox.removeItems((short) 0, xSelFieldsListBox.getItemCount());
xSelFieldsListBox.addItems(AllFieldNames, (short) 0);
}
@@ -465,7 +573,8 @@ public class FieldSelection {
{
SelFieldItems = xFieldsListBox.getSelectedItems();
int MaxSourceSelected = SelFieldItems.length;
- if (MaxSourceSelected > 0) {
+ if (MaxSourceSelected > 0)
+ {
iFieldSelected = xFieldsListBox.getSelectedItemPos();
iSelFieldSelected = xSelFieldsListBox.getSelectedItemPos();
short[] SourceSelList = new short[xFieldsListBox.getSelectedItemsPos().length];
@@ -482,7 +591,8 @@ public class FieldSelection {
}
}
- public void deselectFields(boolean bMoveAll) {
+ public void deselectFields(boolean bMoveAll)
+ {
// int m = 0;
String SearchString;
short iOldFieldSelected = xFieldsListBox.getSelectedItemPos();
@@ -530,36 +640,42 @@ public class FieldSelection {
}
}
- public void addItemsToFieldsListbox(String[] _sItems) {
+ public void addItemsToFieldsListbox(String[] _sItems)
+ {
String[] sOldList = xFieldsListBox.getItems();
- for (int i = 0; i < _sItems.length; i++) {
- if (JavaTools.FieldInList(sOldList, _sItems[i]) < 0) {
+ for (int i = 0; i < _sItems.length; i++)
+ {
+ if (JavaTools.FieldInList(sOldList, _sItems[i]) < 0)
+ {
xFieldsListBox.addItem(_sItems[i], xFieldsListBox.getItemCount());
}
}
}
- public String[] getSelectedFieldNames() {
+ public String[] getSelectedFieldNames()
+ {
return (String[]) CurUnoDialog.getControlProperty("lstSelFields" + sIncSuffix, "StringItemList");
}
- public void setSelectedFieldNames(String[] _sfieldnames){
+ public void setSelectedFieldNames(String[] _sfieldnames)
+ {
CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", _sfieldnames);
String[] sleftboxfieldnames = JavaTools.removefromList(xFieldsListBox.getItems(), _sfieldnames);
CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, "StringItemList", sleftboxfieldnames);
}
- public void setModified(boolean _bModified){
+ public void setModified(boolean _bModified)
+ {
bisModified = _bModified;
}
- public boolean isModified(){
+ public boolean isModified()
+ {
return bisModified;
}
- public void changeSelectedFieldNames(String[] _sfieldnames){
+ public void changeSelectedFieldNames(String[] _sfieldnames)
+ {
CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", _sfieldnames);
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java
index 8762ee4e4676..e1ae043db571 100644
--- a/wizards/com/sun/star/wizards/ui/FilterComponent.java
+++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java
@@ -29,8 +29,7 @@
************************************************************************/
package com.sun.star.wizards.ui;
-import java.util.Vector;
-
+// import java.util.Vector;
import com.sun.star.awt.ItemEvent;
import com.sun.star.awt.TextEvent;
import com.sun.star.awt.VclWindowPeerAttribute;
@@ -53,21 +52,22 @@ import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.db.FieldColumn;
import com.sun.star.wizards.db.QueryMetaData;
-
-public class FilterComponent{
- Integer IStep;
- int iStartPosX;
- int iStartPosY;
- int Count;
- int RowCount;
- int FilterCount;
- static String[] sLogicOperators;
- public String[] FieldNames;
- XRadioButton optMatchAll;
- XRadioButton optMatchAny;
- private String soptMatchAll;
- private String soptMatchAny;
- private String[] sHeadLines;
+public class FilterComponent
+{
+
+ private Integer IStep;
+ private int iStartPosX;
+ private int iStartPosY;
+ // int Count;
+ private int RowCount;
+ // private int FilterCount;
+ private static String[] sLogicOperators;
+ // private /* public */ String[] FieldNames;
+ private XRadioButton optMatchAll;
+ private XRadioButton optMatchAny;
+ // private String soptMatchAll;
+ // private String soptMatchAny;
+ // private String[] sHeadLines;
private String slblFieldNames;
private String slblOperators;
private String slblValue;
@@ -75,7 +75,7 @@ public class FilterComponent{
private int BaseID = 2300;
private String sIncSuffix;
private ControlRow[] oControlRows;
- private Vector FilterNames;
+ // private Vector FilterNames;
private String sDuplicateCondition;
final int SOLSTFIELDNAME = 3;
final int SOLSTOPERATOR = 4;
@@ -86,47 +86,56 @@ public class FilterComponent{
int iDateTimeFormat;
int iDateFormat;
int iTimeFormat;
- PropertyValue[][] filterconditions;
- short curtabindex;
+ private PropertyValue[][] filterconditions;
+ private short curtabindex;
XMultiServiceFactory xMSF;
-
- final int SOFIRSTFIELDNAME = 1;
- final int SOSECFIELDNAME = 2;
- final int SOTHIRDFIELDNAME = 3;
- final int SOFOURTHFIELDNAME = 4;
- int[] SOFIELDNAMELIST = new int[] { SOFIRSTFIELDNAME, SOSECFIELDNAME, SOTHIRDFIELDNAME, SOFOURTHFIELDNAME };
-
- final int SOFIRSTCONDITION = 5;
- final int SOSECCONDITION = 6;
- final int SOTHIRDCONDITION = 7;
- final int SOFOURTHCONDITION = 8;
- int[] SOCONDITIONLIST = new int[] { SOFIRSTCONDITION, SOSECCONDITION, SOTHIRDCONDITION, SOFOURTHCONDITION };
-
- final int SOFIRSTTEXTFIELD = 1;
- final int SOSECTEXTFIELD = 2;
- final int SOTHIRDTEXTFIELD = 3;
- final int SOFOURTHTEXTFIELD = 4;
- int[] SOTEXTFIELDLIST = new int[] { SOFIRSTTEXTFIELD, SOSECTEXTFIELD, SOTHIRDTEXTFIELD, SOFOURTHTEXTFIELD };
- final int SOOPTQUERYMODE = 5;
- int SOIMATCHALL = 0;
- int SOIMATCHANY = 1;
- int ifilterstate = SOIMATCHALL;
+ final int SO_FIRSTFIELDNAME = 1;
+ final int SO_SECONDFIELDNAME = 2;
+ final int SO_THIRDFIELDNAME = 3;
+ final int SO_FOURTHFIELDNAME = 4;
+ int[] SO_FIELDNAMELIST = new int[]
+ {
+ SO_FIRSTFIELDNAME, SO_SECONDFIELDNAME, SO_THIRDFIELDNAME, SO_FOURTHFIELDNAME
+ };
+ final int SO_FIRSTCONDITION = 5;
+ final int SO_SECONDCONDITION = 6;
+ final int SO_THIRDCONDITION = 7;
+ final int SO_FOURTHCONDITION = 8;
+ int[] SO_CONDITIONLIST = new int[]
+ {
+ SO_FIRSTCONDITION, SO_SECONDCONDITION, SO_THIRDCONDITION, SO_FOURTHCONDITION
+ };
+ final int SO_FIRSTTEXTFIELD = 1;
+ final int SO_SECONDTEXTFIELD = 2;
+ final int SO_THIRDTEXTFIELD = 3;
+ final int SO_FOURTHTEXTFIELD = 4;
+ int[] SO_TEXTFIELDLIST = new int[]
+ {
+ SO_FIRSTTEXTFIELD, SO_SECONDTEXTFIELD, SO_THIRDTEXTFIELD, SO_FOURTHTEXTFIELD
+ };
+ final int SO_OPTQUERYMODE = 5;
+ int SOI_MATCHALL = 0;
+ int SOI_MATCHANY = 1;
+ // int ifilterstate = SOI_MATCHALL;
int curHelpID;
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
- class ItemListenerImpl implements com.sun.star.awt.XItemListener {
-
- public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject) {
- try {
+ public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
+ try
+ {
int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
String scontrolname = "";
- switch (iKey) {
+ switch (iKey)
+ {
// case SOOPTQUERYMODE:
// getfilterstate();
- case SOFIRSTFIELDNAME:
- case SOSECFIELDNAME:
- case SOTHIRDFIELDNAME:
- case SOFOURTHFIELDNAME:
+ case SO_FIRSTFIELDNAME:
+ case SO_SECONDFIELDNAME:
+ case SO_THIRDFIELDNAME:
+ case SO_FOURTHFIELDNAME:
scontrolname = getControlName(EventObject.Source);
String scontrolnameSuffix = sIncSuffix + "_" + scontrolname.substring(scontrolname.length() - 1, scontrolname.length());
XListBox xCurFieldListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(scontrolname));
@@ -135,118 +144,154 @@ public class FilterComponent{
XControl xValueControl = CurUnoDialog.xDlgContainer.getControl("txtValue" + scontrolnameSuffix);
XInterface xValueModel = (XInterface) UnoDialog.getModel(xValueControl);
Helper.setUnoPropertyValue(xValueModel, "TreatAsNumber", new Boolean(CurFieldColumn.bIsNumberFormat));
- oQueryMetaData.getNumberFormatter().setNumberFormat(xValueModel, CurFieldColumn.DBFormatKey, oQueryMetaData.getNumberFormatter());
+ final NumberFormatter aNumberFormatter = oQueryMetaData.getNumberFormatter();
+ aNumberFormatter.setNumberFormat(xValueModel, CurFieldColumn.DBFormatKey, aNumberFormatter);
break;
- case SOFIRSTCONDITION:
- case SOSECCONDITION:
- case SOTHIRDCONDITION:
- case SOFOURTHCONDITION:
+ case SO_FIRSTCONDITION:
+ case SO_SECONDCONDITION:
+ case SO_THIRDCONDITION:
+ case SO_FOURTHCONDITION:
scontrolname = getControlName(EventObject.Source);
break;
case SOOPTORMODE:
case SOOPTANDMODE:
- getfilterstate();
+ // getfilterstate();
return;
default:
break;
}
togglefollowingControlRow(scontrolname);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
}
- class TextListenerImpl implements com.sun.star.awt.XTextListener {
+ class TextListenerImpl implements com.sun.star.awt.XTextListener
+ {
- public void textChanged(TextEvent EventObject) {
- try {
+ public void textChanged(TextEvent EventObject)
+ {
+ try
+ {
String sName = getControlName(EventObject.Source);
togglefollowingControlRow(sName);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void disposing(EventObject EventObject) {
+ public void disposing(EventObject EventObject)
+ {
}
}
-
- public void fieldconditionchanged(ItemEvent EventObject){
+ public void fieldconditionchanged(ItemEvent EventObject)
+ {
String sName = getControlName(EventObject.Source);
togglefollowingControlRow(sName);
}
-
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
+ class ActionListenerImpl implements com.sun.star.awt.XActionListener
+ {
- class ActionListenerImpl implements com.sun.star.awt.XActionListener {
-
- public void disposing(EventObject eventObject) {
+ public void disposing(EventObject eventObject)
+ {
}
- public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) {
+
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
getfilterstate();
}
}
-
- private void togglefollowingControlRow(String _scurName){
- String sNameSuffix = sIncSuffix + "_" + _scurName.substring(_scurName.length() - 1, _scurName.length());
+ private void togglefollowingControlRow(String _scurName)
+ {
+ // String sNameSuffix = sIncSuffix + "_" + _scurName.substring(_scurName.length() - 1, _scurName.length());
int Index = Integer.valueOf(_scurName.substring(_scurName.length() - 1, _scurName.length())).intValue();
if (Index < oControlRows.length)
- oControlRows[Index].setEnabled(oControlRows[Index - 1].isComplete());
+ {
+ boolean bValue = oControlRows[Index - 1].isComplete();
+ oControlRows[Index].setEnabled(bValue);
+ }
}
-
- private String getControlName(Object _oSourceevent){
- try {
- XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, _oSourceevent);
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel());
- return AnyConverter.toString(xPSet.getPropertyValue("Name"));
- } catch (Exception e) {
- e.printStackTrace(System.out);
+ private String getControlName(Object _oSourceevent)
+ {
+ try
+ {
+ XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, _oSourceevent);
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel());
+ final String sName = AnyConverter.toString(xPSet.getPropertyValue("Name"));
+ return sName;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
return "";
- }}
-
+ }
- public PropertyValue[][] getFilterConditions() {
+ public PropertyValue[][] getFilterConditions()
+ {
ControlRow CurControlRow;
Object curValue;
- getfilterstate();
+ // getfilterstate();
int filtercount = getFilterCount();
- if (filtercount > 0) {
- if (this.getfilterstate()== this.SOIMATCHALL)
+ if (filtercount > 0)
+ {
+ if (this.getfilterstate() == this.SOI_MATCHALL)
+ {
filterconditions = new PropertyValue[1][filtercount];
+ }
else
+ {
filterconditions = new PropertyValue[filtercount][1];
+ }
int a = 0;
- for (int i = 0; i < RowCount; i++) {
+ for (int i = 0; i < RowCount; i++)
+ {
CurControlRow = oControlRows[i];
- if (CurControlRow.isEnabled()) {
- if (CurControlRow.isComplete()) {
+ if (CurControlRow.isEnabled())
+ {
+ if (CurControlRow.isComplete())
+ {
String curFieldName = CurControlRow.getSelectedFieldName();
int curOperator = (int) CurControlRow.getSelectedOperator() + 1;
FieldColumn CurFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(curFieldName);
if (CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getTextFormatKey())
+ {
curValue = "'" + CurControlRow.getValue() + "'";
+ }
//// TODO the following code is bound to be deprecated as soon as the query composer is able to handle date/time values as numbers
- else if ((CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getDateFormatKey()) || (CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getDateTimeFormatKey())){
+ else if ((CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getDateFormatKey()) ||
+ (CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getDateTimeFormatKey()))
+ {
String sDate = CurControlRow.getDateTimeString(true);
curValue = "{D '" + sDate + "' }"; // FormatsSupplier
}
- else if (CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getTimeFormatKey()){
+ else if (CurFieldColumn.StandardFormatKey == oQueryMetaData.getNumberFormatter().getTimeFormatKey())
+ {
String sTime = CurControlRow.getDateTimeString(true);
curValue = "'{T '" + sTime + "' }";
}
- else{
+ else
+ {
curValue = CurControlRow.getValue();
- switch (CurFieldColumn.FieldType){
+ switch (CurFieldColumn.FieldType)
+ {
case DataType.TINYINT:
case DataType.BIGINT:
case DataType.INTEGER:
@@ -255,99 +300,153 @@ public class FilterComponent{
break;
case DataType.BIT:
case DataType.BOOLEAN:
- curValue = CurControlRow.getText();
-// double dblvalue = ((Double) curValue).doubleValue();
-// curValue = new Boolean(dblvalue == 1.0);
+ // curValue = CurControlRow.getText(); // wrong! (creates something like 'WAHR'/'FALSCH' if german locale is used.
+
+ // double dblvalue = ((Double) curValue).doubleValue();
+ //curValue = new Boolean(dblvalue == 1.0); // wrong! we need a string, not a boolean value
+
+ // converts the '1.0'/'0.0' (EffectiveValue) to a 'boolean' String like 'true'/'false'
+ curValue = String.valueOf(((Double) curValue).intValue() == 1);
break;
default:
curValue = String.valueOf(curValue);
break;
}
}
+
PropertyValue oPropertyValue = Properties.createProperty(curFieldName, curValue, curOperator);
- if (this.ifilterstate == this.SOIMATCHALL) {
+ if (getfilterstate()/*this.ifilterstate*/ == this.SOI_MATCHALL)
+ {
if (i == 0)
+ {
filterconditions[0] = new PropertyValue[filtercount];
+ }
filterconditions[0][a] = oPropertyValue;
- } else
+ }
+ else
+ {
filterconditions[a][0] = oPropertyValue;
+ }
a++;
}
}
}
int[] iduplicate = JavaTools.getDuplicateFieldIndex(filterconditions);
- if (iduplicate[0] != -1) {
+ if (iduplicate[0] != -1)
+ {
PropertyValue aduplicatecondition = filterconditions[iduplicate[0]][iduplicate[1]];
String smsgDuplicateCondition = getDisplayCondition(sDuplicateCondition, aduplicatecondition, null);
CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, smsgDuplicateCondition);
CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2)));
- return new PropertyValue[][] {
- };
+ return new PropertyValue[][]
+ {
+ };
}
}
else
+ {
filterconditions = new PropertyValue[0][0];
+ }
return filterconditions;
}
- public static String getDisplayCondition(String _BaseString, PropertyValue _filtercondition, QueryMetaData _CurDBMetaData) {
- try {
+ public static String getDisplayCondition(String _BaseString, PropertyValue _filtercondition, QueryMetaData _CurDBMetaData)
+ {
+ try
+ {
String FieldName;
- if (_CurDBMetaData != null) {
+ if (_CurDBMetaData != null)
+ {
FieldColumn CurDBFieldColumn = _CurDBMetaData.getFieldColumnByDisplayName(_filtercondition.Name);
- FieldName = CurDBFieldColumn.FieldTitle;
- } else
+ FieldName = CurDBFieldColumn.getFieldTitle();
+ }
+ else
+ {
FieldName = _filtercondition.Name;
+ }
String sreturn = JavaTools.replaceSubString(_BaseString, FieldName, "<FIELDNAME>");
String soperator = sLogicOperators[_filtercondition.Handle - 1];
sreturn = JavaTools.replaceSubString(sreturn, soperator, "<LOGICOPERATOR>");
String sDisplayValue = AnyConverter.toString(_filtercondition.Value);
sreturn = JavaTools.replaceSubString(sreturn, sDisplayValue, "<VALUE>");
return sreturn;
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
e.printStackTrace(System.out);
- return "";
}
+ return "";
}
- private int getfilterstate() {
+ private int getfilterstate()
+ {
boolean bisany = true;
+ int ifilterstate = SOI_MATCHALL;
bisany = (this.optMatchAny.getState()) == true;
if (bisany)
- ifilterstate = SOIMATCHANY;
+ {
+ ifilterstate = SOI_MATCHANY;
+ }
else
- ifilterstate = SOIMATCHALL;
+ {
+ ifilterstate = SOI_MATCHALL;
+ }
return ifilterstate;
}
- private void addfiltercondition(int _index, String _curFieldName, Object _curValue, int _curOperator) {
- try {
+ private void addfiltercondition(int _index, String _curFieldName, Object _curValue, int _curOperator)
+ {
+ try
+ {
String ValString = String.valueOf(_curValue);
PropertyValue oPropertyValue = Properties.createProperty(_curFieldName, ValString, _curOperator);
getfilterstate();
- if (getfilterstate() == this.SOIMATCHALL) {
+ if (getfilterstate() == this.SOI_MATCHALL)
+ {
if (_index == 0)
+ {
filterconditions[0] = new PropertyValue[getFilterCount()];
+ }
filterconditions[0][_index] = new PropertyValue();
filterconditions[0][_index] = oPropertyValue;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- private int getFilterCount() {
+ private int getFilterCount()
+ {
int a = 0;
for (int i = 0; i < RowCount; i++)
+ {
if (oControlRows[i].isEnabled() && oControlRows[i].isComplete())
+ {
a++;
- FilterCount = a;
- return FilterCount;
+ }
+ }
+ return a;
+ // FilterCount = a;
+ // return FilterCount;
}
- /** Creates a new instance of FilterComponent */
- public FilterComponent(WizardDialog CurUnoDialog, XMultiServiceFactory _xMSF, int iStep, int iPosX, int iPosY, int iWidth, int FilterCount, QueryMetaData _oQueryMetaData, int _firstHelpID) {
- try {
+ /** Creates a new instance of FilterComponent
+ * @param CurUnoDialog
+ * @param _xMSF
+ * @param iStep
+ * @param iPosX
+ * @param iPosY
+ * @param iWidth
+ * @param FilterCount
+ * @param _oQueryMetaData
+ * @param _firstHelpID
+ */
+ public FilterComponent(WizardDialog CurUnoDialog, XMultiServiceFactory _xMSF, int iStep, int iPosX, int iPosY, int iWidth, int FilterCount, QueryMetaData _oQueryMetaData, int _firstHelpID)
+ {
+ try
+ {
this.curHelpID = _firstHelpID;
this.xMSF = _xMSF;
this.IStep = new Integer(iStep);
@@ -361,8 +460,8 @@ public class FilterComponent{
iStartPosX = iPosX;
iStartPosY = iPosY;
- soptMatchAll = CurUnoDialog.m_oResource.getResText(BaseID + 9);
- soptMatchAny = CurUnoDialog.m_oResource.getResText(BaseID + 10);
+ String soptMatchAll = CurUnoDialog.m_oResource.getResText(BaseID + 9);
+ String soptMatchAny = CurUnoDialog.m_oResource.getResText(BaseID + 10);
slblFieldNames = CurUnoDialog.m_oResource.getResText(BaseID + 17);
slblOperators = CurUnoDialog.m_oResource.getResText(BaseID + 24);
slblValue = CurUnoDialog.m_oResource.getResText(BaseID + 25);
@@ -371,261 +470,400 @@ public class FilterComponent{
sDuplicateCondition = CurUnoDialog.m_oResource.getResText(BaseID + 89);
optMatchAll = CurUnoDialog.insertRadioButton("optMatchAll" + sIncSuffix, SOOPTANDMODE, new ItemListenerImpl(),
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(9), "HID:" + curHelpID++, soptMatchAll, new Integer(iPosX), new Integer(iStartPosY), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(203)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(9), "HID:" + curHelpID++, soptMatchAll, new Integer(iPosX), new Integer(iStartPosY), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(203)
+ });
optMatchAny = CurUnoDialog.insertRadioButton("optMatchAny" + sIncSuffix, SOOPTORMODE, new ItemListenerImpl(),
- new String[] { "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(9), "HID:" + curHelpID++, soptMatchAny, new Integer(iPosX), new Integer(iStartPosY + 12), IStep, new Short(curtabindex++), new Integer(203)});
+ new String[]
+ {
+ "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(9), "HID:" + curHelpID++, soptMatchAny, new Integer(iPosX), new Integer(iStartPosY + 12), IStep, new Short(curtabindex++), new Integer(203)
+ });
getfilterstate();
oControlRows = new ControlRow[FilterCount];
- for (int i = 0; i < FilterCount; i++) {
+ for (int i = 0; i < FilterCount; i++)
+ {
bEnabled = (i == 0);
oControlRows[i] = new ControlRow(iStartPosY + 20, i, bEnabled, (this.curHelpID + (i * 3)));
iStartPosY += 43;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
- public void initialize(PropertyValue[][] _filterconditions, String[] _fieldnames) {
+ public void initialize(PropertyValue[][] _filterconditions, String[] _fieldnames)
+ {
for (int i = 0; i < RowCount; i++)
+ {
oControlRows[i].setFieldNames(_fieldnames);
+ }
this.filterconditions = _filterconditions;
PropertyValue[] curfilterconditions;
int a;
- if (_filterconditions.length == 1) {
+ if (_filterconditions.length == 1)
+ {
curfilterconditions = filterconditions[0];
for (a = 0; a < curfilterconditions.length; a++)
+ {
oControlRows[a].setCondition(filterconditions[0][a]);
- } else
+ }
+ }
+ else
+ {
for (a = 0; a < filterconditions.length; a++)
+ {
oControlRows[a].setCondition(filterconditions[a][0]);
- while (a < oControlRows.length) {
+ }
+ }
+ while (a < oControlRows.length)
+ {
oControlRows[a].settovoid();
boolean bdoenable;
if (a > 0)
+ {
bdoenable = oControlRows[a - 1].isComplete();
+ }
else
+ {
bdoenable = true;
+ }
oControlRows[a].setEnabled(bdoenable);
a++;
}
}
- public void addNumberFormats(){
- try {
+ public void addNumberFormats()
+ {
+ try
+ {
iDateFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("YYYY-MM-DD");
iTimeFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("HH:MM:SS");
iDateTimeFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("YYYY-MM-DD HH:MM:SS");
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
}
}
+ class ControlRow
+ {
+ protected XInterface[] ControlElements = new XInterface[6];
+ private boolean bEnabled;
+ String[] FieldNames;
- class ControlRow {
- protected XInterface[] ControlElements = new XInterface[6];
- private boolean bEnabled;
- String[] FieldNames;
-
- protected ControlRow(int iCompPosY, int Index, boolean _bEnabled, int _firstRowHelpID) {
- try {
+ protected ControlRow(int iCompPosY, int Index, boolean _bEnabled, int _firstRowHelpID)
+ {
+ try
+ {
String sCompSuffix = sIncSuffix + "_" + String.valueOf(Index + 1);
this.bEnabled = _bEnabled;
ControlElements[0] = (XInterface) CurUnoDialog.insertLabel("lblFieldNames" + sCompSuffix,
- new String[] { "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Boolean(bEnabled), new Integer(9), slblFieldNames, new Integer(iStartPosX + 10), new Integer(iCompPosY + 13), IStep, new Short(curtabindex++), new Integer(55)});
+ new String[]
+ {
+ "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(bEnabled), new Integer(9), slblFieldNames, new Integer(iStartPosX + 10), new Integer(iCompPosY + 13), IStep, new Short(curtabindex++), new Integer(55)
+ });
ControlElements[1] = (XInterface) CurUnoDialog.insertLabel("lblOperators" + sCompSuffix,
- new String[] { "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Boolean(bEnabled), new Integer(9), slblOperators, new Integer(iStartPosX + 87), new Integer(iCompPosY + 13), IStep, new Short(curtabindex++), new Integer(52)});
+ new String[]
+ {
+ "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(bEnabled), new Integer(9), slblOperators, new Integer(iStartPosX + 87), new Integer(iCompPosY + 13), IStep, new Short(curtabindex++), new Integer(52)
+ });
ControlElements[2] = (XInterface) CurUnoDialog.insertLabel("lblValue" + sCompSuffix,
- new String[] { "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Boolean(bEnabled), new Integer(9), slblValue, new Integer(iStartPosX + 162), new Integer(iCompPosY + 13), IStep, new Short(curtabindex++), new Integer(44)});
- ControlElements[3] = (XInterface) CurUnoDialog.insertListBox("lstFieldName" + sCompSuffix, SOFIELDNAMELIST[Index], null, new ItemListenerImpl(),
- new String[] { "Enabled", "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Boolean(bEnabled), Boolean.TRUE, new Integer(13), "HID:" + _firstRowHelpID++, new Integer(iStartPosX + 10), new Integer(iCompPosY + 23), IStep, new Short(curtabindex++), new Integer(71)});
- ControlElements[4] = (XInterface) CurUnoDialog.insertListBox("lstOperator" + sCompSuffix, SOCONDITIONLIST[Index], null, new ItemListenerImpl(),
- new String[] { "Enabled", "Dropdown", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width" },
- new Object[] { new Boolean(bEnabled), Boolean.TRUE, new Integer(13), "HID:" + _firstRowHelpID++, new Short((short) 7), new Integer(iStartPosX + 87), new Integer(iCompPosY + 23), IStep, sLogicOperators, new Short(curtabindex++), new Integer(70)});
- ControlElements[5] = (XInterface) CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SOTEXTFIELDLIST[Index], new TextListenerImpl(),
- new String[] { "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Boolean(bEnabled), new Integer(13), "HID:" + _firstRowHelpID++, new Integer(iStartPosX + 162), new Integer(iCompPosY + 23), IStep, new Short(curtabindex++), new Integer(44)});
- } catch (Exception exception) {
+ new String[]
+ {
+ "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(bEnabled), new Integer(9), slblValue, new Integer(iStartPosX + 162), new Integer(iCompPosY + 13), IStep, new Short(curtabindex++), new Integer(44)
+ });
+ ControlElements[3] = (XInterface) CurUnoDialog.insertListBox("lstFieldName" + sCompSuffix, SO_FIELDNAMELIST[Index], null, new ItemListenerImpl(),
+ new String[]
+ {
+ "Enabled", "Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(bEnabled), Boolean.TRUE, new Integer(13), "HID:" + _firstRowHelpID++, new Integer(iStartPosX + 10), new Integer(iCompPosY + 23), IStep, new Short(curtabindex++), new Integer(71)
+ });
+ ControlElements[4] = (XInterface) CurUnoDialog.insertListBox("lstOperator" + sCompSuffix, SO_CONDITIONLIST[Index], null, new ItemListenerImpl(),
+ new String[]
+ {
+ "Enabled", "Dropdown", "Height", "HelpURL", "LineCount", "PositionX", "PositionY", "Step", "StringItemList", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(bEnabled), Boolean.TRUE, new Integer(13), "HID:" + _firstRowHelpID++, new Short((short) 7), new Integer(iStartPosX + 87), new Integer(iCompPosY + 23), IStep, sLogicOperators, new Short(curtabindex++), new Integer(70)
+ });
+ ControlElements[5] = (XInterface) CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SO_TEXTFIELDLIST[Index], new TextListenerImpl(),
+ new String[]
+ {
+ "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(bEnabled), new Integer(13), "HID:" + _firstRowHelpID++, new Integer(iStartPosX + 162), new Integer(iCompPosY + 23), IStep, new Short(curtabindex++), new Integer(44)
+ });
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
- }}
-
- boolean isComplete() {
- try {
- short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems"));
- if (SelFields.length > 0) {
- short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
- if (SelOperator.length > 0) {
- Object oValue = Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue");
- if (!AnyConverter.isVoid(oValue)){
- String sValue = (String.valueOf(oValue));
- return (!sValue.equals(""));
- }
+ }
+ }
+
+ boolean isComplete()
+ {
+ try
+ {
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems"));
+ if (SelFields.length > 0)
+ {
+ short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
+ if (SelOperator.length > 0)
+ {
+ Object oValue = Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue");
+ if (!AnyConverter.isVoid(oValue))
+ {
+ String sValue = (String.valueOf(oValue));
+ return (!sValue.equals(""));
}
}
- return false;
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- return false;
}
+ return false;
}
-
- public void fieldnamechanged(ItemEvent EventObject) {
- int i = 0;
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return false;
}
+ }
+ public void fieldnamechanged(ItemEvent EventObject)
+ {
+ int i = 0;
+ }
- protected void setCondition(PropertyValue _filtercondition) {
- try {
+ protected void setCondition(PropertyValue _filtercondition)
+ {
+ try
+ {
int ikey;
XListBox xFieldsListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTFIELDNAME]);
xFieldsListBox.selectItem(_filtercondition.Name, true);
XListBox xOperatorListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTOPERATOR]);
xOperatorListBox.selectItemPos((short) (_filtercondition.Handle - 1), true);
- if (AnyConverter.isString(_filtercondition.Value)){
+
+ if (AnyConverter.isString(_filtercondition.Value))
+ {
String sValue = AnyConverter.toString(_filtercondition.Value);
- if (sValue.indexOf("{D '") > -1){
- sValue = JavaTools.replaceSubString(sValue, "","{D '");
- sValue = JavaTools.replaceSubString(sValue, "","' }");
+ if (sValue.indexOf("{D '") > -1)
+ {
+ sValue = JavaTools.replaceSubString(sValue, "", "{D '");
+ sValue = JavaTools.replaceSubString(sValue, "", "' }");
oQueryMetaData.getNumberFormatter().convertStringToNumber(iDateFormat, sValue);
}
- else if (sValue.indexOf("{T '") > -1){
- sValue = JavaTools.replaceSubString(sValue, "","{T '");
- sValue = JavaTools.replaceSubString(sValue, "","' }");
+ else if (sValue.indexOf("{T '") > -1)
+ {
+ sValue = JavaTools.replaceSubString(sValue, "", "{T '");
+ sValue = JavaTools.replaceSubString(sValue, "", "' }");
oQueryMetaData.getNumberFormatter().convertStringToNumber(iTimeFormat, sValue);
}
}
+ else if (AnyConverter.isBoolean(_filtercondition.Value))
+ {
+ boolean b = AnyConverter.toBoolean(_filtercondition.Value);
+ double nValue = 0.0;
+ if (b)
+ {
+ nValue = 1.0;
+ }
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", nValue);
+ }
else
+ {
Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", _filtercondition.Value);
- } catch (Exception e) {
+ }
+ }
+ catch (Exception e)
+ {
e.printStackTrace(System.out);
- }}
+ }
+ }
+ protected void setFieldNames(String[] _FieldNames)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "StringItemList", _FieldNames);
+ FieldNames = _FieldNames;
+ }
- protected void setFieldNames(String[] _FieldNames) {
- Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "StringItemList", _FieldNames);
- FieldNames = _FieldNames;
- }
+ protected boolean isEnabled()
+ {
+ return bEnabled;
+ }
- protected boolean isEnabled() {
- return bEnabled;
- }
+ protected void settovoid()
+ {
+ CurUnoDialog.deselectListBox(ControlElements[SOLSTFIELDNAME]);
+ CurUnoDialog.deselectListBox(ControlElements[SOLSTOPERATOR]);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", com.sun.star.uno.Any.VOID);
+ }
- protected void settovoid() {
- CurUnoDialog.deselectListBox(ControlElements[SOLSTFIELDNAME]);
- CurUnoDialog.deselectListBox(ControlElements[SOLSTOPERATOR]);
- Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", com.sun.star.uno.Any.VOID);
- }
-
- protected void setEnabled(boolean _bEnabled) {
- for (int i = 0; i < ControlElements.length; i++)
- Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[i]), "Enabled", new Boolean(_bEnabled));
- bEnabled = _bEnabled;
- if (bEnabled){
- short[] iselected = new short[]{};
- try {
- iselected = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
- } catch (Exception e) {
- e.printStackTrace(System.out);
- }
- if ((iselected.length) == 0)
- Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems", new short[]{0});
+ protected void setEnabled(boolean _bEnabled)
+ {
+ for (int i = 0; i < ControlElements.length; i++)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[i]), "Enabled", new Boolean(_bEnabled));
+ }
+ bEnabled = _bEnabled;
+ if (bEnabled)
+ {
+ short[] iselected = new short[]
+ {
+ };
+ try
+ {
+ iselected = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
}
- else
- if (!isComplete())
- CurUnoDialog.deselectListBox(ControlElements[SOLSTOPERATOR]);
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ if ((iselected.length) == 0)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems", new short[]
+ {
+ 0
+ });
+ }
+ }
+ else if (!isComplete())
+ {
+ CurUnoDialog.deselectListBox(ControlElements[SOLSTOPERATOR]);
}
+ }
- protected String getSelectedFieldName() {
- try {
- short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems"));
- return FieldNames[SelFields[0]];
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- return null;
- }
+ protected String getSelectedFieldName()
+ {
+ try
+ {
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems"));
+ return FieldNames[SelFields[0]];
}
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return null;
+ }
- // TODO: check if it is really useful to match the indices of the listbox the API constants
- protected short getSelectedOperator() {
- try {
- short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
- return SelFields[0];
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- return -1;
- }
+ // TODO: check if it is really useful to match the indices of the listbox the API constants
+ protected short getSelectedOperator()
+ {
+ try
+ {
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
+ return SelFields[0];
}
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return -1;
+ }
- // TODO make a difference between Text and Numbers
- protected Object getValue() {
- try {
- return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue"));
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- return null;
- }
+ // TODO make a difference between Text and Numbers
+ protected Object getValue()
+ {
+ try
+ {
+ return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue"));
}
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return null;
+ }
- protected Object getText() {
- try {
- return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Text"));
- } catch (Exception exception) {
- exception.printStackTrace(System.out);
- return null;
- }
+ protected Object getText()
+ {
+ try
+ {
+ return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Text"));
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
}
+ return null;
+ }
- protected String getDateTimeString(boolean bgetDate) {
- try {
+ protected String getDateTimeString(boolean bgetDate)
+ {
+ try
+ {
double dblValue = ((Double) getValue()).doubleValue();
NumberFormatter oNumberFormatter = oQueryMetaData.getNumberFormatter();
return oNumberFormatter.convertNumberToString(iDateTimeFormat, dblValue);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
- }}
+ }
}
}
-
- // com.sun.star.sdb.SQLFilterOperator.EQUAL
- // com.sun.star.sdb.SQLFilterOperator.NOT_EQUAL
- // com.sun.star.sdb.SQLFilterOperator.LESS
- // com.sun.star.sdb.SQLFilterOperator.GREATER
- // com.sun.star.sdb.SQLFilterOperator.LESS_EQUAL
- // com.sun.star.sdb.SQLFilterOperator.GREATER_EQUAL
- // com.sun.star.sdb.SQLFilterOperator.LIKE
- // com.sun.star.sdb.SQLFilterOperator.NOT_LIKE
- // com.sun.star.sdb.SQLFilterOperator.SQLNULL
- // com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL
-
- /* constants SQLFilterOperator
- {
- /// equal to
- const long EQUAL = 1;
- /// not equal to
- const long NOT_EQUAL = 2;
- /// less than
- const long LESS = 3;
- /// greater than
- const long GREATER = 4;
- /// less or eqal than
- const long LESS_EQUAL = 5;
- /// greater or eqal than
- const long GREATER_EQUAL = 6;
- /// like
- const long LIKE = 7;
- /// not like
- const long NOT_LIKE = 8;
- /// is null
- const long SQLNULL = 9;
- /// is not null
- const long NOT_SQLNULL = 10;
- }; */
+}// com.sun.star.sdb.SQLFilterOperator.EQUAL
+// com.sun.star.sdb.SQLFilterOperator.NOT_EQUAL
+// com.sun.star.sdb.SQLFilterOperator.LESS
+// com.sun.star.sdb.SQLFilterOperator.GREATER
+// com.sun.star.sdb.SQLFilterOperator.LESS_EQUAL
+// com.sun.star.sdb.SQLFilterOperator.GREATER_EQUAL
+// com.sun.star.sdb.SQLFilterOperator.LIKE
+// com.sun.star.sdb.SQLFilterOperator.NOT_LIKE
+// com.sun.star.sdb.SQLFilterOperator.SQLNULL
+// com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL
+
+/* constants SQLFilterOperator
+{
+/// equal to
+const long EQUAL = 1;
+/// not equal to
+const long NOT_EQUAL = 2;
+/// less than
+const long LESS = 3;
+/// greater than
+const long GREATER = 4;
+/// less or eqal than
+const long LESS_EQUAL = 5;
+/// greater or eqal than
+const long GREATER_EQUAL = 6;
+/// like
+const long LIKE = 7;
+/// not like
+const long NOT_LIKE = 8;
+/// is null
+const long SQLNULL = 9;
+/// is not null
+const long NOT_SQLNULL = 10;
+}; */
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java
index be2247667eb6..a400c34d3054 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.java
+++ b/wizards/com/sun/star/wizards/ui/ImageList.java
@@ -26,7 +26,9 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui;
+ ************************************************************************/
+package com.sun.star.wizards.ui;
+
import com.sun.star.awt.*;
import com.sun.star.lang.EventObject;
import com.sun.star.uno.AnyConverter;
@@ -48,7 +50,8 @@ import javax.swing.event.ListDataListener;
*
* @author rpiterman
*/
- public class ImageList implements XItemEventBroadcaster, ListDataListener{
+public class ImageList implements XItemEventBroadcaster, ListDataListener
+{
private XControl imgContainer;
private XFixedText lblImageText;
@@ -70,32 +73,23 @@ import javax.swing.event.ListDataListener;
private final static Short NO_BORDER = new Short((short) 0);
private boolean refreshOverNull = true;
private int imageTextLines = 1;
-
private boolean rowSelect = false;
public int tabIndex;
public Boolean scaleImages = Boolean.TRUE;
public String name = "il";
-
private int selected = -1;
private int pageStart = 0;
public int helpURL = 0;
-
private CommonListener uiEventListener = new CommonListener();
private ImageRenderer renderer;
private ListModel listModel;
public Renderer counterRenderer = new SimpleCounterRenderer();
-
private Object dialogModel;
-
private ImageKeyListener imageKeyListener;
-
private static final Integer BACKGROUND_COLOR = new Integer(16777216); //new Integer(SystemColor.window.getRGB() + 16777216);
-
private final static Short HIDE_PAGE = new Short((short) 99);
private final static Integer TRANSPARENT = new Integer(-1);
- private final static int LINE_HEIGHT = 8;
-
- //private MethodInvocation METHOD_MOUSE_ENTER_IMAGE;
+ private final static int LINE_HEIGHT = 8; //private MethodInvocation METHOD_MOUSE_ENTER_IMAGE;
//private MethodInvocation METHOD_MOUSE_EXIT_IMAGE;
private MethodInvocation METHOD_MOUSE_PRESSED;
@@ -103,7 +97,8 @@ import javax.swing.event.ListDataListener;
* @return Value of property imageSize.
*
*/
- public Size getImageSize() {
+ public Size getImageSize()
+ {
return this.imageSize;
}
@@ -111,11 +106,13 @@ import javax.swing.event.ListDataListener;
* @param imageSize New value of property imageSize.
*
*/
- public void setImageSize(Size imageSize) {
+ public void setImageSize(Size imageSize)
+ {
this.imageSize = imageSize;
}
- public void create(UnoDialog2 dialog) {
+ public void create(UnoDialog2 dialog)
+ {
oUnoDialog = dialog;
dialogModel = dialog.xDialogModel;
@@ -125,95 +122,151 @@ import javax.swing.event.ListDataListener;
MOVE_SELECTION_VALS[2] = step;
- imgContainer = dialog.insertImage(name + "lblContainer", new String[] { "BackgroundColor", "Border", "Height", "PositionX", "PositionY", "Step", "Width" }, new Object[] { BACKGROUND_COLOR, new Short((short) 1), new Integer((imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), new Integer(pos.Width), new Integer(pos.Height), step, new Integer((imageSize.Width + gap.Width) * cols + gap.Width)});
-
- opeerConfig.setPeerProperties(imgContainer, new String[] { "MouseTransparent" }, new Object[] { Boolean.TRUE });
+ imgContainer = dialog.insertImage(name + "lblContainer", new String[]
+ {
+ "BackgroundColor", "Border", "Height", "PositionX", "PositionY", "Step", "Width"
+ }, new Object[]
+ {
+ BACKGROUND_COLOR, new Short((short) 1), new Integer((imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), new Integer(pos.Width), new Integer(pos.Height), step, new Integer((imageSize.Width + gap.Width) * cols + gap.Width)
+ });
+
+ opeerConfig.setPeerProperties(imgContainer, new String[]
+ {
+ "MouseTransparent"
+ }, new Object[]
+ {
+ Boolean.TRUE
+ });
//XWindow win = (XWindow)UnoRuntime.queryInterface(XWindow.class,lblContainer);
/*dialog.xWindow.addWindowListener(uiEventListener);
String dName = (String)Helper.getUnoPropertyValue(dialog.xDialogModel,"Name");
uiEventListener.add(dName,EventNames.EVENT_WINDOW_SHOWN,"disableContainerMouseEvents",this);
- */
+ */
int selectionWidth = rowSelect ? (imageSize.Width + gap.Width) * cols - gap.Width + (selectionGap.Width * 2) : imageSize.Width + (selectionGap.Width * 2);
- grbxSelectedImage = dialog.insertLabel(name + "_grbxSelected", new String[] { "BackgroundColor", "Border", "Height", "PositionX", "PositionY", "Step", "Tabstop", "Width" }, new Object[] { TRANSPARENT, new Short((short) 1), new Integer(imageSize.Height + (selectionGap.Height * 2)), //height
- new Integer(0), //posx
- new Integer(0), //posy
- step, Boolean.TRUE, new Integer(selectionWidth)});
-
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,grbxSelectedImage);
- xWindow.addMouseListener(new XMouseListener() {
-
- public void mousePressed(MouseEvent arg0) {
+ grbxSelectedImage = dialog.insertLabel(name + "_grbxSelected", new String[]
+ {
+ "BackgroundColor", "Border", "Height", "PositionX", "PositionY", "Step", "Tabstop", "Width"
+ }, new Object[]
+ {
+ TRANSPARENT, new Short((short) 1), new Integer(imageSize.Height + (selectionGap.Height * 2)), //height
+ new Integer(0), //posx
+ new Integer(0), //posy
+ step, Boolean.TRUE, new Integer(selectionWidth)
+ });
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, grbxSelectedImage);
+ xWindow.addMouseListener(new XMouseListener()
+ {
+
+ public void mousePressed(MouseEvent arg0)
+ {
focus(getImageIndexFor(getSelected()));
}
- public void mouseReleased(MouseEvent arg0) {}
+ public void mouseReleased(MouseEvent arg0)
+ {
+ }
- public void mouseEntered(MouseEvent arg0) {}
+ public void mouseEntered(MouseEvent arg0)
+ {
+ }
- public void mouseExited(MouseEvent arg0) {}
+ public void mouseExited(MouseEvent arg0)
+ {
+ }
- public void disposing(EventObject arg0) {}
+ public void disposing(EventObject arg0)
+ {
+ }
});
- final String[] pNames1 = new String[] { "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Tabstop", "Width" };
+ final String[] pNames1 = new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Tabstop", "Width"
+ };
- lblImageText = dialog.insertLabel(name + "_imageText", pNames1, new Object[] { new Integer(imageTextHeight), "", new Integer(pos.Width + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height), step, new Short((short)0), Boolean.FALSE, new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2)});
+ lblImageText = dialog.insertLabel(name + "_imageText", pNames1, new Object[]
+ {
+ new Integer(imageTextHeight), "", new Integer(pos.Width + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height), step, new Short((short) 0), Boolean.FALSE, new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2)
+ });
final Integer btnSize = new Integer(14);
- if (showButtons) {
+ if (showButtons)
+ {
- btnBack = dialog.insertButton(name + "_btnBack", "prevPage", this, pNames1, new Object[] { btnSize, "HID:" + helpURL++, new Integer(pos.Width), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), step, new Short((short)(tabIndex + 1)), Boolean.TRUE, btnSize });
+ btnBack = dialog.insertButton(name + "_btnBack", "prevPage", this, pNames1, new Object[]
+ {
+ btnSize, "HID:" + helpURL++, new Integer(pos.Width), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), step, new Short((short) (tabIndex + 1)), Boolean.TRUE, btnSize
+ });
- btnNext = dialog.insertButton(name+ "_btnNext", "nextPage", this, pNames1, new Object[] { btnSize, "HID:" + helpURL++, new Integer(pos.Width + (imageSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), step, new Short((short)(tabIndex + 2)), Boolean.TRUE, btnSize });
+ btnNext = dialog.insertButton(name + "_btnNext", "nextPage", this, pNames1, new Object[]
+ {
+ btnSize, "HID:" + helpURL++, new Integer(pos.Width + (imageSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1), step, new Short((short) (tabIndex + 2)), Boolean.TRUE, btnSize
+ });
- lblCounter = dialog.insertLabel(name + "_lblCounter", pNames1, new Object[] { new Integer(LINE_HEIGHT), "", new Integer(pos.Width + btnSize.intValue() + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), step, new Short((short)0), Boolean.FALSE, new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1)});
+ lblCounter = dialog.insertLabel(name + "_lblCounter", pNames1, new Object[]
+ {
+ new Integer(LINE_HEIGHT), "", new Integer(pos.Width + btnSize.intValue() + 1), new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)), step, new Short((short) 0), Boolean.FALSE, new Integer(cols * (imageSize.Width + gap.Width) + gap.Width - 2 * btnSize.intValue() - 1)
+ });
Helper.setUnoPropertyValue(getModel(lblCounter), "Align", new Short((short) 1));
- Helper.setUnoPropertyValue(getModel(btnBack),"Label","<");
- Helper.setUnoPropertyValue(getModel(btnNext),"Label",">");
+ Helper.setUnoPropertyValue(getModel(btnBack), "Label", "<");
+ Helper.setUnoPropertyValue(getModel(btnNext), "Label", ">");
}
imageKeyListener = new ImageKeyListener();
- tabIndex_ = new Short((short)tabIndex);
+ tabIndex_ = new Short((short) tabIndex);
images = new XControl[rows * cols];
- try {
+ try
+ {
//METHOD_MOUSE_ENTER_IMAGE = new MethodInvocation("mouseEnterImage",this,Object.class);
//METHOD_MOUSE_EXIT_IMAGE = new MethodInvocation("mouseExitImage",this,Object.class);
METHOD_MOUSE_PRESSED = new MethodInvocation("mousePressed", this, Object.class);
- } catch (NoSuchMethodException e) {
+ }
+ catch (NoSuchMethodException e)
+ {
e.printStackTrace();
}
_imageHeight = new Integer(imageSize.Height);
- _imageWidth = new Integer(imageSize.Width);
+ _imageWidth = new Integer(imageSize.Width);
for (int r = 0; r < rows; r++)
+ {
for (int c = 0; c < cols; c++)
+ {
images[r * cols + c] = createImage(dialog, r, c);
-
+ }
+ }
refreshImages();
listModel.addListDataListener(this);
}
-
- private Integer _imageHeight, _imageWidth;
- private final static String[] IMAGE_PROPS = new String[] { "Border", "BackgroundColor", "Height", "HelpURL", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Tabstop", "Width" };
+ private Integer _imageHeight, _imageWidth;
+ private final static String[] IMAGE_PROPS = new String[]
+ {
+ "Border", "BackgroundColor", "Height", "HelpURL", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Tabstop", "Width"
+ };
//used for optimization
private Short tabIndex_;
- private XControl createImage(UnoDialog2 dialog, int row, int col) {
+ private XControl createImage(UnoDialog2 dialog, int row, int col)
+ {
String imageName = name + "_image" + (row * cols + col);
- XControl image = dialog.insertImage(imageName, IMAGE_PROPS, new Object[] { NO_BORDER, BACKGROUND_COLOR, _imageHeight, "HID:" + helpURL++, new Integer(imagePosX(col)), new Integer(imagePosY(row)), scaleImages, step, tabIndex_ , Boolean.FALSE, _imageWidth });
+ XControl image = dialog.insertImage(imageName, IMAGE_PROPS, new Object[]
+ {
+ NO_BORDER, BACKGROUND_COLOR, _imageHeight, "HID:" + helpURL++, new Integer(imagePosX(col)), new Integer(imagePosY(row)), scaleImages, step, tabIndex_, Boolean.FALSE, _imageWidth
+ });
XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, image);
win.addMouseListener(uiEventListener);
@@ -225,69 +278,100 @@ import javax.swing.event.ListDataListener;
return image;
}
- private int imagePosX(int col) {
+ private int imagePosX(int col)
+ {
return pos.Width + col * (imageSize.Width + gap.Width) + gap.Width;
}
- private int imagePosY(int row) {
+ private int imagePosY(int row)
+ {
return pos.Height + row * (imageSize.Height + gap.Height) + gap.Height;
}
- private void refreshImages() {
+ private void refreshImages()
+ {
if (showButtons)
+ {
refreshCounterText();
+ }
hideSelection();
if (refreshOverNull)
+ {
for (int i = 0; i < images.length; i++)
+ {
setVisible(images[i], false);
+ }
+ }
boolean focusable = true;
- for (int i = 0; i < images.length; i++) {
+ for (int i = 0; i < images.length; i++)
+ {
Object[] oResources = renderer.getImageUrls(getObjectFor(i));
- if (oResources != null) {
+ if (oResources != null)
+ {
if (oResources.length == 1)
+ {
Helper.setUnoPropertyValue(images[i].getModel(), "ImageURL", (String) oResources[0]);
+ }
else if (oResources.length == 2)
+ {
oUnoDialog.getPeerConfiguration().setImageUrl(images[i].getModel(), oResources[0], oResources[1]);
- Helper.setUnoPropertyValue(images[i].getModel(), "Tabstop" , focusable ? Boolean.TRUE : Boolean.FALSE);
+ }
+ Helper.setUnoPropertyValue(images[i].getModel(), "Tabstop", focusable ? Boolean.TRUE : Boolean.FALSE);
if (refreshOverNull)
+ {
setVisible(images[i], true);
+ }
focusable = false;
}
}
refreshSelection();
}
- private void refreshCounterText() {
+ private void refreshCounterText()
+ {
Helper.setUnoPropertyValue(getModel(lblCounter), "Label", counterRenderer.render(new Counter(pageStart + 1, pageEnd(), listModel.getSize())));
}
- private int pageEnd() {
+ private int pageEnd()
+ {
int i = pageStart + cols * rows;
if (i > listModel.getSize() - 1)
+ {
return listModel.getSize();
+ }
else
+ {
return i;
+ }
}
- private void refreshSelection() {
+ private void refreshSelection()
+ {
if (selected < pageStart || selected >= (pageStart + rows * cols))
+ {
hideSelection();
+ }
else
+ {
moveSelection(getImageIndexFor(selected));
+ }
}
- private void hideSelection() {
+ private void hideSelection()
+ {
Helper.setUnoPropertyValue(getModel(grbxSelectedImage), "Step", HIDE_PAGE);
setVisible(grbxSelectedImage, false);
}
-
- private final static String[] MOVE_SELECTION = new String[] { "PositionX", "PositionY", "Step" };
+ private final static String[] MOVE_SELECTION = new String[]
+ {
+ "PositionX", "PositionY", "Step"
+ };
private Object[] MOVE_SELECTION_VALS = new Object[3];
-
/** Utility field holding list of ItemListeners. */
private transient java.util.ArrayList itemListenerList;
- private void moveSelection(int image) {
+ private void moveSelection(int image)
+ {
//System.out.println(image);
setVisible(grbxSelectedImage, false);
@@ -300,18 +384,24 @@ import javax.swing.event.ListDataListener;
Helper.setUnoPropertyValues(getModel(grbxSelectedImage), MOVE_SELECTION, MOVE_SELECTION_VALS);
if (((Number) Helper.getUnoPropertyValue(dialogModel, "Step")).shortValue() == step.shortValue())
- setVisible(grbxSelectedImage, true);
-
- //now focus...
- for (int i = 0; i<images.length; i++)
+ {
+ setVisible(grbxSelectedImage, true); //now focus...
+ }
+ for (int i = 0; i < images.length; i++)
+ {
if (i != image)
+ {
defocus(i);
+ }
else
- Helper.setUnoPropertyValue(images[image].getModel(),"Tabstop",Boolean.TRUE);
+ {
+ Helper.setUnoPropertyValue(images[image].getModel(), "Tabstop", Boolean.TRUE);
+ }
+ }
}
-
- private void setVisible(Object control, boolean visible) {
+ private void setVisible(Object control, boolean visible)
+ {
((XWindow) UnoRuntime.queryInterface(XWindow.class, control)).setVisible(visible);
}
@@ -320,12 +410,17 @@ import javax.swing.event.ListDataListener;
* @param i
* @return the Object in the list model corresponding to the given image index.
*/
- private Object getObjectFor(int i) {
+ private Object getObjectFor(int i)
+ {
int ii = getIndexFor(i);
if (listModel.getSize() <= ii)
+ {
return null;
+ }
else
+ {
return listModel.getElementAt(ii);
+ }
}
/**
@@ -333,37 +428,45 @@ import javax.swing.event.ListDataListener;
* @param i
* @return the index in the listModel for the given image index.
*/
- private int getIndexFor(int i) {
+ private int getIndexFor(int i)
+ {
return pageStart + i;
}
- private int getImageIndexFor(int i) {
+ private int getImageIndexFor(int i)
+ {
return i - pageStart;
}
- public void contentsChanged(ListDataEvent event) {
+ public void contentsChanged(ListDataEvent event)
+ {
/*//if the content that was changed is in the displayed range, refresh...
if ( (event.getIndex1() < getIndexFor(0)) // range is before...
- || event.getIndex0() > getIndexFor( cols*rows - 1)) ; //do nothing
+ || event.getIndex0() > getIndexFor( cols*rows - 1)) ; //do nothing
else
- refreshImages();
- */
-
- //selected = 0;
+ refreshImages();
+ */ //selected = 0;
//pageStart = 0;
//if (event.refreshImages();
}
- public void intervalAdded(ListDataEvent event) {
- if (event.getIndex0()<=selected) {
- if (event.getIndex1()<=selected)
- selected += event.getIndex1()- event.getIndex0() + 1;
+ public void intervalAdded(ListDataEvent event)
+ {
+ if (event.getIndex0() <= selected)
+ {
+ if (event.getIndex1() <= selected)
+ {
+ selected += event.getIndex1() - event.getIndex0() + 1;
+ }
}
if (event.getIndex0() < pageStart || event.getIndex1() < (pageStart + getRows() + getCols()))
+ {
refreshImages();
+ }
}
- public void intervalRemoved(ListDataEvent event) {
+ public void intervalRemoved(ListDataEvent event)
+ {
//contentsChanged(event);
}
@@ -371,10 +474,12 @@ import javax.swing.event.ListDataListener;
* @param listener The listener to register.
*
*/
- public synchronized void addItemListener(XItemListener listener) {
+ public synchronized void addItemListener(XItemListener listener)
+ {
if (itemListenerList == null)
+ {
itemListenerList = new java.util.ArrayList();
-
+ }
itemListenerList.add(listener);
}
@@ -382,8 +487,10 @@ import javax.swing.event.ListDataListener;
* @param listener The listener to remove.
*
*/
- public synchronized void removeItemListener(XItemListener listener) {
- if (itemListenerList != null) {
+ public synchronized void removeItemListener(XItemListener listener)
+ {
+ if (itemListenerList != null)
+ {
itemListenerList.remove(listener);
}
}
@@ -393,16 +500,21 @@ import javax.swing.event.ListDataListener;
* @param event The event to be fired
*
*/
- private void fireItemSelected() {
+ private void fireItemSelected()
+ {
// java.awt.event.ItemEvent event = new java.awt.event.ItemEvent(this, 0,
// getSelectedObject(), java.awt.event.ItemEvent.SELECTED);
java.util.ArrayList list;
- synchronized (this) {
+ synchronized(this)
+ {
if (itemListenerList == null)
+ {
return;
+ }
list = (java.util.ArrayList) itemListenerList.clone();
}
- for (int i = 0; i < list.size(); i++) {
+ for (int i = 0; i < list.size(); i++)
+ {
((com.sun.star.awt.XItemListener) list.get(i)).itemStateChanged(null);
}
}
@@ -410,114 +522,132 @@ import javax.swing.event.ListDataListener;
/**
* @return
*/
- public int getCols() {
+ public int getCols()
+ {
return cols;
}
/**
* @return
*/
- public Size getGap() {
+ public Size getGap()
+ {
return gap;
}
/**
* @return
*/
- public ListModel getListModel() {
+ public ListModel getListModel()
+ {
return listModel;
}
/**
- * @return
- */
- public Short getStep() {
+ * @return
+ */
+ public Short getStep()
+ {
return step;
}
/**
* @return
*/
- public int getPageStart() {
+ public int getPageStart()
+ {
return pageStart;
}
/**
* @return
*/
- public Size getPos() {
+ public Size getPos()
+ {
return pos;
}
/**
* @return
*/
- public ImageRenderer getRenderer() {
+ public ImageRenderer getRenderer()
+ {
return renderer;
}
/**
* @return
*/
- public int getRows() {
+ public int getRows()
+ {
return rows;
}
/**
* @return
*/
- public int getSelected() {
+ public int getSelected()
+ {
return selected;
}
/**
* @return
*/
- public Size getSelectionGap() {
+ public Size getSelectionGap()
+ {
return selectionGap;
}
/**
* @return
*/
- public boolean isShowButtons() {
+ public boolean isShowButtons()
+ {
return showButtons;
}
/**
* @param i
*/
- public void setCols(int i) {
+ public void setCols(int i)
+ {
cols = i;
}
/**
* @param size
*/
- public void setGap(Size size) {
+ public void setGap(Size size)
+ {
gap = size;
}
/**
* @param model
*/
- public void setListModel(ListModel model) {
+ public void setListModel(ListModel model)
+ {
listModel = model;
}
/**
* @param short1
*/
- public void setStep(Short short1) {
+ public void setStep(Short short1)
+ {
step = short1;
}
/**
* @param i
*/
- public void setPageStart(int i) {
+ public void setPageStart(int i)
+ {
if (i == pageStart)
+ {
return;
+ }
pageStart = i;
enableButtons();
refreshImages();
@@ -526,52 +656,69 @@ import javax.swing.event.ListDataListener;
/**
* @param size
*/
- public void setPos(Size size) {
+ public void setPos(Size size)
+ {
pos = size;
}
/**
* @param renderer
*/
- public void setRenderer(ImageRenderer renderer) {
+ public void setRenderer(ImageRenderer renderer)
+ {
this.renderer = renderer;
}
/**
* @param i
*/
- public void setRows(int i) {
+ public void setRows(int i)
+ {
rows = i;
}
/**
* @param i
*/
- public void setSelected(int i) {
- if (rowSelect && (i >= 0) )
+ public void setSelected(int i)
+ {
+ if (rowSelect && (i >= 0))
+ {
i = (i / cols) * cols;
+ }
if (selected == i)
+ {
return;
+ }
selected = i;
refreshImageText();
refreshSelection();
fireItemSelected();
}
- public void setSelected(Object object) {
+ public void setSelected(Object object)
+ {
if (object == null)
+ {
setSelected(-1);
+ }
else
+ {
for (int i = 0; i < getListModel().getSize(); i++)
- if (getListModel().getElementAt(i).equals(object)) {
+ {
+ if (getListModel().getElementAt(i).equals(object))
+ {
setSelected(i);
return;
}
+ }
+ }
setSelected(-1);
}
- private void refreshImageText() {
+ private void refreshImageText()
+ {
Object item = selected >= 0 ? getListModel().getElementAt(selected) : null;
Helper.setUnoPropertyValue(getModel(lblImageText), "Label", " " + renderer.render(item));
}
@@ -579,92 +726,112 @@ import javax.swing.event.ListDataListener;
/**
* @param size
*/
- public void setSelectionGap(Size size) {
+ public void setSelectionGap(Size size)
+ {
selectionGap = size;
}
/**
* @param b
*/
- public void setShowButtons(boolean b) {
+ public void setShowButtons(boolean b)
+ {
showButtons = b;
}
- public void nextPage() {
- if (pageStart < getListModel().getSize() - rows * cols) {
+ public void nextPage()
+ {
+ if (pageStart < getListModel().getSize() - rows * cols)
+ {
setPageStart(pageStart + rows * cols);
}
}
- public void prevPage() {
+ public void prevPage()
+ {
if (pageStart == 0)
+ {
return;
+ }
int i = pageStart - rows * cols;
if (i < 0)
+ {
i = 0;
+ }
setPageStart(i);
}
- private void enableButtons() {
+ private void enableButtons()
+ {
enable(btnNext, new Boolean(pageStart + rows * cols < listModel.getSize()));
enable(btnBack, new Boolean(pageStart > 0));
}
- private void enable(Object control, Boolean enable) {
+ private void enable(Object control, Boolean enable)
+ {
Helper.setUnoPropertyValue(getModel(control), "Enabled", enable);
}
- private Object getModel(Object control) {
+ private Object getModel(Object control)
+ {
return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel();
}
-/*
+ /*
public void mouseEnterImage(Object event) {
- System.out.println("mouse enter");
- int i = getImageFromEvent(event);
- //TODO what is when the image does not display an image?
- if (getIndexFor(i) != selected)
- setBorder(images[i],imageBorderMO);
+ System.out.println("mouse enter");
+ int i = getImageFromEvent(event);
+ //TODO what is when the image does not display an image?
+ if (getIndexFor(i) != selected)
+ setBorder(images[i],imageBorderMO);
}
public void mouseExitImage(Object event) {
- //System.out.println("mouse exit");
- int i = getImageFromEvent(event);
- //TODO what is when the image does not display an image?
- if (getIndexFor(i) != selected)
- setBorder(images[i],imageBorder);
+ //System.out.println("mouse exit");
+ int i = getImageFromEvent(event);
+ //TODO what is when the image does not display an image?
+ if (getIndexFor(i) != selected)
+ setBorder(images[i],imageBorder);
}
-*/
-
- private void setBorder(Object control, Short border) {
+ */
+ private void setBorder(Object control, Short border)
+ {
Helper.setUnoPropertyValue(getModel(control), "Border", border);
- //XWindowPeer peer = ((XControl)UnoRuntime.queryInterface(XControl.class,control)).getPeer();
- //peer.invalidate(InvalidateStyle.CHILDREN);
+ //XWindowPeer peer = ((XControl)UnoRuntime.queryInterface(XControl.class,control)).getPeer();
+ //peer.invalidate(InvalidateStyle.CHILDREN);
}
- private int getImageFromEvent(Object event) {
+ private int getImageFromEvent(Object event)
+ {
Object image = ((EventObject) event).Source;
String controlName = (String) Helper.getUnoPropertyValue(getModel(image), "Name");
- return Integer.valueOf(controlName.substring(6 + name.length())).intValue();
+ return Integer.valueOf(controlName.substring(6 + name.length())).intValue();
}
- public void mousePressed(Object event) {
+ public void mousePressed(Object event)
+ {
int image = getImageFromEvent(event);
int index = getIndexFor(image);
- if (index < listModel.getSize()) {
+ if (index < listModel.getSize())
+ {
focus(image);
setSelected(index);
}
}
- public Object[] getSelectedObjects() {
- return new Object[] { getListModel().getElementAt(selected)};
+ public Object[] getSelectedObjects()
+ {
+ return new Object[]
+ {
+ getListModel().getElementAt(selected)
+ };
}
/**
*/
- public static interface ImageRenderer extends Renderer {
+ public static interface ImageRenderer extends Renderer
+ {
/**
*
@@ -675,153 +842,196 @@ import javax.swing.event.ListDataListener;
public Object[] getImageUrls(Object listItem);
}
- private static class SimpleCounterRenderer implements Renderer {
- public String render(Object counter) {
+ private static class SimpleCounterRenderer implements Renderer
+ {
+
+ public String render(Object counter)
+ {
return "" + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max;
}
}
- public static class Counter {
- public int start, end, max;
+ public static class Counter
+ {
+
+ public int start, end, max;
- public Counter(int start_, int end_, int max_) {
+ public Counter(int start_, int end_, int max_)
+ {
start = start_;
end = end_;
max = max_;
}
}
- public Object getSelectedObject() {
+ public Object getSelectedObject()
+ {
return selected >= 0 ? getListModel().getElementAt(selected) : null;
}
- public void showSelected() {
+ public void showSelected()
+ {
int oldPageStart = pageStart;
if (selected == -1)
+ {
pageStart += 0;
+ }
else
+ {
pageStart = (selected / images.length) * images.length;
- if (oldPageStart != pageStart) {
+ }
+ if (oldPageStart != pageStart)
+ {
enableButtons();
refreshImages();
}
}
- public void setRowSelect(boolean b) {
+ public void setRowSelect(boolean b)
+ {
rowSelect = b;
}
- public boolean isRowSelect() {
+ public boolean isRowSelect()
+ {
return rowSelect;
}
-
-
- private class ImageKeyListener implements XKeyListener {
+ private class ImageKeyListener implements XKeyListener
+ {
/* (non-Javadoc)
* @see com.sun.star.awt.XKeyListener#keyPressed(com.sun.star.awt.KeyEvent)
*/
- public void keyPressed(KeyEvent ke) {
+ public void keyPressed(KeyEvent ke)
+ {
int image = getImageFromEvent(ke);
int r = image / getCols();
int c = image - (r * getCols());
- int d = getKeyMove(ke,r,c);
- int newImage = image + d ;
+ int d = getKeyMove(ke, r, c);
+ int newImage = image + d;
if (newImage == image)
+ {
return;
+ }
if (isFocusable(newImage))
- changeFocus(image,newImage);
+ {
+ changeFocus(image, newImage);
+ }
}
- private boolean isFocusable(int image) {
+ private boolean isFocusable(int image)
+ {
return (image >= 0) && (getIndexFor(image) < listModel.getSize());
}
- private void changeFocus(int oldFocusImage, int newFocusImage) {
+ private void changeFocus(int oldFocusImage, int newFocusImage)
+ {
focus(newFocusImage);
defocus(oldFocusImage);
}
-
- private final int getKeyMove(KeyEvent ke, int row, int col) {
- switch (ke.KeyCode) {
- case Key.UP :
- if (row > 0) return 0 - getCols();
+ private final int getKeyMove(KeyEvent ke, int row, int col)
+ {
+ switch (ke.KeyCode)
+ {
+ case Key.UP:
+ if (row > 0)
+ {
+ return 0 - getCols();
+ }
break;
- case Key.DOWN :
- if (row < getRows() - 1) return getCols();
+ case Key.DOWN:
+ if (row < getRows() - 1)
+ {
+ return getCols();
+ }
break;
- case Key.LEFT :
- if (col > 0) return -1;
+ case Key.LEFT:
+ if (col > 0)
+ {
+ return -1;
+ }
break;
- case Key.RIGHT :
- if (col < getCols() - 1) return 1;
+ case Key.RIGHT:
+ if (col < getCols() - 1)
+ {
+ return 1;
+ }
break;
- case Key.SPACE :
+ case Key.SPACE:
select(ke);
}
return 0;
}
- private void select(KeyEvent ke) {
+ private void select(KeyEvent ke)
+ {
setSelected(getIndexFor(getImageFromEvent(ke)));
}
+ public void keyReleased(KeyEvent ke)
+ {
+ }
- public void keyReleased(KeyEvent ke) {}
-
- public void disposing(EventObject arg0) {}
-
+ public void disposing(EventObject arg0)
+ {
+ }
}
- private final void focus(int image) {
- Helper.setUnoPropertyValue(images[image].getModel(),"Tabstop",
- Boolean.TRUE );
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,images[image]);
+ private final void focus(int image)
+ {
+ Helper.setUnoPropertyValue(images[image].getModel(), "Tabstop",
+ Boolean.TRUE);
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, images[image]);
xWindow.setFocus();
}
- private final void defocus(int image) {
- Helper.setUnoPropertyValue(UnoDialog.getModel(images[image]),"Tabstop",
- Boolean.FALSE);
+ private final void defocus(int image)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(images[image]), "Tabstop",
+ Boolean.FALSE);
}
+
/**
* jump to the given item (display the screen
* that contains the given item).
* @param i
*/
- public void display(int i) {
+ public void display(int i)
+ {
int is = (getCols() * getRows());
- int ps = (listModel.getSize() / is ) * is ;
+ int ps = (listModel.getSize() / is) * is;
setPageStart(ps);
}
-
/**
* @return
*/
- public boolean isenabled() {
+ public boolean isenabled()
+ {
return benabled;
}
/**
* @param b
*/
- public void setenabled(boolean b) {
+ public void setenabled(boolean b)
+ {
for (int i = 0; i < images.length; i++)
+ {
UnoDialog2.setEnabled(images[i], b);
-
- UnoDialog2.setEnabled(grbxSelectedImage,b );
- UnoDialog2.setEnabled( lblImageText ,b );
- if (showButtons) {
- UnoDialog2.setEnabled( btnBack ,b );
- UnoDialog2.setEnabled( btnNext ,b );
- UnoDialog2.setEnabled( lblCounter ,b );
+ }
+ UnoDialog2.setEnabled(grbxSelectedImage, b);
+ UnoDialog2.setEnabled(lblImageText, b);
+ if (showButtons)
+ {
+ UnoDialog2.setEnabled(btnBack, b);
+ UnoDialog2.setEnabled(btnNext, b);
+ UnoDialog2.setEnabled(lblCounter, b);
}
benabled = b;
}
-
}
diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.java b/wizards/com/sun/star/wizards/ui/PathSelection.java
index 06df61dc46e2..93378aa89838 100755
--- a/wizards/com/sun/star/wizards/ui/PathSelection.java
+++ b/wizards/com/sun/star/wizards/ui/PathSelection.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: PathSelection.java,v $
+ *
+ * $Revision: 1.5.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.ui;
import com.sun.star.awt.XTextComponent;
@@ -6,36 +37,38 @@ import com.sun.star.uno.Exception;
import com.sun.star.wizards.common.FileAccess;
import com.sun.star.wizards.common.SystemDialog;
-public class PathSelection {
+public class PathSelection
+{
UnoDialog2 CurUnoDialog;
XMultiServiceFactory xMSF;
int iDialogType;
int iTransferMode;
-
public String sDefaultDirectory = "";
public String sDefaultName = "";
public String sDefaultFilter = "";
-
public boolean usedPathPicker = false;
-
public XPathSelectionListener xAction;
public XTextComponent xSaveTextBox;
-
private final int CMDSELECTPATH = 1;
private final int TXTSAVEPATH = 1;
- public static class DialogTypes {
+ public static class DialogTypes
+ {
+
public static final int FOLDER = 0;
public static final int FILE = 1;
}
- public static class TransferMode {
+ public static class TransferMode
+ {
+
public static final int SAVE = 0;
public static final int LOAD = 1;
}
- public PathSelection(XMultiServiceFactory xMSF, UnoDialog2 CurUnoDialog, int TransferMode, int DialogType) {
+ public PathSelection(XMultiServiceFactory xMSF, UnoDialog2 CurUnoDialog, int TransferMode, int DialogType)
+ {
this.CurUnoDialog = CurUnoDialog;
this.xMSF = xMSF;
this.iDialogType = DialogType;
@@ -43,82 +76,117 @@ public class PathSelection {
}
- public void insert(int DialogStep, int XPos, int YPos, int Width, short CurTabIndex, String LabelText, boolean Enabled, String TxtHelpURL, String BtnHelpURL) {
-
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSaveAs", new String[] { "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, new Object[] { new Boolean(Enabled), new Integer(8), LabelText, new Integer(XPos), new Integer(YPos), new Integer(DialogStep), new Short(CurTabIndex), new Integer(Width)});
-
- xSaveTextBox = CurUnoDialog.insertTextField("txtSavePath", "callXPathSelectionListener", this, new String[] { "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, new Object[] { new Boolean(Enabled), new Integer(12), TxtHelpURL, new Integer(XPos), new Integer(YPos + 10), new Integer(DialogStep), new Short((short)(CurTabIndex + 1)), new Integer(Width - 26)});
+ public void insert(int DialogStep, int XPos, int YPos, int Width, short CurTabIndex, String LabelText, boolean Enabled, String TxtHelpURL, String BtnHelpURL)
+ {
+
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblSaveAs", new String[]
+ {
+ "Enabled", "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ }, new Object[]
+ {
+ new Boolean(Enabled), new Integer(8), LabelText, new Integer(XPos), new Integer(YPos), new Integer(DialogStep), new Short(CurTabIndex), new Integer(Width)
+ });
+
+ xSaveTextBox = CurUnoDialog.insertTextField("txtSavePath", "callXPathSelectionListener", this, new String[]
+ {
+ "Enabled", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ }, new Object[]
+ {
+ new Boolean(Enabled), new Integer(12), TxtHelpURL, new Integer(XPos), new Integer(YPos + 10), new Integer(DialogStep), new Short((short) (CurTabIndex + 1)), new Integer(Width - 26)
+ });
//CurUnoDialog.setControlProperty("txtSavePath", "ReadOnly", Boolean.TRUE);
CurUnoDialog.setControlProperty("txtSavePath", "Enabled", Boolean.FALSE);
- CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker", this, new String[] { "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, new Object[] { new Boolean(Enabled), new Integer(14), BtnHelpURL, "...", new Integer(XPos + Width - 16), new Integer(YPos + 9), new Integer(DialogStep), new Short((short)(CurTabIndex + 2)), new Integer(16)});
+ CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker", this, new String[]
+ {
+ "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ }, new Object[]
+ {
+ new Boolean(Enabled), new Integer(14), BtnHelpURL, "...", new Integer(XPos + Width - 16), new Integer(YPos + 9), new Integer(DialogStep), new Short((short) (CurTabIndex + 2)), new Integer(16)
+ });
}
- public void addSelectionListener(XPathSelectionListener xAction) {
+ public void addSelectionListener(XPathSelectionListener xAction)
+ {
this.xAction = xAction;
}
- public String getSelectedPath() {
+ public String getSelectedPath()
+ {
return xSaveTextBox.getText();
}
- public void initializePath() {
- try {
+ public void initializePath()
+ {
+ try
+ {
FileAccess myFA = new FileAccess(xMSF);
xSaveTextBox.setText(myFA.getPath(sDefaultDirectory + "/" + sDefaultName, null));
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
- public void triggerPathPicker() {
- try {
- switch (iTransferMode) {
- case TransferMode.SAVE :
- switch (iDialogType) {
- case DialogTypes.FOLDER :
+ public void triggerPathPicker()
+ {
+ try
+ {
+ switch (iTransferMode)
+ {
+ case TransferMode.SAVE:
+ switch (iDialogType)
+ {
+ case DialogTypes.FOLDER:
//TODO: write code for picking a folder for saving
break;
- case DialogTypes.FILE :
+ case DialogTypes.FILE:
usedPathPicker = true;
SystemDialog myFilePickerDialog = SystemDialog.createStoreDialog(xMSF);
myFilePickerDialog.callStoreDialog(sDefaultDirectory, sDefaultName, sDefaultFilter);
String sStorePath = myFilePickerDialog.sStorePath;
- if (sStorePath != null) {
+ if (sStorePath != null)
+ {
FileAccess myFA = new FileAccess(xMSF);
- xSaveTextBox.setText(myFA.getPath(sStorePath,null));
+ xSaveTextBox.setText(myFA.getPath(sStorePath, null));
sDefaultDirectory = FileAccess.getParentDir(sStorePath);
sDefaultName = myFA.getFilename(sStorePath);
}
break;
- default :
+ default:
break;
}
break;
- case TransferMode.LOAD :
- switch (iDialogType) {
- case DialogTypes.FOLDER :
+ case TransferMode.LOAD:
+ switch (iDialogType)
+ {
+ case DialogTypes.FOLDER:
//TODO: write code for picking a folder for loading
break;
- case DialogTypes.FILE :
+ case DialogTypes.FILE:
//TODO: write code for picking a file for loading
break;
- default :
+ default:
break;
}
break;
- default :
+ default:
break;
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
- public void callXPathSelectionListener() {
+ public void callXPathSelectionListener()
+ {
if (xAction != null)
+ {
xAction.validatePath();
+ }
}
-
}
diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.java b/wizards/com/sun/star/wizards/ui/PeerConfig.java
index ef5699483816..d9a5ea390b3f 100644
--- a/wizards/com/sun/star/wizards/ui/PeerConfig.java
+++ b/wizards/com/sun/star/wizards/ui/PeerConfig.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.ui;
import java.util.Vector;
@@ -44,107 +43,123 @@ import com.sun.star.wizards.common.Helper;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class PeerConfig implements XWindowListener{
+public class PeerConfig implements XWindowListener
+{
+
private Vector m_aPeerTasks = new Vector();
Vector aControlTasks = new Vector();
Vector aImageUrlTasks = new Vector();
UnoDialog oUnoDialog = null;
- public PeerConfig(UnoDialog _oUnoDialog) {
+ public PeerConfig(UnoDialog _oUnoDialog)
+ {
oUnoDialog = _oUnoDialog;
oUnoDialog.xWindow.addWindowListener(this);
}
- class PeerTask{
+ class PeerTask
+ {
+
XControl xControl;
String[] propnames;
Object[] propvalues;
- public PeerTask(XControl _xControl, String[] propNames_, Object[] propValues_){
+ public PeerTask(XControl _xControl, String[] propNames_, Object[] propValues_)
+ {
propnames = propNames_;
propvalues = propValues_;
xControl = _xControl;
}
}
+ class ControlTask
+ {
- class ControlTask{
Object oModel;
String propname;
Object propvalue;
- public ControlTask(Object _oModel, String _propName, Object _propValue){
+ public ControlTask(Object _oModel, String _propName, Object _propValue)
+ {
propname = _propName;
propvalue = _propValue;
oModel = _oModel;
}
}
+ class ImageUrlTask
+ {
- class ImageUrlTask{
Object oModel;
Object oResource;
Object oHCResource;
- public ImageUrlTask(Object _oModel, Object _oResource, Object _oHCResource){
+ public ImageUrlTask(Object _oModel, Object _oResource, Object _oHCResource)
+ {
oResource = _oResource;
oHCResource = _oHCResource;
oModel = _oModel;
}
}
-
- public void windowResized(WindowEvent arg0) {
+ public void windowResized(WindowEvent arg0)
+ {
}
- public void windowMoved(WindowEvent arg0) {
+ public void windowMoved(WindowEvent arg0)
+ {
}
-
- public void windowShown(EventObject arg0) {
- try {
- for (int i = 0; i < this.m_aPeerTasks.size(); i++)
- {
- PeerTask aPeerTask = (PeerTask) m_aPeerTasks.elementAt(i);
- XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, aPeerTask.xControl.getPeer());
- for (int n = 0; n < aPeerTask.propnames.length; n++)
- {
- xVclWindowPeer.setProperty(aPeerTask.propnames[n], aPeerTask.propvalues[n]);
- }
- }
- for (int i = 0; i < this.aControlTasks.size(); i++)
+ public void windowShown(EventObject arg0)
+ {
+ try
{
- ControlTask aControlTask = (ControlTask) aControlTasks.elementAt(i);
- Helper.setUnoPropertyValue(aControlTask.oModel, aControlTask.propname, aControlTask.propvalue);
- }
- for (int i = 0; i < this.aImageUrlTasks.size(); i++){
- ImageUrlTask aImageUrlTask = (ImageUrlTask) aImageUrlTasks.elementAt(i);
- String sImageUrl = "";
- if (AnyConverter.isInt(aImageUrlTask.oResource))
+ for (int i = 0; i < this.m_aPeerTasks.size(); i++)
{
- sImageUrl = oUnoDialog.getWizardImageUrl(((Integer) aImageUrlTask.oResource).intValue(), ((Integer) aImageUrlTask.oHCResource).intValue());
+ PeerTask aPeerTask = (PeerTask) m_aPeerTasks.elementAt(i);
+ XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, aPeerTask.xControl.getPeer());
+ for (int n = 0; n < aPeerTask.propnames.length; n++)
+ {
+ xVclWindowPeer.setProperty(aPeerTask.propnames[n], aPeerTask.propvalues[n]);
+ }
}
- else if (AnyConverter.isString(aImageUrlTask.oResource))
+ for (int i = 0; i < this.aControlTasks.size(); i++)
{
- sImageUrl = oUnoDialog.getImageUrl(((String) aImageUrlTask.oResource), ((String) aImageUrlTask.oHCResource));
+ ControlTask aControlTask = (ControlTask) aControlTasks.elementAt(i);
+ Helper.setUnoPropertyValue(aControlTask.oModel, aControlTask.propname, aControlTask.propvalue);
}
- if (!sImageUrl.equals(""))
+ for (int i = 0; i < this.aImageUrlTasks.size(); i++)
{
- Helper.setUnoPropertyValue(aImageUrlTask.oModel, "ImageURL", sImageUrl);
+ ImageUrlTask aImageUrlTask = (ImageUrlTask) aImageUrlTasks.elementAt(i);
+ String sImageUrl = "";
+ if (AnyConverter.isInt(aImageUrlTask.oResource))
+ {
+ sImageUrl = oUnoDialog.getWizardImageUrl(((Integer) aImageUrlTask.oResource).intValue(), ((Integer) aImageUrlTask.oHCResource).intValue());
+ }
+ else if (AnyConverter.isString(aImageUrlTask.oResource))
+ {
+ sImageUrl = oUnoDialog.getImageUrl(((String) aImageUrlTask.oResource), ((String) aImageUrlTask.oHCResource));
+ }
+ if (!sImageUrl.equals(""))
+ {
+ Helper.setUnoPropertyValue(aImageUrlTask.oModel, "ImageURL", sImageUrl);
+ }
+ }
+
}
+ catch (RuntimeException re)
+ {
+ re.printStackTrace(System.out);
+ throw re;
}
-
- } catch (RuntimeException re) {
- re.printStackTrace(System.out);
- throw re;
- }}
-
-
- public void windowHidden(EventObject arg0) {
}
+ public void windowHidden(EventObject arg0)
+ {
+ }
- public void disposing(EventObject arg0) {
+ public void disposing(EventObject arg0)
+ {
}
/**
@@ -155,13 +170,24 @@ public class PeerConfig implements XWindowListener{
public void setAccessibleName(Object oAPIControl, String _saccessname)
{
XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oAPIControl);
- setPeerProperties(xControl, new String[] { "AccessibleName" }, new String[]{_saccessname});
+ setPeerProperties(xControl, new String[]
+ {
+ "AccessibleName"
+ }, new String[]
+ {
+ _saccessname
+ });
}
-
public void setAccessibleName(XControl _xControl, String _saccessname)
{
- setPeerProperties(_xControl, new String[] { "AccessibleName" }, new String[]{_saccessname});
+ setPeerProperties(_xControl, new String[]
+ {
+ "AccessibleName"
+ }, new String[]
+ {
+ _saccessname
+ });
}
/**
@@ -176,10 +202,9 @@ public class PeerConfig implements XWindowListener{
setPeerProperties(xControl, _propnames, _propvalues);
}
-
public void setPeerProperties(XControl _xControl, String[] propnames, Object[] propvalues)
{
- PeerTask oPeerTask = new PeerTask(_xControl, propnames, propvalues);
+ PeerTask oPeerTask = new PeerTask(_xControl, propnames, propvalues);
this.m_aPeerTasks.add(oPeerTask);
}
@@ -190,7 +215,8 @@ public class PeerConfig implements XWindowListener{
* @param _spropname
* @param _propvalue
*/
- public void setControlProperty(Object _ocontrolmodel, String _spropname, Object _propvalue){
+ public void setControlProperty(Object _ocontrolmodel, String _spropname, Object _propvalue)
+ {
ControlTask oControlTask = new ControlTask(_ocontrolmodel, _spropname, _propvalue);
this.aControlTasks.add(oControlTask);
}
@@ -203,7 +229,8 @@ public class PeerConfig implements XWindowListener{
* @param _nResId
* @param _nhcResId
*/
- public void setImageUrl(Object _ocontrolmodel, int _nResId, int _nhcResId){
+ public void setImageUrl(Object _ocontrolmodel, int _nResId, int _nhcResId)
+ {
ImageUrlTask oImageUrlTask = new ImageUrlTask(_ocontrolmodel, new Integer(_nResId), new Integer(_nhcResId));
this.aImageUrlTasks.add(oImageUrlTask);
}
@@ -215,12 +242,12 @@ public class PeerConfig implements XWindowListener{
* @param _sResourceUrl
* @param _sHCResourceUrl
*/
- public void setImageUrl(Object _ocontrolmodel, String _sResourceUrl, String _sHCResourceUrl){
+ public void setImageUrl(Object _ocontrolmodel, String _sResourceUrl, String _sHCResourceUrl)
+ {
ImageUrlTask oImageUrlTask = new ImageUrlTask(_ocontrolmodel, _sResourceUrl, _sHCResourceUrl);
this.aImageUrlTasks.add(oImageUrlTask);
}
-
/**
* Assigns an image to the property 'ImageUrl' of a dialog control. The image id must be assigned in a resource file
* within the wizards project
@@ -229,11 +256,9 @@ public class PeerConfig implements XWindowListener{
* @param _oResource
* @param _oHCResource
*/
- public void setImageUrl(Object _ocontrolmodel, Object _oResource, Object _oHCResource){
+ public void setImageUrl(Object _ocontrolmodel, Object _oResource, Object _oHCResource)
+ {
ImageUrlTask oImageUrlTask = new ImageUrlTask(_ocontrolmodel, _oResource, _oHCResource);
this.aImageUrlTasks.add(oImageUrlTask);
}
-
-
-
}
diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java
index 9d285597dc69..e3091d6c9599 100644
--- a/wizards/com/sun/star/wizards/ui/SortingComponent.java
+++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui;
+ ************************************************************************/
+package com.sun.star.wizards.ui;
import java.beans.PropertyChangeEvent;
@@ -34,44 +35,50 @@ import com.sun.star.wizards.common.JavaTools;
import com.sun.star.wizards.common.*;
import com.sun.star.awt.*;
-public class SortingComponent {
+public class SortingComponent
+{
+
com.sun.star.lang.XMultiServiceFactory xMSF;
WizardDialog CurUnoDialog;
int MaxSortIndex = -1;
public String[][] FieldNames;
static String sNoSorting;
static String sSortCriteriaisduplicate;
-
static String[] sSortHeader = new String[4];
static String[] sSortAscend = new String[4];
static String[] sSortDescend = new String[4];
static short[] bOldSortValues = new short[4];
-
public int MAXSORTCRITERIAINDEX = 3;
-
final int SOFIRSTSORTLST = 0;
final int SOSECSORTLST = 1;
final int SOTHIRDSORTLST = 2;
final int SOFOURTHSORTLST = 3;
- final int[] SOSORTLST = new int[] { SOFIRSTSORTLST, SOSECSORTLST, SOTHIRDSORTLST, SOFOURTHSORTLST };
-
+ final int[] SOSORTLST = new int[]
+ {
+ SOFIRSTSORTLST, SOSECSORTLST, SOTHIRDSORTLST, SOFOURTHSORTLST
+ };
XListBox[] xSortListBox = new XListBox[4];
- class ItemListenerImpl implements com.sun.star.awt.XItemListener {
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
- public void itemStateChanged(ItemEvent EventObject) {
+ public void itemStateChanged(ItemEvent EventObject)
+ {
Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(false));
int ikey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
enableNextSortListBox(ikey);
Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", new Boolean(true));
}
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
}
- public SortingComponent(WizardDialog CurUnoDialog, int iStep, int iCompPosX, int iCompPosY, int iCompWidth, int FirstHelpIndex) {
- try {
+ public SortingComponent(WizardDialog CurUnoDialog, int iStep, int iCompPosX, int iCompPosY, int iCompWidth, int FirstHelpIndex)
+ {
+ try
+ {
this.CurUnoDialog = CurUnoDialog;
short curtabindex = UnoDialog.setInitialTabindex(iStep);
xMSF = CurUnoDialog.xMSF;
@@ -90,27 +97,55 @@ public class SortingComponent {
boolean bDoEnable;
String HIDString;
int iCurPosY = iCompPosY;
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++)
+ {
bDoEnable = (i < 2);
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lblSort" + new Integer(i + 1).toString(), new String[] { "Enabled", "Height", "Label", "Orientation", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, new Object[] { new Boolean(bDoEnable), new Integer(8), sSortHeader[i], new Integer(0), ICompPosX, new Integer(iCurPosY), IStep, new Short(curtabindex++), ICompWidth });
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lblSort" + new Integer(i + 1).toString(), new String[]
+ {
+ "Enabled", "Height", "Label", "Orientation", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ }, new Object[]
+ {
+ new Boolean(bDoEnable), new Integer(8), sSortHeader[i], new Integer(0), ICompPosX, new Integer(iCurPosY), IStep, new Short(curtabindex++), ICompWidth
+ });
HIDString = "HID:" + Integer.toString(FirstHelpIndex);
- xSortListBox[i] = CurUnoDialog.insertListBox("lstSort" + new Integer(i + 1).toString(), SOSORTLST[i], null, new ItemListenerImpl(), new String[] { "Dropdown", "Enabled", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width" }, new Object[] { new Boolean(true), new Boolean(bDoEnable), new Integer(12), HIDString, new Short("7"), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth }); //new Short((short) (17+i*4))
+ xSortListBox[i] = CurUnoDialog.insertListBox("lstSort" + new Integer(i + 1).toString(), SOSORTLST[i], null, new ItemListenerImpl(), new String[]
+ {
+ "Dropdown", "Enabled", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ }, new Object[]
+ {
+ new Boolean(true), new Boolean(bDoEnable), new Integer(12), HIDString, new Short("7"), "lstSort" + new Integer(i + 1), IListBoxPosX, new Integer(iCurPosY + 14), IStep, new Short(curtabindex++), IListBoxWidth
+ }); //new Short((short) (17+i*4))
HIDString = "HID:" + Integer.toString(FirstHelpIndex + 1);
- XRadioButton xRadioButtonAsc = CurUnoDialog.insertRadioButton("optAscend" + Integer.toString(i + 1), 0, new String[] { "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Tag", "Width" }, new Object[] { new Boolean(bDoEnable), new Integer(10), HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), new String("ASC"), IOptButtonWidth }); //, new Short((short) (18+i*4))
+ XRadioButton xRadioButtonAsc = CurUnoDialog.insertRadioButton("optAscend" + Integer.toString(i + 1), 0, new String[]
+ {
+ "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Tag", "Width"
+ }, new Object[]
+ {
+ new Boolean(bDoEnable), new Integer(10), HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), new String("ASC"), IOptButtonWidth
+ }); //, new Short((short) (18+i*4))
HIDString = "HID:" + Integer.toString(FirstHelpIndex + 2);
- XRadioButton xRadioButtonDesc = CurUnoDialog.insertRadioButton("optDescend" + Integer.toString(i + 1), 0, new String[] { "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Tag", "Width" }, new Object[] { new Boolean(bDoEnable), new Integer(10), HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), new String("DESC"), IOptButtonWidth }); //, new Short((short) (19+i*4))
+ XRadioButton xRadioButtonDesc = CurUnoDialog.insertRadioButton("optDescend" + Integer.toString(i + 1), 0, new String[]
+ {
+ "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Tag", "Width"
+ }, new Object[]
+ {
+ new Boolean(bDoEnable), new Integer(10), HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), new String("DESC"), IOptButtonWidth
+ }); //, new Short((short) (19+i*4))
iCurPosY = iCurPosY + 36;
FirstHelpIndex += 3;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- private boolean getResources() {
+ private boolean getResources()
+ {
sSortHeader[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 20);
sSortHeader[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 21);
sSortHeader[2] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 51);
@@ -128,7 +163,8 @@ public class SortingComponent {
return true;
}
- public void initialize(String[] _FieldNames, String[][] _SortFieldNames) {
+ public void initialize(String[] _FieldNames, String[][] _SortFieldNames)
+ {
int FieldCount = _FieldNames.length;
String[] ViewFieldNames = new String[FieldCount + 1];
ViewFieldNames[0] = sNoSorting;
@@ -137,14 +173,21 @@ public class SortingComponent {
ViewFieldNames[i + 1] = _FieldNames[i];
}
short[] SelList = null;
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++)
+ {
if (i < _SortFieldNames.length)
{
- SelList = new short[] {(short) (JavaTools.FieldInList(_FieldNames, _SortFieldNames[i][0]) + 1)};
+ SelList = new short[]
+ {
+ (short) (JavaTools.FieldInList(_FieldNames, _SortFieldNames[i][0]) + 1)
+ };
}
else
{
- SelList = new short[] {(short) 0 };
+ SelList = new short[]
+ {
+ (short) 0
+ };
}
CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), "StringItemList", ViewFieldNames);
CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), "SelectedItems", SelList);
@@ -152,9 +195,11 @@ public class SortingComponent {
}
}
- private void setMaxSortIndex() {
+ private void setMaxSortIndex()
+ {
MaxSortIndex = -1;
- for (int i = 0; i <= MAXSORTCRITERIAINDEX; i++) {
+ for (int i = 0; i <= MAXSORTCRITERIAINDEX; i++)
+ {
if (xSortListBox[i].getSelectedItemPos() > 0)
{
MaxSortIndex += 1;
@@ -167,25 +212,29 @@ public class SortingComponent {
* @param _index index of the Sorting criterion
* @param _breadonly
*/
- public void setReadOnly(int _index, boolean _breadonly){
+ public void setReadOnly(int _index, boolean _breadonly)
+ {
CurUnoDialog.setControlProperty("lstSort" + new Integer(_index + 1).toString(), "ReadOnly", new Boolean(_breadonly));
}
-
/**
*
* @param _index the first Sorting criterion in which 'ReadOnly is set to 'false'
* @param _bcomplete
*/
- public void setReadOnlyUntil(int _index, boolean _bcomplete){
- for (int i = 0; i <= 4; i++) {
+ public void setReadOnlyUntil(int _index, boolean _bcomplete)
+ {
+ for (int i = 0; i <= 4; i++)
+ {
boolean breadonly = i < _index;
setReadOnly(i, breadonly);
}
}
- private void enableNextSortListBox(int CurIndex) {
- try {
+ private void enableNextSortListBox(int CurIndex)
+ {
+ try
+ {
setMaxSortIndex();
boolean bDoEnable = (xSortListBox[CurIndex].getSelectedItemPos() != 0);
if (!bDoEnable)
@@ -196,20 +245,25 @@ public class SortingComponent {
{
toggleSortListBox(CurIndex + 1, true);
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public String[][] getSortFieldNames() {
- try {
+ public String[][] getSortFieldNames()
+ {
+ try
+ {
short iCurState;
String CurFieldName;
String CurFieldTitle;
setMaxSortIndex();
String[][] SortFieldNames = new String[MaxSortIndex + 1][2];
- String[] SortDescriptions = new String[MaxSortIndex+1];
- for (int i = 0; i <= MaxSortIndex; i++) {
+ String[] SortDescriptions = new String[MaxSortIndex + 1];
+ for (int i = 0; i <= MaxSortIndex; i++)
+ {
CurFieldName = xSortListBox[i].getSelectedItem();
SortFieldNames[i][0] = CurFieldName;
SortDescriptions[i] = CurFieldName;
@@ -227,33 +281,43 @@ public class SortingComponent {
// When searching for a duplicate entry we can neglect wether the entries are to be sorted ascending or descending
// TODO for the future we should deliver a messagebox when two different sorting modes have been applied to one field
int iduplicate = JavaTools.getDuplicateFieldIndex(SortDescriptions);
- if (iduplicate != -1) {
+ if (iduplicate != -1)
+ {
String sLocSortCriteriaisduplicate = JavaTools.replaceSubString(sSortCriteriaisduplicate, SortFieldNames[iduplicate][0], "<FIELDNAME>");
CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sLocSortCriteriaisduplicate);
CurUnoDialog.vetoableChange(new PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2)));
CurUnoDialog.setFocus("lstSort" + (iduplicate + 1));
- return new String[][] {
- };
+ return new String[][]
+ {
+ };
}
else
{
return SortFieldNames;
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public void disableListBoxesfromIndex(int CurIndex) {
- if (CurIndex < MAXSORTCRITERIAINDEX) {
- for (int i = CurIndex + 1; i <= MAXSORTCRITERIAINDEX; i++) {
+ public void disableListBoxesfromIndex(int CurIndex)
+ {
+ if (CurIndex < MAXSORTCRITERIAINDEX)
+ {
+ for (int i = CurIndex + 1; i <= MAXSORTCRITERIAINDEX; i++)
+ {
toggleSortListBox(i, (false));
if (i < MaxSortIndex)
{
- CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[] { 0 });
+ CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[]
+ {
+ 0
+ });
}
- // xSortListBox[i+1].selectItemPos((short)0, true);
+ // xSortListBox[i+1].selectItemPos((short)0, true);
}
CurUnoDialog.setFocus("lblSort" + new Integer(CurIndex + 1));
MaxSortIndex = CurIndex - 1;
@@ -261,17 +325,28 @@ public class SortingComponent {
}
// The following code can be reactivated in a future version when task #100799 will be fixed
- private void moveupSortItems(int CurIndex, boolean bDoEnable) {
+ private void moveupSortItems(int CurIndex, boolean bDoEnable)
+ {
short iNextItemPos;
- if ((bDoEnable == false) && (MAXSORTCRITERIAINDEX > CurIndex)) {
- for (int i = CurIndex; i < MAXSORTCRITERIAINDEX; i++) {
+ if ((bDoEnable == false) && (MAXSORTCRITERIAINDEX > CurIndex))
+ {
+ for (int i = CurIndex; i < MAXSORTCRITERIAINDEX; i++)
+ {
iNextItemPos = xSortListBox[i + 1].getSelectedItemPos();
- if (iNextItemPos != 0) {
- CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), "SelectedItems", new short[] { iNextItemPos });
- CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[] {
- });
+ if (iNextItemPos != 0)
+ {
+ CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), "SelectedItems", new short[]
+ {
+ iNextItemPos
+ });
+ CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[]
+ {
+ });
toggleSortListBox(i, true);
- CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[] { 0 });
+ CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[]
+ {
+ 0
+ });
}
}
if (MaxSortIndex < xSortListBox.length - 2)
@@ -285,19 +360,27 @@ public class SortingComponent {
}
}
- private void toggleSortListBox(int CurIndex, boolean bDoEnable) {
- try {
- if (CurIndex < xSortListBox.length) {
+ private void toggleSortListBox(int CurIndex, boolean bDoEnable)
+ {
+ try
+ {
+ if (CurIndex < xSortListBox.length)
+ {
CurUnoDialog.setControlProperty("lblSort" + new Integer(CurIndex + 1).toString(), "Enabled", new Boolean(bDoEnable));
CurUnoDialog.setControlProperty("lstSort" + new Integer(CurIndex + 1).toString(), "Enabled", new Boolean(bDoEnable));
CurUnoDialog.setControlProperty("optAscend" + new Integer(CurIndex + 1).toString(), "Enabled", new Boolean(bDoEnable));
CurUnoDialog.setControlProperty("optDescend" + new Integer(CurIndex + 1).toString(), "Enabled", new Boolean(bDoEnable));
if (bDoEnable == false)
{
- CurUnoDialog.setControlProperty("lstSort" + new Integer(CurIndex + 1).toString(), "SelectedItems", new short[] { 0 });
+ CurUnoDialog.setControlProperty("lstSort" + new Integer(CurIndex + 1).toString(), "SelectedItems", new short[]
+ {
+ 0
+ });
}
}
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
diff --git a/wizards/com/sun/star/wizards/ui/TitlesComponent.java b/wizards/com/sun/star/wizards/ui/TitlesComponent.java
index 810956f4f9f9..904b76fcd1c8 100644
--- a/wizards/com/sun/star/wizards/ui/TitlesComponent.java
+++ b/wizards/com/sun/star/wizards/ui/TitlesComponent.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui;
+ ************************************************************************/
+package com.sun.star.wizards.ui;
import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.*;
@@ -37,80 +38,111 @@ import com.sun.star.awt.XTextListener;
import java.util.*;
-public class TitlesComponent extends ControlScroller{
+public class TitlesComponent extends ControlScroller
+{
+
int iLabelPosX;
final int iRelLabelPosXDist = 6;
public String[] fieldnames;
public Map fieldtitleset;
public String[] fieldtitles;
public XTextListener xTextListener;
-
final String SOLABELPREFIX = "lblColumnName_";
final String SOTITLEPREFIX = "lblTitleName_";
-
- public TitlesComponent(WizardDialog _CurUnoDialog, int _iStep, int _iCompPosX, int _iCompPosY, int _iCompWidth, int _uitextfieldcount, String _slblColumnNames, String _slblColumnTitles, int _firsthelpindex){
+ public TitlesComponent(WizardDialog _CurUnoDialog, int _iStep, int _iCompPosX, int _iCompPosY, int _iCompWidth, int _uitextfieldcount, String _slblColumnNames, String _slblColumnTitles, int _firsthelpindex)
+ {
super(_CurUnoDialog, null, _iStep, _iCompPosX, _iCompPosY, _iCompWidth, _uitextfieldcount, 18, _firsthelpindex);
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblColumnNames", new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "Width" }, new Object[] { new Integer(8), _slblColumnNames, new Integer(iLabelPosX), new Integer(iCompPosY - 10), IStep, new Integer(60)});
- CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblColumnTitles", new String[] { "Height", "Label", "PositionX", "PositionY", "Step", "Width" }, new Object[] { new Integer(8), _slblColumnTitles, new Integer(90), new Integer(iCompPosY - 10), IStep, new Integer(152)});
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblColumnNames", new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ }, new Object[]
+ {
+ new Integer(8), _slblColumnNames, new Integer(iLabelPosX), new Integer(iCompPosY - 10), IStep, new Integer(60)
+ });
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblColumnTitles", new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "Step", "Width"
+ }, new Object[]
+ {
+ new Integer(8), _slblColumnTitles, new Integer(90), new Integer(iCompPosY - 10), IStep, new Integer(152)
+ });
}
- protected void insertControlGroup(int i, int ypos) {
+ protected void insertControlGroup(int i, int ypos)
+ {
iLabelPosX = iCompPosX + iRelLabelPosXDist;
ControlRow oControlRow = new ControlRow(i, ypos);
ControlGroupVector.addElement(oControlRow);
}
-
- protected void setControlGroupVisible(int _index, boolean _bIsVisible){
+ protected void setControlGroupVisible(int _index, boolean _bIsVisible)
+ {
CurUnoDialog.setControlVisible(getColumnName(_index), _bIsVisible);
CurUnoDialog.setControlVisible(getTitleName(_index), _bIsVisible);
}
-
- public void addTextListener(XTextListener _xTextListener){
- for (int i = 0; i < super.ControlGroupVector.size(); i++){
+ public void addTextListener(XTextListener _xTextListener)
+ {
+ for (int i = 0; i < super.ControlGroupVector.size(); i++)
+ {
ControlRow curControlRow = (ControlRow) ControlGroupVector.elementAt(i);
XTextComponent xTextBox = curControlRow.xTextComponent;
if ((xTextBox != null) && (_xTextListener != null))
+ {
xTextBox.addTextListener(_xTextListener);
+ }
}
}
+ class ControlRow
+ {
-
- class ControlRow {
PropertyValue[] regproperties;
XTextComponent xTextComponent;
- public ControlRow(int _index, int _iCompPosY) {
+ public ControlRow(int _index, int _iCompPosY)
+ {
String slabelname = getColumnName(_index);
String stextfieldname = getTitleName(_index);
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", slabelname,
- new String[] { "Height", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(16), new Boolean(true), new Integer(iLabelPosX), new Integer(_iCompPosY + 1), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(30)});
+ new String[]
+ {
+ "Height", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(16), new Boolean(true), new Integer(iLabelPosX), new Integer(_iCompPosY + 1), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(30)
+ });
xTextComponent = CurUnoDialog.insertTextField(stextfieldname, 0, null,
- new String[] { "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(12), "HID:" + curHelpIndex++, new Integer(iLabelPosX + 30), new Integer(_iCompPosY), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(iCompWidth - 90 - 20)});
+ new String[]
+ {
+ "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(12), "HID:" + curHelpIndex++, new Integer(iLabelPosX + 30), new Integer(_iCompPosY), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(iCompWidth - 90 - 20)
+ });
}
}
-
- private String getColumnName(int _index) {
+ private String getColumnName(int _index)
+ {
return SOLABELPREFIX + Integer.toString(_index + 1);
}
-
- private String getTitleName(int _index) {
+ private String getTitleName(int _index)
+ {
return SOTITLEPREFIX + Integer.toString(_index + 1);
}
-
- protected void initializeScrollFields() {
- for (int i = 0; i < fieldnames.length; i++) {
+ protected void initializeScrollFields()
+ {
+ for (int i = 0; i < fieldnames.length; i++)
+ {
PropertyValue[] currowproperties = new PropertyValue[2];
currowproperties[0] = Properties.createProperty(getColumnName(i), fieldnames[i], i);
currowproperties[1] = Properties.createProperty(getTitleName(i), fieldtitles[i], i); //getTitleName(i)
@@ -118,8 +150,8 @@ public class TitlesComponent extends ControlScroller{
}
}
-
- private void adjustPosSizes() {
+ private void adjustPosSizes()
+ {
String sLongestFieldName = JavaTools.getlongestArrayItem(fieldnames);
Size aSize = CurUnoDialog.getpreferredLabelSize(getColumnName(0), sLongestFieldName);
double dblMAPConversion = CurUnoDialog.getMAPConversionFactor(getColumnName(0));
@@ -127,16 +159,23 @@ public class TitlesComponent extends ControlScroller{
Integer FieldNameWidth = new Integer(iFieldNameWidth);
Integer TitlePosX = new Integer(iLabelPosX + iFieldNameWidth + 2);
Integer TitleWidth = new Integer(iCompPosX + iCompWidth - TitlePosX.intValue() - iScrollBarWidth - 6);
- for (short i = 0; i <= ncurfieldcount; i++) {
+ for (short i = 0; i <= ncurfieldcount; i++)
+ {
CurUnoDialog.setControlProperty(getColumnName(i), "Width", FieldNameWidth);
- CurUnoDialog.setControlProperties(getTitleName(i), new String[] { "PositionX", "Width" }, new Object[] { TitlePosX, TitleWidth });
+ CurUnoDialog.setControlProperties(getTitleName(i), new String[]
+ {
+ "PositionX", "Width"
+ }, new Object[]
+ {
+ TitlePosX, TitleWidth
+ });
}
CurUnoDialog.setControlProperty("lblColumnNames", "Width", FieldNameWidth);
CurUnoDialog.setControlProperty("lblColumnTitles", "PositionX", TitlePosX);
}
-
- public void initialize(String[] _fieldnames, Map _fieldtitleset) {
+ public void initialize(String[] _fieldnames, Map _fieldtitleset)
+ {
this.fieldnames = _fieldnames;
this.fieldtitleset = _fieldtitleset;
setFieldTitles();
@@ -146,36 +185,44 @@ public class TitlesComponent extends ControlScroller{
// setComponentMouseTransparent();
}
-
- private void setFieldTitles() {
+ private void setFieldTitles()
+ {
fieldtitles = new String[fieldnames.length];
- for (int i = 0; i < fieldnames.length; i++) {
- if (this.fieldtitleset.containsKey(fieldnames[i])) {
+ for (int i = 0; i < fieldnames.length; i++)
+ {
+ if (this.fieldtitleset.containsKey(fieldnames[i]))
+ {
Object curvalue = fieldtitleset.get(fieldnames[i]);
if (curvalue != null)
+ {
fieldtitles[i] = (String) curvalue;
+ }
else
+ {
fieldtitles[i] = fieldnames[i];
+ }
}
- else{
+ else
+ {
fieldtitles[i] = fieldnames[i];
}
}
}
-
- public String getFieldNameByTitleControl(Object _fieldtitlemodel){
+ public String getFieldNameByTitleControl(Object _fieldtitlemodel)
+ {
String sTitleModelName = (String) Helper.getUnoPropertyValue(_fieldtitlemodel, "Name");
String sindex = JavaTools.getSuffixNumber(sTitleModelName);
return (String) CurUnoDialog.getControlProperty(this.SOLABELPREFIX + sindex, "Label");
}
-
- public String[] getFieldTitles(){
+ public String[] getFieldTitles()
+ {
PropertyValue[][] titlelist = this.getScrollFieldValues();
PropertyValue[] currowproperties;
PropertyValue curtitleproperty;
- for (int i = 0; i < titlelist.length; i++) {
+ for (int i = 0; i < titlelist.length; i++)
+ {
currowproperties = titlelist[i];
curtitleproperty = currowproperties[1];
fieldtitles[i] = (String) curtitleproperty.Value;
@@ -184,18 +231,22 @@ public class TitlesComponent extends ControlScroller{
return fieldtitles;
}
-
- private void refreshtitleset() {
+ private void refreshtitleset()
+ {
for (int i = 0; i < fieldnames.length; i++)
+ {
fieldtitleset.put(fieldnames[i], fieldtitles[i]);
+ }
}
-
- private int getFieldNameWidth(int iMAPControlWidth, double dblMAPConversion) {
+ private int getFieldNameWidth(int iMAPControlWidth, double dblMAPConversion)
+ {
int iFieldNameWidth = (int) (1.15 * ((double) (iMAPControlWidth)) / dblMAPConversion);
double dblAvailableWidth = (double) (iCompWidth - iScrollBarWidth - iRelLabelPosXDist);
if (iFieldNameWidth > (0.5 * (dblAvailableWidth)))
+ {
iFieldNameWidth = (int) (0.5 * (dblAvailableWidth));
+ }
return iFieldNameWidth;
}
}
diff --git a/wizards/com/sun/star/wizards/ui/UIConsts.java b/wizards/com/sun/star/wizards/ui/UIConsts.java
index 96f217327698..bac864ecd09c 100644
--- a/wizards/com/sun/star/wizards/ui/UIConsts.java
+++ b/wizards/com/sun/star/wizards/ui/UIConsts.java
@@ -5,13 +5,15 @@
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package com.sun.star.wizards.ui;
+
/**
* @author rpiterman
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public interface UIConsts {
+public interface UIConsts
+{
public static final int RID_COMMON = 500;
public static final int RID_DB_COMMON = 1000;
@@ -23,23 +25,19 @@ public interface UIConsts {
public static final int RID_IMG_FORM = 1100;
public static final int RID_IMG_WEB = 1200;
public static final Integer INVISIBLESTEP = new Integer(99);
- public static final String INFOIMAGEURL = "private:resource/dbu/image/19205";
- public static final String INFOIMAGEURL_HC = "private:resource/dbu/image/19230";
-
-
+ public static final String INFOIMAGEURL = "private:resource/dbu/image/19205";
+ public static final String INFOIMAGEURL_HC = "private:resource/dbu/image/19230";
/**
* The tabindex of the navigation buttons in a wizard must be assigned a very
* high tabindex because on every step their taborder must appear at the end
*/
public static final short SOFIRSTWIZARDNAVITABINDEX = 30000;
-
public static final Integer INTEGER_8 = new Integer(8);
public static final Integer INTEGER_12 = new Integer(12);
public static final Integer INTEGER_14 = new Integer(14);
public static final Integer INTEGER_16 = new Integer(16);
public static final Integer INTEGER_40 = new Integer(40);
public static final Integer INTEGER_50 = new Integer(50);
-
/**Steps of the QueryWizard
*
*/
@@ -51,10 +49,14 @@ public interface UIConsts {
public static final int SOGROUPFILTERPAGE = 6;
public static final int SOTITLESPAGE = 7;
public static final int SOSUMMARYPAGE = 8;
+ public static final Integer[] INTEGERS = new Integer[]
+ {
+ new Integer(0), new Integer(1), new Integer(2), new Integer(3), new Integer(4), new Integer(5), new Integer(6), new Integer(7), new Integer(8), new Integer(9), new Integer(10)
+ };
- public static final Integer[] INTEGERS = new Integer[] { new Integer(0), new Integer(1), new Integer(2), new Integer(3), new Integer(4), new Integer(5), new Integer(6), new Integer(7), new Integer(8), new Integer(9), new Integer(10)};
+ class CONTROLTYPE
+ {
- class CONTROLTYPE {
public static final int BUTTON = 1;
public static final int IMAGECONTROL = 2;
public static final int LISTBOX = 3;
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java
index 212398ed613f..1425c3eadb53 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.ui;
import com.sun.star.awt.*;
@@ -51,7 +50,9 @@ import com.sun.star.wizards.ui.event.*;
import java.util.Hashtable;
-public class UnoDialog implements EventNames {
+public class UnoDialog implements EventNames
+{
+
public XMultiServiceFactory xMSF;
public XMultiServiceFactory MSFDialogModel;
public XNameContainer xDlgNames;
@@ -70,15 +71,17 @@ public class UnoDialog implements EventNames {
public Resource m_oResource;
public XWindowPeer xWindowPeer = null;
private PeerConfig m_oPeerConfig;
-
protected AbstractListener guiEventListener;
- public AbstractListener getGuiEventListener() {
+ public AbstractListener getGuiEventListener()
+ {
return guiEventListener;
}
- public UnoDialog(XMultiServiceFactory xMSF, String[] PropertyNames, Object[] PropertyValues) {
- try {
+ public UnoDialog(XMultiServiceFactory xMSF, String[] PropertyNames, Object[] PropertyValues)
+ {
+ try
+ {
this.xMSF = xMSF;
ControlList = new Hashtable();
xDialogModel = (XInterface) xMSF.createInstance("com.sun.star.awt.UnoControlDialogModel");
@@ -96,35 +99,39 @@ public class UnoDialog implements EventNames {
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xUnoDialog);
xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xUnoDialog);
- // setPeerConfiguration(); // LLA: will be done, if really used!
- } catch (com.sun.star.uno.Exception exception) {
+ // setPeerConfiguration(); // LLA: will be done, if really used!
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public int getControlKey(Object EventObject, Hashtable ControlList) {
+ public int getControlKey(Object EventObject, Hashtable ControlList)
+ {
int iKey;
XControl xContrl = (XControl) UnoRuntime.queryInterface(XControl.class, EventObject);
XControlModel xControlModel = xContrl.getModel();
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
- try {
+ try
+ {
String sName = (String) xPSet.getPropertyValue("Name");
Integer KeyObject = (Integer) ControlList.get(sName);
iKey = KeyObject.intValue();
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
iKey = 2000;
}
return iKey;
}
-
public void createPeerConfiguration()
{
m_oPeerConfig = new PeerConfig(this);
}
-
public PeerConfig getPeerConfiguration()
{
if (m_oPeerConfig == null)
@@ -134,52 +141,66 @@ public class UnoDialog implements EventNames {
return m_oPeerConfig;
}
-
- public void setControlProperty(String ControlName, String PropertyName, Object PropertyValue) {
- try {
- if (PropertyValue != null) {
+ public void setControlProperty(String ControlName, String PropertyName, Object PropertyValue)
+ {
+ try
+ {
+ if (PropertyValue != null)
+ {
if (xDlgNameAccess.hasByName(ControlName) == false)
+ {
return;
+ }
Object xControlModel = xDlgNameAccess.getByName(ControlName);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
- if (AnyConverter.isArray(PropertyValue)) {
+ if (AnyConverter.isArray(PropertyValue))
+ {
com.sun.star.uno.Type seqType = new com.sun.star.uno.Type(PropertyValue.getClass());
PropertyValue = new com.sun.star.uno.Any(seqType, PropertyValue);
- /* PropertyValue = Helper.getArrayValue(PropertyValue);
- if (PropertyValue == null)
- PropertyValue = new short[]{};
- */
+ /* PropertyValue = Helper.getArrayValue(PropertyValue);
+ if (PropertyValue == null)
+ PropertyValue = new short[]{};
+ */
}
xPSet.setPropertyValue(PropertyName, PropertyValue);
}
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
- public Resource getResource(){
+ public Resource getResource()
+ {
return m_oResource;
}
- public void setControlProperties(String ControlName, String[] PropertyNames, Object[] PropertyValues) {
- try {
- if (PropertyValues != null) {
+ public void setControlProperties(String ControlName, String[] PropertyNames, Object[] PropertyValues)
+ {
+ try
+ {
+ if (PropertyValues != null)
+ {
if (xDlgNameAccess.hasByName(ControlName) == false)
+ {
return;
+ }
Object xControlModel = xDlgNameAccess.getByName(ControlName);
XMultiPropertySet xMultiPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, xControlModel);
xMultiPSet.setPropertyValues(PropertyNames, PropertyValues);
}
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
-
- public Object getControlProperty(String ControlName, String PropertyName) {
- try {
+ public Object getControlProperty(String ControlName, String PropertyName)
+ {
+ try
+ {
Object xControlModel = xDlgNameAccess.getByName(ControlName);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
Object oPropValue = xPSet.getPropertyValue(PropertyName);
@@ -187,265 +208,341 @@ public class UnoDialog implements EventNames {
// return Helper.getArrayValue(oPropValue);
// else
return oPropValue;
- } catch (com.sun.star.uno.Exception exception) { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException,
+ }
+ catch (com.sun.star.uno.Exception exception)
+ { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException,
exception.printStackTrace(System.out); // com.sun.star.lang.WrappedTargetException, com.sun.star.beans.PropertyVetoException
return null; // com.sun.star.lang.IllegalArgumentException
}
}
- public void printControlProperties(String ControlName) {
- try {
+ public void printControlProperties(String ControlName)
+ {
+ try
+ {
Object xControlModel = xDlgNameAccess.getByName(ControlName);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
- Property [] allProps = xPSet.getPropertySetInfo().getProperties();
- for (int i=0;i < allProps.length;i++) {
+ Property[] allProps = xPSet.getPropertySetInfo().getProperties();
+ for (int i = 0; i < allProps.length; i++)
+ {
System.out.println(allProps[i].Name);
}
- } catch (com.sun.star.uno.Exception exception) { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException,
+ }
+ catch (com.sun.star.uno.Exception exception)
+ { // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException,
exception.printStackTrace(System.out); // com.sun.star.lang.WrappedTargetException, com.sun.star.beans.PropertyVetoException
}
}
-
- public double getMAPConversionFactor(String ControlName) {
- XControl xControl = xDlgContainer.getControl(ControlName);
- XView xView = (XView) UnoRuntime.queryInterface(XView.class, xControl);
+ public double getMAPConversionFactor(String ControlName)
+ {
+ XControl xControl2 = xDlgContainer.getControl(ControlName);
+ XView xView = (XView) UnoRuntime.queryInterface(XView.class, xControl2);
Size aSize = xView.getSize();
- double dblMAPWidth = (double) (((Integer) Helper.getUnoPropertyValue(xControl.getModel(), "Width")).intValue());
+ double dblMAPWidth = (double) (((Integer) Helper.getUnoPropertyValue(xControl2.getModel(), "Width")).intValue());
double dblFactor = (((double) (aSize.Width)) / dblMAPWidth);
return dblFactor;
}
- public Size getpreferredLabelSize(String LabelName, String sLabel) {
- XControl xControl = xDlgContainer.getControl(LabelName);
- XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, xControl);
+ public Size getpreferredLabelSize(String LabelName, String sLabel)
+ {
+ XControl xControl2 = xDlgContainer.getControl(LabelName);
+ XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, xControl2);
String OldText = xFixedText.getText();
xFixedText.setText(sLabel);
- XLayoutConstrains xLayoutConstrains = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, xControl);
+ XLayoutConstrains xLayoutConstrains = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, xControl2);
Size aSize = xLayoutConstrains.getPreferredSize();
xFixedText.setText(OldText);
return aSize;
}
- public void removeSelectedItems(XListBox xListBox) {
+ public void removeSelectedItems(XListBox xListBox)
+ {
short[] SelList = xListBox.getSelectedItemsPos();
int Sellen = SelList.length;
- for (int i = Sellen - 1; i >= 0; i--) {
+ for (int i = Sellen - 1; i >= 0; i--)
+ {
xListBox.removeItems(SelList[i], (short) 1);
}
}
-
- public static int getListBoxItemCount(XListBox _xListBox){
+ public static int getListBoxItemCount(XListBox _xListBox)
+ {
String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), "StringItemList");
return fieldnames.length;
}
- public static short getSelectedItemPos(XListBox _xListBox){
+ public static short getSelectedItemPos(XListBox _xListBox)
+ {
short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), "SelectedItems");
return ipos[0];
}
- public static boolean isListBoxSelected(XListBox _xListBox){
+ public static boolean isListBoxSelected(XListBox _xListBox)
+ {
short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), "SelectedItems");
return ipos.length > 0;
}
-
- public void addSingleItemtoListbox(XListBox xListBox, String ListItem, short iSelIndex) {
+ public void addSingleItemtoListbox(XListBox xListBox, String ListItem, short iSelIndex)
+ {
xListBox.addItem(ListItem, xListBox.getItemCount());
if (iSelIndex != -1)
+ {
xListBox.selectItemPos(iSelIndex, true);
+ }
}
- public XFixedText insertLabel(String sName, String[] sPropNames, Object[] oPropValues) {
- try {
+ public XFixedText insertLabel(String sName, String[] sPropNames, Object[] oPropValues)
+ {
+ try
+ {
Object oFixedText = insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", sName, sPropNames, oPropValues);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFixedText);
xPSet.setPropertyValue("Name", sName);
Object oLabel = xDlgContainer.getControl(new String(sName));
return (XFixedText) UnoRuntime.queryInterface(XFixedText.class, oLabel);
- } catch (java.lang.Exception ex) {
+ }
+ catch (java.lang.Exception ex)
+ {
ex.printStackTrace();
return null;
}
}
/* public XButton insertButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception{
- Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlButtonModel", sName, sProperties, sValues);
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oButtonModel);
- xPSet.setPropertyValue("Name", sName);
- Object objectButton = xDlgContainer.getControl( new String(sName));
- XButton xButton = ( XButton ) UnoRuntime.queryInterface( XButton.class, objectButton );
- xButton.addActionListener(xActionListener);
- Integer ControlKey = new Integer(iControlKey);
- if (ControlList != null)
- ControlList.put(sName, ControlKey);
- return xButton;
- } */
-
- public XButton insertButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception {
+ Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlButtonModel", sName, sProperties, sValues);
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oButtonModel);
+ xPSet.setPropertyValue("Name", sName);
+ Object objectButton = xDlgContainer.getControl( new String(sName));
+ XButton xButton = ( XButton ) UnoRuntime.queryInterface( XButton.class, objectButton );
+ xButton.addActionListener(xActionListener);
+ Integer ControlKey = new Integer(iControlKey);
+ if (ControlList != null)
+ ControlList.put(sName, ControlKey);
+ return xButton;
+ } */
+ public XButton insertButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception
+ {
Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlButtonModel", sName, sProperties, sValues);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oButtonModel);
xPSet.setPropertyValue("Name", sName);
Object objectButton = xDlgContainer.getControl(new String(sName));
XButton xButton = (XButton) UnoRuntime.queryInterface(XButton.class, objectButton);
if (xActionListener != null)
+ {
xButton.addActionListener(xActionListener);
+ }
Integer ControlKey = new Integer(iControlKey);
if (ControlList != null)
+ {
ControlList.put(sName, ControlKey);
+ }
return xButton;
}
- public void insertCheckBox(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception {
+ public void insertCheckBox(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception
+ {
Object oButtonModel = insertControlModel("com.sun.star.awt.UnoControlCheckBoxModel", sName, sProperties, sValues);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oButtonModel);
xPSet.setPropertyValue("Name", sName);
Object objectCheckBox = xDlgContainer.getControl(new String(sName));
XCheckBox xCheckBox = (XCheckBox) UnoRuntime.queryInterface(XCheckBox.class, objectCheckBox);
if (xItemListener != null)
+ {
xCheckBox.addItemListener(xItemListener);
+ }
Integer ControlKey = new Integer(iControlKey);
if (ControlList != null)
+ {
ControlList.put(sName, ControlKey);
+ }
}
- public void insertNumericField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception {
+ public void insertNumericField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception
+ {
Object oNumericFieldModel = insertControlModel("com.sun.star.awt.UnoControlNumericFieldModel", sName, sProperties, sValues);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oNumericFieldModel);
xPSet.setPropertyValue("Name", sName);
Object objectNumericField = xDlgContainer.getControl(new String(sName));
XTextComponent xNumericField = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, objectNumericField);
if (xTextListener != null)
+ {
xNumericField.addTextListener(xTextListener);
+ }
Integer ControlKey = new Integer(iControlKey);
if (ControlList != null)
+ {
ControlList.put(sName, ControlKey);
+ }
}
- public XScrollBar insertScrollBar(String sName, int iControlKey, XAdjustmentListener xAdjustmentListener, String[] sProperties, Object[] sValues) {
- try {
+ public XScrollBar insertScrollBar(String sName, int iControlKey, XAdjustmentListener xAdjustmentListener, String[] sProperties, Object[] sValues)
+ {
+ try
+ {
Object oScrollModel = insertControlModel("com.sun.star.awt.UnoControlScrollBarModel", sName, sProperties, sValues);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oScrollModel);
xPSet.setPropertyValue("Name", sName);
Object oScrollBar = xDlgContainer.getControl(new String(sName));
XScrollBar xScrollBar = (XScrollBar) UnoRuntime.queryInterface(XScrollBar.class, oScrollBar);
if (xAdjustmentListener != null)
+ {
xScrollBar.addAdjustmentListener(xAdjustmentListener);
+ }
Integer ControlKey = new Integer(iControlKey);
if (ControlList != null)
+ {
ControlList.put(sName, ControlKey);
+ }
return xScrollBar;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public XTextComponent insertTextField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) {
+ public XTextComponent insertTextField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)
+ {
XTextComponent xTextBox = insertEditField("com.sun.star.awt.UnoControlEditModel", sName, iControlKey, xTextListener, sProperties, sValues);
return xTextBox;
}
- public XTextComponent insertFormattedField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) {
+ public XTextComponent insertFormattedField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)
+ {
XTextComponent xTextBox = insertEditField("com.sun.star.awt.UnoControlFormattedFieldModel", sName, iControlKey, xTextListener, sProperties, sValues);
return xTextBox;
}
- public XTextComponent insertEditField(String ServiceName, String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues) {
- try {
+ public XTextComponent insertEditField(String ServiceName, String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)
+ {
+ try
+ {
XInterface xTextModel = insertControlModel(ServiceName, sName, sProperties, sValues);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextModel);
xPSet.setPropertyValue("Name", sName);
XControl xTextField = xDlgContainer.getControl(new String(sName));
XTextComponent xTextBox = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xTextField);
if (xTextListener != null)
+ {
xTextBox.addTextListener(xTextListener);
+ }
Integer ControlKey = new Integer(iControlKey);
ControlList.put(sName, ControlKey);
return xTextBox;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public XListBox insertListBox(String sName, int iControlKey, XActionListener xActionListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception {
+ public XListBox insertListBox(String sName, int iControlKey, XActionListener xActionListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception
+ {
XInterface xListBoxModel = insertControlModel("com.sun.star.awt.UnoControlListBoxModel", sName, sProperties, sValues);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xListBoxModel);
xPSet.setPropertyValue("Name", sName);
XControl xControlListBox = xDlgContainer.getControl(new String(sName));
XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, xControlListBox);
if (xItemListener != null)
+ {
xListBox.addItemListener(xItemListener);
+ }
if (xActionListener != null)
+ {
xListBox.addActionListener(xActionListener);
+ }
Integer ControlKey = new Integer(iControlKey);
ControlList.put(sName, ControlKey);
return xListBox;
}
- public XComboBox insertComboBox(String sName, int iControlKey, XActionListener xActionListener, XTextListener xTextListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception {
+ public XComboBox insertComboBox(String sName, int iControlKey, XActionListener xActionListener, XTextListener xTextListener, XItemListener xItemListener, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception
+ {
XInterface xComboBoxModel = insertControlModel("com.sun.star.awt.UnoControlComboBoxModel", sName, sProperties, sValues);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xComboBoxModel);
xPSet.setPropertyValue("Name", sName);
XControl xControlComboBox = xDlgContainer.getControl(new String(sName));
XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, xControlComboBox);
if (xItemListener != null)
+ {
xComboBox.addItemListener(xItemListener);
- if (xTextListener != null) {
+ }
+ if (xTextListener != null)
+ {
XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xComboBox);
xTextComponent.addTextListener(xTextListener);
}
if (xActionListener != null)
+ {
xComboBox.addActionListener(xActionListener);
+ }
Integer ControlKey = new Integer(iControlKey);
ControlList.put(sName, ControlKey);
return xComboBox;
}
- public XRadioButton insertRadioButton(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues) {
- try {
+ public XRadioButton insertRadioButton(String sName, int iControlKey, XItemListener xItemListener, String[] sProperties, Object[] sValues)
+ {
+ try
+ {
XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues);
if (xItemListener != null)
+ {
xRadioButton.addItemListener(xItemListener);
+ }
return xRadioButton;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public XButton insertRadioButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues) {
- try {
+ public XButton insertRadioButton(String sName, int iControlKey, XActionListener xActionListener, String[] sProperties, Object[] sValues)
+ {
+ try
+ {
XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues);
XButton xButton = (com.sun.star.awt.XButton) UnoRuntime.queryInterface(XButton.class, xRadioButton);
if (xActionListener != null)
+ {
xButton.addActionListener(xActionListener);
+ }
return xButton;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public XRadioButton insertRadioButton(String sName, int iControlKey, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception {
+ public XRadioButton insertRadioButton(String sName, int iControlKey, String[] sProperties, Object[] sValues) throws com.sun.star.uno.Exception
+ {
XRadioButton xRadioButton = insertRadioButton(sName, sProperties, sValues);
Integer ControlKey = new Integer(iControlKey);
ControlList.put(sName, ControlKey);
return xRadioButton;
}
- public XRadioButton insertRadioButton(String sName, String[] sProperties, Object[] sValues) {
- try {
+ public XRadioButton insertRadioButton(String sName, String[] sProperties, Object[] sValues)
+ {
+ try
+ {
XInterface oRadioButtonModel = insertControlModel("com.sun.star.awt.UnoControlRadioButtonModel", sName, sProperties, sValues);
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRadioButtonModel);
xPSet.setPropertyValue("Name", sName);
XControl xControlRadioButton = xDlgContainer.getControl(new String(sName));
XRadioButton xRadioButton = (XRadioButton) UnoRuntime.queryInterface(XRadioButton.class, xControlRadioButton);
return xRadioButton;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
@@ -459,11 +556,15 @@ public class UnoDialog implements EventNames {
* @param the name of the control
* @param iStep change the step if you want to make the control invisible
*/
- private void setControlVisible(String controlname, int iStep) {
- try {
+ private void setControlVisible(String controlname, int iStep)
+ {
+ try
+ {
int iCurStep = AnyConverter.toInt(getControlProperty(controlname, "Step"));
setControlProperty(controlname, "Step", new Integer(iStep));
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
@@ -478,16 +579,24 @@ public class UnoDialog implements EventNames {
* @param controlname the name of the control
* @param bIsVisible sets the control visible or invisible
*/
- public void setControlVisible(String controlname, boolean bIsVisible) {
- try {
+ public void setControlVisible(String controlname, boolean bIsVisible)
+ {
+ try
+ {
int iCurControlStep = AnyConverter.toInt(getControlProperty(controlname, "Step"));
int iCurDialogStep = AnyConverter.toInt(Helper.getUnoPropertyValue(this.xDialogModel, "Step"));
int iNewStep;
if (bIsVisible)
+ {
setControlProperty(controlname, "Step", new Integer(iCurDialogStep));
+ }
else
+ {
setControlProperty(controlname, "Step", UIConsts.INVISIBLESTEP);
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
@@ -496,55 +605,78 @@ public class UnoDialog implements EventNames {
* repaints the currentDialogStep
* @author bc93774
*/
- public void repaintDialogStep() {
- try {
+ public void repaintDialogStep()
+ {
+ try
+ {
int ncurstep = AnyConverter.toInt(Helper.getUnoPropertyValue(this.xDialogModel, "Step"));
Helper.setUnoPropertyValue(xDialogModel, "Step", new Integer(99));
Helper.setUnoPropertyValue(xDialogModel, "Step", new Integer(ncurstep));
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
- public XInterface insertControlModel(String ServiceName, String sName, String[] sProperties, Object[] sValues) {
- try {
+ public XInterface insertControlModel(String ServiceName, String sName, String[] sProperties, Object[] sValues)
+ {
+ try
+ {
XInterface xControlModel = (XInterface) MSFDialogModel.createInstance(ServiceName);
Helper.setUnoPropertyValues(xControlModel, sProperties, sValues);
xDlgNames.insertByName(sName, xControlModel);
return xControlModel;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public void setFocus(String ControlName) {
+ public void setFocus(String ControlName)
+ {
Object oFocusControl = xDlgContainer.getControl(ControlName);
XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oFocusControl);
xWindow.setFocus();
}
- public static String[] combineListboxList(String sFirstEntry, String[] MainList) {
- try {
- String[] FirstList = new String[] { sFirstEntry };
+ public static String[] combineListboxList(String sFirstEntry, String[] MainList)
+ {
+ try
+ {
+ String[] FirstList = new String[]
+ {
+ sFirstEntry
+ };
String[] ResultList = new String[MainList.length + 1];
System.arraycopy(FirstList, 0, ResultList, 0, 1);
System.arraycopy(MainList, 0, ResultList, 1, MainList.length);
return ResultList;
- } catch (java.lang.Exception jexception) {
+ }
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
return null;
}
}
- public void selectListBoxItem(XListBox xListBox, short iFieldsSelIndex) {
- if (iFieldsSelIndex > -1) {
+ public void selectListBoxItem(XListBox xListBox, short iFieldsSelIndex)
+ {
+ if (iFieldsSelIndex > -1)
+ {
int FieldCount = xListBox.getItemCount();
- if (FieldCount > 0) {
+ if (FieldCount > 0)
+ {
if (iFieldsSelIndex < FieldCount)
+ {
xListBox.selectItemPos(iFieldsSelIndex, true);
+ }
else
+ {
xListBox.selectItemPos((short) (iFieldsSelIndex - 1), true);
+ }
}
}
}
@@ -553,14 +685,18 @@ public class UnoDialog implements EventNames {
*
* @param _xBasisListBox
*/
- public void deselectListBox(XInterface _xBasisListBox) {
+ public void deselectListBox(XInterface _xBasisListBox)
+ {
Object oListBoxModel = getModel(_xBasisListBox);
Object sList = Helper.getUnoPropertyValue(oListBoxModel, "StringItemList");
- Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", new String[] {});
+ Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", new String[]
+ {
+ });
Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", sList);
}
- public void calculateDialogPosition(Rectangle FramePosSize) {
+ public void calculateDialogPosition(Rectangle FramePosSize)
+ {
// Todo: check if it would be useful or possible to create a dialog peer, that can be used for the messageboxes to
// maintain modality when they pop up.
Rectangle CurPosSize = xWindow.getPosSize();
@@ -579,12 +715,17 @@ public class UnoDialog implements EventNames {
* @return 0 for cancel, 1 for ok
* @throws com.sun.star.uno.Exception
*/
- public short executeDialog(Rectangle FramePosSize) throws com.sun.star.uno.Exception {
+ public short executeDialog(Rectangle FramePosSize) throws com.sun.star.uno.Exception
+ {
if (xControl.getPeer() == null)
+ {
throw new java.lang.IllegalArgumentException("Please create a peer, using your own frame");
+ }
calculateDialogPosition(FramePosSize);
if (xWindowPeer == null)
+ {
createWindowPeer();
+ }
xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer);
// xVclWindowPeer.setProperty("AutoMnemonics", new Boolean(true));
this.BisHighContrastModeActivated = new Boolean(this.isHighContrastModeActivated());
@@ -592,17 +733,18 @@ public class UnoDialog implements EventNames {
return xDialog.execute();
}
-
- public void setVisible(UnoDialog parent) throws com.sun.star.uno.Exception{
+ public void setVisible(UnoDialog parent) throws com.sun.star.uno.Exception
+ {
calculateDialogPosition(parent.xWindow.getPosSize());
if (xWindowPeer == null)
+ {
createWindowPeer();
+ }
XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer);
xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, xUnoDialog);
this.xWindow.setVisible(true);
}
-
/**
*
* @param parent
@@ -610,7 +752,7 @@ public class UnoDialog implements EventNames {
* @throws com.sun.star.uno.Exception
*/
public short executeDialog(UnoDialog parent)
- throws com.sun.star.uno.Exception
+ throws com.sun.star.uno.Exception
{
return executeDialog(parent.xWindow.getPosSize());
}
@@ -621,29 +763,34 @@ public class UnoDialog implements EventNames {
* @return 0 for cancel, 1 for ok.
* @throws com.sun.star.uno.Exception
*/
- public short executeDialog(XInterface xComponent) throws com.sun.star.uno.Exception {
+ public short executeDialog(XInterface xComponent) throws com.sun.star.uno.Exception
+ {
XFrame frame = (XFrame) UnoRuntime.queryInterface(XFrame.class, xComponent);
- if (frame != null) {
+ if (frame != null)
+ {
XWindow w = frame.getComponentWindow();
if (w != null)
+ {
return executeDialog(w.getPosSize());
+ }
}
- return executeDialog(new Rectangle(0,0,640,400));
+ return executeDialog(new Rectangle(0, 0, 640, 400));
}
-
/**
* When possible, use the other executeDialog methods, since
* there may be problems retrieving the actual active frame,
* for example under linux.
* @return 0 for cancel, 1 for ok
*/
- public short executeDialog() throws com.sun.star.uno.Exception {
+ public short executeDialog() throws com.sun.star.uno.Exception
+ {
return executeDialog(Desktop.getActiveFrame(xMSF));
}
- public void setAutoMnemonic(String ControlName, boolean bValue) {
+ public void setAutoMnemonic(String ControlName, boolean bValue)
+ {
Object oControl = xDlgContainer.getControl(ControlName);
xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oControl);
XWindowPeer xWindowPeer = xControl.getPeer();
@@ -651,7 +798,8 @@ public class UnoDialog implements EventNames {
xVclWindowPeer.setProperty("AutoMnemonics", new Boolean(bValue));
}
- public void modifyFontWeight(String ControlName, float FontWeight) {
+ public void modifyFontWeight(String ControlName, float FontWeight)
+ {
FontDescriptor oFontDesc = new FontDescriptor();
oFontDesc.Weight = FontWeight;
setControlProperty(ControlName, "FontDescriptor", oFontDesc);
@@ -665,11 +813,14 @@ public class UnoDialog implements EventNames {
* @return
* @throws java.lang.Exception
*/
- public XWindowPeer createWindowPeer(XWindowPeer parentPeer) throws com.sun.star.uno.Exception {
+ public XWindowPeer createWindowPeer(XWindowPeer parentPeer) throws com.sun.star.uno.Exception
+ {
xWindow.setVisible(false);
Object tk = xMSF.createInstance("com.sun.star.awt.Toolkit");
if (parentPeer == null)
+ {
parentPeer = ((XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk)).getDesktopWindow();
+ }
XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk);
xReschedule = (XReschedule) UnoRuntime.queryInterface(XReschedule.class, xToolkit);
xControl.createPeer(xToolkit, parentPeer);
@@ -684,27 +835,32 @@ public class UnoDialog implements EventNames {
* @return
* @throws java.lang.Exception
*/
- public XWindowPeer createWindowPeer() throws com.sun.star.uno.Exception {
+ public XWindowPeer createWindowPeer() throws com.sun.star.uno.Exception
+ {
return createWindowPeer(null);
}
// deletes the first entry when this is equal to "DelEntryName"
// returns true when a new item is selected
- public void deletefirstListboxEntry(String ListBoxName, String DelEntryName) {
+ public void deletefirstListboxEntry(String ListBoxName, String DelEntryName)
+ {
XControl xListControl = xDlgContainer.getControl(ListBoxName);
XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, xListControl);
String FirstItem = xListBox.getItem((short) 0);
- if (FirstItem.equals(DelEntryName)) {
+ if (FirstItem.equals(DelEntryName))
+ {
short SelPos = xListBox.getSelectedItemPos();
xListBox.removeItems((short) 0, (short) 1);
- if (SelPos > 0) {
+ if (SelPos > 0)
+ {
setControlProperty(ListBoxName, "SelectedItems", new short[SelPos]);
xListBox.selectItemPos((short) (SelPos - 1), true);
}
}
}
- public void setPeerProperty(String ControlName, String PropertyName, Object PropertyValue) {
+ public void setPeerProperty(String ControlName, String PropertyName, Object PropertyValue)
+ {
Object oControl = xDlgContainer.getControl(ControlName);
XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oControl);
XWindowPeer xControlPeer = xControl.getPeer();
@@ -712,15 +868,18 @@ public class UnoDialog implements EventNames {
xVclWindowPeer.setProperty(PropertyName, PropertyValue);
}
- public static Object getModel(Object control) {
+ public static Object getModel(Object control)
+ {
return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel();
}
- public static void setEnabled(Object control, boolean enabled) {
+ public static void setEnabled(Object control, boolean enabled)
+ {
setEnabled(control, enabled ? Boolean.TRUE : Boolean.FALSE);
}
- public static void setEnabled(Object control, Boolean enabled) {
+ public static void setEnabled(Object control, Boolean enabled)
+ {
Helper.setUnoPropertyValue(getModel(control), "Enabled", enabled);
}
@@ -729,46 +888,85 @@ public class UnoDialog implements EventNames {
* @param oControlModel the model of a control
* @return the LabelType according to UIConsts.CONTROLTYPE
*/
- public static int getControlModelType(Object oControlModel) {
+ public static int getControlModelType(Object oControlModel)
+ {
XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oControlModel);
if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlFixedTextModel"))
+ {
return UIConsts.CONTROLTYPE.FIXEDTEXT;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlButtonModel"))
+ {
return UIConsts.CONTROLTYPE.BUTTON;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlCurrencyFieldModel"))
+ {
return UIConsts.CONTROLTYPE.CURRENCYFIELD;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlDateFieldModel"))
+ {
return UIConsts.CONTROLTYPE.DATEFIELD;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlFixedLineModel"))
+ {
return UIConsts.CONTROLTYPE.FIXEDLINE;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlFormattedFieldModel"))
+ {
return UIConsts.CONTROLTYPE.FORMATTEDFIELD;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlRoadmapModel"))
+ {
return UIConsts.CONTROLTYPE.ROADMAP;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlNumericFieldModel"))
+ {
return UIConsts.CONTROLTYPE.NUMERICFIELD;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlPatternFieldModel"))
+ {
return UIConsts.CONTROLTYPE.PATTERNFIELD;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlHyperTextModel"))
+ {
return UIConsts.CONTROLTYPE.HYPERTEXT;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlProgressBarModel"))
+ {
return UIConsts.CONTROLTYPE.PROGRESSBAR;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlTimeFieldModel"))
+ {
return UIConsts.CONTROLTYPE.TIMEFIELD;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlImageControlModel"))
+ {
return UIConsts.CONTROLTYPE.IMAGECONTROL;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlRadioButtonModel"))
+ {
return UIConsts.CONTROLTYPE.RADIOBUTTON;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlCheckBoxModel"))
+ {
return UIConsts.CONTROLTYPE.CHECKBOX;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlEditModel"))
+ {
return UIConsts.CONTROLTYPE.EDITCONTROL;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlComboBoxModel"))
+ {
return UIConsts.CONTROLTYPE.COMBOBOX;
+ }
else if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlListBoxModel")) // TODO Comboboxes??
+ {
return UIConsts.CONTROLTYPE.LISTBOX;
+ }
else
+ {
return UIConsts.CONTROLTYPE.UNKNOWN;
+ }
}
/**
@@ -776,7 +974,8 @@ public class UnoDialog implements EventNames {
* @param oControlModel
* @return the name of the property that contains the value of a controlmodel
*/
- public static String getDisplayProperty(Object oControlModel) {
+ public static String getDisplayProperty(Object oControlModel)
+ {
XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oControlModel);
int itype = getControlModelType(oControlModel);
return getDisplayProperty(itype);
@@ -787,66 +986,74 @@ public class UnoDialog implements EventNames {
* @param itype The type of the control conforming to UIConst.ControlType
* @return the name of the property that contains the value of a controlmodel
*/
- public static String getDisplayProperty(int itype) {
- String propertyname = "";
- switch (itype) {
- case UIConsts.CONTROLTYPE.FIXEDTEXT :
- return "Label";
- case UIConsts.CONTROLTYPE.BUTTON :
- return "Label";
- case UIConsts.CONTROLTYPE.FIXEDLINE :
- return "Label";
- case UIConsts.CONTROLTYPE.NUMERICFIELD :
- return "Value";
- case UIConsts.CONTROLTYPE.CURRENCYFIELD :
- return "Value";
- case UIConsts.CONTROLTYPE.FORMATTEDFIELD :
- return "EffectiveValue";
- case UIConsts.CONTROLTYPE.DATEFIELD :
- return "Date";
- case UIConsts.CONTROLTYPE.TIMEFIELD :
- return "Time";
- case UIConsts.CONTROLTYPE.SCROLLBAR :
- return "ScrollValue";
- case UIConsts.CONTROLTYPE.PROGRESSBAR :
- return "ProgressValue";
- case UIConsts.CONTROLTYPE.IMAGECONTROL :
- return "ImageURL";
- case UIConsts.CONTROLTYPE.RADIOBUTTON :
- return "State";
- case UIConsts.CONTROLTYPE.CHECKBOX :
- return "State";
- case UIConsts.CONTROLTYPE.EDITCONTROL :
- return "Text";
- case UIConsts.CONTROLTYPE.COMBOBOX :
- return "Text";
- case UIConsts.CONTROLTYPE.PATTERNFIELD :
- return "Text";
- case UIConsts.CONTROLTYPE.LISTBOX :
- return "SelectedItems";
- default :
+ public static String getDisplayProperty(int itype)
+ {
+ // String propertyname = "";
+ switch (itype)
+ {
+ case UIConsts.CONTROLTYPE.FIXEDTEXT:
+ return "Label";
+ case UIConsts.CONTROLTYPE.BUTTON:
+ return "Label";
+ case UIConsts.CONTROLTYPE.FIXEDLINE:
+ return "Label";
+ case UIConsts.CONTROLTYPE.NUMERICFIELD:
+ return "Value";
+ case UIConsts.CONTROLTYPE.CURRENCYFIELD:
+ return "Value";
+ case UIConsts.CONTROLTYPE.FORMATTEDFIELD:
+ return "EffectiveValue";
+ case UIConsts.CONTROLTYPE.DATEFIELD:
+ return "Date";
+ case UIConsts.CONTROLTYPE.TIMEFIELD:
+ return "Time";
+ case UIConsts.CONTROLTYPE.SCROLLBAR:
+ return "ScrollValue";
+ case UIConsts.CONTROLTYPE.PROGRESSBAR:
+ return "ProgressValue";
+ case UIConsts.CONTROLTYPE.IMAGECONTROL:
+ return "ImageURL";
+ case UIConsts.CONTROLTYPE.RADIOBUTTON:
+ return "State";
+ case UIConsts.CONTROLTYPE.CHECKBOX:
+ return "State";
+ case UIConsts.CONTROLTYPE.EDITCONTROL:
+ return "Text";
+ case UIConsts.CONTROLTYPE.COMBOBOX:
+ return "Text";
+ case UIConsts.CONTROLTYPE.PATTERNFIELD:
+ return "Text";
+ case UIConsts.CONTROLTYPE.LISTBOX:
+ return "SelectedItems";
+ default:
return "";
}
}
- public void addResourceHandler(String _Unit, String _Module) {
+ public void addResourceHandler(String _Unit, String _Module)
+ {
m_oResource = new Resource(xMSF, _Unit, _Module);
}
- public static short setInitialTabindex(int _istep) {
+ public static short setInitialTabindex(int _istep)
+ {
return (short) (_istep * 100);
}
-
-
private Boolean BisHighContrastModeActivated = null;
- public boolean isHighContrastModeActivated(){
- if (xVclWindowPeer != null){
- if (BisHighContrastModeActivated == null){
+ public boolean isHighContrastModeActivated()
+ {
+ if (xVclWindowPeer != null)
+ {
+ if (BisHighContrastModeActivated == null)
+ {
int nUIColor;
- try {
+ try
+ {
nUIColor = AnyConverter.toInt(this.xVclWindowPeer.getProperty("DisplayBackgroundColor"));
- } catch (IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
e.printStackTrace(System.out);
return false;
}
@@ -854,20 +1061,25 @@ public class UnoDialog implements EventNames {
int nRed = getRedColorShare(nUIColor);
int nGreen = getGreenColorShare(nUIColor);
int nBlue = getBlueColorShare(nUIColor);
- int nLuminance = (( nBlue*28 + nGreen*151 + nRed*77 ) / 256 );
+ int nLuminance = ((nBlue * 28 + nGreen * 151 + nRed * 77) / 256);
boolean bisactivated = (nLuminance <= 25);
BisHighContrastModeActivated = new Boolean(bisactivated);
return bisactivated;
}
else
+ {
return BisHighContrastModeActivated.booleanValue();
+ }
}
else
+ {
return false;
+ }
}
- public static int getRedColorShare(int _nColor){
- int nRed = (int) _nColor/65536;
+ public static int getRedColorShare(int _nColor)
+ {
+ int nRed = (int) _nColor / 65536;
int nRedModulo = _nColor % 65536;
int nGreen = (int) (nRedModulo / 256);
int nGreenModulo = (nRedModulo % 256);
@@ -875,15 +1087,17 @@ public class UnoDialog implements EventNames {
return nRed;
}
- public static int getGreenColorShare(int _nColor){
- int nRed = (int) _nColor/65536;
+ public static int getGreenColorShare(int _nColor)
+ {
+ int nRed = (int) _nColor / 65536;
int nRedModulo = _nColor % 65536;
int nGreen = (int) (nRedModulo / 256);
return nGreen;
}
- public static int getBlueColorShare(int _nColor){
- int nRed = (int) _nColor/65536;
+ public static int getBlueColorShare(int _nColor)
+ {
+ int nRed = (int) _nColor / 65536;
int nRedModulo = _nColor % 65536;
int nGreen = (int) (nRedModulo / 256);
int nGreenModulo = (nRedModulo % 256);
@@ -891,22 +1105,27 @@ public class UnoDialog implements EventNames {
return nBlue;
}
-
- public String getWizardImageUrl(int _nResId, int _nHCResId){
+ public String getWizardImageUrl(int _nResId, int _nHCResId)
+ {
if (isHighContrastModeActivated())
+ {
return "private:resource/wzi/image/" + _nHCResId;
+ }
else
+ {
return "private:resource/wzi/image/" + _nResId;
+ }
}
-
public String getImageUrl(String _surl, String _shcurl)
{
if (isHighContrastModeActivated())
+ {
return _shcurl;
+ }
else
+ {
return _surl;
+ }
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
index 6bbddca51e50..d8194c085626 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
@@ -26,8 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui;
-
+ ************************************************************************/
+package com.sun.star.wizards.ui;
import com.sun.star.awt.*;
import com.sun.star.lang.XMultiServiceFactory;
@@ -46,263 +46,324 @@ import com.sun.star.wizards.ui.event.*;
* wenn an event on a component is trigered.
* see the classes AbstractListener, CommonListener, MethodInvocation for details.
*/
-public class UnoDialog2 extends UnoDialog implements EventNames {
+public class UnoDialog2 extends UnoDialog implements EventNames
+{
/**
* Override this method to return another listener.
*/
- protected AbstractListener createListener() {
+ protected AbstractListener createListener()
+ {
return new CommonListener();
}
- public UnoDialog2(XMultiServiceFactory xmsf) {
- super(xmsf, new String[] {
- }, new Object[] {
- });
+ public UnoDialog2(XMultiServiceFactory xmsf)
+ {
+ super(xmsf, new String[]
+ {
+ }, new Object[]
+ {
+ });
guiEventListener = createListener();
}
- public XButton insertButton(String sName, String actionPerformed, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XButton insertButton(String sName, String actionPerformed, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
XButton xButton = (XButton) insertControlModel2("com.sun.star.awt.UnoControlButtonModel", sName, sPropNames, oPropValues, XButton.class);
- if (actionPerformed != null) {
+ if (actionPerformed != null)
+ {
xButton.addActionListener((XActionListener) guiEventListener);
guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget);
}
return xButton;
}
- public XButton insertButton(String sName, String actionPerformed, String[] sPropNames, Object[] oPropValues) {
+ public XButton insertButton(String sName, String actionPerformed, String[] sPropNames, Object[] oPropValues)
+ {
return insertButton(sName, actionPerformed, this, sPropNames, oPropValues);
}
- public XCheckBox insertCheckBox(String sName, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XCheckBox insertCheckBox(String sName, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
XCheckBox xCheckBox = (XCheckBox) insertControlModel2("com.sun.star.awt.UnoControlCheckBoxModel", sName, sPropNames, oPropValues, XCheckBox.class);
- if (itemChanged != null) {
+ if (itemChanged != null)
+ {
xCheckBox.addItemListener((XItemListener) guiEventListener);
guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget);
}
return xCheckBox;
}
- public XCheckBox insertCheckBox(String sName, String itemChanged, String[] sPropNames, Object[] oPropValues) {
- return insertCheckBox(sName, itemChanged, this, sPropNames, oPropValues);
+ public XCheckBox insertCheckBox(String sName, String itemChanged, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertCheckBox(sName, itemChanged, this, sPropNames, oPropValues);
}
- public XComboBox insertComboBox(String sName, String actionPerformed, String itemChanged, String textChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XComboBox insertComboBox(String sName, String actionPerformed, String itemChanged, String textChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
XComboBox xComboBox = (XComboBox) insertControlModel2("com.sun.star.awt.UnoControlComboBoxModel", sName, sPropNames, oPropValues, XComboBox.class);
- if (actionPerformed != null) {
+ if (actionPerformed != null)
+ {
xComboBox.addActionListener((XActionListener) guiEventListener);
guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget);
}
- if (itemChanged != null) {
+ if (itemChanged != null)
+ {
xComboBox.addItemListener((XItemListener) guiEventListener);
guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget);
}
- if (textChanged != null) {
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class,xComboBox);
- xTextComponent.addTextListener((XTextListener)guiEventListener);
- guiEventListener.add(sName,EVENT_TEXT_CHANGED, textChanged, eventTarget);
+ if (textChanged != null)
+ {
+ XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xComboBox);
+ xTextComponent.addTextListener((XTextListener) guiEventListener);
+ guiEventListener.add(sName, EVENT_TEXT_CHANGED, textChanged, eventTarget);
}
return xComboBox;
}
-
- public XComboBox insertComboBox(String sName, String actionPerformed, String itemChanged, String textChanged, String[] sPropNames, Object[] oPropValues) {
+ public XComboBox insertComboBox(String sName, String actionPerformed, String itemChanged, String textChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertComboBox(sName, actionPerformed, textChanged, itemChanged, this, sPropNames, oPropValues);
}
- public XListBox insertListBox(String sName, String actionPerformed, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XListBox insertListBox(String sName, String actionPerformed, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
XListBox xListBox = (XListBox) insertControlModel2("com.sun.star.awt.UnoControlListBoxModel", sName, sPropNames, oPropValues, XListBox.class);
- if (actionPerformed != null) {
+ if (actionPerformed != null)
+ {
xListBox.addActionListener((XActionListener) guiEventListener);
guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget);
}
- if (itemChanged != null) {
+ if (itemChanged != null)
+ {
xListBox.addItemListener((XItemListener) guiEventListener);
guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget);
}
return xListBox;
}
- public XListBox insertListBox(String sName, String actionPerformed, String itemChanged, String[] sPropNames, Object[] oPropValues) {
+ public XListBox insertListBox(String sName, String actionPerformed, String itemChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertListBox(sName, actionPerformed, itemChanged, this, sPropNames, oPropValues);
}
- public XRadioButton insertRadioButton(String sName, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XRadioButton insertRadioButton(String sName, String itemChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
XRadioButton xRadioButton = (XRadioButton) insertControlModel2("com.sun.star.awt.UnoControlRadioButtonModel", sName, sPropNames, oPropValues, XRadioButton.class);
- if (itemChanged != null) {
+ if (itemChanged != null)
+ {
xRadioButton.addItemListener((XItemListener) guiEventListener);
guiEventListener.add(sName, EVENT_ITEM_CHANGED, itemChanged, eventTarget);
}
return xRadioButton;
}
- public XRadioButton insertRadioButton(String sName, String itemChanged, String[] sPropNames, Object[] oPropValues) {
+ public XRadioButton insertRadioButton(String sName, String itemChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertRadioButton(sName, itemChanged, this, sPropNames, oPropValues);
}
- public XControl insertTitledBox(String sName, String[] sPropNames, Object[] oPropValues) {
+ public XControl insertTitledBox(String sName, String[] sPropNames, Object[] oPropValues)
+ {
Object oTitledBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues);
return (XControl) UnoRuntime.queryInterface(XControl.class, oTitledBox);
}
- public XTextComponent insertTextField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XTextComponent insertTextField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
return (XTextComponent) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlEditModel", sPropNames, oPropValues, XTextComponent.class);
}
- public XTextComponent insertTextField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) {
+ public XTextComponent insertTextField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertTextField(sName, sTextChanged, this, sPropNames, oPropValues);
}
- public XControl insertImage(String sName, String[] sPropNames, Object[] oPropValues) {
+ public XControl insertImage(String sName, String[] sPropNames, Object[] oPropValues)
+ {
return (XControl) insertControlModel2("com.sun.star.awt.UnoControlImageControlModel", sName, sPropNames, oPropValues, XControl.class);
}
- public XControl insertInfoImage(int _posx, int _posy, int _iStep){
- XControl xImgControl = insertImage(Desktop.getUniqueName(xDlgNameAccess, "imgHint"),
- new String[] {"Border", "Height", "ImageURL", "PositionX", "PositionY", "ScaleImage", "Step","Width"},
- new Object[] { new Short((short)0), new Integer(10), UIConsts.INFOIMAGEURL, new Integer(_posx), new Integer(_posy), Boolean.FALSE, new Integer(_iStep), new Integer(10)});
+ public XControl insertInfoImage(int _posx, int _posy, int _iStep)
+ {
+ XControl xImgControl = insertImage(Desktop.getUniqueName(xDlgNameAccess, "imgHint"),
+ new String[]
+ {
+ "Border", "Height", "ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Short((short) 0), new Integer(10), UIConsts.INFOIMAGEURL, new Integer(_posx), new Integer(_posy), Boolean.FALSE, new Integer(_iStep), new Integer(10)
+ });
super.getPeerConfiguration().setImageUrl(super.getModel(xImgControl), UIConsts.INFOIMAGEURL, UIConsts.INFOIMAGEURL_HC);
return xImgControl;
}
-
/**
* This method is used for creating Edit, Currency, Date, Formatted, Pattern, File
* and Time edit components.
*/
- private Object insertEditField(String sName, String sTextChanged, Object eventTarget, String sModelClass, String[] sPropNames, Object[] oPropValues, Class type) {
+ private Object insertEditField(String sName, String sTextChanged, Object eventTarget, String sModelClass, String[] sPropNames, Object[] oPropValues, Class type)
+ {
XTextComponent xField = (XTextComponent) insertControlModel2(sModelClass, sName, sPropNames, oPropValues, XTextComponent.class);
- if (sTextChanged != null) {
+ if (sTextChanged != null)
+ {
xField.addTextListener((XTextListener) guiEventListener);
guiEventListener.add(sName, EVENT_TEXT_CHANGED, sTextChanged, eventTarget);
}
return UnoRuntime.queryInterface(type, xField);
}
- public XControl insertFileControl(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XControl insertFileControl(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
return (XControl) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlFileControlModel", sPropNames, oPropValues, XControl.class);
}
- public XControl insertFileControl(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) {
+ public XControl insertFileControl(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertFileControl(sName, sTextChanged, this, sPropNames, oPropValues);
}
- public XCurrencyField insertCurrencyField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XCurrencyField insertCurrencyField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
return (XCurrencyField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlCurrencyFieldModel", sPropNames, oPropValues, XCurrencyField.class);
}
- public XCurrencyField insertCurrencyField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) {
+ public XCurrencyField insertCurrencyField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertCurrencyField(sName, sTextChanged, this, sPropNames, oPropValues);
}
- public XDateField insertDateField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XDateField insertDateField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
return (XDateField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlDateFieldModel", sPropNames, oPropValues, XDateField.class);
}
- public XDateField insertDateField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) {
+ public XDateField insertDateField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertDateField(sName, sTextChanged, this, sPropNames, oPropValues);
}
- public XNumericField insertNumericField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XNumericField insertNumericField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
return (XNumericField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlNumericFieldModel", sPropNames, oPropValues, XNumericField.class);
}
- public XNumericField insertNumericField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) {
+ public XNumericField insertNumericField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertNumericField(sName, sTextChanged, this, sPropNames, oPropValues);
}
- public XTimeField insertTimeField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XTimeField insertTimeField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
return (XTimeField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlTimeFieldModel", sPropNames, oPropValues, XTimeField.class);
}
- public XTimeField insertTimeField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) {
+ public XTimeField insertTimeField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertTimeField(sName, sTextChanged, this, sPropNames, oPropValues);
}
- public XPatternField insertPatternField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XPatternField insertPatternField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
return (XPatternField) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlPatternFieldModel", sPropNames, oPropValues, XPatternField.class);
}
- public XPatternField insertPatternField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) {
+ public XPatternField insertPatternField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertPatternField(sName, sTextChanged, this, sPropNames, oPropValues);
}
- public XTextComponent insertFormattedField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues) {
+ public XTextComponent insertFormattedField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
return (XTextComponent) insertEditField(sName, sTextChanged, eventTarget, "com.sun.star.awt.UnoControlFormattedFieldModel", sPropNames, oPropValues, XTextComponent.class);
}
- public XTextComponent insertFormattedField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues) {
+ public XTextComponent insertFormattedField(String sName, String sTextChanged, String[] sPropNames, Object[] oPropValues)
+ {
return insertFormattedField(sName, sTextChanged, this, sPropNames, oPropValues);
}
- public XControl insertFixedLine(String sName, String[] sPropNames, Object[] oPropValues) {
+ public XControl insertFixedLine(String sName, String[] sPropNames, Object[] oPropValues)
+ {
Object oLine = insertControlModel2("com.sun.star.awt.UnoControlFixedLineModel", sName, sPropNames, oPropValues);
return (XControl) UnoRuntime.queryInterface(XControl.class, oLine);
}
- public XScrollBar insertScrollBar(String sName, String[] sPropNames, Object[] oPropValues) {
+ public XScrollBar insertScrollBar(String sName, String[] sPropNames, Object[] oPropValues)
+ {
Object oScrollBar = insertControlModel2("com.sun.star.awt.UnoControlScrollBarModel", sName, sPropNames, oPropValues);
return (XScrollBar) UnoRuntime.queryInterface(XScrollBar.class, oScrollBar);
}
- public XProgressBar insertProgressBar(String sName, String[] sPropNames, Object[] oPropValues) {
+ public XProgressBar insertProgressBar(String sName, String[] sPropNames, Object[] oPropValues)
+ {
Object oProgressBar = insertControlModel2("com.sun.star.awt.UnoControlProgressBarModel", sName, sPropNames, oPropValues);
return (XProgressBar) UnoRuntime.queryInterface(XProgressBar.class, oProgressBar);
}
- public XControl insertGroupBox(String sName, String[] sPropNames, Object[] oPropValues) {
+ public XControl insertGroupBox(String sName, String[] sPropNames, Object[] oPropValues)
+ {
Object oGroupBox = insertControlModel2("com.sun.star.awt.UnoControlGroupBoxModel", sName, sPropNames, oPropValues);
return (XControl) UnoRuntime.queryInterface(XControl.class, oGroupBox);
}
-
-
-
- public Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues) {
- try {
+ public Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues)
+ {
+ try
+ {
//System.out.println("Inserting : " + componentName);
- XInterface xControlModel = insertControlModel(serviceName, componentName, new String[] {
- }, new Object[] {
- });
+ XInterface xControlModel = insertControlModel(serviceName, componentName, new String[]
+ {
+ }, new Object[]
+ {
+ });
Helper.setUnoPropertyValues(xControlModel, sPropNames, oPropValues);
//setControlPropertiesDebug(xControlModel, sPropNames, oPropValues);
//System.out.println(" Setting props successfull !");
Helper.setUnoPropertyValue(xControlModel, "Name", componentName);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
return xDlgContainer.getControl(componentName);
}
- private void setControlPropertiesDebug(Object model, String[] names, Object[] values) {
- for (int i = 0; i<names.length; i++) {
+ private void setControlPropertiesDebug(Object model, String[] names, Object[] values)
+ {
+ for (int i = 0; i < names.length; i++)
+ {
System.out.println(" Settings: " + names[i]);
- Helper.setUnoPropertyValue(model,names[i],values[i]);
+ Helper.setUnoPropertyValue(model, names[i], values[i]);
}
}
- public Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues, Class type) {
+ public Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues, Class type)
+ {
return UnoRuntime.queryInterface(type, insertControlModel2(serviceName, componentName, sPropNames, oPropValues));
}
- public String translateURL(String relativeURL) {
+ public String translateURL(String relativeURL)
+ {
return "";
}
- public static Object getControlModel(Object unoControl) {
+ public static Object getControlModel(Object unoControl)
+ {
Object obj = ((XControl) UnoRuntime.queryInterface(XControl.class, unoControl)).getModel();
return obj;
}
- public int showMessageBox(String windowServiceName, int windowAttribute, String MessageText) {
+ public int showMessageBox(String windowServiceName, int windowAttribute, String MessageText)
+ {
return SystemDialog.showMessageBox(xMSF, this.xControl.getPeer(), windowServiceName, windowAttribute, MessageText);
}
}
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java
index 938dcb727a55..4fe94c5e3456 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.java
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java
@@ -51,7 +51,9 @@ import com.sun.star.frame.TerminationVetoException;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.beans.*;
-public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeListener, XTerminateListener, XCompletion{
+public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeListener, XTerminateListener, XCompletion
+{
+
private static final String NEXT_ACTION_PERFORMED = "gotoNextAvailableStep";
private static final String BACK_ACTION_PERFORMED = "gotoPreviousAvailableStep";
private static final String FINISH_ACTION_PERFORMED = "finishWizard_1";
@@ -75,7 +77,6 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
private int hid;
private boolean bTerminateListenermustberemoved = true;
-
/** Creates a new instance of WizardDialog
* the hid is used as following :
* "HID:(hid)" - the dialog
@@ -85,115 +86,155 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
* "HID:(hid+4)" - the create button
* "HID:(hid+5)" - the cancel button
*/
- public WizardDialog(XMultiServiceFactory xMSF, int hid_) {
+ public WizardDialog(XMultiServiceFactory xMSF, int hid_)
+ {
super(xMSF);
hid = hid_;
oWizardResource = new Resource(xMSF, "Common", "dbw");
sMsgEndAutopilot = oWizardResource.getResText(UIConsts.RID_DB_COMMON + 33);
- //new Resource(xMSF,"Common","com");
+ //new Resource(xMSF,"Common","com");
}
-
- public Resource getResource(){
+ public Resource getResource()
+ {
return oWizardResource;
}
-
- public void activate() {
- try {
- XTopWindow top = (XTopWindow)UnoRuntime.queryInterface(XTopWindow.class, xWindow );
+ public void activate()
+ {
+ try
+ {
+ XTopWindow top = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class, xWindow);
if (top != null)
- top.toFront();
+ {
+ top.toFront();
+ }
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
// do nothing;
}
}
- public void setMaxStep(int i) {
+ public void setMaxStep(int i)
+ {
nMaxStep = i;
}
- public int getMaxStep() {
+ public int getMaxStep()
+ {
return nMaxStep;
}
- public void setOldStep(int i) {
+ public void setOldStep(int i)
+ {
nOldStep = i;
}
- public int getOldStep() {
+ public int getOldStep()
+ {
return nOldStep;
}
- public void setNewStep(int i) {
+ public void setNewStep(int i)
+ {
nNewStep = i;
}
- public int getNewStep() {
+ public int getNewStep()
+ {
return nNewStep;
}
/**
* @see java.beans.VetoableChangeListener#vetoableChange(java.beans.PropertyChangeEvent)
*/
- public void vetoableChange(java.beans.PropertyChangeEvent arg0) {
+ public void vetoableChange(java.beans.PropertyChangeEvent arg0)
+ {
nNewStep = nOldStep;
}
- public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent) {
- try {
+ public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent)
+ {
+ try
+ {
nNewStep = itemEvent.ItemId;
nOldStep = AnyConverter.toInt(Helper.getUnoPropertyValue(xDialogModel, "Step"));
if (nNewStep != nOldStep)
+ {
switchToStep();
- } catch (com.sun.star.lang.IllegalArgumentException exception) {
+ }
+ }
+ catch (com.sun.star.lang.IllegalArgumentException exception)
+ {
exception.printStackTrace(System.out);
}
}
- public void setRoadmapInteractive(boolean _bInteractive) {
+ public void setRoadmapInteractive(boolean _bInteractive)
+ {
Helper.setUnoPropertyValue(oRoadmap, "Activated", new Boolean(_bInteractive));
}
- public void setRoadmapComplete(boolean bComplete) {
+ public void setRoadmapComplete(boolean bComplete)
+ {
Helper.setUnoPropertyValue(oRoadmap, "Complete", new Boolean(bComplete));
}
- public boolean isRoadmapComplete() {
- try {
+ public boolean isRoadmapComplete()
+ {
+ try
+ {
return AnyConverter.toBoolean(Helper.getUnoPropertyValue(oRoadmap, "Complete"));
- } catch (IllegalArgumentException exception) {
+ }
+ catch (IllegalArgumentException exception)
+ {
exception.printStackTrace(System.out);
return false;
}
}
- public void setCurrentRoadmapItemID(short ID) {
- if (oRoadmap != null) {
+ public void setCurrentRoadmapItemID(short ID)
+ {
+ if (oRoadmap != null)
+ {
int nCurItemID = getCurrentRoadmapItemID();
if (nCurItemID != ID)
+ {
Helper.setUnoPropertyValue(oRoadmap, "CurrentItemID", new Short(ID));
+ }
}
}
- public int getCurrentRoadmapItemID() {
- try {
+ public int getCurrentRoadmapItemID()
+ {
+ try
+ {
return AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmap, "CurrentItemID"));
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return -1;
}
}
- public void addRoadmap() {
- try {
+ public void addRoadmap()
+ {
+ try
+ {
int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, "Height")).intValue();
oRoadmap = insertControlModel("com.sun.star.awt.UnoControlRoadmapModel", "rdmNavi",
- new String[] { "Height", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { new Integer(iDialogHeight-26), new Integer(0), new Integer(0), new Integer(0), new Short((short) 0), new Integer(85)});
+ new String[]
+ {
+ "Height", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(iDialogHeight - 26), new Integer(0), new Integer(0), new Integer(0), new Short((short) 0), new Integer(85)
+ });
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap);
xPSet.setPropertyValue("Name", "rdmNavi");
@@ -211,35 +252,43 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
// xRoadmapControl = this.xDlgContainer.getControl("rdmNavi");
// xRoadmapBroadcaster.addItemListener(new RoadmapItemListener());
Helper.setUnoPropertyValue(oRoadmap, "Text", oWizardResource.getResText(UIConsts.RID_COMMON + 16));
- } catch (NoSuchMethodException ex) {
+ }
+ catch (NoSuchMethodException ex)
+ {
Resource.showCommonResourceError(xMSF);
- } catch (java.lang.Exception jexception) {
+ }
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
}
}
- public void setRMItemLabels(Resource _oResource, int StartResID) {
+ public void setRMItemLabels(Resource _oResource, int StartResID)
+ {
sRMItemLabels = _oResource.getResArray(StartResID, nMaxStep);
}
- public String[] getRMItemLabels() {
+ public String[] getRMItemLabels()
+ {
return sRMItemLabels;
}
/* public void insertRoadmapItems(int StartIndex, int RMCount)
- {
- Object oRoadmapItem;
- boolean bEnabled;
- for (int i = StartIndex; i < (StartIndex + RMCount); i++)
- insertSingleRoadmapItem(i, true, sRMItemLabels[i], i);
- }*/
-
- public int insertRoadmapItem(int _Index, boolean _bEnabled, int _LabelID, int _CurItemID) {
+ {
+ Object oRoadmapItem;
+ boolean bEnabled;
+ for (int i = StartIndex; i < (StartIndex + RMCount); i++)
+ insertSingleRoadmapItem(i, true, sRMItemLabels[i], i);
+ }*/
+ public int insertRoadmapItem(int _Index, boolean _bEnabled, int _LabelID, int _CurItemID)
+ {
return insertRoadmapItem(_Index, _bEnabled, sRMItemLabels[_LabelID], _CurItemID);
}
- public int insertRoadmapItem(int Index, boolean _bEnabled, String _sLabel, int _CurItemID) {
- try {
+ public int insertRoadmapItem(int Index, boolean _bEnabled, String _sLabel, int _CurItemID)
+ {
+ try
+ {
Object oRoadmapItem = xSSFRoadmap.createInstance();
Helper.setUnoPropertyValue(oRoadmapItem, "Label", _sLabel);
Helper.setUnoPropertyValue(oRoadmapItem, "Enabled", new Boolean(_bEnabled));
@@ -247,46 +296,62 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
xIndexContRoadmap.insertByIndex(Index, oRoadmapItem);
int NextIndex = Index + 1;
return NextIndex;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return -1;
}
}
- public int getRMItemCount() {
+ public int getRMItemCount()
+ {
return xIndexContRoadmap.getCount();
}
- public XInterface getRoadmapItemByID(int _ID) {
- try {
+ public XInterface getRoadmapItemByID(int _ID)
+ {
+ try
+ {
int CurID;
XInterface CurRoadmapItem;
- for (int i = 0; i < xIndexContRoadmap.getCount(); i++) {
+ for (int i = 0; i < xIndexContRoadmap.getCount(); i++)
+ {
CurRoadmapItem = (XInterface) xIndexContRoadmap.getByIndex(i);
CurID = AnyConverter.toInt(Helper.getUnoPropertyValue(CurRoadmapItem, "ID"));
if (CurID == _ID)
+ {
return CurRoadmapItem;
+ }
}
return null;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return null;
}
}
- public boolean switchToStep(int _nOldStep, int _nNewStep) {
+ public boolean switchToStep(int _nOldStep, int _nNewStep)
+ {
nOldStep = _nOldStep;
nNewStep = _nNewStep;
return switchToStep();
}
- private boolean switchToStep() {
+ private boolean switchToStep()
+ {
leaveStep(nOldStep, nNewStep);
- if (nNewStep != nOldStep) {
- if (nNewStep == nMaxStep) {
+ if (nNewStep != nOldStep)
+ {
+ if (nNewStep == nMaxStep)
+ {
setControlProperty("btnWizardNext", "DefaultButton", Boolean.FALSE);
setControlProperty("btnWizardFinish", "DefaultButton", Boolean.TRUE);
- } else {
+ }
+ else
+ {
setControlProperty("btnWizardNext", "DefaultButton", Boolean.TRUE);
setControlProperty("btnWizardFinish", "DefaultButton", Boolean.FALSE);
}
@@ -301,7 +366,8 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
abstract protected void enterStep(int nOldStep, int nNewStep);
- protected void changeToStep(int nNewStep) {
+ protected void changeToStep(int nNewStep)
+ {
Helper.setUnoPropertyValue(xDialogModel, "Step", new Integer(nNewStep));
setCurrentRoadmapItemID((short) (nNewStep));
enableNextButton(getNextAvailableStep() > 0);
@@ -312,31 +378,38 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#iscompleted(int)
*/
- public boolean iscompleted(int _ndialogpage) {
+ public boolean iscompleted(int _ndialogpage)
+ {
return false;
}
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#ismodified(int)
*/
- public boolean ismodified(int _ndialogpage) {
+
+ public boolean ismodified(int _ndialogpage)
+ {
return false;
}
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean)
*/
- public void setcompleted(int _ndialogpage, boolean _biscompleted) {
+ public void setcompleted(int _ndialogpage, boolean _biscompleted)
+ {
}
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.XCompletion#setmodified(int, java.lang.Object, java.lang.Object)
*/
- public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue) {
+ public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue)
+ {
}
- public void drawNaviBar() {
+ public void drawNaviBar()
+ {
- try {
+ try
+ {
short curtabindex = UIConsts.SOFIRSTWIZARDNAVITABINDEX;
Integer IButtonWidth = new Integer(iButtonWidth);
int iButtonHeight = 14;
@@ -352,201 +425,298 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
int iBackPosX = iNextPosX - 3 - iButtonWidth;
insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnNaviSep",
- new String[] { "Height", "Orientation", "PositionX", "PositionY", "Step", "Width" },
- new Object[] { new Integer(1), new Integer(0), new Integer(0), new Integer(iDialogHeight - 26), ICurStep, new Integer(iDialogWidth)});
+ new String[]
+ {
+ "Height", "Orientation", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(1), new Integer(0), new Integer(0), new Integer(iDialogHeight - 26), ICurStep, new Integer(iDialogWidth)
+ });
insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnRoadSep",
- new String[] { "Height", "Orientation", "PositionX", "PositionY", "Step", "Width" },
- new Object[] { new Integer(iBtnPosY - 6), new Integer(1), new Integer(85), new Integer(0), ICurStep, new Integer(1)});
-
- String[] propNames = new String[] { "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "PushButtonType", "Step", "TabIndex", "Width" };
+ new String[]
+ {
+ "Height", "Orientation", "PositionX", "PositionY", "Step", "Width"
+ },
+ new Object[]
+ {
+ new Integer(iBtnPosY - 6), new Integer(1), new Integer(85), new Integer(0), ICurStep, new Integer(1)
+ });
+
+ String[] propNames = new String[]
+ {
+ "Enabled", "Height", "HelpURL", "Label", "PositionX", "PositionY", "PushButtonType", "Step", "TabIndex", "Width"
+ };
Helper.setUnoPropertyValue(super.xDialogModel, "HelpURL", "HID:" + hid);
- insertButton("btnWizardHelp", HELP_ACTION_PERFORMED, new String[] { "Enabled", "Height", "Label", "PositionX", "PositionY", "PushButtonType", "Step", "TabIndex", "Width" } ,
- new Object[] { new Boolean(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 });
- insertButton("btnWizardBack", BACK_ACTION_PERFORMED, propNames ,
- new Object[] { new Boolean(false), IButtonHeight, "HID:" + (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 });
-
- insertButton("btnWizardNext", NEXT_ACTION_PERFORMED, propNames ,
- new Object[] { new Boolean(true), IButtonHeight, "HID:" + (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 });
+ insertButton("btnWizardHelp", HELP_ACTION_PERFORMED, new String[]
+ {
+ "Enabled", "Height", "Label", "PositionX", "PositionY", "PushButtonType", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(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
+ });
+ insertButton("btnWizardBack", BACK_ACTION_PERFORMED, propNames,
+ new Object[]
+ {
+ new Boolean(false), IButtonHeight, "HID:" + (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
+ });
+
+ insertButton("btnWizardNext", NEXT_ACTION_PERFORMED, propNames,
+ new Object[]
+ {
+ new Boolean(true), IButtonHeight, "HID:" + (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
+ });
insertButton("btnWizardFinish", FINISH_ACTION_PERFORMED, propNames,
- new Object[] { new Boolean(true), IButtonHeight, "HID:" + (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 });
+ new Object[]
+ {
+ new Boolean(true), IButtonHeight, "HID:" + (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
+ });
insertButton("btnWizardCancel", CANCEL_ACTION_PERFORMED, propNames,
- new Object[] { new Boolean(true), IButtonHeight, "HID:" + (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 });
+ new Object[]
+ {
+ new Boolean(true), IButtonHeight, "HID:" + (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
+ });
- setControlProperty("btnWizardNext", "DefaultButton", Boolean.TRUE );
+ setControlProperty("btnWizardNext", "DefaultButton", Boolean.TRUE);
// add a window listener, to know
// if the user used "escape" key to
// close the dialog.
MethodInvocation windowHidden = new MethodInvocation("windowHidden", this);
- xWindow.addWindowListener((CommonListener)getGuiEventListener());
- String dialogName = (String)Helper.getUnoPropertyValue( xDialogModel, "Name" );
- getGuiEventListener().add( dialogName, EVENT_ACTION_PERFORMED , windowHidden);
+ xWindow.addWindowListener((CommonListener) getGuiEventListener());
+ String dialogName = (String) Helper.getUnoPropertyValue(xDialogModel, "Name");
+ getGuiEventListener().add(dialogName, EVENT_ACTION_PERFORMED, windowHidden);
- } catch (java.lang.Exception jexception) {
+ }
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
}
}
- protected void insertRoadMapItems(String[] items, int[] steps, boolean[] enabled) {
+ protected void insertRoadMapItems(String[] items, int[] steps, boolean[] enabled)
+ {
for (int i = 0; i < items.length; i++)
+ {
insertRoadmapItem(i, enabled[i], items[i], steps[i]);
+ }
}
/** This method also enables and disables the "next" button,
- * if the step currently dis/enabled is the one of the next steps.
- * @param _nStep
- * @param bEnabled
- * @param enableNextButton
- */
- public void setStepEnabled(int _nStep, boolean bEnabled, boolean enableNextButton) {
+ * if the step currently dis/enabled is the one of the next steps.
+ * @param _nStep
+ * @param bEnabled
+ * @param enableNextButton
+ */
+ public void setStepEnabled(int _nStep, boolean bEnabled, boolean enableNextButton)
+ {
setStepEnabled(_nStep, bEnabled);
if (getNextAvailableStep() > 0)
+ {
enableNextButton(bEnabled);
+ }
}
- public void enableNavigationButtons(boolean _bEnableBack, boolean _bEnableNext, boolean _bEnableFinish) {
+ public void enableNavigationButtons(boolean _bEnableBack, boolean _bEnableNext, boolean _bEnableFinish)
+ {
enableBackButton(_bEnableBack);
enableNextButton(_bEnableNext);
enableFinishButton(_bEnableFinish);
}
- public void enableBackButton(boolean enabled) {
+ public void enableBackButton(boolean enabled)
+ {
setControlProperty("btnWizardBack", "Enabled", enabled ? Boolean.TRUE : Boolean.FALSE);
}
- public void enableNextButton(boolean enabled) {
+ public void enableNextButton(boolean enabled)
+ {
setControlProperty("btnWizardNext", "Enabled", enabled ? Boolean.TRUE : Boolean.FALSE);
}
- public void enableFinishButton(boolean enabled) {
+ public void enableFinishButton(boolean enabled)
+ {
setControlProperty("btnWizardFinish", "Enabled", enabled ? Boolean.TRUE : Boolean.FALSE);
}
- public void setStepEnabled(int _nStep, boolean bEnabled) {
+ public void setStepEnabled(int _nStep, boolean bEnabled)
+ {
XInterface xRoadmapItem = getRoadmapItemByID(_nStep);
if (xRoadmapItem != null)
+ {
Helper.setUnoPropertyValue(xRoadmapItem, "Enabled", new Boolean(bEnabled));
+ }
}
- public void enablefromStep(int _iStep, boolean _bDoEnable) {
- if (_iStep <= this.nMaxStep) {
+ public void enablefromStep(int _iStep, boolean _bDoEnable)
+ {
+ if (_iStep <= this.nMaxStep)
+ {
for (int i = _iStep; i <= nMaxStep; i++)
+ {
setStepEnabled(i, _bDoEnable);
+ }
enableFinishButton(_bDoEnable);
if (!_bDoEnable)
- enableNextButton(_iStep > getCurrentStep()+1);
+ {
+ enableNextButton(_iStep > getCurrentStep() + 1);
+ }
else
+ {
enableNextButton(!(getCurrentStep() == nMaxStep));
-
+ }
}
}
- public boolean isStepEnabled(int _nStep) {
- try {
+ public boolean isStepEnabled(int _nStep)
+ {
+ try
+ {
boolean bIsEnabled;
XInterface xRoadmapItem = getRoadmapItemByID(_nStep);
if (xRoadmapItem == null)
- // Todo: In this case an exception should be thrown
+ // Todo: In this case an exception should be thrown
+ {
return false;
+ }
bIsEnabled = AnyConverter.toBoolean(Helper.getUnoPropertyValue(xRoadmapItem, "Enabled"));
return bIsEnabled;
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return false;
}
}
- public synchronized void gotoPreviousAvailableStep() {
+ public synchronized void gotoPreviousAvailableStep()
+ {
boolean bIsEnabled;
- if (nNewStep > 1) {
+ if (nNewStep > 1)
+ {
nOldStep = nNewStep;
nNewStep--;
- while (nNewStep > 0) {
+ while (nNewStep > 0)
+ {
bIsEnabled = isStepEnabled(nNewStep);
if (bIsEnabled)
+ {
break;
+ }
nNewStep--;
}
if (nNewStep == 0) // Exception???
+ {
nNewStep = nOldStep;
+ }
switchToStep();
}
}
//TODO discuss with rp
- protected int getNextAvailableStep() {
+ protected int getNextAvailableStep()
+ {
if (isRoadmapComplete())
+ {
for (int i = nNewStep + 1; i <= nMaxStep; i++)
+ {
if (isStepEnabled(i))
+ {
return i;
+ }
+ }
+ }
return -1;
}
- public synchronized void gotoNextAvailableStep() {
+ public synchronized void gotoNextAvailableStep()
+ {
nOldStep = nNewStep;
nNewStep = getNextAvailableStep();
if (nNewStep > -1)
+ {
switchToStep();
+ }
}
public abstract void finishWizard();
- public void finishWizard_1() {
+ public void finishWizard_1()
+ {
finishWizard();
removeTerminateListener();
}
- public int getMaximalStep() {
+ public int getMaximalStep()
+ {
return this.nMaxStep;
}
- public int getCurrentStep() {
- try {
+ public int getCurrentStep()
+ {
+ try
+ {
return AnyConverter.toInt(Helper.getUnoPropertyValue(this.MSFDialogModel, "Step"));
- } catch (com.sun.star.uno.Exception exception) {
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
exception.printStackTrace(System.out);
return -1;
}
}
- public void setCurrentStep(int _nNewstep){
+ public void setCurrentStep(int _nNewstep)
+ {
nNewStep = _nNewstep;
changeToStep(nNewStep);
}
- public void setRightPaneHeaders(Resource _oResource, int StartResID, int _nMaxStep) {
+ public void setRightPaneHeaders(Resource _oResource, int StartResID, int _nMaxStep)
+ {
String[] sRightPaneHeaders = _oResource.getResArray(StartResID, _nMaxStep);
setRightPaneHeaders(sRightPaneHeaders);
}
- public void setRightPaneHeaders(String[] _sRightPaneHeaders) {
+ public void setRightPaneHeaders(String[] _sRightPaneHeaders)
+ {
this.nMaxStep = _sRightPaneHeaders.length;
this.sRightPaneHeaders = _sRightPaneHeaders;
FontDescriptor oFontDesc = new FontDescriptor();
oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD;
- for (int i = 0; i < sRightPaneHeaders.length; i++) {
+ for (int i = 0; i < sRightPaneHeaders.length; i++)
+ {
insertLabel("lblQueryTitle" + String.valueOf(i),
- new String[] { "FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { oFontDesc, new Integer(16), sRightPaneHeaders[i], Boolean.TRUE, new Integer(91), new Integer(8), new Integer(i + 1), new Short((short) 12), new Integer(212)});
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ oFontDesc, new Integer(16), sRightPaneHeaders[i], Boolean.TRUE, new Integer(91), new Integer(8), new Integer(i + 1), new Short((short) 12), new Integer(212)
+ });
}
}
- public void cancelWizard() {
+ public void cancelWizard()
+ {
//can be overwritten by extending class
xDialog.endExecute();
}
- public void callHelp() {
+ public void callHelp()
+ {
//should be overwritten by extending class
}
-
- public void removeTerminateListener( ){
- if (bTerminateListenermustberemoved){
+ public void removeTerminateListener()
+ {
+ if (bTerminateListenermustberemoved)
+ {
Desktop.getDesktop(xMSF).removeTerminateListener(this);
bTerminateListenermustberemoved = false;
}
@@ -558,26 +728,31 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
* if this method was not called before,
* perform a cancel.
*/
- public void cancelWizard_1() {
+ public void cancelWizard_1()
+ {
cancelWizard();
removeTerminateListener();
}
- public void windowHidden() {
+ public void windowHidden()
+ {
cancelWizard_1();
}
- public void notifyTermination(EventObject arg0) {
+ public void notifyTermination(EventObject arg0)
+ {
cancelWizard_1();
}
public void queryTermination(EventObject arg0)
- throws TerminationVetoException {
- activate();
- throw new TerminationVetoException();
+ throws TerminationVetoException
+ {
+ activate();
+ throw new TerminationVetoException();
}
- public void disposing(EventObject arg0) {
+ public void disposing(EventObject arg0)
+ {
cancelWizard_1();
}
}
diff --git a/wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java b/wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java
index b042ea61f2e3..f4cb7f567db8 100644
--- a/wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java
+++ b/wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java
@@ -1,15 +1,47 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XCommandSelectionListener.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* XDSFieldSelection.java
*
* Created on July 23, 2003, 5:05 PM
*/
-
package com.sun.star.wizards.ui;
/**
*
* @author bc93774
*/
-public interface XCommandSelectionListener {
+public interface XCommandSelectionListener
+{
+
public void CommandSelected(String CommandName);
}
diff --git a/wizards/com/sun/star/wizards/ui/XCompletion.java b/wizards/com/sun/star/wizards/ui/XCompletion.java
index b8d4ee305d60..2d9716395e9e 100644
--- a/wizards/com/sun/star/wizards/ui/XCompletion.java
+++ b/wizards/com/sun/star/wizards/ui/XCompletion.java
@@ -26,9 +26,11 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui;
+ ************************************************************************/
+package com.sun.star.wizards.ui;
-public interface XCompletion {
+public interface XCompletion
+{
public void setcompleted(int _ndialogpage, boolean _biscompleted);
diff --git a/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java b/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java
index ff5c2f547d30..abb814f4bd5b 100644
--- a/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java
+++ b/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XFieldSelectionListener.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* FieldSelectionActions.java
*
* Created on July 14, 2003, 5:42 PM
@@ -9,11 +40,18 @@ package com.sun.star.wizards.ui;
*
* @author bc93774
*/
-public interface XFieldSelectionListener {
+public interface XFieldSelectionListener
+{
+
public void shiftFromLeftToRight(String[] SelItems, String[] NewItems);
+
public void shiftFromRightToLeft(String[] OldSelItems, String[] NewItems);
+
public void moveItemUp(String Selitem);
+
public void moveItemDown(String Selitem);
+
public void setID(String sIncSuffix);
+
public int getID();
}
diff --git a/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java b/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java
index 04b8c475c326..41f4fb1f608f 100755
--- a/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java
+++ b/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java
@@ -1,5 +1,38 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XPathSelectionListener.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.ui;
-public interface XPathSelectionListener {
+public interface XPathSelectionListener
+{
+
public void validatePath();
}
diff --git a/wizards/com/sun/star/wizards/ui/event/AbstractListener.java b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
index e1816f5e054f..989419331c7c 100644
--- a/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
+++ b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
@@ -26,7 +26,9 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui.event;
+ ************************************************************************/
+package com.sun.star.wizards.ui.event;
+
import com.sun.star.awt.XControl;
import com.sun.star.lang.EventObject;
import com.sun.star.uno.UnoRuntime;
@@ -48,37 +50,54 @@ import java.util.Hashtable;
* </list>
* @author rpiterman
*/
-public class AbstractListener {
+public class AbstractListener
+{
+
private Hashtable mHashtable = new Hashtable();
/** Creates a new instance of AbstractListener */
- public AbstractListener() {
+ public AbstractListener()
+ {
}
- public void add(String componentName, String eventName, String methodName, Object target) {
- try {
+ public void add(String componentName, String eventName, String methodName, Object target)
+ {
+ try
+ {
add(componentName, eventName, new MethodInvocation(methodName, target));
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
- public void add(String componentName, String eventName, MethodInvocation mi) {
+ public void add(String componentName, String eventName, MethodInvocation mi)
+ {
mHashtable.put(componentName + eventName, mi);
}
- public MethodInvocation get(String componentName, String eventName) {
+ public MethodInvocation get(String componentName, String eventName)
+ {
return (MethodInvocation) mHashtable.get(componentName + eventName);
}
- public Object invoke(String componentName, String eventName, Object param) {
- try {
+ public Object invoke(String componentName, String eventName, Object param)
+ {
+ try
+ {
MethodInvocation mi = get(componentName, eventName);
if (mi != null)
+ {
return mi.invoke(param);
+ }
else
+ {
return null;
- } catch (InvocationTargetException ite) {
+ }
+ }
+ catch (InvocationTargetException ite)
+ {
System.out.println("=======================================================");
System.out.println("=== Note: An Exception was thrown which should have ===");
@@ -88,10 +107,13 @@ public class AbstractListener {
ite.printStackTrace();
- } catch (IllegalAccessException iae) {
+ }
+ catch (IllegalAccessException iae)
+ {
iae.printStackTrace();
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
System.out.println("=======================================================");
System.out.println("=== Note: An Exception was thrown which should have ===");
System.out.println("=== caused a crash. I Catched it. Please report this ==");
@@ -106,7 +128,8 @@ public class AbstractListener {
/**
* Rerurns the property "name" of the Object which is the source of the event.
*/
- public static String getEventSourceName(EventObject eventObject) {
+ public static String getEventSourceName(EventObject eventObject)
+ {
XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, eventObject.Source);
return (String) Helper.getUnoPropertyValue(xControl.getModel(), "Name", String.class);
}
diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.java b/wizards/com/sun/star/wizards/ui/event/CommonListener.java
index 8048b7041e41..2f4d83313ed9 100644
--- a/wizards/com/sun/star/wizards/ui/event/CommonListener.java
+++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui.event;
+ ************************************************************************/
+package com.sun.star.wizards.ui.event;
import com.sun.star.awt.*;
import com.sun.star.lang.EventObject;
@@ -35,118 +36,135 @@ import com.sun.star.lang.EventObject;
*
* @author rpiterman
*/
-public class CommonListener extends AbstractListener implements XActionListener, XItemListener, XTextListener, EventNames, XWindowListener, XMouseListener, XFocusListener, XKeyListener {
+public class CommonListener extends AbstractListener implements XActionListener, XItemListener, XTextListener, EventNames, XWindowListener, XMouseListener, XFocusListener, XKeyListener
+{
/** Creates a new instance of CommonListener */
- public CommonListener() {
+ public CommonListener()
+ {
}
/**
* Implementation of com.sun.star.awt.XActionListener
*/
- public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent) {
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
invoke(getEventSourceName(actionEvent), EVENT_ACTION_PERFORMED, actionEvent);
}
- public void disposing(com.sun.star.lang.EventObject eventObject) {
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
}
/**
* Implementation of com.sun.star.awt.XItemListener
*/
- public void itemStateChanged(ItemEvent itemEvent) {
+ public void itemStateChanged(ItemEvent itemEvent)
+ {
invoke(getEventSourceName(itemEvent), EVENT_ITEM_CHANGED, itemEvent);
}
/**
* Implementation of com.sun.star.awt.XTextListener
*/
- public void textChanged(TextEvent textEvent) {
+ public void textChanged(TextEvent textEvent)
+ {
invoke(getEventSourceName(textEvent), EVENT_TEXT_CHANGED, textEvent);
}
/**
* @see com.sun.star.awt.XWindowListener#windowResized(com.sun.star.awt.WindowEvent)
*/
- public void windowResized(WindowEvent event) {
+ public void windowResized(WindowEvent event)
+ {
invoke(getEventSourceName(event), EVENT_WINDOW_RESIZED, event);
}
/**
* @see com.sun.star.awt.XWindowListener#windowMoved(com.sun.star.awt.WindowEvent)
*/
- public void windowMoved(WindowEvent event) {
+ public void windowMoved(WindowEvent event)
+ {
invoke(getEventSourceName(event), EVENT_WINDOW_MOVED, event);
}
/**
* @see com.sun.star.awt.XWindowListener#windowShown(com.sun.star.lang.EventObject)
*/
- public void windowShown(EventObject event) {
+ public void windowShown(EventObject event)
+ {
invoke(getEventSourceName(event), EVENT_WINDOW_SHOWN, event);
}
/**
* @see com.sun.star.awt.XWindowListener#windowHidden(com.sun.star.lang.EventObject)
*/
- public void windowHidden(EventObject event) {
+ public void windowHidden(EventObject event)
+ {
invoke(getEventSourceName(event), EVENT_WINDOW_HIDDEN, event);
}
/**
* @see com.sun.star.awt.XMouseListener#mousePressed(com.sun.star.awt.MouseEvent)
*/
- public void mousePressed(MouseEvent event) {
+ public void mousePressed(MouseEvent event)
+ {
invoke(getEventSourceName(event), EVENT_MOUSE_PRESSED, event);
}
/**
* @see com.sun.star.awt.XMouseListener#mouseReleased(com.sun.star.awt.MouseEvent)
*/
- public void mouseReleased(MouseEvent event) {
+ public void mouseReleased(MouseEvent event)
+ {
invoke(getEventSourceName(event), EVENT_KEY_RELEASED, event);
}
/**
* @see com.sun.star.awt.XMouseListener#mouseEntered(com.sun.star.awt.MouseEvent)
*/
- public void mouseEntered(MouseEvent event) {
+ public void mouseEntered(MouseEvent event)
+ {
invoke(getEventSourceName(event), EVENT_MOUSE_ENTERED, event);
}
/**
* @see com.sun.star.awt.XMouseListener#mouseExited(com.sun.star.awt.MouseEvent)
*/
- public void mouseExited(MouseEvent event) {
+ public void mouseExited(MouseEvent event)
+ {
invoke(getEventSourceName(event), EVENT_MOUSE_EXITED, event);
}
/**
* @see com.sun.star.awt.XFocusListener#focusGained(com.sun.star.awt.FocusEvent)
*/
- public void focusGained(FocusEvent event) {
+ public void focusGained(FocusEvent event)
+ {
invoke(getEventSourceName(event), EVENT_FOCUS_GAINED, event);
}
/**
* @see com.sun.star.awt.XFocusListener#focusLost(com.sun.star.awt.FocusEvent)
*/
- public void focusLost(FocusEvent event) {
+ public void focusLost(FocusEvent event)
+ {
invoke(getEventSourceName(event), EVENT_FOCUS_LOST, event);
}
/**
* @see com.sun.star.awt.XKeyListener#keyPressed(com.sun.star.awt.KeyEvent)
*/
- public void keyPressed(KeyEvent event) {
+ public void keyPressed(KeyEvent event)
+ {
invoke(getEventSourceName(event), EVENT_KEY_PRESSED, event);
}
/**
* @see com.sun.star.awt.XKeyListener#keyReleased(com.sun.star.awt.KeyEvent)
*/
- public void keyReleased(KeyEvent event) {
+ public void keyReleased(KeyEvent event)
+ {
invoke(getEventSourceName(event), EVENT_KEY_RELEASED, event);
}
-
}
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
index 2cb123bf4c1c..3a6831606bc6 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
+++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
@@ -41,7 +41,9 @@ import com.sun.star.uno.Any;
*
* @see com.sun.star.wizards.ui.event.DataAware.Value
*/
-public class DataAwareFields {
+public class DataAwareFields
+{
+
private static final String TRUE = "true";
private static final String FALSE = "false";
@@ -56,26 +58,36 @@ public class DataAwareFields {
* @throws NoSuchFieldException
*/
public static DataAware.Value getFieldValueFor(Object owner, String fieldname, Object value)
-
{
- try {
+ try
+ {
Field f = owner.getClass().getField(fieldname);
Class c = f.getType();
Class c2 = value.getClass();
if (c.equals(Boolean.TYPE))
- return new BooleanFieldValue(f,c2);
+ {
+ return new BooleanFieldValue(f, c2);
+ }
else if (c.equals(Integer.TYPE))
- return new IntFieldValue(f,c2);
+ {
+ return new IntFieldValue(f, c2);
+ }
else if (c.equals(Double.TYPE))
- return new DoubleFieldValue(f,c2);
- else if (c.equals(String.class) && c2.equals(Integer.class)) {
- return new ConvertedStringValue(f,c2);
- }
+ {
+ return new DoubleFieldValue(f, c2);
+ }
+ else if (c.equals(String.class) && c2.equals(Integer.class))
+ {
+ return new ConvertedStringValue(f, c2);
+ }
else
+ {
return new SimpleFieldValue(f);
+ }
}
- catch (NoSuchFieldException ex) {
+ catch (NoSuchFieldException ex)
+ {
ex.printStackTrace();
return null;
}
@@ -85,23 +97,29 @@ public class DataAwareFields {
* an abstract implementation of DataAware.Value to access
* object memebers (fields) usign reflection.
*/
- private static abstract class FieldValue implements DataAware.Value {
+ private static abstract class FieldValue implements DataAware.Value
+ {
+
Field field;
- public FieldValue(Field field_) {
+ public FieldValue(Field field_)
+ {
field = field_;
}
- public boolean isAssignable(Class type) {
+ public boolean isAssignable(Class type)
+ {
return field.getDeclaringClass().isAssignableFrom(type);
}
-
}
- private static class BooleanFieldValue extends FieldValue {
+ private static class BooleanFieldValue extends FieldValue
+ {
+
private Class convertTo;
- public BooleanFieldValue(Field f, Class convertTo_) {
+ public BooleanFieldValue(Field f, Class convertTo_)
+ {
super(f);
convertTo = convertTo_;
}
@@ -109,39 +127,59 @@ public class DataAwareFields {
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
*/
- public Object get(Object target) {
- try {
+ public Object get(Object target)
+ {
+ try
+ {
boolean b = field.getBoolean(target);
if (convertTo.equals(Boolean.class))
+ {
return b ? Boolean.TRUE : Boolean.FALSE;
+ }
else if (Number.class.isAssignableFrom(convertTo))
+ {
return toNumber(b ? 1 : 0, convertTo);
+ }
else if (convertTo.equals(String.class))
+ {
return String.valueOf(b);
+ }
else if (convertTo.isArray())
+ {
return toShortArray(toInt(b));
+ }
else
+ {
throw new IllegalArgumentException("Cannot convert boolean value to given type (" + convertTo.getName() + ").");
- } catch (IllegalAccessException ex) {
+ }
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
return null;
}
}
- public void set(Object value, Object target) {
- try {
+ public void set(Object value, Object target)
+ {
+ try
+ {
field.setBoolean(target, toBoolean(value));
- } catch (IllegalAccessException ex) {
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
}
}
-
}
- private static class IntFieldValue extends FieldValue {
+ private static class IntFieldValue extends FieldValue
+ {
+
private Class convertTo;
- public IntFieldValue(Field f, Class convertTo_) {
+ public IntFieldValue(Field f, Class convertTo_)
+ {
super(f);
convertTo = convertTo_;
}
@@ -149,38 +187,59 @@ public class DataAwareFields {
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
*/
- public Object get(Object target) {
- try {
+ public Object get(Object target)
+ {
+ try
+ {
int i = field.getInt(target);
if (convertTo.equals(Boolean.class))
+ {
return i != 0 ? Boolean.TRUE : Boolean.FALSE;
+ }
else if (Number.class.isAssignableFrom(convertTo))
+ {
return toNumber(i, convertTo);
+ }
else if (convertTo.equals(String.class))
+ {
return String.valueOf(i);
- else if ( convertTo.isArray() )
+ }
+ else if (convertTo.isArray())
+ {
return toShortArray(i);
+ }
else
+ {
throw new IllegalArgumentException("Cannot convert int value to given type (" + convertTo.getName() + ").");
- } catch (IllegalAccessException ex) {
+ }
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
return null;
}
}
- public void set(Object value, Object target) {
- try {
+ public void set(Object value, Object target)
+ {
+ try
+ {
field.setInt(target, (int) toDouble(value));
- } catch (IllegalAccessException ex) {
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
}
}
-
}
- private static class DoubleFieldValue extends FieldValue {
+
+ private static class DoubleFieldValue extends FieldValue
+ {
+
private Class convertTo;
- public DoubleFieldValue(Field f, Class convertTo_) {
+ public DoubleFieldValue(Field f, Class convertTo_)
+ {
super(f);
convertTo = convertTo_;
}
@@ -188,37 +247,59 @@ public class DataAwareFields {
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
*/
- public Object get(Object target) {
- try {
+ public Object get(Object target)
+ {
+ try
+ {
double d = field.getDouble(target);
if (convertTo.equals(Boolean.class))
+ {
return d != 0 ? Boolean.TRUE : Boolean.FALSE;
+ }
else if (Number.class.isAssignableFrom(convertTo))
+ {
return toNumber(d, convertTo);
+ }
else if (convertTo.equals(String.class))
+ {
return String.valueOf(d);
+ }
else if (convertTo.isArray())
+ {
return toShortArray(d);
+ }
else
+ {
throw new IllegalArgumentException("Cannot convert int value to given type (" + convertTo.getName() + ").");
- } catch (IllegalAccessException ex) {
+ }
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
return null;
}
}
- public void set(Object value, Object target) {
- try {
+
+ public void set(Object value, Object target)
+ {
+ try
+ {
field.setDouble(target, toDouble(value));
- } catch (IllegalAccessException ex) {
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
}
}
}
- private static class ConvertedStringValue extends FieldValue {
+ private static class ConvertedStringValue extends FieldValue
+ {
+
private Class convertTo;
- public ConvertedStringValue(Field f, Class convertTo_) {
+ public ConvertedStringValue(Field f, Class convertTo_)
+ {
super(f);
convertTo = convertTo_;
}
@@ -226,117 +307,204 @@ public class DataAwareFields {
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
*/
- public Object get(Object target) {
- try {
- String s = (String)field.get(target);
+ public Object get(Object target)
+ {
+ try
+ {
+ String s = (String) field.get(target);
if (convertTo.equals(Boolean.class))
- return ( s != null && !s.equals("") && s.equals("true") ) ? Boolean.TRUE : Boolean.FALSE;
- else if ( convertTo.equals(Integer.class) ) {
- if ( s == null || s.equals("") )
+ {
+ return (s != null && !s.equals("") && s.equals("true")) ? Boolean.TRUE : Boolean.FALSE;
+ }
+ else if (convertTo.equals(Integer.class))
+ {
+ if (s == null || s.equals(""))
+ {
return Any.VOID;
- else return new Integer(s);
+ }
+ else
+ {
+ return new Integer(s);
+ }
}
- else if (convertTo.equals(Double.class)) {
- if ( s == null || s.equals("") )
+ else if (convertTo.equals(Double.class))
+ {
+ if (s == null || s.equals(""))
+ {
return Any.VOID;
+ }
else
+ {
return new Double(s);
+ }
}
else
+ {
throw new IllegalArgumentException("Cannot convert int value to given type (" + convertTo.getName() + ").");
- } catch (IllegalAccessException ex) {
+ }
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
return null;
}
}
- public void set(Object value, Object target) {
- try {
- field.set(target, value==null || (value.equals(Any.VOID)) ? "" : value.toString());
- } catch (IllegalAccessException ex) {
+
+ public void set(Object value, Object target)
+ {
+ try
+ {
+ field.set(target, value == null || (value.equals(Any.VOID)) ? "" : value.toString());
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
}
}
}
- private static class SimpleFieldValue extends FieldValue {
+ private static class SimpleFieldValue extends FieldValue
+ {
- public SimpleFieldValue(Field f) {
+ public SimpleFieldValue(Field f)
+ {
super(f);
}
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
*/
- public Object get(Object target) {
- try {
- if (target == null) {
+
+ public Object get(Object target)
+ {
+ try
+ {
+ if (target == null)
+ {
if (field.getType().equals(String.class))
+ {
return "";
+ }
if (field.getType().equals(Short.class))
+ {
return new Short((short) 0);
+ }
if (field.getType().equals(Integer.class))
+ {
return new Integer(0);
+ }
if (field.getType().equals(short[].class))
+ {
return new short[0];
- else return null;
- } else
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
return field.get(target);
- } catch (IllegalAccessException ex) {
+ }
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
return null;
}
}
- public void set(Object value, Object target) {
- try {
+
+ public void set(Object value, Object target)
+ {
+ try
+ {
field.set(target, value);
- } catch (IllegalAccessException ex) {
+ }
+ catch (IllegalAccessException ex)
+ {
ex.printStackTrace();
}
}
}
- private static double toDouble(Object value) {
+ private static double toDouble(Object value)
+ {
if (value instanceof Boolean)
+ {
return ((Boolean) value).booleanValue() ? 1 : 0;
+ }
else if (value instanceof Number)
+ {
return ((Number) value).doubleValue();
+ }
else if (value instanceof String)
+ {
return Double.valueOf((String) value).doubleValue();
+ }
else if (value instanceof short[])
+ {
return ((short[]) value).length == 0 ? 0 : ((short[]) value)[0];
+ }
else
+ {
throw new IllegalArgumentException("Can't convert value to double." + value.getClass().getName());
+ }
}
- private static boolean toBoolean(Object value) {
+ private static boolean toBoolean(Object value)
+ {
if (value instanceof Boolean)
+ {
return ((Boolean) value).booleanValue();
+ }
else if (value instanceof Number)
+ {
return ((Number) value).intValue() != 0;
+ }
else if (value instanceof String)
+ {
return ((String) value).equals(TRUE);
+ }
else if (value instanceof short[])
+ {
return ((short[]) value).length != 0 && ((short[]) value)[0] != 0;
+ }
else
+ {
throw new IllegalArgumentException("Can't convert value to boolean." + value.getClass().getName());
+ }
}
- private static int toInt(boolean b) {
+ private static int toInt(boolean b)
+ {
return b ? 1 : 0;
}
- private static short[] toShortArray(double i) {
- return new short[] {(short) i };
+ private static short[] toShortArray(double i)
+ {
+ return new short[]
+ {
+ (short) i
+ };
}
- private static Number toNumber(double i, Class c) {
+ private static Number toNumber(double i, Class c)
+ {
if (c.equals(Integer.class))
+ {
return new Integer((int) i);
+ }
else if (c.equals(Short.class))
+ {
return new Short((short) i);
+ }
else if (c.equals(Double.class))
+ {
return new Double(i);
+ }
else
+ {
throw new IllegalArgumentException("Cannot convert to the given Number type.");
+ }
}
}
diff --git a/wizards/com/sun/star/wizards/ui/event/EventNames.java b/wizards/com/sun/star/wizards/ui/event/EventNames.java
index 50bf01d3fa33..4ec209ed3de0 100644
--- a/wizards/com/sun/star/wizards/ui/event/EventNames.java
+++ b/wizards/com/sun/star/wizards/ui/event/EventNames.java
@@ -26,39 +26,30 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui.event;
+ ************************************************************************/
+package com.sun.star.wizards.ui.event;
/**
*
* @author rpiterman
*/
-public interface EventNames {
+public interface EventNames
+{
//common listener events
public static final String EVENT_ACTION_PERFORMED = "APR";
public static final String EVENT_ITEM_CHANGED = "ICH";
- public static final String EVENT_TEXT_CHANGED = "TCH";
-
- //window events (XWindow)
+ public static final String EVENT_TEXT_CHANGED = "TCH"; //window events (XWindow)
public static final String EVENT_WINDOW_RESIZED = "WRE";
public static final String EVENT_WINDOW_MOVED = "WMO";
public static final String EVENT_WINDOW_SHOWN = "WSH";
- public static final String EVENT_WINDOW_HIDDEN = "WHI";
-
- //focus events (XWindow)
+ public static final String EVENT_WINDOW_HIDDEN = "WHI"; //focus events (XWindow)
public static final String EVENT_FOCUS_GAINED = "FGA";
- public static final String EVENT_FOCUS_LOST = "FLO";
-
- //keyboard events
+ public static final String EVENT_FOCUS_LOST = "FLO"; //keyboard events
public static final String EVENT_KEY_PRESSED = "KPR";
- public static final String EVENT_KEY_RELEASED = "KRE";
-
- //mouse events
+ public static final String EVENT_KEY_RELEASED = "KRE"; //mouse events
public static final String EVENT_MOUSE_PRESSED = "MPR";
public static final String EVENT_MOUSE_RELEASED = "MRE";
public static final String EVENT_MOUSE_ENTERED = "MEN";
- public static final String EVENT_MOUSE_EXITED = "MEX";
-
- //other events
-
+ public static final String EVENT_MOUSE_EXITED = "MEX"; //other events
}
diff --git a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
index 60f5ce587aeb..e4f4b1a88f71 100644
--- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
+++ b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui.event;
+ ************************************************************************/
+package com.sun.star.wizards.ui.event;
import javax.swing.ListModel;
import javax.swing.event.ListDataEvent;
@@ -41,28 +42,41 @@ import com.sun.star.wizards.common.Helper;
* @author rpiterman
* */
-public class ListModelBinder implements ListDataListener {
+public class ListModelBinder implements ListDataListener
+{
+
private XListBox unoList;
private Object unoListModel;
private ListModel listModel;
- private Renderer renderer = new Renderer() {
- public String render(Object item) {
+ private Renderer renderer = new Renderer()
+ {
+
+ public String render(Object item)
+ {
if (item == null)
+ {
return "";
+ }
else
+ {
return item.toString();
+ }
}
};
- public ListModelBinder(Object unoListBox, ListModel listModel_) {
+ public ListModelBinder(Object unoListBox, ListModel listModel_)
+ {
unoList = (XListBox) UnoRuntime.queryInterface(XListBox.class, unoListBox);
unoListModel = UnoDataAware.getModel(unoListBox);
setListModel(listModel_);
}
- public void setListModel(ListModel newListModel) {
+ public void setListModel(ListModel newListModel)
+ {
if (listModel != null)
+ {
listModel.removeListDataListener(this);
+ }
listModel = newListModel;
listModel.addListDataListener(this);
}
@@ -70,100 +84,129 @@ public class ListModelBinder implements ListDataListener {
/* (non-Javadoc)
* @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent)
*/
- public void contentsChanged(ListDataEvent lde) {
+ public void contentsChanged(ListDataEvent lde)
+ {
short[] selected = getSelectedItems();
for (short i = (short) lde.getIndex0(); i <= lde.getIndex1(); i++)
+ {
update(i);
+ }
setSelectedItems(selected);
}
- protected void update(short i) {
+ protected void update(short i)
+ {
remove(i, i);
insert(i);
}
- protected void remove(short i1, short i2) {
+ protected void remove(short i1, short i2)
+ {
unoList.removeItems((short) i1, (short) (i2 - i1 + 1));
}
- protected void insert(short i) {
+ protected void insert(short i)
+ {
unoList.addItem(getItemString(i), i);
}
- protected String getItemString(short i) {
+ protected String getItemString(short i)
+ {
return getItemString(listModel.getElementAt((int) i));
}
- protected String getItemString(Object item) {
+ protected String getItemString(Object item)
+ {
return renderer.render(item);
}
- protected short[] getSelectedItems() {
+ protected short[] getSelectedItems()
+ {
return (short[]) Helper.getUnoPropertyValue(unoListModel, "SelectedItems");
}
- protected void setSelectedItems(short[] selected) {
+ protected void setSelectedItems(short[] selected)
+ {
Helper.setUnoPropertyValue(unoListModel, "SelectedItems", selected);
}
/* (non-Javadoc)
* @see javax.swing.event.ListDataListener#intervalAdded(javax.swing.event.ListDataEvent)
*/
- public void intervalAdded(ListDataEvent lde) {
+ public void intervalAdded(ListDataEvent lde)
+ {
//Short[] selected = getSelectedItems();
for (short i = (short) lde.getIndex0(); i <= lde.getIndex1(); i++)
+ {
insert(i);
/*int insertedItems = lde.getIndex1() - lde.getIndex0() + 1;
for (int i = 0; i<selected.length; i++)
- if (selected[i].intValue() >= lde.getIndex0())
- selected[i] = new Short((short)(selected[i].shortValue() + insertedItems));
+ if (selected[i].intValue() >= lde.getIndex0())
+ selected[i] = new Short((short)(selected[i].shortValue() + insertedItems));
setSelectedItems(selected);*/
+ }
}
/* (non-Javadoc)
* @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent)
*/
- public void intervalRemoved(ListDataEvent lde) {
+ public void intervalRemoved(ListDataEvent lde)
+ {
//Short[] selected = getSelectedItems();
remove((short) lde.getIndex0(), (short) lde.getIndex1());
- /*int removed = 0;
- for (int i = 0; i<selected.length; i++) {
- short s = selected[i].shortValue();
- if (s>=lde.getIndex0() && s<==lde.getIndex1()) {
- selected[i] = null;
- removed++;
- }
- }
+ /*int removed = 0;
+ for (int i = 0; i<selected.length; i++) {
+ short s = selected[i].shortValue();
+ if (s>=lde.getIndex0() && s<==lde.getIndex1()) {
+ selected[i] = null;
+ removed++;
+ }
+ }
- Short[] newSelected = (removed > 0 ? new Short[selected.length - removed] : selected;
- if (removed>0)
+ Short[] newSelected = (removed > 0 ? new Short[selected.length - removed] : selected;
+ if (removed>0)
- if (selected[i].intValue() >= lde.getIndex0())
- */
+ if (selected[i].intValue() >= lde.getIndex0())
+ */
}
- public static interface Renderer {
+ public static interface Renderer
+ {
+
public String render(Object item);
}
- public static void fillList(Object list, Object[] items, Renderer renderer) {
+ public static void fillList(Object list, Object[] items, Renderer renderer)
+ {
XListBox xlist = (XListBox) UnoRuntime.queryInterface(XListBox.class, list);
- Helper.setUnoPropertyValue(UnoDataAware.getModel(list), "StringItemList", new String[] {});
+ Helper.setUnoPropertyValue(UnoDataAware.getModel(list), "StringItemList", new String[]
+ {
+ });
for (short i = 0; i < items.length; i++)
+ {
if (items[i] != null)
+ {
xlist.addItem((renderer != null ? renderer.render(items[i]) : items[i].toString()), i);
+ }
+ }
}
- public static void fillComboBox(Object list, Object[] items, Renderer renderer) {
- XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class,list);
- Helper.setUnoPropertyValue(UnoDataAware.getModel(list), "StringItemList", new String[] {});
+ public static void fillComboBox(Object list, Object[] items, Renderer renderer)
+ {
+ XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, list);
+ Helper.setUnoPropertyValue(UnoDataAware.getModel(list), "StringItemList", new String[]
+ {
+ });
for (short i = 0; i < items.length; i++)
+ {
if (items[i] != null)
+ {
xComboBox.addItem((renderer != null ? renderer.render(items[i]) : items[i].toString()), i);
+ }
+ }
}
-
}
diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
index 7947eb0d83de..502b0dd47b0a 100644
--- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
+++ b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.ui.event;
import java.lang.reflect.InvocationTargetException;
@@ -44,8 +43,11 @@ import java.lang.reflect.Method;
* on the java level. i throw no error warnings or my own excceptions...
* @author rpiterman
*/
-public class MethodInvocation {
- static final Class[] EMPTY_ARRAY = {
+public class MethodInvocation
+{
+
+ static final Class[] EMPTY_ARRAY =
+ {
};
//the method to invoke.
Method mMethod;
@@ -55,22 +57,26 @@ public class MethodInvocation {
boolean mWithParam;
/** Creates a new instance of MethodInvokation */
- public MethodInvocation(String methodName, Object obj) throws NoSuchMethodException {
+ public MethodInvocation(String methodName, Object obj) throws NoSuchMethodException
+ {
this(methodName, obj, null);
}
- public MethodInvocation(Method method, Object obj) {
+ public MethodInvocation(Method method, Object obj)
+ {
this(method, obj, null);
}
public MethodInvocation(String methodName, Object obj, Class paramClass) throws NoSuchMethodException
- {
- this(paramClass == null ?
- obj.getClass().getMethod(methodName, null) :
- obj.getClass().getMethod(methodName, new Class[] { paramClass }), obj, paramClass);
- }
+ {
+ this(paramClass == null ? obj.getClass().getMethod(methodName, null) : obj.getClass().getMethod(methodName, new Class[]
+ {
+ paramClass
+ }), obj, paramClass);
+ }
- public MethodInvocation(Method method, Object obj, Class paramClass) {
+ public MethodInvocation(Method method, Object obj, Class paramClass)
+ {
mMethod = method;
mObject = obj;
mWithParam = !(paramClass == null);
@@ -79,19 +85,27 @@ public class MethodInvocation {
/**
* Returns the result of calling the method on the object, or null, if no result.
*/
- public Object invoke(Object param) throws IllegalAccessException, InvocationTargetException {
+ public Object invoke(Object param) throws IllegalAccessException, InvocationTargetException
+ {
if (mWithParam)
- return mMethod.invoke(mObject, new Object[] {(Object) param });
+ {
+ return mMethod.invoke(mObject, new Object[]
+ {
+ (Object) param
+ });
+ }
else
+ {
return mMethod.invoke(mObject, EMPTY_ARRAY);
+ }
}
/**
* This method is a convenience method.
* It is the same as calling invoke(null);
*/
- public Object invoke() throws IllegalAccessException, InvocationTargetException {
+ public Object invoke() throws IllegalAccessException, InvocationTargetException
+ {
return invoke(null);
}
-
}
diff --git a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
index 8e50bdb567c4..866155e0d256 100644
--- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui.event;
+ ************************************************************************/
+package com.sun.star.wizards.ui.event;
import com.sun.star.awt.XItemListener;
import com.sun.star.awt.XRadioButton;
@@ -38,48 +39,66 @@ import com.sun.star.uno.UnoRuntime;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class RadioDataAware extends DataAware {
+public class RadioDataAware extends DataAware
+{
+
protected XRadioButton[] radioButtons;
- public RadioDataAware(Object data, Value value, Object[] radioButs) {
+ public RadioDataAware(Object data, Value value, Object[] radioButs)
+ {
super(data, value);
radioButtons = new XRadioButton[radioButs.length];
for (int i = 0; i < radioButs.length; i++)
+ {
radioButtons[i] = (XRadioButton) UnoRuntime.queryInterface(XRadioButton.class, radioButs[i]);
+ }
}
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.DataAware#setToUI(java.lang.Object)
*/
- protected void setToUI(Object value) {
+ protected void setToUI(Object value)
+ {
int selected = ((Number) value).intValue();
if (selected == -1)
+ {
for (int i = 0; i < radioButtons.length; i++)
+ {
radioButtons[i].setState(false);
+ }
+ }
else
+ {
radioButtons[selected].setState(true);
+ }
}
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.DataAware#getFromUI()
*/
- protected Object getFromUI() {
+ protected Object getFromUI()
+ {
for (int i = 0; i < radioButtons.length; i++)
+ {
if (radioButtons[i].getState())
+ {
return new Integer(i);
+ }
+ }
return new Integer(-1);
}
- public static DataAware attachRadioButtons(Object data, String dataProp, Object[] buttons, final Listener listener, boolean field) {
+ public static DataAware attachRadioButtons(Object data, String dataProp, Object[] buttons, final Listener listener, boolean field)
+ {
final RadioDataAware da = new RadioDataAware(data,
- field
- ? DataAwareFields.getFieldValueFor(data,dataProp,new Integer(0))
- : new DataAware.PropertyValue(dataProp,data)
- , buttons);
+ field
+ ? DataAwareFields.getFieldValueFor(data, dataProp, new Integer(0))
+ : new DataAware.PropertyValue(dataProp, data), buttons);
XItemListener xil = UnoDataAware.itemListener(da, listener);
for (int i = 0; i < da.radioButtons.length; i++)
+ {
da.radioButtons[i].addItemListener(xil);
+ }
return da;
}
-
}
diff --git a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
index 5321757108a3..2dc261feb71b 100644
--- a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
@@ -29,14 +29,15 @@
************************************************************************/
package com.sun.star.wizards.ui.event;
-
-public class SimpleDataAware extends DataAware {
+public class SimpleDataAware extends DataAware
+{
protected Object control;
protected Object[] disableObjects = new Object[0];
protected Value controlValue;
- public SimpleDataAware(Object dataObject, Value value, Object control_, Value controlValue_ ) {
+ public SimpleDataAware(Object dataObject, Value value, Object control_, Value controlValue_)
+ {
super(dataObject, value);
control = control_;
controlValue = controlValue_;
@@ -44,14 +45,14 @@ public class SimpleDataAware extends DataAware {
/*
protected void enableControls(Object value) {
- Boolean b = getBoolean(value);
- for (int i = 0; i<disableObjects.length; i++)
- UIHelper.setEnabled(disableObjects[i],b);
+ Boolean b = getBoolean(value);
+ for (int i = 0; i<disableObjects.length; i++)
+ UIHelper.setEnabled(disableObjects[i],b);
}
- */
-
- protected void setToUI(Object value) {
- controlValue.set(value,control);
+ */
+ protected void setToUI(Object value)
+ {
+ controlValue.set(value, control);
}
/**
@@ -65,23 +66,22 @@ public class SimpleDataAware extends DataAware {
* @return
*/
/*protected Boolean getBoolean(Object value) {
- if (value==null)
- return Boolean.FALSE;
- if (value instanceof Boolean)
- return (Boolean)value;
- else if (value.getClass().isArray())
- return ((short[])value).length != 0 ? Boolean.TRUE : Boolean.FALSE;
- else if (value.equals("")) return Boolean.FALSE;
- else return Boolean.TRUE;
+ if (value==null)
+ return Boolean.FALSE;
+ if (value instanceof Boolean)
+ return (Boolean)value;
+ else if (value.getClass().isArray())
+ return ((short[])value).length != 0 ? Boolean.TRUE : Boolean.FALSE;
+ else if (value.equals("")) return Boolean.FALSE;
+ else return Boolean.TRUE;
}
public void disableControls(Object[] controls) {
- disableObjects = controls;
+ disableObjects = controls;
}
- */
-
- protected Object getFromUI() {
+ */
+ protected Object getFromUI()
+ {
return controlValue.get(control);
}
-
}
diff --git a/wizards/com/sun/star/wizards/ui/event/Task.java b/wizards/com/sun/star/wizards/ui/event/Task.java
index 38c26785132e..caf7239ccf67 100644
--- a/wizards/com/sun/star/wizards/ui/event/Task.java
+++ b/wizards/com/sun/star/wizards/ui/event/Task.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui.event;
+ ************************************************************************/
+package com.sun.star.wizards.ui.event;
import java.util.List;
import java.util.Vector;
@@ -37,120 +38,153 @@ import java.util.Vector;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class Task {
+public class Task
+{
+
private int successfull = 0;
private int failed = 0;
-
private int max = 0;
private String taskName;
private List listeners = new Vector();
private String subtaskName;
-
- public Task(String taskName_ , String subtaskName_, int max_) {
+ public Task(String taskName_, String subtaskName_, int max_)
+ {
taskName = taskName_;
subtaskName = subtaskName_;
max = max_;
}
- public void start() {
+ public void start()
+ {
fireTaskStarted();
}
- public void fail() {
+ public void fail()
+ {
fireTaskFailed();
}
- public int getMax() {
+ public int getMax()
+ {
return max;
}
- public void setMax(int max_) {
+ public void setMax(int max_)
+ {
max = max_;
fireTaskStatusChanged();
}
- public void advance(boolean success_) {
- if (success_) successfull++;
- else failed++;
+ public void advance(boolean success_)
+ {
+ if (success_)
+ {
+ successfull++;
+ }
+ else
+ {
+ failed++;
+ }
fireTaskStatusChanged();
- if (failed+successfull == max)
- fireTaskFinished();
+ if (failed + successfull == max)
+ {
+ fireTaskFinished();
+ }
}
- public void advance(boolean success_, String nextSubtaskName) {
+ public void advance(boolean success_, String nextSubtaskName)
+ {
advance(success_);
setSubtaskName(nextSubtaskName);
}
-
-
- public int getStatus() {
- return successfull+failed;
+ public int getStatus()
+ {
+ return successfull + failed;
}
- public void addTaskListener(TaskListener tl) {
+ public void addTaskListener(TaskListener tl)
+ {
listeners.add(tl);
}
- public void removeTaskListener(TaskListener tl) {
+ public void removeTaskListener(TaskListener tl)
+ {
listeners.remove(tl);
}
- protected void fireTaskStatusChanged() {
+ protected void fireTaskStatusChanged()
+ {
TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STATUS_CHANGED);
- for (int i = 0; i<listeners.size(); i++)
- ((TaskListener)listeners.get(i)).taskStatusChanged(te);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((TaskListener) listeners.get(i)).taskStatusChanged(te);
+ }
}
- protected void fireTaskStarted() {
+ protected void fireTaskStarted()
+ {
TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STARTED);
- for (int i = 0; i<listeners.size(); i++)
- ((TaskListener)listeners.get(i)).taskStarted(te);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((TaskListener) listeners.get(i)).taskStarted(te);
+ }
}
- protected void fireTaskFailed() {
- TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FAILED);
+ protected void fireTaskFailed()
+ {
+ TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FAILED);
- for (int i = 0; i<listeners.size(); i++)
- ((TaskListener)listeners.get(i)).taskFinished(te);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((TaskListener) listeners.get(i)).taskFinished(te);
}
+ }
- protected void fireTaskFinished() {
+ protected void fireTaskFinished()
+ {
TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FINISHED);
- for (int i = 0; i<listeners.size(); i++)
- ((TaskListener)listeners.get(i)).taskFinished(te);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((TaskListener) listeners.get(i)).taskFinished(te);
+ }
}
- protected void fireSubtaskNameChanged() {
+ protected void fireSubtaskNameChanged()
+ {
TaskEvent te = new TaskEvent(this, TaskEvent.SUBTASK_NAME_CHANGED);
- for (int i = 0; i<listeners.size(); i++)
- ((TaskListener)listeners.get(i)).subtaskNameChanged(te);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((TaskListener) listeners.get(i)).subtaskNameChanged(te);
+ }
}
-
/**
* @return
*/
- public String getSubtaskName() {
+ public String getSubtaskName()
+ {
return subtaskName;
}
/**
* @return
*/
- public String getTaskName() {
+ public String getTaskName()
+ {
return taskName;
}
/**
* @param string
*/
- public void setSubtaskName(String string) {
+ public void setSubtaskName(String string)
+ {
subtaskName = string;
fireSubtaskNameChanged();
}
@@ -158,15 +192,16 @@ public class Task {
/**
* @return
*/
- public int getFailed() {
+ public int getFailed()
+ {
return failed;
}
/**
* @return
*/
- public int getSuccessfull() {
+ public int getSuccessfull()
+ {
return successfull;
}
-
}
diff --git a/wizards/com/sun/star/wizards/ui/event/TaskEvent.java b/wizards/com/sun/star/wizards/ui/event/TaskEvent.java
index a1e850bc7477..9cb31bcd8c43 100644
--- a/wizards/com/sun/star/wizards/ui/event/TaskEvent.java
+++ b/wizards/com/sun/star/wizards/ui/event/TaskEvent.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui.event;
+ ************************************************************************/
+package com.sun.star.wizards.ui.event;
import java.util.EventObject;
@@ -36,14 +37,14 @@ import java.util.EventObject;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class TaskEvent extends EventObject {
+public class TaskEvent extends EventObject
+{
public static final int TASK_STARTED = 1;
public static final int TASK_FINISHED = 2;
public static final int TASK_STATUS_CHANGED = 3;
public static final int SUBTASK_NAME_CHANGED = 4;
public static final int TASK_FAILED = 5;
-
private int type;
/**
@@ -54,13 +55,14 @@ public class TaskEvent extends EventObject {
* @param success_
* @param failed_
*/
- public TaskEvent(Task source, int type_) {
+ public TaskEvent(Task source, int type_)
+ {
super(source);
type = type_;
}
- public Task getTask() {
- return (Task)getSource();
+ public Task getTask()
+ {
+ return (Task) getSource();
}
-
}
diff --git a/wizards/com/sun/star/wizards/ui/event/TaskListener.java b/wizards/com/sun/star/wizards/ui/event/TaskListener.java
index 976332107b79..5b90df8a0904 100644
--- a/wizards/com/sun/star/wizards/ui/event/TaskListener.java
+++ b/wizards/com/sun/star/wizards/ui/event/TaskListener.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.ui.event;
+ ************************************************************************/
+package com.sun.star.wizards.ui.event;
import java.util.EventListener;
@@ -36,7 +37,8 @@ import java.util.EventListener;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public interface TaskListener extends EventListener {
+public interface TaskListener extends EventListener
+{
public void taskStarted(TaskEvent te);
@@ -49,5 +51,4 @@ public interface TaskListener extends EventListener {
public void taskStatusChanged(TaskEvent te);
public void subtaskNameChanged(TaskEvent te);
-
}
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
index ad6e019a8196..d489ac9d47f4 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
@@ -45,7 +45,8 @@ import com.sun.star.wizards.common.Helper;
* SelectedItems[] property.
* For those controls, static convenience methods are offered, to simplify use.
*/
-public class UnoDataAware extends DataAware {
+public class UnoDataAware extends DataAware
+{
protected Object unoControl;
protected Object unoModel;
@@ -53,42 +54,54 @@ public class UnoDataAware extends DataAware {
protected Object[] disableObjects = new Object[0];
protected boolean inverse = false;
- protected UnoDataAware(Object dataObject, Value value, Object unoObject_, String unoPropName_) {
+ protected UnoDataAware(Object dataObject, Value value, Object unoObject_, String unoPropName_)
+ {
super(dataObject, value);
unoControl = unoObject_;
unoModel = getModel(unoControl);
unoPropName = unoPropName_;
}
- public void setInverse(boolean i) {
+ public void setInverse(boolean i)
+ {
inverse = i;
}
- protected void enableControls(Object value) {
+ protected void enableControls(Object value)
+ {
Boolean b = getBoolean(value);
if (inverse)
+ {
b = b.booleanValue() ? Boolean.FALSE : Boolean.TRUE;
+ }
for (int i = 0; i < disableObjects.length; i++)
+ {
setEnabled(disableObjects[i], b);
+ }
}
- protected void setToUI(Object value) {
+ protected void setToUI(Object value)
+ {
//System.out.println("Settings uno property : "+ Helper.getUnoPropertyValue(this.unoModel,"Name") + "<-" +stringof(value));
Helper.setUnoPropertyValue(unoModel, unoPropName, value);
}
- private String stringof(Object value) {
- if (value.getClass().isArray()) {
+ private String stringof(Object value)
+ {
+ if (value.getClass().isArray())
+ {
StringBuffer sb = new StringBuffer("[");
- for (int i = 0 ; i<((short[])value).length; i++)
- sb.append( ((short[])value)[i] ) .append(" , ");
+ for (int i = 0; i < ((short[]) value).length; i++)
+ {
+ sb.append(((short[]) value)[i]).append(" , ");
+ }
sb.append("]");
return sb.toString();
}
- else return value.toString();
-
-
-
+ else
+ {
+ return value.toString();
+ }
}
/**
@@ -101,118 +114,155 @@ public class UnoDataAware extends DataAware {
* @param value
* @return
*/
- protected Boolean getBoolean(Object value) {
+ protected Boolean getBoolean(Object value)
+ {
if (value == null)
+ {
return Boolean.FALSE;
+ }
if (value instanceof Boolean)
+ {
return (Boolean) value;
+ }
else if (value.getClass().isArray())
+ {
return ((short[]) value).length != 0 ? Boolean.TRUE : Boolean.FALSE;
+ }
else if (value.equals(""))
+ {
return Boolean.FALSE;
+ }
else if (value instanceof Number)
+ {
return ((Number) value).intValue() == 0 ? Boolean.TRUE : Boolean.FALSE;
+ }
else
+ {
return Boolean.TRUE;
+ }
}
- public void disableControls(Object[] controls) {
+ public void disableControls(Object[] controls)
+ {
disableObjects = controls;
}
- protected Object getFromUI() {
+ protected Object getFromUI()
+ {
return Helper.getUnoPropertyValue(unoModel, unoPropName);
}
- private static UnoDataAware attachTextControl(Object data, String prop, Object unoText, final Listener listener, String unoProperty, boolean field, Object value) {
+ private static UnoDataAware attachTextControl(Object data, String prop, Object unoText, final Listener listener, String unoProperty, boolean field, Object value)
+ {
XTextComponent text = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, unoText);
final UnoDataAware uda = new UnoDataAware(data,
- field
- ? DataAwareFields.getFieldValueFor(data,prop,value)
- : new DataAware.PropertyValue(prop,data),
- text, unoProperty);
- text.addTextListener(new XTextListener() {
- public void textChanged(TextEvent te) {
+ field
+ ? DataAwareFields.getFieldValueFor(data, prop, value)
+ : new DataAware.PropertyValue(prop, data),
+ text, unoProperty);
+ text.addTextListener(new XTextListener()
+ {
+
+ public void textChanged(TextEvent te)
+ {
uda.updateData();
if (listener != null)
+ {
listener.eventPerformed(te);
+ }
}
- public void disposing(EventObject eo) {
+
+ public void disposing(EventObject eo)
+ {
}
});
return uda;
}
-
- public static UnoDataAware attachEditControl(Object data, String prop, Object unoControl, Listener listener, boolean field) {
- return attachTextControl(data, prop, unoControl, listener, "Text",field, "");
+ public static UnoDataAware attachEditControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
+ {
+ return attachTextControl(data, prop, unoControl, listener, "Text", field, "");
}
-
- public static UnoDataAware attachDateControl(Object data, String prop, Object unoControl, Listener listener, boolean field) {
- return attachTextControl(data, prop, unoControl, listener, "Date",field, new Integer(0));
+ public static UnoDataAware attachDateControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
+ {
+ return attachTextControl(data, prop, unoControl, listener, "Date", field, new Integer(0));
}
-
- public static UnoDataAware attachTimeControl(Object data, String prop, Object unoControl, Listener listener, boolean field) {
+ public static UnoDataAware attachTimeControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
+ {
return attachTextControl(data, prop, unoControl, listener, "Time", field, new Integer(0));
}
- public static UnoDataAware attachNumericControl(Object data, String prop, Object unoControl, Listener listener, boolean field) {
- return attachTextControl(data, prop, unoControl, listener, "Value",field, new Double(0));
+ public static UnoDataAware attachNumericControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
+ {
+ return attachTextControl(data, prop, unoControl, listener, "Value", field, new Double(0));
}
- public static UnoDataAware attachCheckBox(Object data, String prop, Object checkBox, final Listener listener, boolean field) {
+ public static UnoDataAware attachCheckBox(Object data, String prop, Object checkBox, final Listener listener, boolean field)
+ {
XCheckBox xcheckBox = ((XCheckBox) UnoRuntime.queryInterface(XCheckBox.class, checkBox));
final UnoDataAware uda = new UnoDataAware(data,
- field
- ? DataAwareFields.getFieldValueFor(data,prop,new Short((short)0))
- : new DataAware.PropertyValue(prop,data),
- checkBox, "State");
+ field
+ ? DataAwareFields.getFieldValueFor(data, prop, new Short((short) 0))
+ : new DataAware.PropertyValue(prop, data),
+ checkBox, "State");
xcheckBox.addItemListener(itemListener(uda, listener));
return uda;
}
- static XItemListener itemListener(final DataAware da, final Listener listener) {
- return new XItemListener() {
- public void itemStateChanged(ItemEvent ie) {
+ static XItemListener itemListener(final DataAware da, final Listener listener)
+ {
+ return new XItemListener()
+ {
+
+ public void itemStateChanged(ItemEvent ie)
+ {
da.updateData();
- if (listener != null )
+ if (listener != null)
+ {
listener.eventPerformed(ie);
+ }
}
- public void disposing(EventObject eo) {
+
+ public void disposing(EventObject eo)
+ {
}
};
}
- public static UnoDataAware attachLabel(Object data, String prop, Object label, final Listener listener, boolean field) {
+ public static UnoDataAware attachLabel(Object data, String prop, Object label, final Listener listener, boolean field)
+ {
return new UnoDataAware(data,
- field ? DataAwareFields.getFieldValueFor(data,prop,"")
- : new DataAware.PropertyValue(prop,data),
- label , "Label");
+ field ? DataAwareFields.getFieldValueFor(data, prop, "")
+ : new DataAware.PropertyValue(prop, data),
+ label, "Label");
}
- public static UnoDataAware attachListBox(Object data, String prop, Object listBox, final Listener listener, boolean field) {
+ public static UnoDataAware attachListBox(Object data, String prop, Object listBox, final Listener listener, boolean field)
+ {
XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, listBox);
final UnoDataAware uda = new UnoDataAware(data,
- field
- ? DataAwareFields.getFieldValueFor(data,prop,new short[0])
- : new DataAware.PropertyValue(prop,data),
- listBox, "SelectedItems");
+ field
+ ? DataAwareFields.getFieldValueFor(data, prop, new short[0])
+ : new DataAware.PropertyValue(prop, data),
+ listBox, "SelectedItems");
xListBox.addItemListener(itemListener(uda, listener));
return uda;
}
- public static Object getModel(Object control) {
+ public static Object getModel(Object control)
+ {
return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel();
}
- public static void setEnabled(Object control, boolean enabled) {
+ public static void setEnabled(Object control, boolean enabled)
+ {
setEnabled(control, enabled ? Boolean.TRUE : Boolean.FALSE);
}
- public static void setEnabled(Object control, Boolean enabled) {
+ public static void setEnabled(Object control, Boolean enabled)
+ {
Helper.setUnoPropertyValue(getModel(control), "Enabled", enabled);
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java b/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java
index 75ac0d99101a..b92491879734 100644
--- a/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java
+++ b/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web;
+ ************************************************************************/
+package com.sun.star.wizards.web;
import com.sun.star.awt.VclWindowPeerAttribute;
import com.sun.star.awt.XWindowPeer;
@@ -40,15 +41,16 @@ import com.sun.star.wizards.common.SystemDialog;
* to render the errors, and displays
* error messeges.
*/
-
-public abstract class AbstractErrorHandler implements ErrorHandler {
+public abstract class AbstractErrorHandler implements ErrorHandler
+{
XMultiServiceFactory xmsf;
XWindowPeer peer;
- protected AbstractErrorHandler(XMultiServiceFactory xmsf, XWindowPeer peer_) {
+ protected AbstractErrorHandler(XMultiServiceFactory xmsf, XWindowPeer peer_)
+ {
this.xmsf = xmsf;
- peer=peer_;
+ peer = peer_;
}
/**
@@ -58,29 +60,31 @@ public abstract class AbstractErrorHandler implements ErrorHandler {
* which returns the right error message.
* @return true/false for continue/abort.
*/
- public boolean error(Exception ex, Object arg, int ix, int errorType) {
+ public boolean error(Exception ex, Object arg, int ix, int errorType)
+ {
//ex.printStackTrace();
- switch (errorType) {
- case ErrorHandler.ERROR_FATAL :
- return !showMessage(getMessageFor(ex,arg,ix,errorType) ,errorType);
- case ErrorHandler.ERROR_PROCESS_FATAL :
- return !showMessage(getMessageFor(ex,arg,ix,errorType),errorType );
- case ErrorHandler.ERROR_NORMAL_ABORT :
- return showMessage(getMessageFor(ex,arg,ix,errorType), errorType );
- case ErrorHandler.ERROR_NORMAL_IGNORE :
- return showMessage(getMessageFor(ex,arg,ix,errorType), errorType );
- case ErrorHandler.ERROR_QUESTION_CANCEL :
- return showMessage(getMessageFor(ex,arg,ix,errorType),errorType );
- case ErrorHandler.ERROR_QUESTION_OK :
- return showMessage(getMessageFor(ex,arg,ix,errorType),errorType );
+ switch (errorType)
+ {
+ case ErrorHandler.ERROR_FATAL:
+ return !showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
+ case ErrorHandler.ERROR_PROCESS_FATAL:
+ return !showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
+ case ErrorHandler.ERROR_NORMAL_ABORT:
+ return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
+ case ErrorHandler.ERROR_NORMAL_IGNORE:
+ return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
+ case ErrorHandler.ERROR_QUESTION_CANCEL:
+ return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
+ case ErrorHandler.ERROR_QUESTION_OK:
+ return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
case ErrorHandler.ERROR_QUESTION_NO:
- return showMessage(getMessageFor(ex,arg,ix,errorType),errorType );
- case ErrorHandler.ERROR_QUESTION_YES :
- return showMessage(getMessageFor(ex,arg,ix,errorType),errorType );
- case ErrorHandler.ERROR_WARNING :
- return showMessage(getMessageFor(ex,arg,ix,errorType),errorType );
- case ErrorHandler.ERROR_MESSAGE :
- return showMessage(getMessageFor(ex,arg,ix,errorType),errorType );
+ return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
+ case ErrorHandler.ERROR_QUESTION_YES:
+ return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
+ case ErrorHandler.ERROR_WARNING:
+ return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
+ case ErrorHandler.ERROR_MESSAGE:
+ return showMessage(getMessageFor(ex, arg, ix, errorType), errorType);
}
throw new IllegalArgumentException("unknown error type");
}
@@ -91,8 +95,9 @@ public abstract class AbstractErrorHandler implements ErrorHandler {
* @param errorType
* @return true if the ok/yes button is clicked, false otherwise.
*/
- protected boolean showMessage(String message, int errorType) {
- return showMessage(xmsf,peer, message,errorType);
+ protected boolean showMessage(String message, int errorType)
+ {
+ return showMessage(xmsf, peer, message, errorType);
}
/**
@@ -103,21 +108,22 @@ public abstract class AbstractErrorHandler implements ErrorHandler {
* @param errorType an int constant from the ErrorHandler interface.
* @return
*/
- public static boolean showMessage(XMultiServiceFactory xmsf, XWindowPeer peer, String message, int errorType) {
+ public static boolean showMessage(XMultiServiceFactory xmsf, XWindowPeer peer, String message, int errorType)
+ {
String serviceName = getServiceNameFor(errorType);
int attribute = getAttributeFor(errorType);
- int b = SystemDialog.showMessageBox(xmsf,peer, serviceName, attribute ,message);
+ int b = SystemDialog.showMessageBox(xmsf, peer, serviceName, attribute, message);
return b == getTrueFor(errorType);
}
-
public static boolean showMessage(XMultiServiceFactory xmsf, XWindowPeer peer,
String message,
String dialogtype,
int buttons,
int defaultButton,
- int returnTrueOn ) {
- int b = SystemDialog.showMessageBox(xmsf,peer, dialogtype, defaultButton + buttons ,message);
+ int returnTrueOn)
+ {
+ int b = SystemDialog.showMessageBox(xmsf, peer, dialogtype, defaultButton + buttons, message);
return b == returnTrueOn;
}
@@ -128,56 +134,59 @@ public abstract class AbstractErrorHandler implements ErrorHandler {
* @param errorType
* @return
*/
- private static int getTrueFor(int errorType) {
- switch (errorType) {
- case ErrorHandler.ERROR_FATAL :
- case ErrorHandler.ERROR_PROCESS_FATAL :
- case ErrorHandler.ERROR_NORMAL_ABORT :
- case ErrorHandler.ERROR_NORMAL_IGNORE :
- case ErrorHandler.ERROR_QUESTION_CANCEL :
+ private static int getTrueFor(int errorType)
+ {
+ switch (errorType)
+ {
+ case ErrorHandler.ERROR_FATAL:
+ case ErrorHandler.ERROR_PROCESS_FATAL:
+ case ErrorHandler.ERROR_NORMAL_ABORT:
+ case ErrorHandler.ERROR_NORMAL_IGNORE:
+ case ErrorHandler.ERROR_QUESTION_CANCEL:
case ErrorHandler.ERROR_QUESTION_OK:
return 1;
- case ErrorHandler.ERROR_QUESTION_NO :
+ case ErrorHandler.ERROR_QUESTION_NO:
case ErrorHandler.ERROR_QUESTION_YES:
return 2;
- case ErrorHandler.ERROR_WARNING :
- case ErrorHandler.ERROR_MESSAGE :
+ case ErrorHandler.ERROR_WARNING:
+ case ErrorHandler.ERROR_MESSAGE:
return 1;
}
throw new IllegalArgumentException("unkonown error type");
}
-
/**
* @param errorType
* @return the Uno attributes for each error type.
*/
- private static int getAttributeFor(int errorType) {
- switch (errorType) {
- case ErrorHandler.ERROR_FATAL :
+ private static int getAttributeFor(int errorType)
+ {
+ switch (errorType)
+ {
+ case ErrorHandler.ERROR_FATAL:
return VclWindowPeerAttribute.OK;
- case ErrorHandler.ERROR_PROCESS_FATAL :
+ case ErrorHandler.ERROR_PROCESS_FATAL:
return VclWindowPeerAttribute.OK;
- case ErrorHandler.ERROR_NORMAL_ABORT :
+ case ErrorHandler.ERROR_NORMAL_ABORT:
return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_CANCEL;
- case ErrorHandler.ERROR_NORMAL_IGNORE :
+ case ErrorHandler.ERROR_NORMAL_IGNORE:
return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_OK;
- case ErrorHandler.ERROR_QUESTION_CANCEL :
+ case ErrorHandler.ERROR_QUESTION_CANCEL:
return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_CANCEL;
case ErrorHandler.ERROR_QUESTION_OK:
return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_OK;
- case ErrorHandler.ERROR_QUESTION_NO :
+ case ErrorHandler.ERROR_QUESTION_NO:
return VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO;
case ErrorHandler.ERROR_QUESTION_YES:
return VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_YES;
- case ErrorHandler.ERROR_WARNING :
+ case ErrorHandler.ERROR_WARNING:
return VclWindowPeerAttribute.OK;
- case ErrorHandler.ERROR_MESSAGE :
+ case ErrorHandler.ERROR_MESSAGE:
return VclWindowPeerAttribute.OK;
}
throw new IllegalArgumentException("unkonown error type");
@@ -188,27 +197,29 @@ public abstract class AbstractErrorHandler implements ErrorHandler {
* @param errorType
* @return the uno service name for each error type
*/
- private static String getServiceNameFor(int errorType) {
- switch (errorType) {
- case ErrorHandler.ERROR_FATAL :
+ private static String getServiceNameFor(int errorType)
+ {
+ switch (errorType)
+ {
+ case ErrorHandler.ERROR_FATAL:
return "errorbox";
- case ErrorHandler.ERROR_PROCESS_FATAL :
+ case ErrorHandler.ERROR_PROCESS_FATAL:
return "errorbox";
- case ErrorHandler.ERROR_NORMAL_ABORT :
+ case ErrorHandler.ERROR_NORMAL_ABORT:
return "errorbox";
- case ErrorHandler.ERROR_NORMAL_IGNORE :
+ case ErrorHandler.ERROR_NORMAL_IGNORE:
return "warningbox";
- case ErrorHandler.ERROR_QUESTION_CANCEL :
+ case ErrorHandler.ERROR_QUESTION_CANCEL:
return "querybox";
- case ErrorHandler.ERROR_QUESTION_OK :
+ case ErrorHandler.ERROR_QUESTION_OK:
return "querybox";
case ErrorHandler.ERROR_QUESTION_NO:
return "querybox";
case ErrorHandler.ERROR_QUESTION_YES:
return "querybox";
- case ErrorHandler.ERROR_WARNING :
+ case ErrorHandler.ERROR_WARNING:
return "warningbox";
- case ErrorHandler.ERROR_MESSAGE :
+ case ErrorHandler.ERROR_MESSAGE:
return "infobox";
}
throw new IllegalArgumentException("unkonown error type");
@@ -225,7 +236,6 @@ public abstract class AbstractErrorHandler implements ErrorHandler {
* and which describes the error, and the needed action from the user.
*/
protected abstract String getMessageFor(Exception ex, Object arg, int ix, int type);
-
}
diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java
index e9bc7334b7fa..0f42d4be15c0 100644
--- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java
+++ b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java
@@ -47,7 +47,8 @@ import com.sun.star.wizards.web.data.CGSettings;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class BackgroundsDialog extends ImageListDialog {
+public class BackgroundsDialog extends ImageListDialog
+{
private FileAccess fileAccess;
private SystemDialog sd;
@@ -57,36 +58,37 @@ public class BackgroundsDialog extends ImageListDialog {
* @param xmsf
*/
public BackgroundsDialog(
- XMultiServiceFactory xmsf,
- ConfigSet set_, WebWizardDialogResources resources) throws Exception {
-
- super(xmsf, WWHID.HID_BG, new String[] {
- resources.resBackgroundsDialog,
- resources.resBackgroundsDialogCaption,
- resources.resOK,
- resources.resCancel,
- resources.resHelp,
- resources.resDeselect,
- resources.resOther,
- resources.resCounter
- } );
+ XMultiServiceFactory xmsf,
+ ConfigSet set_, WebWizardDialogResources resources) throws Exception
+ {
+
+ super(xmsf, WWHID.HID_BG, new String[]
+ {
+ resources.resBackgroundsDialog,
+ resources.resBackgroundsDialogCaption,
+ resources.resOK,
+ resources.resCancel,
+ resources.resHelp,
+ resources.resDeselect,
+ resources.resOther,
+ resources.resCounter
+ });
sd = SystemDialog.createOpenDialog(xmsf);
- sd.addFilter(resources.resImages,"*.jpg;*.jpeg;*.jpe;*.gif",true);
- sd.addFilter(resources.resAllFiles,"*.*",false);
+ sd.addFilter(resources.resImages, "*.jpg;*.jpeg;*.jpe;*.gif", true);
+ sd.addFilter(resources.resAllFiles, "*.*", false);
- settings = (CGSettings)set_.root;
+ settings = (CGSettings) set_.root;
fileAccess = new FileAccess(xmsf);
il.setListModel(new Model(set_));
- il.setImageSize( new Size(40,40));
+ il.setImageSize(new Size(40, 40));
il.setRenderer(new BGRenderer(0));
build();
}
-
/**
* trigered when the user clicks the "other" button.
* opens a "file open" dialog, adds the selected
@@ -94,9 +96,11 @@ public class BackgroundsDialog extends ImageListDialog {
* and then jumps to the new image, selecting it in the list.
* @see add(String)
*/
- public void other() {
- String filename[] = sd.callOpenDialog(false,settings.cp_DefaultSession.cp_InDirectory);
- if (filename != null && filename.length > 0 && filename[0] != null) {
+ public void other()
+ {
+ String filename[] = sd.callOpenDialog(false, settings.cp_DefaultSession.cp_InDirectory);
+ if (filename != null && filename.length > 0 && filename[0] != null)
+ {
settings.cp_DefaultSession.cp_InDirectory = FileAccess.getParentDir(filename[0]);
int i = add(filename[0]);
il.setSelected(i);
@@ -110,22 +114,28 @@ public class BackgroundsDialog extends ImageListDialog {
* @param s
* @return
*/
- private int add(String s) {
+ private int add(String s)
+ {
//first i check the item does not already exists in the list...
- for (int i = 0; i<il.getListModel().getSize(); i++)
+ for (int i = 0; i < il.getListModel().getSize(); i++)
+ {
if (il.getListModel().getElementAt(i).equals(s))
+ {
return i;
-
- ((DefaultListModel)il.getListModel()).addElement(s);
- try {
- Object configView = Configuration.getConfigurationRoot(xMSF,FileAccess.connectURLs(WebWizardConst.CONFIG_PATH , "BackgroundImages"),true);
+ }
+ }
+ ((DefaultListModel) il.getListModel()).addElement(s);
+ try
+ {
+ Object configView = Configuration.getConfigurationRoot(xMSF, FileAccess.connectURLs(WebWizardConst.CONFIG_PATH, "BackgroundImages"), true);
int i = Configuration.getChildrenNames(configView).length + 1;
- Object o = Configuration.addConfigNode(configView,"" + i);
- Configuration.set(s, "Href",o);
+ Object o = Configuration.addConfigNode(configView, "" + i);
+ Configuration.set(s, "Href", o);
Configuration.commit(configView);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
@@ -141,25 +151,32 @@ public class BackgroundsDialog extends ImageListDialog {
* @author rpiterman
*
*/
- private class BGRenderer implements ImageList.ImageRenderer {
- private int cut;
+ private class BGRenderer implements ImageList.ImageRenderer
+ {
- public BGRenderer(int cut_) {
- cut = cut_;
- }
- public Object[] getImageUrls(Object listItem) {
- Object[] sRetUrls;
- if (listItem != null){
- sRetUrls = new Object[1];
- sRetUrls[0] = listItem;
- return sRetUrls;
- }
- return null;
- }
- public String render(Object object) {
- return object == null ? "" :
- FileAccess.getPathFilename(fileAccess.getPath((String)object,null));
+ private int cut;
+
+ public BGRenderer(int cut_)
+ {
+ cut = cut_;
+ }
+
+ public Object[] getImageUrls(Object listItem)
+ {
+ Object[] sRetUrls;
+ if (listItem != null)
+ {
+ sRetUrls = new Object[1];
+ sRetUrls[0] = listItem;
+ return sRetUrls;
}
+ return null;
+ }
+
+ public String render(Object object)
+ {
+ return object == null ? "" : FileAccess.getPathFilename(fileAccess.getPath((String) object, null));
+ }
}
/**
@@ -172,29 +189,38 @@ public class BackgroundsDialog extends ImageListDialog {
* if it is a file, it adds the file to the list.
* @author rpiterman
*/
- private class Model extends DefaultListModel {
-
- /**
- * constructor. </br>
- * see class description for a description of
- * the handling of the given model
- * @param model the configuration set of the background images.
- */
- public Model(ConfigSet model) {
- try {
- for (int i = 0; i<model.getSize(); i++) {
- CGImage image = (CGImage)model.getElementAt(i);
- String path = sd.xStringSubstitution.substituteVariables(image.cp_Href,false);
- if (fileAccess.exists(path,false))
- addDir(path);
- else
- remove((String)model.getKey(image));
- }
- }
- catch (Exception ex) {
- ex.printStackTrace();
- }
- }
+ private class Model extends DefaultListModel
+ {
+
+ /**
+ * constructor. </br>
+ * see class description for a description of
+ * the handling of the given model
+ * @param model the configuration set of the background images.
+ */
+ public Model(ConfigSet model)
+ {
+ try
+ {
+ for (int i = 0; i < model.getSize(); i++)
+ {
+ CGImage image = (CGImage) model.getElementAt(i);
+ String path = sd.xStringSubstitution.substituteVariables(image.cp_Href, false);
+ if (fileAccess.exists(path, false))
+ {
+ addDir(path);
+ }
+ else
+ {
+ remove((String) model.getKey(image));
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
/**
* when instanciating the model, it checks if each image
@@ -203,15 +229,18 @@ public class BackgroundsDialog extends ImageListDialog {
* This is what this method does...
* @param imageName
*/
- private void remove(String imageName) {
- try {
- Object conf = Configuration.getConfigurationRoot(xMSF,WebWizardConst.CONFIG_PATH + "/BackgroundImages",true);
- Configuration.removeNode(conf,imageName);
- }
- catch (Exception ex) {
- ex.printStackTrace();
- }
- }
+ private void remove(String imageName)
+ {
+ try
+ {
+ Object conf = Configuration.getConfigurationRoot(xMSF, WebWizardConst.CONFIG_PATH + "/BackgroundImages", true);
+ Configuration.removeNode(conf, imageName);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
/**
* if the given url is a directory
@@ -219,22 +248,30 @@ public class BackgroundsDialog extends ImageListDialog {
* otherwise (if it is a file) adds the file to the list.
* @param url
*/
- private void addDir(String url) {
- if (fileAccess.isDirectory(url))
- add(fileAccess.listFiles(url,false));
- else
- add(url);
- }
+ private void addDir(String url)
+ {
+ if (fileAccess.isDirectory(url))
+ {
+ add(fileAccess.listFiles(url, false));
+ }
+ else
+ {
+ add(url);
+ }
+ }
/**
* adds the given filenames (urls) to
* the list
* @param filenames
*/
- private void add(String[] filenames) {
- for (int i = 0; i<filenames.length; i++)
- add(filenames[i]);
- }
+ private void add(String[] filenames)
+ {
+ for (int i = 0; i < filenames.length; i++)
+ {
+ add(filenames[i]);
+ }
+ }
/**
* adds the given image url to the list.
@@ -242,13 +279,15 @@ public class BackgroundsDialog extends ImageListDialog {
* (case insensitive)
* @param filename image url.
*/
- private void add(String filename) {
- String lcase = filename.toLowerCase();
- if (lcase.endsWith("jpg") ||
- lcase.endsWith("jpeg") ||
- lcase.endsWith("gif")
- )
- Model.this.addElement(filename);
- }
- }
+ private void add(String filename)
+ {
+ String lcase = filename.toLowerCase();
+ if (lcase.endsWith("jpg") ||
+ lcase.endsWith("jpeg") ||
+ lcase.endsWith("gif"))
+ {
+ Model.this.addElement(filename);
+ }
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/web/CallWizard.java b/wizards/com/sun/star/wizards/web/CallWizard.java
index 7dbc7d4e5074..4d417afc986d 100644
--- a/wizards/com/sun/star/wizards/web/CallWizard.java
+++ b/wizards/com/sun/star/wizards/web/CallWizard.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web;
+ ************************************************************************/
+package com.sun.star.wizards.web;
import com.sun.star.beans.XPropertyAccess;
import com.sun.star.comp.loader.FactoryHelper;
@@ -48,9 +49,10 @@ import com.sun.star.wizards.common.Resource;
* information into the given registry key (<CODE>__writeRegistryServiceInfo</CODE>).
*
* @author rpiterman
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.10.52.1 $
*/
-public class CallWizard {
+public class CallWizard
+{
/**
* Gives a factory for creating the service. This method is called by the
@@ -67,10 +69,12 @@ public class CallWizard {
*
* @see com.sun.star.comp.loader.JavaLoader#
*/
- public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey) {
+ public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey)
+ {
XSingleServiceFactory xsingleservicefactory = null;
- if (stringImplementationName.equals(WizardImplementation.class.getName())) {
+ if (stringImplementationName.equals(WizardImplementation.class.getName()))
+ {
xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey);
}
@@ -88,7 +92,8 @@ public class CallWizard {
*
* @see com.sun.star.comp.loader.JavaLoader#
*/
- public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey) {
+ public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey)
+ {
return FactoryHelper.writeRegistryServiceInfo(WizardImplementation.class.getName(), WizardImplementation.__serviceName, xregistrykey);
}
@@ -96,7 +101,8 @@ public class CallWizard {
* This class implements the component. At least the interfaces XServiceInfo,
* XTypeProvider, and XInitialization should be provided by the service.
*/
- public static class WizardImplementation implements XInitialization, XTypeProvider, XServiceInfo, XJobExecutor {
+ public static class WizardImplementation implements XInitialization, XTypeProvider, XServiceInfo, XJobExecutor
+ {
/**
* The constructor of the inner class has a XMultiServiceFactory parameter.
@@ -104,63 +110,70 @@ public class CallWizard {
* @param xmultiservicefactoryInitialization A special service factory could be
* introduced while initializing.
*/
- public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization) {
+ public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
xmultiservicefactory = xmultiservicefactoryInitialization;
- if (xmultiservicefactory != null) {
-
+ if (xmultiservicefactory != null)
+ {
}
}
-
private static WebWizard webWizard = null;
+
/**
* Execute Wizard
*
* @param str only valid parameter is 'start' at the moment.
*/
- public void trigger(String str) {
- if (str.equalsIgnoreCase("start")) {
- if (webWizard == null) {
+ public void trigger(String str)
+ {
+ if (str.equalsIgnoreCase("start"))
+ {
+ if (webWizard == null)
+ {
WebWizard ww = null;
- try {
+ try
+ {
webWizard = new WebWizard(xmultiservicefactory);
ww = webWizard;
webWizard.show();
webWizard = null;
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
webWizard = null;
ex.printStackTrace();
Resource.showCommonResourceError(xmultiservicefactory);
}
- finally {
+ finally
+ {
webWizard = null;
- try {
+ try
+ {
if (ww != null)
+ {
ww.cleanup();
+ }
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
}
- else {
+ else
+ {
webWizard.activate();
}
}
- }
-
-
- //*******************************************
-
+ } //*******************************************
/**
* The service name, that must be used to get an instance of this service.
*/
private static final String __serviceName = "com.sun.star.wizards.web.CallWizard";
-
/**
* The service manager, that gives access to all registered services.
*/
@@ -176,7 +189,8 @@ public class CallWizard {
* @throws com.sun.star.uno.Exception Every exception will not be handled, but
* will be passed to the caller.
*/
- public void initialize(Object[] object) throws com.sun.star.uno.Exception {
+ public void initialize(Object[] object) throws com.sun.star.uno.Exception
+ {
//wizardStarted = false;
}
@@ -185,7 +199,8 @@ public class CallWizard {
*
* @return Array of supported service names.
*/
- public java.lang.String[] getSupportedServiceNames() {
+ public java.lang.String[] getSupportedServiceNames()
+ {
String[] stringSupportedServiceNames = new String[1];
stringSupportedServiceNames[0] = __serviceName;
@@ -200,10 +215,12 @@ public class CallWizard {
*
* @return True, if the given service name will be supported.
*/
- public boolean supportsService(String stringService) {
+ public boolean supportsService(String stringService)
+ {
boolean booleanSupportsService = false;
- if (stringService.equals(__serviceName)) {
+ if (stringService.equals(__serviceName))
+ {
booleanSupportsService = true;
}
@@ -221,13 +238,18 @@ public class CallWizard {
*
* @return Array of bytes, in order to distinguish between two sets.
*/
- public byte[] getImplementationId() {
- byte[] byteReturn = {
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
};
- try {
+ try
+ {
byteReturn = ("" + this.hashCode()).getBytes();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
@@ -239,7 +261,8 @@ public class CallWizard {
*
* @return Class name of the component.
*/
- public java.lang.String getImplementationName() {
+ public java.lang.String getImplementationName()
+ {
return (WizardImplementation.class.getName());
}
@@ -250,13 +273,21 @@ public class CallWizard {
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
- public com.sun.star.uno.Type[] getTypes() {
- Type[] typeReturn = {
+ public com.sun.star.uno.Type[] getTypes()
+ {
+ Type[] typeReturn =
+ {
};
- try {
- typeReturn = new Type[] { new Type(XPropertyAccess.class), new Type(XJob.class), new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class)};
- } catch (Exception exception) {
+ try
+ {
+ typeReturn = new Type[]
+ {
+ new Type(XPropertyAccess.class), new Type(XJob.class), new Type(XJobExecutor.class), new Type(XTypeProvider.class), new Type(XServiceInfo.class), new Type(XInitialization.class)
+ };
+ }
+ catch (Exception exception)
+ {
System.err.println(exception);
}
@@ -264,14 +295,14 @@ public class CallWizard {
}
}
-
-
- public static void main(String[] s) {
+ public static void main(String[] s)
+ {
String ConnectStr =
- "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
+ "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
//localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- try {
+ try
+ {
XMultiServiceFactory xmsf = Desktop.connect(ConnectStr);
//File dir = new File("D:\\CWS\\extras6");//("C:\\Documents and Settings\\rpiterman\\My Documents");
//getFiles(dir,xLocMSF);
@@ -280,9 +311,10 @@ public class CallWizard {
CallWizard.WizardImplementation ww = new CallWizard.WizardImplementation(xmsf);
ww.trigger("start");
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/ErrorHandler.java b/wizards/com/sun/star/wizards/web/ErrorHandler.java
index a4dd0f4902e1..83f35a98bcf3 100644
--- a/wizards/com/sun/star/wizards/web/ErrorHandler.java
+++ b/wizards/com/sun/star/wizards/web/ErrorHandler.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web;
+ ************************************************************************/
+package com.sun.star.wizards.web;
import com.sun.star.awt.VclWindowPeerAttribute;
@@ -36,96 +37,84 @@ import com.sun.star.awt.VclWindowPeerAttribute;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public interface ErrorHandler {
-
-
-
- public static final String MESSAGE_INFO = "infobox";
- public static final String MESSAGE_QUESTION = "querybox";
- public static final String MESSAGE_ERROR = "errorbox";
- public static final String MESSAGE_WARNING = "warningbox";
-
-
- public static int BUTTONS_OK = VclWindowPeerAttribute.OK;
- public static int BUTTONS_OK_CANCEL = VclWindowPeerAttribute.OK_CANCEL;
- public static int BUTTONS_YES_NO = VclWindowPeerAttribute.YES_NO;
-
- public static int RESULT_CANCEL = 0;
- public static int RESULT_OK = 1;
- public static int RESULT_YES = 2;
-
-
- public static int DEF_OK = VclWindowPeerAttribute.DEF_OK;
- public static int DEF_CANCEL = VclWindowPeerAttribute.DEF_CANCEL;
- public static int DEF_YES = VclWindowPeerAttribute.DEF_YES;
- public static int DEF_NO = VclWindowPeerAttribute.DEF_NO;
-
-
-
-
- /**
- * Error type for fatal errors which should abort application
- * execution. Should actually never be used :-)
- */
- public static final int ERROR_FATAL = 0;
- /**
- * An Error type for errors which should stop the current process.
- */
- public static final int ERROR_PROCESS_FATAL = 1;
- /**
- * An Error type for errors to which the user can choose, whether
- * to continue or to abort the current process.
- * default is abort.
- */
- public static final int ERROR_NORMAL_ABORT = 2;
- /**
- * An Error type for errors to which the user can choose, whether
- * to continue or to abort the current process.
- * default is continue.
- */
- public static final int ERROR_NORMAL_IGNORE = 3;
- /**
- * An error type for warnings which requires user interaction.
- * (a question :-) )
- * Default is abort (cancel).
- */
- public static final int ERROR_QUESTION_CANCEL = 4;
- /**
- * An error type for warnings which requires user interaction
- * (a question :-) )
- * Default is to continue (ok).
- */
- public static final int ERROR_QUESTION_OK = 5;
- /**
- * An error type for warnings which requires user interaction.
- * (a question :-) )
- * Default is abort (No).
- */
- public static final int ERROR_QUESTION_NO = 6;
- /**
- * An error type for warnings which requires user interaction
- * (a question :-) )
- * Default is to continue (Yes).
- */
- public static final int ERROR_QUESTION_YES = 7;
- /**
- * An error type which is just a warning...
- */
- public static final int ERROR_WARNING = 8;
- /**
- * An error type which just tells the user something
- * ( like "you look tired! you should take a bath! and so on)
- */
- public static final int ERROR_MESSAGE = 9;
-
-
-
- /**
- * @param ex the exception that accured
- * @param arg an object as help for recognizing the exception
- * @param ix an integer which helps for detailed recognizing of the exception
- * @param errorType one of the int constants defined by this Interface
- * @return true if the execution should continue, false if it should stop.
- */
- public boolean error(Exception ex, Object arg, int ix ,int errorType);
+public interface ErrorHandler
+{
+
+ public static final String MESSAGE_INFO = "infobox";
+ public static final String MESSAGE_QUESTION = "querybox";
+ public static final String MESSAGE_ERROR = "errorbox";
+ public static final String MESSAGE_WARNING = "warningbox";
+ public static int BUTTONS_OK = VclWindowPeerAttribute.OK;
+ public static int BUTTONS_OK_CANCEL = VclWindowPeerAttribute.OK_CANCEL;
+ public static int BUTTONS_YES_NO = VclWindowPeerAttribute.YES_NO;
+ public static int RESULT_CANCEL = 0;
+ public static int RESULT_OK = 1;
+ public static int RESULT_YES = 2;
+ public static int DEF_OK = VclWindowPeerAttribute.DEF_OK;
+ public static int DEF_CANCEL = VclWindowPeerAttribute.DEF_CANCEL;
+ public static int DEF_YES = VclWindowPeerAttribute.DEF_YES;
+ public static int DEF_NO = VclWindowPeerAttribute.DEF_NO;
+ /**
+ * Error type for fatal errors which should abort application
+ * execution. Should actually never be used :-)
+ */
+ public static final int ERROR_FATAL = 0;
+ /**
+ * An Error type for errors which should stop the current process.
+ */
+ public static final int ERROR_PROCESS_FATAL = 1;
+ /**
+ * An Error type for errors to which the user can choose, whether
+ * to continue or to abort the current process.
+ * default is abort.
+ */
+ public static final int ERROR_NORMAL_ABORT = 2;
+ /**
+ * An Error type for errors to which the user can choose, whether
+ * to continue or to abort the current process.
+ * default is continue.
+ */
+ public static final int ERROR_NORMAL_IGNORE = 3;
+ /**
+ * An error type for warnings which requires user interaction.
+ * (a question :-) )
+ * Default is abort (cancel).
+ */
+ public static final int ERROR_QUESTION_CANCEL = 4;
+ /**
+ * An error type for warnings which requires user interaction
+ * (a question :-) )
+ * Default is to continue (ok).
+ */
+ public static final int ERROR_QUESTION_OK = 5;
+ /**
+ * An error type for warnings which requires user interaction.
+ * (a question :-) )
+ * Default is abort (No).
+ */
+ public static final int ERROR_QUESTION_NO = 6;
+ /**
+ * An error type for warnings which requires user interaction
+ * (a question :-) )
+ * Default is to continue (Yes).
+ */
+ public static final int ERROR_QUESTION_YES = 7;
+ /**
+ * An error type which is just a warning...
+ */
+ public static final int ERROR_WARNING = 8;
+ /**
+ * An error type which just tells the user something
+ * ( like "you look tired! you should take a bath! and so on)
+ */
+ public static final int ERROR_MESSAGE = 9;
+
+ /**
+ * @param ex the exception that accured
+ * @param arg an object as help for recognizing the exception
+ * @param ix an integer which helps for detailed recognizing of the exception
+ * @param errorType one of the int constants defined by this Interface
+ * @return true if the execution should continue, false if it should stop.
+ */
+ public boolean error(Exception ex, Object arg, int ix, int errorType);
}
diff --git a/wizards/com/sun/star/wizards/web/ExtensionVerifier.java b/wizards/com/sun/star/wizards/web/ExtensionVerifier.java
index fd42df79830c..463c5c18f58a 100644
--- a/wizards/com/sun/star/wizards/web/ExtensionVerifier.java
+++ b/wizards/com/sun/star/wizards/web/ExtensionVerifier.java
@@ -40,11 +40,14 @@ import com.sun.star.wizards.common.UCB;
* all the files that do *not* end with xsl.
*
*/
-public class ExtensionVerifier implements UCB.Verifier {
+public class ExtensionVerifier implements UCB.Verifier
+{
+
private String extension;
- public ExtensionVerifier(String extension_) {
- extension="." + extension_;
+ public ExtensionVerifier(String extension_)
+ {
+ extension = "." + extension_;
}
/**
@@ -52,10 +55,12 @@ public class ExtensionVerifier implements UCB.Verifier {
* a String which does not end with the
* given extension.
*/
- public boolean verify(Object object) {
+ public boolean verify(Object object)
+ {
if (object instanceof String)
- return !((String)object).endsWith(extension);
+ {
+ return !((String) object).endsWith(extension);
+ }
return false;
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java
index cd1533033cb8..3352b1dff07f 100644
--- a/wizards/com/sun/star/wizards/web/FTPDialog.java
+++ b/wizards/com/sun/star/wizards/web/FTPDialog.java
@@ -73,14 +73,15 @@ import com.sun.star.wizards.web.data.CGSettings;
* the members ip, username, and password (via the methods setXXX(...))
* for details see the ui.events.DataAware classes. <br/>
*/
-public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
+public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
+{
/**
* A Constant used for the setLabel(int) method to change the
* status-display. "unknown" is the status when the user first
* opens the dialog, or changes the servername/username/password.
*/
- private final static int STATUS_UNKONWN= 0;
+ private final static int STATUS_UNKONWN = 0;
/**
* A Constant used for the setLabel(int) method to change the
* status-display. (connection established)
@@ -111,7 +112,6 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* status-display.
*/
private final static int STATUS_CONNECTING = 6;
-
/**
* The icon url for error
*/
@@ -124,14 +124,11 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* The icon url for unknown - this is the status when
* the user first opens the dialog
*/
- private final static String ICON_UNKNOWN= "ftpunknown.gif";
+ private final static String ICON_UNKNOWN = "ftpunknown.gif";
/**
* The icon url for an icon representing the "connecting" state.
*/
- private final static String ICON_CONNECTING = "ftpconnecting.gif";
-
-
- //GUI Components as Class members.
+ private final static String ICON_CONNECTING = "ftpconnecting.gif"; //GUI Components as Class members.
//Fixed Line
private XControl ln1;
private XFixedText lblFTPAddress;
@@ -156,9 +153,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
//Resources Object
private FTPDialogResources resources;
-
private List dataAware = new Vector();
-
public String username = "";
public String password = "";
/**
@@ -169,7 +164,6 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* The ftp directory.
*/
private String dir = "";
-
/**
* the ftp publish object which contains the
* data for this dialog.
@@ -189,13 +183,13 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* for this dialog
* @throws Exception
*/
-
- public FTPDialog(XMultiServiceFactory xmsf, CGPublish p) throws Exception {
+ public FTPDialog(XMultiServiceFactory xmsf, CGPublish p) throws Exception
+ {
super(xmsf);
publish = p;
- imagesDirectory = FileAccess.connectURLs(((CGSettings)(publish.root)).soTemplateDir, "wizard/bitmap/");
+ imagesDirectory = FileAccess.connectURLs(((CGSettings) (publish.root)).soTemplateDir, "wizard/bitmap/");
//Load Resources
resources = new FTPDialogResources(xmsf);
@@ -203,8 +197,14 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
//set dialog properties...
Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Closeable", "Height", "HelpURL", "Moveable", "Name", "PositionX", "PositionY", "Title", "Width" },
- new Object[] { Boolean.TRUE, new Integer(160), "HID:" + HID_FTP , Boolean.TRUE, "FTPDialog", new Integer(167), new Integer(82), resources.resFTPDialog_title, new Integer(222)});
+ new String[]
+ {
+ "Closeable", "Height", "HelpURL", "Moveable", "Name", "PositionX", "PositionY", "Title", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(160), "HID:" + HID_FTP, Boolean.TRUE, "FTPDialog", new Integer(167), new Integer(82), resources.resFTPDialog_title, new Integer(222)
+ });
//add controls to dialog
build();
@@ -217,77 +217,154 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
/**
* Add controls to dialog.
*/
- public void build() {
- final String[] PROPNAMES_LABEL = new String[] { "Height", "Label", "Name", "PositionX", "PositionY", "TabIndex", "Width" };
- final String[] PROPNAMES_BUTTON = new String[] { "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "TabIndex", "Width"};
- final String[] PROPNAMES_BUTTON2 = new String[] { "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "PushButtonType", "TabIndex", "Width"};
+ public void build()
+ {
+ final String[] PROPNAMES_LABEL = new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "TabIndex", "Width"
+ };
+ final String[] PROPNAMES_BUTTON = new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "TabIndex", "Width"
+ };
+ final String[] PROPNAMES_BUTTON2 = new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "PushButtonType", "TabIndex", "Width"
+ };
ln1 = insertFixedLine("ln1",
- PROPNAMES_LABEL,
- new Object[] { INTEGERS[8], resources.resln1_value, "ln1", INTEGERS[6], INTEGERS[6], new Short((short) 0), new Integer(210)});
+ PROPNAMES_LABEL,
+ new Object[]
+ {
+ INTEGERS[8], resources.resln1_value, "ln1", INTEGERS[6], INTEGERS[6], new Short((short) 0), new Integer(210)
+ });
lblFTPAddress = insertLabel("lblFTPAddress",
- PROPNAMES_LABEL,
- new Object[] { INTEGERS[8], resources.reslblFTPAddress_value, "lblFTPAddress", INTEGER_12, new Integer(20), new Short((short) 1), new Integer(95)});
+ PROPNAMES_LABEL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblFTPAddress_value, "lblFTPAddress", INTEGER_12, new Integer(20), new Short((short) 1), new Integer(95)
+ });
txtHost = insertTextField("txtHost", "disconnect",
- new String[] { "Height", "HelpURL", "Name", "PositionX", "PositionY", "TabIndex", "Width" },
- new Object[] { INTEGER_12, "HID:" + HID_FTP_SERVER, "txtIP", new Integer(110), new Integer(18), new Short((short) 2), new Integer(106)});
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID_FTP_SERVER, "txtIP", new Integer(110), new Integer(18), new Short((short) 2), new Integer(106)
+ });
lblUsername = insertLabel("lblUsername",
- PROPNAMES_LABEL,
- new Object[] { INTEGERS[8], resources.reslblUsername_value, "lblUsername", INTEGER_12, new Integer(36), new Short((short) 3), new Integer(85)});
+ PROPNAMES_LABEL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblUsername_value, "lblUsername", INTEGER_12, new Integer(36), new Short((short) 3), new Integer(85)
+ });
txtUsername = insertTextField("txtUsername", "disconnect",
- new String[] { "Height", "HelpURL", "Name", "PositionX", "PositionY", "TabIndex", "Width" },
- new Object[] { INTEGER_12, "HID:" + HID_FTP_USERNAME , "txtUsername", new Integer(110), new Integer(34), new Short((short) 4), new Integer(106)});
+ new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID_FTP_USERNAME, "txtUsername", new Integer(110), new Integer(34), new Short((short) 4), new Integer(106)
+ });
lblPassword = insertLabel("lblPassword",
- PROPNAMES_LABEL,
- new Object[] { INTEGERS[8], resources.reslblPassword_value, "lblPassword", INTEGER_12, new Integer(52), new Short((short) 5), new Integer(85)});
+ PROPNAMES_LABEL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblPassword_value, "lblPassword", INTEGER_12, new Integer(52), new Short((short) 5), new Integer(85)
+ });
txtPassword = insertTextField("txtPassword", "disconnect",
- new String[] { "EchoChar", "Height", "HelpURL","Name", "PositionX", "PositionY", "TabIndex", "Width" },
- new Object[] { new Short((short) 42), INTEGER_12, "HID:" + HID_FTP_PASS, "txtPassword", new Integer(110), new Integer(50), new Short((short) 6), new Integer(106)});
+ new String[]
+ {
+ "EchoChar", "Height", "HelpURL", "Name", "PositionX", "PositionY", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Short((short) 42), INTEGER_12, "HID:" + HID_FTP_PASS, "txtPassword", new Integer(110), new Integer(50), new Short((short) 6), new Integer(106)
+ });
ln2 = insertFixedLine("ln2",
- PROPNAMES_LABEL,
- new Object[] { INTEGERS[8], resources.resln2_value, "ln2", INTEGERS[6], new Integer(68), new Short((short) 7), new Integer(210)});
+ PROPNAMES_LABEL,
+ new Object[]
+ {
+ INTEGERS[8], resources.resln2_value, "ln2", INTEGERS[6], new Integer(68), new Short((short) 7), new Integer(210)
+ });
btnTestConnection = insertButton("btnConnect", "connect",
- PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID_FTP_TEST, resources.resbtnConnect_value, "btnConnect", INTEGER_12, new Integer(80), new Short((short) 8), INTEGER_50 });
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID_FTP_TEST, resources.resbtnConnect_value, "btnConnect", INTEGER_12, new Integer(80), new Short((short) 8), INTEGER_50
+ });
imgStatus = insertImage("imgStatus",
- new String[] { "Border", "Height", "PositionX", "PositionY", "ScaleImage", "Tabstop", "Width" },
- new Object[] { new Short((short) 0), INTEGER_14, new Integer(68), new Integer(80), Boolean.FALSE, Boolean.FALSE, INTEGER_14 });
+ new String[]
+ {
+ "Border", "Height", "PositionX", "PositionY", "ScaleImage", "Tabstop", "Width"
+ },
+ new Object[]
+ {
+ new Short((short) 0), INTEGER_14, new Integer(68), new Integer(80), Boolean.FALSE, Boolean.FALSE, INTEGER_14
+ });
lblStatus = insertLabel("lblStatus",
- PROPNAMES_LABEL,
- new Object[] { INTEGERS[8], resources.resFTPDisconnected, "lblStatus", new Integer(86), new Integer(82), new Short((short) 9), new Integer(99)});
+ PROPNAMES_LABEL,
+ new Object[]
+ {
+ INTEGERS[8], resources.resFTPDisconnected, "lblStatus", new Integer(86), new Integer(82), new Short((short) 9), new Integer(99)
+ });
ln3 = insertFixedLine("ln3",
- PROPNAMES_LABEL,
- new Object[] { INTEGERS[8], resources.resln3_value, "ln3", INTEGERS[6], new Integer(100), new Short((short) 10), new Integer(210)});
+ PROPNAMES_LABEL,
+ new Object[]
+ {
+ INTEGERS[8], resources.resln3_value, "ln3", INTEGERS[6], new Integer(100), new Short((short) 10), new Integer(210)
+ });
txtDir = insertTextField("txtDir",
- null, new String[] { "Enabled", "Height", "HelpURL", "Name", "PositionX", "PositionY", "TabIndex", "Text", "Width" },
- new Object[] { new Boolean(false), INTEGER_12, "HID:" + HID_FTP_TXT_PATH, "txtDir", INTEGER_12, new Integer(113), new Short((short) 11), resources.restxtDir_value, new Integer(184)});
+ null, new String[]
+ {
+ "Enabled", "Height", "HelpURL", "Name", "PositionX", "PositionY", "TabIndex", "Text", "Width"
+ },
+ new Object[]
+ {
+ new Boolean(false), INTEGER_12, "HID:" + HID_FTP_TXT_PATH, "txtDir", INTEGER_12, new Integer(113), new Short((short) 11), resources.restxtDir_value, new Integer(184)
+ });
btnDir = insertButton("btnDir", "chooseDirectory",
- PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID_FTP_BTN_PATH, resources.resbtnDir_value, "btnDir", new Integer(199), new Integer(112), new Short((short) 12), INTEGER_16 });
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID_FTP_BTN_PATH, resources.resbtnDir_value, "btnDir", new Integer(199), new Integer(112), new Short((short) 12), INTEGER_16
+ });
btnOK = insertButton("btnOK", null,
- PROPNAMES_BUTTON2,
- new Object[] { INTEGER_14, "HID:" + HID_FTP_OK, resources.resbtnOK_value, "btnOK", new Integer(165), new Integer(142), new Short((short) PushButtonType.OK_value), new Short((short) 13), INTEGER_50 });
+ PROPNAMES_BUTTON2,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID_FTP_OK, resources.resbtnOK_value, "btnOK", new Integer(165), new Integer(142), new Short((short) PushButtonType.OK_value), new Short((short) 13), INTEGER_50
+ });
btnCancel = insertButton("btnCancel",
- null, PROPNAMES_BUTTON2,
- new Object[] { INTEGER_14, "HID:" + HID_FTP_CANCEL, resources.resbtnCancel_value, "btnCancel", new Integer(113), new Integer(142), new Short((short) PushButtonType.CANCEL_value), new Short((short) 14), INTEGER_50 });
+ null, PROPNAMES_BUTTON2,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID_FTP_CANCEL, resources.resbtnCancel_value, "btnCancel", new Integer(113), new Integer(142), new Short((short) PushButtonType.CANCEL_value), new Short((short) 14), INTEGER_50
+ });
btnHelp = insertButton("btnHelp", null,
- PROPNAMES_BUTTON2 ,
- new Object[] { INTEGER_14,"", resources.resbtnHelp_value, "btnHelp", new Integer(57), new Integer(142), new Short((short) PushButtonType.HELP_value), new Short((short) 15), INTEGER_50 });
+ PROPNAMES_BUTTON2,
+ new Object[]
+ {
+ INTEGER_14, "", resources.resbtnHelp_value, "btnHelp", new Integer(57), new Integer(142), new Short((short) PushButtonType.HELP_value), new Short((short) 15), INTEGER_50
+ });
}
/**
* Make hostname, username and password text fields data aware.
*/
- private void configure() {
- dataAware.add(UnoDataAware.attachEditControl(this, "host", txtHost, null,true));
+ private void configure()
+ {
+ dataAware.add(UnoDataAware.attachEditControl(this, "host", txtHost, null, true));
dataAware.add(UnoDataAware.attachEditControl(this, "username", txtUsername, null, true));
dataAware.add(UnoDataAware.attachEditControl(this, "password", txtPassword, null, true));
}
@@ -300,7 +377,8 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* @return 0 for cancel, 1 for ok.
* @throws Exception - well, if something goes wrong...
*/
- public short execute(UnoDialog parent) throws Exception {
+ public short execute(UnoDialog parent) throws Exception
+ {
host = extractHost(publish.cp_URL);
username = publish.cp_Username == null ? "" : publish.cp_Username;
password = publish.password == null ? "" : publish.password;
@@ -311,7 +389,8 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
updateUI();
short result = executeDialog(parent);
//change the CGPublish properties
- if (result == 1) {
+ if (result == 1)
+ {
publish.cp_URL = "ftp://" + host() + getDir();
publish.cp_Username = username;
publish.password = password;
@@ -325,7 +404,8 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* directory text fields.
* is called uppon initialization.
*/
- private void updateUI() {
+ private void updateUI()
+ {
DataAware.updateUI(dataAware);
setDir(dir);
}
@@ -336,16 +416,22 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* @param ftpUrl
* @return
*/
- private String extractHost(String ftpUrl) {
+ private String extractHost(String ftpUrl)
+ {
if (ftpUrl == null || ftpUrl.length() < 6)
+ {
return "";
-
+ }
String url = ftpUrl.substring(6);
int i = url.indexOf("/");
if (i == -1)
+ {
return url;
+ }
else
+ {
return url.substring(0, i);
+ }
}
/**
@@ -353,16 +439,22 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* @param ftpUrl
* @return the directory portion of the ftp-url
*/
- private String extractDir(String ftpUrl) {
+ private String extractDir(String ftpUrl)
+ {
if (ftpUrl == null || ftpUrl.length() < 6)
+ {
return "/";
-
+ }
String url = ftpUrl.substring(6);
int i = url.indexOf("/");
if (i == -1)
+ {
return "/";
+ }
else
+ {
return url.substring(i);
+ }
}
/**
@@ -370,23 +462,27 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* according to the status of the hostname, username, password text fields.
* If one of these fields is empty, the button is disabled.
*/
- private void enableTestButton() {
+ private void enableTestButton()
+ {
setEnabled(btnTestConnection, !(isEmpty(host) || isEmpty(username) || isEmpty(password)));
}
+
/**
* @param s
* @return true if the string is null or "".
*/
- private final boolean isEmpty(String s) {
- return (s==null) || (s.equals(""));
+ private final boolean isEmpty(String s)
+ {
+ return (s == null) || (s.equals(""));
}
/**
* @return the ftp url with username and password,
* but without the directory portion.
*/
- public String getAcountUrl() {
+ public String getAcountUrl()
+ {
return "ftp://" + username + ":" + password + "@" + host();
}
@@ -394,22 +490,24 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* return the host name without the "ftp://"
* @return
*/
- private String host() {
+ private String host()
+ {
return host(host);
}
- private static String host(String s) {
+ private static String host(String s)
+ {
return (s.startsWith("ftp://") ? s.substring(6) : s);
}
/**
* @return the full ftp url including username, password and directory portion.
*/
- private String getFullUrl() {
+ private String getFullUrl()
+ {
return getAcountUrl() + dir;
}
-
/**
* First I try to connect to the full url, including directory.
* If an InteractiveAugmentedIOException accures, I try again,
@@ -417,34 +515,50 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* to "/", if not I say to the user its his problem...
*
*/
- public void connect() {
+ public void connect()
+ {
setEnabled(btnTestConnection, false);
setLabel(STATUS_CONNECTING);
boolean success = false;
- try {
+ try
+ {
connect(getFullUrl());
success = true;
- } catch (InteractiveAugmentedIOException iaioex) {
- try {
+ }
+ catch (InteractiveAugmentedIOException iaioex)
+ {
+ try
+ {
connect(getAcountUrl());
setDir("/");
success = true;
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
setLabel(STATUS_NO_RIGHTS);
}
- } catch (InteractiveNetworkResolveNameException inrne) {
+ }
+ catch (InteractiveNetworkResolveNameException inrne)
+ {
setLabel(STATUS_SERVER_NOT_FOUND);
- } catch (AuthenticationRequest ar) {
+ }
+ catch (AuthenticationRequest ar)
+ {
setLabel(STATUS_USER_PWD_WRONG);
- } catch (InteractiveNetworkConnectException incx) {
+ }
+ catch (InteractiveNetworkConnectException incx)
+ {
setLabel(STATUS_HOST_UNREACHABLE);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
setLabel(-1);
ex.printStackTrace();
}
- if (success) {
+ if (success)
+ {
setLabel(STATUS_OK);
setEnabled(btnDir, true);
setEnabled(btnOK, true);
@@ -464,7 +578,8 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* @param acountUrl
* @throws Exception
*/
- private void connect(String acountUrl) throws Exception {
+ private void connect(String acountUrl) throws Exception
+ {
Object content = ucb.getContent(acountUrl);
//list files in the content.
@@ -487,7 +602,8 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* the UI and the data.
* @param s the directory.
*/
- public void setDir(String s) {
+ public void setDir(String s)
+ {
dir = s;
Helper.setUnoPropertyValue(getModel(txtDir), "Text", dir);
}
@@ -495,7 +611,8 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
/**
* @return the ftp subdirecrtory.
*/
- public String getDir() {
+ public String getDir()
+ {
return dir;
}
@@ -505,7 +622,8 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* This method is called also when the hostname, username
* and passwordtext fields change.
*/
- public void disconnect() {
+ public void disconnect()
+ {
enableTestButton();
setEnabled(btnOK, false);
setEnabled(btnDir, false);
@@ -516,9 +634,11 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* used for debuging.
* @param args
*/
- public static void main(String args[]) {
+ public static void main(String args[])
+ {
String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService"; //localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- try {
+ try
+ {
XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
CGPublish p = new CGPublish();
p.cp_URL = "ftp://tv-1/Folder";
@@ -527,7 +647,9 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
FTPDialog dialog = new FTPDialog(xLocMSF, p);
dialog.execute(null);
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace();
}
}
@@ -538,35 +660,37 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* @param status one opf the private status-constants.
* if this param is not one of them, an "unknown error" status is displayed.
*/
- private void setLabel(int status) {
- switch (status) {
+ private void setLabel(int status)
+ {
+ switch (status)
+ {
//not connected yet
case STATUS_UNKONWN:
setLabel(resources.resFTPDisconnected, ICON_UNKNOWN);
break;
- //connected!
- case STATUS_OK :
+ //connected!
+ case STATUS_OK:
setLabel(resources.resFTPConnected, ICON_OK);
break;
- case STATUS_USER_PWD_WRONG :
+ case STATUS_USER_PWD_WRONG:
setLabel(resources.resFTPUserPwdWrong, ICON_ERROR);
break;
- //problem resolving server name
- case STATUS_SERVER_NOT_FOUND :
+ //problem resolving server name
+ case STATUS_SERVER_NOT_FOUND:
setLabel(resources.resFTPServerNotFound, ICON_ERROR);
break;
- //rights problem
- case STATUS_NO_RIGHTS :
+ //rights problem
+ case STATUS_NO_RIGHTS:
setLabel(resources.resFTPRights, ICON_ERROR);
break;
- //host unreachable (firewall?)
- case STATUS_HOST_UNREACHABLE :
+ //host unreachable (firewall?)
+ case STATUS_HOST_UNREACHABLE:
setLabel(resources.resFTPHostUnreachable, ICON_ERROR);
break;
case STATUS_CONNECTING:
setLabel(resources.resConnecting, ICON_CONNECTING);
break;
- default :
+ default:
setLabel(resources.resFTPUnknownError, ICON_ERROR);
}
}
@@ -577,13 +701,14 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* @param label
* @param color
*/
- private void setLabel(String label, String image) {
+ private void setLabel(String label, String image)
+ {
Helper.setUnoPropertyValue(getModel(lblStatus), "Label", label);
Helper.setUnoPropertyValue(getModel(imgStatus), "ImageURL", imageUrl(image));
}
-
- private String imageUrl(String s) {
+ private String imageUrl(String s)
+ {
String t = imagesDirectory + s;
//System.out.println(t);
return t;
@@ -597,25 +722,33 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID {
* checks if the returned folder is an ftp folder.
* sets the textbox and the data to the new selected dir.
*/
- public void chooseDirectory() {
+ public void chooseDirectory()
+ {
SystemDialog sd = SystemDialog.createOfficeFolderDialog(xMSF);
String newUrl = sd.callFolderDialog(resources.resFTPDirectory, "", getFullUrl());
- if (newUrl != null) {
+ if (newUrl != null)
+ {
/* if the user chose a local directory,
* sI do not accept it.
*/
if (newUrl.startsWith("ftp://"))
+ {
setDir(extractDir(newUrl));
+ }
else
- AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),resources.resIllegalFolder, ErrorHandler.ERROR_PROCESS_FATAL);
+ {
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), resources.resIllegalFolder, ErrorHandler.ERROR_PROCESS_FATAL);
+ }
}
}
+
/**
* practical to have such a method...
* @param p the publisher obejct that contains the ftp connection info.
* @return the full ftp url with username password and everything one needs.
*/
- public static final String getFullURL(CGPublish p) {
+ public static final String getFullURL(CGPublish p)
+ {
return "ftp://" + p.cp_Username + ":" + p.password + "@" + host(p.cp_URL);
}
}
diff --git a/wizards/com/sun/star/wizards/web/FTPDialogResources.java b/wizards/com/sun/star/wizards/web/FTPDialogResources.java
index e33994cf8a6d..7d6ae650b8f2 100644
--- a/wizards/com/sun/star/wizards/web/FTPDialogResources.java
+++ b/wizards/com/sun/star/wizards/web/FTPDialogResources.java
@@ -26,74 +26,76 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web;
+ ************************************************************************/
+package com.sun.star.wizards.web;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.Resource;
-public class FTPDialogResources extends Resource {
+public class FTPDialogResources extends Resource
+{
- final static String UNIT_NAME = "dbwizres";
- final static String MODULE_NAME = "dbw";
- final static int RID_FTPDIALOG_START = 4200;
- final static int RID_COMMON_START = 500;
+ final static String UNIT_NAME = "dbwizres";
+ final static String MODULE_NAME = "dbw";
+ final static int RID_FTPDIALOG_START = 4200;
+ final static int RID_COMMON_START = 500;
+ String resFTPDialog_title;
+ String reslblUsername_value;
+ String reslblPassword_value;
+ String resbtnConnect_value;
+ String resbtnOK_value;
+ String resbtnHelp_value;
+ String resbtnCancel_value;
+ String resln1_value;
+ String reslblFTPAddress_value;
+ String resln2_value;
+ String resln3_value;
+ String restxtDir_value;
+ String resbtnDir_value;
+ String resFTPDisconnected;
+ String resFTPConnected;
+ String resFTPUserPwdWrong;
+ String resFTPServerNotFound;
+ String resFTPRights;
+ String resFTPHostUnreachable;
+ String resFTPUnknownError;
+ String resFTPDirectory;
+ String resIllegalFolder;
+ String resConnecting;
- String resFTPDialog_title;
- String reslblUsername_value;
- String reslblPassword_value;
- String resbtnConnect_value;
- String resbtnOK_value;
- String resbtnHelp_value;
- String resbtnCancel_value;
- String resln1_value;
- String reslblFTPAddress_value;
- String resln2_value;
- String resln3_value;
- String restxtDir_value;
- String resbtnDir_value;
- String resFTPDisconnected;
- String resFTPConnected;
- String resFTPUserPwdWrong;
- String resFTPServerNotFound;
- String resFTPRights;
- String resFTPHostUnreachable;
- String resFTPUnknownError;
- String resFTPDirectory;
- String resIllegalFolder;
- String resConnecting ;
+ public FTPDialogResources(XMultiServiceFactory xmsf)
+ {
+ super(xmsf, UNIT_NAME, MODULE_NAME);
-public FTPDialogResources(XMultiServiceFactory xmsf) {
- super(xmsf,UNIT_NAME,MODULE_NAME);
+ /**
+ * Delete the String, uncomment the getResText method
+ *
+ */
+ resFTPDialog_title = getResText(RID_FTPDIALOG_START + 0);
+ reslblUsername_value = getResText(RID_FTPDIALOG_START + 1);
+ reslblPassword_value = getResText(RID_FTPDIALOG_START + 2);
+ resbtnConnect_value = getResText(RID_FTPDIALOG_START + 3);
+ resln1_value = getResText(RID_FTPDIALOG_START + 4);
+ reslblFTPAddress_value = getResText(RID_FTPDIALOG_START + 5);
+ resln2_value = getResText(RID_FTPDIALOG_START + 6);
+ resln3_value = getResText(RID_FTPDIALOG_START + 7);
+ resbtnDir_value = getResText(RID_FTPDIALOG_START + 8);
+ resFTPDisconnected = getResText(RID_FTPDIALOG_START + 9);
+ resFTPConnected = getResText(RID_FTPDIALOG_START + 10);
+ resFTPUserPwdWrong = getResText(RID_FTPDIALOG_START + 11);
+ resFTPServerNotFound = getResText(RID_FTPDIALOG_START + 12);
+ resFTPRights = getResText(RID_FTPDIALOG_START + 13);
+ resFTPHostUnreachable = getResText(RID_FTPDIALOG_START + 14);
+ resFTPUnknownError = getResText(RID_FTPDIALOG_START + 15);
+ resFTPDirectory = getResText(RID_FTPDIALOG_START + 16);
+ resIllegalFolder = getResText(RID_FTPDIALOG_START + 17);
+ resConnecting = getResText(RID_FTPDIALOG_START + 18);
- /**
- * Delete the String, uncomment the getResText method
- *
- */
- resFTPDialog_title = getResText(RID_FTPDIALOG_START + 0);
- reslblUsername_value = getResText(RID_FTPDIALOG_START + 1);
- reslblPassword_value = getResText(RID_FTPDIALOG_START + 2);
- resbtnConnect_value = getResText(RID_FTPDIALOG_START + 3);
- resln1_value = getResText(RID_FTPDIALOG_START + 4);
- reslblFTPAddress_value = getResText(RID_FTPDIALOG_START + 5);
- resln2_value = getResText(RID_FTPDIALOG_START + 6);
- resln3_value = getResText(RID_FTPDIALOG_START + 7);
- resbtnDir_value = getResText(RID_FTPDIALOG_START + 8);
- resFTPDisconnected = getResText(RID_FTPDIALOG_START + 9);
- resFTPConnected = getResText(RID_FTPDIALOG_START + 10);
- resFTPUserPwdWrong = getResText(RID_FTPDIALOG_START + 11);
- resFTPServerNotFound = getResText(RID_FTPDIALOG_START + 12);
- resFTPRights = getResText(RID_FTPDIALOG_START + 13);
- resFTPHostUnreachable = getResText(RID_FTPDIALOG_START + 14);
- resFTPUnknownError = getResText(RID_FTPDIALOG_START + 15);
- resFTPDirectory = getResText(RID_FTPDIALOG_START + 16);
- resIllegalFolder = getResText(RID_FTPDIALOG_START + 17);
- resConnecting = getResText(RID_FTPDIALOG_START + 18);
+ resbtnCancel_value = getResText(RID_COMMON_START + 11);
+ resbtnOK_value = getResText(RID_COMMON_START + 18);
+ resbtnHelp_value = getResText(RID_COMMON_START + 15);
- resbtnCancel_value = getResText(RID_COMMON_START + 11);
- resbtnOK_value = getResText(RID_COMMON_START + 18);
- resbtnHelp_value = getResText(RID_COMMON_START + 15);
+ restxtDir_value = "/";
- restxtDir_value = "/";
-
- }
+ }
}
diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.java b/wizards/com/sun/star/wizards/web/IconsDialog.java
index ed366ff47c9b..38cb11826b0c 100644
--- a/wizards/com/sun/star/wizards/web/IconsDialog.java
+++ b/wizards/com/sun/star/wizards/web/IconsDialog.java
@@ -47,7 +47,8 @@ import com.sun.star.wizards.web.data.CGIconSet;
* It also implements the ImageList.ImageRenderer interface, to handle
* its own objects.
*/
-public class IconsDialog extends ImageListDialog implements ImageList.ImageRenderer, ListModel {
+public class IconsDialog extends ImageListDialog implements ImageList.ImageRenderer, ListModel
+{
private ConfigSet set;
String htmlexpDirectory;
@@ -55,41 +56,45 @@ public class IconsDialog extends ImageListDialog implements ImageList.ImageRende
* this icons filename prefixes are used to display the icons.
*/
private String[] icons = new String[]
- {"firs","prev","next","last","nav","text","up","down"};
+ {
+ "firs", "prev", "next", "last", "nav", "text", "up", "down"
+ };
private Integer[] objects;
-
/**
* @param xmsf
* @param set_ the configuration set of the supported
* icon sets.
*/
public IconsDialog(XMultiServiceFactory xmsf,
- ConfigSet set_,
- WebWizardDialogResources resources)
- throws Exception
+ ConfigSet set_,
+ WebWizardDialogResources resources)
+ throws Exception
{
- super(xmsf, WWHID.HID_IS, new String[] {
- resources.resIconsDialog,
- resources.resIconsDialogCaption,
- resources.resOK,
- resources.resCancel,
- resources.resHelp,
- resources.resDeselect,
- resources.resOther,
- resources.resCounter
- } );
-
- htmlexpDirectory = FileAccess.getOfficePath(xmsf,"Gallery","share", "");
+ super(xmsf, WWHID.HID_IS, new String[]
+ {
+ resources.resIconsDialog,
+ resources.resIconsDialogCaption,
+ resources.resOK,
+ resources.resCancel,
+ resources.resHelp,
+ resources.resDeselect,
+ resources.resOther,
+ resources.resCounter
+ });
+
+ htmlexpDirectory = FileAccess.getOfficePath(xmsf, "Gallery", "share", "");
set = set_;
objects = new Integer[set.getSize() * icons.length];
- for (int i = 0; i<objects.length; i++)
- objects[i] = new Integer(i);
+ for (int i = 0; i < objects.length; i++)
+ {
+ objects[i] = new Integer(i);
+ }
il.setListModel(this);
il.setRenderer(this);
il.setRows(4);
il.setCols(8);
- il.setImageSize(new Size(20,20));
+ il.setImageSize(new Size(20, 20));
il.setShowButtons(false);
il.setRowSelect(true);
il.scaleImages = Boolean.FALSE;
@@ -100,89 +105,108 @@ public class IconsDialog extends ImageListDialog implements ImageList.ImageRende
build();
}
-
- public String getIconset() {
+ public String getIconset()
+ {
if (getSelected() == null)
+ {
return null;
+ }
else
- return (String) set.getKey( ((Number)getSelected()).intValue() / icons.length );
+ {
+ return (String) set.getKey(((Number) getSelected()).intValue() / icons.length);
+ }
}
- public void setIconset(String iconset) {
- int icon = set.getIndexOf(set.getElement( iconset ) ) * icons.length;
- this.setSelected( icon >= 0 ? objects[icon] : null );
+ public void setIconset(String iconset)
+ {
+ int icon = set.getIndexOf(set.getElement(iconset)) * icons.length;
+ this.setSelected(icon >= 0 ? objects[icon] : null);
}
/**
* dummy
*/
- public synchronized void addListDataListener(javax.swing.event.ListDataListener listener) {
+ public synchronized void addListDataListener(javax.swing.event.ListDataListener listener)
+ {
}
+
/**
* dummy
*/
- public synchronized void removeListDataListener(javax.swing.event.ListDataListener listener) {
+ public synchronized void removeListDataListener(javax.swing.event.ListDataListener listener)
+ {
}
/* (non-Javadoc)
* @see javax.swing.ListModel#getSize()
*/
- public int getSize() {
+ public int getSize()
+ {
return set.getSize() * icons.length;
}
/* (non-Javadoc)
* @see javax.swing.ListModel#getElementAt(int)
*/
- public Object getElementAt(int arg0) {
+
+ public Object getElementAt(int arg0)
+ {
return objects[arg0];
}
/* (non-Javadoc)
* @see com.sun.star.wizards.ui.ImageList.ImageRenderer#getImageUrls(java.lang.Object)
*/
- public Object[] getImageUrls(Object listItem) {
- int i = ((Number)listItem).intValue();
+ public Object[] getImageUrls(Object listItem)
+ {
+ int i = ((Number) listItem).intValue();
int iset = getIconsetNum(i);
int icon = getIconNum(i);
String[] sRetUrls = new String[2];
- sRetUrls[0] = htmlexpDirectory + "/htmlexpo/" +
- getIconsetPref(iset) +
- icons[icon] +
- getIconsetPostfix(iset);
+ sRetUrls[0] = htmlexpDirectory + "/htmlexpo/" +
+ getIconsetPref(iset) +
+ icons[icon] +
+ getIconsetPostfix(iset);
sRetUrls[1] = sRetUrls[0];
//System.out.println(s);
return sRetUrls;
}
- /* (non-Javadoc)
+ /* (non-Javadoc)
* @see com.sun.star.wizards.common.Renderer#render(java.lang.Object)
*/
- public String render(Object object) {
+
+ public String render(Object object)
+ {
if (object == null)
- return "";
- int i = ((Number)object).intValue();
+ {
+ return "";
+ }
+ int i = ((Number) object).intValue();
int iset = getIconsetNum(i);
return getIconset(iset).cp_Name;
}
-
- private int getIconsetNum(int i) {
+ private int getIconsetNum(int i)
+ {
return i / icons.length;
}
- private int getIconNum(int i) {
+ private int getIconNum(int i)
+ {
return i % icons.length;
}
- private String getIconsetPref(int iconset) {
+ private String getIconsetPref(int iconset)
+ {
return getIconset(iconset).cp_FNPrefix;
}
- private String getIconsetPostfix(int iconset) {
+ private String getIconsetPostfix(int iconset)
+ {
return getIconset(iconset).cp_FNPostfix;
}
- private CGIconSet getIconset(int i ) {
- return (CGIconSet)set.getElementAt(i);
+ private CGIconSet getIconset(int i)
+ {
+ return (CGIconSet) set.getElementAt(i);
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.java b/wizards/com/sun/star/wizards/web/ImageListDialog.java
index f7b1fa4b56f7..8414068481b9 100644
--- a/wizards/com/sun/star/wizards/web/ImageListDialog.java
+++ b/wizards/com/sun/star/wizards/web/ImageListDialog.java
@@ -26,9 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web;
-
-
+ ************************************************************************/
+package com.sun.star.wizards.web;
import com.sun.star.awt.FontDescriptor;
import com.sun.star.awt.Size;
@@ -67,199 +66,220 @@ import com.sun.star.wizards.ui.ImageList.Counter;
*
* @author rpiterman
*/
-public abstract class ImageListDialog extends UnoDialog2 implements UIConsts {
-
- private String[] resources;
-
- private final static int RES_TITLE = 0;
- private final static int RES_LABEL = 1;
- private final static int RES_OK = 2;
- private final static int RES_CANCEL = 3;
- private final static int RES_HELP = 4;
- private final static int RES_DESELECT = 5;
- private final static int RES_OTHER = 6;
- private final static int RES_COUNTER = 7;
-
- //GUI Components as Class members.
- private XButton btnOK;
- private XButton btnCancel;
- private XButton btnHelp;
- private XButton btnOther;
- private XButton btnDeselect;
-
- private static final String START = "%START";
- private static final String END = "%END";
- private static final String TOTAL= "%TOTAL";
-
- protected int cutFilename = 0;
-
- protected boolean showDeselectButton = true;
- protected boolean showOtherButton = true;
-
- private XFixedText lblTitle;
- //Font Descriptors as Class members.
- private FontDescriptor fontDescriptor1 = new FontDescriptor();
-
- protected ImageList il;
-
- //private FileAccess fileAccess;
-
- private Object result;
-
- private int hid;
-
- /**
- *
- * @param xmsf
- * @param resources_ a string array with the following strings :
- * dialog title, label text, ok, cancel, help, deselect, other.
- * <br/> if "deselect" and "other" are not displayed,
- * the array can also be shorter. but if "other" is displayed
- * and "deselect" not, both must be there :-(
- */
- public ImageListDialog(
- XMultiServiceFactory xmsf, int hid_, String[] resources_)
- {
- super(xmsf);
- hid = hid_;
- resources = resources_;
- il = new ImageList();
- il.counterRenderer = new ARenderer(resources[RES_COUNTER]);
- }
-
- /**
- * adds the controls to the dialog, depending on
- * the size of the image list.
- * This method should be called by subclasses after setting
- * the il ImageList member properties
- */
- protected void build() {
- //set dialog properties...
-
- int ilWidth = (il.getImageSize().Width + il.getGap().Width) * il.getCols()+ il.getGap().Width;
- int ilHeight = (il.getImageSize().Height + il.getGap().Height) * il.getRows()+ il.getGap().Height;
-
- int dialogWidth = 6 + ilWidth + 6 + 50 + 6;
- int dialogHeight = 3 + 16 + 3 + ( ilHeight + 8 + 14 ) + 6;
-
- Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Closeable","Height","HelpURL", "Moveable","Name","PositionX","PositionY","Step","Title","Width"},
- new Object[] { Boolean.TRUE,new Integer(dialogHeight),"HID:" + hid , Boolean.TRUE,"imgDialog",new Integer(59),new Integer(24),INTEGERS[1], resources[RES_TITLE],new Integer(dialogWidth)}
- );
- //Set member- FontDescriptors...
- fontDescriptor1.Weight = 150;
+public abstract class ImageListDialog extends UnoDialog2 implements UIConsts
+{
+
+ private String[] resources;
+ private final static int RES_TITLE = 0;
+ private final static int RES_LABEL = 1;
+ private final static int RES_OK = 2;
+ private final static int RES_CANCEL = 3;
+ private final static int RES_HELP = 4;
+ private final static int RES_DESELECT = 5;
+ private final static int RES_OTHER = 6;
+ private final static int RES_COUNTER = 7; //GUI Components as Class members.
+ private XButton btnOK;
+ private XButton btnCancel;
+ private XButton btnHelp;
+ private XButton btnOther;
+ private XButton btnDeselect;
+ private static final String START = "%START";
+ private static final String END = "%END";
+ private static final String TOTAL = "%TOTAL";
+ protected int cutFilename = 0;
+ protected boolean showDeselectButton = true;
+ protected boolean showOtherButton = true;
+ private XFixedText lblTitle;
+ //Font Descriptors as Class members.
+ private FontDescriptor fontDescriptor1 = new FontDescriptor();
+ protected ImageList il; //private FileAccess fileAccess;
+ private Object result;
+ private int hid;
+
+ /**
+ *
+ * @param xmsf
+ * @param resources_ a string array with the following strings :
+ * dialog title, label text, ok, cancel, help, deselect, other.
+ * <br/> if "deselect" and "other" are not displayed,
+ * the array can also be shorter. but if "other" is displayed
+ * and "deselect" not, both must be there :-(
+ */
+ public ImageListDialog(
+ XMultiServiceFactory xmsf, int hid_, String[] resources_)
+ {
+ super(xmsf);
+ hid = hid_;
+ resources = resources_;
+ il = new ImageList();
+ il.counterRenderer = new ARenderer(resources[RES_COUNTER]);
+ }
- final String[] PROPNAMES = new String[] {"DefaultButton", "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "PushButtonType", "TabIndex", "Width"};
+ /**
+ * adds the controls to the dialog, depending on
+ * the size of the image list.
+ * This method should be called by subclasses after setting
+ * the il ImageList member properties
+ */
+ protected void build()
+ {
+ //set dialog properties...
+
+ int ilWidth = (il.getImageSize().Width + il.getGap().Width) * il.getCols() + il.getGap().Width;
+ int ilHeight = (il.getImageSize().Height + il.getGap().Height) * il.getRows() + il.getGap().Height;
+
+ int dialogWidth = 6 + ilWidth + 6 + 50 + 6;
+ int dialogHeight = 3 + 16 + 3 + (ilHeight + 8 + 14) + 6;
+
+ Helper.setUnoPropertyValues(xDialogModel,
+ new String[]
+ {
+ "Closeable", "Height", "HelpURL", "Moveable", "Name", "PositionX", "PositionY", "Step", "Title", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(dialogHeight), "HID:" + hid, Boolean.TRUE, "imgDialog", new Integer(59), new Integer(24), INTEGERS[1], resources[RES_TITLE], new Integer(dialogWidth)
+ });
+ //Set member- FontDescriptors...
+ fontDescriptor1.Weight = 150;
+
+ final String[] PROPNAMES = new String[]
+ {
+ "DefaultButton", "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "PushButtonType", "TabIndex", "Width"
+ };
+
+ Integer iButtonsX = new Integer(6 + ilWidth + 6);
+
+ btnOK = insertButton("btnOK", null,
+ PROPNAMES,
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_14, "HID:" + (hid + 3), resources[RES_OK], "btnOK", iButtonsX, new Integer(22), new Short((short) com.sun.star.awt.PushButtonType.OK_value), new Short((short) 7), INTEGER_50
+ });
+ btnCancel = insertButton("btnCancel", null,
+ PROPNAMES,
+ new Object[]
+ {
+ Boolean.FALSE, INTEGER_14, "HID:" + (hid + 4), resources[RES_CANCEL], "btnCancel", iButtonsX, new Integer(41), new Short((short) com.sun.star.awt.PushButtonType.CANCEL_value), new Short((short) 8), INTEGER_50
+ });
+ btnHelp = insertButton("btnHelp", null,
+ PROPNAMES,
+ new Object[]
+ {
+ Boolean.FALSE, INTEGER_14, "", resources[RES_HELP], "CommandButton3", iButtonsX, new Integer(71), new Short((short) com.sun.star.awt.PushButtonType.HELP_value), new Short((short) 9), INTEGER_50
+ });
+
+ if (showOtherButton)
+ {
+
+ int otherY = 22 + ilHeight - 14 - (showDeselectButton ? 19 : 0);
+
+ btnOther = insertButton("btnOther", "other",
+ PROPNAMES,
+ new Object[]
+ {
+ Boolean.FALSE, INTEGER_14, "HID:" + (hid + 1), resources[RES_OTHER], "btnOther", iButtonsX, new Integer(otherY), new Short((short) com.sun.star.awt.PushButtonType.STANDARD_value), new Short((short) 5), INTEGER_50
+ });
+ }
- Integer iButtonsX = new Integer(6 + ilWidth + 6);
+ if (showDeselectButton)
+ {
- btnOK = insertButton("btnOK", null,
- PROPNAMES,
- new Object[] { Boolean.TRUE , INTEGER_14,"HID:" + (hid + 3), resources[RES_OK],"btnOK",iButtonsX,new Integer(22),new Short((short)com.sun.star.awt.PushButtonType.OK_value),new Short((short)7),INTEGER_50}
- );
- btnCancel = insertButton("btnCancel", null,
- PROPNAMES,
- new Object[] { Boolean.FALSE, INTEGER_14,"HID:" + (hid + 4),resources[RES_CANCEL],"btnCancel",iButtonsX,new Integer(41),new Short((short)com.sun.star.awt.PushButtonType.CANCEL_value),new Short((short)8),INTEGER_50}
- );
- btnHelp = insertButton("btnHelp", null,
- PROPNAMES,
- new Object[] { Boolean.FALSE, INTEGER_14,"" ,resources[RES_HELP],"CommandButton3",iButtonsX,new Integer(71),new Short((short)com.sun.star.awt.PushButtonType.HELP_value),new Short((short)9),INTEGER_50}
- );
+ int deselectY = 22 + ilHeight - 14;
- if (showOtherButton) {
+ btnDeselect = insertButton("btnNoImage", "deselect",
+ PROPNAMES,
+ new Object[]
+ {
+ Boolean.FALSE, INTEGER_14, "HID:" + (hid + 2), resources[RES_DESELECT], "btnNoImage", iButtonsX, new Integer(deselectY), new Short((short) com.sun.star.awt.PushButtonType.STANDARD_value), new Short((short) 4), INTEGER_50
+ });
+ }
- int otherY = 22 + ilHeight - 14 - (showDeselectButton ? 19 : 0);
+ il.setStep(new Short((short) 1));
+ il.setPos(new Size(6, 22));
+ il.helpURL = hid + 5;
+ il.tabIndex = 1;
+ il.create(this);
+
+ /*lblContainer = insertLabel("lblContainer",
+ new String[] {"Height", "Name", "PositionX", "PositionY", "TabIndex", "Width"},
+ new Object[] { new Integer(176),"lblContainer",new Integer(6),new Integer(17),new Short((short)5),new Integer(214)}
+ );*/
+
+ lblTitle = insertLabel("lblTitle",
+ new String[]
+ {
+ "FontDescriptor", "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor1, INTEGERS[8], resources[RES_LABEL], "lblTitle", INTEGERS[6], INTEGERS[6], INTEGERS[1], new Short((short) 4), new Integer(216)
+ });
- btnOther = insertButton("btnOther", "other",
- PROPNAMES,
- new Object[] { Boolean.FALSE, INTEGER_14,"HID:" + (hid + 1), resources[RES_OTHER],"btnOther",iButtonsX, new Integer(otherY),new Short((short)com.sun.star.awt.PushButtonType.STANDARD_value), new Short((short)5),INTEGER_50}
- );
}
- if (showDeselectButton) {
-
- int deselectY = 22 + ilHeight - 14;
-
- btnDeselect = insertButton("btnNoImage", "deselect",
- PROPNAMES ,
- new Object[] { Boolean.FALSE, INTEGER_14,"HID:" + (hid + 2),resources[RES_DESELECT],"btnNoImage", iButtonsX ,new Integer(deselectY),new Short((short)com.sun.star.awt.PushButtonType.STANDARD_value), new Short((short)4),INTEGER_50}
- );
+ /**
+ * is called when the user clicks "none"
+ */
+ public void deselect()
+ {
+ il.setSelected(-1);
}
- il.setStep(new Short((short)1));
- il.setPos(new Size(6,22));
- il.helpURL = hid + 5;
- il.tabIndex = 1;
- il.create(this);
-
- /*lblContainer = insertLabel("lblContainer",
- new String[] {"Height", "Name", "PositionX", "PositionY", "TabIndex", "Width"},
- new Object[] { new Integer(176),"lblContainer",new Integer(6),new Integer(17),new Short((short)5),new Integer(214)}
- );*/
-
- lblTitle = insertLabel("lblTitle",
- new String[] {"FontDescriptor", "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { fontDescriptor1,INTEGERS[8],resources[RES_LABEL],"lblTitle",INTEGERS[6],INTEGERS[6],INTEGERS[1],new Short((short)4),new Integer(216)}
- );
-
- }
+ /**
+ * is called when the user clicks "other"
+ *
+ */
+ public void other()
+ {
+ }
- /**
- * is called when the user clicks "none"
- */
- public void deselect() {
- il.setSelected(-1);
- }
- /**
- * is called when the user clicks "other"
- *
- */
- public void other() {
- }
+ /**
+ * @return the currently elected object.
+ */
+ public Object getSelected()
+ {
+ return il.getSelectedObject();
+ }
- /**
- * @return the currently elected object.
- */
- public Object getSelected() {
- return il.getSelectedObject();
- }
+ /**
+ * sets the currently selected object.
+ * @param obj the object (out of the model) to be selected.
+ */
+ public void setSelected(Object obj)
+ {
+ il.setSelected(obj);
+ il.showSelected();
+ }
- /**
- * sets the currently selected object.
- * @param obj the object (out of the model) to be selected.
- */
- public void setSelected(Object obj) {
- il.setSelected(obj);
- il.showSelected();
- }
+ /**
+ * The counter renderer, which uses a template.
+ * The template replaces the Strings "%START", "%END" and
+ * "%TOTAL" with the respective values.
+ * @author rpiterman
+ *
+ */
+ public static class ARenderer implements Renderer
+ {
- /**
- * The counter renderer, which uses a template.
- * The template replaces the Strings "%START", "%END" and
- * "%TOTAL" with the respective values.
- * @author rpiterman
- *
- */
- public static class ARenderer implements Renderer {
String template;
+
/**
* @param aTempalte a template for this renderer.
* The strings %START, %END ,%TOTAL will be replaced
* with the actual values.
*/
- public ARenderer(String aTemplate) {
+ public ARenderer(String aTemplate)
+ {
template = aTemplate;
}
- public String render(Object counter) {
- String s = JavaTools.replaceSubString(template, "" + ((Counter) counter).start , START);
- s = JavaTools.replaceSubString(s,"" + ((Counter) counter).end, END);
+ public String render(Object counter)
+ {
+ String s = JavaTools.replaceSubString(template, "" + ((Counter) counter).start, START);
+ s = JavaTools.replaceSubString(s, "" + ((Counter) counter).end, END);
s = JavaTools.replaceSubString(s, "" + ((Counter) counter).max, TOTAL);
return s;
}
-
- }
-
-
-
+ }
}
diff --git a/wizards/com/sun/star/wizards/web/LogTaskListener.java b/wizards/com/sun/star/wizards/web/LogTaskListener.java
index 94b22c5086ba..18d65ef871c7 100644
--- a/wizards/com/sun/star/wizards/web/LogTaskListener.java
+++ b/wizards/com/sun/star/wizards/web/LogTaskListener.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LogTaskListener.java,v $
+ *
+ * $Revision: 1.4.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Created on 04.11.2003
*
* To change the template for this generated file go to
@@ -15,60 +46,62 @@ import com.sun.star.wizards.ui.event.TaskListener;
* used for debugging.
* @author rpiterman
*/
-public class LogTaskListener implements TaskListener, ErrorHandler {
+public class LogTaskListener implements TaskListener, ErrorHandler
+{
private PrintStream out;
- public LogTaskListener(PrintStream os) {
+ public LogTaskListener(PrintStream os)
+ {
out = os;
}
- public LogTaskListener() {
+ public LogTaskListener()
+ {
this(System.out);
}
/* (non-Javadoc)
* @see com.sun.star.wizards.web.status.TaskListener#taskStarted(com.sun.star.wizards.web.status.TaskEvent)
*/
- public void taskStarted(TaskEvent te) {
- out.println("TASK " + te.getTask().getTaskName()
- + " STARTED.");
+ public void taskStarted(TaskEvent te)
+ {
+ out.println("TASK " + te.getTask().getTaskName() + " STARTED.");
}
/* (non-Javadoc)
* @see com.sun.star.wizards.web.status.TaskListener#taskFinished(com.sun.star.wizards.web.status.TaskEvent)
*/
- public void taskFinished(TaskEvent te) {
- out.println("TASK " + te.getTask().getTaskName()
- + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded.");
+ public void taskFinished(TaskEvent te)
+ {
+ out.println("TASK " + te.getTask().getTaskName() + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded.");
}
/* (non-Javadoc)
* @see com.sun.star.wizards.web.status.TaskListener#taskStatusChanged(com.sun.star.wizards.web.status.TaskEvent)
*/
- public void taskStatusChanged(TaskEvent te) {
- out.println("TASK " + te.getTask().getTaskName()
- + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax());
+ public void taskStatusChanged(TaskEvent te)
+ {
+ out.println("TASK " + te.getTask().getTaskName() + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax());
}
/* (non-Javadoc)
* @see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent)
*/
- public void subtaskNameChanged(TaskEvent te) {
+ public void subtaskNameChanged(TaskEvent te)
+ {
out.println("SUBTASK Name:" + te.getTask().getSubtaskName());
}
/* (non-Javadoc)
* @see com.sun.star.wizards.web.status.ErrorReporter#error(java.lang.Exception, java.lang.Object, java.lang.String)
*/
- public boolean error(Exception ex, Object arg, int ix, int i) {
+ public boolean error(Exception ex, Object arg, int ix, int i)
+ {
System.out.println("" + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage());
ex.printStackTrace();
return true;
}
-
-
-
}
diff --git a/wizards/com/sun/star/wizards/web/Process.java b/wizards/com/sun/star/wizards/web/Process.java
index 9c4bd57d054f..a9d29b9a7d67 100644
--- a/wizards/com/sun/star/wizards/web/Process.java
+++ b/wizards/com/sun/star/wizards/web/Process.java
@@ -56,8 +56,6 @@ import com.sun.star.wizards.web.data.CGPublish;
import com.sun.star.wizards.web.data.CGSettings;
import com.sun.star.wizards.web.export.Exporter;
-
-
/**
* @author rpiterman
* This class is used to process a CGSession object
@@ -91,44 +89,36 @@ import com.sun.star.wizards.web.export.Exporter;
* the user is given the option to "OK" or to "Cancel" and depending
* on that interaction I cary on.
*/
-public class Process implements WebWizardConst, ProcessErrors {
+public class Process implements WebWizardConst, ProcessErrors
+{
private static final int TASKS_PER_DOC = 5;
private static final int TASKS_PER_XSL = 2;
private static final int TASKS_PER_PUBLISH = 2;
-
private static final int TASKS_IN_PREPARE = 1;
private static final int TASKS_IN_EXPORT = 2;
private static final int TASKS_IN_GENERATE = 2;
private static final int TASKS_IN_PUBLISH = 2;
private static final int TASKS_IN_FINISHUP = 1;
-
private CGSettings settings;
private XMultiServiceFactory xmsf;
-
private ErrorHandler errorHandler;
-
-
private String tempDir;
private FileAccess fileAccess;
private UCB ucb;
-
public Task myTask;
-
/**
* This is a cache for exporters, so I do not need to
* instanciate the same exporter more than once.
*/
private Map exporters = new Hashtable(3);
-
private boolean result;
public Process(
- CGSettings settings,
- XMultiServiceFactory xmsf,
- ErrorHandler er
- )
- throws Exception
+ CGSettings settings,
+ XMultiServiceFactory xmsf,
+ ErrorHandler er)
+ throws Exception
{
this.xmsf = xmsf;
this.settings = settings;
@@ -138,21 +128,25 @@ public class Process implements WebWizardConst, ProcessErrors {
ucb = new UCB(xmsf);
int taskSteps = getTaskSteps();
- myTask = new Task(TASK,TASK_PREPARE, taskSteps);
+ myTask = new Task(TASK, TASK_PREPARE, taskSteps);
}
-
/**
* @return to how many destinations should the
* generated site be published.
*/
- private int countPublish() {
+ private int countPublish()
+ {
int count = 0;
ConfigSet publishers = settings.cp_DefaultSession.cp_Publishing;
- for (int i = 0; i<publishers.getSize(); i++)
- if (((CGPublish)publishers.getElementAt(i)).cp_Publish)
+ for (int i = 0; i < publishers.getSize(); i++)
+ {
+ if (((CGPublish) publishers.getElementAt(i)).cp_Publish)
+ {
count++;
+ }
+ }
return count;
}
@@ -160,20 +154,23 @@ public class Process implements WebWizardConst, ProcessErrors {
* @return the number of task steps that this
* session should have
*/
- private int getTaskSteps() {
+ private int getTaskSteps()
+ {
int docs = settings.cp_DefaultSession.cp_Content.cp_Documents.getSize();
int xsl = 0;
- try {
+ try
+ {
xsl = settings.cp_DefaultSession.getLayout().getTemplates(xmsf).size();
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
}
int publish = countPublish();
int taskSteps =
- TASKS_IN_PREPARE +
- TASKS_IN_EXPORT + docs * TASKS_PER_DOC +
- TASKS_IN_GENERATE + xsl * TASKS_PER_XSL +
- TASKS_IN_PUBLISH + publish * TASKS_PER_PUBLISH +
+ TASKS_IN_PREPARE +
+ TASKS_IN_EXPORT + docs * TASKS_PER_DOC +
+ TASKS_IN_GENERATE + xsl * TASKS_PER_XSL +
+ TASKS_IN_PUBLISH + publish * TASKS_PER_PUBLISH +
TASKS_IN_FINISHUP;
return taskSteps;
}
@@ -181,37 +178,40 @@ public class Process implements WebWizardConst, ProcessErrors {
/**
* does the job
*/
- public void runProcess() {
+ public void runProcess()
+ {
myTask.start();
- try {
- try {
+ try
+ {
+ try
+ {
/*
* I use here '&&' so if one of the
* methods returns false, the next
* will not be called.
*/
- result = createTempDir(myTask)
- && export(myTask)
- && generate(tempDir,myTask)
- && publish(tempDir,myTask);
+ result = createTempDir(myTask) && export(myTask) && generate(tempDir, myTask) && publish(tempDir, myTask);
}
- finally {
+ finally
+ {
//cleanup must be called.
result = result & cleanup(myTask);
}
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
result = false;
}
if (!result)
- myTask.fail();
-
- //this is a bug protection.
+ {
+ myTask.fail(); //this is a bug protection.
+ }
while (myTask.getStatus() < myTask.getMax())
+ {
myTask.advance(true);
-
+ }
}
/**
@@ -219,14 +219,17 @@ public class Process implements WebWizardConst, ProcessErrors {
* @param task
* @return true should continue
*/
- private boolean createTempDir(Task task) {
+ private boolean createTempDir(Task task)
+ {
tempDir = fileAccess.createNewDir(getSOTempDir(xmsf), "wwiztemp");
- if (tempDir == null) {
- error(null,null,ERROR_MKDIR,ErrorHandler.ERROR_PROCESS_FATAL);
+ if (tempDir == null)
+ {
+ error(null, null, ERROR_MKDIR, ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
- else {
+ else
+ {
task.advance(true);
return true;
}
@@ -236,27 +239,33 @@ public class Process implements WebWizardConst, ProcessErrors {
* @param xmsf
* @return the staroffice /openoffice temporary directory
*/
- static String getSOTempDir(XMultiServiceFactory xmsf) {
- try {
- String s = FileAccess.getOfficePath(xmsf,"Temp","", "");
+ static String getSOTempDir(XMultiServiceFactory xmsf)
+ {
+ try
+ {
+ String s = FileAccess.getOfficePath(xmsf, "Temp", "", "");
return s;
}
- catch (Exception e) {}
+ catch (Exception e)
+ {
+ }
return null;
}
// CLEANUP
-
/**
* delete the temporary directory
* @return true should continue
*/
- private boolean cleanup(Task task) {
+ private boolean cleanup(Task task)
+ {
task.setSubtaskName(TASK_FINISH);
boolean b = fileAccess.delete(tempDir);
if (!b)
- error(null,null,ERROR_CLEANUP,ErrorHandler.ERROR_WARNING);
+ {
+ error(null, null, ERROR_CLEANUP, ErrorHandler.ERROR_WARNING);
+ }
task.advance(b);
return b;
}
@@ -284,29 +293,29 @@ public class Process implements WebWizardConst, ProcessErrors {
// }
// return success && fileAccess.delete(dir);
// }
-
-
/**
* This method is used to copy style files to a target
* Directory: css and background.
* Note that this method is static since it is
* also used when displaying a "preview"
*/
- public static void copyMedia(UCB copy, CGSettings settings, String targetDir, Task task ) throws Exception {
+ public static void copyMedia(UCB copy, CGSettings settings, String targetDir, Task task) throws Exception
+ {
//1. .css
- String sourceDir = FileAccess.connectURLs(settings.workPath , "styles");
+ String sourceDir = FileAccess.connectURLs(settings.workPath, "styles");
String filename = settings.cp_DefaultSession.getStyle().cp_CssHref;
- copy.copy(sourceDir,filename,targetDir,"style.css");
+ copy.copy(sourceDir, filename, targetDir, "style.css");
task.advance(true);
//2. background image
String background = settings.cp_DefaultSession.cp_Design.cp_BackgroundImage;
- if (background != null && !background.equals("")) {
+ if (background != null && !background.equals(""))
+ {
sourceDir = FileAccess.getParentDir(background);
filename = background.substring(sourceDir.length());
- copy.copy(sourceDir,filename,targetDir + "/images","background.gif");
+ copy.copy(sourceDir, filename, targetDir + "/images", "background.gif");
}
task.advance(true);
@@ -323,28 +332,30 @@ public class Process implements WebWizardConst, ProcessErrors {
* @throws Exception
*/
public static void copyStaticImages(UCB copy, CGSettings settings, String targetDir)
- throws Exception
+ throws Exception
{
- copy.copy(FileAccess.connectURLs(settings.workPath , "images") ,targetDir+"/images");
+ copy.copy(FileAccess.connectURLs(settings.workPath, "images"), targetDir + "/images");
}
-
/**
* publish the given directory.
* @param dir the source directory to publish from
* @param task task tracking.
* @return true if should continue
*/
- private boolean publish(String dir, Task task ) {
+ private boolean publish(String dir, Task task)
+ {
task.setSubtaskName(TASK_PUBLISH_PREPARE);
ConfigSet set = settings.cp_DefaultSession.cp_Publishing;
- try {
+ try
+ {
- copyMedia(ucb, settings, dir,task);
- copyStaticImages(ucb,settings,dir);
+ copyMedia(ucb, settings, dir, task);
+ copyStaticImages(ucb, settings, dir);
task.advance(true);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
//error in copying media
error(ex, "", ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL);
return false;
@@ -352,19 +363,23 @@ public class Process implements WebWizardConst, ProcessErrors {
boolean result = true;
- for (int i = 0; i < set.getSize(); i++) {
+ for (int i = 0; i < set.getSize(); i++)
+ {
- CGPublish p = (CGPublish)set.getElementAt(i);
+ CGPublish p = (CGPublish) set.getElementAt(i);
- if (p.cp_Publish) {
+ if (p.cp_Publish)
+ {
- String key = (String)set.getKey(p);
+ String key = (String) set.getKey(p);
task.setSubtaskName(key);
if (key.equals(ZIP_PUBLISHER))
+ {
fileAccess.delete(p.cp_URL);
-
- if (!publish(dir, p, ucb, task)) {
+ }
+ if (!publish(dir, p, ucb, task))
+ {
return false;
}
@@ -383,63 +398,69 @@ public class Process implements WebWizardConst, ProcessErrors {
* @param task task tracking
* @return true if should continue
*/
- private boolean publish(String dir,CGPublish publish,UCB copy,Task task) {
- try {
+ private boolean publish(String dir, CGPublish publish, UCB copy, Task task)
+ {
+ try
+ {
//copy.deleteDirContent(publish.url);
task.advance(true);
- copy.copy(dir,publish.url);
+ copy.copy(dir, publish.url);
task.advance(true);
return true;
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
task.advance(false);
- return error(e,publish, ERROR_PUBLISH,ErrorHandler.ERROR_NORMAL_IGNORE);
+ return error(e, publish, ERROR_PUBLISH, ErrorHandler.ERROR_NORMAL_IGNORE);
}
}
-
-
//GENERATING METHODS
-
/**
* Generates the TOC pages for the current session.
* @param targetDir generating to this directory.
*/
- public boolean generate(String targetDir, Task task) {
+ public boolean generate(String targetDir, Task task)
+ {
boolean result = false;
task.setSubtaskName(TASK_GENERATE_PREPARE);
- CGLayout layout = settings.cp_DefaultSession.getLayout();
+ CGLayout layout = settings.cp_DefaultSession.getLayout();
- try {
- /*
- * here I create the DOM of the TOC to pass to the XSL
- */
- Document doc = (Document)settings.cp_DefaultSession.createDOM();
- generate(xmsf,layout,doc ,fileAccess,targetDir,task);
+ try
+ {
+ /*
+ * here I create the DOM of the TOC to pass to the XSL
+ */
+ Document doc = (Document) settings.cp_DefaultSession.createDOM();
+ generate(xmsf, layout, doc, fileAccess, targetDir, task);
- }
- catch (Exception ex) {
- error(ex, "" , ERROR_GENERATE_XSLT ,ErrorHandler.ERROR_PROCESS_FATAL);
- return false;
- }
+ }
+ catch (Exception ex)
+ {
+ error(ex, "", ERROR_GENERATE_XSLT, ErrorHandler.ERROR_PROCESS_FATAL);
+ return false;
+ }
- /* copy files which are not xsl from layout directory to
- * website root.
- */
- try {
+ /* copy files which are not xsl from layout directory to
+ * website root.
+ */
+ try
+ {
- task.setSubtaskName(TASK_GENERATE_COPY);
+ task.setSubtaskName(TASK_GENERATE_COPY);
- copyLayoutFiles(ucb,fileAccess,settings,layout,targetDir);
+ copyLayoutFiles(ucb, fileAccess, settings, layout, targetDir);
- task.advance(true);
+ task.advance(true);
- result = true;
- }
- catch (Exception ex) {
- task.advance(false);
- return error(ex,null,ERROR_GENERATE_COPY,ErrorHandler.ERROR_NORMAL_ABORT);
- }
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ task.advance(false);
+ return error(ex, null, ERROR_GENERATE_COPY, ErrorHandler.ERROR_NORMAL_ABORT);
+ }
@@ -458,11 +479,11 @@ public class Process implements WebWizardConst, ProcessErrors {
* @throws Exception
*/
public static void copyLayoutFiles(UCB ucb, FileAccess fileAccess, CGSettings settings, CGLayout layout, String targetDir)
- throws Exception
+ throws Exception
{
String filesPath = fileAccess.getURL(
- FileAccess.connectURLs(settings.workPath , "layouts/"), layout.cp_FSName );
- ucb.copy(filesPath,targetDir,new ExtensionVerifier("xsl"));
+ FileAccess.connectURLs(settings.workPath, "layouts/"), layout.cp_FSName);
+ ucb.copy(filesPath, targetDir, new ExtensionVerifier("xsl"));
}
@@ -480,31 +501,32 @@ public class Process implements WebWizardConst, ProcessErrors {
* @throws Exception
*/
public static void generate(
- XMultiServiceFactory xmsf,
- CGLayout layout,
- Document doc,
- FileAccess fileAccess,
- String targetPath,
- Task task)
- throws Exception
+ XMultiServiceFactory xmsf,
+ CGLayout layout,
+ Document doc,
+ FileAccess fileAccess,
+ String targetPath,
+ Task task)
+ throws Exception
{
/*
* a map that contains xsl templates. the keys are the xsl file names.
*/
Map templates = layout.getTemplates(xmsf);
- task.advance(true,TASK_GENERATE_XSL);
+ task.advance(true, TASK_GENERATE_XSL);
/*
* each template generates a page.
*/
- for (Iterator i = templates.keySet().iterator() ; i.hasNext(); ) {
+ for (Iterator i = templates.keySet().iterator(); i.hasNext();)
+ {
String key = "";
- key = (String)i.next();
+ key = (String) i.next();
- Transformer transformer = ((Templates)templates.get(key)).newTransformer();
+ Transformer transformer = ((Templates) templates.get(key)).newTransformer();
doc.normalize();
task.advance(true);
@@ -513,7 +535,7 @@ public class Process implements WebWizardConst, ProcessErrors {
* The target file name is like the xsl template filename
* without the .xsl extension.
*/
- String fn = fileAccess.getPath( targetPath, key.substring(0,key.length()-4));
+ String fn = fileAccess.getPath(targetPath, key.substring(0, key.length() - 4));
File f = new File(fn);
FileOutputStream oStream = new FileOutputStream(f);
// Due to a problem occuring when using Xalan-Java 2.6.0 and
@@ -521,13 +543,12 @@ public class Process implements WebWizardConst, ProcessErrors {
// StreamResult's getSystemId would return a "file:/..." URL while
// the Xalan code expects a "file:///..." URL):
transformer.transform(
- new DOMSource(doc), new StreamResult(oStream) );
+ new DOMSource(doc), new StreamResult(oStream));
oStream.close();
task.advance(true);
}
}
-
/**
* I broke the export method to two methods
* in a time where a tree with more than one contents was planned.
@@ -535,7 +556,8 @@ public class Process implements WebWizardConst, ProcessErrors {
* @param task
* @return
*/
- private boolean export(Task task) {
+ private boolean export(Task task)
+ {
return export(settings.cp_DefaultSession.cp_Content, tempDir, task);
@@ -551,11 +573,13 @@ public class Process implements WebWizardConst, ProcessErrors {
* @param task
* @return true if should continue
*/
- private boolean export(CGContent content, String dir, Task task) {
+ private boolean export(CGContent content, String dir, Task task)
+ {
int toPerform = 1;
String contentDir = dir;
- try {
+ try
+ {
task.setSubtaskName(TASK_EXPORT_PREPARE);
@@ -564,56 +588,68 @@ public class Process implements WebWizardConst, ProcessErrors {
* is created in its own directory.
* faileure here is fatal.
*/
- contentDir = fileAccess.createNewDir(dir,content.cp_Name);
- if (contentDir == null || contentDir.equals("") )
+ contentDir = fileAccess.createNewDir(dir, content.cp_Name);
+ if (contentDir == null || contentDir.equals(""))
+ {
throw new IOException("Directory " + dir + " could not be created.");
+ }
content.dirName = FileAccess.getFilename(contentDir);
- task.advance(true,TASK_EXPORT_DOCUMENTS);
+ task.advance(true, TASK_EXPORT_DOCUMENTS);
toPerform--;
/*2. export all documents and sub contents.
* (at the moment, only documents, no subcontents)
*/
Object item = null;
- for (int i = 0; i < content.cp_Documents.getSize(); i++) {
- try {
+ for (int i = 0; i < content.cp_Documents.getSize(); i++)
+ {
+ try
+ {
item = content.cp_Documents.getElementAt(i);
/*
* In present this is always the case.
* may be in the future, when
* a tree is used, it will be abit different.
*/
- if (item instanceof CGDocument) {
- if (!export((CGDocument) item, contentDir,task))
- return false;
- }
- else
- /*
- * we never get here since we
- * did not implement sub-contents.
- */
- if (!export((CGContent) item, contentDir,task))
+ if (item instanceof CGDocument)
+ {
+ if (!export((CGDocument) item, contentDir, task))
+ {
return false;
+ }
+ }
+ else /*
+ * we never get here since we
+ * did not implement sub-contents.
+ */ if (!export((CGContent) item, contentDir, task))
+ {
+ return false;
+ }
}
- catch (SecurityException sx) {
+ catch (SecurityException sx)
+ {
// nonfatal
- if (!error(sx,item, ERROR_EXPORT_SECURITY,ErrorHandler.ERROR_NORMAL_IGNORE))
- return false;
+ if (!error(sx, item, ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE))
+ {
+ return false;
+ }
result = false;
}
}
}
- catch (IOException iox) {
+ catch (IOException iox)
+ {
//nonfatal
- return error(iox,content,ERROR_EXPORT_IO,ErrorHandler.ERROR_NORMAL_IGNORE);
+ return error(iox, content, ERROR_EXPORT_IO, ErrorHandler.ERROR_NORMAL_IGNORE);
}
- catch (SecurityException se) {
+ catch (SecurityException se)
+ {
//nonfatal
- return error(se,content,ERROR_EXPORT_SECURITY,ErrorHandler.ERROR_NORMAL_IGNORE);
+ return error(se, content, ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE);
}
- failTask(task,toPerform);
+ failTask(task, toPerform);
return true;
}
@@ -625,23 +661,29 @@ public class Process implements WebWizardConst, ProcessErrors {
* @param task task tracking
* @return true if should continue
*/
- private boolean export(CGDocument doc, String dir,Task task) {
+ private boolean export(CGDocument doc, String dir, Task task)
+ {
//first I check if the document was already validated...
if (!doc.valid)
- try {
- doc.validate(xmsf,null);
- }
- catch (Exception ex){
- //fatal
- error(ex,doc,ERROR_DOC_VALIDATE,ErrorHandler.ERROR_PROCESS_FATAL);
- return false;
- }
+ {
+ try
+ {
+ doc.validate(xmsf, null);
+ }
+ catch (Exception ex)
+ {
+ //fatal
+ error(ex, doc, ERROR_DOC_VALIDATE, ErrorHandler.ERROR_PROCESS_FATAL);
+ return false;
+ }
//get the exporter specified for this document
- CGExporter exporter = (CGExporter)settings.cp_Exporters.getElement(doc.cp_Exporter);
+ }
+ CGExporter exporter = (CGExporter) settings.cp_Exporters.getElement(doc.cp_Exporter);
- try {
+ try
+ {
/*
* here I calculate the destination filename.
@@ -652,24 +694,23 @@ public class Process implements WebWizardConst, ProcessErrors {
String docFilename = FileAccess.getFilename(doc.cp_URL);
String docExt = FileAccess.getExtension(docFilename);
- String fn = doc.localFilename.substring(0,doc.localFilename.length()-docExt.length()-1); //filename without extension
+ String fn = doc.localFilename.substring(0, doc.localFilename.length() - docExt.length() - 1); //filename without extension
/*
* the copyExporter does not change
* the extension of the target...
*/
- String destExt = (
- exporter.cp_Extension.equals("")
- ? FileAccess.getExtension(docFilename)
- : exporter.cp_Extension
- );
+ String destExt = (exporter.cp_Extension.equals("")
+ ? FileAccess.getExtension(docFilename)
+ : exporter.cp_Extension);
/* if this filter needs to export to its own directory...
* this is the case in, for example, impress html export
*/
- if (exporter.cp_OwnDirectory) { //+++
- dir = fileAccess.createNewDir(dir, fn );
- doc.dirName = FileAccess.getFilename(dir);
+ if (exporter.cp_OwnDirectory)
+ { //+++
+ dir = fileAccess.createNewDir(dir, fn);
+ doc.dirName = FileAccess.getFilename(dir);
}
/*
@@ -678,7 +719,7 @@ public class Process implements WebWizardConst, ProcessErrors {
* i get a new filename, so I do not
* overwrite files...
*/
- String file = fileAccess.getNewFile(dir,fn,destExt);
+ String file = fileAccess.getNewFile(dir, fn, destExt);
/* set filename with extension.
@@ -689,7 +730,8 @@ public class Process implements WebWizardConst, ProcessErrors {
task.advance(true);
- try {
+ try
+ {
//export
getExporter(exporter).export(doc, file, xmsf, task);
task.advance(true);
@@ -699,16 +741,22 @@ public class Process implements WebWizardConst, ProcessErrors {
* IllegalAccessException, InstantiationException, ClassNotFoundException
* export() throws Exception
*/
- catch (Exception ex) {
+ catch (Exception ex)
+ {
//nonfatal
if (!error(ex, doc, ERROR_EXPORT, ErrorHandler.ERROR_NORMAL_IGNORE))
- return false;
+ {
+ return false;
+ }
}
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
//nonfatal
- if (!error(ex,doc,ERROR_EXPORT_MKDIR,ErrorHandler.ERROR_NORMAL_ABORT))
- return false;
+ if (!error(ex, doc, ERROR_EXPORT_MKDIR, ErrorHandler.ERROR_NORMAL_ABORT))
+ {
+ return false;
+ }
}
return true;
@@ -723,21 +771,24 @@ public class Process implements WebWizardConst, ProcessErrors {
* @param errType error type
* @return the interaction result
*/
- private boolean error(Exception ex, Object arg1, int arg2, int errType) {
+ private boolean error(Exception ex, Object arg1, int arg2, int errType)
+ {
result = false;
- return errorHandler.error(ex,arg1,arg2,errType);
+ return errorHandler.error(ex, arg1, arg2, errType);
}
-
/**
* advances the given task in the given count of steps,
* marked as failed.
* @param task the task to advance
* @param count the number of steps to advance
*/
- private void failTask(Task task, int count) {
+ private void failTask(Task task, int count)
+ {
while (count-- > 0)
- task.advance(false);
+ {
+ task.advance(false);
+ }
}
/**
@@ -751,9 +802,9 @@ public class Process implements WebWizardConst, ProcessErrors {
* @throws InstantiationException
*/
private Exporter createExporter(CGExporter export)
- throws ClassNotFoundException,
- IllegalAccessException,
- InstantiationException
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException
{
Exporter e = (Exporter) Class.forName(export.cp_ExporterClass).newInstance();
e.init(export);
@@ -772,14 +823,15 @@ public class Process implements WebWizardConst, ProcessErrors {
* @throws InstantiationException thrown when using Class.forName(string)
*/
private Exporter getExporter(CGExporter export)
- throws ClassNotFoundException,
- IllegalAccessException,
- InstantiationException
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException
{
- Exporter exp = (Exporter)exporters.get(export);
- if (exp == null) {
+ Exporter exp = (Exporter) exporters.get(export);
+ if (exp == null)
+ {
exp = createExporter(export);
- exporters.put(export,exp);
+ exporters.put(export, exp);
}
return exp;
}
@@ -788,8 +840,8 @@ public class Process implements WebWizardConst, ProcessErrors {
* @return tru if everything went smooth, false
* if error(s) accured.
*/
- public boolean getResult() {
+ public boolean getResult()
+ {
return (myTask.getFailed() == 0) && result;
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/ProcessErrorHandler.java b/wizards/com/sun/star/wizards/web/ProcessErrorHandler.java
index 0956e263952a..62e0d7be3034 100644
--- a/wizards/com/sun/star/wizards/web/ProcessErrorHandler.java
+++ b/wizards/com/sun/star/wizards/web/ProcessErrorHandler.java
@@ -45,49 +45,50 @@ import com.sun.star.wizards.web.data.CGPublish;
* that accured.
*/
public class ProcessErrorHandler extends AbstractErrorHandler
- implements WebWizardConst,
- ProcessErrors
+ implements WebWizardConst,
+ ProcessErrors
{
- private static final String FILENAME= "%FILENAME";
+ private static final String FILENAME = "%FILENAME";
private static final String URL = "%URL";
private static final String ERROR = "%ERROR";
-
-
WebWizardDialogResources resources;
- public ProcessErrorHandler(XMultiServiceFactory xmsf, XWindowPeer peer, WebWizardDialogResources res) {
+ public ProcessErrorHandler(XMultiServiceFactory xmsf, XWindowPeer peer, WebWizardDialogResources res)
+ {
super(xmsf, peer);
resources = res;
}
- protected String getMessageFor(Exception ex, Object obj, int ix, int errType) {
+ protected String getMessageFor(Exception ex, Object obj, int ix, int errType)
+ {
- switch (ix) {
+ switch (ix)
+ {
- case ERROR_MKDIR :
+ case ERROR_MKDIR:
return JavaTools.replaceSubString(resources.resErrDocExport, ((CGDocument) obj).localFilename, FILENAME);
- case ERROR_EXPORT_MKDIR :
+ case ERROR_EXPORT_MKDIR:
return JavaTools.replaceSubString(resources.resErrMkDir, ((CGDocument) obj).localFilename, FILENAME);
- case ERROR_DOC_VALIDATE :
+ case ERROR_DOC_VALIDATE:
return JavaTools.replaceSubString(resources.resErrDocInfo, ((CGDocument) obj).localFilename, FILENAME);
- case ERROR_EXPORT_IO :
+ case ERROR_EXPORT_IO:
return JavaTools.replaceSubString(resources.resErrExportIO, ((CGDocument) obj).localFilename, FILENAME);
- case ERROR_EXPORT_SECURITY :
+ case ERROR_EXPORT_SECURITY:
return JavaTools.replaceSubString(resources.resErrSecurity, ((CGDocument) obj).localFilename, FILENAME);
- case ERROR_GENERATE_XSLT :
+ case ERROR_GENERATE_XSLT:
return resources.resErrTOC;
- case ERROR_GENERATE_COPY :
+ case ERROR_GENERATE_COPY:
return resources.resErrTOCMedia;
- case ERROR_PUBLISH :
+ case ERROR_PUBLISH:
return JavaTools.replaceSubString(resources.resErrPublish, ((CGPublish) obj).cp_URL, URL);
- case ERROR_EXPORT :
- case ERROR_PUBLISH_MEDIA :
+ case ERROR_EXPORT:
+ case ERROR_PUBLISH_MEDIA:
return resources.resErrPublishMedia;
- case ERROR_CLEANUP :
+ case ERROR_CLEANUP:
return resources.resErrUnexpected;
- default :
+ default:
return JavaTools.replaceSubString(resources.resErrUnknown, ex.getClass().getName() + "/" + obj.getClass().getName() + "/" + ix, ERROR);
}
}
diff --git a/wizards/com/sun/star/wizards/web/ProcessErrors.java b/wizards/com/sun/star/wizards/web/ProcessErrors.java
index f7af4dc64b9e..0485c754eb6a 100644
--- a/wizards/com/sun/star/wizards/web/ProcessErrors.java
+++ b/wizards/com/sun/star/wizards/web/ProcessErrors.java
@@ -34,22 +34,18 @@ package com.sun.star.wizards.web;
* Error IDs for errors that can accure
* in the interaction with the Process class.
*/
-public interface ProcessErrors {
+public interface ProcessErrors
+{
public final static int ERROR_MKDIR = 0;
-
public final static int ERROR_EXPORT = 1;
public final static int ERROR_EXPORT_MKDIR = 2;
public final static int ERROR_DOC_VALIDATE = 3;
public final static int ERROR_EXPORT_IO = 4;
public final static int ERROR_EXPORT_SECURITY = 5;
-
public final static int ERROR_GENERATE_XSLT = 6;
public final static int ERROR_GENERATE_COPY = 7;
-
public final static int ERROR_PUBLISH = 8;
public final static int ERROR_PUBLISH_MEDIA = 9;
-
public final static int ERROR_CLEANUP = 10;
-
}
diff --git a/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java b/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java
index 9471884b5943..a688ffb7fdd6 100644
--- a/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java
+++ b/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java
@@ -42,27 +42,30 @@ import com.sun.star.wizards.common.Renderer;
* display the current task status.
* (renders the state to resource strings)
*/
-public class ProcessStatusRenderer implements Renderer, WebWizardConst {
+public class ProcessStatusRenderer implements Renderer, WebWizardConst
+{
+
Map strings = new Hashtable(12);
- public ProcessStatusRenderer(WebWizardDialogResources res) {
- strings.put(TASK_EXPORT_DOCUMENTS , res.resTaskExportDocs );
- strings.put(TASK_EXPORT_PREPARE , res.resTaskExportPrepare );
- strings.put(TASK_GENERATE_COPY , res.resTaskGenerateCopy );
- strings.put(TASK_GENERATE_PREPARE , res.resTaskGeneratePrepare );
- strings.put(TASK_GENERATE_XSL , res.resTaskGenerateXsl );
- strings.put(TASK_PREPARE , res.resTaskPrepare );
+ public ProcessStatusRenderer(WebWizardDialogResources res)
+ {
+ strings.put(TASK_EXPORT_DOCUMENTS, res.resTaskExportDocs);
+ strings.put(TASK_EXPORT_PREPARE, res.resTaskExportPrepare);
+ strings.put(TASK_GENERATE_COPY, res.resTaskGenerateCopy);
+ strings.put(TASK_GENERATE_PREPARE, res.resTaskGeneratePrepare);
+ strings.put(TASK_GENERATE_XSL, res.resTaskGenerateXsl);
+ strings.put(TASK_PREPARE, res.resTaskPrepare);
//strings.put(TASK_PUBLISH , res.resTaskPublish );
- strings.put(LOCAL_PUBLISHER, res.resTaskPublishLocal );
- strings.put(ZIP_PUBLISHER, res.resTaskPublishZip );
- strings.put(FTP_PUBLISHER, res.resTaskPublishFTP );
+ strings.put(LOCAL_PUBLISHER, res.resTaskPublishLocal);
+ strings.put(ZIP_PUBLISHER, res.resTaskPublishZip);
+ strings.put(FTP_PUBLISHER, res.resTaskPublishFTP);
- strings.put(TASK_PUBLISH_PREPARE , res.resTaskPublishPrepare );
- strings.put(TASK_FINISH , res.resTaskFinish );
+ strings.put(TASK_PUBLISH_PREPARE, res.resTaskPublishPrepare);
+ strings.put(TASK_FINISH, res.resTaskFinish);
}
- public String render(Object object) {
- return (String)strings.get(object);
+ public String render(Object object)
+ {
+ return (String) strings.get(object);
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/StatusDialog.java b/wizards/com/sun/star/wizards/web/StatusDialog.java
index cb0a1efa1598..bf8c57ad2b6a 100644
--- a/wizards/com/sun/star/wizards/web/StatusDialog.java
+++ b/wizards/com/sun/star/wizards/web/StatusDialog.java
@@ -50,23 +50,20 @@ import com.sun.star.wizards.ui.event.TaskListener;
* status display of more complex tasks.
*
*/
-public class StatusDialog extends UnoDialog2 implements TaskListener {
+public class StatusDialog extends UnoDialog2 implements TaskListener
+{
public static final int STANDARD_WIDTH = 240;
-
private XProgressBar progressBar;
private XFixedText lblTaskName;
private XFixedText lblCounter;
private XButton btnCancel;
-
private String[] res;
private Renderer renderer;
private boolean enableBreak = false;
private boolean closeOnFinish = true;
private MethodInvocation finishedMethod;
-
private UnoDialog parent;
-
private boolean finished;
/**
@@ -75,39 +72,70 @@ public class StatusDialog extends UnoDialog2 implements TaskListener {
* following order:
* dialog title, cancel, close, counter prefix, counter midfix, counter postfix
*/
- public StatusDialog(XMultiServiceFactory xmsf, int width, String taskName, boolean displayCount,String[] resources, String hid) {
+ public StatusDialog(XMultiServiceFactory xmsf, int width, String taskName, boolean displayCount, String[] resources, String hid)
+ {
super(xmsf);
res = resources;
if (res.length != 6)
- throw new IllegalArgumentException("The resources argument should contain 6 Strings, see Javadoc on constructor.");
-
- //display a close button?
+ {
+ throw new IllegalArgumentException("The resources argument should contain 6 Strings, see Javadoc on constructor."); //display a close button?
// if enableBreak == false and closeOnFinsih == false;
+ }
boolean b = !enableBreak && !closeOnFinish;
Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Closeable","Height","HelpURL","Moveable","Name","PositionX","PositionY","Step","Title","Width"},
- new Object[] { Boolean.FALSE, new Integer(6 + 25 + (b ? 27 : 7)), hid, Boolean.TRUE,"StatusDialog",new Integer(102),new Integer(52), new Integer(0),res[0],new Integer(width)}
- );
+ new String[]
+ {
+ "Closeable", "Height", "HelpURL", "Moveable", "Name", "PositionX", "PositionY", "Step", "Title", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, new Integer(6 + 25 + (b ? 27 : 7)), hid, Boolean.TRUE, "StatusDialog", new Integer(102), new Integer(52), new Integer(0), res[0], new Integer(width)
+ });
short tabstop = 1;
- lblTaskName = insertLabel("lblTask" ,
- new String[] {"Height","Label","PositionX","PositionY","TabIndex","Width"},
- new Object[] { new Integer(8),taskName,new Integer(6),new Integer(6),new Short(tabstop++), new Integer(width * 2 / 3)});
+ lblTaskName = insertLabel("lblTask",
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), taskName, new Integer(6), new Integer(6), new Short(tabstop++), new Integer(width * 2 / 3)
+ });
lblCounter = insertLabel("lblCounter",
- new String[] {"Height","Label","PositionX","PositionY","TabIndex","Width"},
- new Object[] { new Integer(8),"",new Integer(width * 2 / 3),new Integer(6),new Short(tabstop++), new Integer(width / 3 - 4)});
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(8), "", new Integer(width * 2 / 3), new Integer(6), new Short(tabstop++), new Integer(width / 3 - 4)
+ });
progressBar = insertProgressBar("progress",
- new String[] {"Height","PositionX","PositionY","TabIndex","Width"},
- new Object[] { new Integer(10),new Integer(6),new Integer(16),new Short(tabstop++), new Integer(width -12)});
-
-
- if (b) {
- btnCancel = insertButton("btnCancel","performCancel",this,
- new String[] {"Height","Label","PositionX","PositionY","TabIndex","Width"},
- new Object[] { new Integer(14),res[1] ,new Integer(width / 2 - 20 ),new Integer(6+25+ 7 ),new Short(tabstop++), new Integer(40)});
+ new String[]
+ {
+ "Height", "PositionX", "PositionY", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(10), new Integer(6), new Integer(16), new Short(tabstop++), new Integer(width - 12)
+ });
+
+
+ if (b)
+ {
+ btnCancel = insertButton("btnCancel", "performCancel", this,
+ new String[]
+ {
+ "Height", "Label", "PositionX", "PositionY", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(14), res[1], new Integer(width / 2 - 20), new Integer(6 + 25 + 7), new Short(tabstop++), new Integer(40)
+ });
}
// xWindow.addWindowListener((XWindowListener)guiEventListener);
@@ -115,20 +143,26 @@ public class StatusDialog extends UnoDialog2 implements TaskListener {
}
- private void initProgressBar(Task t) {
- progressBar.setRange(0,t.getMax());
+ private void initProgressBar(Task t)
+ {
+ progressBar.setRange(0, t.getMax());
progressBar.setValue(0);
}
- private void setStatus(int status) {
- if (finished) return;
+ private void setStatus(int status)
+ {
+ if (finished)
+ {
+ return;
+ }
progressBar.setValue(status);
xReschedule.reschedule();
}
- public void setLabel(String s) {
+ public void setLabel(String s)
+ {
// lblTaskName.setText(s);
- Helper.setUnoPropertyValue( UnoDialog.getModel(lblTaskName), "Label", s);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lblTaskName), "Label", s);
xReschedule.reschedule();
}
@@ -136,16 +170,21 @@ public class StatusDialog extends UnoDialog2 implements TaskListener {
* change the max property of the status bar
* @param max
*/
- private void setMax(int max) {
- if (finished) return;
- Helper.setUnoPropertyValue(getModel(progressBar),"ProgressValueMax", new Integer(max));
+ private void setMax(int max)
+ {
+ if (finished)
+ {
+ return;
+ }
+ Helper.setUnoPropertyValue(getModel(progressBar), "ProgressValueMax", new Integer(max));
}
/**
* initialize the status bar according
* to the given event.
*/
- public void taskStarted(TaskEvent te) {
+ public void taskStarted(TaskEvent te)
+ {
finished = false;
initProgressBar(te.getTask());
}
@@ -153,27 +192,35 @@ public class StatusDialog extends UnoDialog2 implements TaskListener {
/**
* closes the dialog.
*/
- public void taskFinished(TaskEvent te) {
+ public void taskFinished(TaskEvent te)
+ {
finished = true;
- if (closeOnFinish) {
+ if (closeOnFinish)
+ {
// xDialog.endExecute();
parent.xWindow.setEnable(true);
- try {
+ try
+ {
xWindow.setVisible(false);
xComponent.dispose();
- //System.out.println("disposed");
+ //System.out.println("disposed");
}
- catch (Exception ex) {ex.printStackTrace();}
- }
- else
- Helper.setUnoPropertyValue(getModel(btnCancel),"Label",res[2]);
-
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(getModel(btnCancel), "Label", res[2]);
+ }
}
/**
* changes the status display
*/
- public void taskStatusChanged(TaskEvent te) {
+ public void taskStatusChanged(TaskEvent te)
+ {
setMax(te.getTask().getMax());
setStatus(te.getTask().getStatus());
}
@@ -183,9 +230,12 @@ public class StatusDialog extends UnoDialog2 implements TaskListener {
* A renderer is used to render
* the task's subtask name to a resource string.
*/
- public void subtaskNameChanged(TaskEvent te) {
+ public void subtaskNameChanged(TaskEvent te)
+ {
if (renderer != null)
+ {
setLabel(renderer.render(te.getTask().getSubtaskName()));
+ }
}
/**
@@ -193,11 +243,14 @@ public class StatusDialog extends UnoDialog2 implements TaskListener {
* @param parent the parent dialog
* @param r what to do
*/
- public void execute(final UnoDialog parent_, final Task task, String title) {
- try {
+ public void execute(final UnoDialog parent_, final Task task, String title)
+ {
+ try
+ {
this.parent = parent_;
- Helper.setUnoPropertyValue( this.xDialogModel, "Title", title );
- try {
+ Helper.setUnoPropertyValue(this.xDialogModel, "Title", title);
+ try
+ {
//TODO change this to another execute dialog method.
task.addTaskListener(StatusDialog.this);
setMax(10);
@@ -206,12 +259,17 @@ public class StatusDialog extends UnoDialog2 implements TaskListener {
parent.xWindow.setEnable(false);
setVisible(parent);
if (finishedMethod != null)
+ {
finishedMethod.invoke();
- } catch (Exception e) {
+ }
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -219,22 +277,24 @@ public class StatusDialog extends UnoDialog2 implements TaskListener {
/**
* not supported !
*/
- public void performCancel() {//TODO - implement a thread thing here...
+ public void performCancel()
+ {//TODO - implement a thread thing here...
xWindow.setVisible(false);
}
-
/**
* @return the subTask renderer object
*/
- public Renderer getRenderer() {
+ public Renderer getRenderer()
+ {
return renderer;
}
/**
* @param renderer
*/
- public void setRenderer(Renderer renderer) {
+ public void setRenderer(Renderer renderer)
+ {
this.renderer = renderer;
}
@@ -242,9 +302,8 @@ public class StatusDialog extends UnoDialog2 implements TaskListener {
* sets a method to be invoced when the
*
*/
- public void setFinishedMethod(MethodInvocation mi) {
+ public void setFinishedMethod(MethodInvocation mi)
+ {
finishedMethod = mi;
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/web/StylePreview.java b/wizards/com/sun/star/wizards/web/StylePreview.java
index 3cb976cc0c86..4d41ca93fed5 100644
--- a/wizards/com/sun/star/wizards/web/StylePreview.java
+++ b/wizards/com/sun/star/wizards/web/StylePreview.java
@@ -43,7 +43,9 @@ import com.sun.star.wizards.web.data.CGStyle;
* on request, according to the current style/background selection
* of the user.
*/
-public class StylePreview {
+public class StylePreview
+{
+
private FileAccess fileAccess;
/**
* the destination html url.
@@ -66,25 +68,25 @@ public class StylePreview {
*/
private String wwRoot;
-
/**
* copies the html file to the temp directory, and calculates the
* destination names of the background and css files.
* @param wwRoot is the root directory of the web wizard files (
* usually [oo]/share/template/[lang]/wizard/web
*/
- public StylePreview(XMultiServiceFactory xmsf, String wwRoot_) throws Exception {
+ public StylePreview(XMultiServiceFactory xmsf, String wwRoot_) throws Exception
+ {
fileAccess = new FileAccess(xmsf);
tempDir = createTempDir(xmsf);
- htmlFilename = FileAccess.connectURLs(tempDir , "wwpreview.html");
- cssFilename = FileAccess.connectURLs(tempDir ,"style.css");
- backgroundFilename = FileAccess.connectURLs(tempDir , "images/background.gif");
+ htmlFilename = FileAccess.connectURLs(tempDir, "wwpreview.html");
+ cssFilename = FileAccess.connectURLs(tempDir, "style.css");
+ backgroundFilename = FileAccess.connectURLs(tempDir, "images/background.gif");
wwRoot = wwRoot_;
- fileAccess.copy(FileAccess.connectURLs(wwRoot,"preview.html"), htmlFilename);
+ fileAccess.copy(FileAccess.connectURLs(wwRoot, "preview.html"), htmlFilename);
}
/**
@@ -94,30 +96,38 @@ public class StylePreview {
* @param background
* @throws Exception
*/
- public void refresh(CGStyle style, String background) throws Exception {
+ public void refresh(CGStyle style, String background) throws Exception
+ {
- String css = FileAccess.connectURLs(wwRoot , "styles/" + style.cp_CssHref);
+ String css = FileAccess.connectURLs(wwRoot, "styles/" + style.cp_CssHref);
- if (background == null || background.equals("")) {
+ if (background == null || background.equals(""))
+ {
//delete the background image
- if (fileAccess.exists(backgroundFilename,false))
- fileAccess.delete(backgroundFilename);
+ if (fileAccess.exists(backgroundFilename, false))
+ {
+ fileAccess.delete(backgroundFilename);
+ }
}
- else {
+ else
+ {
// a solaris bug workaround
// TODO
//copy the background image to the temp directory.
- fileAccess.copy(background,backgroundFilename);
+ fileAccess.copy(background, backgroundFilename);
}
//copy the actual css to the temp directory
- fileAccess.copy(css,cssFilename);
+ fileAccess.copy(css, cssFilename);
}
- public void cleanup() {
- try {
+ public void cleanup()
+ {
+ try
+ {
removeTempDir();
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -128,10 +138,11 @@ public class StylePreview {
* @return the url of the new directory.
* @throws Exception
*/
- private String createTempDir(XMultiServiceFactory xmsf) throws Exception {
- String tempPath = FileAccess.getOfficePath(xmsf,"Temp","", "") ;
+ private String createTempDir(XMultiServiceFactory xmsf) throws Exception
+ {
+ String tempPath = FileAccess.getOfficePath(xmsf, "Temp", "", "");
String s = fileAccess.createNewDir(tempPath, "wwiz");
- fileAccess.createNewDir(s,"images");
+ fileAccess.createNewDir(s, "images");
return s;
}
@@ -139,8 +150,8 @@ public class StylePreview {
* deletes/removes the temporary directroy.
* @throws Exception
*/
- private void removeTempDir() throws Exception {
+ private void removeTempDir() throws Exception
+ {
fileAccess.delete(tempDir);
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/TOCPreview.java b/wizards/com/sun/star/wizards/web/TOCPreview.java
index 6b5925494a9b..f12079d6f764 100644
--- a/wizards/com/sun/star/wizards/web/TOCPreview.java
+++ b/wizards/com/sun/star/wizards/web/TOCPreview.java
@@ -64,8 +64,9 @@ import com.sun.star.wizards.web.data.CGSettings;
* instanciation.
* The TOC is generated in refresh(...);
*/
+public class TOCPreview
+{
-public class TOCPreview {
private String tempDir = null;
private XMultiServiceFactory xmsf;
private FileAccess fileAccess;
@@ -84,19 +85,19 @@ public class TOCPreview {
* @throws Exception
*/
public TOCPreview(XMultiServiceFactory xmsf_, CGSettings settings, WebWizardDialogResources res, String tempDir_, XFrame _xFrame)
- throws Exception
+ throws Exception
{
xFrame = _xFrame;
xmsf = xmsf_;
resources = res;
fileAccess = new FileAccess(xmsf);
tempDir = tempDir_;
- loadArgs = loadArgs( FileAccess.connectURLs(tempDir,"/index.html") );
+ loadArgs = loadArgs(FileAccess.connectURLs(tempDir, "/index.html"));
openHyperlink = Desktop.getDispatchURL(xmsf, ".uno:OpenHyperlink");
xDispatch = Desktop.getDispatcher(xmsf, xFrame, "_top", openHyperlink);
ucb = new UCB(xmsf);
- Process.copyStaticImages(ucb ,settings,tempDir);
+ Process.copyStaticImages(ucb, settings, tempDir);
}
/**
@@ -106,21 +107,24 @@ public class TOCPreview {
* @throws Exception
*/
public void refresh(CGSettings settings)
- throws Exception
+ throws Exception
{
- Document doc = (Document)settings.cp_DefaultSession.createDOM();
+ Document doc = (Document) settings.cp_DefaultSession.createDOM();
CGLayout layout = settings.cp_DefaultSession.getLayout();
- Task task = new Task("","",10000);
- Process.generate(xmsf, layout, doc, fileAccess, tempDir, task);
- Process.copyLayoutFiles(ucb,fileAccess,settings,layout,tempDir);
+ Task task = new Task("", "", 10000);
+ Process.generate(xmsf, layout, doc, fileAccess, tempDir, task);
+ Process.copyLayoutFiles(ucb, fileAccess, settings, layout, tempDir);
xDispatch.dispatch(openHyperlink, loadArgs); //Dispatch.dispatch(openHyperlink, loadArgs);
}
-
- private PropertyValue[] loadArgs(String url) {
+ private PropertyValue[] loadArgs(String url)
+ {
PropertyValue pv = new PropertyValue();
pv.Name = "URL";
pv.Value = url;
- return new PropertyValue[] {pv};
+ return new PropertyValue[]
+ {
+ pv
+ };
}
}
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.java b/wizards/com/sun/star/wizards/web/WWD_Events.java
index 248db0bf1101..1bc654b67b51 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.java
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web;
+ ************************************************************************/
+package com.sun.star.wizards.web;
import javax.swing.ListModel;
@@ -63,11 +64,10 @@ import com.sun.star.wizards.web.data.CGSessionName;
* The only exception are the finish methods with the save
* session methods.
*/
-public abstract class WWD_Events extends WWD_Startup {
+public abstract class WWD_Events extends WWD_Startup
+{
private static final short[] EMPTY_SHORT_ARRAY = new short[0];
-
-
/**
* Tracks the current loaded session.
* If "" - it means the current session is the default one (empty)
@@ -80,14 +80,15 @@ public abstract class WWD_Events extends WWD_Startup {
* I add a window listener, which, when
* the window closes, deltes the temp directory.
*/
- public WWD_Events(XMultiServiceFactory xmsf) throws Exception {
+ public WWD_Events(XMultiServiceFactory xmsf) throws Exception
+ {
super(xmsf);
Create c = new Create();
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,chkFTP);
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkFTP);
xWindow.addKeyListener(c);
- xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,chkLocalDir);
+ xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkLocalDir);
xWindow.addKeyListener(c);
- xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,chkZip);
+ xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkZip);
xWindow.addKeyListener(c);
}
@@ -96,40 +97,47 @@ public abstract class WWD_Events extends WWD_Startup {
* EVENT and UI METHODS
* *******************************************************
* *********************************************************/
-
- protected void leaveStep(int nOldStep, int nNewStep) {
- if (nOldStep == 1 && nNewStep == 2) {
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+ if (nOldStep == 1 && nNewStep == 2)
+ {
// 1. check if the selected session is the same as the current one.
}
}
-
- protected void enterStep(int old, int newStep) {
- if ((old == 1)) {
+ protected void enterStep(int old, int newStep)
+ {
+ if ((old == 1))
+ {
String sessionToLoad = "";
short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems");
- if ( s.length == 0 || s[0] == 0 )
+ if (s.length == 0 || s[0] == 0)
+ {
sessionToLoad = "";
+ }
else
- sessionToLoad = ((CGSessionName)settings.cp_SavedSessions.getElementAt(s[0])).cp_Name;
- if ( !sessionToLoad.equals(currentSession))
+ {
+ sessionToLoad = ((CGSessionName) settings.cp_SavedSessions.getElementAt(s[0])).cp_Name;
+ }
+ if (!sessionToLoad.equals(currentSession))
+ {
loadSession(sessionToLoad);
-
+ }
}
- if (newStep == 5) {
-
+ if (newStep == 5)
+ {
}
}
/* *********************************
* STEP 1
*/
-
/**
* Called from the Uno event dispatcher when the
* user selects a saved session.
*/
- public void sessionSelected() {
+ public void sessionSelected()
+ {
short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems");
setEnabled(btnDelSession, s.length > 0 && s[0] > 0);
}
@@ -137,70 +145,90 @@ public abstract class WWD_Events extends WWD_Startup {
/**
* Ha ! the session should be loaded :-)
*/
- public void loadSession(final String sessionToLoad) {
- try {
- final StatusDialog sd = getStatusDialog();
-
- final Task task = new Task("LoadDocs", "", 10);
+ public void loadSession(final String sessionToLoad)
+ {
+ try
+ {
+ final StatusDialog sd = getStatusDialog();
- sd.execute(this, task, resources.resLoadingSession );
- task.start();
+ final Task task = new Task("LoadDocs", "", 10);
- setSelectedDoc(EMPTY_SHORT_ARRAY);
- Helper.setUnoPropertyValue(getModel(lstDocuments), "SelectedItems", EMPTY_SHORT_ARRAY);
- Helper.setUnoPropertyValue(getModel(lstDocuments),"StringItemList", EMPTY_STRING_ARRAY);
+ sd.execute(this, task, resources.resLoadingSession);
+ task.start();
- Object view = null;
+ setSelectedDoc(EMPTY_SHORT_ARRAY);
+ Helper.setUnoPropertyValue(getModel(lstDocuments), "SelectedItems", EMPTY_SHORT_ARRAY);
+ Helper.setUnoPropertyValue(getModel(lstDocuments), "StringItemList", EMPTY_STRING_ARRAY);
- if (sessionToLoad.equals(""))
- view= Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/DefaultSession", false);
- else {
- view = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/SavedSessions", false);
- view = Configuration.getNode(sessionToLoad, view);
- }
+ Object view = null;
- CGSession session = new CGSession();
- session.setRoot(settings);
- session.readConfiguration(view, CONFIG_READ_PARAM);
- task.setMax(session.cp_Content.cp_Documents.getSize() * 5 + 7);
- task.advance(true);
+ if (sessionToLoad.equals(""))
+ {
+ view = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/DefaultSession", false);
+ }
+ else
+ {
+ view = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/SavedSessions", false);
+ view = Configuration.getNode(sessionToLoad, view);
+ }
- if (sessionToLoad.equals(""))
- setSaveSessionName(session);
+ CGSession session = new CGSession();
+ session.setRoot(settings);
+ session.readConfiguration(view, CONFIG_READ_PARAM);
+ task.setMax(session.cp_Content.cp_Documents.getSize() * 5 + 7);
+ task.advance(true);
- mount(session, task, false, sd.xControl);
+ if (sessionToLoad.equals(""))
+ {
+ setSaveSessionName(session);
+ }
+ mount(session, task, false, sd.xControl);
- checkSteps();
- currentSession = sessionToLoad;
+ checkSteps();
+ currentSession = sessionToLoad;
- while (task.getStatus() <= task.getMax())
+ while (task.getStatus() <= task.getMax())
+ {
task.advance(false);
- task.removeTaskListener(sd);
- } catch (Exception ex) {
- unexpectedError(ex);
- }
+ }
+ task.removeTaskListener(sd);
+ }
+ catch (Exception ex)
+ {
+ unexpectedError(ex);
+ }
- try {
- refreshStylePreview(); updateIconsetText();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ try
+ {
+ refreshStylePreview();
+ updateIconsetText();
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
-
/**
* hmm. the user clicked the delete button.
*/
- public void delSession() {
+ public void delSession()
+ {
short[] selected = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems");
if (selected.length == 0)
+ {
return;
+ }
if (selected[0] == 0)
+ {
return;
- boolean confirm = AbstractErrorHandler.showMessage(xMSF,xControl.getPeer(), resources.resDelSessionConfirm, ErrorHandler.ERROR_QUESTION_NO);
- if (confirm) {
- try {
+ }
+ boolean confirm = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), resources.resDelSessionConfirm, ErrorHandler.ERROR_QUESTION_NO);
+ if (confirm)
+ {
+ try
+ {
String name = (String) settings.cp_SavedSessions.getKey(selected[0]);
// first delete the session from the registry/configuration.
@@ -210,26 +238,33 @@ public abstract class WWD_Events extends WWD_Startup {
settings.cp_SavedSessions.remove(selected[0]);
settings.savedSessions.remove(selected[0] - 1);
- short[] nextSelected = new short[] {(short) 0 };
+ short[] nextSelected = new short[]
+ {
+ (short) 0
+ };
// We try to select the same item index again, if possible
if (settings.cp_SavedSessions.getSize() > selected[0])
+ {
nextSelected[0] = selected[0];
+ }
else
- // this will always be available because
- // the user can not remove item 0.
- nextSelected[0] = (short)(selected[0] - 1);
-
- // if the <none> session will be selected, disable the remove button...
+ // this will always be available because
+ // the user can not remove item 0.
+ {
+ nextSelected[0] = (short) (selected[0] - 1); // if the <none> session will be selected, disable the remove button...
+ }
if (nextSelected[0] == 0)
- Helper.setUnoPropertyValue(getModel(btnDelSession), "Enabled", Boolean.FALSE);
-
- // select...
+ {
+ Helper.setUnoPropertyValue(getModel(btnDelSession), "Enabled", Boolean.FALSE); // select...
+ }
Helper.setUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems", nextSelected);
- //ListModelBinder.fillComboBox(cbSaveSettings, settings.savedSessions.items(), null);
+ //ListModelBinder.fillComboBox(cbSaveSettings, settings.savedSessions.items(), null);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
unexpectedError(ex);
}
@@ -239,25 +274,23 @@ public abstract class WWD_Events extends WWD_Startup {
/* ********************************
* STEP 2
*/
-
/**
* A method used by the UnoDataAware attached
* to the Documents listbox.
* See the concept of the DataAware objects to undestand
* why it is there...
*/
- public short[] getSelectedDoc() {
+ public short[] getSelectedDoc()
+ {
return selectedDoc;
}
-
private static String[] EMPTY_STRING_ARRAY = new String[0];
/* public void loadSessionSelected() {
- UIHelper.setEnabled(btnLoadSession,true);
- UIHelper.setEnabled(btnDelSession,true);
- }
- */
-
+ UIHelper.setEnabled(btnLoadSession,true);
+ UIHelper.setEnabled(btnDelSession,true);
+ }
+ */
/**
* when the user clicks another document
* in the listbox, this method is called,
@@ -265,18 +298,22 @@ public abstract class WWD_Events extends WWD_Startup {
* the textboxes title,description, author and export format
* to change
*/
- public void setSelectedDoc(short[] s) {
+ public void setSelectedDoc(short[] s)
+ {
CGDocument oldDoc = getDoc(selectedDoc);
CGDocument doc = getDoc(s);
if (doc == null)
+ {
fillExportList(EMPTY_STRING_ARRAY);
//I try to avoid refreshing the export list if
//the same type of document is chosen.
+ }
else if (oldDoc == null || (!oldDoc.appType.equals(doc.appType)))
+ {
fillExportList(settings.getExporters(doc.appType));
- else
- ; // do nothing
+ }
+ else; // do nothing
selectedDoc = s;
@@ -284,19 +321,20 @@ public abstract class WWD_Events extends WWD_Startup {
disableDocUpDown();
}
-
/**
* The user clicks the "Add" button.
* This will open a "FileOpen" dialog,
* and, if the user chooses more than one file,
* will open a status dialog, when validating each document.
*/
- public void addDocument() {
+ public void addDocument()
+ {
final String[] files = getDocAddDialog().callOpenDialog(true, settings.cp_DefaultSession.cp_InDirectory);
if (files == null)
+ {
return;
-
+ }
final Task task = new Task("", "", files.length * 5);
/*
@@ -304,11 +342,12 @@ public abstract class WWD_Events extends WWD_Startup {
* of documents have been added,
* open the status dialog.
*/
- if (files.length > MIN_ADD_FILES_FOR_DIALOG) {
+ if (files.length > MIN_ADD_FILES_FOR_DIALOG)
+ {
StatusDialog sd = getStatusDialog();
sd.setLabel(resources.resValidatingDocuments);
sd.execute(this, task, resources.prodName); // new LoadDocs( sd.xControl, files, task )
- LoadDocs oLoadDocs = new LoadDocs( this.xControl, files, task);
+ LoadDocs oLoadDocs = new LoadDocs(this.xControl, files, task);
oLoadDocs.loadDocuments();
task.removeTaskListener(sd);
}
@@ -316,8 +355,9 @@ public abstract class WWD_Events extends WWD_Startup {
* When adding a single document, do not use a
* status dialog...
*/
- else{
- LoadDocs oLoadDocs = new LoadDocs( this.xControl, files, task);
+ else
+ {
+ LoadDocs oLoadDocs = new LoadDocs(this.xControl, files, task);
oLoadDocs.loadDocuments();
}
@@ -326,33 +366,34 @@ public abstract class WWD_Events extends WWD_Startup {
/**
* The user clicked delete.
*/
- public void removeDocument() {
+ public void removeDocument()
+ {
if (selectedDoc.length == 0)
+ {
return;
-
+ }
settings.cp_DefaultSession.cp_Content.cp_Documents.remove(selectedDoc[0]);
// update the selected document
while (selectedDoc[0] >= getDocsCount())
- selectedDoc[0]--;
-
- // if there are no documents...
+ {
+ selectedDoc[0]--; // if there are no documents...
+ }
if (selectedDoc[0] == -1)
- selectedDoc = EMPTY_SHORT_ARRAY;
-
- // update the list to show the right selection.
+ {
+ selectedDoc = EMPTY_SHORT_ARRAY; // update the list to show the right selection.
+ }
docListDA.updateUI();
// disables all the next steps, if the list of docuemnts
// is empty.
checkSteps();
}
-
-
/**
* doc up.
*/
- public void docUp() {
+ public void docUp()
+ {
Object doc = settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(selectedDoc[0]);
settings.cp_DefaultSession.cp_Content.cp_Documents.remove(selectedDoc[0]);
settings.cp_DefaultSession.cp_Content.cp_Documents.add(--selectedDoc[0], doc);
@@ -363,7 +404,8 @@ public abstract class WWD_Events extends WWD_Startup {
/**
* doc down
*/
- public void docDown() {
+ public void docDown()
+ {
Object doc = settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(selectedDoc[0]);
settings.cp_DefaultSession.cp_Content.cp_Documents.remove(selectedDoc[0]);
settings.cp_DefaultSession.cp_Content.cp_Documents.add(++selectedDoc[0], doc);
@@ -374,88 +416,110 @@ public abstract class WWD_Events extends WWD_Startup {
/* ******************************
* STEP 5
*/
-
/**
* invoked when the user clicks "Choose backgrounds" button.
*/
-
private ImageListDialog bgDialog;
/**
* the user clicked the "backgrounds" button
*/
- public void chooseBackground() {
- try {
- setEnabled(btnBackgrounds, false);
- if (bgDialog == null) {
- bgDialog = new BackgroundsDialog(xMSF, settings.cp_BackgroundImages, resources );
- bgDialog.createWindowPeer(xControl.getPeer());
- }
- bgDialog.setSelected(settings.cp_DefaultSession.cp_Design.cp_BackgroundImage);
- short i = bgDialog.executeDialog((UnoDialog)WWD_Events.this);
+ public void chooseBackground()
+ {
+ try
+ {
+ setEnabled(btnBackgrounds, false);
+ if (bgDialog == null)
+ {
+ bgDialog = new BackgroundsDialog(xMSF, settings.cp_BackgroundImages, resources);
+ bgDialog.createWindowPeer(xControl.getPeer());
+ }
+ bgDialog.setSelected(settings.cp_DefaultSession.cp_Design.cp_BackgroundImage);
+ short i = bgDialog.executeDialog((UnoDialog) WWD_Events.this);
if (i == 1) //ok
+ {
setBackground(bgDialog.getSelected());
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- setEnabled(btnBackgrounds, true);
- }}
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ setEnabled(btnBackgrounds, true);
+ }
+ }
/**
* invoked when the BackgorundsDialog is "OKed".
*/
- public void setBackground(Object background) {
+ public void setBackground(Object background)
+ {
if (background == null)
+ {
background = "";
+ }
settings.cp_DefaultSession.cp_Design.cp_BackgroundImage = (String) background;
refreshStylePreview();
}
-
private IconsDialog iconsDialog;
/**
* is called when the user clicks "Icon sets" button.
*
*/
- public void chooseIconset() {
- try {
- setEnabled(btnIconSets, false);
- if (iconsDialog == null) {
- iconsDialog = new IconsDialog(xMSF, settings.cp_IconSets, resources);
- iconsDialog.createWindowPeer(xControl.getPeer());
- }
+ public void chooseIconset()
+ {
+ try
+ {
+ setEnabled(btnIconSets, false);
+ if (iconsDialog == null)
+ {
+ iconsDialog = new IconsDialog(xMSF, settings.cp_IconSets, resources);
+ iconsDialog.createWindowPeer(xControl.getPeer());
+ }
- iconsDialog.setIconset(settings.cp_DefaultSession.cp_Design.cp_IconSet);
+ iconsDialog.setIconset(settings.cp_DefaultSession.cp_Design.cp_IconSet);
- short i = iconsDialog.executeDialog((UnoDialog)WWD_Events.this);
- if (i == 1) //ok
- setIconset(iconsDialog.getIconset());
- } catch (Exception ex) {
- ex.printStackTrace();
- } finally {
- setEnabled(btnIconSets, true);
- }}
+ short i = iconsDialog.executeDialog((UnoDialog) WWD_Events.this);
+ if (i == 1) //ok
+ {
+ setIconset(iconsDialog.getIconset());
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ setEnabled(btnIconSets, true);
+ }
+ }
/**
- * invoked when the Iconsets Dialog is OKed.
- */
- public void setIconset(String icon) {
+ * invoked when the Iconsets Dialog is OKed.
+ */
+ public void setIconset(String icon)
+ {
settings.cp_DefaultSession.cp_Design.cp_IconSet = icon;
updateIconsetText();
}
-
/* ******************************
* STEP 7
*/
-
/**
* sets the publishing url of either a local/zip or ftp publisher.
* updates the ui....
*/
- private CGPublish setPublishUrl(String publisher, String url, int number) {
+ private CGPublish setPublishUrl(String publisher, String url, int number)
+ {
if (url == null)
+ {
return null;
+ }
CGPublish p = getPublisher(publisher);
p.cp_URL = url;
p.cp_Publish = true;
@@ -469,7 +533,8 @@ public abstract class WWD_Events extends WWD_Startup {
* (the text box url)
* @param number
*/
- private void updatePublishUI(int number) {
+ private void updatePublishUI(int number)
+ {
((DataAware) pubAware.get(number)).updateUI();
((DataAware) pubAware.get(number + 1)).updateUI();
checkPublish();
@@ -479,7 +544,8 @@ public abstract class WWD_Events extends WWD_Startup {
* The user clicks the local "..." button.
*
*/
- public void setPublishLocalDir() {
+ public void setPublishLocalDir()
+ {
String dir = showFolderDialog("Local destination directory", "", settings.cp_DefaultSession.cp_OutDirectory);
//if ok was pressed...
setPublishUrl(LOCAL_PUBLISHER, dir, 0);
@@ -490,8 +556,10 @@ public abstract class WWD_Events extends WWD_Startup {
* The user clicks the "Configure" FTP button.
*
*/
- public void setFTPPublish() {
- if (showFTPDialog(getPublisher(FTP_PUBLISHER))) {
+ public void setFTPPublish()
+ {
+ if (showFTPDialog(getPublisher(FTP_PUBLISHER)))
+ {
getPublisher(FTP_PUBLISHER).cp_Publish = true;
updatePublishUI(2);
}
@@ -502,10 +570,14 @@ public abstract class WWD_Events extends WWD_Startup {
* @param pub
* @return true if OK was pressed, otherwise false.
*/
- private boolean showFTPDialog(CGPublish pub) {
- try {
+ private boolean showFTPDialog(CGPublish pub)
+ {
+ try
+ {
return getFTPDialog(pub).execute(this) == 1;
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
return false;
}
@@ -515,25 +587,30 @@ public abstract class WWD_Events extends WWD_Startup {
* the user clicks the zip "..." button.
* Choose a zip file...
*/
- public void setZipFilename() {
+ public void setZipFilename()
+ {
SystemDialog sd = getZipDialog();
String zipFile = sd.callStoreDialog(settings.cp_DefaultSession.cp_OutDirectory, resources.resDefaultArchiveFilename);
setPublishUrl(ZIP_PUBLISHER, zipFile, 4);
getPublisher(ZIP_PUBLISHER).overwriteApproved = true;
}
-
private TOCPreview docPreview;
-
/**
* the user clicks the "Preview" button.
*/
- public void documentPreview() {
- try {
+ public void documentPreview()
+ {
+ try
+ {
if (docPreview == null)
+ {
docPreview = new TOCPreview(xMSF, settings, resources, stylePreview.tempDir, myFrame);
+ }
docPreview.refresh(settings);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
unexpectedError(ex);
}
}
@@ -541,7 +618,6 @@ public abstract class WWD_Events extends WWD_Startup {
/* **********************
* FINISH
*/
-
/**
* This method checks if the given target's path, added the pathExtension argument,
* exists, and asks the user what to do about it.
@@ -549,69 +625,83 @@ public abstract class WWD_Events extends WWD_Startup {
* be replaced.
* @return true if "create" should continue. false if "create" should abort.
*/
- private boolean publishTargetApproved() {
+ private boolean publishTargetApproved()
+ {
boolean result = true;
// 1. check local publish target
CGPublish p = getPublisher(LOCAL_PUBLISHER);
// should publish ?
- if (p.cp_Publish) {
+ if (p.cp_Publish)
+ {
String path = getFileAccess().getPath(p.url, null);
// target exists?
- if (getFileAccess().exists(p.url, false)) {
+ if (getFileAccess().exists(p.url, false))
+ {
//if its a directory
- if (getFileAccess().isDirectory(p.url)) {
+ if (getFileAccess().isDirectory(p.url))
+ {
//check if its empty
String[] files = getFileAccess().listFiles(p.url, true);
- if (files.length > 0) {
- /* it is not empty :-(
- * it either a local publisher or an ftp (zip uses no directories
- * as target...)
- */
- String message = JavaTools.replaceSubString(resources.resLocalTragetNotEmpty,
- path, "%FILENAME");
- result = AbstractErrorHandler.showMessage(
+ if (files.length > 0)
+ {
+ /* it is not empty :-(
+ * it either a local publisher or an ftp (zip uses no directories
+ * as target...)
+ */
+ String message = JavaTools.replaceSubString(resources.resLocalTragetNotEmpty,
+ path, "%FILENAME");
+ result = AbstractErrorHandler.showMessage(
xMSF, xControl.getPeer(), message,
ErrorHandler.MESSAGE_WARNING, ErrorHandler.BUTTONS_YES_NO,
- ErrorHandler.DEF_NO, ErrorHandler.RESULT_YES);
+ ErrorHandler.DEF_NO, ErrorHandler.RESULT_YES);
- if (!result)
- return result;
+ if (!result)
+ {
+ return result;
+ }
}
}
- else {//not a directory, but still exists
+ else
+ {//not a directory, but still exists
String message = JavaTools.replaceSubString(resources.resLocalTargetExistsAsfile,
path, "%FILENAME");
- AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, ErrorHandler.
- ERROR_PROCESS_FATAL);
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
- // try to write to the path...
+ // try to write to the path...
}
- else {
+ else
+ {
// the local target directory does not exist.
String message = JavaTools.replaceSubString(resources.resLocalTargetCreate,
path, "%FILENAME");
- try {
+ try
+ {
result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
ErrorHandler.ERROR_QUESTION_YES);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
if (!result)
+ {
return result;
// try to create the directory...
- try {
+ }
+ try
+ {
getFileAccess().fileAccess.createFolder(p.cp_URL);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
message = JavaTools.replaceSubString(resources.resLocalTargetCouldNotCreate,
path, "%FILENAME");
- AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message ,
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
@@ -622,27 +712,34 @@ public abstract class WWD_Events extends WWD_Startup {
// should publish ?
p = getPublisher(ZIP_PUBLISHER);
- if (p.cp_Publish) {
+ if (p.cp_Publish)
+ {
- String path = getFileAccess().getPath(p.cp_URL,null);
+ String path = getFileAccess().getPath(p.cp_URL, null);
// target exists?
- if (getFileAccess().exists(p.cp_URL, false)) {
+ if (getFileAccess().exists(p.cp_URL, false))
+ {
//if its a directory
- if (getFileAccess().isDirectory(p.cp_URL)) {
+ if (getFileAccess().isDirectory(p.cp_URL))
+ {
String message = JavaTools.replaceSubString(resources.resZipTargetIsDir,
path, "%FILENAME");
AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
- else {//not a directory, but still exists ( a file...)
- if (!p.overwriteApproved) {
+ else
+ {//not a directory, but still exists ( a file...)
+ if (!p.overwriteApproved)
+ {
String message = JavaTools.replaceSubString(resources.resZipTargetExists,
path, "%FILENAME");
- result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),message ,
+ result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
ErrorHandler.ERROR_QUESTION_YES);
if (!result)
+ {
return false;
+ }
}
}
}
@@ -652,52 +749,64 @@ public abstract class WWD_Events extends WWD_Startup {
p = getPublisher(FTP_PUBLISHER);
// should publish ?
- if (p.cp_Publish) {
+ if (p.cp_Publish)
+ {
- String path = getFileAccess().getPath(p.cp_URL,null);
+ String path = getFileAccess().getPath(p.cp_URL, null);
// target exists?
- if (getFileAccess().exists(p.url, false)) {
+ if (getFileAccess().exists(p.url, false))
+ {
//if its a directory
- if (getFileAccess().isDirectory(p.url)) {
+ if (getFileAccess().isDirectory(p.url))
+ {
//check if its empty
String[] files = getFileAccess().listFiles(p.url, true);
- if (files.length > 0) {
- /* it is not empty :-(
- * it either a local publisher or an ftp (zip uses no directories
- * as target...)
- */
- String message = JavaTools.replaceSubString(resources.resFTPTargetNotEmpty,
+ if (files.length > 0)
+ {
+ /* it is not empty :-(
+ * it either a local publisher or an ftp (zip uses no directories
+ * as target...)
+ */
+ String message = JavaTools.replaceSubString(resources.resFTPTargetNotEmpty,
path, "%FILENAME");
- result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
- ErrorHandler.ERROR_QUESTION_CANCEL);
- if (!result)
- return result;
+ result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
+ ErrorHandler.ERROR_QUESTION_CANCEL);
+ if (!result)
+ {
+ return result;
+ }
}
}
- else {//not a directory, but still exists (as a file)
+ else
+ {//not a directory, but still exists (as a file)
String message = JavaTools.replaceSubString(resources.resFTPTargetExistsAsfile,
path, "%FILENAME");
- AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),message,
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
- // try to write to the path...
+ // try to write to the path...
}
- else {
+ else
+ {
// the ftp target directory does not exist.
String message = JavaTools.replaceSubString(resources.resFTPTargetCreate,
path, "%FILENAME");
result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
ErrorHandler.ERROR_QUESTION_YES);
if (!result)
+ {
return result;
// try to create the directory...
- try {
+ }
+ try
+ {
getFileAccess().fileAccess.createFolder(p.url);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
message = JavaTools.replaceSubString(resources.resFTPTargetCouldNotCreate,
path, "%FILENAME");
AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
@@ -712,8 +821,10 @@ public abstract class WWD_Events extends WWD_Startup {
/*
* return false if "create" should be aborted. true if everything is fine.
*/
- private boolean saveSession() {
- try {
+ private boolean saveSession()
+ {
+ try
+ {
Object node = null;
String name = getSessionSaveName();
@@ -721,23 +832,29 @@ public abstract class WWD_Events extends WWD_Startup {
ListModel docs = settings.cp_DefaultSession.cp_Content.cp_Documents;
for (int i = 0; i < docs.getSize(); i++)
- ((CGDocument) docs.getElementAt(i)).cp_Index = i;
-
+ {
+ ((CGDocument) docs.getElementAt(i)).cp_Index = i;
+ }
Object conf = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/SavedSessions", true);
// first I check if a session with the given name exists
- try {
+ try
+ {
node = Configuration.getNode(name, conf);
if (node != null)
+ {
if (!AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),
- JavaTools.replaceSubString(resources.resSessionExists, name, "${NAME}"),
- ErrorHandler.ERROR_NORMAL_IGNORE))
-
- return false;
-
- //remove the old session
+ JavaTools.replaceSubString(resources.resSessionExists, name, "${NAME}"),
+ ErrorHandler.ERROR_NORMAL_IGNORE))
+ {
+ return false; //remove the old session
+ }
+ }
Configuration.removeNode(conf, name);
- } catch (NoSuchElementException nsex) {}
+ }
+ catch (NoSuchElementException nsex)
+ {
+ }
settings.cp_DefaultSession.cp_Index = 0;
node = Configuration.addConfigNode(conf, name);
@@ -750,7 +867,7 @@ public abstract class WWD_Events extends WWD_Startup {
settings.cp_SavedSessions.clear();
Object confView = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/SavedSessions", false);
- settings.cp_SavedSessions.readConfiguration(confView,CONFIG_READ_PARAM);
+ settings.cp_SavedSessions.readConfiguration(confView, CONFIG_READ_PARAM);
settings.cp_LastSavedSession = name;
currentSession = name;
@@ -760,24 +877,32 @@ public abstract class WWD_Events extends WWD_Startup {
// TODO add the <none> session...
prepareSessionLists();
- ListModelBinder.fillList(lstLoadSettings, settings.cp_SavedSessions.items() , null);
+ ListModelBinder.fillList(lstLoadSettings, settings.cp_SavedSessions.items(), null);
ListModelBinder.fillComboBox(cbSaveSettings, settings.savedSessions.items(), null);
selectSession();
currentSession = settings.cp_LastSavedSession;
return true;
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
return false;
}
}
- private String targetStringFor(String publisher) {
+ private String targetStringFor(String publisher)
+ {
CGPublish p = getPublisher(publisher);
if (p.cp_Publish)
- return "\n" + getFileAccess().getPath(p.cp_URL,null);
- else return "";
+ {
+ return "\n" + getFileAccess().getPath(p.cp_URL, null);
+ }
+ else
+ {
+ return "";
+ }
}
/**
@@ -786,33 +911,40 @@ public abstract class WWD_Events extends WWD_Startup {
* It checks if the "Process" was successfull, and if so,
* it closes the wizard dialog.
*/
- public void finishWizardFinished() {
- if (process.getResult()) {
+ public void finishWizardFinished()
+ {
+ if (process.getResult())
+ {
String targets =
- targetStringFor(LOCAL_PUBLISHER) +
- targetStringFor(ZIP_PUBLISHER) +
- targetStringFor(FTP_PUBLISHER);
- String message = JavaTools.replaceSubString( resources.resFinishedSuccess, targets, "%FILENAME");
+ targetStringFor(LOCAL_PUBLISHER) +
+ targetStringFor(ZIP_PUBLISHER) +
+ targetStringFor(FTP_PUBLISHER);
+ String message = JavaTools.replaceSubString(resources.resFinishedSuccess, targets, "%FILENAME");
- AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message , ErrorHandler.ERROR_MESSAGE);
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message, ErrorHandler.ERROR_MESSAGE);
if (exitOnCreate)
+ {
this.xDialog.endExecute();
- } else
- AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),resources.resFinishedNoSuccess, ErrorHandler.ERROR_WARNING);
-
+ }
+ }
+ else
+ {
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), resources.resFinishedNoSuccess, ErrorHandler.ERROR_WARNING);
+ }
}
- public void cancel() {
+ public void cancel()
+ {
xDialog.endExecute();
}
-
private Process process;
private boolean exitOnCreate = true;
/**
* the user clicks the finish/create button.
*/
- public void finishWizard() {
+ public void finishWizard()
+ {
finishWizard(true);
}
@@ -823,7 +955,8 @@ public abstract class WWD_Events extends WWD_Startup {
* Default is true,
* I have a hidden feature which enables false here
*/
- public void finishWizard(boolean exitOnCreate_) {
+ public void finishWizard(boolean exitOnCreate_)
+ {
exitOnCreate = exitOnCreate_;
@@ -834,18 +967,21 @@ public abstract class WWD_Events extends WWD_Startup {
*/
final CGPublish p = getPublisher(FTP_PUBLISHER);
// if ftp is checked, and no proxies are set, and password is empty...
- if (p.cp_Publish && (!proxies) && (p.password == null || p.password.equals(""))) {
- if (showFTPDialog(p)) {
+ if (p.cp_Publish && (!proxies) && (p.password == null || p.password.equals("")))
+ {
+ if (showFTPDialog(p))
+ {
updatePublishUI(2);
//now continue...
finishWizard2();
}
}
else
+ {
finishWizard2();
+ }
}
-
/**
* this method is only called
* if ftp-password was eather set, or
@@ -853,7 +989,8 @@ public abstract class WWD_Events extends WWD_Startup {
* popped up when clicking "Create".
*
*/
- private void finishWizard2() {
+ private void finishWizard2()
+ {
CGPublish p = getPublisher(LOCAL_PUBLISHER);
p.url = p.cp_URL;
@@ -863,7 +1000,7 @@ public abstract class WWD_Events extends WWD_Startup {
*/
p = getPublisher(ZIP_PUBLISHER);
//replace the '%' with '%25'
- String url1 = JavaTools.replaceSubString(p.cp_URL,"%25","%");
+ String url1 = JavaTools.replaceSubString(p.cp_URL, "%25", "%");
//replace all '/' with '%2F'
url1 = JavaTools.replaceSubString(url1, "%2F", "/");
@@ -880,31 +1017,39 @@ public abstract class WWD_Events extends WWD_Startup {
* what to do. a False here means the user said "cancel" (or rather: clicked...)
*/
if (!publishTargetApproved())
+ {
return;
-
/*
* In order to save the session correctly,
* I return the value of the ftp publisher cp_Publish
* property to its original value...
*/
+ }
p.cp_Publish = __ftp;
//if the "save settings" checkbox is on...
- if (isSaveSession()) {
+ if (isSaveSession())
+ {
// if canceled by user
if (!saveSession())
+ {
return;
+ }
}
- else settings.cp_LastSavedSession = "";
-
- try {
- Object conf = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH , true);
+ else
+ {
+ settings.cp_LastSavedSession = "";
+ }
+ try
+ {
+ Object conf = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH, true);
Configuration.set(
- settings.cp_LastSavedSession ,
- "LastSavedSession", conf);
+ settings.cp_LastSavedSession,
+ "LastSavedSession", conf);
Configuration.commit(conf);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
@@ -913,6 +1058,7 @@ public abstract class WWD_Events extends WWD_Startup {
* starts.
*/
if (proxies)
+ {
p.cp_Publish = false;
/*
@@ -920,25 +1066,30 @@ public abstract class WWD_Events extends WWD_Startup {
* writing folders to an existing zip file, after deleting
* its content, so I "manually" delete it here...
*/
+ }
p = getPublisher(ZIP_PUBLISHER);
- if (getFileAccess().exists(p.cp_URL,false))
+ if (getFileAccess().exists(p.cp_URL, false))
+ {
getFileAccess().delete(p.cp_URL);
+ }
+ try
+ {
- try {
-
- ErrorHandler eh = new ProcessErrorHandler(xMSF, xControl.getPeer(),resources);
+ ErrorHandler eh = new ProcessErrorHandler(xMSF, xControl.getPeer(), resources);
process = new Process(settings, xMSF, eh);
StatusDialog pd = getStatusDialog();
pd.setRenderer(new ProcessStatusRenderer(resources));
- pd.execute(this, process.myTask, resources.prodName); //process,
+ pd.execute(this, process.myTask, resources.prodName); //process,
process.runProcess();
finishWizardFinished();
process.myTask.removeTaskListener(pd);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
@@ -951,90 +1102,139 @@ public abstract class WWD_Events extends WWD_Startup {
* of the last steps' checkboxes.
* @author rp143992
*/
- private class Create implements XKeyListener {
+ private class Create implements XKeyListener
+ {
+
long time = 0;
int count = 0;
/* (non-Javadoc)
* @see com.sun.star.awt.XKeyListener#keyPressed(com.sun.star.awt.KeyEvent)
*/
- public void keyPressed(KeyEvent ke) {
- if (ke.KeyChar == '&' )
+ public void keyPressed(KeyEvent ke)
+ {
+ if (ke.KeyChar == '&')
+ {
time = System.currentTimeMillis();
- else if (ke.KeyChar == '%' && ( (System.currentTimeMillis() - time) < 300) )
+ }
+ else if (ke.KeyChar == '%' && ((System.currentTimeMillis() - time) < 300))
+ {
+ Boolean b = (Boolean) getControlProperty("btnWizardFinish", "Enabled");
+ if (b.booleanValue())
{
- Boolean b = (Boolean)getControlProperty("btnWizardFinish","Enabled");
- if (b.booleanValue())
- finishWizard(false);
+ finishWizard(false);
}
+ }
+ }
+
+ public void keyReleased(KeyEvent arg0)
+ {
}
- public void keyReleased(KeyEvent arg0) {}
- public void disposing(EventObject arg0) {}
+ public void disposing(EventObject arg0)
+ {
+ }
}
/**
* is called on the WindowHidden event,
* deletes the temporary directory.
*/
- public void cleanup() {
+ public void cleanup()
+ {
- try {
+ try
+ {
dpStylePreview.dispose();
}
- catch (Exception ex) {ex.printStackTrace();}
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
stylePreview.cleanup();
- try {
+ try
+ {
if (bgDialog != null)
+ {
bgDialog.xComponent.dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
}
- catch (Exception ex) {ex.printStackTrace();}
- try {
+ try
+ {
if (iconsDialog != null)
+ {
iconsDialog.xComponent.dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
}
- catch (Exception ex) {ex.printStackTrace();}
- try {
+ try
+ {
if (ftpDialog != null)
+ {
ftpDialog.xComponent.dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
}
- catch (Exception ex) {ex.printStackTrace();}
- try {
+ try
+ {
xComponent.dispose();
}
- catch (Exception ex) {ex.printStackTrace();}
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
- try {
+ try
+ {
//XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myDocument);
//if (xCloseable != null)
// xCloseable.close(false);
XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myFrame);
if (xCloseable != null)
+ {
xCloseable.close(false);
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
}
- catch (Exception ex) {ex.printStackTrace();}
}
- public class LoadDocs {
+ public class LoadDocs
+ {
+
private XControl xC;
String[] files;
Task task;
- public LoadDocs(XControl xC_, String[] files_, Task task_) {
+ public LoadDocs(XControl xC_, String[] files_, Task task_)
+ {
xC = xC_;
files = files_;
task = task_;
}
- public void loadDocuments() {
+ public void loadDocuments()
+ {
//LogTaskListener lts = new LogTaskListener();
//task.addTaskListener(lts);
@@ -1060,7 +1260,8 @@ public abstract class WWD_Events extends WWD_Startup {
* Here i go through each file, and validate it.
* If its ok, I add it to the ListModel/ConfigSet
*/
- for (int i = start; i < files.length; i++) {
+ for (int i = start; i < files.length; i++)
+ {
CGDocument doc = new CGDocument();
doc.setRoot(settings);
@@ -1071,16 +1272,23 @@ public abstract class WWD_Events extends WWD_Startup {
* Error reporting to the user is (or should (-: )done in the checkDocument(...) method
*/
if (checkDocument(doc, task, xC))
+ {
settings.cp_DefaultSession.cp_Content.cp_Documents.add(offset + i - failed - start, doc);
+ }
else
+ {
failed++;
-
+ }
}
// if any documents where added,
// set the first one to be the current-selected document.
- if (files.length > start + failed) {
- setSelectedDoc(new short[] {(short) offset });
+ if (files.length > start + failed)
+ {
+ setSelectedDoc(new short[]
+ {
+ (short) offset
+ });
}
// update the ui...
docListDA.updateUI();
@@ -1090,8 +1298,10 @@ public abstract class WWD_Events extends WWD_Startup {
/* a small insurance that the status dialog will
* really close...
*/
- while(task.getStatus() < task.getMax())
+ while (task.getStatus() < task.getMax())
+ {
task.advance(false);
+ }
}
};
}
diff --git a/wizards/com/sun/star/wizards/web/WWD_General.java b/wizards/com/sun/star/wizards/web/WWD_General.java
index 3a4a516a536e..f0be62cabdc5 100644
--- a/wizards/com/sun/star/wizards/web/WWD_General.java
+++ b/wizards/com/sun/star/wizards/web/WWD_General.java
@@ -47,41 +47,43 @@ import com.sun.star.wizards.web.data.CGSettings;
* This class implements general methods, used by different sub-classes (either WWD_Sturtup, or WWD_Events)
* or both.
*/
-public abstract class WWD_General extends WebWizardDialog {
-
+public abstract class WWD_General extends WebWizardDialog
+{
private FileAccess fileAccess;
-
- private SystemDialog docAddDialog, folderDialog, favIconDialog, zipDialog;
-
+ private SystemDialog docAddDialog, folderDialog, favIconDialog, zipDialog;
protected FTPDialog ftpDialog;
-
protected CGSettings settings;
-
-
/**
* true if proxies are on, which means, ftp is disabled.
*/
protected boolean proxies;
- private XStringSubstitution xStringSubstitution ;
+ private XStringSubstitution xStringSubstitution;
- protected StatusDialog getStatusDialog() {
+ protected StatusDialog getStatusDialog()
+ {
- StatusDialog statusDialog = new StatusDialog(xMSF, StatusDialog.STANDARD_WIDTH, resources.resLoadingSession , false , new String[] { resources.prodName, "", "", "", "", "" }, "HID:"+ HID0_STATUS_DIALOG);
- try {
+ StatusDialog statusDialog = new StatusDialog(xMSF, StatusDialog.STANDARD_WIDTH, resources.resLoadingSession, false, new String[]
+ {
+ resources.prodName, "", "", "", "", ""
+ }, "HID:" + HID0_STATUS_DIALOG);
+ try
+ {
statusDialog.createWindowPeer(xControl.getPeer());
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
return statusDialog;
}
-
/**
* @param xmsf
*/
- public WWD_General(XMultiServiceFactory xmsf) {
+ public WWD_General(XMultiServiceFactory xmsf)
+ {
super(xmsf);
xStringSubstitution = SystemDialog.createStringSubstitution(xmsf);
}
@@ -89,63 +91,73 @@ public abstract class WWD_General extends WebWizardDialog {
/*
* File Dialog methods
*/
-
-
- protected SystemDialog getDocAddDialog() {
+ protected SystemDialog getDocAddDialog()
+ {
//if (docAddDialog == null) {
- docAddDialog = SystemDialog.createOpenDialog(xMSF);
- for (int i = 0; i < settings.cp_Filters.getSize(); i++) {
- CGFilter f = ((CGFilter)settings.cp_Filters.getElementAt(i));
- docAddDialog.addFilter(
- JavaTools.replaceSubString(f.cp_Name, resources.prodName, "%PRODNAME")
- , f.cp_Filter, i == 0);
- }
- //docAddDialog.addFilter(resources.resSODocs, "*.oxt;*.sxw;*.sxc;*.sxd;*.sxi;*.sdw;*.sdc;*.sdd;*.sdi;*.sda;*.sdp" ,true);
- //docAddDialog.addFilter(resources.resMSDocs, "*.doc;*.xls;*.ppt;*.pps",false);
- //docAddDialog.addFilter(resources.resImages, "*.jpg;*.gif;*.png;*.bmp;*.tiff;*.jpeg;*.jpe",false);
- //docAddDialog.addFilter(resources.resAllFiles,"*.*",false);
+ docAddDialog = SystemDialog.createOpenDialog(xMSF);
+ for (int i = 0; i < settings.cp_Filters.getSize(); i++)
+ {
+ CGFilter f = ((CGFilter) settings.cp_Filters.getElementAt(i));
+ docAddDialog.addFilter(
+ JavaTools.replaceSubString(f.cp_Name, resources.prodName, "%PRODNAME"), f.cp_Filter, i == 0);
+ }
+ //docAddDialog.addFilter(resources.resSODocs, "*.oxt;*.sxw;*.sxc;*.sxd;*.sxi;*.sdw;*.sdc;*.sdd;*.sdi;*.sda;*.sdp" ,true);
+ //docAddDialog.addFilter(resources.resMSDocs, "*.doc;*.xls;*.ppt;*.pps",false);
+ //docAddDialog.addFilter(resources.resImages, "*.jpg;*.gif;*.png;*.bmp;*.tiff;*.jpeg;*.jpe",false);
+ //docAddDialog.addFilter(resources.resAllFiles,"*.*",false);
//}
return docAddDialog;
}
- protected SystemDialog getZipDialog() {
- if (zipDialog==null) {
+ protected SystemDialog getZipDialog()
+ {
+ if (zipDialog == null)
+ {
zipDialog = SystemDialog.createStoreDialog(xMSF);
- zipDialog.addFilter(resources.resZipFiles,"*.zip",true);
+ zipDialog.addFilter(resources.resZipFiles, "*.zip", true);
}
return zipDialog;
}
- protected FTPDialog getFTPDialog(CGPublish pub) {
- if (ftpDialog == null) {
- try {
- ftpDialog = new FTPDialog(xMSF,pub);
+ protected FTPDialog getFTPDialog(CGPublish pub)
+ {
+ if (ftpDialog == null)
+ {
+ try
+ {
+ ftpDialog = new FTPDialog(xMSF, pub);
ftpDialog.createWindowPeer(xControl.getPeer());
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
return ftpDialog;
}
-
- protected String showFolderDialog(String title, String description,String dir) {
+ protected String showFolderDialog(String title, String description, String dir)
+ {
if (folderDialog == null)
+ {
folderDialog = SystemDialog.createFolderDialog(xMSF);
- return folderDialog.callFolderDialog(title,description,dir);
+ }
+ return folderDialog.callFolderDialog(title, description, dir);
}
-
- protected FileAccess getFileAccess() {
+ protected FileAccess getFileAccess()
+ {
if (fileAccess == null)
- try {
- fileAccess = new FileAccess(xMSF);
- }
- catch (Exception ex) {
- ex.printStackTrace();
- }
-
+ {
+ try
+ {
+ fileAccess = new FileAccess(xMSF);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
return fileAccess;
}
@@ -155,29 +167,38 @@ public abstract class WWD_General extends WebWizardDialog {
* @param s
* @return
*/
- protected CGDocument getDoc(short[] s) {
- if (s.length==0)
- return null;
+ protected CGDocument getDoc(short[] s)
+ {
+ if (s.length == 0)
+ {
+ return null;
+ }
else if (settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() <= s[0])
+ {
return null;
- else return (CGDocument)settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(s[0]);
+ }
+ else
+ {
+ return (CGDocument) settings.cp_DefaultSession.cp_Content.cp_Documents.getElementAt(s[0]);
+ }
}
/**
* how many documents are in the list?
* @return the number of documents in the docs list.
*/
- protected int getDocsCount() {
+ protected int getDocsCount()
+ {
return settings.cp_DefaultSession.cp_Content.cp_Documents.getSize();
}
-
/**
* fills the export listbox.
* @param listContent
*/
- protected void fillExportList(Object[] listContent) {
- ListModelBinder.fillList(lstDocTargetType,listContent,null);
+ protected void fillExportList(Object[] listContent)
+ {
+ ListModelBinder.fillList(lstDocTargetType, listContent, null);
}
/**
@@ -185,62 +206,72 @@ public abstract class WWD_General extends WebWizardDialog {
* @param name one of the WebWizardConst constants : FTP
* @return
*/
- protected CGPublish getPublisher(String name) {
- return (CGPublish)settings.cp_DefaultSession.cp_Publishing.getElement(name);
+ protected CGPublish getPublisher(String name)
+ {
+ return (CGPublish) settings.cp_DefaultSession.cp_Publishing.getElement(name);
}
/**
* @return true if the checkbox "save session" is checked.
*/
- protected boolean isSaveSession() {
- return (((Number)Helper.getUnoPropertyValue(
- getModel(chkSaveSettings),"State")).intValue()==1);
+ protected boolean isSaveSession()
+ {
+ return (((Number) Helper.getUnoPropertyValue(
+ getModel(chkSaveSettings), "State")).intValue() == 1);
}
/**
* @return the name to save the session (step 7)
*/
- protected String getSessionSaveName() {
- return (String)Helper.getUnoPropertyValue(
- getModel(cbSaveSettings),"Text");
+ protected String getSessionSaveName()
+ {
+ return (String) Helper.getUnoPropertyValue(
+ getModel(cbSaveSettings), "Text");
}
-
/**
* This method checks the status of the wizards and
* enables or disables the 'next' and the 'create' button.
*
*/
- protected void checkSteps() {
+ protected void checkSteps()
+ {
/* first I check the document list.
* If it is empty, then step3 and on are disabled.
*/
if (checkDocList())
- checkPublish();
+ {
+ checkPublish();
+ }
}
-
/**
* enables/disables the steps 3 to 7)
* @param enabled true = enabled, false = disabled.
*/
- private void enableSteps(boolean enabled) {
+ private void enableSteps(boolean enabled)
+ {
if (!enabled && !isStepEnabled(3))
- return;
+ {
+ return;
/*
* disbale steps 3-7
*/
- for (int i = 3; i<8; i++)
- setStepEnabled(i,enabled,true);
-
+ }
+ for (int i = 3; i < 8; i++)
+ {
+ setStepEnabled(i, enabled, true);
/* in this place i just disable the finish button.
* later, in the checkPublish, which is only performed if
* this one is true, it will be enabled (if the check
* is positive)
*/
+ }
if (!enabled)
+ {
enableFinishButton(false);
+ }
}
/**
@@ -249,12 +280,15 @@ public abstract class WWD_General extends WebWizardDialog {
* create button.
* @return
*/
- protected boolean checkDocList() {
- if (settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() == 0) {
+ protected boolean checkDocList()
+ {
+ if (settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() == 0)
+ {
enableSteps(false);
return false;
}
- else {
+ else
+ {
enableSteps(true);
return true;
}
@@ -266,31 +300,39 @@ public abstract class WWD_General extends WebWizardDialog {
* if it is marked, a session name exists.
*
*/
- public boolean checkSaveSession() {
+ public boolean checkSaveSession()
+ {
return (!isSaveSession() ||
- !getSessionSaveName().equals(""));
+ !getSessionSaveName().equals(""));
}
-
/**
* @return false if this publisher is not active, or, if it
* active, returns true if the url is not empty...
* if the url is empty, throws an exception
*/
- private boolean checkPublish(String s, Object text, String property) {
+ private boolean checkPublish(String s, Object text, String property)
+ {
CGPublish p = getPublisher(s);
- if (p.cp_Publish) {
- String url = (String)Helper.getUnoPropertyValue(getModel(text),property);
+ if (p.cp_Publish)
+ {
+ String url = (String) Helper.getUnoPropertyValue(getModel(text), property);
if ((url == null) || (url.equals("")))
+ {
throw new IllegalArgumentException();
- else return true;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
}
- else return false;
}
-
-
/**
*
* @return false either if publishing input is wrong or there
@@ -299,13 +341,14 @@ public abstract class WWD_General extends WebWizardDialog {
* which are chosen are legal.
* If proxies are on, ftp publisher is ignored.
*/
- private boolean checkPublish_() {
- try {
- return (checkPublish(LOCAL_PUBLISHER, txtLocalDir, "Text")
- | ( !proxies && checkPublish(FTP_PUBLISHER, lblFTP, "Label"))
- | checkPublish(ZIP_PUBLISHER, txtZip, "Text" )) && checkSaveSession();
+ private boolean checkPublish_()
+ {
+ try
+ {
+ return (checkPublish(LOCAL_PUBLISHER, txtLocalDir, "Text") | (!proxies && checkPublish(FTP_PUBLISHER, lblFTP, "Label")) | checkPublish(ZIP_PUBLISHER, txtZip, "Text")) && checkSaveSession();
}
- catch (IllegalArgumentException ex) {
+ catch (IllegalArgumentException ex)
+ {
return false;
}
}
@@ -317,7 +360,8 @@ public abstract class WWD_General extends WebWizardDialog {
* public because it is called from
* an event listener object.
*/
- public void checkPublish() {
+ public void checkPublish()
+ {
enableFinishButton(checkPublish_());
}
@@ -325,10 +369,11 @@ public abstract class WWD_General extends WebWizardDialog {
* shows a message box "Unexpected Error... " :-)
* @param ex
*/
- protected void unexpectedError(Exception ex) {
+ protected void unexpectedError(Exception ex)
+ {
ex.printStackTrace();
XWindowPeer peer = xControl.getPeer();
- AbstractErrorHandler.showMessage(xMSF,peer,resources.resErrUnexpected, ErrorHandler.ERROR_PROCESS_FATAL);
+ AbstractErrorHandler.showMessage(xMSF, peer, resources.resErrUnexpected, ErrorHandler.ERROR_PROCESS_FATAL);
}
/**
@@ -336,15 +381,15 @@ public abstract class WWD_General extends WebWizardDialog {
* @param path a path, which might contain OOo path variables.
* @return the path, after substituing path variables.
*/
- protected String substitute(String path) {
- try {
- return xStringSubstitution.substituteVariables(path,false);
+ protected String substitute(String path)
+ {
+ try
+ {
+ return xStringSubstitution.substituteVariables(path, false);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
return path;
}
}
-
-
-
}
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.java b/wizards/com/sun/star/wizards/web/WWD_Startup.java
index 96e3df22ee2e..d4b91b638a39 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.java
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.java
@@ -26,11 +26,11 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web;
+ ************************************************************************/
+package com.sun.star.wizards.web;
//import com.sun.star.awt.ItemEvent;
//import com.sun.star.awt.XItemListener;
-
import java.io.FileNotFoundException;
import java.util.Comparator;
import java.util.List;
@@ -119,8 +119,8 @@ import com.sun.star.wizards.web.data.CGStyle;
* @author rpiterman
*
*/
-
-public abstract class WWD_Startup extends WWD_General{
+public abstract class WWD_Startup extends WWD_General
+{
SimpleDataAware sda = null;
/**
@@ -137,7 +137,6 @@ public abstract class WWD_Startup extends WWD_General{
* like publishing-checkboxes, save-session check- and textbox.
*/
protected DataAware.Listener checkPublish = new CheckPublish();
-
/**
* The Vector containing DataAware objects
* which relay on the selected document
@@ -168,7 +167,6 @@ public abstract class WWD_Startup extends WWD_General{
* So they are handled with more care.
*/
protected List pubAware = new Vector(3);
-
/**
* The DataAware object which handles
* the documents-list events.
@@ -181,12 +179,10 @@ public abstract class WWD_Startup extends WWD_General{
* name in step 7 with the CGSession.cp_Name
*/
protected UnoDataAware sessionNameDA;
-
/**
* Binds a ListModel to the UnoControlListBox.
*/
protected ListModelBinder docsBinder;
-
/**
* a DocumentPreview object is
* the UI OO Document preview
@@ -199,12 +195,10 @@ public abstract class WWD_Startup extends WWD_General{
* style preview
*/
protected StylePreview stylePreview;
-
/**
* the currently selected document.
*/
protected short[] selectedDoc = new short[0];
-
/**
* If ftp proxies are on, ftp is disabled, and
* the true/false of the FTP publisher is set to false.
@@ -212,8 +206,6 @@ public abstract class WWD_Startup extends WWD_General{
* at the end, the original loaded value is saved to this variable;
*/
boolean __ftp;
-
-
/**
* When the wizard starts, a new document opens.
* The backgroundDoc memeber contains the TextDocument
@@ -231,7 +223,6 @@ public abstract class WWD_Startup extends WWD_General{
/*
* GENERAL Initialization methods
*/
-
/**
* He - my constructor !
* I call/do here in this order: <br/>
@@ -252,14 +243,15 @@ public abstract class WWD_Startup extends WWD_General{
* fill the documents listbox. <br/>
* if proxies are set, disable the ftp controls in step 7.
*/
- public WWD_Startup(XMultiServiceFactory xmsf) throws Exception {
+ public WWD_Startup(XMultiServiceFactory xmsf) throws Exception
+ {
super(xmsf);
proxies = getOOProxies();
String soTemplateDir = FileAccess.getOfficePath(xmsf, "Template", "share", "/wizard");
- String exclamationURL = FileAccess.connectURLs( soTemplateDir, "wizard/bitmap/caution_16.png");
+ String exclamationURL = FileAccess.connectURLs(soTemplateDir, "wizard/bitmap/caution_16.png");
this.drawNaviBar();
this.buildStep1();
this.buildStep2();
@@ -274,7 +266,7 @@ public abstract class WWD_Startup extends WWD_General{
this.xMSF = xMSF;
XDesktop xDesktop = Desktop.getDesktop(xMSF);
myFrame = OfficeDocument.createNewFrame(xMSF, this);
- Object doc = OfficeDocument.createNewDocument( myFrame, "swriter", false, true );
+ Object doc = OfficeDocument.createNewDocument(myFrame, "swriter", false, true);
loadSettings(doc);
setSaveSessionName(settings.cp_DefaultSession);
@@ -282,7 +274,7 @@ public abstract class WWD_Startup extends WWD_General{
ilLayouts.setListModel(settings.cp_Layouts);
ilLayouts.create(this);
- checkContent(settings.cp_DefaultSession.cp_Content, new Task("", "", 99999), this.xControl );
+ checkContent(settings.cp_DefaultSession.cp_Content, new Task("", "", 99999), this.xControl);
//saved sessions, styles, combobox save session.
// also set the chosen saved session...
@@ -294,61 +286,70 @@ public abstract class WWD_Startup extends WWD_General{
mount(settings.cp_DefaultSession.cp_Content);
- if (proxies) {
- setEnabled(btnFTP,false);
- setEnabled(chkFTP,false);
+ if (proxies)
+ {
+ setEnabled(btnFTP, false);
+ setEnabled(chkFTP, false);
}
}
-
/**
* return true if http proxies or other proxies
* which do not enable ftp to function correctly are set.
* @return true if (http) proxies are on.
* @throws Exception
*/
- private boolean getOOProxies() throws Exception {
- Object node = Configuration.getConfigurationRoot(xMSF,"org.openoffice.Inet/Settings",false);
- int i = Configuration.getInt("ooInetProxyType",node);
+ private boolean getOOProxies() throws Exception
+ {
+ Object node = Configuration.getConfigurationRoot(xMSF, "org.openoffice.Inet/Settings", false);
+ int i = Configuration.getInt("ooInetProxyType", node);
//System.out.println("WWD:Startup:getOOProxies:" + i);
- switch (i) {
- case 0 : //no proxies
+ switch (i)
+ {
+ case 0: //no proxies
return false;
- case 2 : //http proxies
+ case 2: //http proxies
return true;
- default :
+ default:
return true;
}
}
-
/**
* calculates the first available session name,
* and sets the current session name to it.
* The combobox text in step 7 will be updated
* automatically when updateUI() is called.
*/
- protected void setSaveSessionName(CGSession session) {
+ protected void setSaveSessionName(CGSession session)
+ {
int max = 0;
int len = resources.resSessionName.length();
// traverse between the sessions and find the one that
// has the biggest number.
- for (int i = 0; i < settings.cp_SavedSessions.getSize(); i++) {
+ for (int i = 0; i < settings.cp_SavedSessions.getSize(); i++)
+ {
String sessionName = ((CGSessionName) settings.cp_SavedSessions.getElementAt(i)).cp_Name;
if (sessionName.startsWith(resources.resSessionName))
+ {
max = max(max, Integer.valueOf(sessionName.substring(len)).intValue());
+ }
}
session.cp_Name = resources.resSessionName + ++max;
}
-
- private int max(int i1, int i2) {
+ private int max(int i1, int i2)
+ {
if (i1 > i2)
+ {
return i1;
+ }
else
+ {
return i2;
+ }
}
/**
@@ -356,8 +357,18 @@ public abstract class WWD_Startup extends WWD_General{
* like MaxStep, Complete, Interactive-
* Disables the finbihButton.
*/
- private void addRoadMapItems() {
- insertRoadMapItems(new String[] { resources.resStep1, resources.resStep2, resources.resStep3, resources.resStep4, resources.resStep5, resources.resStep6, resources.resStep7 }, new int[] { 1, 2, 3, 4, 5, 6, 7 }, new boolean[] { true, true, false, false, false, false, false });
+ private void addRoadMapItems()
+ {
+ insertRoadMapItems(new String[]
+ {
+ resources.resStep1, resources.resStep2, resources.resStep3, resources.resStep4, resources.resStep5, resources.resStep6, resources.resStep7
+ }, new int[]
+ {
+ 1, 2, 3, 4, 5, 6, 7
+ }, new boolean[]
+ {
+ true, true, false, false, false, false, false
+ });
setRoadmapInteractive(true);
setRoadmapComplete(true);
@@ -375,7 +386,8 @@ public abstract class WWD_Startup extends WWD_General{
* the state of the corresponding data objects.
*
*/
- private void updateUI() {
+ private void updateUI()
+ {
DataAware.updateUI(designAware);
DataAware.updateUI(genAware);
DataAware.updateUI(pubAware);
@@ -383,8 +395,9 @@ public abstract class WWD_Startup extends WWD_General{
checkPublish();
}
- private XFrame getFrame(Object model) {
- XModel xmodel = (XModel)UnoRuntime.queryInterface(XModel.class,model);
+ private XFrame getFrame(Object model)
+ {
+ XModel xmodel = (XModel) UnoRuntime.queryInterface(XModel.class, model);
return xmodel.getCurrentController().getFrame();
}
@@ -394,8 +407,10 @@ public abstract class WWD_Startup extends WWD_General{
* disable the steps 3 to 7 if no documents are
* on the list, and... show the dialog!
*/
- public void show() {
- try {
+ public void show()
+ {
+ try
+ {
/* myFrame.initialize(docWindow);
@@ -418,7 +433,9 @@ public abstract class WWD_Startup extends WWD_General{
executeDialog(myFrame);
removeTerminateListener();
- } catch (java.lang.Exception jexception) {
+ }
+ catch (java.lang.Exception jexception)
+ {
jexception.printStackTrace(System.out);
}
}
@@ -426,14 +443,18 @@ public abstract class WWD_Startup extends WWD_General{
/**
* initializes the style preview.
*/
- private void addStylePreview() {
- try {
+ private void addStylePreview()
+ {
+ try
+ {
dpStylePreview = new DocumentPreview(xMSF, imgPreview);
stylePreview = new StylePreview(xMSF, settings.workPath);
stylePreview.refresh(settings.cp_DefaultSession.getStyle(), settings.cp_DefaultSession.cp_Design.cp_BackgroundImage);
dpStylePreview.setDocument(stylePreview.htmlFilename, DocumentPreview.PREVIEW_MODE);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
@@ -441,18 +462,21 @@ public abstract class WWD_Startup extends WWD_General{
/**
* Loads the web wizard settings from the registry.
*/
- private void loadSettings(Object document) {
- try {
+ private void loadSettings(Object document)
+ {
+ try
+ {
// instanciate
- String[] settingsResources = new String[] {
- resources.resPages,
- resources.resSlides,
- resources.resCreatedTemplate,
- resources.resUpdatedTemplate,
- resources.resSizeTemplate
+ String[] settingsResources = new String[]
+ {
+ resources.resPages,
+ resources.resSlides,
+ resources.resCreatedTemplate,
+ resources.resUpdatedTemplate,
+ resources.resSizeTemplate
};
- settings = new CGSettings(xMSF, settingsResources, document );
+ settings = new CGSettings(xMSF, settingsResources, document);
// get configuration view
Object confRoot = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH, false);
@@ -463,8 +487,9 @@ public abstract class WWD_Startup extends WWD_General{
// now if path variables are used in publisher pathes, they
// are getting replaced here...
- for (int i = 0; i<set.getSize(); i++) {
- CGPublish p =(CGPublish)set.getElementAt(i);
+ for (int i = 0; i < set.getSize(); i++)
+ {
+ CGPublish p = (CGPublish) set.getElementAt(i);
p.cp_URL = substitute(p.cp_URL);
}
@@ -478,26 +503,29 @@ public abstract class WWD_Startup extends WWD_General{
prepareSessionLists();
- if (proxies) {
+ if (proxies)
+ {
__ftp = getPublisher(FTP_PUBLISHER).cp_Publish;
getPublisher(FTP_PUBLISHER).cp_Publish = false;
}
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
-
- protected void prepareSessionLists() {
+ protected void prepareSessionLists()
+ {
// now copy the sessions list...
Object[] sessions = settings.cp_SavedSessions.items();
settings.savedSessions.clear();
- for (int i = 0; i< sessions.length; i++)
- settings.savedSessions.add(i, sessions[i]);
-
- // add an empty session to the saved session list which apears in step 1
+ for (int i = 0; i < sessions.length; i++)
+ {
+ settings.savedSessions.add(i, sessions[i]); // add an empty session to the saved session list which apears in step 1
+ }
CGSessionName sn = new CGSessionName();
sn.cp_Name = resources.resSessionNameNone;
settings.cp_SavedSessions.add(0, sn);
@@ -509,7 +537,8 @@ public abstract class WWD_Startup extends WWD_General{
* Also set the selected "load" session to the last session
* which was saved.
*/
- private void fillLists() {
+ private void fillLists()
+ {
// fill the saved session list.
ListModelBinder.fillList(lstLoadSettings, settings.cp_SavedSessions.items(), null);
@@ -525,32 +554,41 @@ public abstract class WWD_Startup extends WWD_General{
}
- protected void selectSession() {
+ protected void selectSession()
+ {
int selectedSession = 0;
- if (settings.cp_LastSavedSession != null && !settings.cp_LastSavedSession.equals("")) {
+ if (settings.cp_LastSavedSession != null && !settings.cp_LastSavedSession.equals(""))
+ {
- Object ses = settings.cp_SavedSessions.getElement( settings.cp_LastSavedSession );
- if (ses != null) {
+ Object ses = settings.cp_SavedSessions.getElement(settings.cp_LastSavedSession);
+ if (ses != null)
+ {
selectedSession = settings.cp_SavedSessions.getIndexOf(ses);
}
}
- Helper.setUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems", new short[] { (short) selectedSession } );
+ Helper.setUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems", new short[]
+ {
+ (short) selectedSession
+ });
}
-
- public class SimpleDataawareUpdater implements XItemListener{
+ public class SimpleDataawareUpdater implements XItemListener
+ {
/* (non-Javadoc)
* @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
*/
- public void disposing(EventObject arg0) {
+
+ public void disposing(EventObject arg0)
+ {
// TODO Auto-generated method stub
}
- public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent) {
+ public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent)
+ {
sda.updateData();
- //TODO xf uncomment
- //refresh.eventPerformed(ie);
+ //TODO xf uncomment
+ //refresh.eventPerformed(ie);
}
}
@@ -559,30 +597,33 @@ public abstract class WWD_Startup extends WWD_General{
* textbox, no buttons though), a DataObject's JavaBean Property,
* or class member.
*/
- private void makeDataAware() {
+ private void makeDataAware()
+ {
//page 1
new ListModelBinder(lstLoadSettings, settings.cp_SavedSessions);
//page 2 : document properties
docListDA = (UnoDataAware) UnoDataAware.attachListBox(this, "SelectedDoc", lstDocuments, null, false);
- docListDA.disableControls(new Object[] {
- /*btnDocDown, btnDocUp, */
- lnDocsInfo, btnRemoveDoc, lblDocTitle, txtDocTitle, lblDocInfo, txtDocInfo, lblDocAuthor, txtDocAuthor, lblDocExportFormat, lstDocTargetType });
+ docListDA.disableControls(new Object[]
+ {
+ /*btnDocDown, btnDocUp, */
+ lnDocsInfo, btnRemoveDoc, lblDocTitle, txtDocTitle, lblDocInfo, txtDocInfo, lblDocAuthor, txtDocAuthor, lblDocExportFormat, lstDocTargetType
+ });
docListDA.updateUI();
CGDocument doc = new CGDocument(); //dummy
docsBinder = new ListModelBinder(lstDocuments, settings.cp_DefaultSession.cp_Content.cp_Documents);
- docAware.add(UnoDataAware.attachEditControl(doc, "cp_Title", txtDocTitle, refresh, true ));
+ docAware.add(UnoDataAware.attachEditControl(doc, "cp_Title", txtDocTitle, refresh, true));
docAware.add(UnoDataAware.attachEditControl(doc, "cp_Description", txtDocInfo, refresh, true));
docAware.add(UnoDataAware.attachEditControl(doc, "cp_Author", txtDocAuthor, refresh, true));
docAware.add(UnoDataAware.attachListBox(doc, "Exporter", lstDocTargetType, refresh, false));
//page 3 : Layout
Object design = settings.cp_DefaultSession.cp_Design;
- sda = new SimpleDataAware(design, new DataAware.PropertyValue("Layout",design), ilLayouts, new DataAware.PropertyValue("Selected",ilLayouts));
+ sda = new SimpleDataAware(design, new DataAware.PropertyValue("Layout", design), ilLayouts, new DataAware.PropertyValue("Selected", ilLayouts));
ilLayouts.addItemListener(new SimpleDataawareUpdater());
designAware.add(sda);
@@ -596,7 +637,10 @@ public abstract class WWD_Startup extends WWD_General{
designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayFormatIcon", chkDocFormatIcon, refresh, true));
designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayPages", chkDocPages, refresh, true));
designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplaySize", chkDocSize, refresh, true));
- designAware.add(RadioDataAware.attachRadioButtons(settings.cp_DefaultSession.cp_Design, "cp_OptimizeDisplaySize", new Object[] { optOptimize640x480, optOptimize800x600, optOptimize1024x768 }, refresh, true));
+ designAware.add(RadioDataAware.attachRadioButtons(settings.cp_DefaultSession.cp_Design, "cp_OptimizeDisplaySize", new Object[]
+ {
+ optOptimize640x480, optOptimize800x600, optOptimize1024x768
+ }, refresh, true));
//page 5 : Style
@@ -618,17 +662,16 @@ public abstract class WWD_Startup extends WWD_General{
//page 7 : publishing
pubAware(LOCAL_PUBLISHER, chkLocalDir, txtLocalDir, false);
- pubAware(FTP_PUBLISHER, chkFTP, lblFTP ,true );
- pubAware(ZIP_PUBLISHER, chkZip, txtZip , false );
+ pubAware(FTP_PUBLISHER, chkFTP, lblFTP, true);
+ pubAware(ZIP_PUBLISHER, chkZip, txtZip, false);
sessionNameDA = UnoDataAware.attachEditControl(settings.cp_DefaultSession, "cp_Name", cbSaveSettings, null, true);
- //cleanup when exiting wizard.
- //guiEventListener.add("WebWizardDialog",EventNames.EVENT_WINDOW_HIDDEN, "cleanup", this);
- //xWindow.addWindowListener((XWindowListener)guiEventListener);
+ //cleanup when exiting wizard.
+ //guiEventListener.add("WebWizardDialog",EventNames.EVENT_WINDOW_HIDDEN, "cleanup", this);
+ //xWindow.addWindowListener((XWindowListener)guiEventListener);
}
-
/**
* A help method to attach a Checkbox and a TextBox to
* a CGPublish object properties/class members,
@@ -636,16 +679,20 @@ public abstract class WWD_Startup extends WWD_General{
* @param checkbox
* @param textbox
*/
- private void pubAware(String publish, Object checkbox, Object textbox, boolean isLabel) {
+ private void pubAware(String publish, Object checkbox, Object textbox, boolean isLabel)
+ {
Object p = settings.cp_DefaultSession.cp_Publishing.getElement(publish);
UnoDataAware uda = UnoDataAware.attachCheckBox(p, "cp_Publish", checkbox, checkPublish, true);
uda.setInverse(true);
- uda.disableControls(new Object[] { textbox });
+ uda.disableControls(new Object[]
+ {
+ textbox
+ });
pubAware.add(uda);
pubAware.add(
- isLabel ? UnoDataAware.attachLabel(p, "URL", textbox, checkPublish, false )
- : UnoDataAware.attachEditControl(p, "URL", textbox, checkPublish, false));
+ isLabel ? UnoDataAware.attachLabel(p, "URL", textbox, checkPublish, false)
+ : UnoDataAware.attachEditControl(p, "URL", textbox, checkPublish, false));
}
@@ -654,7 +701,6 @@ public abstract class WWD_Startup extends WWD_General{
* (are used both on the start of the wizard and
* when the user loads a session)
*/
-
/**
* Is called when a new session/settings is
* loaded. <br/>
@@ -666,7 +712,8 @@ public abstract class WWD_Startup extends WWD_General{
* and ??? times for each document in the session.
*
*/
- protected void mount(CGSession session, Task task, boolean refreshStyle, XControl xC ) {
+ protected void mount(CGSession session, Task task, boolean refreshStyle, XControl xC)
+ {
/* This checks the documents. If the user
* chooses to cancel, the session is not loaded.
*/
@@ -695,12 +742,13 @@ public abstract class WWD_Startup extends WWD_General{
task.advance(true);
- if (refreshStyle) {
+ if (refreshStyle)
+ {
refreshStylePreview();
updateIconsetText();
}
- //updateUI();
+ //updateUI();
}
/**
@@ -713,7 +761,8 @@ public abstract class WWD_Startup extends WWD_General{
* @param data the CGPublish object
* @param i the number of the object (0 = local, 1 = ftp, 2 = zip)
*/
- private void mount(Object data, int i) {
+ private void mount(Object data, int i)
+ {
((DataAware) pubAware.get(i * 2)).setDataObject(data, true);
((DataAware) pubAware.get(i * 2 + 1)).setDataObject(data, true);
}
@@ -723,7 +772,8 @@ public abstract class WWD_Startup extends WWD_General{
* @param root the CGContent object
* that contains the documents (a ListModel)
*/
- private void mount(CGContent root) {
+ private void mount(CGContent root)
+ {
ListModelBinder.fillList(lstDocuments, root.cp_Documents.items(), null);
docsBinder.setListModel(root.cp_Documents);
disableDocUpDown();
@@ -736,9 +786,12 @@ public abstract class WWD_Startup extends WWD_General{
* @param data
* @param list
*/
- protected void mount(Object data, List list) {
+ protected void mount(Object data, List list)
+ {
for (int i = 0; i < list.size(); i++)
- ((DataAware) list.get(i)).setDataObject(data, true);
+ {
+ ((DataAware) list.get(i)).setDataObject(data, true);
+ }
}
/**
@@ -752,42 +805,54 @@ public abstract class WWD_Startup extends WWD_General{
* displayed, using the Task object to monitor progress.
* @return true if the document is ok (a file exists in the given url).
*/
- protected boolean checkDocument(CGDocument doc, Task task, XControl xC) {
- try {
+ protected boolean checkDocument(CGDocument doc, Task task, XControl xC)
+ {
+ try
+ {
doc.validate(xMSF, task);
return true;
- } catch (FileNotFoundException ex) {
+ }
+ catch (FileNotFoundException ex)
+ {
- int relocate = SystemDialog.showMessageBox(xMSF, xC.getPeer()
- , "WarningBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, getFileAccess().getPath(doc.cp_URL,"") + "\n\n" + resources.resSpecifyNewFileLocation);
+ int relocate = SystemDialog.showMessageBox(xMSF, xC.getPeer(), "WarningBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, getFileAccess().getPath(doc.cp_URL, "") + "\n\n" + resources.resSpecifyNewFileLocation);
- if (relocate == 2) {
+ if (relocate == 2)
+ {
String[] file = getDocAddDialog().callOpenDialog(false, FileAccess.getParentDir(doc.cp_URL));
if (file == null)
+ {
return false;
- else {
+ }
+ else
+ {
doc.cp_URL = file[0];
- return checkDocument(doc, task, xC );
+ return checkDocument(doc, task, xC);
}
- } else
+ }
+ else
+ {
return false;
+ }
}
- catch (IllegalArgumentException iaex) {
+ catch (IllegalArgumentException iaex)
+ {
//file is a directory
- AbstractErrorHandler.showMessage(xMSF,xControl.getPeer(),
- JavaTools.replaceSubString(resources.resErrIsDirectory,
- getFileAccess().getPath(doc.cp_URL,""),
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),
+ JavaTools.replaceSubString(resources.resErrIsDirectory,
+ getFileAccess().getPath(doc.cp_URL, ""),
"%FILENAME"),
- ErrorHandler.ERROR_PROCESS_FATAL);
+ ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
- catch (Exception exp) {
+ catch (Exception exp)
+ {
//something went wrong.
exp.printStackTrace();
- AbstractErrorHandler.showMessage(xMSF,xControl.getPeer(),
- JavaTools.replaceSubString(resources.resErrDocValidate,
- getFileAccess().getPath(doc.cp_URL,""),
- "%FILENAME"),ErrorHandler.ERROR_PROCESS_FATAL);
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),
+ JavaTools.replaceSubString(resources.resErrDocValidate,
+ getFileAccess().getPath(doc.cp_URL, ""),
+ "%FILENAME"), ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
@@ -798,14 +863,19 @@ public abstract class WWD_Startup extends WWD_General{
* @param content
* @param task
*/
- private void checkContent(CGContent content, Task task, XControl xC) {
+ private void checkContent(CGContent content, Task task, XControl xC)
+ {
for (int i = 0; i < content.cp_Documents.getSize(); i++)
+ {
if (!checkDocument((CGDocument) content.cp_Documents.getElementAt(i), task, xC))
- // I use here 'i--' since, when the document is removed
- // an index change accures
+ // I use here 'i--' since, when the document is removed
+ // an index change accures
+ {
content.cp_Documents.remove(i--);
- /*for (Iterator i = content.cp_Contents.childrenMap.values().iterator(); i.hasNext();)
- checkContent((CGContent)i.next(),task);*/
+ /*for (Iterator i = content.cp_Contents.childrenMap.values().iterator(); i.hasNext();)
+ checkContent((CGContent)i.next(),task);*/
+ }
+ }
}
/**
@@ -814,8 +884,11 @@ public abstract class WWD_Startup extends WWD_General{
* changes the "create" button enable state accordingly.
* @author rpiterman
*/
- private class CheckPublish implements DataAware.Listener {
- public void eventPerformed(Object event) {
+ private class CheckPublish implements DataAware.Listener
+ {
+
+ public void eventPerformed(Object event)
+ {
checkPublish();
}
}
@@ -827,39 +900,55 @@ public abstract class WWD_Startup extends WWD_General{
* down disabled and so on...)
*
*/
- protected void disableDocUpDown() {
- try {
+ protected void disableDocUpDown()
+ {
+ try
+ {
setEnabled(btnDocUp, selectedDoc.length == 0 ? Boolean.FALSE : (selectedDoc[0] == 0 ? Boolean.FALSE : Boolean.TRUE));
setEnabled(btnDocDown, selectedDoc.length == 0 ? Boolean.FALSE : (selectedDoc[0] + 1 < settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() ? Boolean.TRUE : Boolean.FALSE));
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
}
}
- void updateBackgroundText() {
+ void updateBackgroundText()
+ {
String bg = settings.cp_DefaultSession.cp_Design.cp_BackgroundImage;
if (bg == null || bg.equals(""))
+ {
bg = resources.resBackgroundNone;
+ }
else
- bg = FileAccess.getPathFilename( getFileAccess().getPath(bg,null));
-
- Helper.setUnoPropertyValue(getModel(txtBackground),"Label",bg);
+ {
+ bg = FileAccess.getPathFilename(getFileAccess().getPath(bg, null));
+ }
+ Helper.setUnoPropertyValue(getModel(txtBackground), "Label", bg);
}
- void updateIconsetText() {
+ void updateIconsetText()
+ {
String iconset = settings.cp_DefaultSession.cp_Design.cp_IconSet;
String iconsetName;
if (iconset == null || iconset.equals(""))
+ {
iconsetName = resources.resIconsetNone;
- else {
- CGIconSet is = (CGIconSet)settings.cp_IconSets.getElement(iconset);
+ }
+ else
+ {
+ CGIconSet is = (CGIconSet) settings.cp_IconSets.getElement(iconset);
if (is == null)
+ {
iconsetName = resources.resIconsetNone;
+ }
else
+ {
iconsetName = is.cp_Name;
+ }
}
- Helper.setUnoPropertyValue(getModel(txtIconset),"Label",iconsetName);
+ Helper.setUnoPropertyValue(getModel(txtIconset), "Label", iconsetName);
}
/**
@@ -868,31 +957,38 @@ public abstract class WWD_Startup extends WWD_General{
* when the background is changed, this method
* has to be called, so I am walking on the safe side here...
*/
- public void refreshStylePreview() {
- try {
+ public void refreshStylePreview()
+ {
+ try
+ {
updateBackgroundText();
stylePreview.refresh(settings.cp_DefaultSession.getStyle(), settings.cp_DefaultSession.cp_Design.cp_BackgroundImage);
dpStylePreview.reload(xMSF);
- } catch (Exception ex) {
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
-
- private class StylesComparator implements Comparator {
+ private class StylesComparator implements Comparator
+ {
/* (non-Javadoc)
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
- public int compare(Object o1, Object o2) {
+ public int compare(Object o1, Object o2)
+ {
// TODO Auto-generated method stub
- if (o1 instanceof CGStyle && o2 instanceof CGStyle) {
- return ((CGStyle)o1).cp_Name.compareTo(
- ((CGStyle)o2).cp_Name);
+ if (o1 instanceof CGStyle && o2 instanceof CGStyle)
+ {
+ return ((CGStyle) o1).cp_Name.compareTo(
+ ((CGStyle) o2).cp_Name);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot compare objects which are not CGStyle.");
}
- else throw new IllegalArgumentException("Cannot compare objects which are not CGStyle.");
}
-
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/WWHID.java b/wizards/com/sun/star/wizards/web/WWHID.java
index 3c71f36786b6..05b53e15af0d 100644
--- a/wizards/com/sun/star/wizards/web/WWHID.java
+++ b/wizards/com/sun/star/wizards/web/WWHID.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WWHID.java,v $
+ *
+ * $Revision: 1.4.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Created on May 5, 2004
*
* TODO To change the template for this generated file go to
@@ -12,173 +43,148 @@ package com.sun.star.wizards.web;
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
-public interface WWHID {
+public interface WWHID
+{
// web wizard general controls
- public static final int HID0_WEBWIZARD = 34200 + 0 ;
- public static final int HID0_HELP = 34200 + 1 ;
- public static final int HID0_NEXT = 34200 + 2 ;
- public static final int HID0_PREV = 34200 + 3 ;
- public static final int HID0_CREATE = 34200 + 4 ;
- public static final int HID0_CANCEL = 34200 + 5 ;
- public static final int HID0_STATUS_DIALOG = 34200 + 6 ;
-
-
-// step 1
- public static final int HID1_LST_SESSIONS = 34200 + 7 ;
- public static final int HID1_BTN_DEL_SES = 34200 + 9 ;
-
-// step 2
- public static final int HID2_LST_DOCS = 34200 + 10 ;
- public static final int HID2_BTN_ADD_DOC = 34200 + 11 ;
- public static final int HID2_BTN_REM_DOC = 34200 + 12 ;
- public static final int HID2_BTN_DOC_UP = 34200 + 13 ;
- public static final int HID2_BTN_DOC_DOWN = 34200 + 14 ;
- public static final int HID2_TXT_DOC_TITLE = 34200 + 15 ;
- public static final int HID2_TXT_DOC_DESC = 34200 + 16 ;
- public static final int HID2_TXT_DOC_AUTHOR = 34200 + 17 ;
- public static final int HID2_LST_DOC_EXPORT = 34200 + 18 ;
- public static final int HID2_STATUS_ADD_DOCS = 34200 + 19 ;
-
-// step 3
- public static final int HID3_IL_LAYOUTS_IMG1 = 34200 + 20 ;
- public static final int HID3_IL_LAYOUTS_IMG2 = 34200 + 21 ;
- public static final int HID3_IL_LAYOUTS_IMG3 = 34200 + 22 ;
- public static final int HID3_IL_LAYOUTS_IMG4 = 34200 + 23 ;
- public static final int HID3_IL_LAYOUTS_IMG5 = 34200 + 24 ;
- public static final int HID3_IL_LAYOUTS_IMG6 = 34200 + 25 ;
- public static final int HID3_IL_LAYOUTS_IMG7 = 34200 + 26 ;
- public static final int HID3_IL_LAYOUTS_IMG8 = 34200 + 27 ;
- public static final int HID3_IL_LAYOUTS_IMG9 = 34200 + 28 ;
- public static final int HID3_IL_LAYOUTS_IMG10 = 34200 + 29 ;
- public static final int HID3_IL_LAYOUTS_IMG11 = 34200 + 30 ;
- public static final int HID3_IL_LAYOUTS_IMG12 = 34200 + 31 ;
- public static final int HID3_IL_LAYOUTS_IMG13 = 34200 + 32 ;
- public static final int HID3_IL_LAYOUTS_IMG14 = 34200 + 33 ;
- public static final int HID3_IL_LAYOUTS_IMG15 = 34200 + 34 ;
-
-// step 4
- public static final int HID4_CHK_DISPLAY_FILENAME = 34200 + 35 ;
- public static final int HID4_CHK_DISPLAY_DESCRIPTION= 34200 + 36 ;
- public static final int HID4_CHK_DISPLAY_AUTHOR = 34200 + 37 ;
- public static final int HID4_CHK_DISPLAY_CR_DATE = 34200 + 38 ;
- public static final int HID4_CHK_DISPLAY_UP_DATE = 34200 + 39 ;
- public static final int HID4_CHK_DISPLAY_FORMAT = 34200 + 40 ;
- public static final int HID4_CHK_DISPLAY_F_ICON = 34200 + 41 ;
- public static final int HID4_CHK_DISPLAY_PAGES = 34200 + 42 ;
- public static final int HID4_CHK_DISPLAY_SIZE = 34200 + 43 ;
-
- public static final int HID4_GRP_OPTIMAIZE_640 = 34200 + 44 ;
- public static final int HID4_GRP_OPTIMAIZE_800 = 34200 + 45 ;
- public static final int HID4_GRP_OPTIMAIZE_1024 = 34200 + 46 ;
-
-
-// step 5
- public static final int HID5_LST_STYLES = 34200 + 47 ;
- public static final int HID5_BTN_BACKGND = 34200 + 48 ;
- public static final int HID5_BTN_ICONS = 34200 + 49 ;
-
-// step 6
- public static final int HID6_TXT_SITE_TITLE = 34200 + 50 ;
- public static final int HID6_TXT_SITE_ICON = 34200 + 51 ;
- public static final int HID6_BTN_SITE_ICON = 34200 + 52 ;
- public static final int HID6_TXT_SITE_DESC = 34200 + 53 ;
- public static final int HID6_TXT_SITE_KEYWRDS = 34200 + 54 ;
- public static final int HID6_DATE_SITE_CREATED = 34200 + 55 ;
- public static final int HID6_DATE_SITE_UPDATED = 34200 + 56 ;
- public static final int HID6_NUM_SITE_REVISTS = 34200 + 57 ;
- public static final int HID6_TXT_SITE_EMAIL = 34200 + 58 ;
- public static final int HID6_TXT_SITE_COPYRIGHT = 34200 + 59 ;
-
-// step 7
- public static final int HID7_BTN_PREVIEW = 34200 + 60 ;
- public static final int HID7_CHK_PUBLISH_LOCAL = 34200 + 61 ;
- public static final int HID7_TXT_LOCAL = 34200 + 62 ;
- public static final int HID7_BTN_LOCAL = 34200 + 63 ;
- public static final int HID7_CHK_PUBLISH_ZIP = 34200 + 64 ;
- public static final int HID7_TXT_ZIP = 34200 + 65 ;
- public static final int HID7_BTN_ZIP = 34200 + 66 ;
- public static final int HID7_CHK_PUBLISH_FTP = 34200 + 67 ;
+ public static final int HID0_WEBWIZARD = 34200 + 0;
+ public static final int HID0_HELP = 34200 + 1;
+ public static final int HID0_NEXT = 34200 + 2;
+ public static final int HID0_PREV = 34200 + 3;
+ public static final int HID0_CREATE = 34200 + 4;
+ public static final int HID0_CANCEL = 34200 + 5;
+ public static final int HID0_STATUS_DIALOG = 34200 + 6;// step 1
+ public static final int HID1_LST_SESSIONS = 34200 + 7;
+ public static final int HID1_BTN_DEL_SES = 34200 + 9;// step 2
+ public static final int HID2_LST_DOCS = 34200 + 10;
+ public static final int HID2_BTN_ADD_DOC = 34200 + 11;
+ public static final int HID2_BTN_REM_DOC = 34200 + 12;
+ public static final int HID2_BTN_DOC_UP = 34200 + 13;
+ public static final int HID2_BTN_DOC_DOWN = 34200 + 14;
+ public static final int HID2_TXT_DOC_TITLE = 34200 + 15;
+ public static final int HID2_TXT_DOC_DESC = 34200 + 16;
+ public static final int HID2_TXT_DOC_AUTHOR = 34200 + 17;
+ public static final int HID2_LST_DOC_EXPORT = 34200 + 18;
+ public static final int HID2_STATUS_ADD_DOCS = 34200 + 19;// step 3
+ public static final int HID3_IL_LAYOUTS_IMG1 = 34200 + 20;
+ public static final int HID3_IL_LAYOUTS_IMG2 = 34200 + 21;
+ public static final int HID3_IL_LAYOUTS_IMG3 = 34200 + 22;
+ public static final int HID3_IL_LAYOUTS_IMG4 = 34200 + 23;
+ public static final int HID3_IL_LAYOUTS_IMG5 = 34200 + 24;
+ public static final int HID3_IL_LAYOUTS_IMG6 = 34200 + 25;
+ public static final int HID3_IL_LAYOUTS_IMG7 = 34200 + 26;
+ public static final int HID3_IL_LAYOUTS_IMG8 = 34200 + 27;
+ public static final int HID3_IL_LAYOUTS_IMG9 = 34200 + 28;
+ public static final int HID3_IL_LAYOUTS_IMG10 = 34200 + 29;
+ public static final int HID3_IL_LAYOUTS_IMG11 = 34200 + 30;
+ public static final int HID3_IL_LAYOUTS_IMG12 = 34200 + 31;
+ public static final int HID3_IL_LAYOUTS_IMG13 = 34200 + 32;
+ public static final int HID3_IL_LAYOUTS_IMG14 = 34200 + 33;
+ public static final int HID3_IL_LAYOUTS_IMG15 = 34200 + 34;// step 4
+ public static final int HID4_CHK_DISPLAY_FILENAME = 34200 + 35;
+ public static final int HID4_CHK_DISPLAY_DESCRIPTION = 34200 + 36;
+ public static final int HID4_CHK_DISPLAY_AUTHOR = 34200 + 37;
+ public static final int HID4_CHK_DISPLAY_CR_DATE = 34200 + 38;
+ public static final int HID4_CHK_DISPLAY_UP_DATE = 34200 + 39;
+ public static final int HID4_CHK_DISPLAY_FORMAT = 34200 + 40;
+ public static final int HID4_CHK_DISPLAY_F_ICON = 34200 + 41;
+ public static final int HID4_CHK_DISPLAY_PAGES = 34200 + 42;
+ public static final int HID4_CHK_DISPLAY_SIZE = 34200 + 43;
+ public static final int HID4_GRP_OPTIMAIZE_640 = 34200 + 44;
+ public static final int HID4_GRP_OPTIMAIZE_800 = 34200 + 45;
+ public static final int HID4_GRP_OPTIMAIZE_1024 = 34200 + 46;// step 5
+ public static final int HID5_LST_STYLES = 34200 + 47;
+ public static final int HID5_BTN_BACKGND = 34200 + 48;
+ public static final int HID5_BTN_ICONS = 34200 + 49;// step 6
+ public static final int HID6_TXT_SITE_TITLE = 34200 + 50;
+ public static final int HID6_TXT_SITE_ICON = 34200 + 51;
+ public static final int HID6_BTN_SITE_ICON = 34200 + 52;
+ public static final int HID6_TXT_SITE_DESC = 34200 + 53;
+ public static final int HID6_TXT_SITE_KEYWRDS = 34200 + 54;
+ public static final int HID6_DATE_SITE_CREATED = 34200 + 55;
+ public static final int HID6_DATE_SITE_UPDATED = 34200 + 56;
+ public static final int HID6_NUM_SITE_REVISTS = 34200 + 57;
+ public static final int HID6_TXT_SITE_EMAIL = 34200 + 58;
+ public static final int HID6_TXT_SITE_COPYRIGHT = 34200 + 59;// step 7
+ public static final int HID7_BTN_PREVIEW = 34200 + 60;
+ public static final int HID7_CHK_PUBLISH_LOCAL = 34200 + 61;
+ public static final int HID7_TXT_LOCAL = 34200 + 62;
+ public static final int HID7_BTN_LOCAL = 34200 + 63;
+ public static final int HID7_CHK_PUBLISH_ZIP = 34200 + 64;
+ public static final int HID7_TXT_ZIP = 34200 + 65;
+ public static final int HID7_BTN_ZIP = 34200 + 66;
+ public static final int HID7_CHK_PUBLISH_FTP = 34200 + 67;
//public static final int HID7_TXT_FTP = 34200 + 68 ;
- public static final int HID7_BTN_FTP = 34200 + 69 ;
- public static final int HID7_CHK_SAVE = 34200 + 70 ;
- public static final int HID7_TXT_SAVE = 34200 + 71 ;
-
-// web wizard backgrounds dialog
- public static final int HID_BG = 34200 + 90 ;
- public static final int HID_BG_BTN_OTHER = 34200 + 91 ;
- public static final int HID_BG_BTN_NONE = 34200 + 92 ;
- public static final int HID_BG_BTN_OK = 34200 + 93 ;
- public static final int HID_BG_BTN_CANCEL = 34200 + 94 ;
-
- public static final int HID_BG_BTN_BACK = 34200 + 95 ;
- public static final int HID_BG_BTN_FW = 34200 + 96 ;
- public static final int HID_BG_BTN_IMG1 = 34200 + 97 ;
- public static final int HID_BG_BTN_IMG2 = 34200 + 98 ;
- public static final int HID_BG_BTN_IMG3 = 34200 + 99 ;
- public static final int HID_BG_BTN_IMG4 = 34200 + 100 ;
- public static final int HID_BG_BTN_IMG5 = 34200 + 101 ;
- public static final int HID_BG_BTN_IMG6 = 34200 + 102 ;
- public static final int HID_BG_BTN_IMG7 = 34200 + 103 ;
- public static final int HID_BG_BTN_IMG8 = 34200 + 104 ;
- public static final int HID_BG_BTN_IMG9 = 34200 + 105 ;
- public static final int HID_BG_BTN_IMG10 = 34200 + 106 ;
- public static final int HID_BG_BTN_IMG11 = 34200 + 107 ;
- public static final int HID_BG_BTN_IMG12 = 34200 + 108 ;
- public static final int HID_BG_BTN_IMG13 = 34200 + 109 ;
- public static final int HID_BG_BTN_IMG14 = 34200 + 100 ;
- public static final int HID_BG_BTN_IMG15 = 34200 + 111 ;
- public static final int HID_BG_BTN_IMG16 = 34200 + 112 ;
-
-
-
-// web wizard icons sets dialog
- public static final int HID_IS = 41000 + 0 ;
- public static final int HID_IS_ICONSETS = 41000 + 1 ;
- public static final int HID_IS_BTN_NONE = 41000 + 2 ;
- public static final int HID_IS_BTN_OK = 41000 + 3 ;
-
- public static final int HID_IS_BTN_IMG1 = 41000 + 5 ;
- public static final int HID_IS_BTN_IMG2 = 41000 + 6 ;
- public static final int HID_IS_BTN_IMG3 = 41000 + 7 ;
- public static final int HID_IS_BTN_IMG4 = 41000 + 8 ;
- public static final int HID_IS_BTN_IMG5 = 41000 + 9 ;
- public static final int HID_IS_BTN_IMG6 = 41000 + 10 ;
- public static final int HID_IS_BTN_IMG7 = 41000 + 11 ;
- public static final int HID_IS_BTN_IMG8 = 41000 + 12 ;
- public static final int HID_IS_BTN_IMG9 = 41000 + 13 ;
- public static final int HID_IS_BTN_IMG10 = 41000 + 14 ;
- public static final int HID_IS_BTN_IMG11 = 41000 + 15 ;
- public static final int HID_IS_BTN_IMG12 = 41000 + 16 ;
- public static final int HID_IS_BTN_IMG13 = 41000 + 17 ;
- public static final int HID_IS_BTN_IMG14 = 41000 + 18 ;
- public static final int HID_IS_BTN_IMG15 = 41000 + 19 ;
- public static final int HID_IS_BTN_IMG16 = 41000 + 20 ;
- public static final int HID_IS_BTN_IMG17 = 41000 + 21 ;
- public static final int HID_IS_BTN_IMG18 = 41000 + 22 ;
- public static final int HID_IS_BTN_IMG19 = 41000 + 23 ;
- public static final int HID_IS_BTN_IMG20 = 41000 + 24 ;
- public static final int HID_IS_BTN_IMG21 = 41000 + 25 ;
- public static final int HID_IS_BTN_IMG22 = 41000 + 26 ;
- public static final int HID_IS_BTN_IMG23 = 41000 + 27 ;
- public static final int HID_IS_BTN_IMG24 = 41000 + 28 ;
- public static final int HID_IS_BTN_IMG25 = 41000 + 29 ;
- public static final int HID_IS_BTN_IMG26 = 41000 + 30 ;
- public static final int HID_IS_BTN_IMG27 = 41000 + 31 ;
- public static final int HID_IS_BTN_IMG28 = 41000 + 32 ;
- public static final int HID_IS_BTN_IMG29 = 41000 + 33 ;
- public static final int HID_IS_BTN_IMG30 = 41000 + 34 ;
- public static final int HID_IS_BTN_IMG31 = 41000 + 35 ;
- public static final int HID_IS_BTN_IMG32 = 41000 + 36 ;
+ public static final int HID7_BTN_FTP = 34200 + 69;
+ public static final int HID7_CHK_SAVE = 34200 + 70;
+ public static final int HID7_TXT_SAVE = 34200 + 71;// web wizard backgrounds dialog
+ public static final int HID_BG = 34200 + 90;
+ public static final int HID_BG_BTN_OTHER = 34200 + 91;
+ public static final int HID_BG_BTN_NONE = 34200 + 92;
+ public static final int HID_BG_BTN_OK = 34200 + 93;
+ public static final int HID_BG_BTN_CANCEL = 34200 + 94;
+ public static final int HID_BG_BTN_BACK = 34200 + 95;
+ public static final int HID_BG_BTN_FW = 34200 + 96;
+ public static final int HID_BG_BTN_IMG1 = 34200 + 97;
+ public static final int HID_BG_BTN_IMG2 = 34200 + 98;
+ public static final int HID_BG_BTN_IMG3 = 34200 + 99;
+ public static final int HID_BG_BTN_IMG4 = 34200 + 100;
+ public static final int HID_BG_BTN_IMG5 = 34200 + 101;
+ public static final int HID_BG_BTN_IMG6 = 34200 + 102;
+ public static final int HID_BG_BTN_IMG7 = 34200 + 103;
+ public static final int HID_BG_BTN_IMG8 = 34200 + 104;
+ public static final int HID_BG_BTN_IMG9 = 34200 + 105;
+ public static final int HID_BG_BTN_IMG10 = 34200 + 106;
+ public static final int HID_BG_BTN_IMG11 = 34200 + 107;
+ public static final int HID_BG_BTN_IMG12 = 34200 + 108;
+ public static final int HID_BG_BTN_IMG13 = 34200 + 109;
+ public static final int HID_BG_BTN_IMG14 = 34200 + 100;
+ public static final int HID_BG_BTN_IMG15 = 34200 + 111;
+ public static final int HID_BG_BTN_IMG16 = 34200 + 112;// web wizard icons sets dialog
+ public static final int HID_IS = 41000 + 0;
+ public static final int HID_IS_ICONSETS = 41000 + 1;
+ public static final int HID_IS_BTN_NONE = 41000 + 2;
+ public static final int HID_IS_BTN_OK = 41000 + 3;
+ public static final int HID_IS_BTN_IMG1 = 41000 + 5;
+ public static final int HID_IS_BTN_IMG2 = 41000 + 6;
+ public static final int HID_IS_BTN_IMG3 = 41000 + 7;
+ public static final int HID_IS_BTN_IMG4 = 41000 + 8;
+ public static final int HID_IS_BTN_IMG5 = 41000 + 9;
+ public static final int HID_IS_BTN_IMG6 = 41000 + 10;
+ public static final int HID_IS_BTN_IMG7 = 41000 + 11;
+ public static final int HID_IS_BTN_IMG8 = 41000 + 12;
+ public static final int HID_IS_BTN_IMG9 = 41000 + 13;
+ public static final int HID_IS_BTN_IMG10 = 41000 + 14;
+ public static final int HID_IS_BTN_IMG11 = 41000 + 15;
+ public static final int HID_IS_BTN_IMG12 = 41000 + 16;
+ public static final int HID_IS_BTN_IMG13 = 41000 + 17;
+ public static final int HID_IS_BTN_IMG14 = 41000 + 18;
+ public static final int HID_IS_BTN_IMG15 = 41000 + 19;
+ public static final int HID_IS_BTN_IMG16 = 41000 + 20;
+ public static final int HID_IS_BTN_IMG17 = 41000 + 21;
+ public static final int HID_IS_BTN_IMG18 = 41000 + 22;
+ public static final int HID_IS_BTN_IMG19 = 41000 + 23;
+ public static final int HID_IS_BTN_IMG20 = 41000 + 24;
+ public static final int HID_IS_BTN_IMG21 = 41000 + 25;
+ public static final int HID_IS_BTN_IMG22 = 41000 + 26;
+ public static final int HID_IS_BTN_IMG23 = 41000 + 27;
+ public static final int HID_IS_BTN_IMG24 = 41000 + 28;
+ public static final int HID_IS_BTN_IMG25 = 41000 + 29;
+ public static final int HID_IS_BTN_IMG26 = 41000 + 30;
+ public static final int HID_IS_BTN_IMG27 = 41000 + 31;
+ public static final int HID_IS_BTN_IMG28 = 41000 + 32;
+ public static final int HID_IS_BTN_IMG29 = 41000 + 33;
+ public static final int HID_IS_BTN_IMG30 = 41000 + 34;
+ public static final int HID_IS_BTN_IMG31 = 41000 + 35;
+ public static final int HID_IS_BTN_IMG32 = 41000 + 36;
// web wizard ftp dialog
- public static final int HID_FTP = 41000 + 40 ;
- public static final int HID_FTP_SERVER = 41000 + 41 ;
- public static final int HID_FTP_USERNAME = 41000 + 42 ;
- public static final int HID_FTP_PASS = 41000 + 43 ;
- public static final int HID_FTP_TEST = 41000 + 44 ;
- public static final int HID_FTP_TXT_PATH = 41000 + 45 ;
- public static final int HID_FTP_BTN_PATH = 41000 + 46 ;
- public static final int HID_FTP_OK = 41000 + 47 ;
- public static final int HID_FTP_CANCEL = 41000 + 48 ;
-
+ public static final int HID_FTP = 41000 + 40;
+ public static final int HID_FTP_SERVER = 41000 + 41;
+ public static final int HID_FTP_USERNAME = 41000 + 42;
+ public static final int HID_FTP_PASS = 41000 + 43;
+ public static final int HID_FTP_TEST = 41000 + 44;
+ public static final int HID_FTP_TXT_PATH = 41000 + 45;
+ public static final int HID_FTP_BTN_PATH = 41000 + 46;
+ public static final int HID_FTP_OK = 41000 + 47;
+ public static final int HID_FTP_CANCEL = 41000 + 48;
}
diff --git a/wizards/com/sun/star/wizards/web/WebWizard.java b/wizards/com/sun/star/wizards/web/WebWizard.java
index c098eeba8bfb..b9b968dcdc14 100644
--- a/wizards/com/sun/star/wizards/web/WebWizard.java
+++ b/wizards/com/sun/star/wizards/web/WebWizard.java
@@ -1,9 +1,39 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WebWizard.java,v $
+ *
+ * $Revision: 1.6.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Start1.java
*
* Created on 19. September 2003, 12:09
*/
-
package com.sun.star.wizards.web;
import com.sun.star.awt.XTopWindow;
@@ -16,21 +46,25 @@ import com.sun.star.wizards.common.Desktop;
* Has no functionality, is just nice to have it instanciated.
* @author rpiterman
*/
-public class WebWizard extends WWD_Events{
+public class WebWizard extends WWD_Events
+{
/**
* @param xmsf
*/
- public WebWizard(XMultiServiceFactory xmsf) throws Exception {
+ public WebWizard(XMultiServiceFactory xmsf) throws Exception
+ {
super(xmsf);
}
- public static void main(String args[]) {
+ public static void main(String args[])
+ {
String ConnectStr =
- "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
+ "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
//localhost ;Lo-1.Germany.sun.com; 10.16.65.155
- try {
+ try
+ {
XMultiServiceFactory xmsf = Desktop.connect(ConnectStr);
//File dir = new File("D:\\CWS\\extras6");//("C:\\Documents and Settings\\rpiterman\\My Documents");
//getFiles(dir,xLocMSF);
@@ -40,7 +74,9 @@ public class WebWizard extends WWD_Events{
ww.show();
ww.cleanup();
- } catch (Exception exception) {
+ }
+ catch (Exception exception)
+ {
exception.printStackTrace(System.out);
}
}
diff --git a/wizards/com/sun/star/wizards/web/WebWizardConst.java b/wizards/com/sun/star/wizards/web/WebWizardConst.java
index a525d19cf236..a8b2b972de0f 100644
--- a/wizards/com/sun/star/wizards/web/WebWizardConst.java
+++ b/wizards/com/sun/star/wizards/web/WebWizardConst.java
@@ -1,56 +1,77 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WebWizardConst.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.web;
-public interface WebWizardConst {
- public static final String LSTLOADSETTINGS_ITEM_CHANGED = "sessionSelected"; // "lstLoadSettingsItemChanged";
- public static final String BTNLOADSESSION_ACTION_PERFORMED = "loadSession"; // "btnLoadSessionActionPerformed";
- public static final String BTNDELSESSION_ACTION_PERFORMED = "delSession"; // "btnDelSessionActionPerformed";
- public static final String BTNADDDOC_ACTION_PERFORMED = "addDocument"; // "btnAddDocActionPerformed";
- public static final String BTNREMOVEDOC_ACTION_PERFORMED = "removeDocument"; // "btnRemoveDocActionPerformed";
- public static final String BTNDOCUP_ACTION_PERFORMED = "docUp"; // "btnDocUpActionPerformed";
- public static final String BTNDOCDOWN_ACTION_PERFORMED = "docDown"; // "btnDocDownActionPerformed";
- public static final String LSTSTYLES_ITEM_CHANGED = "refreshStylePreview"; // "lstStylesItemChanged";
- public static final String BTNBACKGROUNDS_ACTION_PERFORMED = "chooseBackground"; // "btnBackgroundsActionPerformed";
- public static final String BTNICONSETS_ACTION_PERFORMED = "chooseIconset"; // "btnIconSetsActionPerformed";
- public static final String BTNFAVICON_ACTION_PERFORMED = "chooseFavIcon"; // "btnFavIconActionPerformed";
- public static final String BTNPREVIEW_ACTION_PERFORMED = "documentPreview"; // "btnPreviewActionPerformed";
- public static final String BTNFTP_ACTION_PERFORMED = "setFTPPublish"; // "btnFTPActionPerformed";
- public static final String CHKLOCALDIR_ITEM_CHANGED = "checkPublish"; // "chkLocalDirItemChanged";
- public static final String CHKSAVESETTINGS_ITEM_CHANGED = "checkPublish"; // "chkSaveSettingsItemChanged";
- public static final String TXTSAVESETTINGS_TEXT_CHANGED = "checkPublish"; // "txtSaveSettingsTextChanged";
- public static final String BTNLOCALDIR_ACTION_PERFORMED = "setPublishLocalDir"; // "btnLocalDirActionPerformed";
- public static final String BTNZIP_ACTION_PERFORMED = "setZipFilename";// "btnZipActionPerformed";
-
-
- public static final String CONFIG_PATH = "/org.openoffice.Office.WebWizard/WebWizard";
- public static final String CONFIG_READ_PARAM ="cp_";
-
- public static final String TASK = "WWIZ";
-
- public static final String TASK_PREPARE = "t-prep";
-
- public static final String LOCAL_PUBLISHER = "local";
- public static final String FTP_PUBLISHER = "ftp";
- public static final String ZIP_PUBLISHER = "zip";
-
- public static final String TASK_EXPORT = "t_exp";
- public static final String TASK_EXPORT_PREPARE = "t_exp_prep";
- public static final String TASK_EXPORT_DOCUMENTS = "t_exp_docs";
-
- public static final String TASK_GENERATE_PREPARE = "t_gen_prep";
- public static final String TASK_GENERATE_XSL = "t_gen_x";
- public static final String TASK_GENERATE_COPY = "t_gen_cp";
-
- public static final String TASK_PUBLISH_PREPARE = "t_pub_prep";
- //public static final String TASK_PUBLISH = "t_pub";
-
- public static final String TASK_FINISH = "t_fin";
-
- /**
- * when the user adds more than this number
- * of documents to the list, a status dialog opens.
- */
- public static final int MIN_ADD_FILES_FOR_DIALOG = 2;
-
+public interface WebWizardConst
+{
+ public static final String LSTLOADSETTINGS_ITEM_CHANGED = "sessionSelected"; // "lstLoadSettingsItemChanged";
+ public static final String BTNLOADSESSION_ACTION_PERFORMED = "loadSession"; // "btnLoadSessionActionPerformed";
+ public static final String BTNDELSESSION_ACTION_PERFORMED = "delSession"; // "btnDelSessionActionPerformed";
+ public static final String BTNADDDOC_ACTION_PERFORMED = "addDocument"; // "btnAddDocActionPerformed";
+ public static final String BTNREMOVEDOC_ACTION_PERFORMED = "removeDocument"; // "btnRemoveDocActionPerformed";
+ public static final String BTNDOCUP_ACTION_PERFORMED = "docUp"; // "btnDocUpActionPerformed";
+ public static final String BTNDOCDOWN_ACTION_PERFORMED = "docDown"; // "btnDocDownActionPerformed";
+ public static final String LSTSTYLES_ITEM_CHANGED = "refreshStylePreview"; // "lstStylesItemChanged";
+ public static final String BTNBACKGROUNDS_ACTION_PERFORMED = "chooseBackground"; // "btnBackgroundsActionPerformed";
+ public static final String BTNICONSETS_ACTION_PERFORMED = "chooseIconset"; // "btnIconSetsActionPerformed";
+ public static final String BTNFAVICON_ACTION_PERFORMED = "chooseFavIcon"; // "btnFavIconActionPerformed";
+ public static final String BTNPREVIEW_ACTION_PERFORMED = "documentPreview"; // "btnPreviewActionPerformed";
+ public static final String BTNFTP_ACTION_PERFORMED = "setFTPPublish"; // "btnFTPActionPerformed";
+ public static final String CHKLOCALDIR_ITEM_CHANGED = "checkPublish"; // "chkLocalDirItemChanged";
+ public static final String CHKSAVESETTINGS_ITEM_CHANGED = "checkPublish"; // "chkSaveSettingsItemChanged";
+ public static final String TXTSAVESETTINGS_TEXT_CHANGED = "checkPublish"; // "txtSaveSettingsTextChanged";
+ public static final String BTNLOCALDIR_ACTION_PERFORMED = "setPublishLocalDir"; // "btnLocalDirActionPerformed";
+ public static final String BTNZIP_ACTION_PERFORMED = "setZipFilename";// "btnZipActionPerformed";
+ public static final String CONFIG_PATH = "/org.openoffice.Office.WebWizard/WebWizard";
+ public static final String CONFIG_READ_PARAM = "cp_";
+ public static final String TASK = "WWIZ";
+ public static final String TASK_PREPARE = "t-prep";
+ public static final String LOCAL_PUBLISHER = "local";
+ public static final String FTP_PUBLISHER = "ftp";
+ public static final String ZIP_PUBLISHER = "zip";
+ public static final String TASK_EXPORT = "t_exp";
+ public static final String TASK_EXPORT_PREPARE = "t_exp_prep";
+ public static final String TASK_EXPORT_DOCUMENTS = "t_exp_docs";
+ public static final String TASK_GENERATE_PREPARE = "t_gen_prep";
+ public static final String TASK_GENERATE_XSL = "t_gen_x";
+ public static final String TASK_GENERATE_COPY = "t_gen_cp";
+ public static final String TASK_PUBLISH_PREPARE = "t_pub_prep";
+ //public static final String TASK_PUBLISH = "t_pub";
+ public static final String TASK_FINISH = "t_fin";
+ /**
+ * when the user adds more than this number
+ * of documents to the list, a status dialog opens.
+ */
+ public static final int MIN_ADD_FILES_FOR_DIALOG = 2;
}
\ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.java b/wizards/com/sun/star/wizards/web/WebWizardDialog.java
index f189f895d733..089122bea457 100644
--- a/wizards/com/sun/star/wizards/web/WebWizardDialog.java
+++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web;
+ ************************************************************************/
+package com.sun.star.wizards.web;
import com.sun.star.awt.FontDescriptor;
import com.sun.star.awt.Size;
@@ -51,631 +52,883 @@ import com.sun.star.wizards.web.data.CGLayout;
* This class is generated Automatically....
* bla bla bla
*/
-public abstract class WebWizardDialog extends WizardDialog implements WebWizardConst, UIConsts, WWHID {
- //GUI Components as Class members.
- XFixedText lbIntroTitle;
- XFixedText lblIntroduction;
- //Fixed Line
- XControl lnLoadSettings;
- XFixedText lblLoadSettings;
- XListBox lstLoadSettings;
- XButton btnDelSession;
- XFixedText lblContentTitle;
- //Fixed Line
- XFixedText lblSiteContent;
- XListBox lstDocuments;
- XButton btnAddDoc;
- XButton btnRemoveDoc;
- XButton btnDocUp;
- XButton btnDocDown;
- //Fixed Line
- XControl lnDocsInfo;
- XFixedText lblDocTitle;
- XTextComponent txtDocTitle;
- XFixedText lblDocInfo;
- XTextComponent txtDocInfo;
- XFixedText lblDocAuthor;
- XTextComponent txtDocAuthor;
- XFixedText lblDocExportFormat;
- XListBox lstDocTargetType;
- XFixedText lblLayoutTitle;
- XFixedText lblLayouts;
- /*XFixedText Label1;
- //Image Control
- XControl ImageControl1;
- //Image Control
- XControl ImageControl3;
- //Image Control
- XControl ImageControl4;
- //Image Control
- XControl ImageControl5;
- //Image Control
- XControl ImageControl6;
- XFixedText Label3;
- //titled box
- XControl FrameControl1;
- //Image Control
- XControl ImageControl2;
- //Image Control
- XControl ImageControl7;
- //Image Control
- XControl ImageControl8;
- //Image Control
- XControl ImageControl9;
- //Image Control
- XControl ImageControl10;
- //Image Control
- XControl ImageControl11;
- //Image Control
- XControl ImageControl12;
- //Image Control
- XControl ImageControl13;
- //Image Control
- XControl ImageControl14;
- //Image Control
- XControl ImageControl15;
- */
- XCheckBox chbDocDesc;
- XCheckBox chkDocFilename;
- XCheckBox chbDocAuthor;
- XCheckBox chkDocFormat;
- XCheckBox chkDocFormatIcon;
- XCheckBox chkDocCreated;
- XCheckBox chkDocChanged;
- XCheckBox chkDocPages;
- XCheckBox chkDocSize;
- XFixedText lnDisplay;
- XRadioButton optOptimize640x480;
- XRadioButton optOptimize800x600;
- XRadioButton optOptimize1024x768;
- XFixedText lblLayout2Title;
- XFixedText lblOptimizeFor;
-
- // Step 5
-
- XFixedText lblStyle;
- XFixedText lblStyleTitle;
- XListBox lstStyles;
- //Image Control
- XFixedText txtBackground;
- XFixedText txtIconset;
- XButton btnBackgrounds;
- XButton btnIconSets;
- XControl imgPreview;
-
- // Step 6
-
- XFixedText lblSiteTitle;
- XFixedText lblSiteCreated;
- XFixedText lblEmail;
- XFixedText lblSiteDesc;
- XTextComponent txtSiteTitle;
- XTextComponent txtSiteDesc;
- XTextComponent txtEmail;
- XDateField dateSiteCreated;
- XDateField dateSiteUpdate;
- XFixedText lblSiteUpdated;
- XTextComponent txtCopyright;
- XFixedText lblCopyright;
- XFixedText lblTitleGeneralPage;
- XButton btnPreview;
- XButton btnFTP;
- XCheckBox chkLocalDir;
- //Fixed Line
- XControl lblCreateSite;
- XCheckBox chkFTP;
- XFixedText lblFTP;
- XCheckBox chkZip;
- XCheckBox chkSaveSettings;
- XFixedText lblSaveSettings;
- //Fixed Line
- XControl lnSaveSetting;
- XComboBox cbSaveSettings;
- XTextComponent txtLocalDir;
- XTextComponent txtZip;
- XButton btnLocalDir;
- XButton btnZip;
- XFixedText lblTitlePublish;
- //Fixed Line
- XControl FixedLine1;
- //Font Descriptors as Class members.
- FontDescriptor fontDescriptor0 = new FontDescriptor();
- FontDescriptor fontDescriptor1 = new FontDescriptor();
- FontDescriptor fontDescriptor4 = new FontDescriptor();
- FontDescriptor fontDescriptor5 = new FontDescriptor();
- FontDescriptor fontDescriptor6 = new FontDescriptor();
- FontDescriptor fontDescriptor7 = new FontDescriptor();
-
- //private static String[] PROPNAMES_LBL_NOFOCUS = new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "Width"};
- private static String[] PROPNAMES_LBL = new String[] { "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"};
- private static String[] PROPNAMES_CHKBOX = new String[] { "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width" };
- private static String[] PROPNAMES_BUTTON = new String[] { "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width" };
- private static String[] PROPNAMES_TXT = new String[] { "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width" };
- private static String[] PROPNAMES_TXT_2 = new String[] { "Height", "HelpURL", "Name", "PositionX", "PositionY", "ReadOnly", "Step", "TabIndex", "Width" };
- private static String[] PROPNAMES_TITLE = new String[] { "FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width" };
-
- private static Integer INTEGER_91 = new Integer(91);
- private static Integer INTEGER_97 = new Integer(97);
- private static Integer INTEGER_103 = new Integer(103);
- private static Integer INTEGER_169 = new Integer(169);
-
-
- //Resources Object
- WebWizardDialogResources resources;
-
- public WebWizardDialog(XMultiServiceFactory xmsf) {
- super(xmsf, HID0_WEBWIZARD);
- //Load Resources
- resources = new WebWizardDialogResources(xmsf, super.getResource());
-
-
- //set dialog properties...
- Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Closeable","Height", "HelpURL", "Moveable","Name","PositionX","PositionY","Step","TabIndex","Title","Width"},
- new Object[] { Boolean.TRUE,new Integer(210), "HID:" + HID0_WEBWIZARD , Boolean.TRUE,"WebWizardDialog",new Integer(102),new Integer(52),INTEGERS[1],new Short((short)6),resources.resWebWizardDialog_title,new Integer(330)}
- );
-
- //Set member- FontDescriptors...
- fontDescriptor0.Weight = 100;
- fontDescriptor1.Weight = 150;
- fontDescriptor1.Underline = com.sun.star.awt.FontUnderline.SINGLE;
- fontDescriptor4.Weight = 150;
- fontDescriptor5.Name = "Angsana New";
- fontDescriptor5.Height = 16;
- fontDescriptor5.StyleName = "Regular";
- fontDescriptor5.Family = com.sun.star.awt.FontFamily.ROMAN;
- fontDescriptor5.Weight = 100;
- fontDescriptor6.Name = "Andalus";
- fontDescriptor6.Height = 22;
- fontDescriptor6.StyleName = "Bold Italic";
- fontDescriptor6.Weight = 150;
- fontDescriptor6.Slant = com.sun.star.awt.FontSlant.ITALIC;
- fontDescriptor7.Name = "StarSymbol";
- fontDescriptor7.Height = 9;
- fontDescriptor7.StyleName = "Regular";
- fontDescriptor7.Weight = 100;
- }
- //build components
- public void buildStep1() {
- short tabIndex = 100;
- lbIntroTitle = insertLabel("lbIntroTitle",
- PROPNAMES_TITLE ,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslbIntroTitle_value,Boolean.TRUE,"lbIntroTitle",new Integer(91),INTEGERS[8],INTEGERS[1],new Short(tabIndex++),new Integer(232)}
- );
- lblIntroduction = insertLabel("lblIntroduction",
- new String[] {"Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(119),resources.reslblIntroduction_value,Boolean.TRUE,"lblIntroduction",new Integer(97),new Integer(28),INTEGERS[1],new Short(tabIndex++),new Integer(226)}
- );
-
- lnLoadSettings = insertFixedLine("lnLoadSettings",
- PROPNAMES_TXT,
- new Object[] { INTEGERS[2],"", "lnLoadSettings",new Integer(91),new Integer(147),INTEGERS[1],new Short(tabIndex++),new Integer(234)}
- );
- lblLoadSettings = insertLabel("lblLoadSettings",
- new String[] {"Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGERS[8],resources.reslblLoadSettings_value,Boolean.TRUE,"lblLoadSettings",new Integer(97),new Integer(153),INTEGERS[1],new Short(tabIndex++),new Integer(226)}
- );
- lstLoadSettings = insertListBox("lstLoadSettings", null ,LSTLOADSETTINGS_ITEM_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL","LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12, "HID:" + HID1_LST_SESSIONS , new Short((short)7),"lstLoadSettings",new Integer(97),new Integer(165),INTEGERS[1],new Short(tabIndex++),new Integer(173)}
- );
- btnDelSession = insertButton("btnDelSession", BTNDELSESSION_ACTION_PERFORMED,
- new String[] {"Enabled","Height", "HelpURL", "ImageAlign", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.FALSE, INTEGER_14, "HID:" + HID1_BTN_DEL_SES, new Short(com.sun.star.awt.ImageAlign.LEFT),resources.resbtnDelSession_value,"btnDelSession",new Integer(274),new Integer(164),INTEGERS[1],new Short(tabIndex++),INTEGER_50}
- );
- }
-
- public void buildStep2() {
- short tabIndex = 200;
-
- lblContentTitle = insertLabel("lblContentTitle",
- PROPNAMES_TITLE,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblContentTitle_value,Boolean.TRUE, "lblContentTitle",new Integer(91),INTEGERS[8],INTEGERS[2],new Short(tabIndex++),new Integer(232)}
- );
- lblSiteContent = insertLabel("lblSiteContent",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblSiteContent_value,"lblSiteContent",new Integer(97),new Integer(28),INTEGERS[2],new Short(tabIndex++),new Integer(105)}
- );
- lstDocuments = insertListBox("lstDocuments", null,null,
- new String[] {"Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(123), "HID:" + HID2_LST_DOCS, new Short((short)9),"lstDocuments",new Integer(97),new Integer(38),INTEGERS[2],new Short(tabIndex++),new Integer(103)}
- );
- btnAddDoc = insertButton("btnAddDoc", BTNADDDOC_ACTION_PERFORMED,
- PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID2_BTN_ADD_DOC, resources.resbtnAddDoc_value,"btnAddDoc",new Integer(97),new Integer(165),INTEGERS[2],new Short(tabIndex++),INTEGER_50}
- );
- btnRemoveDoc = insertButton("btnRemoveDoc", BTNREMOVEDOC_ACTION_PERFORMED,
- PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID2_BTN_REM_DOC, resources.resbtnRemoveDoc_value,"btnRemoveDoc",new Integer(150),new Integer(165),INTEGERS[2],new Short(tabIndex++),INTEGER_50}
- );
- btnDocUp = insertButton("btnDocUp", BTNDOCUP_ACTION_PERFORMED,
- new String[] {"FontDescriptor", "Height", "HelpURL","Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { fontDescriptor7,INTEGER_14, "HID:" + HID2_BTN_DOC_UP, resources.resbtnDocUp_value,"btnDocUp",new Integer(205),new Integer(87),INTEGERS[2],new Short(tabIndex++),new Integer(18)}
- );
- btnDocDown = insertButton("btnDocDown", BTNDOCDOWN_ACTION_PERFORMED,
- new String[] {"FontDescriptor", "Height", "HelpURL","Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width" },
- new Object[] { fontDescriptor7,INTEGER_14, "HID:" + HID2_BTN_DOC_DOWN, resources.resbtnDocDown_value,"btnDocDown",new Integer(205),new Integer(105),INTEGERS[2], new Short(tabIndex++),new Integer(18)}
- );
-
- lblDocExportFormat = insertLabel("lblDocExportFormat",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblDocExportFormat_value,"lblDocExportFormat",new Integer(235),new Integer(28),INTEGERS[2],new Short(tabIndex++),new Integer(89)}
- );
- lstDocTargetType = insertListBox("lstDocTargetType", null,null,
- new String[] {"Dropdown", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE, INTEGER_12, "HID:" + HID2_LST_DOC_EXPORT , new Short((short)7),"lstDocTargetType",new Integer(235),new Integer(38),INTEGERS[2],new Short(tabIndex++),new Integer(89)}
- );
-
-
-
-
- lnDocsInfo = insertFixedLine("lnDocsInfo",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslnDocsInfo_value,"lnDocsInfo",new Integer(235),new Integer(66),INTEGERS[2],new Short(tabIndex++),new Integer(90)}
- );
- lblDocTitle = insertLabel("lblDocTitle",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblDocTitle_value,"lblDocTitle",new Integer(235),new Integer(78),INTEGERS[2],new Short(tabIndex++),new Integer(89)}
- );
- txtDocTitle = insertTextField("txtDocTitle", null,
- PROPNAMES_TXT,
- new Object[] { INTEGER_12, "HID:" + HID2_TXT_DOC_TITLE , "txtDocTitle",new Integer(235),new Integer(88),INTEGERS[2],new Short(tabIndex++),new Integer(89)}
- );
- lblDocInfo = insertLabel("lblDocInfo",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblDocInfo_value,"lblDocInfo",new Integer(235),new Integer(103),INTEGERS[2],new Short(tabIndex++),new Integer(89)}
- );
- txtDocInfo = insertTextField("txtDocInfo", null,
- new String[] {"Height", "HelpURL", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_40, "HID:" + HID2_TXT_DOC_DESC , Boolean.TRUE,"txtDocInfo",new Integer(235),new Integer(113),INTEGERS[2],new Short(tabIndex++),new Integer(89)}
- );
- lblDocAuthor = insertLabel("lblDocAuthor",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblDocAuthor_value,"lblDocAuthor",new Integer(235),new Integer(155),INTEGERS[2],new Short(tabIndex++),new Integer(89)}
- );
- txtDocAuthor = insertTextField("txtDocAuthor", null,
- PROPNAMES_TXT,
- new Object[] { INTEGER_12, "HID:" + HID2_TXT_DOC_AUTHOR, "txtDocAuthor",new Integer(235),new Integer(165),INTEGERS[2],new Short(tabIndex++),new Integer(89)}
- );
- }
-
- public void buildStep3() {
- lblLayoutTitle = insertLabel("lblLayoutTitle",
- PROPNAMES_TITLE,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblLayoutTitle_value,Boolean.TRUE,"lblLayoutTitle",new Integer(91),INTEGERS[8],INTEGERS[3],new Short((short)29),new Integer(232)}
- );
- lblLayouts = insertLabel("lblLayouts",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblLayouts_value,"lblLayouts",new Integer(97),new Integer(28),INTEGERS[3],new Short((short)30),new Integer(206)}
- );
-
- }
-
- public void buildStep4() {
- lblLayout2Title = insertLabel("lblLayout2Title",
- PROPNAMES_TITLE,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblLayout2Title_value,Boolean.TRUE,"lblLayout2Title",new Integer(91),INTEGERS[8],INTEGERS[4],new Short((short)33),new Integer(232)}
- );
- lnDisplay = insertLabel("lblDisplay",
- new String[] {"Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_16,resources.reslblDisplay_value,Boolean.TRUE, "lblDisplay",new Integer(97),new Integer(28),INTEGERS[4],new Short((short)34),new Integer(226)}
- );
- chkDocFilename = insertCheckBox("chkDocFilename", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_FILENAME , resources.reschkDocFilename_value,"chkDocFilename",new Integer(103),new Integer(50),new Short((short)0),INTEGERS[4],new Short((short)35),new Integer(99)}
- );
- chbDocDesc = insertCheckBox("chbDocDesc", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_DESCRIPTION, resources.reschbDocDesc_value,"chbDocDesc",new Integer(103),new Integer(60),new Short((short)0),INTEGERS[4],new Short((short)36),new Integer(99)}
- );
- chbDocAuthor = insertCheckBox("chbDocAuthor", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_AUTHOR, resources.reschbDocAuthor_value,"chbDocAuthor",new Integer(103),new Integer(70),new Short((short)0),INTEGERS[4],new Short((short)37),new Integer(99)}
- );
- chkDocCreated = insertCheckBox("chkDocCreated", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_CR_DATE,resources.reschkDocCreated_value,"chkDocCreated",new Integer(103),new Integer(80),new Short((short)0),INTEGERS[4],new Short((short)38),new Integer(99)}
- );
- chkDocChanged = insertCheckBox("chkDocChanged", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_UP_DATE, resources.reschkDocChanged_value,"chkDocChanged",new Integer(103),new Integer(90),new Short((short)0),INTEGERS[4],new Short((short)39),new Integer(99)}
- );
-
- chkDocFormat = insertCheckBox("chkDocFormat", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8],"HID:" + HID4_CHK_DISPLAY_FORMAT, resources.reschkDocFormat_value,"chkDocFormat",new Integer(200),new Integer(50),new Short((short)0),INTEGERS[4],new Short((short)40),new Integer(110)}
- );
- chkDocFormatIcon = insertCheckBox("chkDocFormatIcon", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_F_ICON, resources.reschkDocFormatIcon_value,"chkDocFormatIcon",new Integer(200),new Integer(60),new Short((short)0),INTEGERS[4],new Short((short)41),new Integer(110)}
- );
- chkDocPages = insertCheckBox("chkDocPages", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_PAGES , resources.reschkDocPages_value,"chkDocPages",new Integer(200),new Integer(70),new Short((short)0),INTEGERS[4],new Short((short)42),new Integer(110)}
- );
- chkDocSize = insertCheckBox("chkDocSize", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_SIZE, resources.reschkDocSize_value,"chkDocSize",new Integer(200),new Integer(80),new Short((short)0),INTEGERS[4],new Short((short)43),new Integer(110)}
- );
- lblOptimizeFor = insertLabel("lblOptimizeFor",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblOptimizeFor_value,"lblOptimizeFor",new Integer(97),new Integer(113),INTEGERS[4],new Short((short)44), new Integer(226)}
- );
- optOptimize640x480 = insertRadioButton("optOptimize640x480", null,
- PROPNAMES_BUTTON,
- new Object[] { INTEGERS[10], "HID:" + HID4_GRP_OPTIMAIZE_640, resources.resoptOptimize640x480_value,"optOptimize640x480",new Integer(103),new Integer(133),INTEGERS[4],new Short((short)45),new Integer(44)}
- );
- optOptimize800x600 = insertRadioButton("optOptimize800x600", null,
- PROPNAMES_BUTTON,
- new Object[] { INTEGERS[10], "HID:" + HID4_GRP_OPTIMAIZE_800, resources.resoptOptimize800x600_value,"optOptimize800x600",new Integer(103),new Integer(146),INTEGERS[4],new Short((short)46),new Integer(44)}
- );
- optOptimize1024x768 = insertRadioButton("optOptimize1024x768", null,
- PROPNAMES_BUTTON,
- new Object[] { INTEGERS[10], "HID:" + HID4_GRP_OPTIMAIZE_1024, resources.resoptOptimize1024x768_value,"optOptimize1024x768",new Integer(103),new Integer(158),INTEGERS[4],new Short((short)47),new Integer(44)}
- );
-
- }
-
- public void buildStep5() {
- lblStyleTitle = insertLabel("lblStyleTitle",PROPNAMES_TITLE,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblStyleTitle_value,Boolean.TRUE,"lblStyleTitle",new Integer(91),INTEGERS[8],INTEGERS[5],new Short((short)50),new Integer(232)}
- );
-
- lblStyle = insertLabel("lblStyle",PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblStyle_value,"lblStyle",new Integer(97),new Integer(28),INTEGERS[5],new Short((short)51),new Integer(80)}
- );
- lstStyles = insertListBox("lstStyles", null,LSTSTYLES_ITEM_CHANGED,
- new String[] {"Dropdown", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12, "HID:" + HID5_LST_STYLES, new Short((short)7),"lstStyles",new Integer(179),new Integer(26),INTEGERS[5],new Short((short)52),new Integer(145)}
- );
-
- insertLabel("lblBackground", PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblBackground,"lblBackground",new Integer(97),new Integer(46),INTEGERS[5],new Short((short)51),new Integer(70)}
- );
- txtBackground = insertLabel("txtBackground",
- new String[] { "Border", "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"} ,
- new Object[] { new Short((short)1), INTEGER_12, resources.resBackgroundNone, "txtBackground",new Integer(179),new Integer(44),INTEGERS[5],new Short((short)52),new Integer(90)}
- );
- btnBackgrounds = insertButton("btnBackgrounds", BTNBACKGROUNDS_ACTION_PERFORMED, PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID5_BTN_BACKGND, resources.resBtnChooseBackground ,"btnBackgrounds",new Integer(274),new Integer(43),INTEGERS[5],new Short((short)53),INTEGER_50}
- );
-
- insertLabel("lblIconset", PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblIconset,"lblIconset",new Integer(97),new Integer(64),INTEGERS[5],new Short((short)51),new Integer(70)}
- );
- txtIconset = insertLabel("txtIconset",
- new String[] { "Border", "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"} ,
- new Object[] { new Short((short)1), INTEGER_12, resources.resIconsetNone,"txtIconset",new Integer(179),new Integer(62),INTEGERS[5],new Short((short)52),new Integer(90)}
- );
- btnIconSets = insertButton("btnIconSets", BTNICONSETS_ACTION_PERFORMED,
- PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID5_BTN_ICONS, resources.resBtnChooseIconset,"btnIconSets",new Integer(274),new Integer(61),INTEGERS[5],new Short((short)54),INTEGER_50 }
- );
- insertLabel("lblIconsetInfo",
- new String[] { "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { INTEGER_16 ,resources.reslblIconSetInfo, Boolean.TRUE, "lblIconsetInfo",new Integer(179),new Integer(78),INTEGERS[5],new Short((short)51),new Integer(145)}
- );
-
-
- imgPreview = insertImage("imgPreview",
- new String[] {"BackgroundColor", "Enabled","Height", "ImageURL", "Name", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(0), Boolean.FALSE, new Integer(78),"" ,"imgPreview",new Integer(91),new Integer(100),Boolean.FALSE,INTEGERS[5],new Short((short)55),new Integer(232)}
- );
-
- }
-
- public void buildStep6() {
- short tabIndex = 60;
- lblTitleGeneralPage = insertLabel("lblTitleGeneralPage",
- PROPNAMES_TITLE,
- new Object[] { fontDescriptor4,INTEGERS[8],resources.reslblTitleGeneralPage_value,Boolean.TRUE,"lblTitleGeneralPage",new Integer(90),INTEGERS[9],INTEGERS[6], new Short(tabIndex++),new Integer(232)}
- );
- lblSiteTitle = insertLabel("lblSiteTitle",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblSiteTitle_value,"lblSiteTitle",new Integer(97),new Integer(28),INTEGERS[6], new Short(tabIndex++),new Integer(80)}
- );
- txtSiteTitle = insertTextField("txtSiteTitle", null,
- PROPNAMES_TXT,
- new Object[] { INTEGER_12, "HID:" + HID6_TXT_SITE_TITLE, "txtSiteTitle",new Integer(179),new Integer(26),INTEGERS[6], new Short(tabIndex++),new Integer(145)}
- );
-
-
- insertFixedLine("FixedLineMetaData",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[9],resources.reslblMetaData ,"FixedLineMetaData",new Integer(97),new Integer(56),INTEGERS[6], new Short(tabIndex++),new Integer(228)}
- );
-
-
- lblSiteDesc = insertLabel("lblSiteDesc",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblSiteDesc_value,"lblSiteDesc",new Integer(103),new Integer(72),INTEGERS[6], new Short(tabIndex++),new Integer(80)}
- );
- txtSiteDesc = insertTextField("txtSiteDesc", null,
- PROPNAMES_TXT,
- new Object[] { INTEGER_12, "HID:" + HID6_TXT_SITE_DESC , "txtSiteDesc",new Integer(179),new Integer(70),INTEGERS[6], new Short(tabIndex++),new Integer(145)}
- );
-
- lblEmail = insertLabel("lblEmail", PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblEmail_value,"lblEmail",new Integer(103),new Integer(90),INTEGERS[6], new Short(tabIndex++),new Integer(80)}
- );
- txtEmail = insertTextField("txtEmail", null, PROPNAMES_TXT,
- new Object[] { INTEGER_12, "HID:" + HID6_TXT_SITE_EMAIL , "txtEmail",new Integer(179),new Integer(87),INTEGERS[6], new Short(tabIndex++),new Integer(145)}
- );
-
- lblCopyright = insertLabel("lblCopyright", PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblCopyright_value,"lblCopyright",new Integer(103),new Integer(108),INTEGERS[6], new Short(tabIndex++),new Integer(80)}
- );
- txtCopyright = insertTextField("txtCopyright", null, PROPNAMES_TXT,
- new Object[] { INTEGER_12, "HID:" + HID6_TXT_SITE_COPYRIGHT , "txtCopyright",new Integer(179),new Integer(106),INTEGERS[6], new Short(tabIndex++),new Integer(145)}
- );
-
-
- lblSiteCreated = insertLabel("lblSiteCreated",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblSiteCreated_value,"lblSiteCreated",new Integer(103),new Integer(126),INTEGERS[6], new Short(tabIndex++),new Integer(80)}
- );
- dateSiteCreated = insertDateField("dateSiteCreated", null,
- new String[] {"Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12, "HID:" + HID6_DATE_SITE_CREATED , "dateSiteCreated",new Integer(179),new Integer(124),INTEGERS[6], new Short(tabIndex++),new Integer(49)}
- );
- lblSiteUpdated = insertLabel("lblSiteUpdated",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8],resources.reslblSiteUpdated_value,"lblSiteUpdated",new Integer(103),new Integer(144),INTEGERS[6], new Short(tabIndex++),new Integer(80)}
- );
-
- dateSiteUpdate = insertDateField("dateSiteUpdate", null,
- new String[] {"Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { Boolean.TRUE,INTEGER_12, "HID:" + HID6_DATE_SITE_UPDATED , "dateSiteUpdate",new Integer(179),new Integer(142),INTEGERS[6], new Short(tabIndex++),new Integer(49)}
- );
-
-
-
- }
-
- public void buildStep7( boolean disableFTP, String exclamationURL) {
- short tabIndex = 700;
-
- lblTitlePublish = insertLabel("lblTitlePublish",
- PROPNAMES_TITLE,
- new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitlePublish_value,Boolean.TRUE, "lblTitlePublish",new Integer(91),INTEGERS[8],INTEGERS[7],new Short(tabIndex++), new Integer(232)}
- );
-
- FixedLine1 = insertFixedLine("FixedLine1",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[9],resources.resFixedLine1_value,"FixedLine1",new Integer(97),new Integer(28),INTEGERS[7],new Short(tabIndex++),new Integer(228)}
- );
-
- btnPreview = insertButton("btnPreview", BTNPREVIEW_ACTION_PERFORMED,
- PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID7_BTN_PREVIEW ,resources.resbtnPreview_value,"btnPreview",new Integer(103),new Integer(40),INTEGERS[7],new Short(tabIndex++),INTEGER_50}
- );
-
- lblCreateSite = insertFixedLine("lblCreateSite",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[9],resources.reslblCreateSite_value,"lblCreateSite",new Integer(97),new Integer(56),INTEGERS[7],new Short(tabIndex++),new Integer(228)}
- );
-
- chkLocalDir = insertCheckBox("chkLocalDir", CHKLOCALDIR_ITEM_CHANGED,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID7_CHK_PUBLISH_LOCAL, resources.reschkLocalDir_value,"chkLocalDir",new Integer(103),new Integer(68),new Short((short)0),INTEGERS[7],new Short(tabIndex++),new Integer(215)}
- );
- txtLocalDir = insertTextField("txtLocalDir", null,
- PROPNAMES_TXT,
- new Object[] { INTEGER_12, "HID:" + HID7_TXT_LOCAL , "txtLocalDir",new Integer(113),new Integer(78), INTEGERS[7], new Short(tabIndex++),new Integer(190)}
- );
- btnLocalDir = insertButton("btnLocalDir", BTNLOCALDIR_ACTION_PERFORMED,
- PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID7_BTN_LOCAL , resources.resbtnLocalDir_value,"btnLocalDir",new Integer(308),new Integer(77),INTEGERS[7],new Short(tabIndex++),INTEGER_16}
- );
-
- chkZip = insertCheckBox("chkZip", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[9], "HID:" + HID7_CHK_PUBLISH_ZIP, resources.reschkZip_value,"chkZip",new Integer(103),new Integer(96),new Short((short)0),INTEGERS[7],new Short(tabIndex++),new Integer(215)}
- );
- txtZip = insertTextField("txtZip", null,
- PROPNAMES_TXT,
- new Object[] { INTEGER_12, "HID:" + HID7_TXT_ZIP, "txtZip",new Integer(113),new Integer(108), INTEGERS[7],new Short(tabIndex++),new Integer(190)}
- );
- btnZip = insertButton("btnZip", BTNZIP_ACTION_PERFORMED,
- PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID7_BTN_ZIP, resources.resbtnZip_value,"btnZip",new Integer(308),new Integer(107),INTEGERS[7],new Short(tabIndex++),INTEGER_16}
- );
-
- chkFTP = insertCheckBox("chkFTP", null,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[8], "HID:" + HID7_CHK_PUBLISH_FTP, resources.reschkFTP_value,"chkFTP",new Integer(103),new Integer(124),new Short((short)0),INTEGERS[7],new Short(tabIndex++),new Integer(215)}
- );
-
- Integer FTP_STEP = disableFTP ? new Integer(99) : INTEGERS[7];
-
- lblFTP = insertLabel("lblFTP",
- new String[] { "Border", "Height", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"} ,
- new Object[] { new Short((short)1), INTEGER_12, "txtFTP", new Integer(113),new Integer(134),FTP_STEP ,new Short(tabIndex++),new Integer(156)}
- );
-
- btnFTP = insertButton("btnFTP", BTNFTP_ACTION_PERFORMED,
- PROPNAMES_BUTTON,
- new Object[] { INTEGER_14, "HID:" + HID7_BTN_FTP, resources.resbtnFTP_value,"btnFTP",new Integer(274),new Integer(133),FTP_STEP,new Short(tabIndex++),INTEGER_50}
- );
-
- if (disableFTP) {
-
- insertImage("imgFTPDisabled",
- new String[] {"BackgroundColor", "Border" , "Enabled","Height", "ImageURL", "Name", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(-1), new Short((short)0), Boolean.FALSE, new Integer(10),exclamationURL ,"imgFTPDisabled",new Integer(115),new Integer(135),Boolean.FALSE,INTEGERS[7],new Short(tabIndex++),new Integer(8)}
- );
- insertLabel("lblFTPDisabled",
- new String[] { "BackgroundColor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
- new Object[] { new Integer(-1), INTEGER_8,resources.reslblFTPDisabled,Boolean.TRUE, "lblFTPDisabled",new Integer(125),new Integer(136),INTEGERS[7],new Short(tabIndex++),new Integer(226)}
- );
- //FTP_STEP = new Integer(99);
- }
- //else
-
- lnSaveSetting = insertFixedLine("lnSaveSetting",
- PROPNAMES_TXT,
- new Object[] { INTEGERS[2],"", "lnSaveSetting",new Integer(97),new Integer(151),INTEGERS[7], new Short(tabIndex++),new Integer(228)}
- );
- chkSaveSettings = insertCheckBox("chkSaveSettings", CHKSAVESETTINGS_ITEM_CHANGED,
- PROPNAMES_CHKBOX,
- new Object[] { INTEGERS[9], "HID:" + HID7_CHK_SAVE , resources.reschkSaveSettings_value,"chkSaveSettings",new Integer(97),new Integer(157),new Short((short)1),INTEGERS[7], new Short(tabIndex++),new Integer(215)}
- );
- lblSaveSettings = insertLabel("lblSaveSettings",
- PROPNAMES_LBL,
- new Object[] { INTEGERS[8], resources.reslblSaveSettings_value,"lblSaveSettings",new Integer(107),new Integer(169),INTEGERS[7], new Short(tabIndex++),new Integer(45)}
- );
- cbSaveSettings = insertComboBox("txtSaveSettings", TXTSAVESETTINGS_TEXT_CHANGED,TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED,
- new String[] {"Autocomplete", "Dropdown", "Height","HelpURL","LineCount","Name","PositionX","PositionY","Step","TabIndex","Width"},
- new Object[] { Boolean.TRUE, Boolean.TRUE, INTEGER_12, "HID:" + HID7_TXT_SAVE , new Short((short)7), "txtSaveSettings",new Integer(179),new Integer(167),INTEGERS[7], new Short(tabIndex++),new Integer(145)}
- );
-
- }
-
- XControl[] imgIconsPrev = new XControl[8];
- ImageList ilLayouts;
-
- /**
- * builds the layouts image list.
- */
- public void buildStepX() {
- ilLayouts = new ImageList();
- ilLayouts.setPos(new Size(97,38));
- ilLayouts.setImageSize(new Size(34,30));
- ilLayouts.setCols(5);
- ilLayouts.setRows(3);
- ilLayouts.setStep(new Short((short)3));
- ilLayouts.setShowButtons(false);
- ilLayouts.setRenderer(new LayoutRenderer());
- ilLayouts.scaleImages = Boolean.FALSE;
- ilLayouts.tabIndex = 31;
- ilLayouts.helpURL = HID3_IL_LAYOUTS_IMG1;
+public abstract class WebWizardDialog extends WizardDialog implements WebWizardConst, UIConsts, WWHID
+{
+ //GUI Components as Class members.
+ XFixedText lbIntroTitle;
+ XFixedText lblIntroduction;
+ //Fixed Line
+ XControl lnLoadSettings;
+ XFixedText lblLoadSettings;
+ XListBox lstLoadSettings;
+ XButton btnDelSession;
+ XFixedText lblContentTitle;
+ //Fixed Line
+ XFixedText lblSiteContent;
+ XListBox lstDocuments;
+ XButton btnAddDoc;
+ XButton btnRemoveDoc;
+ XButton btnDocUp;
+ XButton btnDocDown;
+ //Fixed Line
+ XControl lnDocsInfo;
+ XFixedText lblDocTitle;
+ XTextComponent txtDocTitle;
+ XFixedText lblDocInfo;
+ XTextComponent txtDocInfo;
+ XFixedText lblDocAuthor;
+ XTextComponent txtDocAuthor;
+ XFixedText lblDocExportFormat;
+ XListBox lstDocTargetType;
+ XFixedText lblLayoutTitle;
+ XFixedText lblLayouts;
+ /*XFixedText Label1;
+ //Image Control
+ XControl ImageControl1;
+ //Image Control
+ XControl ImageControl3;
+ //Image Control
+ XControl ImageControl4;
+ //Image Control
+ XControl ImageControl5;
+ //Image Control
+ XControl ImageControl6;
+ XFixedText Label3;
+ //titled box
+ XControl FrameControl1;
+ //Image Control
+ XControl ImageControl2;
+ //Image Control
+ XControl ImageControl7;
+ //Image Control
+ XControl ImageControl8;
+ //Image Control
+ XControl ImageControl9;
+ //Image Control
+ XControl ImageControl10;
+ //Image Control
+ XControl ImageControl11;
+ //Image Control
+ XControl ImageControl12;
+ //Image Control
+ XControl ImageControl13;
+ //Image Control
+ XControl ImageControl14;
+ //Image Control
+ XControl ImageControl15;
+ */
+ XCheckBox chbDocDesc;
+ XCheckBox chkDocFilename;
+ XCheckBox chbDocAuthor;
+ XCheckBox chkDocFormat;
+ XCheckBox chkDocFormatIcon;
+ XCheckBox chkDocCreated;
+ XCheckBox chkDocChanged;
+ XCheckBox chkDocPages;
+ XCheckBox chkDocSize;
+ XFixedText lnDisplay;
+ XRadioButton optOptimize640x480;
+ XRadioButton optOptimize800x600;
+ XRadioButton optOptimize1024x768;
+ XFixedText lblLayout2Title;
+ XFixedText lblOptimizeFor; // Step 5
+ XFixedText lblStyle;
+ XFixedText lblStyleTitle;
+ XListBox lstStyles; //Image Control
+ XFixedText txtBackground;
+ XFixedText txtIconset;
+ XButton btnBackgrounds;
+ XButton btnIconSets;
+ XControl imgPreview; // Step 6
+ XFixedText lblSiteTitle;
+ XFixedText lblSiteCreated;
+ XFixedText lblEmail;
+ XFixedText lblSiteDesc;
+ XTextComponent txtSiteTitle;
+ XTextComponent txtSiteDesc;
+ XTextComponent txtEmail;
+ XDateField dateSiteCreated;
+ XDateField dateSiteUpdate;
+ XFixedText lblSiteUpdated;
+ XTextComponent txtCopyright;
+ XFixedText lblCopyright;
+ XFixedText lblTitleGeneralPage;
+ XButton btnPreview;
+ XButton btnFTP;
+ XCheckBox chkLocalDir;
+ //Fixed Line
+ XControl lblCreateSite;
+ XCheckBox chkFTP;
+ XFixedText lblFTP;
+ XCheckBox chkZip;
+ XCheckBox chkSaveSettings;
+ XFixedText lblSaveSettings;
+ //Fixed Line
+ XControl lnSaveSetting;
+ XComboBox cbSaveSettings;
+ XTextComponent txtLocalDir;
+ XTextComponent txtZip;
+ XButton btnLocalDir;
+ XButton btnZip;
+ XFixedText lblTitlePublish;
+ //Fixed Line
+ XControl FixedLine1;
+ //Font Descriptors as Class members.
+ FontDescriptor fontDescriptor0 = new FontDescriptor();
+ FontDescriptor fontDescriptor1 = new FontDescriptor();
+ FontDescriptor fontDescriptor4 = new FontDescriptor();
+ FontDescriptor fontDescriptor5 = new FontDescriptor();
+ FontDescriptor fontDescriptor6 = new FontDescriptor();
+ FontDescriptor fontDescriptor7 = new FontDescriptor(); //private static String[] PROPNAMES_LBL_NOFOCUS = new String[] {"Height", "Label", "Name", "PositionX", "PositionY", "Step", "Width"};
+ private static String[] PROPNAMES_LBL = new String[]
+ {
+ "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ };
+ private static String[] PROPNAMES_CHKBOX = new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"
+ };
+ private static String[] PROPNAMES_BUTTON = new String[]
+ {
+ "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ };
+ private static String[] PROPNAMES_TXT = new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ };
+ private static String[] PROPNAMES_TXT_2 = new String[]
+ {
+ "Height", "HelpURL", "Name", "PositionX", "PositionY", "ReadOnly", "Step", "TabIndex", "Width"
+ };
+ private static String[] PROPNAMES_TITLE = new String[]
+ {
+ "FontDescriptor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ };
+ private static Integer INTEGER_91 = new Integer(91);
+ private static Integer INTEGER_97 = new Integer(97);
+ private static Integer INTEGER_103 = new Integer(103);
+ private static Integer INTEGER_169 = new Integer(169); //Resources Object
+ WebWizardDialogResources resources;
+
+ public WebWizardDialog(XMultiServiceFactory xmsf)
+ {
+ super(xmsf, HID0_WEBWIZARD);
+ //Load Resources
+ resources = new WebWizardDialogResources(xmsf, super.getResource());
+
+
+ //set dialog properties...
+ Helper.setUnoPropertyValues(xDialogModel,
+ new String[]
+ {
+ "Closeable", "Height", "HelpURL", "Moveable", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Title", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, new Integer(210), "HID:" + HID0_WEBWIZARD, Boolean.TRUE, "WebWizardDialog", new Integer(102), new Integer(52), INTEGERS[1], new Short((short) 6), resources.resWebWizardDialog_title, new Integer(330)
+ });
+
+ //Set member- FontDescriptors...
+ fontDescriptor0.Weight = 100;
+ fontDescriptor1.Weight = 150;
+ fontDescriptor1.Underline = com.sun.star.awt.FontUnderline.SINGLE;
+ fontDescriptor4.Weight = 150;
+ fontDescriptor5.Name = "Angsana New";
+ fontDescriptor5.Height = 16;
+ fontDescriptor5.StyleName = "Regular";
+ fontDescriptor5.Family = com.sun.star.awt.FontFamily.ROMAN;
+ fontDescriptor5.Weight = 100;
+ fontDescriptor6.Name = "Andalus";
+ fontDescriptor6.Height = 22;
+ fontDescriptor6.StyleName = "Bold Italic";
+ fontDescriptor6.Weight = 150;
+ fontDescriptor6.Slant = com.sun.star.awt.FontSlant.ITALIC;
+ fontDescriptor7.Name = "StarSymbol";
+ fontDescriptor7.Height = 9;
+ fontDescriptor7.StyleName = "Regular";
+ fontDescriptor7.Weight = 100;
+ }
+ //build components
+ public void buildStep1()
+ {
+ short tabIndex = 100;
+ lbIntroTitle = insertLabel("lbIntroTitle",
+ PROPNAMES_TITLE,
+ new Object[]
+ {
+ fontDescriptor4, INTEGER_16, resources.reslbIntroTitle_value, Boolean.TRUE, "lbIntroTitle", new Integer(91), INTEGERS[8], INTEGERS[1], new Short(tabIndex++), new Integer(232)
+ });
+ lblIntroduction = insertLabel("lblIntroduction",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(119), resources.reslblIntroduction_value, Boolean.TRUE, "lblIntroduction", new Integer(97), new Integer(28), INTEGERS[1], new Short(tabIndex++), new Integer(226)
+ });
+
+ lnLoadSettings = insertFixedLine("lnLoadSettings",
+ PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGERS[2], "", "lnLoadSettings", new Integer(91), new Integer(147), INTEGERS[1], new Short(tabIndex++), new Integer(234)
+ });
+ lblLoadSettings = insertLabel("lblLoadSettings",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblLoadSettings_value, Boolean.TRUE, "lblLoadSettings", new Integer(97), new Integer(153), INTEGERS[1], new Short(tabIndex++), new Integer(226)
+ });
+ lstLoadSettings = insertListBox("lstLoadSettings", null, LSTLOADSETTINGS_ITEM_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + HID1_LST_SESSIONS, new Short((short) 7), "lstLoadSettings", new Integer(97), new Integer(165), INTEGERS[1], new Short(tabIndex++), new Integer(173)
+ });
+ btnDelSession = insertButton("btnDelSession", BTNDELSESSION_ACTION_PERFORMED,
+ new String[]
+ {
+ "Enabled", "Height", "HelpURL", "ImageAlign", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.FALSE, INTEGER_14, "HID:" + HID1_BTN_DEL_SES, new Short(com.sun.star.awt.ImageAlign.LEFT), resources.resbtnDelSession_value, "btnDelSession", new Integer(274), new Integer(164), INTEGERS[1], new Short(tabIndex++), INTEGER_50
+ });
+ }
- /*for (int i = 0; i<8; i++)
- imgIconsPrev[i] = insertImage("imgIconPrev" + i,
- new String[] { "BackgroundColor","Border","Height","ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "Tabstop", "Width"},
- new Object[] { new Integer(-1), new Short((short)0),new Integer(14),"file:///c:/bludisk.gif", new Integer(97 + i * 20 + 7 ),new Integer(147),Boolean.FALSE,INTEGERS[5],Boolean.FALSE,new Integer(14)});
- */
- }
-
- /**
- * renders the images and titles of
- * the layouts
- * @author rpiterman
-
- */
- private class LayoutRenderer implements ImageList.ImageRenderer {
-
- public Object[] getImageUrls(Object listItem) {
- Object[] oResIds = null;
- if (listItem != null)
- oResIds = ((CGLayout)listItem).getImageUrls();
- return oResIds;
+ public void buildStep2()
+ {
+ short tabIndex = 200;
+
+ lblContentTitle = insertLabel("lblContentTitle",
+ PROPNAMES_TITLE,
+ new Object[]
+ {
+ fontDescriptor4, INTEGER_16, resources.reslblContentTitle_value, Boolean.TRUE, "lblContentTitle", new Integer(91), INTEGERS[8], INTEGERS[2], new Short(tabIndex++), new Integer(232)
+ });
+ lblSiteContent = insertLabel("lblSiteContent",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSiteContent_value, "lblSiteContent", new Integer(97), new Integer(28), INTEGERS[2], new Short(tabIndex++), new Integer(105)
+ });
+ lstDocuments = insertListBox("lstDocuments", null, null,
+ new String[]
+ {
+ "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(123), "HID:" + HID2_LST_DOCS, new Short((short) 9), "lstDocuments", new Integer(97), new Integer(38), INTEGERS[2], new Short(tabIndex++), new Integer(103)
+ });
+ btnAddDoc = insertButton("btnAddDoc", BTNADDDOC_ACTION_PERFORMED,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID2_BTN_ADD_DOC, resources.resbtnAddDoc_value, "btnAddDoc", new Integer(97), new Integer(165), INTEGERS[2], new Short(tabIndex++), INTEGER_50
+ });
+ btnRemoveDoc = insertButton("btnRemoveDoc", BTNREMOVEDOC_ACTION_PERFORMED,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID2_BTN_REM_DOC, resources.resbtnRemoveDoc_value, "btnRemoveDoc", new Integer(150), new Integer(165), INTEGERS[2], new Short(tabIndex++), INTEGER_50
+ });
+ btnDocUp = insertButton("btnDocUp", BTNDOCUP_ACTION_PERFORMED,
+ new String[]
+ {
+ "FontDescriptor", "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor7, INTEGER_14, "HID:" + HID2_BTN_DOC_UP, resources.resbtnDocUp_value, "btnDocUp", new Integer(205), new Integer(87), INTEGERS[2], new Short(tabIndex++), new Integer(18)
+ });
+ btnDocDown = insertButton("btnDocDown", BTNDOCDOWN_ACTION_PERFORMED,
+ new String[]
+ {
+ "FontDescriptor", "Height", "HelpURL", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ fontDescriptor7, INTEGER_14, "HID:" + HID2_BTN_DOC_DOWN, resources.resbtnDocDown_value, "btnDocDown", new Integer(205), new Integer(105), INTEGERS[2], new Short(tabIndex++), new Integer(18)
+ });
+
+ lblDocExportFormat = insertLabel("lblDocExportFormat",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblDocExportFormat_value, "lblDocExportFormat", new Integer(235), new Integer(28), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ });
+ lstDocTargetType = insertListBox("lstDocTargetType", null, null,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + HID2_LST_DOC_EXPORT, new Short((short) 7), "lstDocTargetType", new Integer(235), new Integer(38), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ });
+
+
+
+
+ lnDocsInfo = insertFixedLine("lnDocsInfo",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslnDocsInfo_value, "lnDocsInfo", new Integer(235), new Integer(66), INTEGERS[2], new Short(tabIndex++), new Integer(90)
+ });
+ lblDocTitle = insertLabel("lblDocTitle",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblDocTitle_value, "lblDocTitle", new Integer(235), new Integer(78), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ });
+ txtDocTitle = insertTextField("txtDocTitle", null,
+ PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID2_TXT_DOC_TITLE, "txtDocTitle", new Integer(235), new Integer(88), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ });
+ lblDocInfo = insertLabel("lblDocInfo",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblDocInfo_value, "lblDocInfo", new Integer(235), new Integer(103), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ });
+ txtDocInfo = insertTextField("txtDocInfo", null,
+ new String[]
+ {
+ "Height", "HelpURL", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_40, "HID:" + HID2_TXT_DOC_DESC, Boolean.TRUE, "txtDocInfo", new Integer(235), new Integer(113), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ });
+ lblDocAuthor = insertLabel("lblDocAuthor",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblDocAuthor_value, "lblDocAuthor", new Integer(235), new Integer(155), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ });
+ txtDocAuthor = insertTextField("txtDocAuthor", null,
+ PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID2_TXT_DOC_AUTHOR, "txtDocAuthor", new Integer(235), new Integer(165), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ });
}
- public String render(Object listItem) {
- return listItem==null ? "" : ((CGLayout)listItem).cp_Name;
+ public void buildStep3()
+ {
+ lblLayoutTitle = insertLabel("lblLayoutTitle",
+ PROPNAMES_TITLE,
+ new Object[]
+ {
+ fontDescriptor4, INTEGER_16, resources.reslblLayoutTitle_value, Boolean.TRUE, "lblLayoutTitle", new Integer(91), INTEGERS[8], INTEGERS[3], new Short((short) 29), new Integer(232)
+ });
+ lblLayouts = insertLabel("lblLayouts",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblLayouts_value, "lblLayouts", new Integer(97), new Integer(28), INTEGERS[3], new Short((short) 30), new Integer(206)
+ });
+
}
- }
+ public void buildStep4()
+ {
+ lblLayout2Title = insertLabel("lblLayout2Title",
+ PROPNAMES_TITLE,
+ new Object[]
+ {
+ fontDescriptor4, INTEGER_16, resources.reslblLayout2Title_value, Boolean.TRUE, "lblLayout2Title", new Integer(91), INTEGERS[8], INTEGERS[4], new Short((short) 33), new Integer(232)
+ });
+ lnDisplay = insertLabel("lblDisplay",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_16, resources.reslblDisplay_value, Boolean.TRUE, "lblDisplay", new Integer(97), new Integer(28), INTEGERS[4], new Short((short) 34), new Integer(226)
+ });
+ chkDocFilename = insertCheckBox("chkDocFilename", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_FILENAME, resources.reschkDocFilename_value, "chkDocFilename", new Integer(103), new Integer(50), new Short((short) 0), INTEGERS[4], new Short((short) 35), new Integer(99)
+ });
+ chbDocDesc = insertCheckBox("chbDocDesc", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_DESCRIPTION, resources.reschbDocDesc_value, "chbDocDesc", new Integer(103), new Integer(60), new Short((short) 0), INTEGERS[4], new Short((short) 36), new Integer(99)
+ });
+ chbDocAuthor = insertCheckBox("chbDocAuthor", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_AUTHOR, resources.reschbDocAuthor_value, "chbDocAuthor", new Integer(103), new Integer(70), new Short((short) 0), INTEGERS[4], new Short((short) 37), new Integer(99)
+ });
+ chkDocCreated = insertCheckBox("chkDocCreated", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_CR_DATE, resources.reschkDocCreated_value, "chkDocCreated", new Integer(103), new Integer(80), new Short((short) 0), INTEGERS[4], new Short((short) 38), new Integer(99)
+ });
+ chkDocChanged = insertCheckBox("chkDocChanged", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_UP_DATE, resources.reschkDocChanged_value, "chkDocChanged", new Integer(103), new Integer(90), new Short((short) 0), INTEGERS[4], new Short((short) 39), new Integer(99)
+ });
+
+ chkDocFormat = insertCheckBox("chkDocFormat", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_FORMAT, resources.reschkDocFormat_value, "chkDocFormat", new Integer(200), new Integer(50), new Short((short) 0), INTEGERS[4], new Short((short) 40), new Integer(110)
+ });
+ chkDocFormatIcon = insertCheckBox("chkDocFormatIcon", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_F_ICON, resources.reschkDocFormatIcon_value, "chkDocFormatIcon", new Integer(200), new Integer(60), new Short((short) 0), INTEGERS[4], new Short((short) 41), new Integer(110)
+ });
+ chkDocPages = insertCheckBox("chkDocPages", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_PAGES, resources.reschkDocPages_value, "chkDocPages", new Integer(200), new Integer(70), new Short((short) 0), INTEGERS[4], new Short((short) 42), new Integer(110)
+ });
+ chkDocSize = insertCheckBox("chkDocSize", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID4_CHK_DISPLAY_SIZE, resources.reschkDocSize_value, "chkDocSize", new Integer(200), new Integer(80), new Short((short) 0), INTEGERS[4], new Short((short) 43), new Integer(110)
+ });
+ lblOptimizeFor = insertLabel("lblOptimizeFor",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblOptimizeFor_value, "lblOptimizeFor", new Integer(97), new Integer(113), INTEGERS[4], new Short((short) 44), new Integer(226)
+ });
+ optOptimize640x480 = insertRadioButton("optOptimize640x480", null,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGERS[10], "HID:" + HID4_GRP_OPTIMAIZE_640, resources.resoptOptimize640x480_value, "optOptimize640x480", new Integer(103), new Integer(133), INTEGERS[4], new Short((short) 45), new Integer(44)
+ });
+ optOptimize800x600 = insertRadioButton("optOptimize800x600", null,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGERS[10], "HID:" + HID4_GRP_OPTIMAIZE_800, resources.resoptOptimize800x600_value, "optOptimize800x600", new Integer(103), new Integer(146), INTEGERS[4], new Short((short) 46), new Integer(44)
+ });
+ optOptimize1024x768 = insertRadioButton("optOptimize1024x768", null,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGERS[10], "HID:" + HID4_GRP_OPTIMAIZE_1024, resources.resoptOptimize1024x768_value, "optOptimize1024x768", new Integer(103), new Integer(158), INTEGERS[4], new Short((short) 47), new Integer(44)
+ });
+
+ }
+
+ public void buildStep5()
+ {
+ lblStyleTitle = insertLabel("lblStyleTitle", PROPNAMES_TITLE,
+ new Object[]
+ {
+ fontDescriptor4, INTEGER_16, resources.reslblStyleTitle_value, Boolean.TRUE, "lblStyleTitle", new Integer(91), INTEGERS[8], INTEGERS[5], new Short((short) 50), new Integer(232)
+ });
+
+ lblStyle = insertLabel("lblStyle", PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblStyle_value, "lblStyle", new Integer(97), new Integer(28), INTEGERS[5], new Short((short) 51), new Integer(80)
+ });
+ lstStyles = insertListBox("lstStyles", null, LSTSTYLES_ITEM_CHANGED,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + HID5_LST_STYLES, new Short((short) 7), "lstStyles", new Integer(179), new Integer(26), INTEGERS[5], new Short((short) 52), new Integer(145)
+ });
+
+ insertLabel("lblBackground", PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblBackground, "lblBackground", new Integer(97), new Integer(46), INTEGERS[5], new Short((short) 51), new Integer(70)
+ });
+ txtBackground = insertLabel("txtBackground",
+ new String[]
+ {
+ "Border", "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Short((short) 1), INTEGER_12, resources.resBackgroundNone, "txtBackground", new Integer(179), new Integer(44), INTEGERS[5], new Short((short) 52), new Integer(90)
+ });
+ btnBackgrounds = insertButton("btnBackgrounds", BTNBACKGROUNDS_ACTION_PERFORMED, PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID5_BTN_BACKGND, resources.resBtnChooseBackground, "btnBackgrounds", new Integer(274), new Integer(43), INTEGERS[5], new Short((short) 53), INTEGER_50
+ });
+
+ insertLabel("lblIconset", PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblIconset, "lblIconset", new Integer(97), new Integer(64), INTEGERS[5], new Short((short) 51), new Integer(70)
+ });
+ txtIconset = insertLabel("txtIconset",
+ new String[]
+ {
+ "Border", "Height", "Label", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Short((short) 1), INTEGER_12, resources.resIconsetNone, "txtIconset", new Integer(179), new Integer(62), INTEGERS[5], new Short((short) 52), new Integer(90)
+ });
+ btnIconSets = insertButton("btnIconSets", BTNICONSETS_ACTION_PERFORMED,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID5_BTN_ICONS, resources.resBtnChooseIconset, "btnIconSets", new Integer(274), new Integer(61), INTEGERS[5], new Short((short) 54), INTEGER_50
+ });
+ insertLabel("lblIconsetInfo",
+ new String[]
+ {
+ "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ INTEGER_16, resources.reslblIconSetInfo, Boolean.TRUE, "lblIconsetInfo", new Integer(179), new Integer(78), INTEGERS[5], new Short((short) 51), new Integer(145)
+ });
+
+
+ imgPreview = insertImage("imgPreview",
+ new String[]
+ {
+ "BackgroundColor", "Enabled", "Height", "ImageURL", "Name", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(0), Boolean.FALSE, new Integer(78), "", "imgPreview", new Integer(91), new Integer(100), Boolean.FALSE, INTEGERS[5], new Short((short) 55), new Integer(232)
+ });
+
+ }
+
+ public void buildStep6()
+ {
+ short tabIndex = 60;
+ lblTitleGeneralPage = insertLabel("lblTitleGeneralPage",
+ PROPNAMES_TITLE,
+ new Object[]
+ {
+ fontDescriptor4, INTEGERS[8], resources.reslblTitleGeneralPage_value, Boolean.TRUE, "lblTitleGeneralPage", new Integer(90), INTEGERS[9], INTEGERS[6], new Short(tabIndex++), new Integer(232)
+ });
+ lblSiteTitle = insertLabel("lblSiteTitle",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSiteTitle_value, "lblSiteTitle", new Integer(97), new Integer(28), INTEGERS[6], new Short(tabIndex++), new Integer(80)
+ });
+ txtSiteTitle = insertTextField("txtSiteTitle", null,
+ PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID6_TXT_SITE_TITLE, "txtSiteTitle", new Integer(179), new Integer(26), INTEGERS[6], new Short(tabIndex++), new Integer(145)
+ });
+
+
+ insertFixedLine("FixedLineMetaData",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[9], resources.reslblMetaData, "FixedLineMetaData", new Integer(97), new Integer(56), INTEGERS[6], new Short(tabIndex++), new Integer(228)
+ });
+
+
+ lblSiteDesc = insertLabel("lblSiteDesc",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSiteDesc_value, "lblSiteDesc", new Integer(103), new Integer(72), INTEGERS[6], new Short(tabIndex++), new Integer(80)
+ });
+ txtSiteDesc = insertTextField("txtSiteDesc", null,
+ PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID6_TXT_SITE_DESC, "txtSiteDesc", new Integer(179), new Integer(70), INTEGERS[6], new Short(tabIndex++), new Integer(145)
+ });
+
+ lblEmail = insertLabel("lblEmail", PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblEmail_value, "lblEmail", new Integer(103), new Integer(90), INTEGERS[6], new Short(tabIndex++), new Integer(80)
+ });
+ txtEmail = insertTextField("txtEmail", null, PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID6_TXT_SITE_EMAIL, "txtEmail", new Integer(179), new Integer(87), INTEGERS[6], new Short(tabIndex++), new Integer(145)
+ });
+
+ lblCopyright = insertLabel("lblCopyright", PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblCopyright_value, "lblCopyright", new Integer(103), new Integer(108), INTEGERS[6], new Short(tabIndex++), new Integer(80)
+ });
+ txtCopyright = insertTextField("txtCopyright", null, PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID6_TXT_SITE_COPYRIGHT, "txtCopyright", new Integer(179), new Integer(106), INTEGERS[6], new Short(tabIndex++), new Integer(145)
+ });
+
+
+ lblSiteCreated = insertLabel("lblSiteCreated",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSiteCreated_value, "lblSiteCreated", new Integer(103), new Integer(126), INTEGERS[6], new Short(tabIndex++), new Integer(80)
+ });
+ dateSiteCreated = insertDateField("dateSiteCreated", null,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + HID6_DATE_SITE_CREATED, "dateSiteCreated", new Integer(179), new Integer(124), INTEGERS[6], new Short(tabIndex++), new Integer(49)
+ });
+ lblSiteUpdated = insertLabel("lblSiteUpdated",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSiteUpdated_value, "lblSiteUpdated", new Integer(103), new Integer(144), INTEGERS[6], new Short(tabIndex++), new Integer(80)
+ });
+
+ dateSiteUpdate = insertDateField("dateSiteUpdate", null,
+ new String[]
+ {
+ "Dropdown", "Height", "HelpURL", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, INTEGER_12, "HID:" + HID6_DATE_SITE_UPDATED, "dateSiteUpdate", new Integer(179), new Integer(142), INTEGERS[6], new Short(tabIndex++), new Integer(49)
+ });
+
+
+ }
+
+ public void buildStep7(boolean disableFTP, String exclamationURL)
+ {
+ short tabIndex = 700;
+
+ lblTitlePublish = insertLabel("lblTitlePublish",
+ PROPNAMES_TITLE,
+ new Object[]
+ {
+ fontDescriptor4, INTEGER_16, resources.reslblTitlePublish_value, Boolean.TRUE, "lblTitlePublish", new Integer(91), INTEGERS[8], INTEGERS[7], new Short(tabIndex++), new Integer(232)
+ });
+
+ FixedLine1 = insertFixedLine("FixedLine1",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[9], resources.resFixedLine1_value, "FixedLine1", new Integer(97), new Integer(28), INTEGERS[7], new Short(tabIndex++), new Integer(228)
+ });
+
+ btnPreview = insertButton("btnPreview", BTNPREVIEW_ACTION_PERFORMED,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID7_BTN_PREVIEW, resources.resbtnPreview_value, "btnPreview", new Integer(103), new Integer(40), INTEGERS[7], new Short(tabIndex++), INTEGER_50
+ });
+
+ lblCreateSite = insertFixedLine("lblCreateSite",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[9], resources.reslblCreateSite_value, "lblCreateSite", new Integer(97), new Integer(56), INTEGERS[7], new Short(tabIndex++), new Integer(228)
+ });
+
+ chkLocalDir = insertCheckBox("chkLocalDir", CHKLOCALDIR_ITEM_CHANGED,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID7_CHK_PUBLISH_LOCAL, resources.reschkLocalDir_value, "chkLocalDir", new Integer(103), new Integer(68), new Short((short) 0), INTEGERS[7], new Short(tabIndex++), new Integer(215)
+ });
+ txtLocalDir = insertTextField("txtLocalDir", null,
+ PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID7_TXT_LOCAL, "txtLocalDir", new Integer(113), new Integer(78), INTEGERS[7], new Short(tabIndex++), new Integer(190)
+ });
+ btnLocalDir = insertButton("btnLocalDir", BTNLOCALDIR_ACTION_PERFORMED,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID7_BTN_LOCAL, resources.resbtnLocalDir_value, "btnLocalDir", new Integer(308), new Integer(77), INTEGERS[7], new Short(tabIndex++), INTEGER_16
+ });
+
+ chkZip = insertCheckBox("chkZip", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[9], "HID:" + HID7_CHK_PUBLISH_ZIP, resources.reschkZip_value, "chkZip", new Integer(103), new Integer(96), new Short((short) 0), INTEGERS[7], new Short(tabIndex++), new Integer(215)
+ });
+ txtZip = insertTextField("txtZip", null,
+ PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGER_12, "HID:" + HID7_TXT_ZIP, "txtZip", new Integer(113), new Integer(108), INTEGERS[7], new Short(tabIndex++), new Integer(190)
+ });
+ btnZip = insertButton("btnZip", BTNZIP_ACTION_PERFORMED,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID7_BTN_ZIP, resources.resbtnZip_value, "btnZip", new Integer(308), new Integer(107), INTEGERS[7], new Short(tabIndex++), INTEGER_16
+ });
+
+ chkFTP = insertCheckBox("chkFTP", null,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[8], "HID:" + HID7_CHK_PUBLISH_FTP, resources.reschkFTP_value, "chkFTP", new Integer(103), new Integer(124), new Short((short) 0), INTEGERS[7], new Short(tabIndex++), new Integer(215)
+ });
+
+ Integer FTP_STEP = disableFTP ? new Integer(99) : INTEGERS[7];
+
+ lblFTP = insertLabel("lblFTP",
+ new String[]
+ {
+ "Border", "Height", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Short((short) 1), INTEGER_12, "txtFTP", new Integer(113), new Integer(134), FTP_STEP, new Short(tabIndex++), new Integer(156)
+ });
+
+ btnFTP = insertButton("btnFTP", BTNFTP_ACTION_PERFORMED,
+ PROPNAMES_BUTTON,
+ new Object[]
+ {
+ INTEGER_14, "HID:" + HID7_BTN_FTP, resources.resbtnFTP_value, "btnFTP", new Integer(274), new Integer(133), FTP_STEP, new Short(tabIndex++), INTEGER_50
+ });
+
+ if (disableFTP)
+ {
+
+ insertImage("imgFTPDisabled",
+ new String[]
+ {
+ "BackgroundColor", "Border", "Enabled", "Height", "ImageURL", "Name", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(-1), new Short((short) 0), Boolean.FALSE, new Integer(10), exclamationURL, "imgFTPDisabled", new Integer(115), new Integer(135), Boolean.FALSE, INTEGERS[7], new Short(tabIndex++), new Integer(8)
+ });
+ insertLabel("lblFTPDisabled",
+ new String[]
+ {
+ "BackgroundColor", "Height", "Label", "MultiLine", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ new Integer(-1), INTEGER_8, resources.reslblFTPDisabled, Boolean.TRUE, "lblFTPDisabled", new Integer(125), new Integer(136), INTEGERS[7], new Short(tabIndex++), new Integer(226)
+ });
+ //FTP_STEP = new Integer(99);
+ }
+ //else
+
+ lnSaveSetting = insertFixedLine("lnSaveSetting",
+ PROPNAMES_TXT,
+ new Object[]
+ {
+ INTEGERS[2], "", "lnSaveSetting", new Integer(97), new Integer(151), INTEGERS[7], new Short(tabIndex++), new Integer(228)
+ });
+ chkSaveSettings = insertCheckBox("chkSaveSettings", CHKSAVESETTINGS_ITEM_CHANGED,
+ PROPNAMES_CHKBOX,
+ new Object[]
+ {
+ INTEGERS[9], "HID:" + HID7_CHK_SAVE, resources.reschkSaveSettings_value, "chkSaveSettings", new Integer(97), new Integer(157), new Short((short) 1), INTEGERS[7], new Short(tabIndex++), new Integer(215)
+ });
+ lblSaveSettings = insertLabel("lblSaveSettings",
+ PROPNAMES_LBL,
+ new Object[]
+ {
+ INTEGERS[8], resources.reslblSaveSettings_value, "lblSaveSettings", new Integer(107), new Integer(169), INTEGERS[7], new Short(tabIndex++), new Integer(45)
+ });
+ cbSaveSettings = insertComboBox("txtSaveSettings", TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED,
+ new String[]
+ {
+ "Autocomplete", "Dropdown", "Height", "HelpURL", "LineCount", "Name", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE, Boolean.TRUE, INTEGER_12, "HID:" + HID7_TXT_SAVE, new Short((short) 7), "txtSaveSettings", new Integer(179), new Integer(167), INTEGERS[7], new Short(tabIndex++), new Integer(145)
+ });
+
+ }
+ XControl[] imgIconsPrev = new XControl[8];
+ ImageList ilLayouts;
+
+ /**
+ * builds the layouts image list.
+ */
+ public void buildStepX()
+ {
+ ilLayouts = new ImageList();
+ ilLayouts.setPos(new Size(97, 38));
+ ilLayouts.setImageSize(new Size(34, 30));
+ ilLayouts.setCols(5);
+ ilLayouts.setRows(3);
+ ilLayouts.setStep(new Short((short) 3));
+ ilLayouts.setShowButtons(false);
+ ilLayouts.setRenderer(new LayoutRenderer());
+ ilLayouts.scaleImages = Boolean.FALSE;
+ ilLayouts.tabIndex = 31;
+ ilLayouts.helpURL = HID3_IL_LAYOUTS_IMG1;
+
+ /*for (int i = 0; i<8; i++)
+ imgIconsPrev[i] = insertImage("imgIconPrev" + i,
+ new String[] { "BackgroundColor","Border","Height","ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "Tabstop", "Width"},
+ new Object[] { new Integer(-1), new Short((short)0),new Integer(14),"file:///c:/bludisk.gif", new Integer(97 + i * 20 + 7 ),new Integer(147),Boolean.FALSE,INTEGERS[5],Boolean.FALSE,new Integer(14)});
+ */
+ }
+
+ /**
+ * renders the images and titles of
+ * the layouts
+ * @author rpiterman
+
+ */
+ private class LayoutRenderer implements ImageList.ImageRenderer
+ {
+
+ public Object[] getImageUrls(Object listItem)
+ {
+ Object[] oResIds = null;
+ if (listItem != null)
+ {
+ oResIds = ((CGLayout) listItem).getImageUrls();
+ }
+ return oResIds;
+ }
+
+ public String render(Object listItem)
+ {
+ return listItem == null ? "" : ((CGLayout) listItem).cp_Name;
+ }
+ }
}
diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java b/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java
index cf2a41d09e13..f6087fca4edf 100644
--- a/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java
+++ b/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java
@@ -1,3 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WebWizardDialogResources.java,v $
+ *
+ * $Revision: 1.6.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
package com.sun.star.wizards.web;
import com.sun.star.lang.XMultiServiceFactory;
@@ -7,7 +38,8 @@ import com.sun.star.wizards.common.Properties;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.document.OfficeDocument;
-public class WebWizardDialogResources{
+public class WebWizardDialogResources
+{
String resSessionName;
String resSizeTemplate;
@@ -25,7 +57,6 @@ public class WebWizardDialogResources{
String resStep5;
String resStep6;
String resStep7;
-
String resDefaultArchiveFilename;
String resValidatingDocuments;
String resErrUnexpected;
@@ -47,7 +78,6 @@ public class WebWizardDialogResources{
final static int RID_WEBWIZARDDIALOG_START = 4000;
final static int RID_COMMON_START = 500;
final static int RID_DB_COMMON_START = 1000;
-
String resWebWizardDialog_title;
String reslblIntroduction_value;
String resbtnDelSession_value;
@@ -100,37 +130,27 @@ public class WebWizardDialogResources{
String resoptOptimize640x480_value;
String resoptOptimize800x600_value;
String resoptOptimize1024x768_value;
-
final String resbtnDocUp_value = String.valueOf((char) 8743);
final String resbtnDocDown_value = String.valueOf((char) 8744);
-
String reslblBackground;
String reslblIconset;
String reslblIconSetInfo;
String reslblMetaData;
String resBtnChooseBackground;
- String resBtnChooseIconset;
-
-
- //String resGenerate;
+ String resBtnChooseIconset; //String resGenerate;
//String resPublish;
//String resExport;
-
String resCancel;
String resClose;
String resCounter;
String resStatusDialogTitle;
-
String resPublishDir;
-
String resFTPTargetExistsAsfile;
String resLocalTargetExistsAsfile;
-
String resZipTargetExists;
String resFTPTargetNotEmpty;
String resLocalTragetNotEmpty;
String resSessionExists;
-
String resTaskExport;
String resTaskExportDocs;
String resTaskExportPrepare;
@@ -143,35 +163,26 @@ public class WebWizardDialogResources{
String resTaskPublishFTP;
String resTaskPublishZip;
String resTaskFinish;
-
String resPages;
-
String resImages;
String resAllFiles;
String resZipFiles;
String resGifFiles;
-
String resOK;
String resHelp;
-
String resBackgroundsDialog;
String resBackgroundsDialogCaption;
-
String resIconsDialog;
String resIconsDialogCaption;
-
String resOther;
String resDeselect;
-
String resFinishedSuccess;
String resFinishedNoSuccess;
-
String resSessionNameNone;
String reslblFTPDisabled;
String resBackgroundNone;
String resIconsetNone;
String prodName;
-
String resFTPTargetCouldNotCreate;
String resFTPTargetCreate;
String resZipTargetIsDir;
@@ -179,159 +190,163 @@ public class WebWizardDialogResources{
String resLocalTargetCreate;
Resource oResource;
- public WebWizardDialogResources(XMultiServiceFactory xmsf, Resource _oResource) {
+ public WebWizardDialogResources(XMultiServiceFactory xmsf, Resource _oResource)
+ {
oResource = _oResource;
/**
* Delete the String, uncomment the getResText method
*
*/
- resWebWizardDialog_title = oResource.getResText(RID_WEBWIZARDDIALOG_START + 1);
- reslblIntroduction_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 2);
- resbtnDelSession_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 4);
- reslbIntroTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 5);
- reslblContentTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 6);
- reslnDocsInfo_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 8);
- reslblDocTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 9);
- reslblDocInfo_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 10);
- reslblDocAuthor_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 11);
- reslblDocExportFormat_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 12);
- reslblTitleGeneralPage_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 13);
- reslblSiteTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 14);
- reslblSiteDesc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 16);
- reslblSiteCreated_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 18);
- reslblEmail_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 20);
- reslblCopyright_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 21);
- reslblSiteUpdated_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 22);
- resbtnPreview_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 24);
- reslblTitlePublish_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 25);
- reslblCreateSite_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 26);
- reschkLocalDir_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 27);
- resbtnLocalDir_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 28);
- reschkFTP_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 29);
+ resWebWizardDialog_title = oResource.getResText(RID_WEBWIZARDDIALOG_START + 1);
+ reslblIntroduction_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 2);
+ resbtnDelSession_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 4);
+ reslbIntroTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 5);
+ reslblContentTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 6);
+ reslnDocsInfo_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 8);
+ reslblDocTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 9);
+ reslblDocInfo_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 10);
+ reslblDocAuthor_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 11);
+ reslblDocExportFormat_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 12);
+ reslblTitleGeneralPage_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 13);
+ reslblSiteTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 14);
+ reslblSiteDesc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 16);
+ reslblSiteCreated_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 18);
+ reslblEmail_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 20);
+ reslblCopyright_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 21);
+ reslblSiteUpdated_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 22);
+ resbtnPreview_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 24);
+ reslblTitlePublish_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 25);
+ reslblCreateSite_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 26);
+ reschkLocalDir_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 27);
+ resbtnLocalDir_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 28);
+ reschkFTP_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 29);
//
- resbtnFTP_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 31);
- reschkZip_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 32);
- resbtnZip_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 33);
- reschkSaveSettings_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 34);
- reslblSaveSettings_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 35);
- reslblLoadSettings_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 36);
- reslblSiteContent_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 37);
- resbtnAddDoc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 38);
- resbtnRemoveDoc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 39);
- reslblLayoutTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 40);
- reslblStyleTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 41);
- reslblStyle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 42);
+ resbtnFTP_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 31);
+ reschkZip_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 32);
+ resbtnZip_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 33);
+ reschkSaveSettings_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 34);
+ reslblSaveSettings_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 35);
+ reslblLoadSettings_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 36);
+ reslblSiteContent_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 37);
+ resbtnAddDoc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 38);
+ resbtnRemoveDoc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 39);
+ reslblLayoutTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 40);
+ reslblStyleTitle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 41);
+ reslblStyle_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 42);
//
- reslblLayouts_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 48);
+ reslblLayouts_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 48);
//
- reschbDocDesc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 50);
- reschbDocAuthor_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 51);
- reschkDocCreated_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 52);
- reschkDocChanged_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 53);
- reschkDocFilename_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 54);
- reschkDocFormat_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 55);
- reschkDocFormatIcon_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 56);
- reschkDocPages_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 57);
- reschkDocSize_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 58);
- resFixedLine1_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 59);
- reslblLayout2Title_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 60);
- reslblDisplay_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 61);
- reslblOptimizeFor_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 62);
- resoptOptimize640x480_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 64);
- resoptOptimize800x600_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 65);
- resoptOptimize1024x768_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 66);
+ reschbDocDesc_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 50);
+ reschbDocAuthor_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 51);
+ reschkDocCreated_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 52);
+ reschkDocChanged_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 53);
+ reschkDocFilename_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 54);
+ reschkDocFormat_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 55);
+ reschkDocFormatIcon_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 56);
+ reschkDocPages_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 57);
+ reschkDocSize_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 58);
+ resFixedLine1_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 59);
+ reslblLayout2Title_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 60);
+ reslblDisplay_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 61);
+ reslblOptimizeFor_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 62);
+ resoptOptimize640x480_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 64);
+ resoptOptimize800x600_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 65);
+ resoptOptimize1024x768_value = oResource.getResText(RID_WEBWIZARDDIALOG_START + 66);
//resExport = oResource.getResText(RID_WEBWIZARDDIALOG_START + 67);
//resGenerate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 68);
//resPublish = oResource.getResText(RID_WEBWIZARDDIALOG_START + 69);
- resStatusDialogTitle = oResource.getResText(RID_WEBWIZARDDIALOG_START + 70);
- resCounter = oResource.getResText(RID_WEBWIZARDDIALOG_START + 71);
- resPublishDir = oResource.getResText(RID_WEBWIZARDDIALOG_START + 72);
- resFTPTargetExistsAsfile = oResource.getResText(RID_WEBWIZARDDIALOG_START + 73);
- resLocalTargetExistsAsfile = oResource.getResText(RID_WEBWIZARDDIALOG_START + 74);
- resZipTargetExists = oResource.getResText(RID_WEBWIZARDDIALOG_START + 75);
- resFTPTargetNotEmpty = oResource.getResText(RID_WEBWIZARDDIALOG_START + 76);
- resLocalTragetNotEmpty = oResource.getResText(RID_WEBWIZARDDIALOG_START + 77);
- resSessionExists = oResource.getResText(RID_WEBWIZARDDIALOG_START + 78);
- resTaskExportDocs = oResource.getResText(RID_WEBWIZARDDIALOG_START + 79);
- resTaskExportPrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 80);
- resTaskGenerateCopy = oResource.getResText(RID_WEBWIZARDDIALOG_START + 81);
- resTaskGeneratePrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 82);
- resTaskGenerateXsl = oResource.getResText(RID_WEBWIZARDDIALOG_START + 83);
- resTaskPrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 84);
- resTaskPublishPrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 86);
- resTaskPublishLocal = oResource.getResText(RID_WEBWIZARDDIALOG_START + 87);
- resTaskPublishFTP = oResource.getResText(RID_WEBWIZARDDIALOG_START + 88);
- resTaskPublishZip = oResource.getResText(RID_WEBWIZARDDIALOG_START + 89);
- resTaskFinish = oResource.getResText(RID_WEBWIZARDDIALOG_START + 90);
+ resStatusDialogTitle = oResource.getResText(RID_WEBWIZARDDIALOG_START + 70);
+ resCounter = oResource.getResText(RID_WEBWIZARDDIALOG_START + 71);
+ resPublishDir = oResource.getResText(RID_WEBWIZARDDIALOG_START + 72);
+ resFTPTargetExistsAsfile = oResource.getResText(RID_WEBWIZARDDIALOG_START + 73);
+ resLocalTargetExistsAsfile = oResource.getResText(RID_WEBWIZARDDIALOG_START + 74);
+ resZipTargetExists = oResource.getResText(RID_WEBWIZARDDIALOG_START + 75);
+ resFTPTargetNotEmpty = oResource.getResText(RID_WEBWIZARDDIALOG_START + 76);
+ resLocalTragetNotEmpty = oResource.getResText(RID_WEBWIZARDDIALOG_START + 77);
+ resSessionExists = oResource.getResText(RID_WEBWIZARDDIALOG_START + 78);
+ resTaskExportDocs = oResource.getResText(RID_WEBWIZARDDIALOG_START + 79);
+ resTaskExportPrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 80);
+ resTaskGenerateCopy = oResource.getResText(RID_WEBWIZARDDIALOG_START + 81);
+ resTaskGeneratePrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 82);
+ resTaskGenerateXsl = oResource.getResText(RID_WEBWIZARDDIALOG_START + 83);
+ resTaskPrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 84);
+ resTaskPublishPrepare = oResource.getResText(RID_WEBWIZARDDIALOG_START + 86);
+ resTaskPublishLocal = oResource.getResText(RID_WEBWIZARDDIALOG_START + 87);
+ resTaskPublishFTP = oResource.getResText(RID_WEBWIZARDDIALOG_START + 88);
+ resTaskPublishZip = oResource.getResText(RID_WEBWIZARDDIALOG_START + 89);
+ resTaskFinish = oResource.getResText(RID_WEBWIZARDDIALOG_START + 90);
//resPages = oResource.getResText(RID_WEBWIZARDDIALOG_START + 91);
- resImages = oResource.getResText(RID_WEBWIZARDDIALOG_START + 94);
- resAllFiles = oResource.getResText(RID_WEBWIZARDDIALOG_START + 95);
- resZipFiles = oResource.getResText(RID_WEBWIZARDDIALOG_START + 96);
- resBackgroundsDialog = oResource.getResText(RID_WEBWIZARDDIALOG_START + 98);
- resBackgroundsDialogCaption = oResource.getResText(RID_WEBWIZARDDIALOG_START + 99);
- resIconsDialog = oResource.getResText(RID_WEBWIZARDDIALOG_START + 100);
- resIconsDialogCaption = oResource.getResText(RID_WEBWIZARDDIALOG_START + 101);
- resOther = oResource.getResText(RID_WEBWIZARDDIALOG_START + 102);
- resDeselect = oResource.getResText(RID_WEBWIZARDDIALOG_START + 103);
- resFinishedSuccess = oResource.getResText(RID_WEBWIZARDDIALOG_START + 104);
- resFinishedNoSuccess = oResource.getResText(RID_WEBWIZARDDIALOG_START + 105);
- resErrTOC = oResource.getResText(RID_WEBWIZARDDIALOG_START + 106);
- resErrTOCMedia = oResource.getResText(RID_WEBWIZARDDIALOG_START + 107);
- resErrDocInfo = oResource.getResText(RID_WEBWIZARDDIALOG_START + 108);
- resErrDocExport = oResource.getResText(RID_WEBWIZARDDIALOG_START + 109);
- resErrMkDir = oResource.getResText(RID_WEBWIZARDDIALOG_START + 110);
- resErrSecurity = oResource.getResText(RID_WEBWIZARDDIALOG_START + 111);
- resErrExportIO = oResource.getResText(RID_WEBWIZARDDIALOG_START + 112);
- resErrPublishMedia = oResource.getResText(RID_WEBWIZARDDIALOG_START + 113);
- resErrPublish = oResource.getResText(RID_WEBWIZARDDIALOG_START + 114);
- resErrUnknown = oResource.getResText(RID_WEBWIZARDDIALOG_START + 115);
- resErrDocValidate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 116);
- resErrIsDirectory = oResource.getResText(RID_WEBWIZARDDIALOG_START + 117);
- resLoadingSession = oResource.getResText(RID_WEBWIZARDDIALOG_START + 118);
- resErrUnexpected = oResource.getResText(RID_WEBWIZARDDIALOG_START + 119);
- resValidatingDocuments = oResource.getResText(RID_WEBWIZARDDIALOG_START + 120);
- resDefaultArchiveFilename = oResource.getResText(RID_WEBWIZARDDIALOG_START + 121);
- resStep1 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 122);
- resStep2 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 123);
- resStep3 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 124);
- resStep4 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 125);
- resStep5 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 126);
- resStep6 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 127);
- resStep7 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 128);
- resDelSessionConfirm = oResource.getResText(RID_WEBWIZARDDIALOG_START + 130);
- resPages = oResource.getResText(RID_WEBWIZARDDIALOG_START + 131);
- resSlides = oResource.getResText(RID_WEBWIZARDDIALOG_START + 132);
- resCreatedTemplate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 133);
- resUpdatedTemplate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 134);
- resSessionName = oResource.getResText(RID_WEBWIZARDDIALOG_START + 135);
+ resImages = oResource.getResText(RID_WEBWIZARDDIALOG_START + 94);
+ resAllFiles = oResource.getResText(RID_WEBWIZARDDIALOG_START + 95);
+ resZipFiles = oResource.getResText(RID_WEBWIZARDDIALOG_START + 96);
+ resBackgroundsDialog = oResource.getResText(RID_WEBWIZARDDIALOG_START + 98);
+ resBackgroundsDialogCaption = oResource.getResText(RID_WEBWIZARDDIALOG_START + 99);
+ resIconsDialog = oResource.getResText(RID_WEBWIZARDDIALOG_START + 100);
+ resIconsDialogCaption = oResource.getResText(RID_WEBWIZARDDIALOG_START + 101);
+ resOther = oResource.getResText(RID_WEBWIZARDDIALOG_START + 102);
+ resDeselect = oResource.getResText(RID_WEBWIZARDDIALOG_START + 103);
+ resFinishedSuccess = oResource.getResText(RID_WEBWIZARDDIALOG_START + 104);
+ resFinishedNoSuccess = oResource.getResText(RID_WEBWIZARDDIALOG_START + 105);
+ resErrTOC = oResource.getResText(RID_WEBWIZARDDIALOG_START + 106);
+ resErrTOCMedia = oResource.getResText(RID_WEBWIZARDDIALOG_START + 107);
+ resErrDocInfo = oResource.getResText(RID_WEBWIZARDDIALOG_START + 108);
+ resErrDocExport = oResource.getResText(RID_WEBWIZARDDIALOG_START + 109);
+ resErrMkDir = oResource.getResText(RID_WEBWIZARDDIALOG_START + 110);
+ resErrSecurity = oResource.getResText(RID_WEBWIZARDDIALOG_START + 111);
+ resErrExportIO = oResource.getResText(RID_WEBWIZARDDIALOG_START + 112);
+ resErrPublishMedia = oResource.getResText(RID_WEBWIZARDDIALOG_START + 113);
+ resErrPublish = oResource.getResText(RID_WEBWIZARDDIALOG_START + 114);
+ resErrUnknown = oResource.getResText(RID_WEBWIZARDDIALOG_START + 115);
+ resErrDocValidate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 116);
+ resErrIsDirectory = oResource.getResText(RID_WEBWIZARDDIALOG_START + 117);
+ resLoadingSession = oResource.getResText(RID_WEBWIZARDDIALOG_START + 118);
+ resErrUnexpected = oResource.getResText(RID_WEBWIZARDDIALOG_START + 119);
+ resValidatingDocuments = oResource.getResText(RID_WEBWIZARDDIALOG_START + 120);
+ resDefaultArchiveFilename = oResource.getResText(RID_WEBWIZARDDIALOG_START + 121);
+ resStep1 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 122);
+ resStep2 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 123);
+ resStep3 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 124);
+ resStep4 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 125);
+ resStep5 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 126);
+ resStep6 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 127);
+ resStep7 = oResource.getResText(RID_WEBWIZARDDIALOG_START + 128);
+ resDelSessionConfirm = oResource.getResText(RID_WEBWIZARDDIALOG_START + 130);
+ resPages = oResource.getResText(RID_WEBWIZARDDIALOG_START + 131);
+ resSlides = oResource.getResText(RID_WEBWIZARDDIALOG_START + 132);
+ resCreatedTemplate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 133);
+ resUpdatedTemplate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 134);
+ resSessionName = oResource.getResText(RID_WEBWIZARDDIALOG_START + 135);
- reslblBackground = oResource.getResText(RID_WEBWIZARDDIALOG_START + 136);
- reslblIconset = oResource.getResText(RID_WEBWIZARDDIALOG_START + 137);
- reslblIconSetInfo = oResource.getResText(RID_WEBWIZARDDIALOG_START + 138);
- reslblMetaData = oResource.getResText(RID_WEBWIZARDDIALOG_START + 139);
- resBtnChooseBackground = oResource.getResText(RID_WEBWIZARDDIALOG_START + 140);
- resBtnChooseIconset = oResource.getResText(RID_WEBWIZARDDIALOG_START + 141);
- resSessionNameNone = oResource.getResText(RID_WEBWIZARDDIALOG_START + 142);
- reslblFTPDisabled = oResource.getResText(RID_WEBWIZARDDIALOG_START + 143);
- resBackgroundNone = oResource.getResText(RID_WEBWIZARDDIALOG_START + 144);
- resIconsetNone = oResource.getResText(RID_WEBWIZARDDIALOG_START + 145);
- resFTPTargetCouldNotCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 146);
- resFTPTargetCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 147);
- resZipTargetIsDir = oResource.getResText(RID_WEBWIZARDDIALOG_START + 148);
- resLocalTargetCouldNotCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 149);
- resLocalTargetCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 150);
- resSizeTemplate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 151);
- resSpecifyNewFileLocation = oResource.getResText(RID_WEBWIZARDDIALOG_START + 152);
+ reslblBackground = oResource.getResText(RID_WEBWIZARDDIALOG_START + 136);
+ reslblIconset = oResource.getResText(RID_WEBWIZARDDIALOG_START + 137);
+ reslblIconSetInfo = oResource.getResText(RID_WEBWIZARDDIALOG_START + 138);
+ reslblMetaData = oResource.getResText(RID_WEBWIZARDDIALOG_START + 139);
+ resBtnChooseBackground = oResource.getResText(RID_WEBWIZARDDIALOG_START + 140);
+ resBtnChooseIconset = oResource.getResText(RID_WEBWIZARDDIALOG_START + 141);
+ resSessionNameNone = oResource.getResText(RID_WEBWIZARDDIALOG_START + 142);
+ reslblFTPDisabled = oResource.getResText(RID_WEBWIZARDDIALOG_START + 143);
+ resBackgroundNone = oResource.getResText(RID_WEBWIZARDDIALOG_START + 144);
+ resIconsetNone = oResource.getResText(RID_WEBWIZARDDIALOG_START + 145);
+ resFTPTargetCouldNotCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 146);
+ resFTPTargetCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 147);
+ resZipTargetIsDir = oResource.getResText(RID_WEBWIZARDDIALOG_START + 148);
+ resLocalTargetCouldNotCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 149);
+ resLocalTargetCreate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 150);
+ resSizeTemplate = oResource.getResText(RID_WEBWIZARDDIALOG_START + 151);
+ resSpecifyNewFileLocation = oResource.getResText(RID_WEBWIZARDDIALOG_START + 152);
- resClose = oResource.getResText(RID_COMMON_START + 17);
- resCancel = oResource.getResText(RID_COMMON_START + 11);
- resOK = oResource.getResText(RID_COMMON_START + 18);
- resHelp = oResource.getResText(RID_COMMON_START + 15);
+ resClose = oResource.getResText(RID_COMMON_START + 17);
+ resCancel = oResource.getResText(RID_COMMON_START + 11);
+ resOK = oResource.getResText(RID_COMMON_START + 18);
+ resHelp = oResource.getResText(RID_COMMON_START + 15);
- try {
- prodName = Configuration.getProductName(xmsf);
- resGifFiles = (String) Properties.getPropertyValue(OfficeDocument.getTypeMediaDescriptor(xmsf, "gif_Graphics_Interchange"), "UIName");
- } catch (Exception ex) {
+ try
+ {
+ prodName = Configuration.getProductName(xmsf);
+ resGifFiles = (String) Properties.getPropertyValue(OfficeDocument.getTypeMediaDescriptor(xmsf, "gif_Graphics_Interchange"), "UIName");
+ }
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGArgument.java b/wizards/com/sun/star/wizards/web/data/CGArgument.java
index a7d64637a864..7797dc29e934 100644
--- a/wizards/com/sun/star/wizards/web/data/CGArgument.java
+++ b/wizards/com/sun/star/wizards/web/data/CGArgument.java
@@ -26,10 +26,13 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.ConfigGroup;
-public class CGArgument extends ConfigGroup {
+public class CGArgument extends ConfigGroup
+{
+
public String cp_Value;
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGContent.java b/wizards/com/sun/star/wizards/web/data/CGContent.java
index b99b03adc8db..fdd58da3f737 100644
--- a/wizards/com/sun/star/wizards/web/data/CGContent.java
+++ b/wizards/com/sun/star/wizards/web/data/CGContent.java
@@ -26,42 +26,46 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.*;
import org.w3c.dom.*;
-public class CGContent extends ConfigSetItem implements XMLProvider {
- public String dirName;
+public class CGContent extends ConfigSetItem implements XMLProvider
+{
- public String cp_Name;
- public String cp_Description;
+ public String dirName;
+ public String cp_Name;
+ public String cp_Description;
+ public ConfigSet cp_Contents = new ConfigSet(CGContent.class);
+ public ConfigSet cp_Documents = new ConfigSet(CGDocument.class);
- public ConfigSet cp_Contents = new ConfigSet(CGContent.class);
-
-
- public ConfigSet cp_Documents = new ConfigSet(CGDocument.class);
-
- public CGContent() {
- /*cp_Documents = new ConfigSet(CGDocument.class) {
+ public CGContent()
+ {
+ /*cp_Documents = new ConfigSet(CGDocument.class) {
protected DefaultListModel createChildrenList() {
- return cp_Contents.getChildrenList();
+ return cp_Contents.getChildrenList();
}
- };*/
-
- }
-
- public Node createDOM(Node parent) {
+ };*/
+ }
- Node myElement = XMLHelper.addElement(parent,"content",
- new String[] {"name","directory-name","description","directory"},
- new String[] {cp_Name,dirName, cp_Description,dirName}
- );
+ public Node createDOM(Node parent)
+ {
- cp_Documents.createDOM(myElement);
+ Node myElement = XMLHelper.addElement(parent, "content",
+ new String[]
+ {
+ "name", "directory-name", "description", "directory"
+ },
+ new String[]
+ {
+ cp_Name, dirName, cp_Description, dirName
+ });
- return myElement;
- }
+ cp_Documents.createDOM(myElement);
+ return myElement;
+ }
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGDesign.java b/wizards/com/sun/star/wizards/web/data/CGDesign.java
index 384c3cc9e142..856340fdfddf 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDesign.java
+++ b/wizards/com/sun/star/wizards/web/data/CGDesign.java
@@ -32,65 +32,63 @@ package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.*;
import org.w3c.dom.Node;
+public class CGDesign extends ConfigGroup implements XMLProvider
+{
+
+ public String cp_Layout;
+ public String cp_Style;
+ public String cp_BackgroundImage;
+ public String cp_IconSet;
+ //public int cp_OptimizeDisplay;
+ public boolean cp_DisplayTitle;
+ public boolean cp_DisplayDescription;
+ public boolean cp_DisplayAuthor;
+ public boolean cp_DisplayCreateDate;
+ public boolean cp_DisplayUpdateDate;
+ public boolean cp_DisplayFilename;
+ public boolean cp_DisplayFileFormat;
+ public boolean cp_DisplayFormatIcon;
+ public boolean cp_DisplayPages;
+ public boolean cp_DisplaySize;
+ public int cp_OptimizeDisplaySize;
+ private final String TRUE = "true";
+ private final String FALSE = null;
+ private String styleName;
+
+ public Node createDOM(Node parent)
+ {
+ return XMLHelper.addElement(parent, "design", new String[0],
+ new String[0]);
-public class CGDesign extends ConfigGroup implements XMLProvider {
-
- public String cp_Layout;
- public String cp_Style;
- public String cp_BackgroundImage;
- public String cp_IconSet;
- //public int cp_OptimizeDisplay;
-
- public boolean cp_DisplayTitle;
- public boolean cp_DisplayDescription;
- public boolean cp_DisplayAuthor;
- public boolean cp_DisplayCreateDate;
- public boolean cp_DisplayUpdateDate;
- public boolean cp_DisplayFilename;
- public boolean cp_DisplayFileFormat;
- public boolean cp_DisplayFormatIcon;
- public boolean cp_DisplayPages;
- public boolean cp_DisplaySize;
- public int cp_OptimizeDisplaySize;
-
-
-
- private final String TRUE = "true";
- private final String FALSE = null;
-
- private String styleName;
-
-
- public Node createDOM(Node parent) {
- return XMLHelper.addElement(parent, "design", new String[0] ,
- new String[0]
- );
-
- }
-
- private static final Short SHORT_TRUE = new Short((short)1);
- private static final Short SHORT_FALSE = new Short((short)0);
-
-
- public short[] getStyle() {
- CGStyle style = ((CGStyle) ((CGSettings)root).cp_Styles.getElement(cp_Style));
- return new short[] { (short) ((CGSettings)root).cp_Styles.getIndexOf(style)};
+ }
+ private static final Short SHORT_TRUE = new Short((short) 1);
+ private static final Short SHORT_FALSE = new Short((short) 0);
+
+ public short[] getStyle()
+ {
+ CGStyle style = ((CGStyle) ((CGSettings) root).cp_Styles.getElement(cp_Style));
+ return new short[]
+ {
+ (short) ((CGSettings) root).cp_Styles.getIndexOf(style)
+ };
}
- public void setStyle(short[] newStyle) {
- Object o = ((CGStyle) ((CGSettings)root).cp_Styles.getElementAt(newStyle[0]));
- cp_Style = (String)((CGSettings)root).cp_Styles.getKey(o);
+ public void setStyle(short[] newStyle)
+ {
+ Object o = ((CGStyle) ((CGSettings) root).cp_Styles.getElementAt(newStyle[0]));
+ cp_Style = (String) ((CGSettings) root).cp_Styles.getKey(o);
}
- public int getLayout() {
- CGLayout layout = ((CGLayout) ((CGSettings)root).cp_Layouts.getElement(cp_Layout));
+ public int getLayout()
+ {
+ CGLayout layout = ((CGLayout) ((CGSettings) root).cp_Layouts.getElement(cp_Layout));
return layout.cp_Index;
}
- public void setLayout(int layoutIndex) {
- CGLayout layout = (CGLayout)((CGSettings)root).cp_Layouts.getElementAt(layoutIndex);
- cp_Layout = (String)((CGSettings)root).cp_Layouts.getKey(layout);
+ public void setLayout(int layoutIndex)
+ {
+ CGLayout layout = (CGLayout) ((CGSettings) root).cp_Layouts.getElementAt(layoutIndex);
+ cp_Layout = (String) ((CGSettings) root).cp_Layouts.getKey(layout);
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.java b/wizards/com/sun/star/wizards/web/data/CGDocument.java
index 131bba16124d..8268bac5250d 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDocument.java
+++ b/wizards/com/sun/star/wizards/web/data/CGDocument.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
import java.io.File;
import java.io.FileNotFoundException;
@@ -69,73 +70,69 @@ import com.sun.star.wizards.ui.event.Task;
* The same is valid for *description* and *author*.
* @author rpiterman
*/
+public class CGDocument extends ConfigSetItem implements XMLProvider
+{
-public class CGDocument extends ConfigSetItem implements XMLProvider {
public static final int PAGE_TYPE_UNKNOWN = 0;
public static final int PAGE_TYPE_PAGE = 1;
public static final int PAGE_TYPE_SLIDE = 2;
-
- public String cp_Title = "";
- public String cp_Description = "";
- public String cp_URL;
- public String cp_Author = "";
- public String cp_Exporter;
-
+ public String cp_Title = "";
+ public String cp_Description = "";
+ public String cp_URL;
+ public String cp_Author = "";
+ public String cp_Exporter;
/**
* the destination filename to which this
* document will be exported to.
*/
- public String localFilename = "";
- public String urlFilename = "";
-
- public String title = "";
- public String description = "";
- public String author = "";
- public DateTime createDate;
- public DateTime updateDate;
-
- public int sizeBytes = -1;
- public int pages = -1;
-
+ public String localFilename = "";
+ public String urlFilename = "";
+ public String title = "";
+ public String description = "";
+ public String author = "";
+ public DateTime createDate;
+ public DateTime updateDate;
+ public int sizeBytes = -1;
+ public int pages = -1;
/**
* The contents subdirectory name in which the document is in.
* This subdirectory will be created in the content's "docs"
* subdirectory.
*/
- public String dirName;
-
+ public String dirName;
/**
* contains an identifier of the type of this document.
*/
- public String appType;
+ public String appType;
public PropertyValue[] mediaDescriptor;
-
/**
* Is this document an original SO Document (different versions).
*/
- public boolean isSODocument;
-
+ public boolean isSODocument;
/**
* can this document be opend through SO?
*/
- public boolean isSOOpenable;
-
+ public boolean isSOOpenable;
/**
* This flag is set to true after the validate method is called.
*/
- public boolean valid = false;
+ public boolean valid = false;
+ public String targetTypeName;
- public String targetTypeName;
-
- public CGDocument() {}
+ public CGDocument()
+ {
+ }
- public CGDocument(String url, XMultiServiceFactory xmsf,Task task) throws Exception {
+ public CGDocument(String url, XMultiServiceFactory xmsf, Task task) throws Exception
+ {
cp_URL = getSettings().getFileAccess(xmsf).getURL(url);
- if (task==null) task = new Task("","",5);
- validate(xmsf,task);
+ if (task == null)
+ {
+ task = new Task("", "", 5);
+ }
+ validate(xmsf, task);
}
-
/**
* the task will advance 5 times during validate.
* @param xmsf
@@ -143,19 +140,20 @@ public class CGDocument extends ConfigSetItem implements XMLProvider {
* @throws Exception
*/
public void validate(XMultiServiceFactory xmsf, Task task)
- throws FileNotFoundException,
- IllegalArgumentException,
- Exception {
+ throws FileNotFoundException,
+ IllegalArgumentException,
+ Exception
+ {
- if (!getSettings().getFileAccess(xmsf).exists(cp_URL,false))
+ if (!getSettings().getFileAccess(xmsf).exists(cp_URL, false))
+ {
throw new FileNotFoundException("The given URL does not point to a file");
-
+ }
if (getSettings().getFileAccess(xmsf).isDirectory(cp_URL))
- throw new IllegalArgumentException("The given URL points to a directory");
-
- //create a TypeDetection service
-
- mediaDescriptor = OfficeDocument.getFileMediaDecriptor(xmsf,cp_URL);
+ {
+ throw new IllegalArgumentException("The given URL points to a directory"); //create a TypeDetection service
+ }
+ mediaDescriptor = OfficeDocument.getFileMediaDecriptor(xmsf, cp_URL);
task.advance(true); //1
@@ -165,8 +163,8 @@ public class CGDocument extends ConfigSetItem implements XMLProvider {
task.advance(true); //2
- String path = getSettings().getFileAccess(xmsf).getPath(cp_URL,"");
- localFilename = FileAccess.getFilename(path,File.separator);
+ String path = getSettings().getFileAccess(xmsf).getPath(cp_URL, "");
+ localFilename = FileAccess.getFilename(path, File.separator);
/* if the type is a star office convertable document
* We try to open the document to get some properties
@@ -174,35 +172,39 @@ public class CGDocument extends ConfigSetItem implements XMLProvider {
//first get the info object which is a DocumentInfo service.
Object info = null;
- if (isSODocument) {//for SO documents, use StandaloneDocumentInfo service.
+ if (isSODocument)
+ {//for SO documents, use StandaloneDocumentInfo service.
info = xmsf.createInstance("com.sun.star.document.StandaloneDocumentInfo");
- ((XStandaloneDocumentInfo)UnoRuntime.queryInterface(XStandaloneDocumentInfo.class, info)).loadFromURL(cp_URL);
+ ((XStandaloneDocumentInfo) UnoRuntime.queryInterface(XStandaloneDocumentInfo.class, info)).loadFromURL(cp_URL);
}
task.advance(true); //3
- if (!isSODocument && isSOOpenable) { //for other documents which are openable through SO, use DocumentInfo service.
+ if (!isSODocument && isSOOpenable)
+ { //for other documents which are openable through SO, use DocumentInfo service.
XDesktop desktop = Desktop.getDesktop(xmsf);
PropertyValue[] props = new PropertyValue[3];
props[0] = Properties.createProperty("Hidden", Boolean.TRUE);
props[1] = Properties.createProperty("MacroExecutionMode", new Short(MacroExecMode.NEVER_EXECUTE));
props[2] = Properties.createProperty("UpdateDocMode", new Short(UpdateDocMode.NO_UPDATE));
- XComponent component = ((XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class,desktop)).loadComponentFromURL(cp_URL,"_default",0,props);
- info = ((XDocumentInfoSupplier)UnoRuntime.queryInterface(XDocumentInfoSupplier.class, component)).getDocumentInfo();
+ XComponent component = ((XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop)).loadComponentFromURL(cp_URL, "_default", 0, props);
+ info = ((XDocumentInfoSupplier) UnoRuntime.queryInterface(XDocumentInfoSupplier.class, component)).getDocumentInfo();
}
task.advance(true); //4
//now use the object to read some document properties.
- if (isSODocument || isSOOpenable) {
- title = (String)Helper.getUnoPropertyValue(info,"Title");
- description = (String)Helper.getUnoPropertyValue(info,"Description");
- author = (String)Helper.getUnoPropertyValue(info,"Author");
- createDate = (DateTime)Helper.getUnoPropertyValue(info,"CreationDate",DateTime.class);
- updateDate = (DateTime)Helper.getUnoPropertyValue(info,"ModifyDate",DateTime.class);
- //TODO get pages here.
+ if (isSODocument || isSOOpenable)
+ {
+ title = (String) Helper.getUnoPropertyValue(info, "Title");
+ description = (String) Helper.getUnoPropertyValue(info, "Description");
+ author = (String) Helper.getUnoPropertyValue(info, "Author");
+ createDate = (DateTime) Helper.getUnoPropertyValue(info, "CreationDate", DateTime.class);
+ updateDate = (DateTime) Helper.getUnoPropertyValue(info, "ModifyDate", DateTime.class);
+ //TODO get pages here.
}
- else { //get some information from OS.
+ else
+ { //get some information from OS.
title = localFilename;
updateDate = getSettings().getFileAccess(xmsf).getLastModified(cp_URL);
}
@@ -211,43 +213,54 @@ public class CGDocument extends ConfigSetItem implements XMLProvider {
valid = true;
- if (cp_Title.equals("")) cp_Title=title;
- if (cp_Title.equals("")) cp_Title=localFilename;
- if (cp_Description.equals("")) cp_Description=description;
- if (cp_Author.equals("")) cp_Author = author;
-
+ if (cp_Title.equals(""))
+ {
+ cp_Title = title;
+ }
+ if (cp_Title.equals(""))
+ {
+ cp_Title = localFilename;
+ }
+ if (cp_Description.equals(""))
+ {
+ cp_Description = description;
+ }
+ if (cp_Author.equals(""))
+ {
+ cp_Author = author;
+ }
if (cp_Exporter == null || cp_Exporter.equals(""))
- cp_Exporter = (String)getSettings().cp_Exporters.getKey(
- getSettings().getExporters(appType)[0] );
-
+ {
+ cp_Exporter = (String) getSettings().cp_Exporters.getKey(
+ getSettings().getExporters(appType)[0]);
+ }
}
/**
* Analyzes a type-detection string, returned from the TypeDetection service,
* and sets the appType, isSOOpenable and isSODocument memebres.
*/
- private void analyzeFileType(PropertyValue[] mediaDesc) {
+ private void analyzeFileType(PropertyValue[] mediaDesc)
+ {
- if (mediaDesc == null) {
+ if (mediaDesc == null)
+ {
}
String media = (mediaDesc == null)
- ? "" : (String) Properties.getPropertyValue(mediaDescriptor,"Name");
+ ? "" : (String) Properties.getPropertyValue(mediaDescriptor, "Name");
appType = getDocType(media);
//System.out.println(appType);
isSOOpenable =
- ( appType == TypeDetection.WRITER_DOC
- || appType == TypeDetection.CALC_DOC
- || appType == TypeDetection.IMPRESS_DOC
- || appType == TypeDetection.DRAW_DOC ) || appType == TypeDetection.HTML_DOC;
+ (appType == TypeDetection.WRITER_DOC || appType == TypeDetection.CALC_DOC || appType == TypeDetection.IMPRESS_DOC || appType == TypeDetection.DRAW_DOC) || appType == TypeDetection.HTML_DOC;
// String[] parts = media.split("_"); // line removed because of compatibility to JDK13
String[] parts = JavaTools.ArrayoutofString(media, "_");
- isSODocument = parts.length < 2 ? false : isSOOpenable && ( parts[1].startsWith("Star") );
+ isSODocument = parts.length < 2 ? false : isSOOpenable && (parts[1].startsWith("Star"));
}
@@ -256,94 +269,147 @@ public class CGDocument extends ConfigSetItem implements XMLProvider {
* @return one of the constants in the interface TypeDetection.
*
*/
- private String getDocType(String media) {
- if (media.equals("")) return TypeDetection.NO_TYPE;
-
- if (media.startsWith("writer")) {
- if (media.startsWith("writer_web_HTML")) return TypeDetection.HTML_DOC;
- else return TypeDetection.WRITER_DOC;
+ private String getDocType(String media)
+ {
+ if (media.equals(""))
+ {
+ return TypeDetection.NO_TYPE;
+ }
+ if (media.startsWith("writer"))
+ {
+ if (media.startsWith("writer_web_HTML"))
+ {
+ return TypeDetection.HTML_DOC;
+ }
+ else
+ {
+ return TypeDetection.WRITER_DOC;
+ }
+ }
+ else if (media.startsWith("calc"))
+ {
+ return TypeDetection.CALC_DOC;
+ }
+ else if (media.startsWith("draw"))
+ {
+ return TypeDetection.DRAW_DOC;
+ }
+ else if (media.startsWith("impress"))
+ {
+ return TypeDetection.IMPRESS_DOC;
+ }
+ else if (media.startsWith("pdf"))
+ {
+ return TypeDetection.PDF_DOC;
+ }
+ else if (media.startsWith("gif") || media.startsWith("jpg"))
+ {
+ return TypeDetection.WEB_GRAPHICS;
+ }
+ else if (media.startsWith("wav"))
+ {
+ return TypeDetection.SOUND_FILE;
+ }
+ else
+ {
+ return TypeDetection.NO_TYPE;
}
- else if (media.startsWith("calc")) return TypeDetection.CALC_DOC;
- else if (media.startsWith("draw")) return TypeDetection.DRAW_DOC;
- else if (media.startsWith("impress")) return TypeDetection.IMPRESS_DOC;
- else if (media.startsWith("pdf")) return TypeDetection.PDF_DOC;
- else if (media.startsWith("gif") || media.startsWith("jpg")) return TypeDetection.WEB_GRAPHICS;
- else if (media.startsWith("wav")) return TypeDetection.SOUND_FILE;
- else return TypeDetection.NO_TYPE;
}
- public Node createDOM(Node parent) {
+ public Node createDOM(Node parent)
+ {
CGDesign d = getSettings().cp_DefaultSession.cp_Design;
- CGExporter exp = (CGExporter)getSettings().cp_Exporters.getElement(cp_Exporter);
-
- return XMLHelper.addElement(parent,"document",
- new String[] {"title","description","author","format","filename","create-date","update-date","pages","size","icon","dir","fn"},
- new String[] {
- d.cp_DisplayTitle ? cp_Title : "" ,
- d.cp_DisplayDescription ? cp_Description : "",
- d.cp_DisplayAuthor ? cp_Author : "",
- d.cp_DisplayFileFormat ? getTargetTypeName(exp) : "",
- d.cp_DisplayFilename ? localFilename : "",
- d.cp_DisplayCreateDate ? createDate() : "",
- d.cp_DisplayUpdateDate ? updateDate() : "",
- d.cp_DisplayPages && (pages > -1) ? "" + pages() : "", //TODO when do i calculate pages?
- d.cp_DisplaySize ? sizeKB() : "" ,//TODO when do i calculate size?
- d.cp_DisplayFormatIcon ? getIcon(exp) : "",
- dirName, urlFilename}
- );
+ CGExporter exp = (CGExporter) getSettings().cp_Exporters.getElement(cp_Exporter);
+
+ return XMLHelper.addElement(parent, "document",
+ new String[]
+ {
+ "title", "description", "author", "format", "filename", "create-date", "update-date", "pages", "size", "icon", "dir", "fn"
+ },
+ new String[]
+ {
+ d.cp_DisplayTitle ? cp_Title : "",
+ d.cp_DisplayDescription ? cp_Description : "",
+ d.cp_DisplayAuthor ? cp_Author : "",
+ d.cp_DisplayFileFormat ? getTargetTypeName(exp) : "",
+ d.cp_DisplayFilename ? localFilename : "",
+ d.cp_DisplayCreateDate ? createDate() : "",
+ d.cp_DisplayUpdateDate ? updateDate() : "",
+ d.cp_DisplayPages && (pages > -1) ? "" + pages() : "", //TODO when do i calculate pages?
+ d.cp_DisplaySize ? sizeKB() : "",//TODO when do i calculate size?
+ d.cp_DisplayFormatIcon ? getIcon(exp) : "",
+ dirName, urlFilename
+ });
}
-
- private String updateDate() {
- if ( this.updateDate == null )
+ private String updateDate()
+ {
+ if (this.updateDate == null)
+ {
return "";
+ }
return getSettings().formatter.formatCreated(this.updateDate);
}
- private String createDate() {
- if ( this.createDate == null )
+ private String createDate()
+ {
+ if (this.createDate == null)
+ {
return "";
+ }
return getSettings().formatter.formatCreated(this.createDate);
}
- private String sizeKB() {
+ private String sizeKB()
+ {
if (sizeBytes == -1)
+ {
return "";
- else return getSettings().formatter.formatFileSize(sizeBytes);
+ }
+ else
+ {
+ return getSettings().formatter.formatFileSize(sizeBytes);
+ }
}
- private String pages() {
- return pages == -1 ? ""
- : JavaTools.replaceSubString(pagesTemplate() , "" + pages , "%NUMBER" );
+ private String pages()
+ {
+ return pages == -1 ? ""
+ : JavaTools.replaceSubString(pagesTemplate(), "" + pages, "%NUMBER");
}
- private String pagesTemplate() {
- int pagesType = ((CGExporter)getSettings().cp_Exporters.getElement(cp_Exporter)).cp_PageType;
- switch (pagesType) {
- case PAGE_TYPE_UNKNOWN :
+ private String pagesTemplate()
+ {
+ int pagesType = ((CGExporter) getSettings().cp_Exporters.getElement(cp_Exporter)).cp_PageType;
+ switch (pagesType)
+ {
+ case PAGE_TYPE_UNKNOWN:
return "";
- case PAGE_TYPE_PAGE :
+ case PAGE_TYPE_PAGE:
return getSettings().resources[CGSettings.RESOURCE_PAGES_TEMPLATE];
- case PAGE_TYPE_SLIDE :
+ case PAGE_TYPE_SLIDE:
return getSettings().resources[CGSettings.RESOURCE_SLIDES_TEMPLATE];
- default : return "";
+ default:
+ return "";
}
}
- private String getTargetTypeName(CGExporter exp) {
+ private String getTargetTypeName(CGExporter exp)
+ {
return (exp.targetTypeName.equals(""))
- ? (String) Properties.getPropertyValue(mediaDescriptor,"UIName")
- : exp.targetTypeName;
+ ? (String) Properties.getPropertyValue(mediaDescriptor, "UIName")
+ : exp.targetTypeName;
}
- private String getIcon(CGExporter exporter) {
- return exporter.cp_Icon.equals("") ?
- getIcon(this.appType) : exporter.cp_Icon;
+ private String getIcon(CGExporter exporter)
+ {
+ return exporter.cp_Icon.equals("") ? getIcon(this.appType) : exporter.cp_Icon;
}
- private String getIcon(String appType) {
+ private String getIcon(String appType)
+ {
//System.out.println("Getting Icon for: " + appType);
- return appType+".gif";
+ return appType + ".gif";
}
/**
@@ -353,34 +419,47 @@ public class CGDocument extends ConfigSetItem implements XMLProvider {
* exporters available for this type of document</b>
* @return
*/
- public short[] getExporter() {
- return new short[] {getExporterIndex()};
+ public short[] getExporter()
+ {
+ return new short[]
+ {
+ getExporterIndex()
+ };
}
/**
* @see getExporter()
*/
- public void setExporter(short[] exporter_) {
+ public void setExporter(short[] exporter_)
+ {
Object exp = getSettings().getExporters(appType)[exporter_[0]];
- cp_Exporter = (String)getSettings().cp_Exporters.getKey(exp);
+ cp_Exporter = (String) getSettings().cp_Exporters.getKey(exp);
}
/**
* @see getExporter()
* @return
*/
- private short getExporterIndex() {
- if (cp_Exporter==null)
- return 0;
+ private short getExporterIndex()
+ {
+ if (cp_Exporter == null)
+ {
+ return 0;
+ }
Object exporter = getSettings().cp_Exporters.getElement(cp_Exporter);
Object[] exporters = getSettings().getExporters(appType);
- for (short i = 0; i<exporters.length; i++)
- if (exporters[i] == exporter)
- return i;
+ for (short i = 0; i < exporters.length; i++)
+ {
+ if (exporters[i] == exporter)
+ {
+ return i;
+ }
+ }
return -1;
}
- public String toString() {
+ public String toString()
+ {
return localFilename;
}
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGExporter.java b/wizards/com/sun/star/wizards/web/data/CGExporter.java
index a0f0febc06f8..e58d56d9b20d 100644
--- a/wizards/com/sun/star/wizards/web/data/CGExporter.java
+++ b/wizards/com/sun/star/wizards/web/data/CGExporter.java
@@ -26,34 +26,35 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.ConfigSet;
-public class CGExporter extends ConfigSetItem {
- public String cp_Name;
- public String cp_ExporterClass;
- public boolean cp_OwnDirectory;
- public boolean cp_SupportsFilename;
- public String cp_DefaultFilename;
- public String cp_Extension;
- public String cp_SupportedMimeTypes;
- public String cp_Icon;
- public String cp_TargetType;
- public boolean cp_Binary;
- public int cp_PageType;
-
- public String targetTypeName = "";
-
- public ConfigSet cp_Arguments = new ConfigSet(CGArgument.class);
-
-
- public String toString() {
+public class CGExporter extends ConfigSetItem
+{
+
+ public String cp_Name;
+ public String cp_ExporterClass;
+ public boolean cp_OwnDirectory;
+ public boolean cp_SupportsFilename;
+ public String cp_DefaultFilename;
+ public String cp_Extension;
+ public String cp_SupportedMimeTypes;
+ public String cp_Icon;
+ public String cp_TargetType;
+ public boolean cp_Binary;
+ public int cp_PageType;
+ public String targetTypeName = "";
+ public ConfigSet cp_Arguments = new ConfigSet(CGArgument.class);
+
+ public String toString()
+ {
return cp_Name;
}
- public boolean supports(String mime) {
- return (cp_SupportedMimeTypes.equals("") || cp_SupportedMimeTypes.indexOf(mime)>-1);
+ public boolean supports(String mime)
+ {
+ return (cp_SupportedMimeTypes.equals("") || cp_SupportedMimeTypes.indexOf(mime) > -1);
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGFilter.java b/wizards/com/sun/star/wizards/web/data/CGFilter.java
index 693545c7566d..b02008a71d27 100644
--- a/wizards/com/sun/star/wizards/web/data/CGFilter.java
+++ b/wizards/com/sun/star/wizards/web/data/CGFilter.java
@@ -26,10 +26,13 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
-public class CGFilter extends ConfigSetItem {
- public String cp_Name;
+public class CGFilter extends ConfigSetItem
+{
+
+ public String cp_Name;
//public boolean cp_Readonly;
- public String cp_Filter;
+ public String cp_Filter;
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java b/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java
index 5f41343c81ed..345a636659ad 100644
--- a/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java
+++ b/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java
@@ -26,52 +26,68 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
import com.sun.star.util.DateTime;
import com.sun.star.wizards.common.*;
import org.w3c.dom.Node;
+public class CGGeneralInfo extends ConfigGroup implements XMLProvider
+{
-public class CGGeneralInfo extends ConfigGroup implements XMLProvider {
- public String cp_Title;
- public String cp_Description;
- public String cp_Author;
- public int cp_CreationDate;
- public int cp_UpdateDate;
- public String cp_Email;
- public String cp_Copyright;
+ public String cp_Title;
+ public String cp_Description;
+ public String cp_Author;
+ public int cp_CreationDate;
+ public int cp_UpdateDate;
+ public String cp_Email;
+ public String cp_Copyright;
- public Node createDOM(Node parent) {
- return XMLHelper.addElement(parent,"general-info",
- new String[] {"title","author","description","creation-date","update-date","email","copyright"},
- new String[] {cp_Title, cp_Author, cp_Description, String.valueOf(cp_CreationDate), String.valueOf(cp_UpdateDate),cp_Email, cp_Copyright}
- );
+ public Node createDOM(Node parent)
+ {
+ return XMLHelper.addElement(parent, "general-info",
+ new String[]
+ {
+ "title", "author", "description", "creation-date", "update-date", "email", "copyright"
+ },
+ new String[]
+ {
+ cp_Title, cp_Author, cp_Description, String.valueOf(cp_CreationDate), String.valueOf(cp_UpdateDate), cp_Email, cp_Copyright
+ });
}
- public Integer getCreationDate() {
+ public Integer getCreationDate()
+ {
if (cp_CreationDate == 0)
+ {
cp_CreationDate = currentDate();
+ }
return new Integer(cp_CreationDate);
}
-
- public Integer getUpdateDate() {
- if (cp_UpdateDate== 0)
+ public Integer getUpdateDate()
+ {
+ if (cp_UpdateDate == 0)
+ {
cp_UpdateDate = currentDate();
+ }
return new Integer(cp_UpdateDate);
}
- public void setCreationDate(Integer i) {
+ public void setCreationDate(Integer i)
+ {
//System.out.println(i);
cp_CreationDate = i.intValue();
}
- public void setUpdateDate(Integer i) {
+ public void setUpdateDate(Integer i)
+ {
cp_UpdateDate = i.intValue();
}
- private int currentDate() {
+ private int currentDate()
+ {
DateTime dt = JavaTools.getDateTime(System.currentTimeMillis());
//System.out.println();
return dt.Day + dt.Month * 100 + dt.Year * 10000;
diff --git a/wizards/com/sun/star/wizards/web/data/CGIconSet.java b/wizards/com/sun/star/wizards/web/data/CGIconSet.java
index b7a2d0611969..f12f80942316 100644
--- a/wizards/com/sun/star/wizards/web/data/CGIconSet.java
+++ b/wizards/com/sun/star/wizards/web/data/CGIconSet.java
@@ -26,9 +26,12 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
+
+public class CGIconSet extends ConfigSetItem
+{
-public class CGIconSet extends ConfigSetItem {
public String cp_FNPrefix;
public String cp_FNPostfix;
public String cp_Name;
diff --git a/wizards/com/sun/star/wizards/web/data/CGImage.java b/wizards/com/sun/star/wizards/web/data/CGImage.java
index 0862cdea95c7..a4cd4dd12819 100644
--- a/wizards/com/sun/star/wizards/web/data/CGImage.java
+++ b/wizards/com/sun/star/wizards/web/data/CGImage.java
@@ -1,9 +1,39 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CGImage.java,v $
+ *
+ * $Revision: 1.2.412.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* IconSet.java
*
* Created on 12. September 2003, 17:16
*/
-
package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.ConfigGroup;
@@ -12,8 +42,8 @@ import com.sun.star.wizards.common.ConfigGroup;
*
* @author rpiterman
*/
+public class CGImage extends ConfigGroup
+{
-
-public class CGImage extends ConfigGroup {
- public String cp_Href;
+ public String cp_Href;
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGLayout.java b/wizards/com/sun/star/wizards/web/data/CGLayout.java
index 413c3747f4bb..8fca3b01334c 100644
--- a/wizards/com/sun/star/wizards/web/data/CGLayout.java
+++ b/wizards/com/sun/star/wizards/web/data/CGLayout.java
@@ -26,7 +26,8 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
import com.sun.star.wizards.ui.UIConsts;
import java.util.Hashtable;
@@ -38,13 +39,15 @@ import javax.xml.transform.stream.StreamSource;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.FileAccess;
-public class CGLayout extends ConfigSetItem {
+public class CGLayout extends ConfigSetItem
+{
+
public String cp_Name;
public String cp_FSName;
-
private Map templates;
- private void createTemplates(XMultiServiceFactory xmsf) throws Exception {
+ private void createTemplates(XMultiServiceFactory xmsf) throws Exception
+ {
templates = new Hashtable(3);
@@ -52,29 +55,36 @@ public class CGLayout extends ConfigSetItem {
String workPath = getSettings().workPath;
FileAccess fa = new FileAccess(xmsf);
- String stylesheetPath = fa.getURL(getSettings().workPath,"layouts/"+ cp_FSName);
+ String stylesheetPath = fa.getURL(getSettings().workPath, "layouts/" + cp_FSName);
- String[] files = fa.listFiles(stylesheetPath,false);
+ String[] files = fa.listFiles(stylesheetPath, false);
- for (int i = 0; i<files.length; i++)
+ for (int i = 0; i < files.length; i++)
+ {
if (FileAccess.getExtension(files[i]).equals("xsl"))
- templates.put(FileAccess.getFilename(files[i]), tf.newTemplates( new StreamSource(files[i]) ));
-
+ {
+ templates.put(FileAccess.getFilename(files[i]), tf.newTemplates(new StreamSource(files[i])));
+ }
+ }
}
- public Object[] getImageUrls() {
+ public Object[] getImageUrls()
+ {
Object[] sRetUrls = new Object[1];
- int ResId = UIConsts.RID_IMG_WEB + (cp_Index *2);
- return new Integer[]{new Integer(ResId), new Integer(ResId + 1)};
+ int ResId = UIConsts.RID_IMG_WEB + (cp_Index * 2);
+ return new Integer[]
+ {
+ new Integer(ResId), new Integer(ResId + 1)
+ };
}
- public Map getTemplates(XMultiServiceFactory xmsf) throws Exception {
+ public Map getTemplates(XMultiServiceFactory xmsf) throws Exception
+ {
// TODO uncomment...
// if (templates==null)
- createTemplates(xmsf);
+ createTemplates(xmsf);
return templates;
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGPublish.java b/wizards/com/sun/star/wizards/web/data/CGPublish.java
index d0a81fc6b78f..eaca60259399 100644
--- a/wizards/com/sun/star/wizards/web/data/CGPublish.java
+++ b/wizards/com/sun/star/wizards/web/data/CGPublish.java
@@ -32,7 +32,6 @@ package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.ConfigGroup;
import com.sun.star.wizards.common.JavaTools;
-
/**
*
* A Class which describes the publishing arguments
@@ -40,13 +39,13 @@ import com.sun.star.wizards.common.JavaTools;
* Each session can contain different publishers, which are configured
* through such a CGPublish object.
*/
-public class CGPublish extends ConfigGroup {
+public class CGPublish extends ConfigGroup
+{
public boolean cp_Publish;
public String cp_URL;
public String cp_Username;
public String password;
-
/**
* cp_URL is the url given by the user
* for this publisher. (in UCB URL form)
@@ -55,8 +54,6 @@ public class CGPublish extends ConfigGroup {
* It is used for example to add ftp username and password, or zip url
*/
public String url;
-
-
/**
* if the user approved overwriting files in this publisher target
*/
@@ -67,28 +64,35 @@ public class CGPublish extends ConfigGroup {
* a UCB url...
* @param url
*/
- public void setURL(String path) {
- try {
- this.cp_URL = ((CGSettings)this.root).getFileAccess().getURL(path);
+ public void setURL(String path)
+ {
+ try
+ {
+ this.cp_URL = ((CGSettings) this.root).getFileAccess().getURL(path);
overwriteApproved = false;
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
- public String getURL() {
- try {
- return ((CGSettings)this.root).getFileAccess().getPath(cp_URL, null );
- } catch (Exception e) {
+ public String getURL()
+ {
+ try
+ {
+ return ((CGSettings) this.root).getFileAccess().getPath(cp_URL, null);
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
return "";
}
}
- private String ftpURL() {
+ private String ftpURL()
+ {
return "ftp://" + cp_Username +
- ((password!=null && password.length()>0) ? ":" + password : "")
- + "@" + cp_URL.substring(7);
+ ((password != null && password.length() > 0) ? ":" + password : "") + "@" + cp_URL.substring(7);
}
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGSession.java b/wizards/com/sun/star/wizards/web/data/CGSession.java
index 19780f93b26d..59cf8f4fc601 100644
--- a/wizards/com/sun/star/wizards/web/data/CGSession.java
+++ b/wizards/com/sun/star/wizards/web/data/CGSession.java
@@ -37,25 +37,30 @@ import com.sun.star.wizards.common.*;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-
-public class CGSession extends ConfigSetItem implements XMLProvider {
- public String cp_InDirectory;
- public String cp_OutDirectory;
- public String cp_Name;
-
- public CGContent cp_Content = new CGContent();
- public CGDesign cp_Design = new CGDesign();
+public class CGSession extends ConfigSetItem implements XMLProvider
+{
+
+ public String cp_InDirectory;
+ public String cp_OutDirectory;
+ public String cp_Name;
+ public CGContent cp_Content = new CGContent();
+ public CGDesign cp_Design = new CGDesign();
public CGGeneralInfo cp_GeneralInfo = new CGGeneralInfo();
- public ConfigSet cp_Publishing = new ConfigSet(CGPublish.class);
-
+ public ConfigSet cp_Publishing = new ConfigSet(CGPublish.class);
+ public CGStyle style; // !!!
+ public boolean valid = false;
- public CGStyle style; // !!!
- public boolean valid = false;
-
- public Node createDOM(Node parent) {
+ public Node createDOM(Node parent)
+ {
Node root = XMLHelper.addElement(parent, "session",
- new String[] { "name" , "screen-size" },
- new String[] { cp_Name , getScreenSize() } );
+ new String[]
+ {
+ "name", "screen-size"
+ },
+ new String[]
+ {
+ cp_Name, getScreenSize()
+ });
//cp_Design.createDOM(root);
cp_GeneralInfo.createDOM(root);
@@ -65,33 +70,42 @@ public class CGSession extends ConfigSetItem implements XMLProvider {
return root;
}
- private String getScreenSize() {
- switch (cp_Design.cp_OptimizeDisplaySize) {
- case 0 : return "640";
- case 1 : return "800";
- case 2 : return "1024";
- default : return "800";
+ private String getScreenSize()
+ {
+ switch (cp_Design.cp_OptimizeDisplaySize)
+ {
+ case 0:
+ return "640";
+ case 1:
+ return "800";
+ case 2:
+ return "1024";
+ default:
+ return "800";
}
}
- public CGLayout getLayout() {
- return (CGLayout)((CGSettings)root).cp_Layouts.getElement(cp_Design.cp_Layout);
+ public CGLayout getLayout()
+ {
+ return (CGLayout) ((CGSettings) root).cp_Layouts.getElement(cp_Design.cp_Layout);
}
- public CGStyle getStyle() {
- return (CGStyle)((CGSettings)root).cp_Styles.getElement(cp_Design.cp_Style);
+ public CGStyle getStyle()
+ {
+ return (CGStyle) ((CGSettings) root).cp_Styles.getElement(cp_Design.cp_Style);
}
- public void setLayout(short[] layout) {
+ public void setLayout(short[] layout)
+ {
//dummy
}
public Node createDOM()
- throws ParserConfigurationException
+ throws ParserConfigurationException
{
DocumentBuilderFactory factory =
- DocumentBuilderFactory.newInstance();
+ DocumentBuilderFactory.newInstance();
Document doc = factory.newDocumentBuilder().newDocument();
createDOM(doc);
return doc;
diff --git a/wizards/com/sun/star/wizards/web/data/CGSessionName.java b/wizards/com/sun/star/wizards/web/data/CGSessionName.java
index 8e7a1064e126..d385969e6d3b 100644
--- a/wizards/com/sun/star/wizards/web/data/CGSessionName.java
+++ b/wizards/com/sun/star/wizards/web/data/CGSessionName.java
@@ -26,14 +26,16 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
+public class CGSessionName extends ConfigSetItem
+{
-public class CGSessionName extends ConfigSetItem {
- public String cp_Name;
+ public String cp_Name;
- public String toString() {
+ public String toString()
+ {
return cp_Name;
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.java b/wizards/com/sun/star/wizards/web/data/CGSettings.java
index fa4ff66f5e5a..2364f3ae653c 100644
--- a/wizards/com/sun/star/wizards/web/data/CGSettings.java
+++ b/wizards/com/sun/star/wizards/web/data/CGSettings.java
@@ -1,12 +1,42 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CGSettings.java,v $
+ *
+ * $Revision: 1.7.164.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/*
* IconSet.java
*
* Created on 12. September 2003, 17:16
*/
-
package com.sun.star.wizards.web.data;
-
import java.util.Calendar;
import java.util.Hashtable;
import java.util.Map;
@@ -29,79 +59,80 @@ import com.sun.star.wizards.common.Helper.DateUtils;
/**
* @author rpiterman
*/
-
-
-public class CGSettings extends ConfigGroup {
-
- public String soTemplateDir;
- public String soGalleryDir;
- public String workPath = null;
-
- public String cp_WorkDir;
-
- public ConfigSet cp_Exporters = new ConfigSet(CGExporter.class);
- public ConfigSet cp_Layouts = new ConfigSet(CGLayout.class);
- public ConfigSet cp_Styles = new ConfigSet(CGStyle.class);
- public ConfigSet cp_IconSets = new ConfigSet(CGIconSet.class);
- public ConfigSet cp_BackgroundImages = new ConfigSet(CGImage.class);
- public ConfigSet cp_SavedSessions = new ConfigSet(CGSessionName.class);
- public ConfigSet cp_Filters = new ConfigSet(CGFilter.class);
-
- public ConfigSet savedSessions = new ConfigSet(CGSessionName.class);
-
- public CGSession cp_DefaultSession = new CGSession();
- public String cp_LastSavedSession;
-
+public class CGSettings extends ConfigGroup
+{
+
+ public String soTemplateDir;
+ public String soGalleryDir;
+ public String workPath = null;
+ public String cp_WorkDir;
+ public ConfigSet cp_Exporters = new ConfigSet(CGExporter.class);
+ public ConfigSet cp_Layouts = new ConfigSet(CGLayout.class);
+ public ConfigSet cp_Styles = new ConfigSet(CGStyle.class);
+ public ConfigSet cp_IconSets = new ConfigSet(CGIconSet.class);
+ public ConfigSet cp_BackgroundImages = new ConfigSet(CGImage.class);
+ public ConfigSet cp_SavedSessions = new ConfigSet(CGSessionName.class);
+ public ConfigSet cp_Filters = new ConfigSet(CGFilter.class);
+ public ConfigSet savedSessions = new ConfigSet(CGSessionName.class);
+ public CGSession cp_DefaultSession = new CGSession();
+ public String cp_LastSavedSession;
private Map exportersMap = new Hashtable();
private XMultiServiceFactory xmsf;
-
String[] resources;
public Formatter formatter;
-
-
public static final int RESOURCE_PAGES_TEMPLATE = 0;
public static final int RESOURCE_SLIDES_TEMPLATE = 1;
public static final int RESOURCE_CREATED_TEMPLATE = 2;
public static final int RESOURCE_UPDATED_TEMPLATE = 3;
public static final int RESOURCE_SIZE_TEMPLATE = 4;
- public CGSettings(XMultiServiceFactory xmsf_, String[] resources_ , Object document) {
+ public CGSettings(XMultiServiceFactory xmsf_, String[] resources_, Object document)
+ {
xmsf = xmsf_;
- try {
- soTemplateDir = FileAccess.getOfficePath(xmsf, "Config","", "");
- soGalleryDir = FileAccess.getOfficePath(xmsf,"Gallery","share", "");
+ try
+ {
+ soTemplateDir = FileAccess.getOfficePath(xmsf, "Config", "", "");
+ soGalleryDir = FileAccess.getOfficePath(xmsf, "Gallery", "share", "");
root = this;
- formatter = new Formatter(xmsf, document );
+ formatter = new Formatter(xmsf, document);
resources = resources_;
}
- catch (Exception ex) {
- ex.printStackTrace();
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
}
}
-
-
private static final CGExporter[] EMPTY_ARRAY_1 = new CGExporter[0];
- public CGExporter[] getExporters(String mime) {
- CGExporter[] exps = (CGExporter[])exportersMap.get(mime);
+ public CGExporter[] getExporters(String mime)
+ {
+ CGExporter[] exps = (CGExporter[]) exportersMap.get(mime);
if (exps == null)
- exportersMap.put(mime,exps = createExporters(mime));
+ {
+ exportersMap.put(mime, exps = createExporters(mime));
+ }
return exps;
}
- private CGExporter[] createExporters(String mime) {
+ private CGExporter[] createExporters(String mime)
+ {
Object[] exporters = cp_Exporters.items();
Vector v = new Vector();
- for (int i = 0; i<exporters.length; i++)
- if (((CGExporter)exporters[i]).supports(mime)) {
- try {
+ for (int i = 0; i < exporters.length; i++)
+ {
+ if (((CGExporter) exporters[i]).supports(mime))
+ {
+ try
+ {
v.add(exporters[i]);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
- }
- return (CGExporter[])v.toArray(EMPTY_ARRAY_1);
+ }
+ }
+ return (CGExporter[]) v.toArray(EMPTY_ARRAY_1);
}
/**
@@ -109,70 +140,81 @@ public class CGSettings extends ConfigGroup {
* @param xmsf
* @param document the background document. used for date/number formatting.
*/
- public void configure(XMultiServiceFactory xmsf) throws Exception {
- workPath = FileAccess.connectURLs(soTemplateDir , cp_WorkDir);
+ public void configure(XMultiServiceFactory xmsf) throws Exception
+ {
+ workPath = FileAccess.connectURLs(soTemplateDir, cp_WorkDir);
calcExportersTargetTypeNames(xmsf);
}
- private void calcExportersTargetTypeNames(XMultiServiceFactory xmsf) throws Exception {
+ private void calcExportersTargetTypeNames(XMultiServiceFactory xmsf) throws Exception
+ {
Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
- XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class,typeDetect);
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
for (int i = 0; i < cp_Exporters.getSize(); i++)
- calcExporterTargetTypeName(xNameAccess,(CGExporter)cp_Exporters.getElementAt(i));
+ {
+ calcExporterTargetTypeName(xNameAccess, (CGExporter) cp_Exporters.getElementAt(i));
+ }
}
-
private void calcExporterTargetTypeName(XNameAccess xNameAccess, CGExporter exporter)
- throws NoSuchElementException,
- WrappedTargetException
+ throws NoSuchElementException,
+ WrappedTargetException
{
if (!exporter.cp_TargetType.equals(""))
+ {
exporter.targetTypeName =
- (String) Properties.getPropertyValue(
+ (String) Properties.getPropertyValue(
(PropertyValue[]) xNameAccess.getByName(exporter.cp_TargetType),
"UIName");
-
+ }
}
-
FileAccess fileAccess;
- FileAccess getFileAccess() throws Exception {
+ FileAccess getFileAccess() throws Exception
+ {
return getFileAccess(xmsf);
}
- FileAccess getFileAccess(XMultiServiceFactory xmsf) throws Exception {
- if (fileAccess==null)
- fileAccess = new FileAccess(xmsf);
+ FileAccess getFileAccess(XMultiServiceFactory xmsf) throws Exception
+ {
+ if (fileAccess == null)
+ {
+ fileAccess = new FileAccess(xmsf);
+ }
return fileAccess;
}
- public class Formatter {
+ public class Formatter
+ {
+
private long docNullTime;
- private int dateFormat, numberFormat;
+ private int dateFormat, numberFormat;
private DateUtils dateUtils;
- public Formatter(XMultiServiceFactory xmsf, Object document ) throws Exception {
+ public Formatter(XMultiServiceFactory xmsf, Object document) throws Exception
+ {
dateUtils = new DateUtils(xmsf, document);
- dateFormat = dateUtils.getFormat( NumberFormatIndex.DATE_SYS_DMMMYYYY);
- numberFormat = dateUtils.getFormat( NumberFormatIndex.NUMBER_1000DEC2 );
+ dateFormat = dateUtils.getFormat(NumberFormatIndex.DATE_SYS_DMMMYYYY);
+ numberFormat = dateUtils.getFormat(NumberFormatIndex.NUMBER_1000DEC2);
}
- public String formatCreated(DateTime date) {
- String sDate = dateUtils.format( dateFormat, date );
- return JavaTools.replaceSubString( resources[CGSettings.RESOURCE_CREATED_TEMPLATE], sDate, "%DATE" );
+ public String formatCreated(DateTime date)
+ {
+ String sDate = dateUtils.format(dateFormat, date);
+ return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_CREATED_TEMPLATE], sDate, "%DATE");
}
- public String formatUpdated(DateTime date) {
- String sDate = dateUtils.format( dateFormat, date );
- return JavaTools.replaceSubString( resources[CGSettings.RESOURCE_UPDATED_TEMPLATE], sDate, "%DATE" );
+ public String formatUpdated(DateTime date)
+ {
+ String sDate = dateUtils.format(dateFormat, date);
+ return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_UPDATED_TEMPLATE], sDate, "%DATE");
}
- public String formatFileSize(int size) {
- float sizeInKB = ((float)size) / 1024f;
- String sSize = dateUtils.getFormatter().convertNumberToString(numberFormat, sizeInKB );
- return JavaTools.replaceSubString( resources[CGSettings.RESOURCE_SIZE_TEMPLATE], sSize, "%NUMBER" );
+ public String formatFileSize(int size)
+ {
+ float sizeInKB = ((float) size) / 1024f;
+ String sSize = dateUtils.getFormatter().convertNumberToString(numberFormat, sizeInKB);
+ return JavaTools.replaceSubString(resources[CGSettings.RESOURCE_SIZE_TEMPLATE], sSize, "%NUMBER");
}
-
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGStyle.java b/wizards/com/sun/star/wizards/web/data/CGStyle.java
index c3123bdf7531..529c38157bf6 100644
--- a/wizards/com/sun/star/wizards/web/data/CGStyle.java
+++ b/wizards/com/sun/star/wizards/web/data/CGStyle.java
@@ -26,24 +26,32 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.data;
+ ************************************************************************/
+package com.sun.star.wizards.web.data;
-public class CGStyle extends ConfigSetItem {
- public String cp_Name;
+public class CGStyle extends ConfigSetItem
+{
+
+ public String cp_Name;
//public boolean cp_Readonly;
- public String cp_CssHref;
- public String cp_BackgroundImage;
- public String cp_IconSet;
+ public String cp_CssHref;
+ public String cp_BackgroundImage;
+ public String cp_IconSet;
- public String toString() {
+ public String toString()
+ {
return cp_Name;
}
- public String getBackgroundUrl() {
+ public String getBackgroundUrl()
+ {
if (cp_BackgroundImage == null || cp_BackgroundImage.equals(""))
- return null;
+ {
+ return null;
+ }
else
- return cp_BackgroundImage;
+ {
+ return cp_BackgroundImage;
+ }
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java b/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java
index a9eb5bacb7f6..c78d7c740f99 100644
--- a/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java
+++ b/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java
@@ -1,9 +1,39 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ConfigSetItem.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* SetItem.java
*
* Created on 16. September 2003, 12:29
*/
-
package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.*;
@@ -12,14 +42,18 @@ import com.sun.star.wizards.common.*;
*
* @author rpiterman
*/
-public class ConfigSetItem extends ConfigGroup implements Indexable {
+public class ConfigSetItem extends ConfigGroup implements Indexable
+{
+
public int cp_Index = -1;
- public int getIndex() {
+ public int getIndex()
+ {
return cp_Index;
}
- public CGSettings getSettings() {
- return (CGSettings)root;
+ public CGSettings getSettings()
+ {
+ return (CGSettings) root;
}
}
diff --git a/wizards/com/sun/star/wizards/web/data/TypeDetection.java b/wizards/com/sun/star/wizards/web/data/TypeDetection.java
index 7a2351435960..884738f4c4b5 100644
--- a/wizards/com/sun/star/wizards/web/data/TypeDetection.java
+++ b/wizards/com/sun/star/wizards/web/data/TypeDetection.java
@@ -1,56 +1,83 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TypeDetection.java,v $
+ *
+ * $Revision: 1.2.412.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/*
* FileTypes.java
*
* Created on 29. September 2003, 18:52
*/
-
package com.sun.star.wizards.web.data;
+
/**
*
* @author rpiterman
*/
-public class TypeDetection {
+public class TypeDetection
+{
/**
* a document which will open in writer.
*/
- public final static String WRITER_DOC = "writer";
- /**
+ public final static String WRITER_DOC = "writer";
+ /**
* a document which will open in calc.
*/
- public final static String CALC_DOC = "calc";
+ public final static String CALC_DOC = "calc";
/**
* a document which will open in impress.
*/
- public final static String IMPRESS_DOC = "impress";
+ public final static String IMPRESS_DOC = "impress";
/**
* a document which will open in draw.
*/
- public final static String DRAW_DOC = "draw";
-
+ public final static String DRAW_DOC = "draw";
/**
* an HTML document
*/
- public final static String HTML_DOC = "html";
+ public final static String HTML_DOC = "html";
/**
* a GIF or an JPG file.
*/
- public final static String WEB_GRAPHICS = "graphics";
+ public final static String WEB_GRAPHICS = "graphics";
/**
* a PDF document.
*/
- public final static String PDF_DOC = "pdf";
+ public final static String PDF_DOC = "pdf";
/**
* a Sound file (mp3/wav ect.)
*/
- public final static String SOUND_FILE = "sound";
-
-
+ public final static String SOUND_FILE = "sound";
/**
* a File which can not be handled by neither SO or a Web browser (exe, jar, zip ect.)
*/
- public final static String NO_TYPE = "other";
-
-
-
+ public final static String NO_TYPE = "other";
}
diff --git a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java
index cadb10ec2ee2..71c214a272e6 100644
--- a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java
+++ b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java
@@ -1,9 +1,39 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AbstractExporter.java,v $
+ *
+ * $Revision: 1.6.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* AbstractExporter.java
*
* Created on 1. Oktober 2003, 16:12
*/
-
package com.sun.star.wizards.web.export;
import com.sun.star.beans.PropertyValue;
@@ -31,107 +61,137 @@ import com.sun.star.wizards.web.data.TypeDetection;
*
* @author rpiterman
*/
-public abstract class AbstractExporter implements Exporter {
+public abstract class AbstractExporter implements Exporter
+{
+
protected CGExporter exporter;
protected FileAccess fileAccess;
protected void storeToURL(Object officeDocument, Properties props, String targetUrl, String filterName, PropertyValue[] filterData)
- throws IOException {
-
- props = new Properties();
- props.put("FilterName", filterName);
+ throws IOException
+ {
- if (filterData.length>0)
- props.put("FilterData", filterData);
+ props = new Properties();
+ props.put("FilterName", filterName);
- XStorable xs = ((XStorable)UnoRuntime.queryInterface(XStorable.class,officeDocument));
- PropertyValue[] o = props.getProperties();
- xs.storeToURL(targetUrl, o);
- }
+ if (filterData.length > 0)
+ {
+ props.put("FilterData", filterData);
+ }
+ XStorable xs = ((XStorable) UnoRuntime.queryInterface(XStorable.class, officeDocument));
+ PropertyValue[] o = props.getProperties();
+ xs.storeToURL(targetUrl, o);
+ }
- protected void storeToURL(Object officeDocument, String targetUrl, String filterName, PropertyValue[] filterData)
- throws IOException {
+ protected void storeToURL(Object officeDocument, String targetUrl, String filterName, PropertyValue[] filterData)
+ throws IOException
+ {
- storeToURL(officeDocument, new Properties(), targetUrl, filterName, filterData);
- }
+ storeToURL(officeDocument, new Properties(), targetUrl, filterName, filterData);
+ }
- protected void storeToURL(Object officeDocument, String targetUrl, String filterName )
- throws IOException {
+ protected void storeToURL(Object officeDocument, String targetUrl, String filterName)
+ throws IOException
+ {
- storeToURL(officeDocument, new Properties(), targetUrl, filterName, new PropertyValue[0]);
+ storeToURL(officeDocument, new Properties(), targetUrl, filterName, new PropertyValue[0]);
- }
+ }
- protected String getArgument(String name, CGExporter p) {
- return ((CGArgument)p.cp_Arguments.getElement(name)).cp_Value;
+ protected String getArgument(String name, CGExporter p)
+ {
+ return ((CGArgument) p.cp_Arguments.getElement(name)).cp_Value;
}
protected Object openDocument(CGDocument doc, XMultiServiceFactory xmsf)
- throws com.sun.star.io.IOException
+ throws com.sun.star.io.IOException
{
Object document = null;
//open the document.
- try {
+ try
+ {
XDesktop desktop = Desktop.getDesktop(xmsf);
Properties props = new Properties();
props.put("Hidden", Boolean.TRUE);
props.put("MacroExecutionMode", new Short(MacroExecMode.NEVER_EXECUTE));
- props.put( "UpdateDocMode", new Short(UpdateDocMode.NO_UPDATE));
- document = ((XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop)).loadComponentFromURL( doc.cp_URL, "_blank", 0, props.getProperties());
- } catch (com.sun.star.lang.IllegalArgumentException iaex) {
+ props.put("UpdateDocMode", new Short(UpdateDocMode.NO_UPDATE));
+ document = ((XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop)).loadComponentFromURL(doc.cp_URL, "_blank", 0, props.getProperties());
+ }
+ catch (com.sun.star.lang.IllegalArgumentException iaex)
+ {
}
//try to get the number of pages in the document;
- try {
- pageCount(doc,document);
+ try
+ {
+ pageCount(doc, document);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
//Here i do nothing since pages is not *so* important.
}
return document;
}
- protected void closeDocument(Object doc,XMultiServiceFactory xmsf) {
+ protected void closeDocument(Object doc, XMultiServiceFactory xmsf)
+ {
/*OfficeDocument.dispose(
- xmsf,
- (XComponent) UnoRuntime.queryInterface(XComponent.class, doc));*/
- try {
- XCloseable xc = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, doc);
+ xmsf,
+ (XComponent) UnoRuntime.queryInterface(XComponent.class, doc));*/
+ try
+ {
+ XCloseable xc = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, doc);
xc.close(false);
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
ex.printStackTrace();
}
}
- private void pageCount(CGDocument doc, Object document) {
+ private void pageCount(CGDocument doc, Object document)
+ {
if (doc.appType.equals(TypeDetection.WRITER_DOC))
+ {
doc.pages = TextDocument.getPageCount(document);
+ }
else if (doc.appType.equals(TypeDetection.IMPRESS_DOC))
+ {
doc.pages = OfficeDocument.getSlideCount(document);
+ }
else if (doc.appType.equals(TypeDetection.DRAW_DOC))
+ {
doc.pages = OfficeDocument.getSlideCount(document);
+ }
}
- public void init(CGExporter exporter_) {
+ public void init(CGExporter exporter_)
+ {
exporter = exporter_;
}
- protected FileAccess getFileAccess(XMultiServiceFactory xmsf) {
- if ( fileAccess == null )
- try {
+ protected FileAccess getFileAccess(XMultiServiceFactory xmsf)
+ {
+ if (fileAccess == null)
+ {
+ try
+ {
fileAccess = new FileAccess(xmsf);
}
- catch (Exception ex) {}
+ catch (Exception ex)
+ {
+ }
+ }
return fileAccess;
}
- protected void calcFileSize(CGDocument doc, String url, XMultiServiceFactory xmsf) {
+ protected void calcFileSize(CGDocument doc, String url, XMultiServiceFactory xmsf)
+ {
/*if the exporter exports to a
* binary format, get the size of the destination.
*/
if (exporter.cp_Binary)
+ {
doc.sizeBytes = getFileAccess(xmsf).getSize(url);
-
+ }
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java b/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java
index b2ab482c8e03..a785e6ce3019 100644
--- a/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java
+++ b/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java
@@ -1,4 +1,36 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ConfiguredExporter.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/*
* Created on 31.10.2003
*
* To change the template for this generated file go to
@@ -17,37 +49,54 @@ import com.sun.star.wizards.web.data.CGExporter;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class ConfiguredExporter extends FilterExporter {
+public class ConfiguredExporter extends FilterExporter
+{
/* (non-Javadoc)
- * @see com.sun.star.wizards.web.export.Exporter#init(com.sun.star.wizards.web.data.CGExporter)
- */
- public void init(CGExporter exporter) {
+ * @see com.sun.star.wizards.web.export.Exporter#init(com.sun.star.wizards.web.data.CGExporter)
+ */
+ public void init(CGExporter exporter)
+ {
super.init(exporter);
- for (Iterator i = exporter.cp_Arguments.keys().iterator(); i.hasNext();) {
+ for (Iterator i = exporter.cp_Arguments.keys().iterator(); i.hasNext();)
+ {
Object key = i.next();
- if (!key.equals("Filter")) {
+ if (!key.equals("Filter"))
+ {
Object value = exporter.cp_Arguments.getElement(key);
- props.put(key,cast( ((CGArgument)value).cp_Value ));
+ props.put(key, cast(((CGArgument) value).cp_Value));
}
}
}
- private Object cast(String s) {
+ private Object cast(String s)
+ {
String s1 = s.substring(1);
char c = s.charAt(0);
- switch (c) {
- case '$' : return s1;
- case '%' : return Integer.valueOf(s1);
- case '#' : return Short.valueOf(s1);
- case '&' : return Double.valueOf(s1);
- case 'f' : if (s.equals("false")) return Boolean.FALSE;
- break;
- case 't' : if (s.equals("true")) return Boolean.TRUE;
- break;
+ switch (c)
+ {
+ case '$':
+ return s1;
+ case '%':
+ return Integer.valueOf(s1);
+ case '#':
+ return Short.valueOf(s1);
+ case '&':
+ return Double.valueOf(s1);
+ case 'f':
+ if (s.equals("false"))
+ {
+ return Boolean.FALSE;
+ }
+ break;
+ case 't':
+ if (s.equals("true"))
+ {
+ return Boolean.TRUE;
+ }
+ break;
}
return null;
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/export/CopyExporter.java b/wizards/com/sun/star/wizards/web/export/CopyExporter.java
index 1fa2886b0cb0..6555424efcf0 100644
--- a/wizards/com/sun/star/wizards/web/export/CopyExporter.java
+++ b/wizards/com/sun/star/wizards/web/export/CopyExporter.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: CopyExporter.java,v $
+ *
+ * $Revision: 1.4.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Created on 17.10.2003
*
* To change the template for this generated file go to
@@ -17,14 +48,16 @@ import com.sun.star.wizards.web.data.CGDocument;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class CopyExporter extends AbstractExporter{
-
+public class CopyExporter extends AbstractExporter
+{
/* (non-Javadoc)
* @see com.sun.star.wizards.web.export.Exporter#export(java.lang.Object, java.io.File, com.sun.star.wizards.web.data.CGSettings, com.sun.star.lang.XMultiServiceFactory)
*/
- public boolean export(CGDocument source, String target,XMultiServiceFactory xmsf, Task task) {
- try {
+ public boolean export(CGDocument source, String target, XMultiServiceFactory xmsf, Task task)
+ {
+ try
+ {
task.advance(true);
@@ -32,28 +65,28 @@ public class CopyExporter extends AbstractExporter{
* this will open the document, and calculate the pages/slides number
* in it.
*/
- if (exporter.cp_PageType > 0) {
- closeDocument(openDocument(source,xmsf),xmsf);
+ if (exporter.cp_PageType > 0)
+ {
+ closeDocument(openDocument(source, xmsf), xmsf);
}
task.advance(true);
String newTarget = FileAccess.connectURLs(
- FileAccess.getParentDir(target) , source.urlFilename) ;
+ FileAccess.getParentDir(target), source.urlFilename);
boolean b = getFileAccess(xmsf).copy(source.cp_URL, newTarget);
task.advance(true);
- calcFileSize(source,newTarget,xmsf);
+ calcFileSize(source, newTarget, xmsf);
return b;
}
- catch (Exception ex) {
+ catch (Exception ex)
+ {
return false;
}
}
-
-
}
diff --git a/wizards/com/sun/star/wizards/web/export/Exporter.java b/wizards/com/sun/star/wizards/web/export/Exporter.java
index 0f88ad05d008..84a6540ceb78 100644
--- a/wizards/com/sun/star/wizards/web/export/Exporter.java
+++ b/wizards/com/sun/star/wizards/web/export/Exporter.java
@@ -26,19 +26,21 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
- ************************************************************************/package com.sun.star.wizards.web.export;
+ ************************************************************************/
+package com.sun.star.wizards.web.export;
import com.sun.star.io.IOException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.ui.event.Task;
import com.sun.star.wizards.web.data.*;
-
/**
*
* @author rpiterman
*/
-public interface Exporter {
+public interface Exporter
+{
+
/**
* This method exports a document with a specified filter.<br/>
* The method is responsible for exporting the given source document
@@ -55,7 +57,7 @@ public interface Exporter {
* (call task.advacne(true) ) 3 times, while exporting.
*
*/
- public boolean export(CGDocument source, String targetDirectory ,XMultiServiceFactory xmsf, Task task) throws IOException;
+ public boolean export(CGDocument source, String targetDirectory, XMultiServiceFactory xmsf, Task task) throws IOException;
public void init(CGExporter exporter);
}
diff --git a/wizards/com/sun/star/wizards/web/export/FilterExporter.java b/wizards/com/sun/star/wizards/web/export/FilterExporter.java
index 06a7cb22177b..1784f159f05c 100644
--- a/wizards/com/sun/star/wizards/web/export/FilterExporter.java
+++ b/wizards/com/sun/star/wizards/web/export/FilterExporter.java
@@ -1,5 +1,5 @@
/*************************************************************************
-*
+ *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
@@ -26,7 +26,7 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
-************************************************************************/
+ ************************************************************************/
package com.sun.star.wizards.web.export;
import com.sun.star.io.IOException;
@@ -42,7 +42,8 @@ import com.sun.star.wizards.web.data.CGExporter;
* An exporter which is configured with a filter name, and
* uses the specified filter to export documents.
*/
-public class FilterExporter extends AbstractExporter {
+public class FilterExporter extends AbstractExporter
+{
protected String filterName;
protected Properties props = new Properties();
@@ -50,26 +51,30 @@ public class FilterExporter extends AbstractExporter {
/* (non-Javadoc)
* @see com.sun.star.wizards.web.export.Exporter#export(java.lang.Object, java.io.File, com.sun.star.wizards.web.data.CGSettings, com.sun.star.lang.XMultiServiceFactory)
*/
- public boolean export( CGDocument source, String target, XMultiServiceFactory xmsf, Task task) throws IOException {
+ public boolean export(CGDocument source, String target, XMultiServiceFactory xmsf, Task task) throws IOException
+ {
boolean result = true;
Object document = null;
- try {
- document = openDocument(source,xmsf);
- task.advance(true);
- storeToURL(document,target, filterName, props.getProperties());
- task.advance(true);
+ try
+ {
+ document = openDocument(source, xmsf);
+ task.advance(true);
+ storeToURL(document, target, filterName, props.getProperties());
+ task.advance(true);
}
- catch (IOException iox) {
+ catch (IOException iox)
+ {
iox.printStackTrace(System.out);
result = false;
throw iox;
}
- finally {
- closeDocument(document,xmsf);
- calcFileSize(source,target,xmsf);
+ finally
+ {
+ closeDocument(document, xmsf);
+ calcFileSize(source, target, xmsf);
task.advance(true);
}
return result;
@@ -79,9 +84,9 @@ public class FilterExporter extends AbstractExporter {
/* (non-Javadoc)
* @see com.sun.star.wizards.web.export.Exporter#init(com.sun.star.wizards.web.data.CGExporter)
*/
- public void init(CGExporter exporter_) {
+ public void init(CGExporter exporter_)
+ {
super.init(exporter_);
- filterName = getArgument("Filter",exporter_);
+ filterName = getArgument("Filter", exporter_);
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java b/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java
index debe63c85ccc..ebecaa8c42d4 100644
--- a/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java
+++ b/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java
@@ -41,13 +41,15 @@ import com.sun.star.wizards.web.data.CGSession;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class ImpressHTMLExporter extends ConfiguredExporter {
+public class ImpressHTMLExporter extends ConfiguredExporter
+{
private static final Integer SMALL_IMAGE = new Integer(512);
private static final Integer MEDIUM_IMAGE = new Integer(640);
private static final Integer LARGE_IMAGE = new Integer(800);
- public boolean export(CGDocument source, String targetDirectory ,XMultiServiceFactory xmsf, Task task) throws IOException {
+ public boolean export(CGDocument source, String targetDirectory, XMultiServiceFactory xmsf, Task task) throws IOException
+ {
/* here set some filter specific properties.
* other properties, which are not dependant on
@@ -57,12 +59,12 @@ public class ImpressHTMLExporter extends ConfiguredExporter {
CGSession session = getSession(source);
- props.put("Author",source.cp_Author);
- props.put("Email",session.cp_GeneralInfo.cp_Email);
- props.put("HomepageURL",getHomepageURL(session));
- props.put("UserText",source.cp_Title);
+ props.put("Author", source.cp_Author);
+ props.put("Email", session.cp_GeneralInfo.cp_Email);
+ props.put("HomepageURL", getHomepageURL(session));
+ props.put("UserText", source.cp_Title);
- props.put("Width",getImageWidth(session));
+ props.put("Width", getImageWidth(session));
/*
* props.put("BackColor",...);
@@ -71,7 +73,7 @@ public class ImpressHTMLExporter extends ConfiguredExporter {
* props.put("VLinkColor",...);
* props.put("ALinkColor",...);
*/
- props.put("UseButtonSet",new Integer(session.cp_Design.cp_IconSet));
+ props.put("UseButtonSet", new Integer(session.cp_Design.cp_IconSet));
//now export
@@ -79,22 +81,28 @@ public class ImpressHTMLExporter extends ConfiguredExporter {
}
- private String getHomepageURL(CGSession session) {
+ private String getHomepageURL(CGSession session)
+ {
return "../" +
- ( exporter.cp_OwnDirectory ? "../index.html" : "index.html" ) ;
+ (exporter.cp_OwnDirectory ? "../index.html" : "index.html");
}
- private Integer getImageWidth(CGSession session) {
- switch (session.cp_Design.cp_OptimizeDisplaySize) {
- case 0 : return SMALL_IMAGE;
- case 1 : return MEDIUM_IMAGE;
- case 2 : return LARGE_IMAGE;
+ private Integer getImageWidth(CGSession session)
+ {
+ switch (session.cp_Design.cp_OptimizeDisplaySize)
+ {
+ case 0:
+ return SMALL_IMAGE;
+ case 1:
+ return MEDIUM_IMAGE;
+ case 2:
+ return LARGE_IMAGE;
}
return MEDIUM_IMAGE;
}
- private CGSession getSession(CGDocument doc) {
+ private CGSession getSession(CGDocument doc)
+ {
return doc.getSettings().cp_DefaultSession;
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/status/ErrorLog.java b/wizards/com/sun/star/wizards/web/status/ErrorLog.java
index 17746ffe9ec6..982e36cf8ad5 100644
--- a/wizards/com/sun/star/wizards/web/status/ErrorLog.java
+++ b/wizards/com/sun/star/wizards/web/status/ErrorLog.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ErrorLog.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Created on 04.11.2003
*
* To change the template for this generated file go to
@@ -15,27 +46,28 @@ import java.util.Vector;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class ErrorLog implements ErrorReporter {
+public class ErrorLog implements ErrorReporter
+{
private List errors = new Vector();
- public void error(Exception ex, Object obj, String s) {
- errors.add(new Err(ex,obj,s));
+ public void error(Exception ex, Object obj, String s)
+ {
+ errors.add(new Err(ex, obj, s));
}
- public class Err {
+ public class Err
+ {
+
public Exception exception;
public Object argument;
public String string;
- public Err(Exception ex, Object arg, String s) {
+ public Err(Exception ex, Object arg, String s)
+ {
exception = ex;
argument = arg;
string = s;
}
-
}
-
-
-
}
diff --git a/wizards/com/sun/star/wizards/web/status/ErrorReporter.java b/wizards/com/sun/star/wizards/web/status/ErrorReporter.java
index 0c6fe3e96d13..327e6384d754 100644
--- a/wizards/com/sun/star/wizards/web/status/ErrorReporter.java
+++ b/wizards/com/sun/star/wizards/web/status/ErrorReporter.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ErrorReporter.java,v $
+ *
+ * $Revision: 1.2.412.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Created on 14.10.2003
*
* To change the template for this generated file go to
@@ -12,6 +43,8 @@ package com.sun.star.wizards.web.status;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public interface ErrorReporter {
- public void error(Exception ex, Object arg, String st);
+public interface ErrorReporter
+{
+
+ public void error(Exception ex, Object arg, String st);
}
diff --git a/wizards/com/sun/star/wizards/web/status/LogTaskListener.java b/wizards/com/sun/star/wizards/web/status/LogTaskListener.java
index 5a28c7c24f6c..27bf9aa62dfb 100644
--- a/wizards/com/sun/star/wizards/web/status/LogTaskListener.java
+++ b/wizards/com/sun/star/wizards/web/status/LogTaskListener.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LogTaskListener.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Created on 04.11.2003
*
* To change the template for this generated file go to
@@ -14,47 +45,47 @@ import java.io.PrintStream;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class LogTaskListener implements TaskListener {
+public class LogTaskListener implements TaskListener
+{
private PrintStream out;
- public LogTaskListener(PrintStream os) {
+ public LogTaskListener(PrintStream os)
+ {
out = os;
}
/* (non-Javadoc)
* @see com.sun.star.wizards.web.status.TaskListener#taskStarted(com.sun.star.wizards.web.status.TaskEvent)
*/
- public void taskStarted(TaskEvent te) {
- out.println("TASK " + te.getTask().getTaskName()
- + " STARTED.");
+ public void taskStarted(TaskEvent te)
+ {
+ out.println("TASK " + te.getTask().getTaskName() + " STARTED.");
}
/* (non-Javadoc)
* @see com.sun.star.wizards.web.status.TaskListener#taskFinished(com.sun.star.wizards.web.status.TaskEvent)
*/
- public void taskFinished(TaskEvent te) {
- out.println("TASK " + te.getTask().getTaskName()
- + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded.");
+ public void taskFinished(TaskEvent te)
+ {
+ out.println("TASK " + te.getTask().getTaskName() + " FINISHED: " + te.getTask().getSuccessfull() + "/" + te.getTask().getMax() + "Succeeded.");
}
/* (non-Javadoc)
* @see com.sun.star.wizards.web.status.TaskListener#taskStatusChanged(com.sun.star.wizards.web.status.TaskEvent)
*/
- public void taskStatusChanged(TaskEvent te) {
- out.println("TASK " + te.getTask().getTaskName()
- + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax());
+ public void taskStatusChanged(TaskEvent te)
+ {
+ out.println("TASK " + te.getTask().getTaskName() + " status : " + te.getTask().getSuccessfull() + "(+" + te.getTask().getFailed() + ")/" + te.getTask().getMax());
}
/* (non-Javadoc)
* @see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent)
*/
- public void subtaskNameChanged(TaskEvent te) {
+ public void subtaskNameChanged(TaskEvent te)
+ {
out.println("SUBTASK Name:" + te.getTask().getSubtaskName());
}
-
-
-
}
diff --git a/wizards/com/sun/star/wizards/web/status/Task.java b/wizards/com/sun/star/wizards/web/status/Task.java
index 6f370c272e9a..5b3e8ddb7a88 100644
--- a/wizards/com/sun/star/wizards/web/status/Task.java
+++ b/wizards/com/sun/star/wizards/web/status/Task.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Task.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Created on 17.10.2003
*
* To change the template for this generated file go to
@@ -15,111 +46,138 @@ import java.util.Vector;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class Task {
+public class Task
+{
+
private int successfull = 0;
private int failed = 0;
-
private int max = 0;
private String taskName;
private List listeners = new Vector();
private String subtaskName;
-
- public Task(String taskName_ , String subtaskName_, int max_) {
+ public Task(String taskName_, String subtaskName_, int max_)
+ {
taskName = taskName_;
subtaskName = subtaskName_;
max = max_;
}
- public void start() {
+ public void start()
+ {
fireTaskStarted();
}
- public int getMax() {
+ public int getMax()
+ {
return max;
}
- public void setMax(int max_) {
+ public void setMax(int max_)
+ {
max = max_;
fireTaskStatusChanged();
}
- public void advance(boolean success_) {
- if (success_) successfull++;
- else failed++;
+ public void advance(boolean success_)
+ {
+ if (success_)
+ {
+ successfull++;
+ }
+ else
+ {
+ failed++;
+ }
fireTaskStatusChanged();
- if (failed+successfull == max)
- fireTaskFinished();
+ if (failed + successfull == max)
+ {
+ fireTaskFinished();
+ }
}
- public void advance(boolean success_, String nextSubtaskName) {
+ public void advance(boolean success_, String nextSubtaskName)
+ {
advance(success_);
setSubtaskName(nextSubtaskName);
}
-
-
- public int getStatus() {
- return successfull+failed;
+ public int getStatus()
+ {
+ return successfull + failed;
}
- public void addTaskListener(TaskListener tl) {
+ public void addTaskListener(TaskListener tl)
+ {
listeners.add(tl);
}
- public void removeTaskListener(TaskListener tl) {
+ public void removeTaskListener(TaskListener tl)
+ {
listeners.remove(tl);
}
- protected void fireTaskStatusChanged() {
+ protected void fireTaskStatusChanged()
+ {
TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STATUS_CHANGED);
- for (int i = 0; i<listeners.size(); i++)
- ((TaskListener)listeners.get(i)).taskStatusChanged(te);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((TaskListener) listeners.get(i)).taskStatusChanged(te);
+ }
}
- protected void fireTaskStarted() {
+ protected void fireTaskStarted()
+ {
TaskEvent te = new TaskEvent(this, TaskEvent.TASK_STARTED);
- for (int i = 0; i<listeners.size(); i++)
- ((TaskListener)listeners.get(i)).taskStarted(te);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((TaskListener) listeners.get(i)).taskStarted(te);
+ }
}
- protected void fireTaskFinished() {
+ protected void fireTaskFinished()
+ {
TaskEvent te = new TaskEvent(this, TaskEvent.TASK_FINISHED);
- for (int i = 0; i<listeners.size(); i++)
- ((TaskListener)listeners.get(i)).taskFinished(te);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((TaskListener) listeners.get(i)).taskFinished(te);
+ }
}
- protected void fireSubtaskNameChanged() {
- TaskEvent te = new TaskEvent(this, TaskEvent.SUBTASK_NAME_CHANGED);
+ protected void fireSubtaskNameChanged()
+ {
+ TaskEvent te = new TaskEvent(this, TaskEvent.SUBTASK_NAME_CHANGED);
- for (int i = 0; i<listeners.size(); i++)
- ((TaskListener)listeners.get(i)).subtaskNameChanged(te);
+ for (int i = 0; i < listeners.size(); i++)
+ {
+ ((TaskListener) listeners.get(i)).subtaskNameChanged(te);
}
-
-
-
+ }
/**
* @return
*/
- public String getSubtaskName() {
+ public String getSubtaskName()
+ {
return subtaskName;
}
/**
* @return
*/
- public String getTaskName() {
+ public String getTaskName()
+ {
return taskName;
}
/**
* @param string
*/
- public void setSubtaskName(String string) {
+ public void setSubtaskName(String string)
+ {
subtaskName = string;
fireSubtaskNameChanged();
}
@@ -127,15 +185,16 @@ public class Task {
/**
* @return
*/
- public int getFailed() {
+ public int getFailed()
+ {
return failed;
}
/**
* @return
*/
- public int getSuccessfull() {
+ public int getSuccessfull()
+ {
return successfull;
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/status/TaskEvent.java b/wizards/com/sun/star/wizards/web/status/TaskEvent.java
index 549c826d388b..fdde3287ebe3 100644
--- a/wizards/com/sun/star/wizards/web/status/TaskEvent.java
+++ b/wizards/com/sun/star/wizards/web/status/TaskEvent.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TaskEvent.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Created on 04.11.2003
*
* To change the template for this generated file go to
@@ -14,13 +45,13 @@ import java.util.EventObject;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public class TaskEvent extends EventObject {
+public class TaskEvent extends EventObject
+{
public static final int TASK_STARTED = 1;
public static final int TASK_FINISHED = 2;
public static final int TASK_STATUS_CHANGED = 3;
public static final int SUBTASK_NAME_CHANGED = 4;
-
private int type;
/**
@@ -31,13 +62,14 @@ public class TaskEvent extends EventObject {
* @param success_
* @param failed_
*/
- public TaskEvent(Task source, int type_) {
+ public TaskEvent(Task source, int type_)
+ {
super(source);
type = type_;
}
- public Task getTask() {
- return (Task)getSource();
+ public Task getTask()
+ {
+ return (Task) getSource();
}
-
}
diff --git a/wizards/com/sun/star/wizards/web/status/TaskListener.java b/wizards/com/sun/star/wizards/web/status/TaskListener.java
index c702233fd061..09af02e19ce8 100644
--- a/wizards/com/sun/star/wizards/web/status/TaskListener.java
+++ b/wizards/com/sun/star/wizards/web/status/TaskListener.java
@@ -1,4 +1,35 @@
/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TaskListener.java,v $
+ *
+ * $Revision: 1.3.192.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/*
* Created on 04.11.2003
*
* To change the template for this generated file go to
@@ -14,7 +45,8 @@ import java.util.EventListener;
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
-public interface TaskListener extends EventListener {
+public interface TaskListener extends EventListener
+{
public void taskStarted(TaskEvent te);
@@ -27,5 +59,4 @@ public interface TaskListener extends EventListener {
public void taskStatusChanged(TaskEvent te);
public void subtaskNameChanged(TaskEvent te);
-
}