summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaTemplate.java1961
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java384
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java107
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java597
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java221
-rw-r--r--wizards/com/sun/star/wizards/agenda/CGAgenda.java83
-rw-r--r--wizards/com/sun/star/wizards/agenda/CGTopic.java87
-rw-r--r--wizards/com/sun/star/wizards/agenda/CallWizard.java240
-rw-r--r--wizards/com/sun/star/wizards/agenda/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/agenda/TemplateConsts.java146
-rw-r--r--wizards/com/sun/star/wizards/agenda/TopicsControl.java1320
-rw-r--r--wizards/com/sun/star/wizards/agenda/makefile.mk71
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigGroup.java183
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigNode.java53
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigSet.java452
-rw-r--r--wizards/com/sun/star/wizards/common/Configuration.java457
-rw-r--r--wizards/com/sun/star/wizards/common/DebugHelper.java58
-rw-r--r--wizards/com/sun/star/wizards/common/Desktop.java509
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.java1200
-rw-r--r--wizards/com/sun/star/wizards/common/Helper.java444
-rw-r--r--wizards/com/sun/star/wizards/common/IRenderer.java40
-rw-r--r--wizards/com/sun/star/wizards/common/Indexable.java44
-rw-r--r--wizards/com/sun/star/wizards/common/InvalidQueryException.java40
-rw-r--r--wizards/com/sun/star/wizards/common/JavaTools.java785
-rw-r--r--wizards/com/sun/star/wizards/common/MANIFEST.MF1
-rw-r--r--wizards/com/sun/star/wizards/common/NamedValueCollection.java90
-rw-r--r--wizards/com/sun/star/wizards/common/NoValidPathException.java44
-rw-r--r--wizards/com/sun/star/wizards/common/NumberFormatter.java333
-rw-r--r--wizards/com/sun/star/wizards/common/NumericalHelper.java1625
-rw-r--r--wizards/com/sun/star/wizards/common/Properties.java126
-rw-r--r--wizards/com/sun/star/wizards/common/PropertySetHelper.java396
-rw-r--r--wizards/com/sun/star/wizards/common/Resource.java143
-rw-r--r--wizards/com/sun/star/wizards/common/SystemDialog.java428
-rw-r--r--wizards/com/sun/star/wizards/common/TerminateWizardException.java43
-rw-r--r--wizards/com/sun/star/wizards/common/UCB.java269
-rw-r--r--wizards/com/sun/star/wizards/common/XMLHelper.java74
-rw-r--r--wizards/com/sun/star/wizards/common/XMLProvider.java46
-rw-r--r--wizards/com/sun/star/wizards/common/delzip0
-rw-r--r--wizards/com/sun/star/wizards/db/BlindtextCreator.java113
-rw-r--r--wizards/com/sun/star/wizards/db/ColumnPropertySet.java213
-rw-r--r--wizards/com/sun/star/wizards/db/CommandMetaData.java772
-rw-r--r--wizards/com/sun/star/wizards/db/CommandName.java267
-rw-r--r--wizards/com/sun/star/wizards/db/DBMetaData.java1121
-rw-r--r--wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java75
-rw-r--r--wizards/com/sun/star/wizards/db/FieldColumn.java471
-rw-r--r--wizards/com/sun/star/wizards/db/MANIFEST.MF0
-rw-r--r--wizards/com/sun/star/wizards/db/QueryMetaData.java300
-rw-r--r--wizards/com/sun/star/wizards/db/RecordParser.java306
-rw-r--r--wizards/com/sun/star/wizards/db/RelationController.java161
-rw-r--r--wizards/com/sun/star/wizards/db/SQLQueryComposer.java433
-rw-r--r--wizards/com/sun/star/wizards/db/TableDescriptor.java861
-rw-r--r--wizards/com/sun/star/wizards/db/TypeInspector.java465
-rw-r--r--wizards/com/sun/star/wizards/document/Control.java359
-rw-r--r--wizards/com/sun/star/wizards/document/DatabaseControl.java269
-rw-r--r--wizards/com/sun/star/wizards/document/FormHandler.java594
-rw-r--r--wizards/com/sun/star/wizards/document/GridControl.java93
-rw-r--r--wizards/com/sun/star/wizards/document/OfficeDocument.java457
-rw-r--r--wizards/com/sun/star/wizards/document/Shape.java142
-rw-r--r--wizards/com/sun/star/wizards/document/TimeStampControl.java172
-rw-r--r--wizards/com/sun/star/wizards/fax/CGFax.java60
-rw-r--r--wizards/com/sun/star/wizards/fax/CGFaxWizard.java38
-rw-r--r--wizards/com/sun/star/wizards/fax/CallWizard.java257
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxDocument.java212
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialog.java628
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.java115
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java873
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java182
-rw-r--r--wizards/com/sun/star/wizards/fax/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/fax/makefile.mk62
-rw-r--r--wizards/com/sun/star/wizards/form/CallFormWizard.java221
-rw-r--r--wizards/com/sun/star/wizards/form/DataEntrySetter.java147
-rw-r--r--wizards/com/sun/star/wizards/form/FieldLinker.java312
-rw-r--r--wizards/com/sun/star/wizards/form/Finalizer.java139
-rw-r--r--wizards/com/sun/star/wizards/form/FormConfiguration.java241
-rw-r--r--wizards/com/sun/star/wizards/form/FormControlArranger.java731
-rw-r--r--wizards/com/sun/star/wizards/form/FormDocument.java594
-rw-r--r--wizards/com/sun/star/wizards/form/FormWizard.java481
-rw-r--r--wizards/com/sun/star/wizards/form/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/form/StyleApplier.java494
-rw-r--r--wizards/com/sun/star/wizards/form/UIControlArranger.java504
-rw-r--r--wizards/com/sun/star/wizards/form/makefile.mk67
-rw-r--r--wizards/com/sun/star/wizards/letter/CGLetter.java66
-rw-r--r--wizards/com/sun/star/wizards/letter/CGLetterWizard.java39
-rw-r--r--wizards/com/sun/star/wizards/letter/CGPaperElementLocation.java40
-rw-r--r--wizards/com/sun/star/wizards/letter/CallWizard.java257
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterDocument.java330
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialog.java913
-rwxr-xr-xwizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java93
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java89
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java1543
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java207
-rw-r--r--wizards/com/sun/star/wizards/letter/LocaleCodes.java202
-rw-r--r--wizards/com/sun/star/wizards/letter/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/letter/makefile.mk65
-rw-r--r--wizards/com/sun/star/wizards/makefile.mk149
-rw-r--r--wizards/com/sun/star/wizards/query/CallQueryWizard.java230
-rw-r--r--wizards/com/sun/star/wizards/query/Finalizer.java195
-rw-r--r--wizards/com/sun/star/wizards/query/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/query/QuerySummary.java254
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java503
-rw-r--r--wizards/com/sun/star/wizards/query/makefile.mk61
-rw-r--r--wizards/com/sun/star/wizards/report/CallReportWizard.java281
-rw-r--r--wizards/com/sun/star/wizards/report/DBColumn.java482
-rw-r--r--wizards/com/sun/star/wizards/report/Dataimport.java222
-rw-r--r--wizards/com/sun/star/wizards/report/GroupFieldHandler.java196
-rwxr-xr-xwizards/com/sun/star/wizards/report/IReportBuilderLayouter.java119
-rwxr-xr-xwizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java61
-rw-r--r--wizards/com/sun/star/wizards/report/IReportDocument.java268
-rw-r--r--wizards/com/sun/star/wizards/report/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/report/RecordTable.java99
-rw-r--r--wizards/com/sun/star/wizards/report/ReportFinalizer.java293
-rw-r--r--wizards/com/sun/star/wizards/report/ReportImplementationHelper.java68
-rw-r--r--wizards/com/sun/star/wizards/report/ReportLayouter.java341
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextDocument.java786
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextImplementation.java734
-rw-r--r--wizards/com/sun/star/wizards/report/ReportWizard.java761
-rw-r--r--wizards/com/sun/star/wizards/report/delzip0
-rw-r--r--wizards/com/sun/star/wizards/report/makefile.mk68
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/Manifest.mf2
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java748
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java105
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java62
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java137
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java333
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java166
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java133
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java52
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java1693
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java55
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java74
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java86
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java67
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java154
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/makefile.mk71
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/makefile.mk55
-rw-r--r--wizards/com/sun/star/wizards/table/CGCategory.java88
-rw-r--r--wizards/com/sun/star/wizards/table/CGTable.java95
-rw-r--r--wizards/com/sun/star/wizards/table/CallTableWizard.java228
-rw-r--r--wizards/com/sun/star/wizards/table/FieldDescription.java176
-rw-r--r--wizards/com/sun/star/wizards/table/FieldFormatter.java433
-rw-r--r--wizards/com/sun/star/wizards/table/Finalizer.java364
-rw-r--r--wizards/com/sun/star/wizards/table/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java460
-rw-r--r--wizards/com/sun/star/wizards/table/ScenarioSelector.java385
-rw-r--r--wizards/com/sun/star/wizards/table/TableWizard.java438
-rw-r--r--wizards/com/sun/star/wizards/table/makefile.mk65
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.java483
-rw-r--r--wizards/com/sun/star/wizards/text/TextFieldHandler.java348
-rw-r--r--wizards/com/sun/star/wizards/text/TextFrameHandler.java51
-rw-r--r--wizards/com/sun/star/wizards/text/TextSectionHandler.java271
-rw-r--r--wizards/com/sun/star/wizards/text/TextStyleHandler.java114
-rw-r--r--wizards/com/sun/star/wizards/text/TextTableHandler.java253
-rw-r--r--wizards/com/sun/star/wizards/text/ViewHandler.java115
-rw-r--r--wizards/com/sun/star/wizards/ui/AggregateComponent.java611
-rw-r--r--wizards/com/sun/star/wizards/ui/ButtonList.java908
-rw-r--r--wizards/com/sun/star/wizards/ui/CommandFieldSelection.java474
-rw-r--r--wizards/com/sun/star/wizards/ui/ControlScroller.java509
-rw-r--r--wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java158
-rw-r--r--wizards/com/sun/star/wizards/ui/DocumentPreview.java186
-rw-r--r--wizards/com/sun/star/wizards/ui/FieldSelection.java697
-rw-r--r--wizards/com/sun/star/wizards/ui/FilterComponent.java1089
-rw-r--r--wizards/com/sun/star/wizards/ui/ImageList.java1133
-rwxr-xr-xwizards/com/sun/star/wizards/ui/PathSelection.java188
-rw-r--r--wizards/com/sun/star/wizards/ui/PeerConfig.java261
-rw-r--r--wizards/com/sun/star/wizards/ui/SortingComponent.java384
-rw-r--r--wizards/com/sun/star/wizards/ui/TitlesComponent.java249
-rw-r--r--wizards/com/sun/star/wizards/ui/UIConsts.java83
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog.java1148
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog2.java384
-rw-r--r--wizards/com/sun/star/wizards/ui/WizardDialog.java811
-rw-r--r--wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java43
-rw-r--r--wizards/com/sun/star/wizards/ui/XCompletion.java39
-rw-r--r--wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java53
-rwxr-xr-xwizards/com/sun/star/wizards/ui/XPathSelectionListener.java34
-rw-r--r--wizards/com/sun/star/wizards/ui/event/AbstractListener.java133
-rw-r--r--wizards/com/sun/star/wizards/ui/event/CommonListener.java167
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAware.java365
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAwareFields.java507
-rw-r--r--wizards/com/sun/star/wizards/ui/event/EventNames.java52
-rw-r--r--wizards/com/sun/star/wizards/ui/event/ListModelBinder.java209
-rw-r--r--wizards/com/sun/star/wizards/ui/event/MethodInvocation.java108
-rw-r--r--wizards/com/sun/star/wizards/ui/event/RadioDataAware.java101
-rw-r--r--wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java84
-rw-r--r--wizards/com/sun/star/wizards/ui/event/Task.java204
-rw-r--r--wizards/com/sun/star/wizards/ui/event/TaskEvent.java65
-rw-r--r--wizards/com/sun/star/wizards/ui/event/TaskListener.java51
-rw-r--r--wizards/com/sun/star/wizards/ui/event/UnoDataAware.java265
-rw-r--r--wizards/com/sun/star/wizards/web/AbstractErrorHandler.java238
-rw-r--r--wizards/com/sun/star/wizards/web/BackgroundsDialog.java290
-rw-r--r--wizards/com/sun/star/wizards/web/CallWizard.java312
-rw-r--r--wizards/com/sun/star/wizards/web/ErrorHandler.java117
-rw-r--r--wizards/com/sun/star/wizards/web/ExtensionVerifier.java63
-rw-r--r--wizards/com/sun/star/wizards/web/FTPDialog.java751
-rw-r--r--wizards/com/sun/star/wizards/web/FTPDialogResources.java98
-rw-r--r--wizards/com/sun/star/wizards/web/IconsDialog.java208
-rw-r--r--wizards/com/sun/star/wizards/web/ImageListDialog.java282
-rw-r--r--wizards/com/sun/star/wizards/web/LogTaskListener.java103
-rw-r--r--wizards/com/sun/star/wizards/web/MANIFEST.MF2
-rw-r--r--wizards/com/sun/star/wizards/web/Process.java844
-rw-r--r--wizards/com/sun/star/wizards/web/ProcessErrorHandler.java92
-rw-r--r--wizards/com/sun/star/wizards/web/ProcessErrors.java48
-rw-r--r--wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java68
-rw-r--r--wizards/com/sun/star/wizards/web/StatusDialog.java305
-rw-r--r--wizards/com/sun/star/wizards/web/StylePreview.java154
-rw-r--r--wizards/com/sun/star/wizards/web/TOCPreview.java120
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_Events.java1305
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_General.java392
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_Startup.java984
-rw-r--r--wizards/com/sun/star/wizards/web/WWHID.java186
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizard.java72
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizardConst.java73
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizardDialog.java930
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizardDialogResources.java349
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGArgument.java35
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGContent.java68
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGDesign.java91
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGDocument.java453
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGExporter.java57
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGFilter.java35
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java92
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGIconSet.java35
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGImage.java45
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGLayout.java87
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGPublish.java94
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGSession.java110
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGSessionName.java38
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGSettings.java212
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGStyle.java54
-rw-r--r--wizards/com/sun/star/wizards/web/data/ConfigSetItem.java55
-rw-r--r--wizards/com/sun/star/wizards/web/data/TypeDetection.java79
-rw-r--r--wizards/com/sun/star/wizards/web/data/makefile.mk74
-rw-r--r--wizards/com/sun/star/wizards/web/export/AbstractExporter.java192
-rw-r--r--wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java98
-rw-r--r--wizards/com/sun/star/wizards/web/export/CopyExporter.java88
-rw-r--r--wizards/com/sun/star/wizards/web/export/Exporter.java61
-rw-r--r--wizards/com/sun/star/wizards/web/export/FilterExporter.java89
-rw-r--r--wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java105
-rw-r--r--wizards/com/sun/star/wizards/web/export/makefile.mk63
-rw-r--r--wizards/com/sun/star/wizards/web/makefile.mk85
-rw-r--r--wizards/com/sun/star/wizards/web/status/ErrorLog.java69
-rw-r--r--wizards/com/sun/star/wizards/web/status/ErrorReporter.java46
-rw-r--r--wizards/com/sun/star/wizards/web/status/LogTaskListener.java87
-rw-r--r--wizards/com/sun/star/wizards/web/status/Task.java196
-rw-r--r--wizards/com/sun/star/wizards/web/status/TaskEvent.java71
-rw-r--r--wizards/com/sun/star/wizards/web/status/TaskListener.java58
-rw-r--r--wizards/prj/build.lst28
-rw-r--r--wizards/prj/d.lst15
-rw-r--r--wizards/source/config/delzip0
-rw-r--r--wizards/source/config/dialog.xlc5
-rw-r--r--wizards/source/config/makefile.mk52
-rw-r--r--wizards/source/config/script.xlc5
-rw-r--r--wizards/source/configshare/delzip0
-rw-r--r--wizards/source/configshare/dialog.xlc13
-rw-r--r--wizards/source/configshare/makefile.mk52
-rw-r--r--wizards/source/configshare/script.xlc13
-rw-r--r--wizards/source/depot/CommonLang.xba351
-rw-r--r--wizards/source/depot/Currency.xba178
-rw-r--r--wizards/source/depot/Depot.xba500
-rw-r--r--wizards/source/depot/Dialog2.xdl36
-rw-r--r--wizards/source/depot/Dialog3.xdl45
-rw-r--r--wizards/source/depot/Dialog4.xdl17
-rw-r--r--wizards/source/depot/Internet.xba339
-rw-r--r--wizards/source/depot/Lang_de.xba158
-rw-r--r--wizards/source/depot/Lang_en.xba158
-rw-r--r--wizards/source/depot/Lang_es.xba158
-rw-r--r--wizards/source/depot/Lang_fr.xba158
-rw-r--r--wizards/source/depot/Lang_it.xba158
-rw-r--r--wizards/source/depot/Lang_ja.xba158
-rw-r--r--wizards/source/depot/Lang_ko.xba158
-rw-r--r--wizards/source/depot/Lang_sv.xba157
-rw-r--r--wizards/source/depot/Lang_tw.xba158
-rw-r--r--wizards/source/depot/Lang_zh.xba158
-rw-r--r--wizards/source/depot/delzip1
-rw-r--r--wizards/source/depot/dialog.xlb7
-rw-r--r--wizards/source/depot/makefile.mk53
-rw-r--r--wizards/source/depot/script.xlb19
-rw-r--r--wizards/source/depot/tools.xba200
-rw-r--r--wizards/source/euro/AutoPilotRun.xba409
-rw-r--r--wizards/source/euro/Common.xba272
-rw-r--r--wizards/source/euro/ConvertRun.xba317
-rw-r--r--wizards/source/euro/DlgConvert.xdl77
-rw-r--r--wizards/source/euro/DlgPassword.xdl15
-rw-r--r--wizards/source/euro/Hard.xba229
-rw-r--r--wizards/source/euro/Init.xba604
-rw-r--r--wizards/source/euro/Protect.xba175
-rw-r--r--wizards/source/euro/Soft.xba239
-rw-r--r--wizards/source/euro/Writer.xba72
-rw-r--r--wizards/source/euro/delzip0
-rw-r--r--wizards/source/euro/dialog.xlb6
-rw-r--r--wizards/source/euro/euro.src476
-rw-r--r--wizards/source/euro/makefile.mk53
-rw-r--r--wizards/source/euro/script.xlb12
-rw-r--r--wizards/source/formwizard/DBMeta.xba330
-rw-r--r--wizards/source/formwizard/DlgFormDB.xdl102
-rw-r--r--wizards/source/formwizard/FormWizard.xba427
-rw-r--r--wizards/source/formwizard/Language.xba285
-rw-r--r--wizards/source/formwizard/Layouter.xba380
-rw-r--r--wizards/source/formwizard/dbwizres.src3518
-rw-r--r--wizards/source/formwizard/delzip0
-rw-r--r--wizards/source/formwizard/develop.xba533
-rw-r--r--wizards/source/formwizard/dialog.xlb5
-rw-r--r--wizards/source/formwizard/makefile.mk53
-rw-r--r--wizards/source/formwizard/script.xlb10
-rw-r--r--wizards/source/formwizard/tools.xba349
-rw-r--r--wizards/source/gimmicks/AutoText.xba97
-rw-r--r--wizards/source/gimmicks/ChangeAllChars.xba75
-rw-r--r--wizards/source/gimmicks/GetTexts.xba522
-rw-r--r--wizards/source/gimmicks/ReadDir.xba305
-rw-r--r--wizards/source/gimmicks/ReadFolderDlg.xdl22
-rw-r--r--wizards/source/gimmicks/UserfieldDlg.xdl49
-rw-r--r--wizards/source/gimmicks/Userfields.xba219
-rw-r--r--wizards/source/gimmicks/delzip0
-rw-r--r--wizards/source/gimmicks/dialog.xlb6
-rw-r--r--wizards/source/gimmicks/makefile.mk46
-rw-r--r--wizards/source/gimmicks/readdirs.dlgbin0 -> 3180 bytes
-rw-r--r--wizards/source/gimmicks/script.xlb9
-rw-r--r--wizards/source/imagelists/imagelists.src215
-rw-r--r--wizards/source/imagelists/makefile.mk50
-rw-r--r--wizards/source/importwizard/API.xba208
-rw-r--r--wizards/source/importwizard/DialogModul.xba657
-rw-r--r--wizards/source/importwizard/FilesModul.xba824
-rw-r--r--wizards/source/importwizard/ImportDialog.xdl96
-rw-r--r--wizards/source/importwizard/Language.xba157
-rw-r--r--wizards/source/importwizard/Main.xba290
-rw-r--r--wizards/source/importwizard/delzip0
-rw-r--r--wizards/source/importwizard/dialog.xlb5
-rw-r--r--wizards/source/importwizard/importwi.src674
-rw-r--r--wizards/source/importwizard/makefile.mk53
-rw-r--r--wizards/source/importwizard/script.xlb9
-rw-r--r--wizards/source/launcher/DicOOo.xba59
-rw-r--r--wizards/source/launcher/delzip0
-rw-r--r--wizards/source/launcher/dialog.xlb3
-rw-r--r--wizards/source/launcher/makefile.mk46
-rw-r--r--wizards/source/launcher/script.xlb5
-rw-r--r--wizards/source/schedule/BankHoliday.xba177
-rw-r--r--wizards/source/schedule/CalendarMain.xba302
-rw-r--r--wizards/source/schedule/CreateTable.xba133
-rw-r--r--wizards/source/schedule/DlgCalendar.xdl64
-rw-r--r--wizards/source/schedule/DlgControl.xba148
-rw-r--r--wizards/source/schedule/GermanHolidays.xba132
-rw-r--r--wizards/source/schedule/Language.xba95
-rw-r--r--wizards/source/schedule/LocalHolidays.xba642
-rw-r--r--wizards/source/schedule/OwnEvents.xba217
-rw-r--r--wizards/source/schedule/delzip0
-rw-r--r--wizards/source/schedule/dialog.xlb5
-rw-r--r--wizards/source/schedule/makefile.mk53
-rw-r--r--wizards/source/schedule/schedule.src357
-rw-r--r--wizards/source/schedule/script.xlb12
-rw-r--r--wizards/source/standard/Module1.xba7
-rw-r--r--wizards/source/standard/delzip0
-rw-r--r--wizards/source/standard/dialog.xlb3
-rw-r--r--wizards/source/standard/makefile.mk45
-rw-r--r--wizards/source/standard/script.xlb5
-rw-r--r--wizards/source/template/Autotext.xba173
-rw-r--r--wizards/source/template/Correspondence.xba286
-rw-r--r--wizards/source/template/DialogStyles.xdl15
-rw-r--r--wizards/source/template/ModuleAgenda.xba203
-rw-r--r--wizards/source/template/Samples.xba185
-rw-r--r--wizards/source/template/TemplateDialog.xdl29
-rw-r--r--wizards/source/template/delzip0
-rw-r--r--wizards/source/template/dialog.xlb7
-rw-r--r--wizards/source/template/makefile.mk54
-rw-r--r--wizards/source/template/script.xlb8
-rw-r--r--wizards/source/template/template.src358
-rw-r--r--wizards/source/tools/Debug.xba236
-rw-r--r--wizards/source/tools/DlgOverwriteAll.xdl17
-rw-r--r--wizards/source/tools/Listbox.xba353
-rw-r--r--wizards/source/tools/Misc.xba817
-rw-r--r--wizards/source/tools/ModuleControls.xba370
-rw-r--r--wizards/source/tools/Strings.xba452
-rw-r--r--wizards/source/tools/UCB.xba294
-rw-r--r--wizards/source/tools/delzip0
-rw-r--r--wizards/source/tools/dialog.xlb5
-rw-r--r--wizards/source/tools/makefile.mk45
-rw-r--r--wizards/source/tools/script.xlb10
-rw-r--r--wizards/source/tutorials/Functions.xba368
-rw-r--r--wizards/source/tutorials/RoadMap.xba117
-rw-r--r--wizards/source/tutorials/ShowInfoDialog.xba305
-rw-r--r--wizards/source/tutorials/TutorialClose.xba15
-rw-r--r--wizards/source/tutorials/TutorialCloseDialog.xdl14
-rw-r--r--wizards/source/tutorials/TutorialCreator.xba10
-rw-r--r--wizards/source/tutorials/TutorialOpen.xba96
-rw-r--r--wizards/source/tutorials/TutorialOpenDialog.xdl21
-rw-r--r--wizards/source/tutorials/TutorialsDialog.xdl26
-rw-r--r--wizards/source/tutorials/delzip0
-rw-r--r--wizards/source/tutorials/dialog.xlb7
-rw-r--r--wizards/source/tutorials/makefile.mk45
-rw-r--r--wizards/source/tutorials/script.xlb10
-rw-r--r--wizards/source/webwizard/Bullets.xba117
-rw-r--r--wizards/source/webwizard/Common.xba145
-rw-r--r--wizards/source/webwizard/HtmlAutoPilotBasic.xba436
-rw-r--r--wizards/source/webwizard/Language.xba84
-rw-r--r--wizards/source/webwizard/WebWzrd.xdl28
-rw-r--r--wizards/source/webwizard/delzip0
-rw-r--r--wizards/source/webwizard/dialog.xlb5
-rw-r--r--wizards/source/webwizard/makefile.mk53
-rw-r--r--wizards/source/webwizard/script.xlb8
-rw-r--r--wizards/source/webwizard/webwizar.src167
-rw-r--r--wizards/util/hidother.src1498
-rw-r--r--wizards/util/makefile.mk42
-rw-r--r--wizards/util/soffice.lnk248
-rw-r--r--wizards/util/target.pmk41
402 files changed, 96029 insertions, 0 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
new file mode 100644
index 000000000000..422f4c8134f9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
@@ -0,0 +1,1961 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.agenda;
+
+import java.util.Calendar;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+
+import com.sun.star.awt.TextEvent;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.document.XDocumentProperties;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XTerminateListener;
+import com.sun.star.i18n.NumberFormatIndex;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XTableRows;
+import com.sun.star.text.*;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XNumberFormatsSupplier;
+import com.sun.star.util.XNumberFormatter;
+import com.sun.star.util.XSearchDescriptor;
+import com.sun.star.util.XSearchable;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NumberFormatter;
+import com.sun.star.wizards.document.OfficeDocument;
+import com.sun.star.wizards.text.TextDocument;
+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:
+ * the live-preview and the final "creation" of the document, when the user clicks "finish". <br/>
+ * <br/>
+ * <h2>Some terminology:<h2/>
+ * items are names or headings. we don't make any distinction.
+ *
+ * <br/>
+ * The Agenda Template is used as general "controller" of the whole document, whereas the
+ * two child-classes ItemsTable and TopicsTable control the item tables (note plural!) and the
+ * topics table (note singular).
+ * <br/> <br/>
+ * Other small classes are used to abstract the handling of cells and text and we
+ * try to use them as components.
+ * <br/><br/>
+ * We tried to keep the Agenda Template as flexible as possible, though there
+ * must be many limitations, because it is generated dynamically.<br/><br/>
+ * To keep the template flexible the following decisions were made:<br/>
+ * 1. Item tables.<br/>
+ * 1.a. there might be arbitrary number of Item tables.<br/>
+ * 1.b. Item tables design (bordewr, background) is arbitrary.<br/>
+ * 1.c. Items text styles are individual, and use stylelist styles with predefined names.<br/>
+ * As result the following limitations:<br/>
+ * Pairs of Name->value for each item.<br/>
+ * Tables contain *only* those pairs.<br/>
+ * 2. Topics table.<br/>
+ * 2.a. arbitrary structure.<br/>
+ * 2.b. design is arbitrary.<br/>
+ * As result the following limitations:<br/>
+ * No column merge is allowed.<br/>
+ * One compolsary Heading row.<br/>
+ * <br/><br/>
+ * To let the template be flexible, we use a kind of "detection": we look where
+ * the items are read the design of each table, reaplying it after writing the
+ * table.
+ * <br/><br/>
+ * A note about threads:<br/>
+ * Many methods here are synchronized, in order to avoid colission made by
+ * events fired too often.
+ * @author rpiterman
+ *
+ */
+public class AgendaTemplate extends TextDocument implements TemplateConsts, DataAware.Listener
+{
+
+ /**
+ * resources.
+ */
+ AgendaWizardDialogResources resources;
+ /**
+ * data model. This keeps the status of the agenda document, and
+ * every redraw is done according to this 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,
+ * inorder to restore them, we need a template to link to.
+ * This is practically an identicall copy of the current template.
+ */
+ String template;
+ /**
+ * used for common operations on sections.
+ */
+ TextSectionHandler textSectionHandler;
+ /**
+ * 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.
+ */
+ Map itemsCache;
+ /**
+ * This map is used to find which tables contains a certain Item, so
+ * the keys are the different Items, the Objects are the ItemTable controllers.
+ * When an Item must be redrawn (because the user checked or uncheced it),
+ * 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
+ * can just reference them and set their text.
+ */
+ 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).
+ */
+ private XDocumentProperties m_xDocProps;
+
+ /**
+ * loads the given template, and analyze its structure.
+ * @param templateURL
+ * @param topics
+ * @see AgendaTemplate.initialize()
+ * @see AgendaTemplate.initializeData()
+ */
+ public synchronized void load(String templateURL, List topics)
+ {
+ template = calcTemplateName(templateURL);
+ document = loadAsPreview(templateURL, false);
+ docMSF = ((XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document));
+ xFrame.getComponentWindow().setEnable(false);
+ xTextDocument.lockControllers();
+ initialize();
+ initializeData(topics);
+ xTextDocument.unlockControllers();
+ }
+
+ /**
+ * The agenda templates are in format of aw-XXX.ott
+ * the templates name is then XXX.ott.
+ * This method calculates it.
+ * @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));
+ }
+
+ /**
+ * synchronize the document to the model.<br/>
+ * this method rewrites all titles, item tables , and the topics table-
+ * thus synchronizing the document to the data model (CGAgenda).
+ * @param topicsData since the model does not contain Topics
+ * 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
+ {
+ itemsTables[i].write("");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ redrawTitle("txtTitle");
+ redrawTitle("txtDate");
+ redrawTitle("txtTime");
+ redrawTitle("cbLocation");
+
+ topics.writeAll(topicsData);
+
+ setTemplateTitle(agenda.cp_TemplateName);
+
+ }
+
+ /**
+ * redraws/rewrites the table which contains the given item
+ * This method is called when the user checks/unchecks an item.
+ * The table is being found, in which the item is, and redrawn.
+ * @param itemName
+ */
+ public synchronized void redraw(String itemName)
+ {
+ try
+ {
+ // get the table in which the item is...
+ Object itemsTable =
+ itemsMap.get(itemName);
+ // rewrite the table.
+ ((ItemsTable) itemsTable).write(null);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * update the documents title property to the given title
+ * @param newTitle new title.
+ */
+ synchronized void setTemplateTitle(String newTitle)
+ {
+ m_xDocProps.setTitle(newTitle);
+ }
+
+ /**
+ * constructor. The document is *not* loaded here.
+ * only some formal members are set.
+ * @param xmsf_ service factory.
+ * @param agenda_ the data model (CGAgenda)
+ * @param resources_ resources.
+ */
+ 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;
+
+ }
+
+ /**
+ * checks the data model if the
+ * item corresponding to the given string should be shown
+ * @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))
+ {
+ return agenda.cp_ShowMeetingType;
+ }
+ else if (itemName.equals(FILLIN_READ))
+ {
+ return agenda.cp_ShowRead;
+ }
+ else if (itemName.equals(FILLIN_BRING))
+ {
+ return agenda.cp_ShowBring;
+ }
+ else if (itemName.equals(FILLIN_NOTES))
+ {
+ return agenda.cp_ShowNotes;
+ }
+ else if (itemName.equals(FILLIN_FACILITATOR))
+ {
+ return agenda.cp_ShowFacilitator;
+ }
+ else if (itemName.equals(FILLIN_TIMEKEEPER))
+ {
+ return agenda.cp_ShowTimekeeper;
+ }
+ else if (itemName.equals(FILLIN_NOTETAKER))
+ {
+ return agenda.cp_ShowNotetaker;
+ }
+ else if (itemName.equals(FILLIN_PARTICIPANTS))
+ {
+ return agenda.cp_ShowAttendees;
+ }
+ else if (itemName.equals(FILLIN_CALLED_BY))
+ {
+ return agenda.cp_ShowCalledBy;
+ }
+ else if (itemName.equals(FILLIN_OBSERVERS))
+ {
+ return agenda.cp_ShowObservers;
+ }
+ else if (itemName.equals(FILLIN_RESOURCE_PERSONS))
+ {
+ return agenda.cp_ShowResourcePersons;
+ }
+ else
+ {
+ throw new IllegalArgumentException("No such item");
+ }
+ }
+
+ /**
+ * itemsCache is a Map containing all agenda item. These are object which
+ * "write themselfs" to the table, given a table cursor.
+ * 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()
+ {
+ itemsCache = new Hashtable(11);
+
+ 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_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_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_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_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_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)));
+
+ }
+
+ /**
+ * Initializes a template.<br/>
+ * This method does the following tasks:<br/>
+ * Get a Time and Date format for the document, and retrieve the null date of the document (which is
+ * document-specific).<br/>
+ * Initializes the Items Cache map.
+ * Analyses the document:<br/>
+ * -find all "fille-ins" (apear as &gt;xxx&lt; in the document).
+ * -analyze all items sections (and the tables in them).
+ * -locate the titles and actualize them
+ * -analyze the topics table
+ */
+ private void initialize()
+ {
+ /*
+ * Get the default locale of the document, and create the date and time formatters.
+ */
+ 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");
+
+ java.util.Locale jl = new java.util.Locale(
+ l.Language, l.Country, l.Variant);
+
+ calendar = Calendar.getInstance(jl);
+
+ 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");
+
+ 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);
+
+
+ dateFormatter = NumberFormatter.createNumberFormatter(xMSF, nfs);
+ timeFormatter = NumberFormatter.createNumberFormatter(xMSF, nfs);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ throw new NullPointerException("Fatal Error: could not initialize locale or date/time formats.");
+ }
+
+ /*
+ * get the document properties object.
+ */
+ m_xDocProps = OfficeDocument.getDocumentProperties(document);
+
+ initItemsCache();
+ initializeItems();
+ initializeTitles();
+ initializeItemsSections();
+ XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+ textSectionHandler = new TextSectionHandler(xMultiServiceFactory, (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, document));
+ initializeTopics();
+ _allItems.clear();
+ _allItems = null;
+ }
+
+ /**
+ * locates the titles (name, location, date, time) and saves a reference to thier Text ranges.
+ *
+ */
+ private void initializeTitles()
+ {
+ XTextRange item = null;
+
+ XMultiServiceFactory xmsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+
+ for (int i = 0; i < _allItems.size(); i++)
+ {
+ item = (XTextRange) _allItems.get(i);
+ String text = item.getString().trim().toLowerCase();
+ 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))
+ {
+ teDate = new PlaceholderTextElement(item, resources.resPlaceHolderDate, resources.resPlaceHolderHint, xmsf);
+ trDate = item;
+ _allItems.remove(i--);
+ }
+ 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))
+ {
+ teLocation = new PlaceholderTextElement(item, resources.resPlaceHolderLocation, resources.resPlaceHolderHint, xmsf);
+ trLocation = item;
+ _allItems.remove(i--);
+ }
+ }
+ }
+
+ private void initializeTopics()
+ {
+ topics = new Topics();
+ }
+
+ private void initializeItems()
+ {
+ _allItems = searchFillInItems();
+ }
+
+ /**
+ * 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);
+ XSearchDescriptor sd = xSearchable.createSearchDescriptor();
+ sd.setSearchString("<[^>]+>");
+ sd.setPropertyValue("SearchRegularExpression", Boolean.TRUE);
+ sd.setPropertyValue("SearchWords", Boolean.TRUE);
+
+ 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)
+ {
+ System.err.println("Nonfatal Error in finding fillins.");
+ }
+ }
+ return l;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ throw new IllegalArgumentException("Fatal Error: Loading template failed: searching fillins failed");
+ }
+ }
+
+ /**
+ * analyze the item sections in the template. delegates the analyze of each table to the
+ * ItemsTable class.
+ */
+ private void initializeItemsSections()
+ {
+ String[] sections = getSections(document, TemplateConsts.SECTION_ITEMS);
+
+ // for each section - there is a table...
+ itemsTables = new ItemsTable[sections.length];
+
+ for (int i = 0; i < itemsTables.length; i++)
+ {
+ try
+ {
+ itemsTables[i] = new ItemsTable(getSection(sections[i]), getTable(sections[i]));
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ throw new IllegalArgumentException("Fatal Error while initialilzing Template: items table in section " + sections[i]);
+ }
+ }
+
+ }
+
+ private String[] getSections(Object document, String s)
+ {
+ XTextSectionsSupplier xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, document);
+ String[] allSections = xTextSectionsSupplier.getTextSections().getElementNames();
+ 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();
+ }
+
+ Object getTable(String name) throws NoSuchElementException, WrappedTargetException
+ {
+ XTextTablesSupplier xTextTablesSupplier = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, document);
+ return ((Any) xTextTablesSupplier.getTextTables().getByName(name)).getObject();
+ }
+
+ /**
+ * implementation of DataAware.Listener, is
+ * called when title/date/time or location are
+ * changed.
+ */
+ 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)
+ {
+ 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("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...");
+ }
+ }
+
+ 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 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);
+
+ long date1 = JavaTools.getTimeInMillis(calendar);
+ /*
+ * docNullTime and date1 are in millis, but
+ * I need a day...
+ */
+ double daysDiff = (date1 - docNullTime) / DAY_IN_MILLIS + 1;
+
+ return dateFormatter.convertNumberToString(dateFormat, daysDiff);
+ }
+
+ 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));
+ return timeFormatter.convertNumberToString(timeFormat, t);
+ }
+
+ /* *******************************************
+ * F I N I S H
+ *********************************************/
+ /** the user clicked finish **/
+ public synchronized void finish(List topics)
+ {
+ createMinutes(topics);
+ deleteHiddenSections();
+ textSectionHandler.removeAllTextSections();
+ }
+
+ /**
+ * hidden sections exist when an item's section is hidden because the
+ * user specified not to display any items which it contains.
+ * When finishing the wizard removes this sections entireley from the document.
+ */
+ 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++)
+ {
+ 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("");
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * create the minutes for the given topics or remove the minutes section from the document.
+ * If no topics are supplied, or the user
+ * 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)
+ {
+
+ // if the minutes section should be removed (the
+ // user did not check "create minutes")
+ if (!agenda.cp_IncludeMinutes || (topicsData.size() <= 1))
+ {
+ try
+ {
+ Object minutesAllSection = getSection(SECTION_MINUTES_ALL);
+ XTextSection xTextSection = (XTextSection) UnoRuntime.queryInterface(XTextSection.class, minutesAllSection);
+ xTextSection.getAnchor().setString("");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ // the user checked "create minutes"
+ else
+ {
+ try
+ {
+ String itemText;
+ XTextRange item;
+ int topicStartTime = 0;
+ try
+ {
+ topicStartTime = new Integer(agenda.cp_Time).intValue();
+ }
+ 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);
+ 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);
+ }
+ }
+
+ items.clear();
+
+ /*
+ * now add minutes for each topic.
+ * The template contains *one* minutes section, so
+ * we first use the one available, and then add a new one...
+ *
+ * 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);
+
+ items = searchFillInItems();
+ 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))
+ {
+ int topicTime = 0;
+
+ try
+ {
+ topicTime = (new Integer((String) topic[3].Value)).intValue();
+ }
+ 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)) + " - ";
+ topicStartTime += topicTime * 1000;
+ time += getTimeString(String.valueOf(topicStartTime));
+ }
+ fillMinutesItem(item, time, "");
+ }
+ }
+
+ 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);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * given a text range and a text, fills the given
+ * text range with the given text.
+ * If the given text is empty, uses a placeholder with the giveb placeholder text.
+ * @param range text range to fill
+ * @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(""))
+ {
+ XTextContent placeHolder = createPlaceHolder(docMSF, placeholder, resources.resPlaceHolderHint);
+ try
+ {
+ range.getStart().getText().insertTextContent(range.getStart(), placeHolder, true);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ }
+ }
+
+ /**
+ * creates a placeholder field with the given text and given hint.
+ * @param xmsf service factory
+ * @param ph place holder text
+ * @param hint hint text
+ * @return the place holder field.
+ */
+ public static XTextContent createPlaceHolder(XMultiServiceFactory xmsf, String ph, String hint)
+ {
+ Object placeHolder;
+ try
+ {
+ placeHolder = xmsf.createInstance("com.sun.star.text.TextField.JumpEdit");
+ }
+ 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);
+
+ }
+
+ /*
+ * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+ * =================================
+ * The ItemTable class
+ * =================================
+ * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+ */
+ public class ItemsTable
+ {
+
+ Object table;
+ Object section;
+ /**
+ * the items in the table.
+ */
+ List items = new Vector(6);
+
+ public ItemsTable(Object section_, Object table_)
+ {
+
+ table = table_;
+ section = section_;
+
+ AgendaItem ai;
+ XTextRange item;
+ String iText;
+
+ /* go through all <*> items in the document
+ * and each one if it is in this table.
+ * If they are, register them to belong here, notice their order
+ * 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)
+ {
+ iText = item.getString().toLowerCase().trim();
+ ai = (AgendaItem) itemsCache.get(item.getString().toLowerCase().trim());
+ if (ai != null)
+ {
+ items.add(ai);
+ _allItems.remove(i--);
+ itemsMap.put(iText, this);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * link the section to the template. this will restore the original table
+ * with all the items.<br/>
+ * then break the link, to make the section editable.<br/>
+ * then, starting at cell one, write all items that should be visible.
+ * then clear the rest and remove obsolete rows.
+ * If no items are visible, hide the section.
+ * @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);
+
+ }
+ }
+
+ 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;
+ }
+ 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);
+
+ if (rowsCount >= rowIndex)
+ {
+ removeTableRows(table, rowIndex - 1, (rowsCount - rowIndex) + 1);
+ }
+ }
+ }
+ }
+
+ /*
+ * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+ * =================================
+ * The Topics class
+ * =================================
+ * $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
+ */
+ /**
+ * This class handles the preview of the topics table.
+ * You can call it the controller of the topics table.
+ * It differs from ItemsTable in that it has no data model -
+ * the update is done programttically.<br/>
+ * <br/>
+ * The decision to make this class a class by its own
+ * was done out of logic reasons and not design/functionality reasons,
+ * since there is anyway only one instance of this class at runtime
+ * it could have also be implemented in the AgendaTemplate class
+ * but for clarity and separation I decided to make a sub class for it.
+ *
+ * @author rp143992
+ */
+ 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.
+ */
+ int numCell = -1;
+ 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
+ * whole topic is already present in the document, using this vector.
+ * The vector contains nulls for topics which were not written, and
+ * empty strings for topics which were written (though any other
+ * object would also do - i check only if it is a null or not...);
+ */
+ List writtenTopics = new Vector();
+
+ /**
+ * Analyze the structure of the Topics table.
+ * The structure Must be as follows:<br>
+ * -One Header Row. <br>
+ * -arbitrary number of rows per topic <br>
+ * -arbitrary content in the topics row <br>
+ * -only soft formatting will be restored. <br>
+ * -the topic rows must repeat three times. <br>
+ * -in the topics rows, placeholders for number, topic, responsible, and duration
+ * must be placed.<br>
+ * <br>
+ * A word about table format: to reconstruct the format of the
+ * table we hold to the following formats: first row (header), topic, and last row.
+ * We hold the format of the last row, because one might wish to give it
+ * a special format, other than the one on the bottom of each topic.
+ * The left and right borders of the whole table are, on the other side,
+ * part of the topics rows format, and need not be preserved seperateley.
+ */
+ public Topics()
+ {
+ Object t;
+
+ Map topicItems = new Hashtable(4);
+
+ // This is the topics table. say hallo :-)
+ try
+ {
+ t = getTable(SECTION_TOPICS);
+ }
+ 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));
+
+ /* first I store all <*> ranges
+ * which are in the topics table.
+ * I store each <*> range in this - the key
+ * is the cell it is in. Later when analyzing the topic,
+ * cell by cell, I check in this map to know
+ * if a cell contains a <*> or not.
+ */
+ Hashtable items = new Hashtable();
+
+ 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);
+ }
+ }
+
+ /*
+ * in the topics table, there are always one
+ * title row and three topics defined.
+ * So no mutter how many rows a topic takes - we
+ * can restore its structure and format.
+ */
+ int rows = getRowCount(table);
+
+ rowsPerTopic = (rows - 1) / 3;
+
+ String firstCell = "A" + (1 + rowsPerTopic + 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))
+ {
+ cell = table.getCellByName(cursor.getRangeName());
+ 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);
+ }
+
+ topicCells.add(ae);
+
+ // and store the format of the cell.
+ topicCellFormats.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
+
+ // goto next cell.
+ 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));
+
+
+
+ /* now that we know how the topics look like,
+ * we get the format of the first and last rows.
+ */
+
+ // format of first row
+ cursor.gotoStart(false);
+ do
+ {
+ firstRowFormat.add(new TableCellFormatter(table.getCellByName(cursor.getRangeName())));
+ cursor.goRight((short) 1, false);
+ }
+ while (!cursor.getRangeName().startsWith("A"));
+
+ // format of the last row
+ cursor.gotoEnd(false);
+ while (!cursor.getRangeName().startsWith("A"))
+ {
+ 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())));
+
+ removeTableRows(table, 1 + rowsPerTopic, rows - rowsPerTopic - 1);
+
+ }
+
+ /**
+ * @param topic the topic number to write
+ * @param data the data of the topic.
+ * @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
+ {
+ while (topic >= writtenTopics.size())
+ {
+ writtenTopics.add(null);
+ }
+ writtenTopics.set(topic, "");
+
+ // make sure threr are enough rows for me...
+ int rows = getRowCount(table);
+ 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...
+ }
+ setItemText(numCell, data[0].Value);
+ setItemText(topicCell, data[1].Value);
+ setItemText(responsibleCell, data[2].Value);
+ setItemText(timeCell, data[3].Value);
+
+ // 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);
+ }
+
+ // now format !
+ cursor.gotoCellByName("A" + firstRow, false);
+
+ formatTable(cursor, topicCellFormats, false);
+
+ return diff;
+
+ }
+
+ /**
+ * check if the topic with the given index is written to the table.
+ * @param topic the topic number (0 base)
+ * @return true if the topic is already written to the table. False if not.
+ * (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);
+ }
+
+ /**
+ * rewrites a single cell containing.
+ * This is used in order to refresh the topic/responsible/duration data in the
+ * preview document, in response to a change in the gui (by the user).
+ * Since the structure of the topics table is flexible, we don't reference a cell
+ * number. Rather, we use "what" argument to specify which cell should be redrawn.
+ * The Topics object, which analyzed the structure of the topics table appon
+ * initialization, refreshes the approperiate cell.
+ * @param topic index of the topic (0 based).
+ * @param what 0 for num, 1 for topic, 2 for responsible, 3 for duration
+ * @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
+ {
+ // if the whole row should be written...
+ if (!isWritten(topic))
+ {
+ write(topic, data);
+ // write only the "what" cell.
+ }
+ else
+ {
+ // calculate the table row.
+ 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:
+ te = setItemText(numCell, data[0].Value);
+ cursorMoves = numCell;
+ break;
+ case 1:
+ te = setItemText(topicCell, data[1].Value);
+ cursorMoves = topicCell;
+ break;
+ case 2:
+ te = setItemText(responsibleCell, data[2].Value);
+ cursorMoves = responsibleCell;
+ break;
+ case 3:
+ te = setItemText(timeCell, data[3].Value);
+ cursorMoves = timeCell;
+ break;
+ }
+ // move the cursor to the needed cell...
+ cursor.goRight((short) cursorMoves, false);
+ XCell xc = table.getCellByName(cursor.getRangeName());
+ // and write it !
+ te.write(xc);
+ ((TableCellFormatter) topicCellFormats.get(cursorMoves)).format(xc);
+
+ }
+ }
+
+ /**
+ * writes the given topic.
+ * if the first topic was involved, reformat the
+ * first row.
+ * If any rows were added to the table, reformat
+ * the last row.
+ * @param topic the index of the topic to write.
+ * @param data the topic's data. (see TopicsControl
+ * 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
+ {
+ int diff = write2(topic, data);
+ /* if the first topic has been written,
+ * one needs to reformat the first row.
+ */
+ if (topic == 0)
+ {
+ formatFirstRow();
+ }
+ /*
+ * if any rows were added, one needs to format
+ * the whole table again.
+ */
+ if (diff > 0)
+ {
+ formatLastRow();
+ }
+ }
+
+ /**
+ * Writes all the topics to thetopics table.
+ * @param topicsData a List containing all Topic's Data.
+ */
+ public void writeAll(List topicsData)
+ {
+ try
+ {
+ for (int i = 0; i < topicsData.size() - 1; i++)
+ {
+ write2(i, (PropertyValue[]) topicsData.get(i));
+ }
+ formatLastRow();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * removes obsolete rows, reducing the
+ * topics table to the given number of topics.
+ * Note this method does only reducing - if
+ * the number of topics given is greater than the
+ * number of actuall topics it does *not* add
+ * new rows !
+ * Note also that the first topic will never be removed.
+ * If the table contains no topics, the whole section will
+ * be removed uppon finishing.
+ * The reason for that is a "table-design" one: the first topic is
+ * maintained in order to be able to add rows with a design of this topic,
+ * and not of the header row.
+ * @param topics the number of topics the table should contain.
+ * @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);
+ }
+ formatLastRow();
+ while (writtenTopics.size() > topics)
+ {
+ writtenTopics.remove(topics);
+ }
+ }
+
+ /**
+ * reapply the format of the first (header) row.
+ */
+ private void formatFirstRow()
+ {
+ XTextTableCursor cursor = table.createCursorByCellName("A1");
+ formatTable(cursor, firstRowFormat, false);
+ }
+
+ /**
+ * reaply the format of the last row.
+ */
+ private void formatLastRow()
+ {
+ XTextTableCursor cursor = table.createCursorByCellName("A1");
+ cursor.gotoEnd(false);
+ formatTable(cursor, lastRowFormat, true);
+ }
+
+ /**
+ * returns a text element for the given cell,
+ * which will write the given text.
+ * @param cell the topics cell number.
+ * @param value the value to write.
+ * @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));
+ if (te != null)
+ {
+ te.text = value.toString();
+ }
+ return te;
+ }
+ return null;
+ }
+
+ /**
+ * formats a series of cells from the given one,
+ * using the given List of TableCellFormatter objects,
+ * in the given order.
+ * This method is used to format the first (header) and the last
+ * rows of the table.
+ * @param cursor a table cursor, pointing to the start cell to format
+ * @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()));
+ if (reverse)
+ {
+ cursor.goLeft((short) 1, false);
+ }
+ else
+ {
+ cursor.goRight((short) 1, false);
+ }
+ }
+ }
+ }
+
+
+ /*
+ * =================================
+ * 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;
+ }
+
+ /**
+ * Convenience method, costs the given object to an XNamed, and returnes its name.
+ * @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();
+ }
+
+ /**
+ * convenience method, for removing a number of cells from a table.
+ * @param table
+ * @param start
+ * @param count
+ */
+ public static void removeTableRows(Object table, int start, int count)
+ {
+ XTableRows rows = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table)).getRows();
+ rows.removeByIndex(start, count);
+ }
+
+ /**
+ * Convenience method for inserting some cells into a table.
+ * @param table
+ * @param start
+ * @param count
+ */
+ public static void insertTableRows(Object table, int start, int count)
+ {
+ XTableRows rows = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table)).getRows();
+ rows.insertByIndex(start, count);
+ }
+
+ /**
+ * returns the row index for this cursor, assuming
+ * the cursor points to a single cell.
+ * @param cursor
+ * @return the row index in which the cursor is.
+ */
+ public static int getRowIndex(XTextTableCursor cursor)
+ {
+ return getRowIndex(cursor.getRangeName());
+ }
+
+ /**
+ * returns the row index for this cell name.
+ * @param cellName
+ * @return the row index for this cell name.
+ */
+ public static int getRowIndex(String cellName)
+ {
+ return Integer.parseInt(cellName.substring(1));
+ }
+
+ /**
+ * returns the rows count of this table, assuming
+ * there is no vertical merged cells.
+ * @param table
+ * @return the rows count of the given table.
+ */
+ public static int getRowCount(XTextTable table)
+ {
+ String[] cells = table.getCellNames();
+ return getRowIndex(cells[cells.length - 1]);
+ }
+}
+
+/*
+ * ===========================================================================================
+ *
+ * End of AgendaTempalte class
+ *
+ * ===========================================================================================
+ *
+ */
+/*
+ * =================================
+ * The AgendaElement interface
+ * =================================
+ */
+/**
+ * Interface that is used for writing content to a Uno Text / TextRange
+ * @author rp143992
+ *
+ */
+interface AgendaElement
+{
+
+ void write(Object any) throws Exception;
+}
+
+
+/*
+ * =================================
+ * The ParaStyled class
+ * =================================
+ */
+/**
+ * Basic implementation of the AgendaElement interface -
+ * writes nothing, but applies a ParaStyle to the given XText/XTextRange
+ * @author rp143992
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+class ParaStyled implements AgendaElement
+{
+
+ String paraStyle;
+
+ ParaStyled(String paraStyle_)
+ {
+ paraStyle = paraStyle_;
+ }
+
+ void format(Object textRange)
+ {
+ XText o;
+ 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);
+ XTextCursor cursor = o.createTextCursorByRange(xtr);
+
+ Helper.setUnoPropertyValue(cursor, "ParaStyleName", paraStyle);
+ }
+
+ public void write(Object textRange)
+ {
+ format(textRange);
+ }
+}
+
+/*
+ * =================================
+ * 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
+{
+
+ String text;
+
+ TextElement(XTextRange range)
+ {
+ this(range.getString(), (String) Helper.getUnoPropertyValue(range.getStart(), "ParaStyleName"));
+ }
+
+ TextElement(String text_, String paraStyle_)
+ {
+ super(paraStyle_);
+ text = 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.
+ * @author rp143992
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+class PlaceholderTextElement extends TextElement
+{
+
+ String hint;
+ String placeHolderText;
+ 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);
+ placeHolderText = placeHolderText_;
+ hint = hint_;
+ xmsf = xmsf_;
+ }
+
+ 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);
+ xTextRange.getText().insertTextContent(xTextRange.getStart(), xTextContent, true);
+ }
+ 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
+{
+
+ String hint;
+ String placeHolderText;
+ 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);
+ xTextRange.getText().insertTextContent(xTextRange.getStart(), xTextContent, true);
+ super.write(textRange);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+}
+
+
+/*
+ * =================================
+ * The AgendaItem class
+ * =================================
+ */
+/**
+ * An implementation of AgendaElement which
+ * gets as a parameter a table cursor, and writes
+ * a text to the cell marked by this table cursor, and
+ * a place holder to the next cell.
+ * @author rp143992
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+class AgendaItem implements AgendaElement
+{
+
+ TextElement textElement;
+ AgendaElement field;
+ public Object table;
+ String name;
+
+ 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);
+
+ String cellname = xTextTableCursor.getRangeName();
+ Object cell = xTextTable.getCellByName(cellname);
+
+ textElement.write(cell);
+
+ xTextTableCursor.goRight((short) 1, false);
+
+ //second field is actually always null...
+ // this is a preparation for adding placeholders.
+ if (field != null)
+ {
+ field.write(xTextTable.getCellByName(xTextTableCursor.getRangeName()));
+ }
+ }
+}
+
+/*
+ * =================================
+ * 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[]
+ {
+ "BackColor",
+ "BackTransparent",
+ "BorderDistance",
+ "BottomBorder",
+ "BottomBorderDistance",
+ "LeftBorder",
+ "LeftBorderDistance",
+ "RightBorder",
+ "RightBorderDistance",
+ "TopBorder",
+ "TopBorderDistance"
+ };
+ 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 void format(Object tableCell)
+ {
+ Helper.setUnoPropertyValues(tableCell, properties, values);
+ }
+}
+
+
+
+
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java
new file mode 100644
index 000000000000..55119ea28325
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java
@@ -0,0 +1,384 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.agenda;
+
+import com.sun.star.awt.FontDescriptor;
+import com.sun.star.awt.XButton;
+import com.sun.star.awt.XCheckBox;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XDateField;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.awt.XTimeField;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.WizardDialog;
+
+/**
+ * This class is generated Automatically....
+ * bla bla bla
+ */
+public abstract class AgendaWizardDialog extends WizardDialog implements AgendaWizardDialogConst, UIConsts {
+ //GUI Components as Class members.
+ XFixedText lblTitle1;
+ XCheckBox chkMinutes;
+ XFixedText lblHelp1;
+ XFixedText lblPageDesign;
+ XListBox listPageDesign;
+ //Image Control
+ XControl imgHelp1;
+ XControl imgHelp2;
+ XControl imgHelp3;
+ XControl imgHelp4;
+ XControl imgHelp6;
+ XFixedText lblTitle2;
+ XFixedText lblTime;
+ XFixedText lblTitle;
+ XFixedText lblLocation;
+ XTextComponent cbLocation;
+ XTimeField txtTime;
+ XTextComponent txtTitle;
+ XFixedText lblHelp2;
+ XFixedText lblDate;
+ XDateField txtDate;
+ XFixedText lblTitle3;
+ XCheckBox chkMeetingTitle;
+ XCheckBox chkRead;
+ XCheckBox chkBring;
+ XCheckBox chkNotes;
+ XFixedText lblHelp3;
+ XFixedText lblTitle5;
+ XCheckBox chkConvenedBy;
+ XCheckBox chkPresiding;
+ XCheckBox chkNoteTaker;
+ XCheckBox chkTimekeeper;
+ XCheckBox chkAttendees;
+ XCheckBox chkObservers;
+ XCheckBox chkResourcePersons;
+ XFixedText lblHelp4;
+ XFixedText lblTitle4;
+ XFixedText lblTopic;
+ XFixedText lblResponsible;
+ XFixedText lblDuration;
+ //XFixedText lblHelp5;
+ XTextComponent txtTemplateName;
+ XRadioButton optCreateAgenda;
+ XRadioButton optMakeChanges;
+ XFixedText lblProceed;
+ XFixedText lblTemplateName;
+ XFixedText lblTemplatePath;
+ XFixedText lblTitle6;
+ XTextComponent txtTemplatePath;
+ XButton btnTemplatePath;
+ XFixedText lblHelp6;
+ XFixedText lblHelpPg6;
+ XButton btnInsert;
+ XButton btnRemove;
+ XButton btnUp;
+ XButton btnDown;
+
+ final private String IMGHELP1_HID = "";
+
+
+ //Font Descriptors as Class members.
+ FontDescriptor fontDescriptor1 = new FontDescriptor();
+ FontDescriptor fontDescriptor2 = new FontDescriptor();
+ FontDescriptor fontDescriptor4 = new FontDescriptor();
+
+ //Resources Object
+ AgendaWizardDialogResources resources;
+
+ private String[] PROPS_LIST = new String[] {"Dropdown", "Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"};
+ private String[] PROPS_LABEL_B = new String[] {"FontDescriptor", "Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"};
+ private String[] PROPS_CHECK = new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "State", "Step", "TabIndex", "Width"};
+ private String[] PROPS_BUTTON = new String[] {"Height", "HelpURL", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"};
+ private String[] PROPS_X = new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "TabIndex", "Width"};
+ private String[] PROPS_TEXTAREA = new String[] {"Height", "Label", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"};
+ private String[] PROPS_TEXT = new String[] {"Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"};
+ private String[] PROPS_IMAGE = new String[] {"Border", "Height", "HelpURL", "ImageURL", "PositionX", "PositionY", "ScaleImage", "Step", "TabIndex", "Width"};
+
+ private static final Short NO_BORDER = new Short((short)0);
+
+ public AgendaWizardDialog(XMultiServiceFactory xmsf) {
+ super(xmsf,HID);
+ //Load Resources
+ resources = new AgendaWizardDialogResources(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(200),new Integer(52),INTEGERS[1],new Short((short)1),resources.resAgendaWizardDialog_title,new Integer(310)}
+ );
+
+ //Set member- FontDescriptors...
+ fontDescriptor1.Weight = 150;
+ fontDescriptor1.Underline = com.sun.star.awt.FontUnderline.SINGLE;
+ fontDescriptor2.Weight = 100;
+ fontDescriptor4.Weight = 150;
+ }
+
+ //build components
+ public void buildStep1() {
+ lblTitle1 = insertLabel("lblTitle1",
+ PROPS_LABEL_B,
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle1_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[1],new Short((short)100),new Integer(212)}
+ );
+ lblPageDesign = insertLabel("lblPageDesign",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblPageDesign_value,new Integer(97),new Integer(32),INTEGERS[1],new Short((short)101),new Integer(66)}
+ );
+ listPageDesign = insertListBox("listPageDesign", null, null,
+ PROPS_LIST,
+ new Object[] { Boolean.TRUE,INTEGER_12,LISTPAGEDESIGN_HID,new Integer(166),new Integer(30),INTEGERS[1],new Short((short)102),new Integer(70)}
+ );
+ chkMinutes = insertCheckBox("chkMinutes", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[9],CHKMINUTES_HID,resources.reschkMinutes_value,new Integer(97),new Integer(50),new Short((short)0),INTEGERS[1],new Short((short)103),new Integer(203)}
+ );
+ imgHelp1 = insertImage("imgHelp1",
+ PROPS_IMAGE,
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID, AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145), Boolean.FALSE, INTEGERS[1], new Short((short)104),INTEGERS[10]}
+ );
+ lblHelp1 = insertLabel("lblHelp1",
+ PROPS_TEXTAREA,
+ new Object[] { new Integer(39),resources.reslblHelp1_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[1],new Short((short)105),new Integer(199)}
+ );
+
+ }
+
+ public void buildStep2() {
+ lblTitle2 = insertLabel("lblTitle2",
+ PROPS_LABEL_B,
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle2_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[2],new Short((short)200),new Integer(212)}
+ );
+ lblDate = insertLabel("lblDate",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblDate_value,new Integer(97),new Integer(32),INTEGERS[2],new Short((short)201),new Integer(66)}
+ );
+ txtDate = insertDateField("txtDate", null,
+ PROPS_LIST,
+ new Object[] { Boolean.TRUE,INTEGER_12,TXTDATE_HID,new Integer(166),new Integer(30),INTEGERS[2],new Short((short)202),new Integer(70)}
+ );
+ lblTime = insertLabel("lblTime",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblTime_value,new Integer(97),new Integer(50),INTEGERS[2],new Short((short)203),new Integer(66)}
+ );
+ txtTime = insertTimeField("txtTime", null,
+ new String[] {"Height", "HelpURL", "PositionX", "PositionY", "Step", "StrictFormat", "TabIndex", "Width"},
+ new Object[] { INTEGER_12,TXTTIME_HID,new Integer(166),new Integer(48),INTEGERS[2],Boolean.TRUE,new Short((short)204),new Integer(70)}
+ );
+
+ lblTitle = insertLabel("lblTitle",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblTitle_value,new Integer(97),new Integer(68),INTEGERS[2],new Short((short)205),new Integer(66)}
+ );
+ txtTitle = insertTextField("txtTitle", null,
+ new String[] {"Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
+ new Object[] { new Integer(26),TXTTITLE_HID,Boolean.TRUE,new Integer(166),new Integer(66),INTEGERS[2],new Short((short)206),new Integer(138)}
+ );
+ lblLocation = insertLabel("lblLocation",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblLocation_value,new Integer(97),new Integer(100),INTEGERS[2],new Short((short)207),new Integer(66)}
+ );
+ cbLocation = insertTextField("cbLocation", null,null,
+ new String[] { "Height", "HelpURL", "MultiLine", "PositionX", "PositionY", "Step", "TabIndex", "Width"},
+ new Object[] { new Integer(34),CBLOCATION_HID,Boolean.TRUE,new Integer(166),new Integer(98),INTEGERS[2],new Short((short)208),new Integer(138)}
+ );
+
+ imgHelp2 = insertImage("imgHelp2",
+ PROPS_IMAGE,
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145),Boolean.FALSE, INTEGERS[2],new Short((short)209),INTEGERS[10]}
+ );
+ lblHelp2 = insertLabel("lblHelp2",
+ PROPS_TEXTAREA,
+ new Object[] { new Integer(39),resources.reslblHelp2_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[2],new Short((short)210),new Integer(199)}
+ );
+
+ }
+
+ public void buildStep3() {
+ lblTitle3 = insertLabel("lblTitle3",
+ PROPS_LABEL_B,
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle3_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[3],new Short((short)300),new Integer(212)}
+ );
+ chkMeetingTitle = insertCheckBox("chkMeetingTitle", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKMEETINGTITLE_HID,resources.reschkMeetingTitle_value,new Integer(97),new Integer(32),new Short((short)1),INTEGERS[3],new Short((short)301),new Integer(69)}
+ );
+ chkRead = insertCheckBox("chkRead", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKREAD_HID,resources.reschkRead_value,new Integer(97),new Integer(46),new Short((short)0),INTEGERS[3],new Short((short)302),new Integer(162)}
+ );
+ chkBring = insertCheckBox("chkBring", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKBRING_HID,resources.reschkBring_value,new Integer(97),new Integer(60),new Short((short)0),INTEGERS[3],new Short((short)303),new Integer(162)}
+ );
+ chkNotes = insertCheckBox("chkNotes", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKNOTES_HID,resources.reschkNotes_value,new Integer(97),new Integer(74),new Short((short)1),INTEGERS[3],new Short((short)304),new Integer(160)}
+ );
+ imgHelp3 = insertImage("imgHelp3",
+ PROPS_IMAGE,
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145),Boolean.FALSE, INTEGERS[3],new Short((short)305),INTEGERS[10]}
+ );
+ lblHelp3 = insertLabel("lblHelp3",
+ PROPS_TEXTAREA,
+ new Object[] { new Integer(39),resources.reslblHelp3_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[3],new Short((short)306),new Integer(199)}
+ );
+ }
+
+ public void buildStep4() {
+ lblTitle5 = insertLabel("lblTitle5",
+ PROPS_LABEL_B,
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle5_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[4],new Short((short)400),new Integer(212)}
+ );
+ chkConvenedBy = insertCheckBox("chkConvenedBy", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKCONVENEDBY_HID,resources.reschkConvenedBy_value,new Integer(97),new Integer(32),new Short((short)1),INTEGERS[4],new Short((short)401),new Integer(150)}
+ );
+ chkPresiding = insertCheckBox("chkPresiding", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKPRESIDING_HID,resources.reschkPresiding_value,new Integer(97),new Integer(46),new Short((short)0),INTEGERS[4],new Short((short)402),new Integer(150)}
+ );
+ chkNoteTaker = insertCheckBox("chkNoteTaker", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKNOTETAKER_HID,resources.reschkNoteTaker_value,new Integer(97),new Integer(60),new Short((short)0),INTEGERS[4],new Short((short)403),new Integer(150)}
+ );
+ chkTimekeeper = insertCheckBox("chkTimekeeper", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKTIMEKEEPER_HID,resources.reschkTimekeeper_value,new Integer(97),new Integer(74),new Short((short)0),INTEGERS[4],new Short((short)404),new Integer(150)}
+ );
+ chkAttendees = insertCheckBox("chkAttendees", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKATTENDEES_HID,resources.reschkAttendees_value,new Integer(97),new Integer(88),new Short((short)1),INTEGERS[4],new Short((short)405),new Integer(150)}
+ );
+ chkObservers = insertCheckBox("chkObservers", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKOBSERVERS_HID,resources.reschkObservers_value,new Integer(97),new Integer(102),new Short((short)0),INTEGERS[4],new Short((short)406),new Integer(150)}
+ );
+ chkResourcePersons = insertCheckBox("chkResourcePersons", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],CHKRESOURCEPERSONS_HID,resources.reschkResourcePersons_value,new Integer(97),new Integer(116),new Short((short)0),INTEGERS[4],new Short((short)407),new Integer(150)}
+ );
+ imgHelp4 = insertImage("imgHelp4",
+ PROPS_IMAGE,
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145),Boolean.FALSE, INTEGERS[4],new Short((short)408),INTEGERS[10]}
+ );
+ lblHelp4 = insertLabel("lblHelp4",
+ PROPS_TEXTAREA,
+ new Object[] { new Integer(39),resources.reslblHelp4_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[4],new Short((short)409),new Integer(199)}
+ );
+ }
+
+ public void buildStep5() {
+ lblTitle4 = insertLabel("lblTitle4",
+ PROPS_LABEL_B,
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle4_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[5],new Short((short)500),new Integer(212)}
+ );
+ lblTopic = insertLabel("lblTopic",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblTopic_value,new Integer(107),new Integer(28),INTEGERS[5],new Short((short)71),new Integer(501)}
+ );
+ lblResponsible = insertLabel("lblResponsible",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblResponsible_value,new Integer(195),new Integer(28),INTEGERS[5],new Short((short)72),new Integer(502)}
+ );
+ lblDuration = insertLabel("lblDuration",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblDuration_value,new Integer(267),new Integer(28),INTEGERS[5],new Short((short)73),new Integer(503)}
+ );
+
+
+
+
+
+ btnInsert = insertButton("btnInsert", BTNINSERT_ACTION_PERFORMED,
+ PROPS_BUTTON,
+ new Object[] { INTEGER_14,BTNINSERT_HID,resources.resButtonInsert,new Integer(92),new Integer(136),INTEGERS[5],new Short((short)580),INTEGER_40}
+ );
+ btnRemove = insertButton("btnRemove", BTNREMOVE_ACTION_PERFORMED,
+ PROPS_BUTTON,
+ new Object[] { INTEGER_14,BTNREMOVE_HID,resources.resButtonRemove,new Integer(134),new Integer(136),INTEGERS[5],new Short((short)581),INTEGER_40}
+ );
+ btnUp = insertButton("btnUp", BTNUP_ACTION_PERFORMED,
+ PROPS_BUTTON,
+ new Object[] { INTEGER_14,BTNUP_HID,resources.resButtonUp,new Integer(222),new Integer(136),INTEGERS[5],new Short((short)582),INTEGER_40}
+ );
+ btnDown = insertButton("btnDown", BTNDOWN_ACTION_PERFORMED,
+ PROPS_BUTTON,
+ new Object[] { INTEGER_14,BTNDOWN_HID,resources.resButtonDown,new Integer(264),new Integer(136),INTEGERS[5],new Short((short)583),INTEGER_40}
+ );
+
+
+ }
+
+ public void buildStep6() {
+
+ lblTitle6 = insertLabel("lblTitle6",
+ PROPS_LABEL_B,
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle6_value,Boolean.TRUE,new Integer(91),INTEGERS[8],INTEGERS[6],new Short((short)600),new Integer(212)}
+ );
+ lblHelpPg6 = insertLabel("lblHelpPg6",
+ PROPS_TEXTAREA,
+ new Object[] { new Integer(24),resources.reslblHelpPg6_value,Boolean.TRUE,new Integer(97),new Integer(32),INTEGERS[6],new Short((short)601),new Integer(204)}
+ );
+
+ lblTemplateName = insertLabel("lblTemplateName",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblTemplateName_value,new Integer(97),new Integer(62),INTEGERS[6],new Short((short)602),new Integer(101)}
+ );
+ txtTemplateName = insertTextField("txtTemplateName", TXTTEMPLATENAME_TEXT_CHANGED,
+ PROPS_X,
+ new Object[] { INTEGER_12,TXTTEMPLATENAME_HID,new Integer(202),new Integer(60),INTEGERS[6],new Short((short)603),new Integer(100)}
+ );
+ lblProceed = insertLabel("lblProceed",
+ PROPS_TEXT,
+ new Object[] { INTEGERS[8],resources.reslblProceed_value,new Integer(97),new Integer(101),INTEGERS[6],new Short((short)607),new Integer(204)}
+ );
+ optCreateAgenda = insertRadioButton("optCreateAgenda", null,
+ PROPS_CHECK,
+ new Object[] { INTEGERS[8],OPTCREATEAGENDA_HID,resources.resoptCreateAgenda_value,new Integer(103),new Integer(113),new Short((short)1),INTEGERS[6],new Short((short)608),new Integer(198)}
+ );
+ optMakeChanges = insertRadioButton("optMakeChanges", null,
+ PROPS_BUTTON,
+ new Object[] { INTEGERS[8],OPTMAKECHANGES_HID,resources.resoptMakeChanges_value,new Integer(103),new Integer(125),INTEGERS[6],new Short((short)609),new Integer(198)}
+ );
+ imgHelp6 = insertImage("imgHelp6",
+ PROPS_IMAGE,
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, new Integer(92),new Integer(145),Boolean.FALSE, INTEGERS[6],new Short((short)610),INTEGERS[10]}
+ );
+ lblHelp6 = insertLabel("lblHelp6",
+ PROPS_TEXTAREA,
+ new Object[] { new Integer(39),resources.reslblHelp6_value,Boolean.TRUE,new Integer(104),new Integer(145),INTEGERS[6],new Short((short)611),new Integer(199)}
+ );
+
+ }
+
+} \ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java
new file mode 100644
index 000000000000..08f2fabfb8d9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.java
@@ -0,0 +1,107 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.agenda;
+
+public interface AgendaWizardDialogConst {
+
+ /**
+ * These are event method names, used with reflection
+ * to call the methods under these names uppon
+ * events.
+ */
+
+ final String LISTPAGEDESIGN_ACTION_PERFORMED = "pageDesignChanged";
+ final String TXTTEMPLATENAME_TEXT_CHANGED = "templateTitleChanged";
+ final String BTNTEMPLATEPATH_ACTION_PERFORMED = "saveAs";
+ final String BTNINSERT_ACTION_PERFORMED = "insertRow";
+ final String BTNREMOVE_ACTION_PERFORMED = "removeRow";
+ final String BTNUP_ACTION_PERFORMED = "rowUp";
+ final String BTNDOWN_ACTION_PERFORMED = "rowDown";
+
+ final String INFO_IMAGE_URL = "private:resource/dbu/image/19205";
+ /* ====================================
+ * Help IDs
+ * ====================================
+ */
+ final int HID = 41051;
+
+ /*
+ * "HID:(hid)" - the dialog
+ * "HID:(hid+1) - the help button
+ * "HID:(hid+2)" - the back button
+ * "HID:(hid+3)" - the next button
+ * "HID:(hid+4)" - the create button
+ * "HID:(hid+5)" - the cancel button
+ */
+
+ final String LISTPAGEDESIGN_HID = "HID:" + (HID + 6);
+ final String CHKMINUTES_HID = "HID:" + (HID + 7);
+ final String TXTTIME_HID = "HID:" + (HID + 8);
+ final String TXTDATE_HID = "HID:" + (HID + 9);
+ final String TXTTITLE_HID = "HID:" + (HID + 10);
+ final String CBLOCATION_HID = "HID:" + (HID + 11);
+
+ final String CHKMEETINGTITLE_HID = "HID:" + (HID + 12);
+ final String CHKREAD_HID = "HID:" + (HID + 13);
+ final String CHKBRING_HID = "HID:" + (HID + 14);
+ final String CHKNOTES_HID = "HID:" + (HID + 15);
+
+ final String CHKCONVENEDBY_HID = "HID:" + (HID + 16);
+ final String CHKPRESIDING_HID = "HID:" + (HID + 17);
+ final String CHKNOTETAKER_HID = "HID:" + (HID + 18);
+ final String CHKTIMEKEEPER_HID = "HID:" + (HID + 19);
+ final String CHKATTENDEES_HID = "HID:" + (HID + 20);
+ final String CHKOBSERVERS_HID = "HID:" + (HID + 21);
+ final String CHKRESOURCEPERSONS_HID = "HID:" + (HID + 22);
+
+ final String TXTTEMPLATENAME_HID = "HID:" + (HID + 23);
+ final String TXTTEMPLATEPATH_HID = "HID:" + (HID + 24);
+ final String BTNTEMPLATEPATH_HID = "HID:" + (HID + 25);
+
+ final String OPTCREATEAGENDA_HID = "HID:" + (HID + 26);
+ final String OPTMAKECHANGES_HID = "HID:" + (HID + 27);
+
+ final String BTNINSERT_HID = "HID:" + (HID + 28);
+ final String BTNREMOVE_HID = "HID:" + (HID + 29);
+ final String BTNUP_HID = "HID:" + (HID + 30);
+ final String BTNDOWN_HID = "HID:" + (HID + 31);
+
+ final int LAST_HID = HID + 32;
+
+ /*
+ * 32 : scroll bar
+ * 33 - 35 first topics row
+ * 36 - 38 second
+ * 39 - 41
+ * 42 - 44
+ * 45 - 47
+ * total 5 rows / 3 controls.
+ */
+
+
+}
+ \ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java
new file mode 100644
index 000000000000..4701f27110cd
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java
@@ -0,0 +1,597 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.agenda;
+
+import java.util.Vector;
+
+import com.sun.star.awt.ItemEvent;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XItemListener;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.task.XInteractionHandler;
+import com.sun.star.text.XTextDocument;
+//import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.CloseVetoException;
+import com.sun.star.util.XCloseable;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.NoValidPathException;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.document.OfficeDocument;
+import com.sun.star.wizards.text.ViewHandler;
+import com.sun.star.wizards.ui.PathSelection;
+import com.sun.star.wizards.ui.XPathSelectionListener;
+import com.sun.star.wizards.ui.event.DataAware;
+import com.sun.star.wizards.ui.event.RadioDataAware;
+import com.sun.star.wizards.ui.event.UnoDataAware;
+
+/**
+ * This class is the dialog implementation class -
+ * there is not much business logic here - but mostley
+ * event methods.
+ * Some event methods are also implemented in TopicsControl and TopicsControl.ControlRow.
+ * @author rp143992
+ */
+public class AgendaWizardDialogImpl extends AgendaWizardDialog
+{
+ /**
+ * used to prevent a double start of the wizard.
+ */
+ static boolean running;
+
+ /**
+ * the preview document controller.
+ */
+ AgendaTemplate agendaTemplate;
+ /**
+ * the data model, read from the OOo configuration.
+ * (live synchronized: when the user changes the gui,
+ * the data model changes, except for topics).
+ */
+ private CGAgenda agenda;
+
+ /**
+ * the topics control, a gui element which
+ * manipulates the topics data according to the
+ * user's input.
+ */
+ private TopicsControl topicsControl;
+
+ /**
+ * an array with two array memebers:
+ * agendaTemplates[0] contains an array with
+ * UI template names.
+ * agendaTemplates[1] contains an array with
+ * corresponding URLs.
+ */
+ private String[][] agendaTemplates;
+
+ PathSelection myPathSelection;
+
+ String sTemplatePath;
+ String sUserTemplatePath;
+ String sBitmapPath;
+
+ String sPath;
+
+ /** constructor */
+ public AgendaWizardDialogImpl(XMultiServiceFactory xmsf)
+ {
+ super(xmsf);
+ }
+
+ protected void enterStep(int OldStep, int NewStep) {}
+ protected void leaveStep(int OldStep, int NewStep) {}
+
+ /**
+ * read the configuration data, open the specified template,
+ * initialize the template controller (AgendaTemplate) and
+ * set the status of the displayed template to the one
+ * read from the configuration.
+ * build the dialog.
+ * Synchronize the dialog to the same status (read from
+ * the configuration).
+ * show the dialog.
+ */
+ public void startWizard() {
+ running = true;
+ try {
+ // read configuration data.
+ agenda = new CGAgenda();
+
+ Object root = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.Office.Writer/Wizards/Agenda", false);
+ agenda.readConfiguration(root,"cp_");
+
+ // initialize the agenda template
+ agendaTemplate = new AgendaTemplate(xMSF, agenda, resources, this);
+ initializeTemplates();
+
+ agendaTemplate.load(agendaTemplates[1][agenda.cp_AgendaType] , new Vector());
+
+ // build the dialog.
+ buildStep1();
+ buildStep2();
+ buildStep3();
+ buildStep4();
+ buildStep5();
+ topicsControl = new TopicsControl(this,xMSF, agenda);
+ buildStep6();
+ drawNaviBar();
+
+ initializePaths();
+
+ //special Control for setting the save Path:
+ insertPathSelectionControl();
+
+ // create the peer
+ XWindow xw = agendaTemplate.xFrame.getContainerWindow();
+ XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xw);
+ this.createWindowPeer( xWindowPeer );
+
+ // initialize roadmap
+ this.addRoadmap();
+ this.insertRoadMapItems(
+ new String[] { resources.resStep1, resources.resStep2, resources.resStep3, resources.resStep4, resources.resStep5, resources.resStep6, } ,
+ new int[] { 1,2,3,4,5,6},
+ new boolean[] { true,true,true,true,true,true }
+ );
+ this.setMaxStep(6);
+
+ // synchronize GUI and CGAgenda object.
+ makeDA();
+ if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
+
+ executeDialog(agendaTemplate.xFrame);
+ removeTerminateListener();
+ closeDocument();
+ running = false;
+
+ }
+ catch (Exception ex) {
+ removeTerminateListener();
+ ex.printStackTrace();
+ running=false;
+ return;
+ }
+
+
+ }
+
+ private class myPathSelectionListener implements XPathSelectionListener {
+ public void validatePath() {
+ if (myPathSelection.usedPathPicker) {
+ filenameChanged = true;
+ }
+ myPathSelection.usedPathPicker = false;
+ }
+ }
+
+
+ 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 + 24 ), "HID:" + ( HID + 25 ));
+ myPathSelection.sDefaultDirectory = sUserTemplatePath;
+ myPathSelection.sDefaultName = "myAgendaTemplate.ott";
+ myPathSelection.sDefaultFilter = "writer8_template";
+ myPathSelection.addSelectionListener(new myPathSelectionListener());
+ }
+
+ 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) {
+ e.printStackTrace();
+ }
+ }
+
+ private void checkSavePath() {
+ if (agenda.cp_TemplatePath == null ||
+ agenda.cp_TemplatePath.equals("") ||
+ !getFileAccess().exists(FileAccess.getParentDir(agenda.cp_TemplatePath),false) ||
+ !getFileAccess().isDirectory(FileAccess.getParentDir(agenda.cp_TemplatePath )))
+ {
+ try {
+ agenda.cp_TemplatePath =
+ FileAccess.connectURLs(
+ FileAccess.getOfficePath(xMSF, "Work", "", "") ,
+ resources.resDefaultFilename
+ );
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * bind controls to the agenda member (DataAware model)
+ */
+ private void makeDA() {
+
+ setControlProperty("listPageDesign", "StringItemList", agendaTemplates[0]);
+
+ checkSavePath();
+ //setFilename(agenda.cp_TemplatePath);
+
+ UnoDataAware.attachListBox( agenda, "cp_AgendaType", listPageDesign , null, true ).updateUI();
+ UnoDataAware.attachCheckBox( agenda, "cp_IncludeMinutes", chkMinutes, null, true).updateUI();
+
+ UnoDataAware.attachEditControl(agenda, "cp_Title", txtTitle, agendaTemplate , true).updateUI();
+ UnoDataAware.attachDateControl(agenda, "cp_Date", txtDate, agendaTemplate , true).updateUI();
+ UnoDataAware.attachTimeControl(agenda, "cp_Time", txtTime, agendaTemplate , true).updateUI();
+ UnoDataAware.attachEditControl(agenda, "cp_Location", cbLocation, agendaTemplate , true).updateUI();
+
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowMeetingType", chkMeetingTitle , new RedrawListener( TemplateConsts.FILLIN_MEETING_TYPE ) , true);
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowRead", chkRead , new RedrawListener( TemplateConsts.FILLIN_READ ) , true).updateUI();
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowBring", chkBring , new RedrawListener( TemplateConsts.FILLIN_BRING ) , true).updateUI();
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowNotes", chkNotes , new RedrawListener( TemplateConsts.FILLIN_NOTES ) , true).updateUI();
+
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowCalledBy", chkConvenedBy , new RedrawListener( TemplateConsts.FILLIN_CALLED_BY ) , true).updateUI();
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowFacilitator", chkPresiding , new RedrawListener( TemplateConsts.FILLIN_FACILITATOR ) , true).updateUI();
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowNotetaker", chkNoteTaker , new RedrawListener( TemplateConsts.FILLIN_NOTETAKER ) , true).updateUI();
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowTimekeeper", chkTimekeeper , new RedrawListener( TemplateConsts.FILLIN_TIMEKEEPER ) , true).updateUI();
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowAttendees", chkAttendees , new RedrawListener( TemplateConsts.FILLIN_PARTICIPANTS ) , true).updateUI();
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowObservers", chkObservers , new RedrawListener( TemplateConsts.FILLIN_OBSERVERS ) , true).updateUI();
+ UnoDataAware.attachCheckBox(agenda,"cp_ShowResourcePersons", chkResourcePersons , new RedrawListener( TemplateConsts.FILLIN_RESOURCE_PERSONS ) , true).updateUI();
+
+ UnoDataAware.attachEditControl(agenda, "cp_TemplateName", txtTemplateName, null, true).updateUI();
+ RadioDataAware.attachRadioButtons( agenda, "cp_ProceedMethod",
+ new Object[] {optCreateAgenda, optMakeChanges} ,null,true).updateUI();
+
+ listPageDesign.addItemListener(new XItemListener() {
+ public void itemStateChanged(ItemEvent ie) {
+ pageDesignChanged(ie);
+ }
+ public void disposing(EventObject eo) {}
+ });
+ }
+
+ /** used in developement to start the wizard */
+ public static void main(String args[])
+ {
+ String ConnectStr = "uno:socket,host=127.0.0.1,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager";
+ try {
+ XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
+ AgendaWizardDialogImpl wizard = new AgendaWizardDialogImpl(xLocMSF);
+ wizard.startWizard();
+
+ }
+ catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+
+
+ /*
+ private void initializePaths() {
+ try {
+
+ sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user");
+ sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/bitmap");
+ } catch (NoValidPathException e) {
+ e.printStackTrace();
+ }
+ }*/
+
+ /**
+ * read the available agenda wizard templates.
+ */
+ public boolean initializeTemplates() {
+ try {
+ String sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
+
+ //sCurrentNorm = Norms[getCurrentLetter().cp_Norm];
+ String sAgendaPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/wizard/agenda" );
+
+ agendaTemplates = FileAccess.getFolderTitles(xMSF, "aw" , sAgendaPath);
+
+ return true;
+ } catch (NoValidPathException nopathexception) {
+ nopathexception.printStackTrace();
+ return false;
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ return false;
+ }
+ }
+
+ /* ******************************
+ * Event methods
+ * ******************************
+ */
+
+ /**
+ * first page, page design listbox changed.
+ */
+ public void pageDesignChanged(ItemEvent ie) {
+ int selected = ie.Selected;
+ try {
+ agendaTemplate.load( agendaTemplates[1][selected] , topicsControl.getTopicsData());
+ }
+ catch (Exception ex) {
+ SystemDialog.showMessageBox(xMSF, "ErrBox", VclWindowPeerAttribute.OK, resources.resErrOpenTemplate);
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * last page, template title changed...
+ */
+ public void templateTitleChanged() {
+ String title = (String)Helper.getUnoPropertyValue( getModel(txtTemplateName), "Text" );
+ agendaTemplate.setTemplateTitle( title );
+ }
+
+
+ private FileAccess fileAccess1;
+ /** convenience method.
+ * instead of creating a FileAccess object every time
+ * it is needed, I have a FileAccess object memeber.
+ * the first time it is needed it will be created, and
+ * then be reused...
+ * @return the FileAccess memeber object.
+ */
+ private FileAccess getFileAccess() {
+ if (fileAccess1 == null)
+ try {
+ fileAccess1 = new FileAccess(xMSF);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return fileAccess1;
+
+ }
+ /**
+ * indicates if the filename was changed by the user through
+ * the "save as" dialog.
+ * If it is so, one needs not warn the user
+ * upon overwrite, since she was already warned.
+ */
+ private boolean filenameChanged = false;
+
+ /**
+ * last page, "browse" ("...") button was clicked...
+ */
+ public void saveAs() {
+ try {
+
+ checkSavePath();
+
+ SystemDialog saveAs = SystemDialog.createStoreDialog(xMSF);
+ saveAs.addFilterToDialog("ott","writer8_template",true);
+ // call the saveAs dialog.
+ String url = saveAs.callStoreDialog(
+ FileAccess.getParentDir(agenda.cp_TemplatePath),
+ FileAccess.getFilename(agenda.cp_TemplatePath));
+
+ if (url != null) {
+ agenda.cp_TemplatePath = url;
+ setFilename(url);
+ filenameChanged = true;
+ }
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+
+ }
+
+ /**
+ * is called when the user
+ * changes the path through the "save as" dialog.
+ * The path displayed is a translated, user-friendly, platform dependant path.
+ * @param url the new save url.
+ */
+ private void setFilename(String url) {
+ try {
+ String path = getFileAccess().getPath(url,"");
+ Helper.setUnoPropertyValue( getModel(myPathSelection.xSaveTextBox), "Text", path);
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
+ public void insertRow() {
+ topicsControl.insertRow();
+ }
+
+ public void removeRow() {
+ topicsControl.removeRow();
+ }
+
+ public void rowUp() {
+ topicsControl.rowUp();
+ }
+
+ public void rowDown() {
+ topicsControl.rowDown();
+ }
+
+
+ /* ************************
+ * Navigation bar methods
+ * ************************
+ */
+
+ public void cancelWizard() {
+ xDialog.endExecute();
+ running = false;
+ }
+
+ public boolean finishWizard() {
+ boolean bSaveSuccess = false; // pesimistic :(
+ XTextDocument xTextDocument;
+
+ try {
+ FileAccess fileAccess = new FileAccess(xMSF);
+ sPath = myPathSelection.getSelectedPath();
+ if (sPath.equals("")) {
+ myPathSelection.triggerPathPicker();
+ sPath = myPathSelection.getSelectedPath();
+ }
+ sPath = fileAccess.getURL(sPath);
+
+ //first, if the filename was not changed, thus
+ //it is coming from a saved session, check if the
+ // file exists and warn the user.
+ if (!filenameChanged)
+ if (fileAccess.exists(sPath, true)) {
+
+ int answer = SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "MessBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, resources.resFileExists);
+ if (answer == 3) // user said: no, do not overwrite....
+ return false;
+ }
+
+ agendaTemplate.xTextDocument.lockControllers();
+
+ xTextDocument = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class,agendaTemplate.document);
+
+ bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath , "writer8_template", false, resources.resErrSaveTemplate );
+ } catch (Exception e) {
+ SystemDialog.showMessageBox(xMSF, xControl.getPeer(), "ErrBox", VclWindowPeerAttribute.OK, resources.resErrSaveTemplate);
+ //e.printStackTrace();
+ }
+
+ if (bSaveSuccess) {
+ try {
+ topicsControl.saveTopics(agenda);
+ Object root = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.Office.Writer/Wizards/Agenda", true);
+ agenda.writeConfiguration(root,"cp_");
+ Configuration.commit(root);
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ agendaTemplate.finish( topicsControl.getTopicsData());
+ try {
+ XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, agendaTemplate.document);
+ xStoreable.store();
+ }
+ catch (Exception ex) {
+ SystemDialog.showMessageBox(xMSF, "ErrBox", VclWindowPeerAttribute.OK, resources.resErrSaveTemplate);
+ ex.printStackTrace();
+ }
+
+ //xWindow.setVisible(false);
+ //running = false;
+ agendaTemplate.xTextDocument.unlockControllers();
+ //closeDocument();
+ //removeTerminateListener();
+
+ PropertyValue loadValues[] = new PropertyValue[2];
+ loadValues[0] = new PropertyValue();
+ loadValues[0].Name = "AsTemplate";
+ if (agenda.cp_ProceedMethod == 1) {
+ loadValues[0].Value = Boolean.TRUE;
+ } else {
+ loadValues[0].Value = Boolean.FALSE;
+ }
+ loadValues[1] = new PropertyValue();
+ loadValues[1].Name = "InteractionHandler";
+ try {
+ XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
+ loadValues[1].Value = xIH;
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), agenda.cp_TemplatePath, "_default", new PropertyValue[0]);
+ Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), sPath, "_default", new PropertyValue[0]);
+ xTextDocument = (com.sun.star.text.XTextDocument) oDoc;
+ XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ ViewHandler myViewHandler = new ViewHandler(xDocMSF, xTextDocument);
+ try {
+ myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.OPTIMAL));
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ } else {
+ agendaTemplate.xTextDocument.unlockControllers();
+ return false;
+ }
+ xDialog.endExecute();
+ running = false;
+ return true;
+ }
+
+ private void closeDocument() {
+ try {
+ //xComponent.dispose();
+ XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, agendaTemplate.xFrame);
+ xCloseable.close(false);
+ } catch (CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /* ********************
+ * Sub Classes
+ * ********************
+ */
+
+
+ /**
+ * this class is used to redraw an item's table when
+ * the user clicks one of the checkboxes in step 3 or 4.
+ */
+ private class RedrawListener implements DataAware.Listener {
+
+ private String itemName;
+
+ public RedrawListener(String itemName_) {
+ itemName = itemName_;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.event.DataAware.Listener#eventPerformed(java.lang.Object)
+ */
+ public void eventPerformed(Object event) {
+ agendaTemplate.xTextDocument.lockControllers();
+ agendaTemplate.redraw(itemName);
+ agendaTemplate.xTextDocument.unlockControllers();
+ }
+ }
+
+
+}
+ \ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java
new file mode 100644
index 000000000000..21730c9aa040
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.java
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.agenda;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Resource;
+
+public class AgendaWizardDialogResources extends Resource {
+
+ final static String UNIT_NAME = "dbwizres";
+ final static String MODULE_NAME = "dbw";
+ final static int RID_AGENDAWIZARDDIALOG_START = 5000;
+ final static int RID_COMMON_START = 500;
+
+
+ String resAgendaWizardDialog_title;
+ String resoptMakeChanges_value;
+ String reslblTemplateName_value;
+ String reslblTemplatePath_value;
+ String reslblProceed_value;
+ String reslblTitle1_value;
+ String reslblTitle3_value;
+ String reslblTitle2_value;
+ String reslblTitle4_value;
+ String reslblTitle5_value;
+ String reslblTitle6_value;
+ String reschkMinutes_value;
+ String reslblHelp1_value;
+ String reslblTime_value;
+ String reslblTitle_value;
+ String reslblLocation_value;
+ String reslblHelp2_value;
+ String resbtnTemplatePath_value;
+ String resoptCreateAgenda_value;
+ String reslblHelp6_value;
+ String reslblTopic_value;
+ String reslblResponsible_value;
+ String reslblDuration_value;
+ String reschkConvenedBy_value;
+ String reschkPresiding_value;
+ String reschkNoteTaker_value;
+ String reschkTimekeeper_value;
+ String reschkAttendees_value;
+ String reschkObservers_value;
+ String reschkResourcePersons_value;
+ String reslblHelp4_value;
+ String reschkMeetingTitle_value;
+ String reschkRead_value;
+ String reschkBring_value;
+ String reschkNotes_value;
+ String reslblHelp3_value;
+
+ String reslblDate_value;
+ String reslblHelpPg6_value;
+ String reslblPageDesign_value;
+
+ String resDefaultFilename;
+ String resDefaultTitle;
+
+ String resErrSaveTemplate;
+
+ String resPlaceHolderTitle;
+ String resPlaceHolderDate;
+ String resPlaceHolderTime;
+ String resPlaceHolderLocation;
+ String resPlaceHolderHint;
+
+ String resStep1;
+ String resStep2;
+ String resStep3;
+ String resStep4;
+ String resStep5;
+ String resStep6;
+
+ String resErrOpenTemplate;
+
+ String itemMeetingType;
+ String itemRead;
+ String itemBring;
+ String itemNote;
+ String itemCalledBy;
+ String itemFacilitator;
+ String itemNotetaker;
+ String itemTimekeeper;
+ String itemAttendees;
+ String itemObservers;
+ String itemResource;
+
+ String resButtonInsert;
+ String resButtonRemove;
+ String resButtonUp;
+ String resButtonDown;
+
+
+
+
+ // *** common resources ***
+
+ String resFileExists;
+
+public AgendaWizardDialogResources(XMultiServiceFactory xmsf) {
+ super(xmsf,UNIT_NAME,MODULE_NAME);
+
+ /**
+ * Delete the String, uncomment the getResText method
+ *
+ */
+ resAgendaWizardDialog_title = getResText(RID_AGENDAWIZARDDIALOG_START + 1);
+ resoptMakeChanges_value = getResText(RID_AGENDAWIZARDDIALOG_START + 2);
+ reslblTemplateName_value = getResText(RID_AGENDAWIZARDDIALOG_START + 3);
+ reslblTemplatePath_value = getResText(RID_AGENDAWIZARDDIALOG_START + 4);
+ reslblProceed_value = getResText(RID_AGENDAWIZARDDIALOG_START + 5);
+ reslblTitle1_value = getResText(RID_AGENDAWIZARDDIALOG_START + 6);
+ reslblTitle3_value = getResText(RID_AGENDAWIZARDDIALOG_START + 7);
+ reslblTitle2_value = getResText(RID_AGENDAWIZARDDIALOG_START + 8);
+ reslblTitle4_value = getResText(RID_AGENDAWIZARDDIALOG_START + 9);
+ reslblTitle5_value = getResText(RID_AGENDAWIZARDDIALOG_START + 10);
+ reslblTitle6_value = getResText(RID_AGENDAWIZARDDIALOG_START + 11);
+ reschkMinutes_value = getResText(RID_AGENDAWIZARDDIALOG_START + 12);
+ reslblHelp1_value = getResText(RID_AGENDAWIZARDDIALOG_START + 13);
+ reslblTime_value = getResText(RID_AGENDAWIZARDDIALOG_START + 14);
+ reslblTitle_value = getResText(RID_AGENDAWIZARDDIALOG_START + 15);
+ reslblLocation_value = getResText(RID_AGENDAWIZARDDIALOG_START + 16);
+ reslblHelp2_value = getResText(RID_AGENDAWIZARDDIALOG_START + 17);
+ resbtnTemplatePath_value = getResText(RID_AGENDAWIZARDDIALOG_START + 18);
+ resoptCreateAgenda_value = getResText(RID_AGENDAWIZARDDIALOG_START + 19);
+ reslblHelp6_value = getResText(RID_AGENDAWIZARDDIALOG_START + 20);
+ reslblTopic_value = getResText(RID_AGENDAWIZARDDIALOG_START + 21);
+ reslblResponsible_value = getResText(RID_AGENDAWIZARDDIALOG_START + 22);
+ reslblDuration_value = getResText(RID_AGENDAWIZARDDIALOG_START + 23);
+ reschkConvenedBy_value = getResText(RID_AGENDAWIZARDDIALOG_START + 24);
+ reschkPresiding_value = getResText(RID_AGENDAWIZARDDIALOG_START + 25);
+ reschkNoteTaker_value = getResText(RID_AGENDAWIZARDDIALOG_START + 26);
+ reschkTimekeeper_value = getResText(RID_AGENDAWIZARDDIALOG_START + 27);
+ reschkAttendees_value = getResText(RID_AGENDAWIZARDDIALOG_START + 28);
+ reschkObservers_value = getResText(RID_AGENDAWIZARDDIALOG_START + 29);
+ reschkResourcePersons_value = getResText(RID_AGENDAWIZARDDIALOG_START + 30);
+ reslblHelp4_value = getResText(RID_AGENDAWIZARDDIALOG_START + 31);
+ reschkMeetingTitle_value = getResText(RID_AGENDAWIZARDDIALOG_START + 32);
+ reschkRead_value = getResText(RID_AGENDAWIZARDDIALOG_START + 33);
+ reschkBring_value = getResText(RID_AGENDAWIZARDDIALOG_START + 34);
+ reschkNotes_value = getResText(RID_AGENDAWIZARDDIALOG_START + 35);
+ reslblHelp3_value = getResText(RID_AGENDAWIZARDDIALOG_START + 36);
+ reslblDate_value = getResText(RID_AGENDAWIZARDDIALOG_START + 38);
+ reslblHelpPg6_value = getResText(RID_AGENDAWIZARDDIALOG_START + 39);
+ reslblPageDesign_value = getResText(RID_AGENDAWIZARDDIALOG_START + 40);
+
+ resDefaultFilename = getResText(RID_AGENDAWIZARDDIALOG_START + 41);
+ resDefaultFilename = resDefaultFilename.substring(0,resDefaultFilename.length()-4) + ".ott";
+
+ resDefaultTitle = getResText(RID_AGENDAWIZARDDIALOG_START + 42);
+
+ resErrSaveTemplate = getResText(RID_AGENDAWIZARDDIALOG_START + 43);
+
+ resPlaceHolderTitle = getResText(RID_AGENDAWIZARDDIALOG_START + 44);
+ resPlaceHolderDate = getResText(RID_AGENDAWIZARDDIALOG_START + 45);
+ resPlaceHolderTime = getResText(RID_AGENDAWIZARDDIALOG_START + 46);
+ resPlaceHolderLocation = getResText(RID_AGENDAWIZARDDIALOG_START + 47);
+ resPlaceHolderHint = getResText(RID_AGENDAWIZARDDIALOG_START + 48);
+
+
+ resStep1 = getResText(RID_AGENDAWIZARDDIALOG_START + 50);
+ resStep2 = getResText(RID_AGENDAWIZARDDIALOG_START + 51);
+ resStep3 = getResText(RID_AGENDAWIZARDDIALOG_START + 52);
+ resStep4 = getResText(RID_AGENDAWIZARDDIALOG_START + 53);
+ resStep5 = getResText(RID_AGENDAWIZARDDIALOG_START + 54);
+ resStep6 = getResText(RID_AGENDAWIZARDDIALOG_START + 55);
+
+ resErrOpenTemplate = getResText(RID_AGENDAWIZARDDIALOG_START + 56);
+
+ itemMeetingType = getResText(RID_AGENDAWIZARDDIALOG_START + 57);
+ itemBring = getResText(RID_AGENDAWIZARDDIALOG_START + 58);
+ itemRead = getResText(RID_AGENDAWIZARDDIALOG_START + 59);
+ itemNote = getResText(RID_AGENDAWIZARDDIALOG_START + 60);
+
+ itemCalledBy = getResText(RID_AGENDAWIZARDDIALOG_START + 61);
+ itemFacilitator = getResText(RID_AGENDAWIZARDDIALOG_START + 62);
+ itemAttendees = getResText(RID_AGENDAWIZARDDIALOG_START + 63);
+ itemNotetaker = getResText(RID_AGENDAWIZARDDIALOG_START + 64);
+ itemTimekeeper = getResText(RID_AGENDAWIZARDDIALOG_START + 65);
+ itemObservers = getResText(RID_AGENDAWIZARDDIALOG_START + 66);
+ itemResource = getResText(RID_AGENDAWIZARDDIALOG_START + 67);
+
+ resButtonInsert = getResText(RID_AGENDAWIZARDDIALOG_START + 68);
+ resButtonRemove = getResText(RID_AGENDAWIZARDDIALOG_START + 69);
+ resButtonUp = getResText(RID_AGENDAWIZARDDIALOG_START + 70);
+ resButtonDown = getResText(RID_AGENDAWIZARDDIALOG_START + 71);
+
+ /*
+ * Common resources
+ */
+
+ resFileExists = getResText(RID_COMMON_START + 19);
+
+ }
+}
diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.java b/wizards/com/sun/star/wizards/agenda/CGAgenda.java
new file mode 100644
index 000000000000..b7dc1cc37c00
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/CGAgenda.java
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.agenda;
+
+import com.sun.star.wizards.common.ConfigGroup;
+import com.sun.star.wizards.common.ConfigSet;
+
+/**
+ * CGAgenda means Configuration Group Agenda.
+ * This object encapsulates a OOo configuration group, used
+ * to save the state of the agenda wizard for reloading uppon
+ * next start.
+ */
+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 */
+ public String cp_Date;
+ /** step 2 - time */
+ public String cp_Time;
+ /** step 2 - location */
+ public String cp_Location = "";
+ /** step 3 - show meeting type */
+ public boolean cp_ShowMeetingType;
+ /** step 3 - show read */
+ public boolean cp_ShowRead;
+ /** step 3 - show bring */
+ 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 */
+ public boolean cp_ShowFacilitator;
+ /** step 4 - show notes taker */
+ public boolean cp_ShowNotetaker;
+ /** step 4 - show time keeper */
+ public boolean cp_ShowTimekeeper;
+ /** step 4 - show attendees */
+ public boolean cp_ShowAttendees;
+ /** step 4 - show observers */
+ 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
new file mode 100644
index 000000000000..74b818205b9f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/CGTopic.java
@@ -0,0 +1,87 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.agenda;
+
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.wizards.common.ConfigGroup;
+import com.sun.star.wizards.common.Indexable;
+
+/**
+ * CGTopic means: Configuration Group Topic.
+ * This object encapsulates a configuration group with topic information.
+ * Since the topics gui conftrol uses its own data model, there is
+ * also code here to convert from the data model to CGTopic object (the constructor)
+ * and vice versa (setDataToRow method - used when loading the last session...)
+ */
+public class CGTopic extends ConfigGroup implements Indexable {
+
+ /** sort order */
+ public int cp_Index;
+ /** topic name */
+ public String cp_Topic;
+ /** responsible */
+ public String cp_Responsible;
+ /** time */
+ public String cp_Time;
+
+ public CGTopic() {}
+
+ /**
+ * create a new CGTopic object with data from the given row.
+ * the row object is a PropertyValue array, as used
+ * by the TopicsControl's data model.
+ * @param row PropertyValue array as used by the TopicsControl data model.
+ */
+ public CGTopic( Object row) {
+ PropertyValue[] pv = (PropertyValue[])row;
+ String num = (String)pv[0].Value;
+ cp_Index = Integer.valueOf(num.substring(0,num.length() - 1)).intValue();
+ cp_Topic = (String)pv[1].Value;
+ cp_Responsible = (String)pv[2].Value;
+ cp_Time = (String)pv[3].Value;
+ }
+
+ /**
+ * copies the data in this CGTopic object
+ * to the given row.
+ * @param row the row object (PropertyValue array) to
+ * copy the data to.
+ */
+ public void setDataToRow(Object row) {
+ PropertyValue[] pv = (PropertyValue[])row;
+ pv[0].Value = "" + cp_Index + ".";
+ pv[1].Value = cp_Topic;
+ pv[2].Value = cp_Responsible;
+ pv[3].Value = cp_Time;
+ }
+
+ public int getIndex() {
+ return cp_Index;
+ }
+
+}
diff --git a/wizards/com/sun/star/wizards/agenda/CallWizard.java b/wizards/com/sun/star/wizards/agenda/CallWizard.java
new file mode 100644
index 000000000000..69b62c56e4f7
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/CallWizard.java
@@ -0,0 +1,240 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.agenda;
+
+import com.sun.star.beans.XPropertyAccess;
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.task.XJob;
+import com.sun.star.task.XJobExecutor;
+import com.sun.star.uno.Type;
+
+/**
+ * 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 (<CODE>__writeRegistryServiceInfo</CODE>).
+ *
+ * @author $author$
+ * @version $Revision: 1.5.52.1 $
+ */
+public class CallWizard {
+
+ /**
+ * Gives a factory for creating the service. This method is called by the
+ * <code>JavaLoader</code>
+ *
+ * <p></p>
+ *
+ * @param stringImplementationName The implementation name of the component.
+ * @param xMSF The service manager, who gives access to every known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single registry key accessible.
+ *
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the component.
+ *
+ * @see com.sun.star.comp.loader.JavaLoader#
+ */
+ public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey) {
+ XSingleServiceFactory xsingleservicefactory = null;
+
+ if (stringImplementationName.equals(WizardImplementation.class.getName())) {
+ xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey);
+ }
+
+ return xsingleservicefactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key. This method is called
+ * by the <code>JavaLoader</code>.
+ *
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single registry key accessible.
+ *
+ * @return returns true if the operation succeeded
+ *
+ * @see com.sun.star.comp.loader.JavaLoader#
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey) {
+ return FactoryHelper.writeRegistryServiceInfo(WizardImplementation.class.getName(), WizardImplementation.__serviceName, xregistrykey);
+ }
+
+ /**
+ * 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 {
+
+ /**
+ * The constructor of the inner class has a XMultiServiceFactory parameter.
+ *
+ * @param xmultiservicefactoryInitialization A special service factory could be
+ * introduced while initializing.
+ */
+ public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization) {
+ xmultiservicefactory = xmultiservicefactoryInitialization;
+
+ if (xmultiservicefactory != null) {
+
+ }
+ }
+
+ /**
+ * Execute Wizard
+ *
+ * @param str only valid parameter is 'start' at the moment.
+ */
+
+ public void trigger(String str) {
+ try {
+ if (str.equalsIgnoreCase("start")) {
+ AgendaWizardDialogImpl aw = new AgendaWizardDialogImpl(xmultiservicefactory);
+ if (!AgendaWizardDialogImpl.running) {
+ aw.startWizard();
+ }
+ }
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ //*******************************************
+
+ /**
+ * The service name, that must be used to get an instance of this service.
+ */
+ private static final String __serviceName = "com.sun.star.wizards.agenda.CallWizard";
+
+ /**
+ * The service manager, that gives access to all registered services.
+ */
+ private XMultiServiceFactory xmultiservicefactory;
+
+ /**
+ * This method is a member of the interface for initializing an object directly
+ * after its creation.
+ *
+ * @param object This array of arbitrary objects will be passed to the component
+ * after its creation.
+ *
+ * @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 {
+
+ }
+
+ /**
+ * 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];
+ stringSupportedServiceNames[0] = __serviceName;
+
+ return (stringSupportedServiceNames);
+ }
+
+ /**
+ * This method returns true, if the given service will be supported by the
+ * component.
+ *
+ * @param stringService Service name.
+ *
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService(String stringService) {
+ boolean booleanSupportsService = false;
+
+ 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. to realise hashing functionality
+ * when the object is introspected. Two objects that return the same ID also
+ * have to return the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to return an empty
+ * sequence. Important: If the object aggregates other objects the ID has to be
+ * unique for the whole combination of objects.
+ *
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId() {
+ byte[] byteReturn = {
+ };
+
+ try {
+ byteReturn = ("" + 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 (WizardImplementation.class.getName());
+ }
+
+ /**
+ * Provides a sequence of all types (usually interface types) provided by the
+ * object.
+ *
+ * @return Sequence of all types (usually interface types) provided by the
+ * service.
+ */
+ 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) {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/agenda/MANIFEST.MF b/wizards/com/sun/star/wizards/agenda/MANIFEST.MF
new file mode 100644
index 000000000000..b9a31ef4732c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.agenda.CallWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/agenda/TemplateConsts.java b/wizards/com/sun/star/wizards/agenda/TemplateConsts.java
new file mode 100644
index 000000000000..44ce6a1e0f0e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/TemplateConsts.java
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.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
+ * must contain a table whos name is identical name to the section's name.
+ */
+ public final static String SECTION_ITEMS = "AGENDA_ITEMS";
+ /**
+ * the name of the section which contains the topics.
+ */
+ public final static String SECTION_TOPICS = "AGENDA_TOPICS";
+ /**
+ * the name of the parent minutes section.
+ */
+ public final static String SECTION_MINUTES_ALL = "MINUTES_ALL";
+ /**
+ * 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";
+ /**
+ * taged headings and names.
+ * These will be searched in item tables (in the template) and will be
+ * replaced with resource strings.
+ *
+ * headings...
+ */
+ public final static String FILLIN_MEETING_TYPE = "<meeting-type>";
+ public final static String FILLIN_BRING = "<bring>";
+ public final static String FILLIN_READ = "<read>";
+ public final static String FILLIN_NOTES = "<notes>";
+ /**
+ * names...
+ */
+ public final static String FILLIN_CALLED_BY = "<called-by>";
+ public final static String FILLIN_FACILITATOR = "<facilitator>";
+ public final static String FILLIN_PARTICIPANTS = "<attendees>";
+ public final static String FILLIN_NOTETAKER = "<notetaker>";
+ 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
+ *
+ */
+ public final static String STYLE_MEETING_TYPE = "MeetingType";
+ public final static String STYLE_BRING = "Bring";
+ public final static String STYLE_READ = "Read";
+ public final static String STYLE_NOTES = "Notes";
+ /**
+ * names styles
+ */
+ public final static String STYLE_CALLED_BY = "CalledBy";
+ public final static String STYLE_FACILITATOR = "Facilitator";
+ public final static String STYLE_PARTICIPANTS = "Attendees";
+ public final static String STYLE_NOTETAKER = "Notetaker";
+ 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...)
+ *
+ * headings fields styles
+ */
+ public final static String STYLE_MEETING_TYPE_TEXT = "MeetingTypeText";
+ 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
+ */
+ public final static String STYLE_CALLED_BY_TEXT = "CalledByText";
+ public final static String STYLE_FACILITATOR_TEXT = "FacilitatorText";
+ public final static String STYLE_PARTICIPANTS_TEXT = "AttendeesText";
+ public final static String STYLE_NOTETAKER_TEXT = "NotetakerText";
+ 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
+ * part of detecting its structure.
+ */
+ public final static String FILLIN_TOPIC_NUMBER = "<num>";
+ 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
+ * with the appropriate data.
+ */
+ public final static String FILLIN_MINUTES_TITLE = "<minutes-title>";
+ 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
+ * will be replaced with topic data.
+ */
+ public final static String FILLIN_MINUTE_NUM = "<mnum>";
+ 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
new file mode 100644
index 000000000000..eb13e2f8b65c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.java
@@ -0,0 +1,1320 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.agenda;
+
+import java.util.List;
+
+import com.sun.star.awt.FocusEvent;
+import com.sun.star.awt.Key;
+import com.sun.star.awt.KeyEvent;
+import com.sun.star.awt.KeyModifier;
+import com.sun.star.awt.Selection;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XFocusListener;
+import com.sun.star.awt.XKeyListener;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.ui.ControlScroller;
+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.
+ * <br/>
+ * During developement, there has been a few changes which were not *fully* done -
+ * mainly in converting the topics and time boxes from combobox and time box to normal textboxes,
+ * so in the code they might be referenced as combobox or timebox. This should be
+ * rather understood as topicstextbox and timetextbox.
+ * <br/>
+ * <br/>
+ * Important behaiviour of this control is that there is always a
+ * blank row at the end, in which the user can enter data.<br/>
+ * Once the row is not blank (thus, the user entered data...),
+ * a new blank row is added.<br/>
+ * Once the user removes the last *unempty* row, by deleteing its data, it becomes
+ * the *last empty row* and the one after is being automatically removed.<br/>
+ * <br/>
+ * The contorl shows 5 rows at a time.<br/>
+ * If, for example, only 2 rows exist (from which the 2ed one is empty...)
+ * then the other three rows, which do not exist in the data model, are disabled.
+ * <br/>
+ * The following other functionality is implemented:
+ * <br/>
+ * 0. synchroniting data between controls, data model and live preview.
+ * 1. Tab scrolling.<br/>
+ * 2. Keyboard scrolling.<br/>
+ * 3. Removing rows and adding new rows.<br/>
+ * 4. Moving rows up and down. <br/>
+ * <br/>
+ * This control relays on the ControlScroller control which uses the following
+ * Data model:<br/>
+ * 1. It uses a vector, whos members are arrays of PropertyValue.<br/>
+ * 2. Each array represents a row.<br/>
+ * (Note: the Name and Value memebrs of the PropertyValue object are being used...)
+ * 3. Each property Value represents a value for a single control with the following rules:<br/>
+ * 3. a. the Value of the property is used for as value of the controls (usually text).<br/>
+ * 3. b. the Name of the property is used to map values to UI controls in the following manner:<br/>
+ * 3. b. 1. only the Name of the first X Rows is regarded, where X is the number of visible rows
+ * (in the agenda wizard this would be 5, since 5 topic rows are visible on the dialog).<br/>
+ * 3. b. 2. The Names of the first X (or 5...) rows are the names of the UI Controls to
+ * hold values. When the control scroller scrolls, it looks at the first 5 rows and uses
+ * the names specified there to map the current values to the specified controls.
+ * <br/>
+ * This data model makes the following limitations on the implementation:
+ * When moving rows, only the values should be moved. The Rows objects, which contain
+ * also the Names of the controls should not be switched. <br/>
+ * also when deleting or inserting rows, attention should be paid that no rows should be removed
+ * or inserted. Instead, only the Values should rotate.
+ * <br/>
+ * <br/>
+ * To save the topics in the registry a ConfigSet of objects of type CGTopic is
+ * being used.
+ * This one is not synchronized "live", since it is unnecessary... instead, it is
+ * synchronized on call, before the settings should be saved.
+ */
+public class TopicsControl extends ControlScroller implements XFocusListener
+{
+
+ /**
+ * The name prefix of the number (label) controls
+ */
+ public static final String LABEL = "lblTopicCnt_";
+ /**
+ * The name prefix of the topic (text) controls
+ */
+ public static final String TOPIC = "txtTopicTopic_";
+ /**
+ * The name prefix of the responsible (text) controls
+ */
+ public static final String RESP = "cbTopicResp_";
+ /**
+ * The name prefix of the time (text) controls
+ */
+ public static final String TIME = "txtTopicTime_";
+ Object lastFocusControl;
+ int lastFocusRow;
+ /**
+ * the last
+ * topic text box.
+ * When pressing tab on this one a scroll down *may* be performed.
+ */
+ private Object firstTopic;
+ /**
+ * the first time box.
+ * 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.
+ */
+ private int tabIndex = 520;
+
+ /**
+ * create a new TopicControl. Since this is used specifically for the
+ * agenda dialog, I use step 5, and constant location - and need no paramter...
+ * @param dialog the parent dialog
+ * @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);
+ initializeScrollFields(agenda);
+ initialize(agenda.cp_Topics.getSize() + 1);
+
+ // set some focus listeners for TAB scroll down and up...
+ try
+ {
+
+ // prepare scroll down on tab press...
+ 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);
+
+ addKeyListener(lastTime, (XKeyListener) dialog.getGuiEventListener());
+
+ //prepare scroll up on tab press...
+ firstTopic = ((ControlRow) ControlGroupVector.get(0)).textbox;
+
+ mi = new MethodInvocation("firstControlKeyPressed", this, KeyEvent.class);
+ dialog.getGuiEventListener().add(TOPIC + 0, EventNames.EVENT_KEY_PRESSED, mi);
+
+ addKeyListener(firstTopic, (XKeyListener) dialog.getGuiEventListener());
+
+ }
+ catch (NoSuchMethodException ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+
+ /**
+ * Is used to add a keylistener to different controls...
+ */
+ 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);
+ xlastControl.addFocusListener(listener);
+ }
+
+ /**
+ * Implementation of the parent class...
+ */
+ protected void initializeScrollFields()
+ {
+ }
+
+ /**
+ * initializes the data of the control.
+ * @param agenda
+ */
+ 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++)
+ {
+ PropertyValue[] row = newRow(i);
+ ((CGTopic) agenda.cp_Topics.getElementAt(i)).setDataToRow(row);
+ // a parent class method
+ registerControlGroup(row, i);
+ this.updateDocumentRow(i);
+ }
+ // inserts a blank row at the end...
+ insertRowAtEnd();
+ }
+
+ /**
+ * Insert a blank (empty) row
+ * as last row of the control.
+ * The control has always a blank row at the
+ * end, which enables the user to enter data...
+ */
+ protected void insertRowAtEnd()
+ {
+ int l = scrollfields.size();
+ 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);
+ }
+ }
+
+ /**
+ * The Topics Set in the CGAgenda object is synchronized to
+ * the current content of the topics.
+ * @param agenda
+ */
+ void saveTopics(CGAgenda agenda)
+ {
+ agenda.cp_Topics.clear();
+ for (int i = 0; i < scrollfields.size() - 1; i++)
+ {
+ agenda.cp_Topics.add(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)
+ {
+ super.fillupControls(guiRow);
+ ((ControlRow) ControlGroupVector.get(guiRow)).setEnabled(true);
+ }
+
+ /**
+ * remove the last row
+ */
+ 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)
+ {
+ setScrollValue(nscrollvalue - 1);
+ }
+ }
+ // if we should disable a row...
+ else if (nscrollvalue == 0 && l - 1 < nblockincrement)
+ {
+ ControlRow cr = (ControlRow) ControlGroupVector.get(l - 1);
+ cr.setEnabled(false);
+ }
+
+ unregisterControlGroup(l - 1);
+ setTotalFieldCount(l - 1);
+ }
+
+ /**
+ * 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);
+ focusGained(xc);
+ }
+
+ /**
+ * Sometimes I set the focus programatically to a control
+ * (for example when moving a row up or down, the focus should move
+ * with it).
+ * In such cases, no VCL event is being triggered so it must
+ * be called programtically.
+ * This is done by this method.
+ * @param control
+ */
+ private void focusGained(XControl control)
+ {
+ try
+ {
+ //calculate in which row we are...
+ String name = (String) Helper.getUnoPropertyValue(UnoDialog2.getModel(control), "Name");
+ int i = name.indexOf("_");
+ String num = name.substring(i + 1);
+ lastFocusRow = Integer.valueOf(num).intValue() + nscrollvalue;
+ lastFocusControl = control;
+ // enable/disable the buttons...
+ enableButtons();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * 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));
+ }
+
+ /**
+ * compolsary implementation of FocusListener.
+ * @param fe
+ */
+ public void focusLost(FocusEvent fe)
+ {
+ }
+
+ /**
+ * compolsary implementation of FocusListener.
+ * @param 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;
+ }
+
+ /**
+ * move the current row up
+ */
+ public void rowUp()
+ {
+ rowUp(lastFocusRow - nscrollvalue, lastFocusControl);
+ }
+
+ /**
+ * move the current row down.
+ */
+ public void rowDown()
+ {
+ rowDown(lastFocusRow - nscrollvalue, lastFocusControl);
+ }
+
+ private void lockDoc()
+ {
+ //((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.xTextDocument.lockControllers();
+ }
+
+ private void unlockDoc()
+ {
+ //((AgendaWizardDialogImpl)CurUnoDialog).agendaTemplate.xTextDocument.unlockControllers();
+ }
+
+ /**
+ * Removes the current row.
+ * See general class documentation explanation about the
+ * data model used and the limitations which explain the implementation here.
+ */
+ 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);
+ 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);
+ }
+ }
+ removeLastRow();
+ // update the live preview background document
+ reduceDocumentToTopics();
+
+ // the focus should return to the edit control
+ focus(lastFocusControl);
+ 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()
+ {
+ lockDoc();
+ insertRowAtEnd();
+ 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);
+ }
+ }
+
+ // 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);
+ pv1[1].Value = "";
+ pv1[2].Value = "";
+ pv1[3].Value = "";
+
+ // update the preview document.
+ updateDocumentRow(lastFocusRow);
+
+ fillupControls(lastFocusRow - nscrollvalue);
+
+ focus(lastFocusControl);
+ unlockDoc();
+ }
+
+ /**
+ * create a new row with the given index.
+ * The index is important because it is used in the
+ * Name member of the PropertyValue objects.
+ * To know why see general class documentation above (data model explanation).
+ * @param i the index of the new row
+ * @return
+ */
+ 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[2] = Properties.createProperty(RESP + i, "");
+ pv[3] = Properties.createProperty(TIME + i, "");
+ return pv;
+ }
+
+ /**
+ * 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);
+ ControlGroupVector.addElement(oControlRow);
+ tabIndex += 4;
+ }
+
+ /**
+ * 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);
+
+ }
+
+ /**
+ * Checks if a row is empty.
+ * This is used when the last row is changed.
+ * If it is empty, the next row (which is always blank) is removed.
+ * If it is not empty, a next row must exist.
+ * @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);
+
+ // now - is this row empty?
+ return data[1].Value.equals("") &&
+ data[2].Value.equals("") &&
+ data[3].Value.equals("");
+
+ }
+ /**
+ * is used for data tracking.
+ */
+ private Object[] oldData;
+
+ /**
+ * update the preview document and
+ * remove/insert rows if needed.
+ * @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;
+
+ 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...
+ */
+ 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...
+ */
+ 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();
+ }
+
+ }
+ else
+ { // row contains data
+ // is this the last row?
+ if ((guiRow + nscrollvalue + 1) == scrollfields.size())
+ {
+ insertRowAtEnd();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+ }
+
+ /**
+ * return the corresponding row data for the given index.
+ * @param topic index of the topic to get.
+ * @return a PropertyValue array with the data for the given topic.
+ */
+ public PropertyValue[] getTopicData(int topic)
+ {
+ if (topic < scrollfields.size())
+ {
+ return (PropertyValue[]) scrollfields.get(topic);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * If the user presses tab on the last control, and
+ * there *are* more rows in the model, scroll down.
+ * @param 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())
+ {
+ setScrollValue(nscrollvalue + 1);
+ //focus(firstTopic);
+ focus(getControl((ControlRow) ControlGroupVector.get(4), 1));
+
+ }
+ }
+ }
+
+ /**
+ * If the user presses shift-tab on the first control, and
+ * there *are* more rows in the model, scroll up.
+ * @param event
+ */
+ public void firstControlKeyPressed(KeyEvent event)
+ {
+ // if tab with shift was pressed...
+ 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);
+ String text = xTextComponent.getText();
+ xTextComponent.setSelection(new Selection(0, text.length()));
+ XControl xc = (XControl) UnoRuntime.queryInterface(XControl.class, textControl);
+ focusGained(xc);
+ }
+
+ /**
+ * moves the given row one row down.
+ * @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)
+ {
+ // only perform if this is not the last row.
+ int actuallRow = guiRow + nscrollvalue;
+ if (actuallRow + 1 < scrollfields.size())
+ {
+ // get the current selection
+ Selection selection = getSelection(control);
+
+ // the last row should scroll...
+ boolean scroll = guiRow == (nblockincrement - 1);
+ if (scroll)
+ {
+ setScrollValue(nscrollvalue + 1);
+ }
+ int scroll1 = nscrollvalue;
+
+ switchRows(guiRow, guiRow + (scroll ? -1 : 1));
+
+ if (nscrollvalue != scroll1)
+ {
+ guiRow += (nscrollvalue - scroll1);
+ }
+ setSelection(guiRow + (scroll ? 0 : 1), control, selection);
+ }
+ }
+
+ synchronized void rowUp(int guiRow, Object control)
+ {
+ // only perform if this is not the first row
+ int actuallRow = guiRow + nscrollvalue;
+ if (actuallRow > 0)
+ {
+ // get the current selection
+ Selection selection = getSelection(control);
+
+ // the last row should scroll...
+ boolean scroll = (guiRow == 0);
+ if (scroll)
+ {
+ setScrollValue(nscrollvalue - 1);
+ }
+ switchRows(guiRow, guiRow + (scroll ? 1 : -1));
+
+ setSelection(guiRow - (scroll ? 0 : 1), control, selection);
+ }
+ }
+
+ /**
+ * moves the cursor up.
+ * @param guiRow
+ * @param 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)
+ {
+ return;
+ // the first row should scroll...
+ }
+ boolean scroll = (guiRow == 0);
+ ControlRow upperRow;
+ if (scroll)
+ {
+ setScrollValue(nscrollvalue - 1);
+ upperRow = (ControlRow) ControlGroupVector.get(guiRow);
+ }
+ else
+ {
+ upperRow = (ControlRow) ControlGroupVector.get(guiRow - 1);
+ }
+ focus(getControl(upperRow, control));
+
+ }
+
+ /**
+ * moves the cursor down
+ * @param guiRow
+ * @param 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 we scrolled we are done...
+ //otherwise...
+ 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)
+ {
+ 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++)
+ {
+ temp = o1[i].Value;
+ o1[i].Value = o2[i].Value;
+ o2[i].Value = temp;
+ }
+
+ fillupControls(row1);
+ fillupControls(row2);
+
+ 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()))
+ {
+ insertRowAtEnd();
+ /*
+ * if we did not change the last row but
+ * we did change the one before - check if we
+ * 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))
+ {
+ removeLastRow();
+ reduceDocumentToTopics();
+ }
+ }
+ }
+
+ /**
+ * returns the current Selection of a text field
+ * @param control a text field from which the Selection object
+ * should be gotten.
+ * @return the selection object.
+ */
+ private Selection getSelection(Object control)
+ {
+ return ((XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, control)).getSelection();
+ }
+
+ /**
+ * sets a text selection to a given control.
+ * This is used when one moves a row up or down.
+ * After moving row X to X+/-1, the selection (or cursor position) of the
+ * last focused control should be restored.
+ * The control's row is the given guiRow.
+ * The control's column is detecte4d according to the given event.
+ * This method is called as subsequent to different events,
+ * thus it is comfortable to use the event here to detect the column,
+ * rather than in the different event methods.
+ * @param guiRow the row of the control to set the selection to.
+ * @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);
+ Object control = getControl(cr, eventSource);
+ ((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");
+ }
+ }
+
+ /**
+ * returns a control out of the given row, which is
+ * in the same column as the given control.
+ * @param cr control row object
+ * @param control a control indicating a column.
+ * @return
+ */
+ private Object getControl(ControlRow cr, Object control)
+ {
+ int column = getColumn(control);
+ return getControl(cr, column);
+ }
+
+ /**
+ * returns the column number of the given control.
+ * @param control
+ * @return
+ */
+ private int getColumn(Object control)
+ {
+ String name = (String) Helper.getUnoPropertyValue(UnoDialog2.getModel(control), "Name");
+ if (name.startsWith(TOPIC))
+ {
+ return 1;
+ }
+ if (name.startsWith(RESP))
+ {
+ return 2;
+ }
+ if (name.startsWith(TIME))
+ {
+ return 3;
+ }
+ 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));
+ }
+
+ /**
+ * update the given row in the preview document with the given data.
+ * @param row
+ * @param data
+ */
+ private void updateDocumentRow(int row, PropertyValue[] data)
+ {
+ try
+ {
+ ((AgendaWizardDialogImpl) CurUnoDialog).agendaTemplate.topics.write(row, data);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * updates a single cell in the preview document.
+ * Is called when a single value is changed, since we really
+ * don't have to update the whole row for one small changhe...
+ * @param row the data row to update (topic number).
+ * @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);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * when removeing rows, this method updates
+ * 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);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * needed to make this data poblic.
+ * @return the List containing the topics data.
+ */
+ public List getTopicsData()
+ {
+ return scrollfields;
+ }
+ /**
+ * A static member used for the child-class ControlRow (GUI Constant)
+ */
+ private static Integer I_12 = new Integer(12);
+ /**
+ * A static member used for the child-class ControlRow (GUI Constant)
+ */
+ private static Integer I_8 = new Integer(8);
+ /**
+ * 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"
+ };
+ /**
+ * 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"
+ };
+
+ /**
+ *
+ * @author rp143992
+ * A class represting a single GUI row.
+ * Note that the instance methods of this class
+ * are being called and handle controls of
+ * a single row.
+ */
+ public class ControlRow implements XKeyListener
+ {
+
+ /**
+ * the number (label) control
+ */
+ Object label;
+ /**
+ * the topic (text) control
+ */
+ Object textbox;
+ /**
+ * the responsible (text, yes, text) control
+ */
+ Object combobox;
+ /**
+ * the time (text, yes, text) control
+ */
+ Object timebox;
+ /**
+ * the row offset of this instance (0 = first gui row)
+ */
+ int offset;
+
+ /**
+ * called through an event listener when the
+ * topic text is changed by the user.
+ * updates the data model and the preview document.
+ */
+ public void topicTextChanged()
+ {
+ try
+ {
+ // update the data model
+ fieldInfo(offset, 1);
+ // update the preview document
+ fieldChanged(offset, 1);
+ }
+ 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
+ {
+ // update the data model
+ fieldInfo(offset, 2);
+ // update the preview document
+ fieldChanged(offset, 2);
+ }
+ 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
+ {
+ // update the data model
+ fieldInfo(offset, 3);
+ // update the preview document
+ fieldChanged(offset, 3);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * constructor. Create the row in the given dialog given cordinates,
+ * with the given offset (row number) and tabindex.
+ * Note that since I use this specifically for the agenda wizard,
+ * the step and all control coordinates inside the
+ * row are constant (5).
+ * @param dialog the agenda dialog
+ * @param x x coordinates
+ * @param y y coordinates
+ * @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)
+ {
+
+ offset = i;
+
+ Integer y_ = new Integer(y);
+
+ 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)
+ });
+
+ 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)
+ });
+
+ 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,
+ 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)
+ });
+
+ setEnabled(false);
+ addKeyListener(textbox, this);
+ addKeyListener(combobox, this);
+ addKeyListener(timebox, this);
+
+ addFocusListener(textbox, TopicsControl.this);
+ addFocusListener(combobox, TopicsControl.this);
+ addFocusListener(timebox, TopicsControl.this);
+
+ }
+
+ /**
+ * not implemented.
+ * @param visible
+ */
+ 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)
+ {
+ Boolean b = enabled ? Boolean.TRUE : Boolean.FALSE;
+ 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);
+ }
+ 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();
+ }
+
+ /**
+ * returns the column number of the given control.
+ * The given control must belong to this row or
+ * an IllegalArgumentException will accure.
+ * @param control
+ * @return an int columnd number of the given control (0 to 3).
+ */
+ private int getColumn(Object control)
+ {
+ if (control == textbox)
+ {
+ return 1;
+ }
+ else if (control == combobox)
+ {
+ return 2;
+ }
+ else if (control == timebox)
+ {
+ return 3;
+ }
+ 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 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 isUp(KeyEvent e)
+ {
+ return (e.KeyCode == Key.UP) && (e.Modifiers == 0);
+ }
+
+ public void keyReleased(KeyEvent arg0)
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
+ */
+ public void disposing(EventObject arg0)
+ {
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/agenda/makefile.mk b/wizards/com/sun/star/wizards/agenda/makefile.mk
new file mode 100644
index 000000000000..314dcf3b7da9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/agenda/makefile.mk
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = agenda
+PACKAGE = com$/sun$/star$/wizards$/agenda
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar \
+ jurt.jar \
+ ridl.jar \
+ juh.jar \
+ java_uno.jar \
+ java_uno_accessbridge \
+ commonwizards.jar
+
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/agenda
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ AgendaTemplate.java \
+ AgendaWizardDialog.java \
+ AgendaWizardDialogConst.java \
+ AgendaWizardDialogImpl.java \
+ AgendaWizardDialogResources.java \
+ CGAgenda.java \
+ CGTopic.java \
+ CallWizard.java \
+ TemplateConsts.java \
+ TopicsControl.java
+
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.java b/wizards/com/sun/star/wizards/common/ConfigGroup.java
new file mode 100644
index 000000000000..1b260132a5f4
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/ConfigGroup.java
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.lang.reflect.Field;
+
+/**
+ *
+ * @author rpiterman
+ */
+public class ConfigGroup implements ConfigNode
+{
+
+ public Object root;
+
+ 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
+ {
+ writeField(fields[i], configurationView, (String) param);
+ }
+ 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
+ {
+ String propertyName = field.getName().substring(prefix.length());
+ //System.out.println("Going to save:" + propertyName);
+ Class fieldType = field.getType();
+ 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())
+ {
+ Configuration.set(convertValue(field), propertyName, configView);
+ }
+ 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
+ * Java Object value.
+ * @param field
+ * @return the value of the field as a Object.
+ * @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))
+ {
+ return new Double(field.getDouble(this));
+ }
+ //System.out.println("ohoh...");
+ return null; //and good luck with it :-) ...
+ }
+
+ 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
+ {
+ readField(fields[i], configurationView, (String) param);
+ }
+ 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
+ {
+ String propertyName = field.getName().substring(prefix.length());
+
+ Class fieldType = field.getType();
+ 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())
+ {
+ 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))
+ {
+ field.set(this, Configuration.getString(propertyName, configView));
+ }
+ }
+
+ 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
new file mode 100644
index 000000000000..23c0f9c5ba81
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/ConfigNode.java
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+/**
+ * This Interface specifies a method of an object which is
+ * capable of reading adn writing its data out of the
+ * OO Configuration. <br/>
+ * There are 2 direct implementations: ConfigGroup and ConfigSet.
+ * The root is the first Java Object in the configuration hirarchie.
+ * @author rpiterman
+ */
+public interface ConfigNode
+{
+
+ /**
+ * reads the object data out of the configuration.
+ * @param configurationView is a ::com::sun::star::configuration::HierarchyElement
+ * which represents the node corresponding to the Object.
+ * @param param a free parameter. Since the intension of this interface is
+ * to be used in a tree like way, reading objects and subobjects and so on,
+ * 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);
+}
diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.java b/wizards/com/sun/star/wizards/common/ConfigSet.java
new file mode 100644
index 000000000000..216f91b5e430
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/ConfigSet.java
@@ -0,0 +1,452 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.*;
+
+import javax.swing.ListModel;
+import javax.swing.event.ListDataEvent;
+
+
+import org.w3c.dom.*;
+
+/**
+ *
+ * @author rpiterman
+ */
+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.
+ * If it is true, it will remove any nulls from
+ * the vector.
+ * subclasses can change this field in the constructor
+ * 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)
+ {
+ childClass = childType;
+ }
+
+ public void add(String name, Object child)
+ {
+ childrenMap.put(name, child);
+ 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)
+ {
+ childrenList.add(child);
+ fireListDataListenerIntervalAdded(getSize() - 1, getSize() - 1);
+ }
+ }
+
+ 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
+ {
+ return childClass.newInstance();
+ }
+
+ public void writeConfiguration(Object configView, Object param)
+ {
+ Object[] names = childrenMap.keySet().toArray();
+
+ 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]);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ } // 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)
+ {
+ 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)
+ {
+ String[] names = Configuration.getChildrenNames(configurationView);
+
+ if (ConfigNode.class.isAssignableFrom(childClass))
+ {
+
+ 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)
+ {
+ 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
+ {
+ Object child = Configuration.getNode(names[i], configurationView);
+ add(names[i], child);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void remove(Object obj)
+ {
+ Object key = getKey(obj);
+ childrenMap.remove(key);
+ int i = childrenList.indexOf(obj);
+ childrenList.remove(obj);
+ fireListDataListenerIntervalRemoved(i, i);
+ }
+
+ public void remove(int i)
+ {
+ Object o = getElementAt(i);
+ remove(o);
+ }
+
+ public void clear()
+ {
+ childrenMap.clear();
+ childrenList.clear();
+ }
+
+ public void update(int i)
+ {
+ fireListDataListenerContentsChanged(i, i);
+ }
+
+ public Node createDOM(Node parent)
+ {
+
+ Object[] items = items();
+
+ for (int i = 0; i < items.length; i++)
+ {
+ Object item = items[i];
+ if (item instanceof XMLProvider)
+ {
+ ((XMLProvider) item).createDOM(parent);
+ }
+ }
+ return parent;
+ }
+
+ public Object[] items()
+ {
+ return childrenList.toArray();
+ }
+
+ 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)
+ {
+ int c = 0;
+ 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)
+ {
+ root = newRoot;
+ }
+
+ /** Registers ListDataListener to receive events.
+ * @param listener The listener to register.
+ *
+ */
+ 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);
+ }
+
+ /** Removes ListDataListener from the list of listeners.
+ * @param listener The listener to remove.
+ *
+ */
+ public synchronized void removeListDataListener(javax.swing.event.ListDataListener listener)
+ {
+ listenerList.remove(javax.swing.event.ListDataListener.class, listener);
+ }
+
+ /** Notifies all registered listeners about the event.
+ *
+ * @param event The event to be fired
+ *
+ */
+ 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)
+ {
+ ((javax.swing.event.ListDataListener) listeners[i + 1]).intervalAdded(event);
+ }
+ }
+ }
+
+ /** Notifies all registered listeners about the event.
+ *
+ * @param event The event to be fired
+ *
+ */
+ 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)
+ {
+ ((javax.swing.event.ListDataListener) listeners[i + 1]).intervalRemoved(event);
+ }
+ }
+ }
+
+ /** Notifies all registered listeners about the event.
+ *
+ * @param event The event to be fired
+ *
+ */
+ 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)
+ {
+ ((javax.swing.event.ListDataListener) listeners[i + 1]).contentsChanged(event);
+ }
+ }
+ }
+
+ public Object getElementAt(int i)
+ {
+ return childrenList.get(i);
+ }
+
+ public Object getElement(Object o)
+ {
+ return childrenMap.get(o);
+ }
+
+ public int getSize()
+ {
+ return childrenList.size();
+ }
+
+ public Set keys()
+ {
+ return childrenMap.keySet();
+ }
+
+ public int getIndexOf(Object item)
+ {
+ return childrenList.indexOf(item);
+ }
+
+ /**
+ * Set members might include a property
+ * which orders them.
+ * This method reindexes the given member to be
+ * the index number 0
+ * Do not forget to call commit() after calling this method.
+ * @param confView
+ * @param memebrName
+ */
+ 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
+ * to a vector, ordered by there index property
+ */
+ String[] names = Configuration.getChildrenNames(confView);
+ Vector v = new Vector(names.length);
+ Object member = null;
+ int index = 0;
+ for (int i = 0; i < names.length; i++)
+ {
+ 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++)
+ {
+ member = v.get(i);
+ if (member != null)
+ {
+ Configuration.set(index++, indexPropertyName, member);
+ }
+ }
+
+ }
+
+ 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
new file mode 100644
index 000000000000..103fdc5848a2
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/Configuration.java
@@ -0,0 +1,457 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.beans.*;
+import com.sun.star.container.*;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.Locale;
+import com.sun.star.util.XChangesBatch;
+
+/**
+ * This class gives access to the OO configuration api.
+ * It contains 4 get and 4 set convenience methods for getting and settings properties
+ * in the configuration. <br/>
+ * For the get methods, two parameters must be given: name and parent, where name is the
+ * name of the property, parent is a HierarchyElement (::com::sun::star::configuration::HierarchyElement)<br/>
+ * The get and set methods support hieryrchical property names like "options/gridX". <br/>
+ * NOTE: not yet supported, but sometime later,
+ * If you will ommit the "parent" parameter, then the "name" parameter must be in hierarchy form from
+ * the root of the registry.
+ * @author rpiterman
+ */
+public abstract class Configuration
+{
+
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ Object o = getNode(name, parent);
+ if (AnyConverter.isVoid(o))
+ {
+ return "";
+ }
+ return (String) o;
+ }
+
+ 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
+ {
+ return ((XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, parent)).getByName(name);
+ }
+
+ 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
+ {
+ set(new Short(value), name, parent);
+ }
+
+ 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
+ {
+ 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
+ {
+ ((XHierarchicalPropertySet) UnoRuntime.queryInterface(XHierarchicalPropertySet.class, parent)).setHierarchicalPropertyValue(name, value);
+ }
+
+ /** Creates a new instance of RegistryEntry
+ * @param name
+ * @param parent
+ * @return
+ * @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
+ {
+
+ Object oConfigProvider;
+ oConfigProvider = xmsf.createInstance("com.sun.star.configuration.ConfigurationProvider");
+ XMultiServiceFactory confMsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
+
+ final String sView = updateable ? "com.sun.star.configuration.ConfigurationUpdateAccess" : "com.sun.star.configuration.ConfigurationAccess";
+
+ Object args[] = new Object[updateable ? 2 : 1];
+
+ PropertyValue aPathArgument = new PropertyValue();
+ aPathArgument.Name = "nodepath";
+ aPathArgument.Value = sPath;
+
+ args[0] = aPathArgument;
+
+ if (updateable)
+ {
+
+ PropertyValue aModeArgument = new PropertyValue();
+ aModeArgument.Name = "lazywrite";
+ aModeArgument.Value = Boolean.FALSE;
+
+ args[1] = aModeArgument;
+ }
+
+ return confMsf.createInstanceWithArguments(sView, args);
+ }
+
+ public static String[] getChildrenNames(Object configView)
+ {
+ XNameAccess nameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, configView);
+ return nameAccess.getElementNames();
+ }
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ public static String getOfficeLocaleString(XMultiServiceFactory xMSF)
+ {
+ String sLocale = "";
+ try
+ {
+ Locale aLocLocale = new Locale();
+ Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
+ sLocale = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return sLocale;
+ }
+
+ public static Locale getOfficeLocale(XMultiServiceFactory xMSF)
+ {
+ Locale aLocLocale = new Locale();
+ // Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
+ // String sLocale = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
+ String sLocale = getOfficeLocaleString(xMSF);
+ 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
+ {
+ Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
+ String sLinguistic = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
+ return sLinguistic;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * This method creates a new configuration node and adds it
+ * to the given view. Note that if a node with the given name
+ * already exists it will be completely removed from
+ * the configuration.
+ * @param configView
+ * @param name
+ * @return the new created configuration node.
+ * @throws com.sun.star.lang.WrappedTargetException
+ * @throws ElementExistException
+ * @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
+ {
+
+ XNameContainer xNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, configView);
+
+ if (xNameContainer == null)
+ {
+ XNameReplace xNameReplace = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, configView);
+ return xNameReplace.getByName(name);
+ }
+ else
+ {
+
+ /*if (xNameContainer.hasByName(name))
+ xNameContainer.removeByName(name);*/
+
+ // create a new detached set element (instance of DataSourceDescription)
+ XSingleServiceFactory xElementFactory = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, configView);
+
+ // the new element is the result !
+ Object newNode = xElementFactory.createInstance();
+ // insert it - this also names the element
+ xNameContainer.insertByName(name, newNode);
+
+ return newNode;
+ }
+ }
+
+ 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
+ {
+ 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
+ {
+ Object view = Configuration.getConfigurationRoot(xmsf, path, true);
+ addConfigNode(path, name);
+ node.writeConfiguration(view, param);
+ XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, view);
+ 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
+ {
+ 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[] 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;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return snames;
+ }
+ }
+
+ 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 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)
+ {
+ 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]));
+ }
+ }
+ }
+ 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);
+ }
+ 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;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/DebugHelper.java b/wizards/com/sun/star/wizards/common/DebugHelper.java
new file mode 100644
index 000000000000..b560fb643a40
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/DebugHelper.java
@@ -0,0 +1,58 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.uno.Exception;
+
+/**
+ *
+ * @author ll93751
+ */
+public class DebugHelper
+{
+
+ public static void exception(String DetailedMessage, Exception ex, int err, String additionalArgument) throws java.lang.Exception
+ {
+// throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public static void exception(int err, String additionalArgument) throws java.lang.Exception
+ {
+// throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public static void exception(Exception ex) throws java.lang.Exception
+ {
+// throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public static void writeInfo(String msg)
+ {
+// 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
new file mode 100644
index 000000000000..c9292b58c1b4
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/Desktop.java
@@ -0,0 +1,509 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.Date;
+
+// import com.sun.star.awt.XToolkit;
+import com.sun.star.beans.PropertyValue;
+// import com.sun.star.frame.XDesktop;
+// import com.sun.star.frame.XFrame;
+// import com.sun.star.frame.XFramesSupplier;
+
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XNamingService;
+import com.sun.star.util.XURLTransformer;
+import com.sun.star.lang.Locale;
+import com.sun.star.uno.XInterface;
+import com.sun.star.bridge.XUnoUrlResolver;
+import com.sun.star.comp.helper.Bootstrap;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.XHierarchicalNameAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.util.XStringSubstitution;
+import com.sun.star.frame.*;
+import com.sun.star.i18n.KParseType;
+import com.sun.star.i18n.ParseResult;
+import com.sun.star.i18n.XCharacterClassification;
+
+public class Desktop
+{
+
+ /** Creates a new instance of Desktop */
+ public Desktop()
+ {
+ }
+
+ public static XDesktop getDesktop(XMultiServiceFactory xMSF)
+ {
+ com.sun.star.uno.XInterface xInterface = null;
+ XDesktop xDesktop = null;
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+ else
+ {
+ System.out.println("Can't create a desktop. null pointer !");
+ }
+ return xDesktop;
+ }
+
+ 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)
+ {
+ XFrame xFrame = getActiveFrame(_xMSF);
+ return (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
+ }
+
+ public static XTextDocument getActiveTextDocument(XMultiServiceFactory _xMSF)
+ {
+ XComponent xComponent = getActiveComponent(_xMSF);
+ return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ }
+
+ 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
+ {
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ return null;
+ }
+
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ return null;
+ }
+
+ 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)
+ {
+ dispatchURL(xMSF, sURL, xFrame, "");
+ }
+
+ 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
+ {
+ 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
+ {
+ XMultiComponentFactory componentFactory = getMultiComponentFactory();
+ Object xUrlResolver = componentFactory.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", null );
+ XUnoUrlResolver urlResolver = UnoRuntime.queryInterface(XUnoUrlResolver.class, xUrlResolver);
+ XMultiServiceFactory orb = UnoRuntime.queryInterface(XMultiServiceFactory.class, urlResolver.resolve( connectStr ) );
+ return orb;
+ }
+
+ public static String getIncrementSuffix(XNameAccess xElementContainer, String ElementName)
+ {
+ boolean bElementexists = true;
+ int i = 1;
+ String sIncSuffix = "";
+ String BaseName = ElementName;
+ while (bElementexists == true)
+ {
+ bElementexists = xElementContainer.hasByName(ElementName);
+ 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)
+ {
+ boolean bElementexists = true;
+ int i = 1;
+ String sIncSuffix = "";
+ String BaseName = ElementName;
+ while (bElementexists == true)
+ {
+ bElementexists = xElementContainer.hasByHierarchicalName(ElementName);
+ 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 String removeSpecialCharacters(XMultiServiceFactory _xMSF, Locale _aLocale, String _sname)
+ {
+ String snewname = _sname;
+ int i = 0;
+ while (i < snewname.length())
+ {
+ i = Desktop.checkforfirstSpecialCharacter(_xMSF, snewname, _aLocale);
+ 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
+ * @param xElementContainer
+ * @param sElementName
+ * @return a unique Name ready to be added to the container.
+ */
+ public static String getUniqueName(XNameAccess xElementContainer, String sElementName)
+ {
+ String sIncSuffix = getIncrementSuffix(xElementContainer, sElementName);
+ return sElementName + sIncSuffix;
+ }
+
+ /**
+ * Checks if the passed Element Name already exists in the ElementContainer. If yes it appends a
+ * suffix to make it unique
+ * @param xElementContainer
+ * @param sElementName
+ * @return a unique Name ready to be added to the container.
+ */
+ 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
+ * @param _slist
+ * @param _sElementName
+ * @param _sSuffixSeparator
+ * @return a unique Name not being in the passed list.
+ */
+ 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++)
+ {
+ if (JavaTools.FieldInList(_slist, scompname) == -1)
+ {
+ return scompname;
+ }
+ }
+ scompname = _sElementName + _sSuffixSeparator + a++;
+ }
+ return "";
+ }
+
+ /**
+ * @deprecated use Configuration.getConfigurationRoot() with the same parameters instead
+ * @param xMSF
+ * @param KeyName
+ * @param bForUpdate
+ * @return
+ */
+ 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");
+ aNodePath[0] = new PropertyValue();
+ aNodePath[0].Name = "nodepath";
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ /**
+ * @deprecated used to retrieve the most common paths used in the office application
+ * @author bc93774
+ *
+ */
+ public class OfficePathRetriever
+ {
+
+ public String TemplatePath;
+ public String BitmapPath;
+ public String UserTemplatePath;
+ public String WorkPath;
+
+ 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)
+ {
+ }
+ }
+ }
+
+ public static String getTemplatePath(XMultiServiceFactory _xMSF)
+ {
+ try
+ {
+ String sTemplatePath = FileAccess.getOfficePath(_xMSF, "Template", "share", "/wizard");
+ return sTemplatePath;
+ }
+ catch (NoValidPathException nopathexception)
+ {
+ }
+ return "";
+ }
+
+ public static String getUserTemplatePath(XMultiServiceFactory _xMSF)
+ {
+ try
+ {
+ String sUserTemplatePath = FileAccess.getOfficePath(_xMSF, "Template", "user", "");
+ return sUserTemplatePath;
+ }
+ catch (NoValidPathException nopathexception)
+ {
+ }
+ return "";
+ }
+
+ public static String getBitmapPath(XMultiServiceFactory _xMSF)
+ {
+ try
+ {
+ String sBitmapPath = FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/wizard/bitmap");
+ return sBitmapPath;
+ }
+ catch (NoValidPathException nopathexception)
+ {
+ }
+ return "";
+ }
+
+ public static String getWorkPath(XMultiServiceFactory _xMSF)
+ {
+ try
+ {
+ String sWorkPath = FileAccess.getOfficePath(_xMSF, "Work", "", "");
+ return sWorkPath;
+ }
+ catch (NoValidPathException nopathexception)
+ {
+ }
+ return "";
+ }
+
+ 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;
+ }
+ }
+
+ /**
+ * This method searches (and hopefully finds...) a frame
+ * with a componentWindow.
+ * It does it in three phases:
+ * 1. Check if the given desktop argument has a componentWindow.
+ * If it is null, the myFrame argument is taken.
+ * 2. Go up the tree of frames and search a frame with a component window.
+ * 3. Get from the desktop all the components, and give the first one
+ * which has a frame.
+ * @param xMSF
+ * @param myFrame
+ * @param desktop
+ * @return
+ * @throws NoSuchElementException
+ * @throws WrappedTargetException
+ */
+ public static XFrame findAFrame(XMultiServiceFactory xMSF, XFrame myFrame, XFrame desktop)
+ throws NoSuchElementException,
+ WrappedTargetException
+ {
+ if (desktop == null)
+ {
+ desktop = myFrame; // we go up in the tree...
+ }
+ while (desktop != null && desktop.getComponentWindow() == null)
+ {
+ desktop = desktop.findFrame("_parent", FrameSearchFlag.PARENT);
+ }
+ if (desktop == null)
+ {
+
+ 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
new file mode 100644
index 000000000000..6278d7e71a97
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/FileAccess.java
@@ -0,0 +1,1200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.beans.XPropertySet;
+import com.sun.star.lang.Locale;
+import com.sun.star.uno.Exception;
+import com.sun.star.util.XMacroExpander;
+// import com.sun.star.wizards.common.NoValidPathException;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Vector;
+
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.io.XActiveDataSink;
+import com.sun.star.io.XInputStream;
+// import com.sun.star.io.XStream;
+import com.sun.star.io.XTextInputStream;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.ucb.*;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.DateTime;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.document.XDocumentProperties;
+
+/**
+ * This class delivers static convenience methods
+ * to use with ucb SimpleFileAccess service.
+ * You can also instanciate the class, to encapsulate
+ * some functionality of SimpleFileAccess. The instance
+ * keeps a reference to an XSimpleFileAccess and an
+ * XFileIdentifierConverter, saves the permanent
+ * overhead of quering for those interfaces, and delivers
+ * conveneince methods for using them.
+ * These Convenince methods include mainly Exception-handling.
+ */
+public class FileAccess
+{
+
+ /**
+ *
+ * @param xMSF
+ * @param sPath
+ * @param 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
+ // simple String comparison to find out, if a path is already in "ResultPath"
+ String[] PathList = JavaTools.ArrayoutofString(ResultPath, ";");
+ int MaxIndex = PathList.length - 1;
+ String CompCurPath;
+ // sAddPath.replace(null, (char) 47);
+ String CompAddPath = JavaTools.replaceSubString(sAddPath, "", "/");
+ String CurPath;
+ for (int i = 0; i <= MaxIndex; i++)
+ {
+ CurPath = JavaTools.convertfromURLNotation(PathList[i]);
+ CompCurPath = JavaTools.replaceSubString(CurPath, "", "/");
+ if (CompCurPath.equals(CompAddPath))
+ {
+ return;
+ }
+ }
+ ResultPath += ";" + sAddPath;
+ return;
+ }
+
+ public static String deleteLastSlashfromUrl(String _sPath)
+ {
+ if (_sPath.endsWith("/"))
+ {
+ return _sPath.substring(0, _sPath.length() - 1);
+ }
+ else
+ {
+ return _sPath;
+ }
+ }
+
+ /**
+ * 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)
+ {
+ exception.printStackTrace(System.out);
+ return "";
+ }
+ }
+
+ /**
+ * Further information on arguments value see in OO Developer Guide,
+ * chapter 6.2.7
+ * @param xMSF
+ * @param sPath
+ * @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
+ * @param sSearchDir
+ * @return
+ * @throws NoValidPathException
+ */
+ 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;
+
+ boolean bexists = false;
+ 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;
+ 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");
+ 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++)
+ {
+ ReadPaths[t] = Template_internal[i];
+ t++;
+ }
+ 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"))
+ {
+ ResultPath = WritePath;
+ bexists = true;
+ }
+ 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))
+ {
+ ResultPath = ReadPaths[i];
+ bexists = true;
+ break;
+ }
+ }
+ }
+ ResultPath = deleteLastSlashfromUrl(ResultPath);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ ResultPath = "";
+ }
+ if (bexists == false)
+ {
+ throw new NoValidPathException(xMSF, "");
+ }
+ return ResultPath;
+ }
+
+ public static ArrayList<String> getOfficePaths(XMultiServiceFactory xMSF, String _sPath, String sType, String sSearchDir) throws NoValidPathException
+ {
+ //This method currently only works with sPath="Template"
+
+ // String ResultPath = "";
+ ArrayList<String> aPathList = new ArrayList<String>();
+ String Template_writable = "";
+ String[] Template_internal;
+ String[] Template_user;
+
+ // String [] ReadPaths = null;
+
+ // boolean bexists = false;
+ 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 = "";
+ // 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");
+
+ // int iNumEntries = Template_user.length + Template_internal.length + 1;
+ for (int i = 0; i < Template_internal.length; i++)
+ {
+ String sPath = Template_internal[i];
+ if (sPath.startsWith("vnd."))
+ {
+ String sPathToExpand = sPath.substring("vnd.sun.star.Expand:".length());
+
+ XMacroExpander xExpander = Helper.getMacroExpander(xMSF);
+ sPath = xExpander.expandMacros(sPathToExpand);
+ }
+
+ // if there exists a language in the directory, we try to add the right language
+ sPath = checkIfLanguagePathExists(xMSF, sPath);
+
+ aPathList.add(sPath);
+ }
+ for (int i = 0; i < Template_user.length; i++)
+ {
+ aPathList.add(Template_user[i]);
+ }
+ aPathList.add(Template_writable);
+ // WritePath = Template_writable;
+
+// if (sType.equalsIgnoreCase("user"))
+// {
+// ResultPath = WritePath;
+// bexists = true;
+// }
+
+ // 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
+// for (int i = 0; i<ReadPaths.length; i++)
+// {
+// String tmpPath = ReadPaths[i]+sSearchDir;
+// if (xSimpleFileAccess.exists(tmpPath))
+// {
+// ResultPath = ReadPaths[i];
+// bexists = true;
+// break;
+// }
+// }
+// }
+// ResultPath = deleteLastSlashfromUrl(ResultPath);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ // ResultPath = "";
+ }
+// if (bexists == false)
+// {
+// throw new NoValidPathException(xMSF, "");
+// }
+// return ResultPath;
+ return aPathList;
+ }
+
+ private static String checkIfLanguagePathExists(XMultiServiceFactory _xMSF, String _sPath)
+ {
+ try
+ {
+ Object defaults = _xMSF.createInstance("com.sun.star.text.Defaults");
+ Locale aLocale = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
+ if (aLocale == null)
+ {
+ java.util.Locale.getDefault();
+ aLocale = new com.sun.star.lang.Locale();
+ aLocale.Country = java.util.Locale.getDefault().getCountry();
+ aLocale.Language = java.util.Locale.getDefault().getLanguage();
+ aLocale.Variant = java.util.Locale.getDefault().getVariant();
+ }
+
+ String sLanguage = aLocale.Language;
+ String sCountry = aLocale.Country;
+ String sVariant = aLocale.Variant;
+
+ // de-DE-Bayrisch
+ StringBuffer aLocaleAll = new StringBuffer();
+ aLocaleAll.append(sLanguage).append('-').append(sCountry).append('-').append(sVariant);
+ String sPath = _sPath + "/" + aLocaleAll.toString();
+
+ XInterface xInterface = (XInterface) _xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
+ if (xSimpleFileAccess.exists(sPath))
+ {
+ return sPath;
+ }
+
+ // de-DE
+ StringBuffer aLocaleLang_Country = new StringBuffer();
+ aLocaleLang_Country.append(sLanguage).append('-').append(sCountry);
+ sPath = _sPath + "/" + aLocaleLang_Country.toString();
+
+ if (xSimpleFileAccess.exists(sPath))
+ {
+ return sPath;
+ }
+
+ // de
+ StringBuffer aLocaleLang = new StringBuffer();
+ aLocaleLang.append(sLanguage);
+ sPath = _sPath + "/" + aLocaleLang.toString();
+
+ if (xSimpleFileAccess.exists(sPath))
+ {
+ return sPath;
+ }
+
+ // the absolute default is en-US or en
+ sPath = _sPath + "/en-US";
+ if (xSimpleFileAccess.exists(sPath))
+ {
+ return sPath;
+ }
+
+ sPath = _sPath + "/en";
+ if (xSimpleFileAccess.exists(sPath))
+ {
+ return sPath;
+ }
+
+ // java.util.Locale jl = new java.util.Locale(
+ // l.Language , l.Country, l.Variant );
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ }
+
+ return _sPath;
+ }
+
+ /*
+ 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;
+ }
+ **/
+ public static void combinePaths(XMultiServiceFactory xMSF, ArrayList _aFirstPath, String _sSecondPath) throws NoValidPathException
+ {
+ for (int i = 0; i < _aFirstPath.size(); ++i)
+ {
+ String sOnePath = (String) _aFirstPath.get(i);
+ sOnePath = addPath(sOnePath, _sSecondPath);
+ if (isPathValid(xMSF, sOnePath))
+ {
+ _aFirstPath.add(i, sOnePath);
+ _aFirstPath.remove(i + 1);
+ }
+ else
+ {
+ _aFirstPath.remove(i);
+ --i;
+ }
+ }
+ }
+
+ public static boolean isPathValid(XMultiServiceFactory xMSF, String _sPath)
+ {
+ 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);
+ bExists = xSimpleFileAccess.exists(_sPath);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return bExists;
+ }
+
+ public static String combinePaths(XMultiServiceFactory xMSF, String _sFirstPath, String _sSecondPath) throws NoValidPathException
+ {
+ boolean bexists = false;
+ String ReturnPath = "";
+ try
+ {
+ XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
+ ReturnPath = _sFirstPath + _sSecondPath;
+ bexists = xSimpleFileAccess.exists(ReturnPath);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return "";
+ }
+ if (bexists == false)
+ {
+ throw new NoValidPathException(xMSF, "");
+ }
+ return ReturnPath;
+ }
+
+ public static boolean createSubDirectory(XMultiServiceFactory xMSF, XSimpleFileAccess xSimpleFileAccess, String Path)
+ {
+ String sNoDirCreation = "";
+ try
+ {
+ Resource oResource = new Resource(xMSF, "ImportWizard", "imp");
+ if (oResource != null)
+ {
+ sNoDirCreation = oResource.getResText(1050);
+ String sMsgDirNotThere = oResource.getResText(1051);
+ String sQueryForNewCreation = oResource.getResText(1052);
+ String OSPath = JavaTools.convertfromURLNotation(Path);
+ 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)
+ {
+ xSimpleFileAccess.createFolder(Path);
+ return true;
+ }
+ }
+ return false;
+ }
+ 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)
+ {
+ String sMsgNoDir = JavaTools.replaceSubString(sNoDirCreation, Path, "%1");
+ SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgNoDir);
+ return false;
+ }
+ }
+
+ // 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
+ {
+ String SubDir;
+ String SubDirPath = "";
+ int SubLen;
+ int NewLen;
+ int RestLen;
+ boolean bexists;
+ boolean bSubDirexists = true;
+ String LowerCasePath;
+ 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))
+ {
+ Resource oResource = new Resource(xMSF, "ImportWizard", "imp");
+ String sFileexists = oResource.getResText(1053);
+ String NewString = JavaTools.convertfromURLNotation(Path);
+ sFileexists = JavaTools.replaceSubString(sFileexists, NewString, "<1>");
+ sFileexists = JavaTools.replaceSubString(sFileexists, String.valueOf((char) 13), "<CR>");
+ int iLeave = SystemDialog.showMessageBox(xMSF, "QueryBox", VclWindowPeerAttribute.YES_NO, sFileexists);
+ if (iLeave == 3)
+ {
+ return false;
+ }
+ }
+ }
+ String[] DirArray = JavaTools.ArrayoutofString(Path, "/");
+ int MaxIndex = DirArray.length - 1;
+ 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)
+ {
+ NewPath = NewPath.substring(0, NewLen - SubLen - 1);
+ if (i == MaxIndex)
+ {
+ SubDirPath = NewPath;
+ }
+ bexists = xSimpleFileAccess.exists(NewPath);
+ if (bexists)
+ {
+ LowerCasePath = NewPath.toLowerCase();
+ bexists = (((LowerCasePath.equals("file:///")) || (LowerCasePath.equals("file://")) || (LowerCasePath.equals("file:/")) || (LowerCasePath.equals("file:"))) == false);
+ }
+ if (bexists)
+ {
+ if (bSubDirexists == false)
+ {
+ boolean bSubDiriscreated = createSubDirectory(xMSF, xSimpleFileAccess, SubDirPath);
+ return bSubDiriscreated;
+ }
+ return true;
+ }
+ else
+ {
+ bSubDirexists = false;
+ }
+ }
+ }
+ }
+ SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid);
+ return false;
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgFilePathInvalid);
+ return false;
+ }
+ }
+
+ /**
+ * searches a directory for files which start with a certain
+ * prefix, and returns their URLs and document-titles.
+ * @param xMSF
+ * @param FilterName the prefix of the filename. a "-" is added to the prefix !
+ * @param FolderName the folder (URL) to look for files...
+ * @return an array with two array members. The first one, with document titles,
+ * 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)
+ {
+ String[][] LocLayoutFiles = new String[2][]; //{"",""}{""};
+ try
+ {
+ java.util.Vector<String> TitleVector = null;
+ java.util.Vector<String> NameVector = null;
+
+ XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
+ XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);
+
+ 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);
+
+ String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false);
+
+ TitleVector = new java.util.Vector<String>(/*nameList.length*/);
+ NameVector = new java.util.Vector<String>(nameList.length);
+
+ FilterName = FilterName == null || FilterName.equals("") ? null : FilterName + "-";
+
+ String fileName = "";
+ PropertyValue[] noArgs = { };
+ for (int i = 0; i < nameList.length; i++)
+ {
+ fileName = getFilename(nameList[i]);
+
+ if (FilterName == null || fileName.startsWith(FilterName))
+ {
+ xDocProps.loadFromMedium(nameList[i], noArgs);
+ NameVector.addElement(nameList[i]);
+ TitleVector.addElement(xDocProps.getTitle());
+ }
+ }
+ String[] LocNameList = new String[NameVector.size()];
+ String[] LocTitleList = new String[TitleVector.size()];
+
+ NameVector.copyInto(LocNameList);
+ TitleVector.copyInto(LocTitleList);
+ LocLayoutFiles[1] = LocNameList;
+ LocLayoutFiles[0] = LocTitleList;
+
+ JavaTools.bubblesortList(LocLayoutFiles);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return LocLayoutFiles;
+ }
+
+ /**
+ * 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;
+ if (!_sPath.endsWith("/"))
+ {
+ _sPath += "/";
+ }
+ if (_sPath2.startsWith("/"))
+ {
+ _sPath2 = _sPath2.substring(1);
+ }
+ sNewPath = _sPath + _sPath2;
+ return sNewPath;
+ }
+
+ public static String getPathFromList(XMultiServiceFactory xMSF, ArrayList _aList, String _sFile)
+ {
+ String sFoundFile = "";
+ try
+ {
+ 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++)
+ {
+ String sPath = (String) _aList.get(i);
+ sPath = addPath(sPath, _sFile);
+ if (xSimpleFileAccess.exists(sPath))
+ {
+ sFoundFile = sPath;
+ }
+ }
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ }
+ return sFoundFile;
+ }
+
+ /**
+ *
+ * @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
+ {
+ return getFolderTitles(xMSF, _sStartFilterName, FolderNames, "");
+ }
+
+ private static String getTitle(XMultiServiceFactory xMSF, String _sFile)
+ {
+ String sTitle = "";
+ try
+ {
+ XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
+ XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);
+ PropertyValue[] noArgs = { };
+ xDocProps.loadFromMedium(_sFile, noArgs);
+ sTitle = xDocProps.getTitle();
+ }
+ catch (Exception e)
+ {
+ }
+ return sTitle;
+ }
+
+ public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String _sStartFilterName, ArrayList FolderName, String _sEndFilterName)
+ throws NoValidPathException
+ {
+ String[][] LocLayoutFiles = new String[2][]; //{"",""}{""};
+ if (FolderName.size() == 0)
+ {
+ throw new NoValidPathException(null, "Path not given.");
+ }
+ ArrayList<String> TitleVector = new ArrayList<String>();
+ ArrayList<String> URLVector = new ArrayList<String>();
+
+ com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = null;
+ try
+ {
+ XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ xSimpleFileAccess = (com.sun.star.ucb.XSimpleFileAccess) UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ e.printStackTrace();
+ throw new NoValidPathException(null, "Internal error.");
+ }
+
+ for (int j = 0; j < FolderName.size(); j++)
+ {
+ String sFolderName = (String) FolderName.get(j);
+
+ try
+ {
+ String[] nameList = xSimpleFileAccess.getFolderContents(sFolderName, false);
+ _sStartFilterName = _sStartFilterName == null || _sStartFilterName.equals("") ? null : _sStartFilterName + "-";
+
+ String fileName = "";
+ for (int i = 0; i < nameList.length; i++)
+ {
+ fileName = getFilename(nameList[i]);
+ String sTitle;
+
+ if (_sStartFilterName == null || fileName.startsWith(_sStartFilterName))
+ {
+ if (_sEndFilterName.equals(""))
+ {
+ sTitle = getTitle(xMSF, nameList[i]);
+ }
+ else if (fileName.endsWith(_sEndFilterName))
+ {
+ fileName = fileName.replaceAll(_sEndFilterName + "$", "");
+ sTitle = fileName;
+ }
+ else
+ {
+ // no or wrong (start|end) filter
+ continue;
+ }
+ URLVector.add(nameList[i]);
+ TitleVector.add(sTitle);
+ }
+ }
+ }
+ catch (com.sun.star.ucb.CommandAbortedException exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ }
+ }
+
+ String[] LocNameList = new String[URLVector.size()];
+ String[] LocTitleList = new String[TitleVector.size()];
+
+ // LLA: we have to check if this works
+ URLVector.toArray(LocNameList);
+ TitleVector.toArray(LocTitleList);
+
+ LocLayoutFiles[1] = LocNameList;
+ LocLayoutFiles[0] = LocTitleList;
+
+ JavaTools.bubblesortList(LocLayoutFiles);
+
+ return LocLayoutFiles;
+ }
+ public XSimpleFileAccess2 fileAccess;
+ public XFileIdentifierConverter filenameConverter;
+
+ 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);
+ //get the file identifier converter
+ Object fcv = xmsf.createInstance("com.sun.star.ucb.FileContentProvider");
+ filenameConverter = (XFileIdentifierConverter) UnoRuntime.queryInterface(XFileIdentifierConverter.class, fcv);
+ }
+
+ 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)
+ {
+ File f = new File(path);
+ String r = filenameConverter.getFileURLFromSystemPath(
+ path, f.getAbsolutePath());
+ return r;
+ }
+
+ 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)
+ {
+ int p = filename.indexOf(".");
+ if (p == -1)
+ {
+ return "";
+ }
+ else
+ {
+ do
+ {
+ filename = filename.substring(p + 1);
+ }
+ while ((p = filename.indexOf(".")) > -1);
+ }
+ return filename;
+ }
+
+ /**
+ * @author rpiterman
+ * @param s
+ * @return
+ */
+ public boolean mkdir(String s)
+ {
+ try
+ {
+ fileAccess.createFolder(s);
+ return true;
+ }
+ catch (CommandAbortedException cax)
+ {
+ cax.printStackTrace();
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ return false;
+ }
+
+ /**
+ * @author rpiterman
+ * @param filename
+ * @param def what to return in case of an exception
+ * @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
+ {
+ return fileAccess.exists(filename);
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+
+ return def;
+ }
+
+ /**
+ * @author rpiterman
+ * @param filename
+ * @return
+ */
+ public boolean isDirectory(String filename)
+ {
+ try
+ {
+ return fileAccess.isFolder(filename);
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+
+ return false;
+ }
+
+ /**
+ * lists the files in a given directory
+ * @author rpiterman
+ * @param dir
+ * @param includeFolders
+ * @return
+ */
+ public String[] listFiles(String dir, boolean includeFolders)
+ {
+ try
+ {
+ return fileAccess.getFolderContents(dir, includeFolders);
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+
+ return new String[0];
+ }
+
+ /**
+ * @author rpiterman
+ * @param file
+ * @return
+ */
+ public boolean delete(String file)
+ {
+ try
+ {
+ fileAccess.kill(file);
+ return true;
+ }
+ catch (CommandAbortedException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+
+ return false;
+ }
+
+ /**
+ * @author rpiterman
+ * @param path
+ * @return
+ */
+ public static String getFilename(String path)
+ {
+ return getFilename(path, "/");
+ }
+
+ /**
+ * return the filename out of a system-dependent path
+ * @param path
+ * @return
+ */
+ public static String getPathFilename(String path)
+ {
+ return getFilename(path, File.separator);
+ }
+
+ /**
+ * @author rpiterman
+ * @param path
+ * @param pathSeparator
+ * @return
+ */
+ 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)
+ {
+ String filename = getFilename(path, pathSeparator);
+ String sExtension = getExtension(filename);
+ String basename = filename.substring(0, filename.length() - (sExtension.length() + 1));
+ return basename;
+ }
+
+ /**
+ * @author rpiterman
+ * @param source
+ * @param target
+ * @return
+ */
+ public boolean copy(String source, String target)
+ {
+ try
+ {
+ fileAccess.copy(source, target);
+ return true;
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+
+ return false;
+ }
+
+ public DateTime getLastModified(String url)
+ {
+ try
+ {
+ return fileAccess.getDateTimeModified(url);
+ }
+ catch (CommandAbortedException e)
+ {
+ }
+ catch (Exception e)
+ {
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param url
+ * @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)
+ {
+ if (url.endsWith("/"))
+ {
+ return getParentDir(url.substring(0, url.length() - 1));
+ }
+ int pos = -1;
+ int lastPos = 0;
+ while ((pos = url.indexOf("/", pos + 1)) > -1)
+ {
+ lastPos = pos;
+ }
+ return url.substring(0, lastPos);
+ }
+
+ public String createNewDir(String parentDir, String name)
+ {
+ String s = getNewFile(parentDir, name, "");
+ if (mkdir(s))
+ {
+ return s;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public String getNewFile(String parentDir, String name, String extension)
+ {
+
+ int i = 0;
+ String url;
+ do
+ {
+ String filename = filename(name, extension, i++);
+ String u = getURL(parentDir, filename);
+ url = u;
+ }
+ while (exists(url, true));
+
+ return url;
+ }
+
+ 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
+ {
+ return fileAccess.getSize(url);
+ }
+ 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[] getDataFromTextFile(XMultiServiceFactory _xMSF, String _filepath)
+ {
+ String[] sFileData = null;
+ try
+ {
+ Vector<String> oDataVector = new Vector<String>();
+ 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))
+ {
+ XInputStream xInputStream = xSimpleFileAccess.openFileRead(_filepath);
+ Object oTextInputStream = _xMSF.createInstance("com.sun.star.io.TextInputStream");
+ XTextInputStream xTextInputStream = (XTextInputStream) UnoRuntime.queryInterface(XTextInputStream.class, oTextInputStream);
+ XActiveDataSink xActiveDataSink = (XActiveDataSink) UnoRuntime.queryInterface(XActiveDataSink.class, oTextInputStream);
+ xActiveDataSink.setInputStream(xInputStream);
+ while (!xTextInputStream.isEOF())
+ {
+ oDataVector.addElement( xTextInputStream.readLine());
+ }
+ xTextInputStream.closeInput();
+ sFileData = new String[oDataVector.size()];
+ oDataVector.toArray(sFileData);
+
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return sFileData;
+ }
+
+ /**
+ * shortens a filename to a user displayable representation.
+ * @param path
+ * @param maxLength
+ * @return
+ */
+ 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);
+ }
+ else
+ { //windows
+ firstPart = Math.min(10, (maxLength - 3) / 2);
+ }
+
+ String s1 = path.substring(0, firstPart);
+ String s2 = path.substring(path.length() - (maxLength - (3 + firstPart)));
+
+ return s1 + "..." + s2;
+ }
+ else
+ {
+ return path;
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java
new file mode 100644
index 000000000000..0df16b360de0
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/Helper.java
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.uno.XComponentContext;
+import com.sun.star.util.XMacroExpander;
+import java.util.Calendar;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+// import com.sun.star.i18n.NumberFormatIndex;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.XMultiServiceFactory;
+// import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.RuntimeException;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.DateTime;
+import com.sun.star.util.XNumberFormatsSupplier;
+import com.sun.star.util.XNumberFormatter;
+
+public class Helper
+{
+
+ /** Creates a new instance of Helper */
+ public Helper()
+ {
+ }
+
+ 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();
+ long lTime = dTime.getTime();
+ long lDate = lTime / (3600 * 24000);
+ return lDate;
+ }
+
+ 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
+ {
+ Property[] selementnames = xPSet.getPropertySetInfo().getProperties();
+ throw new java.lang.IllegalArgumentException("No Such Property: '" + PropertyName + "'");
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ 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))
+ {
+ return CurPropertyValue[i].Value;
+ }
+ }
+ }
+ throw new RuntimeException();
+ }
+
+ 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))
+ {
+ return null;
+ }
+ else
+ {
+ return com.sun.star.uno.AnyConverter.toObject(new com.sun.star.uno.Type(xClass), oObject);
+ }
+ }
+ return null;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return 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)
+ {
+ PropertyValue aValue = (PropertyValue) CurPropertyValue[i];
+ if (aValue != null && aValue.Name.equals(PropertyName))
+ {
+ return aValue.Value;
+ }
+ }
+ }
+ }
+ // System.out.println("Property not found: " + PropertyName);
+ return 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)
+ {
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return 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)
+ {
+ Object oObject = xPSet.getPropertyValue(PropertyName);
+ return oObject;
+ }
+ }
+ return null;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ 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++)
+ {
+ //System.out.println(PropertyNames[i] + "=" + PropertyValues[i]);
+ setUnoPropertyValue(oUnoObject, PropertyNames[i], PropertyValues[i]);
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ /**
+ * @author bc93774
+ * checks if the value of an object that represents an array is null.
+ * check beforehand if the Object is really an array with "AnyConverter.IsArray(oObject)
+ * @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
+ {
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+ private static long DAY_IN_MILLIS = (24 * 60 * 60 * 1000);
+
+ 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);
+
+ Object defaults = docMSF.createInstance("com.sun.star.text.Defaults");
+ Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
+
+ java.util.Locale jl = new java.util.Locale(
+ l.Language, l.Country, l.Variant);
+
+ calendar = Calendar.getInstance(jl);
+
+ 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");
+
+ calendar.set(date.Year, date.Month - 1, date.Day);
+ docNullTime = getTimeInMillis();
+
+ 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 XNumberFormatter getFormatter()
+ {
+ return formatter;
+ }
+
+ 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)
+ {
+ calendar.clear();
+ 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;
+
+ return daysDiff;
+ }
+
+ public double getDocumentDateAsDouble(DateTime date)
+ {
+ return getDocumentDateAsDouble(date.Year * 10000 + date.Month * 100 + date.Day);
+ }
+
+ public synchronized double getDocumentDateAsDouble(long javaTimeInMillis)
+ {
+ calendar.clear();
+ JavaTools.setTimeInMillis(calendar, javaTimeInMillis);
+
+ long date1 = getTimeInMillis();
+
+ /*
+ * docNullTime and date1 are in millis, but
+ * I need a day...
+ */
+ 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, DateTime date)
+ {
+ return formatter.convertNumberToString(formatIndex, getDocumentDateAsDouble(date));
+ }
+
+ 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 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;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/IRenderer.java b/wizards/com/sun/star/wizards/common/IRenderer.java
new file mode 100644
index 000000000000..1aa73eaa599b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/IRenderer.java
@@ -0,0 +1,40 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+/**
+ * A General interface which gives a string
+ * that represents the rendered argument object.
+ * Can be used to reference resources, internationalizartion
+ * a.s.o
+ */
+public interface IRenderer
+{
+
+ public String render(Object object);
+}
diff --git a/wizards/com/sun/star/wizards/common/Indexable.java b/wizards/com/sun/star/wizards/common/Indexable.java
new file mode 100644
index 000000000000..d95640f1ec70
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/Indexable.java
@@ -0,0 +1,44 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ */
+
+package com.sun.star.wizards.common;
+
+/**
+ *
+ * @author rpiterman
+ */
+public interface Indexable {
+
+ public int getIndex();
+
+}
diff --git a/wizards/com/sun/star/wizards/common/InvalidQueryException.java b/wizards/com/sun/star/wizards/common/InvalidQueryException.java
new file mode 100644
index 000000000000..325f6fdc3760
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/InvalidQueryException.java
@@ -0,0 +1,40 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+{
+// 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
new file mode 100644
index 000000000000..836b2a7ea242
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/JavaTools.java
@@ -0,0 +1,785 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.util.DateTime;
+import com.sun.star.beans.PropertyValue;
+import java.util.*;
+import java.io.File;
+
+import com.sun.star.lib.util.UrlToFileMapper;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ *
+ * @author bc93774
+ */
+public class JavaTools
+{
+
+ /** Creates a new instance of JavaTools */
+ public JavaTools()
+ {
+ }
+
+/*
+ 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
+ {
+ XMultiServiceFactory xLocMSF = com.sun.star.wizards.common.Desktop.connect(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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+*/
+ public static String[] copyStringArray(String[] FirstArray)
+ {
+ if (FirstArray != null)
+ {
+ String[] SecondArray = new String[FirstArray.length];
+ for (int i = 0; i < FirstArray.length; i++)
+ {
+ SecondArray[i] = FirstArray[i];
+ }
+ return SecondArray;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ 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)
+ {
+ for (int i = 0; i < olist.length; i++)
+ {
+ olist[i] = ovalue;
+ }
+ return olist;
+ }
+
+ public static String[] ArrayOutOfMultiDimArray(String _sMultiDimArray[][], int _index)
+ {
+ String[] sRetArray = null;
+ if (_sMultiDimArray != null)
+ {
+ sRetArray = new String[_sMultiDimArray.length];
+ for (int i = 0; i < _sMultiDimArray.length; i++)
+ {
+ sRetArray[i] = _sMultiDimArray[i][_index];
+ }
+ }
+ return sRetArray;
+ }
+
+ 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<Integer> _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)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ /**converts a list of Boolean values included in a Boolean vector to a list of boolean values
+ *
+ *
+ * @param _aBooleanVector
+ * @return
+ */
+ public static boolean[] BooleanTobooleanList(Vector<Boolean> _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[]
+ {
+ };
+ retlist = new String[multidimlist.length];
+ for (int i = 0; i < multidimlist.length; i++)
+ {
+ retlist[i] = multidimlist[i][0];
+ }
+ return retlist;
+ }
+
+ 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++)
+ {
+ iCurLength = StringArray[i].length();
+ if (iCurLength > iOldLength)
+ {
+ iOldLength = iCurLength;
+ sLongestItem = StringArray[i];
+ }
+ }
+ return sLongestItem;
+ }
+
+ public static String ArraytoString(String[] LocArray)
+ {
+ String ResultString = "";
+ int iLen = LocArray.length;
+ for (int i = 0; i < iLen; i++)
+ {
+ ResultString += LocArray[i];
+ if (i < iLen - 1)
+ {
+ ResultString += ";";
+ }
+ }
+ return ResultString;
+ }
+
+ /**
+ * @author bc93774
+ * @param SearchList
+ * @param SearchString
+ * @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)
+ {
+ int FieldLen = SearchList.length;
+ int retvalue = -1;
+ for (int i = 0; i < FieldLen; i++)
+ {
+ if (SearchList[i].compareTo(SearchString) == 0)
+ {
+ retvalue = i;
+ break;
+ }
+ }
+ return retvalue;
+ }
+
+ 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)
+ {
+ retvalue = i;
+ break;
+ }
+ }
+ }
+ return retvalue;
+ }
+
+ public static int FieldInTable(String[][] SearchList, String SearchString)
+ {
+ int retvalue;
+ 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)
+ {
+ retvalue = i;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ retvalue = -1;
+ }
+ return retvalue;
+ }
+
+ public static int FieldInIntTable(int[][] SearchList, int SearchValue)
+ {
+ int retvalue = -1;
+ for (int i = 0; i < SearchList.length; i++)
+ {
+ if (SearchList[i][0] == SearchValue)
+ {
+ retvalue = i;
+ break;
+ }
+ }
+ return retvalue;
+ }
+
+ 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)
+ {
+ retvalue = i;
+ break;
+ }
+ }
+ return retvalue;
+ }
+
+ public static int FieldInIntTable(int[] SearchList, int SearchValue)
+ {
+ return FieldInIntTable(SearchList, SearchValue, 0);
+ }
+
+ public static int getArraylength(Object[] MyArray)
+ {
+ int FieldCount = 0;
+ if (MyArray != null)
+ {
+ FieldCount = MyArray.length;
+ }
+ return FieldCount;
+ }
+
+ /**
+ * @author bc93774
+ * This function bubble sorts an array of with 2 dimensions.
+ * 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)
+ {
+ 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++)
+ {
+ DisplayDummy = SortList[k][t];
+ SortList[k][t] = SortList[k][t + 1];
+ SortList[k][t + 1] = DisplayDummy;
+ }
+ }
+ }
+ }
+ return SortList;
+ }
+
+ /**
+ * @param MainString
+ * @param Token
+ * @return
+ */
+ public static String[] ArrayoutofString(String MainString, String Token)
+ {
+ String[] StringArray;
+ if (MainString.equals("") == false)
+ {
+ Vector StringVector = new Vector();
+ String LocString = null;
+ int iIndex;
+ do
+ {
+ iIndex = MainString.indexOf(Token);
+ if (iIndex < 0)
+ {
+ StringVector.addElement(MainString);
+ }
+ else
+ {
+ StringVector.addElement(MainString.substring(0, iIndex));
+ MainString = MainString.substring(iIndex + 1, MainString.length());
+ }
+ }
+ while (iIndex >= 0);
+ int FieldCount = StringVector.size();
+ StringArray = new String[FieldCount];
+ StringVector.copyInto(StringArray);
+ }
+ else
+ {
+ StringArray = new String[0];
+ }
+ return StringArray;
+ }
+
+ 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)
+ {
+ NewIndex = MainString.indexOf(OldSubString, OldIndex);
+ if (NewIndex != -1)
+ {
+ MainString = MainString.substring(0, NewIndex) + NewSubString + MainString.substring(NewIndex + OldSubLen);
+ OldIndex = NewIndex + NewSubLen;
+ }
+ }
+ return MainString;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ public static String getFilenameOutOfPath(String sPath)
+ {
+ String[] Hierarchy = ArrayoutofString(sPath, "/");
+ return Hierarchy[Hierarchy.length - 1];
+ }
+
+ 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++)
+ {
+ 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 DateTime getDateTime(long timeMillis)
+ {
+ java.util.Calendar cal = java.util.Calendar.getInstance();
+ setTimeInMillis(cal, timeMillis);
+ DateTime dt = new DateTime();
+ dt.Year = (short) cal.get(Calendar.YEAR);
+ dt.Day = (short) cal.get(Calendar.DAY_OF_MONTH);
+ dt.Month = (short) (cal.get(Calendar.MONTH) + 1);
+ dt.Hours = (short) cal.get(Calendar.HOUR);
+ dt.Minutes = (short) cal.get(Calendar.MINUTE);
+ dt.Seconds = (short) cal.get(Calendar.SECOND);
+ dt.HundredthSeconds = (short) cal.get(Calendar.MILLISECOND);
+ return dt;
+ }
+
+ public static long getTimeInMillis(Calendar _calendar)
+ {
+ java.util.Date dDate = _calendar.getTime();
+ return dDate.getTime();
+ }
+
+ 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)
+ {
+ 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))
+ {
+ 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
+ // }
+ }
+ }
+ 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)
+ {
+ Vector retvector = new Vector();
+ for (int i = 0; i < baselist.length; i++)
+ {
+ String sValue = baselist[i][_compindex];
+ if (FieldInList(_complist, sValue) != -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);
+ }
+ }
+ return (retarray);
+ }
+
+ 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[][]
+ {
+ };
+ if ((baselist != null) && (_complist != null))
+ {
+ Vector firstdimvector = new Vector();
+ int b = 0;
+ 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)
+ {
+ secdimvector.add(baselist[n][m]);
+ a++;
+ }
+ }
+ if (a > 0)
+ {
+ internalArray = new PropertyValue[a];
+ secdimvector.toArray(internalArray);
+ firstdimvector.add(internalArray);
+ b++;
+ }
+ }
+ retarray = new PropertyValue[b][];
+ firstdimvector.toArray(retarray);
+ }
+ return (retarray);
+ }
+
+ /**
+ * searches a multidimensional array for duplicate fields. According to the following example
+ * SlaveFieldName1 ;SlaveFieldName2; SlaveFieldName3
+ * MasterFieldName1;MasterFieldName2;MasterFieldName3
+ * The entries SlaveFieldNameX and MasterFieldNameX are grouped together and then the created groups are compared
+ * If a group is duplicate the entry of the second group is returned.
+ * @param _scomplist
+ * @return
+ */
+ public static int getDuplicateFieldIndex(String[][] _scomplist)
+ {
+ int retvalue = -1;
+ 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++)
+ {
+ if (n == 0)
+ {
+ sDescList[m] = new String();
+ }
+ sDescList[m] += _scomplist[n][m];
+ }
+ }
+ return getDuplicateFieldIndex(sDescList);
+ }
+ return retvalue;
+ }
+
+ /**
+ * not tested!!!!!
+ * @param scomplist
+ * @return
+ */
+ 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)
+ {
+ if (scurvalue.equals(scomplist[m]))
+ {
+ return m;
+ }
+ }
+ }
+ }
+ return -1;
+ }
+
+ public static int getDuplicateFieldIndex(String[] _scomplist, String _fieldname)
+ {
+ int iduplicate = 0;
+ for (int n = 0; n < _scomplist.length; n++)
+ {
+ if (_scomplist[n].equals(_fieldname))
+ {
+ iduplicate++;
+ if (iduplicate == 2)
+ {
+ return n;
+ }
+ }
+ }
+ return -1;
+ }
+
+ 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++)
+ {
+ PropertyValue[] ocurValue = ocomplist[n];
+ for (int m = n; m < ocurValue.length; m++)
+ {
+ PropertyValue odetValue = ocurValue[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[]
+ {
+ -1, -1
+ };
+ }
+
+ public static String getSuffixNumber(String _sbasestring)
+ {
+ int suffixcharcount = 0;
+ 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());
+ }
+
+ public static String[] removefromList(String[] _sbaselist, String[] _sdellist)
+ {
+ Vector tempbaselist = new Vector();
+ 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)
+ {
+ boolean bissame = false;
+ if (sFirstString == null)
+ {
+ if (sSecondString != null)
+ {
+ bissame = sSecondString.equals("");
+ }
+ else
+ {
+ bissame = (sSecondString == null);
+ }
+ }
+ 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/MANIFEST.MF b/wizards/com/sun/star/wizards/common/MANIFEST.MF
new file mode 100644
index 000000000000..a670e80c31e7
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/MANIFEST.MF
@@ -0,0 +1 @@
+Class-Path: saxon9.jar
diff --git a/wizards/com/sun/star/wizards/common/NamedValueCollection.java b/wizards/com/sun/star/wizards/common/NamedValueCollection.java
new file mode 100644
index 000000000000..f8f2cd05224a
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/NamedValueCollection.java
@@ -0,0 +1,90 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package com.sun.star.wizards.common;
+
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.PropertyState;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+/**
+ *
+ * @author frank.schoenheit@sun.com
+ */
+public class NamedValueCollection
+{
+ final private HashMap< String, Object > m_values = new HashMap< String, Object >();
+
+ public NamedValueCollection()
+ {
+ }
+
+ public NamedValueCollection( final PropertyValue[] i_values )
+ {
+ for ( int i = 0; i < i_values.length; ++i )
+ m_values.put( i_values[i].Name, i_values[i].Value );
+ }
+
+ public final void put( final String i_name, final Object i_value )
+ {
+ m_values.put( i_name, i_value );
+ }
+
+ @SuppressWarnings("unchecked")
+ public final < T extends Object > T getOrDefault( final String i_key, final T i_default )
+ {
+ if ( m_values.containsKey( i_key ) )
+ {
+ final Object value = m_values.get( i_key );
+ try
+ {
+ return (T)value;
+ }
+ catch ( ClassCastException e ) { }
+ }
+ return i_default;
+ }
+
+ @SuppressWarnings("unchecked")
+ public final < T extends XInterface > T queryOrDefault( final String i_key, final T i_default, Class i_interfaceClass )
+ {
+ if ( m_values.containsKey( i_key ) )
+ {
+ final Object value = m_values.get( i_key );
+ return (T)UnoRuntime.queryInterface( i_interfaceClass, value );
+ }
+ return i_default;
+ }
+
+ public final boolean has( final String i_key )
+ {
+ return m_values.containsKey( i_key );
+ }
+
+ public final PropertyValue[] getPropertyValues()
+ {
+ PropertyValue[] values = new PropertyValue[ m_values.size() ];
+
+ Iterator< Entry< String, Object > > iter = m_values.entrySet().iterator();
+ int i = 0;
+ while ( iter.hasNext() )
+ {
+ Entry< String, Object > entry = iter.next();
+ values[i++] = new PropertyValue(
+ entry.getKey(),
+ 0,
+ entry.getValue(),
+ PropertyState.DIRECT_VALUE
+ );
+ }
+
+ return values;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/NoValidPathException.java b/wizards/com/sun/star/wizards/common/NoValidPathException.java
new file mode 100644
index 000000000000..f4975d2fff0c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/NoValidPathException.java
@@ -0,0 +1,44 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 NoValidPathException extends Exception
+{
+ public NoValidPathException(XMultiServiceFactory xMSF, String _sText)
+ {
+ super(_sText);
+ // TODO: NEVER open a dialog in an exception
+ if (xMSF != null)
+ {
+ SystemDialog.showErrorBox(xMSF, "dbwizres", "dbw", 521); // OfficePathnotavailable
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java
new file mode 100644
index 000000000000..cb183eb29c25
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java
@@ -0,0 +1,333 @@
+/*************************************************************************
+*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.Date;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.NumberFormat;
+import com.sun.star.util.XNumberFormatTypes;
+import com.sun.star.util.XNumberFormats;
+import com.sun.star.util.XNumberFormatsSupplier;
+import com.sun.star.util.XNumberFormatter;
+
+
+public class NumberFormatter
+{
+
+ public int iDateFormatKey = -1;
+ public int iDateTimeFormatKey = -1;
+ public int iNumberFormatKey = -1;
+ public int iTextFormatKey = -1;
+ public int iTimeFormatKey = -1;
+ public int iLogicalFormatKey = -1;
+ public long lDateCorrection;
+ public XNumberFormatter xNumberFormatter;
+ public XNumberFormats xNumberFormats;
+ public XNumberFormatTypes xNumberFormatTypes;
+ public XPropertySet xNumberFormatSettings;
+ private boolean bNullDateCorrectionIsDefined = false;
+ private Locale aLocale;
+
+
+ public NumberFormatter(XMultiServiceFactory _xMSF, XNumberFormatsSupplier _xNumberFormatsSupplier, Locale _aLocale) throws Exception
+ {
+ aLocale = _aLocale;
+ Object oNumberFormatter = _xMSF.createInstance("com.sun.star.util.NumberFormatter");
+ xNumberFormats = _xNumberFormatsSupplier.getNumberFormats();
+ xNumberFormatSettings = _xNumberFormatsSupplier.getNumberFormatSettings();
+ xNumberFormatter = (XNumberFormatter) UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter);
+ xNumberFormatter.attachNumberFormatsSupplier(_xNumberFormatsSupplier);
+ xNumberFormatTypes = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats);
+
+ }
+
+ public NumberFormatter(XNumberFormatsSupplier _xNumberFormatsSupplier, Locale _aLocale) throws Exception
+ {
+ aLocale = _aLocale;
+ xNumberFormats = _xNumberFormatsSupplier.getNumberFormats();
+ xNumberFormatSettings = _xNumberFormatsSupplier.getNumberFormatSettings();
+ xNumberFormatTypes = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats);
+ }
+
+
+ /**
+ * @param _xMSF
+ * @param _xNumberFormatsSupplier
+ * @return
+ * @throws Exception
+ * @deprecated
+ *
+ */
+ 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);
+ return xNumberFormatter;
+ }
+
+
+ /**
+ * gives a key to pass to a NumberFormat object. <br/>
+ * example: <br/>
+ * <pre>
+ * XNumberFormatsSupplier nsf = (XNumberFormatsSupplier)UnoRuntime.queryInterface(...,document);
+ * int key = Desktop.getNumberFormatterKey( nsf, ...star.i18n.NumberFormatIndex.DATE...);
+ * XNumberFormatter nf = Desktop.createNumberFormatter(xmsf, nsf);
+ * nf.convertNumberToString( key, 1972 );
+ * </pre>
+ * @param numberFormatsSupplier
+ * @param type - a constant out of i18n.NumberFormatIndex enumeration.
+ * @return a key to use with a util.NumberFormat instance.
+ *
+ */
+ 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)
+ {
+ return xNumberFormatter.convertNumberToString(_nkey, _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
+ {
+ return convertStringToNumber(_nkey, _sString);
+ }
+
+
+ /**
+ * @param dateCorrection The lDateCorrection to set.
+ */
+ 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;
+ }
+ }
+
+
+ /**
+ * returns a numberformat for a FormatString.
+ * @param _FormatString
+ * @param _aLocale
+ * @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 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);
+ xPSet.setPropertyValue("FormatsSupplier", _oNumberFormatter.xNumberFormatter.getNumberFormatsSupplier());
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+
+ 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();
+ oCal.set(1900, 1, 1);
+ Date dTime = oCal.getTime();
+ long lTime = dTime.getTime();
+ long lDBNullDate = lTime / (3600 * 24000);
+ lDateCorrection = lDBNullDate - lNullDate;
+ return lDateCorrection;
+ }
+ else
+ {
+ return this.lDateCorrection;
+ }
+ }
+
+
+ public int setBooleanReportDisplayNumberFormat()
+ {
+ String FormatString = "[=1]" + '"' + (char)9745 + '"' + ";[=0]" + '"' + (char)58480 + '"' + ";0";
+ iLogicalFormatKey = xNumberFormats.queryKey(FormatString, aLocale, true);
+ try
+ {
+ if (iLogicalFormatKey == -1)
+ {
+ iLogicalFormatKey = xNumberFormats.addNew(FormatString, aLocale);
+ }
+ }
+ catch (Exception e)
+ { //MalformedNumberFormat
+ e.printStackTrace();
+ iLogicalFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.LOGICAL, aLocale);
+ }
+ return iLogicalFormatKey;
+ }
+
+
+ /**
+ * @return Returns the iDateFormatKey.
+ */
+ public int getDateFormatKey()
+ {
+ if (iDateFormatKey == -1)
+ {
+ iDateFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.DATE, aLocale);
+ }
+ return iDateFormatKey;
+ }
+ /**
+ * @return Returns the iDateTimeFormatKey.
+ */
+ public int getDateTimeFormatKey()
+ {
+ if (iDateTimeFormatKey == -1)
+ {
+ iDateTimeFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.DATETIME, aLocale);
+ }
+ return iDateTimeFormatKey;
+ }
+ /**
+ * @return Returns the iLogicalFormatKey.
+ */
+ public int getLogicalFormatKey()
+ {
+ if (iLogicalFormatKey == -1)
+ {
+ iLogicalFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.LOGICAL, aLocale);
+ }
+ return iLogicalFormatKey;
+ }
+ /**
+ * @return Returns the iNumberFormatKey.
+ */
+ public int getNumberFormatKey()
+ {
+ if (iNumberFormatKey == -1)
+ {
+ iNumberFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.NUMBER, aLocale);
+ }
+ return iNumberFormatKey;
+ }
+ /**
+ * @return Returns the iTextFormatKey.
+ */
+ public int getTextFormatKey()
+ {
+ if (iTextFormatKey == -1)
+ {
+ iTextFormatKey = xNumberFormatTypes.getStandardFormat(NumberFormat.TEXT, aLocale);
+ }
+ return iTextFormatKey;
+ }
+ /**
+ * @return Returns the iTimeFormatKey.
+ */
+ 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
new file mode 100644
index 000000000000..109affffd5ef
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java
@@ -0,0 +1,1625 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.beans.XPropertySet;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.TypeClass;
+
+/**
+ * A class for helping with all kinds of numerical conversions.
+ * Optional or named parameters in SO are of the Object type in Java.
+ * These objects must be converted to the right simple value type.
+ * Unfortunately, StarBasic does not know the original desired type,
+ * and a value that should be a "Float" is delivered as "Byte". This class
+ * handles the conversions of these types.<br>
+ * This class does not log warnings (or throws Exceptions) when the precision
+ * of a value is lost.
+ */
+public class NumericalHelper
+{
+
+ public static final int UNKNOWN_TYPE = -32768;
+ public static final int BYTE_TYPE = 0;
+ public static final int SHORT_TYPE = 1;
+ public static final int INT_TYPE = 2;
+ public static final int LONG_TYPE = 3;
+ public static final int FLOAT_TYPE = 4;
+ public static final int DOUBLE_TYPE = 5;
+ public static final int CHAR_TYPE = 6;
+ public static final int STRING_TYPE = -1;
+ 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;
+
+ /**
+ * private c'tor to prevent instantiation
+ */
+ private NumericalHelper()
+ {
+ // private c'tor, so noone can instantiate
+ }
+
+ /**
+ * get the type of an object: returns all types that can possibly converted
+ * with this class.
+ * @param obj an object that is checked for conversion
+ * @return the type of the object
+ */
+ public static int getType(Object obj)
+ {
+ try
+ {
+ TypeObject aTypeObject = getTypeObject(obj);
+ return aTypeObject.iType;
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore this one; just return unknown type
+ }
+ return UNKNOWN_TYPE;
+ }
+
+ /**
+ * get a byte value from the object
+ * @param aValue
+ * @return a byte
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static byte toByte(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+
+ byte retValue = 0;
+ // boolean hasConversionWarning = false;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = getByte(aTypeObject);
+ break;
+ case CHAR_TYPE:
+ retValue = (byte) getChar(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = (byte) getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = (byte) getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = (byte) getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = (byte) getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (byte) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ Byte b = new Byte((String) aTypeObject.aValue);
+ retValue = b.byteValue();
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to byte: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? (byte) -1 : (byte) 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
+ * get a char value from the object
+ * @param aValue
+ * @return a char
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static char toChar(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+
+ char retValue = 0;
+ boolean hasConversionWarning = false;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case CHAR_TYPE:
+ retValue = getChar(aTypeObject);
+ break;
+ case BYTE_TYPE:
+ retValue = (char) getByte(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = (char) getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = (char) getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = (char) getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = (char) getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (char) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ String s = (String) aTypeObject.aValue;
+ if (s.length() > 0)
+ {
+ retValue = s.charAt(0);
+ }
+ else
+ {
+ retValue = (char) 0;
+ }
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to char: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? (char) -1 : (char) 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
+ * get a short value from the object
+ * @param aValue
+ * @return a short
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static short toShort(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ short retValue = 0;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = (short) getByte(aTypeObject);
+ break;
+ case CHAR_TYPE:
+ retValue = (byte) getChar(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = (short) getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = (short) getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = (short) getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (short) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ Short s = new Short((String) aTypeObject.aValue);
+ retValue = s.shortValue();
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to short: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? (short) -1 : (short) 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "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))
+ {
+ 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))
+ {
+ int nType = AnyConverter.getType(aValue).getTypeClass().getValue();
+ return (nType == TypeClass.BOOLEAN_value);
+ }
+ }
+ return false;
+ }
+
+ public static boolean isValid(Object aValue)
+ {
+ if (aValue != null)
+ {
+ if (!AnyConverter.isVoid(aValue))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ @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;
+ }
+ }
+ 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
+
+ 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
+ * @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)
+ {
+ case BYTE_TYPE:
+ case CHAR_TYPE:
+ case SHORT_TYPE:
+ case INT_TYPE:
+ case LONG_TYPE:
+ 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
+ {
+ toStringArray(aValue);
+ return true;
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore
+ }
+ return false;
+ }
+
+ /**
+ * Can a given object be converted to an int array?
+ * @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
+ {
+ toIntArray(aValue);
+ return true;
+ }
+ 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);
+// }
+// catch(com.sun.star.lang.IllegalArgumentException e) {
+// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, "");
+// return 0;
+// }}
+//
+//
+// public static String toStringWithErrorMessage(Object _aValue) throws com.sun.star.script.BasicErrorException{
+// try {
+// return toString(_aValue);
+// }
+// catch(com.sun.star.lang.IllegalArgumentException e) {
+// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, "");
+// return "";
+// }}
+//
+//
+// public static int toIntWithErrorMessage(Object _aValue, int _ndefaultValue) throws com.sun.star.script.BasicErrorException{
+// try {
+// return toInt(_aValue, _ndefaultValue);
+// }
+// catch(com.sun.star.uno.Exception e) {
+// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, "");
+// return 0;
+// }}
+//
+// public static boolean toBooleanWithErrorMessage(Object _oObject, int _nTrueField, int _nFalseField) throws com.sun.star.script.BasicErrorException{
+// return toBooleanWithErrorMessage(_oObject, new int[]{_nTrueField}, new int[]{_nFalseField});
+// }
+//
+//
+// public static boolean toBooleanWithErrorMessage(Object _oObject) throws com.sun.star.script.BasicErrorException{
+// try{
+// return toBoolean(_oObject);
+// }
+// catch (java.lang.Exception e){
+// DebugHelper.exception(BasicErrorCode.SbERR_BAD_ARGUMENT, "");
+// return false;
+// }
+// }
+//
+//
+// public static boolean toBooleanWithErrorMessage(Object _oObject, int[] _nTrueFields, int[] _nFalseFields) throws com.sun.star.script.BasicErrorException{
+// try{
+// int nValue = NumericalHelper.toIntWithErrorMessage(_oObject);
+// if (ContainerUtilities.FieldInIntTable(_nTrueFields, nValue) > -1){
+// return true;
+// }
+// else if (ContainerUtilities.FieldInIntTable(_nFalseFields, nValue) > -1){
+// return false;
+// }
+// else{
+// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, "");
+// return false;
+// }
+// }catch (java.lang.Exception e){
+// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, "");
+// return false;
+// }}
+//
+//
+// public static boolean toBooleanWithErrorMessage(Object _oObject, int _nTrueField, int _nFalseField, boolean _bdefaultValue) throws com.sun.star.script.BasicErrorException{
+// return toBooleanWithErrorMessage(_oObject, new int[]{_nTrueField}, new int[]{_nFalseField}, _bdefaultValue);
+// }
+//
+//
+// public static boolean toBooleanWithErrorMessage(Object _oObject, int[] _nTrueFields, int[] _nFalseFields, boolean _bdefaultValue) throws com.sun.star.script.BasicErrorException{
+// try{
+// if ((_oObject == null) || (AnyConverter.isVoid(_oObject))){
+// return _bdefaultValue;
+// }
+// else{
+// int nValue = NumericalHelper.toIntWithErrorMessage(_oObject);
+// if (ContainerUtilities.FieldInIntTable(_nTrueFields, nValue) > -1){
+// return true;
+// }
+// else if (ContainerUtilities.FieldInIntTable(_nFalseFields, nValue) > -1){
+// return false;
+// }
+// else{
+// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, "");
+// return false;
+// }
+// }
+// }catch (java.lang.Exception e){
+// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, "");
+// return false;
+// }}
+ /**
+ * get an int value from the object
+ * @param aValue
+ * @return an int
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static int toInt(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ int retValue = 0;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = (int) getByte(aTypeObject);
+ break;
+ case CHAR_TYPE:
+ retValue = (int) getChar(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = (int) getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = (int) getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = (int) getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (int) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ Integer i = new Integer((String) aTypeObject.aValue);
+ retValue = i.intValue();
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to int: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? -1 : 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
+ * get a long value from the object
+ * @param aValue
+ * @return a long
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static long toLong(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ long retValue = 0;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = (long) getByte(aTypeObject);
+ break;
+ case CHAR_TYPE:
+ retValue = (long) getChar(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = (long) getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = (long) getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = (long) getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (long) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ Long l = new Long((String) aTypeObject.aValue);
+ retValue = l.longValue();
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to short: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? -1 : 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
+ * get a float value from the object
+ * @param aValue
+ * @return a float
+ * @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;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = (float) getByte(aTypeObject);
+ break;
+ case CHAR_TYPE:
+ retValue = (float) getChar(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = (float) getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = (float) getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = (float) getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (float) getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ Float f = new Float((String) aTypeObject.aValue);
+ retValue = f.floatValue();
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to short: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? (float) -1 : (float) 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
+ * get a double value from the object
+ * @param aValue
+ * @return a double
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static double toDouble(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ double retValue = 0.0;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = (double) getByte(aTypeObject);
+ break;
+ case CHAR_TYPE:
+ retValue = (double) getChar(aTypeObject);
+ break;
+ case SHORT_TYPE:
+ retValue = (double) getShort(aTypeObject);
+ break;
+ case INT_TYPE:
+ retValue = (double) getInt(aTypeObject);
+ break;
+ case LONG_TYPE:
+ retValue = (double) getLong(aTypeObject);
+ break;
+ case FLOAT_TYPE:
+ retValue = (double) getFloat(aTypeObject);
+ break;
+ case DOUBLE_TYPE:
+ retValue = getDouble(aTypeObject);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ Float f = new Float((String) aTypeObject.aValue);
+ retValue = f.floatValue();
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to short: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = getBool(aTypeObject) ? (double) -1 : (double) 0;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
+ * get a String value from the object
+ * @param aValue
+ * @return a String
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static String toString(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ String retValue = null;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = ((Byte) aTypeObject.aValue).toString();
+ break;
+ case CHAR_TYPE:
+ retValue = ((Character) aTypeObject.aValue).toString();
+ break;
+ case SHORT_TYPE:
+ retValue = ((Short) aTypeObject.aValue).toString();
+ break;
+ case INT_TYPE:
+ retValue = ((Integer) aTypeObject.aValue).toString();
+ break;
+ case LONG_TYPE:
+ retValue = ((Long) aTypeObject.aValue).toString();
+ break;
+ case FLOAT_TYPE:
+ retValue = ((Float) aTypeObject.aValue).toString();
+ break;
+ case DOUBLE_TYPE:
+ retValue = ((Double) aTypeObject.aValue).toString();
+ break;
+ case STRING_TYPE:
+ retValue = (String) aTypeObject.aValue;
+ break;
+ case BOOLEAN_TYPE:
+ 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());
+ }
+ return retValue;
+ }
+
+ /**
+ * get a boolean value from the object
+ * @param aValue
+ * @return a boolean
+ * @throws com.sun.star.lang.IllegalArgumentException if the object cannot be converted
+ */
+ public static boolean toBoolean(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ boolean retValue = true;
+ TypeObject aTypeObject = getTypeObject(aValue);
+ switch (aTypeObject.iType)
+ {
+ case BYTE_TYPE:
+ retValue = (((Byte) aTypeObject.aValue).byteValue() != 0);
+ break;
+ case CHAR_TYPE:
+ retValue = (((Character) aTypeObject.aValue).charValue() != 0);
+ break;
+ case SHORT_TYPE:
+ retValue = (((Short) aTypeObject.aValue).shortValue() != 0);
+ break;
+ case INT_TYPE:
+ retValue = (((Integer) aTypeObject.aValue).intValue() != 0);
+ break;
+ case LONG_TYPE:
+ retValue = (((Long) aTypeObject.aValue).longValue() != 0);
+ break;
+ case FLOAT_TYPE:
+ retValue = (((Float) aTypeObject.aValue).floatValue() != 0);
+ break;
+ case DOUBLE_TYPE:
+ retValue = (((Double) aTypeObject.aValue).doubleValue() != 0);
+ break;
+ case STRING_TYPE:
+ try
+ {
+ Boolean b = Boolean.valueOf((String) aTypeObject.aValue);
+ retValue = b.booleanValue();
+ }
+ catch (java.lang.NumberFormatException e)
+ {
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert to short: " + aTypeObject.aValue);
+ }
+ break;
+ case BOOLEAN_TYPE:
+ retValue = ((Boolean) aTypeObject.aValue).booleanValue();
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return retValue;
+ }
+
+ /**
+ * get an int array from an object
+ * @param anArrayValue a value that is constructed into an array
+ * @return an integer array
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ public static int[] toIntArray(Object anArrayValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ int[] retValue = null;
+ TypeObject aTypeObject = getTypeObject(anArrayValue);
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
+ aTypeObject = convertSequenceToObjectArray(aTypeObject);
+ }
+ if (aTypeObject.iType == ARRAY_TYPE)
+ {
+ Object[] obj = (Object[]) aTypeObject.aValue;
+ retValue = new int[obj.length];
+ 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)
+ };
+ }
+ return retValue;
+ }
+
+ /**
+ * get an byte array from an object
+ * @param anArrayValue a value that is constructed into an array
+ * @return a byte array
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ public static byte[] toByteArray(Object anArrayValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ byte[] retValue = null;
+ TypeObject aTypeObject = getTypeObject(anArrayValue);
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
+ aTypeObject = convertSequenceToObjectArray(aTypeObject);
+ }
+ if (aTypeObject.iType == ARRAY_TYPE)
+ {
+ Object[] obj = (Object[]) aTypeObject.aValue;
+ retValue = new byte[obj.length];
+ 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)
+ };
+ }
+ return retValue;
+ }
+
+ /**
+ * get a short array from an object
+ * @param anArrayValue a value that is constructed into an array
+ * @return a short array
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ public static short[] toShortArray(Object anArrayValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ short[] retValue = null;
+ TypeObject aTypeObject = getTypeObject(anArrayValue);
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
+ aTypeObject = convertSequenceToObjectArray(aTypeObject);
+ }
+ if (aTypeObject.iType == ARRAY_TYPE)
+ {
+ Object[] obj = (Object[]) aTypeObject.aValue;
+ retValue = new short[obj.length];
+ 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)
+ };
+ }
+ return retValue;
+ }
+
+ /**
+ * get a string array from an object
+ * @param anArrayValue a value that is constructed into an array
+ * @return a short array
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ public static String[] toStringArray(Object anArrayValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ String[] retValue = null;
+ TypeObject aTypeObject = getTypeObject(anArrayValue);
+ if (aTypeObject.iType == SEQUENCE_TYPE)
+ {
+ aTypeObject = convertSequenceToObjectArray(aTypeObject);
+ }
+ if (aTypeObject.iType == ARRAY_TYPE)
+ {
+ Object[] obj = (Object[]) aTypeObject.aValue;
+ retValue = new String[obj.length];
+ 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)
+ };
+ }
+ return retValue;
+ }
+
+ /**
+ * get an int from an object
+ * @param _aValue a value that is constructed into an int
+ * @param _ndefaultValue the value that is returned, if conversion fails, or if 'aValue' is null
+ * @return an int value
+ * @throws java.lang.Exception
+ */
+ public static int toInt(Object _aValue, int _ndefaultValue) throws Exception
+ {
+ int nreturn = _ndefaultValue;
+ try
+ {
+ if ((_aValue != null) && (!(AnyConverter.isVoid(_aValue))))
+ {
+ if (isInteger(_aValue))
+ {
+ nreturn = toInt(_aValue);
+ }
+ else
+ {
+ DebugHelper.exception(1/* BasicErrorCode.SbERR_CONVERSION*/, "");
+ }
+ }
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ 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
+ {
+ return toLong(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a float from an object
+ * @param aValue a value that is constructed into a float
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a long value
+ */
+ public static float toFloat(Object aValue, float defaultValue)
+ {
+ try
+ {
+ return toFloat(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a double from an object
+ * @param aValue a value that is constructed into a double
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a double value
+ */
+ public static double toDouble(Object aValue, double defaultValue)
+ {
+ try
+ {
+ return toDouble(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a string from an object
+ * @param aValue a value that is constructed into a string
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a string value
+ */
+ public static String toString(Object aValue, String defaultValue)
+ {
+ try
+ {
+ return toString(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a boolean from an object
+ * @param aValue a value that is constructed into a boolean
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a boolean value
+ */
+ public static boolean toBoolean(Object aValue, boolean defaultValue)
+ {
+ try
+ {
+ return toBoolean(aValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a int array from an object
+ * @param anArrayValue a value that is constructed into an int array
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return an int array
+ */
+ public static int[] toIntArray(Object anArrayValue, int[] defaultValue)
+ {
+ try
+ {
+ return toIntArray(anArrayValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a short array from an object
+ * @param anArrayValue a value that is constructed into a short array
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a short array
+ */
+ public static short[] toShortArray(Object anArrayValue, short[] defaultValue)
+ {
+ try
+ {
+ return toShortArray(anArrayValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a string array from an object
+ * @param anArrayValue a value that is constructed into a string array
+ * @param defaultValue the value that is returned, if conversion fails
+ * @return a string array
+ */
+ public static String[] toStringArray(Object anArrayValue, String[] defaultValue)
+ {
+ try
+ {
+ return toStringArray(anArrayValue);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ // ignore exception
+ }
+ return defaultValue;
+ }
+
+ /**
+ * get a hexadecimal representation from a number
+ * @param number the number to transform
+ * @return a String with the hex code of the number
+ */
+ public static String getHexStringFromNumber(long number)
+ {
+ TransformNumToHex num = new TransformNumToHex(number);
+ return num.getResult();
+ }
+
+ /**
+ * 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
+ * converted using ASCII letters (3999 -> MMMCMXCIX).
+ * @param n the arabic number
+ * @return the roman equivalent as string
+ * @throws BasicErrorException if the number cannot be converted.
+ */
+// public static String getRomanEquivalent(int n)
+// 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'
+ * @return a type object: the object together with the its type information
+ * @throws com.sun.star.lang.IllegalArgumentException if the object is unknown
+ */
+ private static TypeObject getTypeObject(Object aValue)
+ throws com.sun.star.lang.IllegalArgumentException
+ {
+ TypeObject aTypeObject = new TypeObject();
+ 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)
+ {
+ case TypeClass.CHAR_value:
+ aTypeObject.iType = CHAR_TYPE;
+ aTypeObject.aValue = new Character(AnyConverter.toChar(aValue));
+ break;
+ case TypeClass.BYTE_value:
+ aTypeObject.iType = BYTE_TYPE;
+ aTypeObject.aValue = new Byte(AnyConverter.toByte(aValue));
+ break;
+ case TypeClass.SHORT_value:
+ aTypeObject.iType = SHORT_TYPE;
+ aTypeObject.aValue = new Short(AnyConverter.toShort(aValue));
+ break;
+ case TypeClass.LONG_value:
+ aTypeObject.iType = INT_TYPE;
+ aTypeObject.aValue = new Integer(AnyConverter.toInt(aValue));
+ break;
+ case TypeClass.HYPER_value:
+ aTypeObject.iType = LONG_TYPE;
+ aTypeObject.aValue = new Long(AnyConverter.toLong(aValue));
+ break;
+ case TypeClass.FLOAT_value:
+ aTypeObject.iType = FLOAT_TYPE;
+ aTypeObject.aValue = new Float(AnyConverter.toFloat(aValue));
+ break;
+ case TypeClass.DOUBLE_value:
+ aTypeObject.iType = DOUBLE_TYPE;
+ aTypeObject.aValue = new Double(AnyConverter.toDouble(aValue));
+ break;
+ case TypeClass.STRING_value:
+ aTypeObject.iType = STRING_TYPE;
+ aTypeObject.aValue = AnyConverter.toString(aValue);
+ break;
+ case TypeClass.BOOLEAN_value:
+ aTypeObject.iType = BOOLEAN_TYPE;
+ aTypeObject.aValue = Boolean.valueOf(AnyConverter.toBoolean(aValue));
+ break;
+ case TypeClass.ARRAY_value:
+ aTypeObject.iType = ARRAY_TYPE;
+ aTypeObject.aValue = new Object[]
+ {
+ AnyConverter.toArray(aValue)
+ };
+ break;
+ case TypeClass.SEQUENCE_value:
+ aTypeObject.iType = SEQUENCE_TYPE;
+ aTypeObject.aValue = aValue;
+ break;
+ default:
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert this type: " + aValue.getClass().getName());
+ }
+ return aTypeObject;
+ }
+
+ /**
+ * get the simple byte type
+ */
+ private static byte getByte(TypeObject typeObject)
+ 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();
+ }
+
+ /**
+ * get the simple char type
+ */
+ private static char getChar(TypeObject typeObject)
+ 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();
+ }
+
+ /**
+ * get the simple short type
+ */
+ private static short getShort(TypeObject typeObject)
+ 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();
+ }
+
+ /**
+ * get the simple int type
+ * @param typeObject
+ * @return
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ static int getInt(TypeObject typeObject)
+ 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();
+ }
+
+ /**
+ * get the simple float type
+ * @throws com.sun.star.lang.IllegalArgumentException
+ */
+ static float getFloat(TypeObject typeObject)
+ 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();
+ }
+
+ /**
+ * get the simple double type
+ */
+ private static double getDouble(TypeObject typeObject)
+ 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();
+ }
+
+ /**
+ * get the simple long type
+ */
+ private static long getLong(TypeObject typeObject)
+ 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();
+ }
+
+ /**
+ * get the simple boolean type
+ */
+ private static boolean getBool(TypeObject typeObject)
+ 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();
+ }
+
+ /**
+ * a class to contain a type and a value for easier conversions
+ */
+ private static class TypeObject
+ {
+
+ public int iType;
+ public Object aValue;
+ }
+
+ /**
+ * simple class to construct a hexadecimal value from a long number
+ */
+ private static class TransformNumToHex
+ {
+
+ private StringBuffer val;
+
+ public TransformNumToHex(long number)
+ {
+ val = new StringBuffer();
+ transform(number);
+ }
+
+ private void transform(long number)
+ {
+ int index = (int) (number % HEX_BASE);
+ number = number / HEX_BASE;
+ if (index < DEC_BASE)
+ {
+ val.insert(0, index);
+ }
+ else
+ {
+ val.insert(0, (char) (ASCII_LETTER_A_OFFSET + index));
+ }
+ if (number > 0)
+ {
+ transform(number);
+ }
+ }
+
+ public String getResult()
+ {
+ return val.toString();
+ }
+ }
+
+ private static TypeObject convertSequenceToObjectArray(
+ TypeObject sourceObject)
+ 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;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Byte(vals[i]);
+ }
+ }
+ else if (c.equals(short[].class))
+ {
+ short[] vals = (short[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Short(vals[i]);
+ }
+ }
+ else if (c.equals(int[].class))
+ {
+ int[] vals = (int[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Integer(vals[i]);
+ }
+ }
+ else if (c.equals(long[].class))
+ {
+ long[] vals = (long[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Long(vals[i]);
+ }
+ }
+ else if (c.equals(float[].class))
+ {
+ float[] vals = (float[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Float(vals[i]);
+ }
+ }
+ else if (c.equals(double[].class))
+ {
+ double[] vals = (double[]) array;
+ aShortVal = new Object[vals.length];
+ for (int i = 0; i < vals.length; i++)
+ {
+ aShortVal[i] = new Double(vals[i]);
+ }
+ }
+ else if (c.equals(boolean[].class))
+ {
+ boolean[] vals = (boolean[]) array;
+ aShortVal = new Object[vals.length];
+ 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;
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ // unknown type cannot be converted
+ throw new com.sun.star.lang.IllegalArgumentException(
+ "Cannot convert unknown type: '" + e.getMessage() + "'");
+ }
+ }
+ destObject.aValue = aShortVal;
+ return destObject;
+ }
+
+// public static boolean isObjectNumericRepresentation(Object _oValue, NumberFormatter _oNumberFormatter, XPropertySet _xPropertySet) throws com.sun.star.script.BasicErrorException{
+// try{
+// int nNumberFormat = AnyConverter.toInt(_xPropertySet.getPropertyValue("NumberFormat"));
+// if (AnyConverter.isString(_oValue)){
+// String sCellContent = AnyConverter.toString(_oValue);
+// try{
+// _oNumberFormatter.convertStringToNumber(nNumberFormat, sCellContent);
+// return true;
+// }catch (Exception e){
+// return false;
+// }
+// }
+// else{
+// return true;
+// }
+// }
+// catch (com.sun.star.uno.Exception e){
+// DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, "");
+// return false;
+// }}
+ /**
+ * Helper class for roman numbering
+ */
+ private static class RomanNumbering
+ {
+
+ /** the used roman lettesrs **/
+ 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 **/
+ private static final int MIN_NUMBER = 1;
+ /** ASCII code for the number 0 **/
+ private static final int ASCII_CODE_0 = 48;
+ /** special number for the conversion algorithm **/
+ private static final int FOUR = 4;
+ /** special number for the conversion algorithm **/
+ private static final int FIVE = 5;
+ /** 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
+ * converted using ASCII letters (3999 -> MMMCMXCIX).
+ * @param n the arabic number
+ * @return the roman equivalent as string
+ * @throws BasicErrorException if the number cannot be converted.
+ */
+ public static String getRomanEquivalent(int n)
+ throws Exception
+ {
+ StringBuffer romanNumber = new StringBuffer();
+ 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
+ * different roman symbols, using three in total, e.g. CC, CD,
+ * DCC, CM for the hundreds (meaning 200, 400, 700 and 900).
+ * So every digit is converted seperately with regard to the
+ * special cases 4 and 9.
+ */
+ int symbolIndex = 0;
+ 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
+ romanDigit.append(ROMAN_EQUIV[symbolIndex]);
+ romanDigit.append(ROMAN_EQUIV[symbolIndex + 1]);
+ }
+ 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
+ romanDigit.append(ROMAN_EQUIV[symbolIndex + 1]);
+ b = b - FIVE;
+ }
+ for (int j = 0; j < b; j++)
+ { // append I's
+ romanDigit.append(ROMAN_EQUIV[symbolIndex]);
+ }
+ }
+ // next group of three symbols
+ symbolIndex += 2;
+ // append in reverse: we are starting at the right
+ romanNumber.append(romanDigit.reverse());
+ }
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ DebugHelper.exception(e);
+ }
+ // reverse again to get the number
+ return romanNumber.reverse().toString();
+ }
+ }
+
+ 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)
+ {
+ return roundDouble(_Dblvalue.doubleValue(), _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;
+ return dblretvalue;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/Properties.java b/wizards/com/sun/star/wizards/common/Properties.java
new file mode 100644
index 000000000000..6b4155d15adf
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/Properties.java
@@ -0,0 +1,126 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ */
+package com.sun.star.wizards.common;
+
+import com.sun.star.beans.PropertyValue;
+import java.util.*;
+
+/**
+ * Simplifies handling Arrays of PropertyValue.
+ * To make a use of this class, instantiate it, and call
+ * the put(propName,propValue) method.
+ * caution: propName should always be a String.
+ * When finished, call the getProperties() method to get an array of the set properties.
+ * @author rp
+ */
+public class Properties extends Hashtable
+{
+
+ 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++)
+ {
+ if (propName.equals(props[i].Name))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public PropertyValue[] getProperties()
+ {
+ return getProperties(this);
+ }
+
+ 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)
+ {
+ return createProperty(name, map.get(name));
+ }
+
+ 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)
+ {
+ PropertyValue pv = createProperty(name, value);
+ pv.Handle = handle;
+ return pv;
+ }
+
+ public static PropertyValue[] convertToPropertyValueArray(Object[] _oObjectArray)
+ {
+ PropertyValue[] retproperties = null;
+ if (_oObjectArray != null)
+ {
+ if (_oObjectArray.length > 0)
+ {
+ retproperties = new PropertyValue[_oObjectArray.length];
+ for (int i = 0; i < _oObjectArray.length; i++)
+ {
+ retproperties[i] = (PropertyValue) _oObjectArray[i];
+ }
+ }
+ }
+ return retproperties;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java
new file mode 100644
index 000000000000..aec166a5c1c5
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java
@@ -0,0 +1,396 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.beans.Property;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.lang.XServiceInfo;
+
+// import com.sun.star.container.XNameAccess;
+import java.util.HashMap;
+
+public class PropertySetHelper
+{
+
+ protected XPropertySet m_xPropertySet;
+ private HashMap<String, Object> m_aHashMap;
+
+ public PropertySetHelper(Object _aObj)
+ {
+ if (_aObj == null)
+ {
+ return;
+ }
+ m_xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aObj);
+ }
+
+ private HashMap<String, Object> getHashMap()
+ {
+ if (m_aHashMap == null)
+ {
+ m_aHashMap = new HashMap<String, Object>();
+ }
+ 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
+ */
+ public void setPropertyValueDontThrow(String _sName, Object _aValue)
+ {
+ try
+ {
+ 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
+ * @throws java.lang.Exception
+ */
+ public void setPropertyValue(String _sName, Object _aValue) throws java.lang.Exception
+ {
+ 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);
+ }
+ }
+
+ /**
+ 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;
+
+ 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
+ */
+ public short getPropertyValueAsShort(String _sName, short _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;
+ }
+
+ /**
+ 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;
+
+ 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
+ */
+ public boolean getPropertyValueAsBoolean(String _sName, boolean _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;
+ }
+
+ /**
+ 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;
+
+ 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
+ */
+ public Object getPropertyValueAsObject(String _sName)
+ {
+ 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;
+ }
+
+ /**
+ * 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();
+ }
+
+ /**
+ Debug helper, to show all properties which are available in the current object.
+ */
+ public void showProperties()
+ {
+ String sName = "";
+
+ 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
+ {
+ DebugHelper.writeInfo("The given object don't support XPropertySet interface.");
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java
new file mode 100644
index 000000000000..8dc660b21d07
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/Resource.java
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.IllegalArgumentException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.script.XInvocation;
+import com.sun.star.beans.PropertyValue;
+
+public class Resource
+{
+
+ XInvocation xInvocation;
+ XMultiServiceFactory xMSF;
+ String Unit;
+ String Module;
+
+ /** Creates a new instance of Resource
+ * @param _xMSF
+ * @param _Unit
+ * @param _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
+ {
+ short[][] PointerArray = new short[1][];
+ Object[][] DummyArray = new Object[1][];
+ Object[] nIDArray = new Object[1];
+ nIDArray[0] = new Integer(nID);
+ final String IDString = (String) xInvocation.invoke("getString", nIDArray, PointerArray, DummyArray);
+ return IDString;
+ }
+ 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
+ {
+ 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);
+ return ResProp;
+ }
+ 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
+ {
+ String[] ResArray = new String[iCount];
+ for (int i = 0; i < iCount; i++)
+ {
+ ResArray[i] = getResText(nID + i);
+ }
+ return ResArray;
+ }
+ 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
+ {
+ com.sun.star.uno.XInterface xResource = (com.sun.star.uno.XInterface) xMSF.createInstance("com.sun.star.resource.VclStringResourceLoader");
+ if (xResource == null)
+ {
+ showCommonResourceError(xMSF);
+ throw new IllegalArgumentException();
+ }
+ else
+ {
+ XInvocation xResInvoke = (XInvocation) com.sun.star.uno.UnoRuntime.queryInterface(XInvocation.class, xResource);
+ xResInvoke.setValue("FileName", Module);
+ return xResInvoke;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ showCommonResourceError(xMSF);
+ return null;
+ }
+ }
+
+ 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
new file mode 100644
index 000000000000..ac3a38c9cf7d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.java
@@ -0,0 +1,428 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.ui.dialogs.*;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.util.XStringSubstitution;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.frame.XFrame;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.awt.XToolkit;
+import com.sun.star.awt.XMessageBox;
+import com.sun.star.beans.PropertyValue;
+
+public class SystemDialog
+{
+
+ Object systemDialog;
+ XFilePicker xFilePicker;
+ XFolderPicker xFolderPicker;
+ XFilterManager xFilterManager;
+ XInitialization xInitialize;
+ XExecutableDialog xExecutable;
+ XComponent xComponent;
+ XFilePickerControlAccess xFilePickerControlAccess;
+ XMultiServiceFactory xMSF;
+ public XStringSubstitution xStringSubstitution;
+ public String sStorePath;
+
+ /**
+ *
+ * @param xMSF
+ * @param ServiceName
+ * @param type according to com.sun.star.ui.dialogs.TemplateDescription
+ */
+ public SystemDialog(XMultiServiceFactory xMSF, String ServiceName, short type)
+ {
+ try
+ {
+ this.xMSF = xMSF;
+ systemDialog = (XInterface) xMSF.createInstance(ServiceName);
+ xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, systemDialog);
+ xFolderPicker = (XFolderPicker) UnoRuntime.queryInterface(XFolderPicker.class, systemDialog);
+ xFilterManager = (XFilterManager) UnoRuntime.queryInterface(XFilterManager.class, systemDialog);
+ xInitialize = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, systemDialog);
+ xExecutable = (XExecutableDialog) UnoRuntime.queryInterface(XExecutableDialog.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)
+ };
+ if (xInitialize != null)
+ {
+ xInitialize.initialize(listAny);
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace();
+ }
+ }
+
+ 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)
+ {
+ return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FilePicker", TemplateDescription.FILEOPEN_SIMPLE);
+ }
+
+ public static SystemDialog createFolderDialog(XMultiServiceFactory xmsf)
+ {
+ return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.FolderPicker", (short) 0);
+ }
+
+ public static SystemDialog createOfficeFolderDialog(XMultiServiceFactory xmsf)
+ {
+ return new SystemDialog(xmsf, "com.sun.star.ui.dialogs.OfficeFolderPicker", (short) 0);
+ }
+
+ private String subst(String path)
+ {
+ try
+ {
+ //System.out.println("SystemDialog.subst:");
+ //System.out.println(path);
+ String s = xStringSubstitution.substituteVariables(path, false);
+ //System.out.println(s);
+ return s;
+
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return path;
+ }
+ }
+
+ /**
+ * ATTENTION a BUG : The extension calculated
+ * here gives the last 3 chars of the filename - what
+ * if the extension is of 4 or more chars?
+ *
+ * @param DisplayDirectory
+ * @param DefaultName
+ * @param sDocuType
+ * @return
+ */
+ 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
+ * @param defaultName
+ * given url to a local path.
+ * @return
+ */
+ public String callStoreDialog(String displayDir, String defaultName)
+ {
+ sStorePath = null;
+ 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))
+ {
+ String[] sPathList = xFilePicker.getFiles();
+ sStorePath = sPathList[0];
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace();
+ }
+ return sStorePath;
+ }
+
+ public String callFolderDialog(String title, String description, String displayDir)
+ {
+ try
+ {
+ xFolderPicker.setDisplayDirectory(subst(displayDir));
+ }
+ 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)
+ {
+ return execDialog.execute() == 1;
+ }
+
+ public String[] callOpenDialog(boolean multiSelect, String displayDirectory)
+ {
+
+ try
+ {
+ xFilePicker.setMultiSelectionMode(multiSelect);
+ xFilePicker.setDisplayDirectory(subst(displayDirectory));
+ if (execute(xExecutable))
+ {
+ return xFilePicker.getFiles();
+ }
+ }
+ 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
+ {
+ //get the localized filtername
+ String uiName = getFilterUIName(filterName);
+ String pattern = "*." + sExtension;
+
+ //add the filter
+ addFilter(uiName, pattern, setToDefault);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void addFilter(String uiName, String pattern, boolean setToDefault)
+ {
+ try
+ {
+ xFilterManager.appendFilter(uiName, pattern);
+ if (setToDefault)
+ {
+ xFilterManager.setCurrentFilter(uiName);
+ }
+ }
+ 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)
+ {
+ String prodName = Configuration.getProductName(xMSF);
+ String[][] s = new String[][]
+ {
+ {
+ getFilterUIName_(filterName)
+ }
+ };
+ s[0][0] = JavaTools.replaceSubString(s[0][0], prodName, "%productname%");
+ return s[0][0];
+ }
+
+ /**
+ * note the result should go through conversion of the product name.
+ * @param filterName
+ * @return the UI localized name of the given filter name.
+ */
+ 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++)
+ {
+ PropertyValue aValue = 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ 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);
+ String sErrorMessage = oResource.getResText(ResID);
+ sErrorMessage = JavaTools.replaceSubString(sErrorMessage, ProductName, "%PRODUCTNAME");
+ sErrorMessage = JavaTools.replaceSubString(sErrorMessage, String.valueOf((char) 13), "<BR>");
+ sErrorMessage = JavaTools.replaceSubString(sErrorMessage, AddString, AddTag);
+ return SystemDialog.showMessageBox(xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, sErrorMessage);
+ }
+
+ 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);
+ String sErrorMessage = oResource.getResText(ResID);
+ sErrorMessage = JavaTools.replaceSubString(sErrorMessage, ProductName, "%PRODUCTNAME");
+ sErrorMessage = JavaTools.replaceSubString(sErrorMessage, String.valueOf((char) 13), "<BR>");
+ return showMessageBox(xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, sErrorMessage);
+ }
+
+ /*
+ * example:
+ * (xMSF, "ErrorBox", com.sun.star.awt.VclWindowPeerAttribute.OK, "message")
+ */
+ /**
+ * @param windowServiceName one of the following strings:
+ * "ErrorBox", "WarningBox", "MessBox", "InfoBox", "QueryBox".
+ * There are other values possible, look
+ * under src/toolkit/source/awt/vcltoolkit.cxx
+ * @param windowAttribute see com.sun.star.awt.VclWindowPeerAttribute
+ * @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)
+ {
+
+ short iMessage = 0;
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return iMessage;
+ }
+
+ /**
+ * just like the other showMessageBox(...) method, but recieves a
+ * peer argument to use to create the message box.
+ * @param xMSF
+ * @param peer
+ * @param windowServiceName
+ * @param windowAttribute
+ * @param MessageText
+ * @return
+ */
+ 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);
+ }
+ short iMessage = 0;
+ 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();
+ oDescriptor.WindowServiceName = windowServiceName;
+ oDescriptor.Parent = peer;
+ oDescriptor.Type = com.sun.star.awt.WindowClass.MODALTOP;
+ oDescriptor.WindowAttributes = windowAttribute;
+ XWindowPeer xMsgPeer = xToolkit.createWindow(oDescriptor);
+ XMessageBox xMsgbox = (XMessageBox) UnoRuntime.queryInterface(XMessageBox.class, xMsgPeer);
+ XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xMsgbox);
+ xMsgbox.setMessageText(MessageText);
+ iMessage = xMsgbox.execute();
+ xComponent.dispose();
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace(System.out);
+ }
+ return iMessage;
+ }
+
+ 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;
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/TerminateWizardException.java b/wizards/com/sun/star/wizards/common/TerminateWizardException.java
new file mode 100644
index 000000000000..124d98f9ff31
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/TerminateWizardException.java
@@ -0,0 +1,43 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 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
new file mode 100644
index 000000000000..5e3ad00698df
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/UCB.java
@@ -0,0 +1,269 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.common;
+
+import java.util.List;
+import java.util.Vector;
+
+import com.sun.star.beans.Property;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.ucb.*;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+ * @author rpiterman
+ * This class is used to copy the content of a folder to
+ * another folder.
+ * There is an incosistency with argument order.
+ * It should be always: dir,filename.
+ */
+public class UCB
+{
+
+ private Object ucb;
+ private FileAccess fa;
+
+ public UCB(XMultiServiceFactory xmsf) throws Exception
+ {
+ String[] keys = new String[2];
+ keys[ 0 ] = "Local";
+ keys[ 1 ] = "Office";
+ ucb = xmsf.createInstanceWithArguments(
+ "com.sun.star.ucb.UniversalContentBroker", keys );
+ fa = new FileAccess(xmsf);
+ }
+
+ public void deleteDirContent(String dir)
+ throws Exception
+ {
+ if (!fa.exists(dir,true))
+ {
+ return;
+ }
+ List l = listFiles(dir,null);
+ for (int i = 0; i<l.size(); i++)
+ {
+ delete(FileAccess.connectURLs(dir ,(String)l.get(i)));
+ }
+ }
+
+ public void delete(String filename) throws Exception
+ {
+ //System.out.println("UCB.delete(" + filename);
+ executeCommand( getContent(filename),"delete",Boolean.TRUE);
+ }
+
+ public void copy(String sourceDir, String targetDir) throws Exception
+ {
+ copy(sourceDir,targetDir,(Verifier)null);
+ }
+
+ public void copy(String sourceDir, String targetDir, Verifier verifier) throws Exception
+ {
+ List files = listFiles(sourceDir,verifier);
+ for (int i = 0; i<files.size(); i++)
+ {
+ copy(sourceDir, (String)files.get(i), targetDir);
+ }
+
+ }
+
+ public void copy(String sourceDir, String filename, String targetDir, String targetName) throws Exception
+ {
+ if (!fa.exists(targetDir,true))
+ {
+ fa.fileAccess.createFolder(targetDir);
+ }
+ //System.out.println("UCB.copy(" + sourceDir + ", " + filename + ", " + targetDir+ ", " + targetName);
+ executeCommand(ucb, "globalTransfer", copyArg(sourceDir,filename, targetDir,targetName));
+ }
+
+ /**
+ * @deprecated
+ * @param sourceDir
+ * @param filename
+ * @param targetDir
+ * @throws Exception
+ */
+ public void copy(String sourceDir, String filename, String targetDir) throws Exception
+ {
+ copy(sourceDir,filename, targetDir, "");
+ }
+
+ /**
+ * target name can be "", in which case the name stays lige the source name
+ * @param sourceDir
+ * @param sourceFilename
+ * @param targetDir
+ * @param targetFilename
+ * @return
+ */
+ public GlobalTransferCommandArgument copyArg(String sourceDir, String sourceFilename, String targetDir, String targetFilename)
+ {
+
+ GlobalTransferCommandArgument aArg = new GlobalTransferCommandArgument();
+ aArg.Operation = TransferCommandOperation.COPY;
+ aArg.SourceURL = fa.getURL(sourceDir,sourceFilename);
+ aArg.TargetURL = targetDir;
+ aArg.NewTitle = targetFilename;
+ // fail, if object with same name exists in target folder
+ aArg.NameClash = NameClash.OVERWRITE;
+ return aArg;
+ }
+
+ public Object executeCommand(Object xContent, String aCommandName, Object aArgument)
+ throws com.sun.star.ucb.CommandAbortedException,
+ com.sun.star.uno.Exception
+ {
+ XCommandProcessor xCmdProcessor = (XCommandProcessor)UnoRuntime.queryInterface(
+ XCommandProcessor.class, xContent);
+ Command aCommand = new Command();
+ aCommand.Name = aCommandName;
+ aCommand.Handle = -1; // not available
+ aCommand.Argument = aArgument;
+ return xCmdProcessor.execute(aCommand, 0, null);
+ }
+
+ public List listFiles(String path, Verifier verifier) throws Exception
+ {
+ Object xContent = getContent(path);
+
+ OpenCommandArgument2 aArg = new OpenCommandArgument2();
+ aArg.Mode = OpenMode.ALL;
+ aArg.Priority = 32768;
+
+ // Fill info for the properties wanted.
+ aArg.Properties = new Property[] {new Property()};
+
+ aArg.Properties[0].Name = "Title";
+ aArg.Properties[0].Handle = -1;
+
+ XDynamicResultSet xSet;
+
+ xSet = (XDynamicResultSet)UnoRuntime.queryInterface(
+ XDynamicResultSet.class,executeCommand(xContent, "open", aArg));
+
+ XResultSet xResultSet = xSet.getStaticResultSet();
+
+ List files = new Vector();
+
+ if (xResultSet.first())
+ {
+ // obtain XContentAccess interface for child content access and XRow for properties
+ XContentAccess xContentAccess = (XContentAccess)UnoRuntime.queryInterface(
+ XContentAccess.class, xResultSet);
+ XRow xRow = (XRow)UnoRuntime.queryInterface(XRow.class, xResultSet);
+ do
+ {
+ // Obtain URL of child.
+ String aId = xContentAccess.queryContentIdentifierString();
+ // First column: Title (column numbers are 1-based!)
+ String aTitle = xRow.getString(1);
+ if (aTitle.length() == 0 && xRow.wasNull())
+ {
+ ; //ignore
+ }
+ else
+ {
+ files.add(aTitle);
+ }
+ }
+ while (xResultSet.next()); // next child
+ }
+
+ if (verifier != null)
+ {
+ for (int i = 0; i<files.size(); i++)
+ {
+ if (!verifier.verify(files.get(i)))
+ {
+ files.remove(i--);
+ }
+ }
+ }
+
+ return files;
+ }
+
+ public Object getContentProperty(Object content, String propName, Class type)
+ throws Exception
+ {
+ Property[] pv = new Property[1];
+ pv[0] = new Property();
+ pv[0].Name = propName;
+ pv[0].Handle = -1;
+
+ Object row = executeCommand(content,"getPropertyValues",pv);
+ XRow xrow = (XRow)UnoRuntime.queryInterface(XRow.class,row);
+ if (type.equals(String.class))
+ {
+ return xrow.getString(1);
+ }
+ else if (type.equals(Boolean.class))
+ {
+ return xrow.getBoolean(1) ? Boolean.TRUE : Boolean.FALSE;
+ }
+ else if (type.equals(Integer.class))
+ {
+ return new Integer(xrow.getInt(1));
+ }
+ else if (type.equals(Short.class))
+ {
+ return new Short(xrow.getShort(1));
+ }
+ else
+ {
+ return null;
+ }
+
+ }
+
+ public Object getContent(String path) throws Exception
+ {
+ //System.out.println("Getting Content for : " + path);
+ XContentIdentifier id = ((XContentIdentifierFactory) UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb)).createContentIdentifier(path);
+
+ return ((XContentProvider)UnoRuntime.queryInterface(
+ XContentProvider.class,ucb)).queryContent(id);
+ }
+
+ public static interface Verifier
+ {
+
+ public boolean verify(Object object);
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/XMLHelper.java b/wizards/com/sun/star/wizards/common/XMLHelper.java
new file mode 100644
index 000000000000..326ba03fbeea
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/XMLHelper.java
@@ -0,0 +1,74 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+
+/**
+ *
+ * @author rpiterman
+ */
+public class XMLHelper
+{
+
+ 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
+ });
+ }
+}
diff --git a/wizards/com/sun/star/wizards/common/XMLProvider.java b/wizards/com/sun/star/wizards/common/XMLProvider.java
new file mode 100644
index 000000000000..f5c2fd662d31
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/XMLProvider.java
@@ -0,0 +1,46 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 Node createDOM(Node parent);
+}
diff --git a/wizards/com/sun/star/wizards/common/delzip b/wizards/com/sun/star/wizards/common/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/common/delzip
diff --git a/wizards/com/sun/star/wizards/db/BlindtextCreator.java b/wizards/com/sun/star/wizards/db/BlindtextCreator.java
new file mode 100644
index 000000000000..b52381def054
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/BlindtextCreator.java
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import com.sun.star.wizards.common.JavaTools;
+
+/**
+ *
+ * @author bc93774
+ */
+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.";
+
+ 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 <= MaxFieldCount)
+ {
+ BlindTextString = getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
+ }
+ else
+ {
+ BlindTextString = getBlindTextString(FieldTitle, FieldWidth, (int) (0.5 * FieldWidth));
+ }
+ }
+ else
+ {
+ BlindTextString = getBlindTextString(FieldTitle, FieldWidth, (int) 1.1 * FieldTitle.length());
+ }
+ return BlindTextString;
+ }
+
+ public static String getBlindTextString(String FieldTitle, int FieldWidth, int MaxWidth)
+ {
+ String[] BlindTextArray = JavaTools.ArrayoutofString(BlindText, " ");
+ String PartBlindText = BlindTextArray[0];
+ String NewPartBlindText;
+ int MaxHeaderWidth;
+ int iWidth = FieldWidth;
+ 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
+ {
+ NewPartBlindText = PartBlindText + " " + BlindTextArray[i];
+ if (NewPartBlindText.length() < MaxWidth)
+ {
+ PartBlindText = NewPartBlindText;
+ i += 1;
+ }
+ }
+ while (NewPartBlindText.length() < MaxWidth);
+ return PartBlindText;
+ }
+
+ 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
new file mode 100644
index 000000000000..204ba2328321
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.wizards.common.Properties;
+// import com.sun.star.wizards.db.TypeInspector;
+
+public class ColumnPropertySet
+{
+
+ TypeInspector oTypeInspector;
+ public XPropertySet xPropertySet;
+ private int nType;
+ private String sTypeName = "";
+
+ public ColumnPropertySet(TypeInspector _oTypeInspector, XPropertySet _xPropertySet)
+ {
+ xPropertySet = _xPropertySet;
+ oTypeInspector = _oTypeInspector;
+ }
+
+ 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++)
+ {
+ PropertyValue val = new PropertyValue();
+ val.Name = props[i].Name;
+ val.Value = _xNewPropertySet.getPropertyValue(val.Name);
+ ret[i] = val;
+ }
+ return ret;
+ }
+
+ private void assignPropertyValues(String _sNewName, PropertyValue[] _aNewColPropertyValues, boolean _bsetDefaultProperties)
+ {
+ 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"))
+ {
+ precision = (Integer) Properties.getPropertyValue(_aNewColPropertyValues, "Precision");
+
+ }
+ if ((nType == DataType.VARCHAR) && (precision == null || precision.intValue() == 0))
+ {
+ precision = new Integer(50);
+ }
+ if (precision != null)
+ {
+ xPropertySet.setPropertyValue("Precision", precision);
+ }
+ setType(nType, sTypeName, precision);
+ for (int i = 0; i < _aNewColPropertyValues.length; i++)
+ {
+ String sPropName = _aNewColPropertyValues[i].Name;
+ if (_sNewName != null && sPropName.equals("Name"))
+ {
+ xPropertySet.setPropertyValue("Name", _sNewName);
+ }
+ else if (sPropName.equals("Precision"))
+ {
+ // do nothing, see above
+ }
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+
+ }
+
+ 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);
+ }
+ }
+
+ 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)
+ {
+ 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"))
+ {
+ nType = ((Integer) _oValue).intValue();
+ xPropertySet.setPropertyValue("Type", new Integer(nType));
+ }
+ else if (_spropname.equals("Name"))
+ {
+ String sName = (String) _oValue;
+ if (!sName.equals(""))
+ {
+ xPropertySet.setPropertyValue("Name", sName);
+ }
+ }
+ else if (_spropname.equals("Scale"))
+ {
+ int nScale = ((Integer) _oValue).intValue();
+ nScale = oTypeInspector.getScale(xPropertySet);
+ xPropertySet.setPropertyValue("Scale", new Integer(nScale));
+ }
+ 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"))
+ {
+ String sTypeName = (String) _oValue;
+ xPropertySet.setPropertyValue("TypeName", sTypeName);
+ }
+ else
+ {
+ xPropertySet.setPropertyValue(_spropname, _oValue);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ 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
new file mode 100644
index 000000000000..ad54020e8645
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java
@@ -0,0 +1,772 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbcx.KeyType;
+import com.sun.star.sdbcx.XColumnsSupplier;
+import com.sun.star.sdbcx.XKeysSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.Locale;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.embed.EntryInitModes;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NumberFormatter;
+import com.sun.star.wizards.common.Resource;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+
+public class CommandMetaData extends DBMetaData
+{
+ public Map FieldTitleSet = new HashMap();
+ public String[] m_aAllFieldNames = new String[]{};
+ public FieldColumn[] FieldColumns = new FieldColumn[]{};
+ public String[] GroupFieldNames = new String[] {};
+ private String[][] SortFieldNames = new String[][] {};
+ private String[] RecordFieldNames = new String[] {};
+ public String[][] AggregateFieldNames = new String[][] {};
+ public String[] NumericFieldNames = new String[] {};
+ public String[] NonAggregateFieldNames;
+ private int CommandType;
+ private String Command;
+ boolean bCatalogAtStart = true;
+ String sCatalogSep = "";
+ String sIdentifierQuote = "";
+ boolean bCommandComposerAttributesalreadyRetrieved = false;
+
+
+ private XIndexAccess xIndexKeys;
+
+ public CommandMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter oNumberFormatter)
+ {
+ super(xMSF, _aLocale, oNumberFormatter);
+ }
+
+ public CommandMetaData(XMultiServiceFactory xMSF)
+ {
+ super(xMSF);
+ }
+
+
+ public void initializeFieldColumns(boolean _bgetDefaultValue, String _CommandName, String[] _FieldNames)
+ {
+ this.setCommandName(_CommandName);
+ FieldColumns = new FieldColumn[_FieldNames.length];
+ for (int i = 0; i < _FieldNames.length; i++)
+ {
+ FieldColumns[i] = new FieldColumn(this, _FieldNames[i], this.getCommandName(), false);
+// if (_bgetDefaultValue)
+// {
+// FieldColumns[i].getDefaultValue();
+// }
+ }
+ }
+
+
+ public void initializeFieldColumns(String[] _FieldNames, XNameAccess _xColumns)
+ {
+ FieldColumns = new FieldColumn[_FieldNames.length];
+ for (int i = 0; i < _FieldNames.length; i++)
+ {
+ FieldColumns[i] = new FieldColumn(this,_xColumns, _FieldNames[i] );
+ }
+ }
+
+
+ public void initializeFieldColumns(String[] _FieldNames, String _CommandName)
+ {
+ this.setCommandName(_CommandName);
+ FieldColumns = new FieldColumn[_FieldNames.length];
+ for (int i = 0; i < _FieldNames.length; i++)
+ {
+ FieldColumns[i] = new FieldColumn(this, _FieldNames[i], _CommandName, false);
+ if (FieldTitleSet != null)
+ {
+ if (FieldTitleSet.containsKey(_FieldNames[i]))
+ {
+ FieldColumns[i].setFieldTitle( (String) FieldTitleSet.get(_FieldNames[i]) );
+ if (FieldColumns[i].getFieldTitle() == null)
+ {
+ FieldColumns[i].setFieldTitle( _FieldNames[i] );
+ FieldTitleSet.put(_FieldNames[i], _FieldNames[i]);
+ }
+ }
+ }
+ }
+ }
+
+ public Map getFieldTitleSet()
+ {
+ return FieldTitleSet;
+ }
+
+
+ public XPropertySet getColumnObjectByFieldName(String _FieldName, boolean _bgetByDisplayName)
+ {
+ try
+ {
+ FieldColumn CurFieldColumn = null;
+ if (_bgetByDisplayName)
+ {
+ CurFieldColumn = this.getFieldColumnByDisplayName(_FieldName);
+ }
+ else
+ {
+ CurFieldColumn = this.getFieldColumnByFieldName(_FieldName);
+ }
+ String CurCommandName = CurFieldColumn.getCommandName();
+ CommandObject oCommand = getTableByName(CurCommandName);
+ Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName());
+ XPropertySet xColumn = UnoRuntime.queryInterface( XPropertySet.class, oColumn );
+ return xColumn;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+
+ // @SuppressWarnings("unchecked")
+ public void prependSortFieldNames(String[] _fieldnames)
+ {
+ Vector aSortFields = new Vector();
+ for (int i = 0; i < _fieldnames.length; i++)
+ {
+ String[] sSortFieldName = new String[2];
+ sSortFieldName[0] = _fieldnames[i];
+ int index = JavaTools.FieldInTable(SortFieldNames, _fieldnames[i]);
+ if (index > -1)
+
+ {
+ sSortFieldName[1] = SortFieldNames[index][1];
+ }
+ else
+
+ {
+ sSortFieldName[1] = "ASC";
+ }
+ aSortFields.add(sSortFieldName);
+ }
+ for (int i = 0; i < SortFieldNames.length; i++)
+ {
+ if (JavaTools.FieldInList(_fieldnames, SortFieldNames[i][0]) == -1)
+ {
+ aSortFields.add(SortFieldNames[i]);
+ }
+ }
+ SortFieldNames = new String[aSortFields.size()][2];
+ aSortFields.toArray(SortFieldNames);
+ }
+
+ public String[][] getSortFieldNames()
+ {
+ return SortFieldNames;
+ }
+ public void setSortFieldNames(String[][] aNewListList)
+ {
+ SortFieldNames = aNewListList;
+ }
+
+ public FieldColumn getFieldColumn(String _FieldName, String _CommandName)
+ {
+ if (FieldColumns.length > 0)
+ {
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ if (FieldColumns[i].getFieldName().equals(_FieldName))
+
+ {
+ if (FieldColumns[i].getCommandName().equals(_CommandName))
+ {
+ return FieldColumns[i];
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+
+
+ public FieldColumn getFieldColumnByFieldName(String _FieldName)
+ {
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ String sFieldName = FieldColumns[i].getFieldName();
+ if (sFieldName.equals(_FieldName))
+ {
+ return FieldColumns[i];
+ }
+ if (_FieldName.indexOf('.') == -1)
+ {
+ String sCompound = Command + "." + _FieldName;
+ if (sFieldName.equals(sCompound))
+ {
+ return FieldColumns[i];
+ }
+ }
+ }
+ throw new com.sun.star.uno.RuntimeException();
+ }
+
+
+ public FieldColumn getFieldColumnByDisplayName(String _DisplayName)
+ {
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ String sDisplayName = FieldColumns[i].getDisplayFieldName();
+ if (sDisplayName.equals(_DisplayName))
+ {
+ return FieldColumns[i];
+ }
+ if (_DisplayName.indexOf('.') == -1)
+ {
+ String sCompound = Command + "." + _DisplayName;
+ if (sDisplayName.equals(sCompound))
+ {
+ return FieldColumns[i];
+ }
+ }
+ }
+ throw new com.sun.star.uno.RuntimeException();
+ }
+
+
+ public FieldColumn getFieldColumnByTitle(String _FieldTitle)
+ {
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ if (FieldColumns[i].getFieldTitle().equals(_FieldTitle))
+ {
+ return FieldColumns[i];
+ }
+ }
+ // throw new com.sun.star.uno.RuntimeException();
+ // LLA: Group works with fields direct
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ if (FieldColumns[i].getFieldName().equals(_FieldTitle))
+ {
+ return FieldColumns[i];
+ }
+ }
+ throw new com.sun.star.uno.RuntimeException();
+ }
+
+
+ public boolean getFieldNamesOfCommand(String _commandname, int _commandtype, boolean _bAppendMode)
+ {
+ try
+ {
+ // Object oField;
+ java.util.Vector<String> ResultFieldNames = new java.util.Vector<String>(10);
+ String[] FieldNames;
+ CommandObject oCommand = this.getCommandByName(_commandname, _commandtype);
+ FieldNames = oCommand.getColumns().getElementNames();
+ if (FieldNames.length > 0)
+ {
+ for (int n = 0; n < FieldNames.length; n++)
+ {
+ final String sFieldName = FieldNames[n];
+ Object oField = oCommand.getColumns().getByName(sFieldName);
+ int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type"));
+ // BinaryFieldTypes are not included in the WidthList
+ if (JavaTools.FieldInIntTable(WidthList, iType) >= 0)
+ {
+// if (_bAppendMode)
+// ResultFieldNames.addElement(_commandname + "." + FieldNames[n]);
+// else
+ ResultFieldNames.addElement(sFieldName);
+ }
+ else if (JavaTools.FieldInIntTable(BinaryTypes, iType) >= 0)
+ {
+ ResultFieldNames.addElement(sFieldName);
+ }
+ }
+ // FieldNames = new String[FieldNames.length];
+ // FieldTypes = new int[FieldNames.length];
+ m_aAllFieldNames = new String[ResultFieldNames.size()];
+ ResultFieldNames.copyInto(m_aAllFieldNames);
+ return true;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ Resource oResource = new Resource(xMSF, "Database", "dbw");
+ String sMsgNoFieldsFromCommand = oResource.getResText(RID_DB_COMMON + 45);
+ sMsgNoFieldsFromCommand = JavaTools.replaceSubString(sMsgNoFieldsFromCommand, _commandname, "%NAME");
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgNoFieldsFromCommand);
+ return false;
+ }
+
+
+
+
+
+
+ public String[] getOrderableColumns(String[] _fieldnames)
+ {
+ Vector<String> aOrderableColumns = new Vector<String>();
+ int ncount = 0;
+ for (int i = 0; i < _fieldnames.length; i++)
+ {
+ FieldColumn ofieldcolumn = getFieldColumnByFieldName(_fieldnames[i]);
+ if (getDBDataTypeInspector().isColumnOrderable(ofieldcolumn.getXColumnPropertySet()))
+ {
+ aOrderableColumns.addElement(_fieldnames[i]);
+ ncount++;
+ }
+ }
+ String[] sretfieldnames = new String[ncount];
+ aOrderableColumns.toArray(sretfieldnames);
+ return sretfieldnames;
+ }
+
+
+ /**
+ * @return Returns the command.
+ */
+ public String getCommandName()
+ {
+ return Command;
+ }
+ /**
+ * @param _command The command to set.
+ */
+ public void setCommandName(String _command)
+ {
+ Command = _command;
+ }
+
+ /**
+ * @return Returns the commandType.
+ */
+ public int getCommandType()
+ {
+ return CommandType;
+ }
+
+ /**
+ * @param _commandType The commandType to set.
+ */
+ public void setCommandType(int _commandType)
+ {
+ CommandType = _commandType;
+ }
+
+
+ public boolean isnumeric(FieldColumn _oFieldColumn)
+ {
+ try
+ {
+ CommandObject oTable = super.getTableByName(_oFieldColumn.getCommandName());
+ Object oField = oTable.getColumns().getByName(_oFieldColumn.getFieldName());
+ int iType = AnyConverter.toInt(Helper.getUnoPropertyValue(oField, "Type"));
+ int ifound = java.util.Arrays.binarySearch(NumericTypes, iType);
+ if ((ifound < NumericTypes.length) && (ifound > 0))
+ {
+ return (NumericTypes[ifound] == iType);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ public String[] setNumericFields()
+ {
+ try
+ {
+ Vector<String> numericfieldsvector = new java.util.Vector<String>();
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ if (isnumeric(FieldColumns[i]))
+ {
+ numericfieldsvector.addElement(FieldColumns[i].getDisplayFieldName());
+ }
+ }
+ NumericFieldNames = new String[numericfieldsvector.size()];
+ numericfieldsvector.toArray(NumericFieldNames);
+ return NumericFieldNames;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return new String[]{};
+ }
+ }
+
+ public String[] getFieldNames(String[] _sDisplayFieldNames, String _sCommandName)
+ {
+ Vector<String> sFieldNamesVector = new java.util.Vector<String>();
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ if (_sCommandName.equals(FieldColumns[i].getCommandName()))
+ {
+ if (JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].getDisplayFieldName()) > -1)
+ {
+ sFieldNamesVector.addElement(FieldColumns[i].getFieldName());
+ }
+ }
+ }
+ String[] sFieldNames = new String[sFieldNamesVector.size()];
+ sFieldNamesVector.toArray(sFieldNames);
+ return sFieldNames;
+ }
+
+
+
+ public String[] getFieldNames()
+ {
+ String[] sFieldNames = new String[FieldColumns.length];
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ sFieldNames[i] = FieldColumns[i].getFieldName();
+ }
+ return sFieldNames;
+ }
+
+ public String[] getDisplayFieldNames()
+ {
+ String[] sDisplayFieldNames = new String[FieldColumns.length];
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ sDisplayFieldNames[i] = FieldColumns[i].getDisplayFieldName();
+ }
+ return sDisplayFieldNames;
+ }
+
+
+ public String[] setNonAggregateFieldNames()
+ {
+ try
+ {
+ Vector<String> nonaggregatefieldsvector = new java.util.Vector<String>();
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].getDisplayFieldName()) == -1)
+ {
+ nonaggregatefieldsvector.addElement(FieldColumns[i].getDisplayFieldName());
+ }
+ }
+ NonAggregateFieldNames = new String[nonaggregatefieldsvector.size()];
+ nonaggregatefieldsvector.toArray(NonAggregateFieldNames);
+ return NonAggregateFieldNames;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return new String[]{};
+ }
+ }
+
+ /**
+ * the fieldnames passed over are not necessarily the ones that are defined in the class
+ * @param _DisplayFieldNames
+ * @return
+ */
+ public boolean hasNumericalFields(String[] _DisplayFieldNames)
+
+ {
+ if (_DisplayFieldNames != null)
+ {
+ if (_DisplayFieldNames.length > 0)
+ {
+ for (int i = 0; i < _DisplayFieldNames.length; i++)
+ {
+ if (isnumeric(getFieldColumnByDisplayName(_DisplayFieldNames[i])))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public String getFieldTitle(String FieldName)
+ {
+ String FieldTitle = FieldName;
+ if (this.FieldTitleSet != null)
+ {
+ FieldTitle = (String) this.FieldTitleSet.get(FieldName); //FieldTitles[TitleIndex];
+ if (FieldTitle == null)
+ {
+ return FieldName;
+ }
+ }
+ return FieldTitle;
+ }
+
+
+ public void setFieldTitles(String[] sFieldTitles)
+ {
+ int nFieldColLength = FieldColumns.length;
+ for (int i = 0; i < sFieldTitles.length; i++)
+ {
+ if (i < nFieldColLength)
+ {
+ FieldColumns[i].setFieldTitle(sFieldTitles[i]);
+ }
+
+ }
+ }
+
+
+ public String[] getFieldTitles()
+ {
+ String[] sFieldTitles = new String[FieldColumns.length];
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ sFieldTitles[i] = FieldColumns[i].getFieldTitle();
+ }
+ return sFieldTitles;
+ }
+
+
+ public void setGroupFieldNames(String[] GroupFieldNames)
+ {
+ this.GroupFieldNames = GroupFieldNames;
+ }
+
+
+ public String[] getGroupFieldNames()
+ {
+ return GroupFieldNames;
+ }
+
+ public void createRecordFieldNames()
+ {
+ String CurFieldName;
+ int GroupFieldCount;
+ int TotFieldCount = FieldColumns.length;
+ // int SortFieldCount = SortFieldNames[0].length;
+ GroupFieldCount = JavaTools.getArraylength(GroupFieldNames);
+ RecordFieldNames = new String[TotFieldCount - GroupFieldCount];
+
+ int a = 0;
+ for (int i = 0; i < TotFieldCount; i++)
+ {
+ CurFieldName = FieldColumns[i].getFieldName();
+ if (JavaTools.FieldInList(GroupFieldNames, CurFieldName) < 0)
+ {
+ RecordFieldNames[a] = CurFieldName;
+ // a += 1;
+ ++a;
+ }
+ }
+ }
+ public void setRecordFieldNames(String [] _aNewList)
+ {
+ RecordFieldNames = _aNewList;
+ }
+ public String[] getRecordFieldNames()
+ {
+ return RecordFieldNames;
+ }
+ public String getRecordFieldName(int i)
+ {
+ return RecordFieldNames[i];
+ }
+
+ /**@deprecated use 'RelationController' class instead
+ *
+ * @param _stablename
+ * @param _ncommandtype
+ * @return
+ */
+ public String[] getReferencedTables(String _stablename, int _ncommandtype)
+ {
+ String[] sTotReferencedTables = new String[]{};
+ try
+ {
+ if (_ncommandtype == com.sun.star.sdb.CommandType.TABLE)
+ {
+ if (xDBMetaData.supportsIntegrityEnhancementFacility())
+ {
+ java.util.Vector<String> TableVector = new java.util.Vector<String>();
+ Object oTable = getTableNamesAsNameAccess().getByName(_stablename);
+ XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface( XKeysSupplier.class, oTable );
+ xIndexKeys = xKeysSupplier.getKeys();
+ for (int i = 0; i < xIndexKeys.getCount(); i++)
+ {
+ XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xIndexKeys.getByIndex( i ) );
+ int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type"));
+ if (curtype == KeyType.FOREIGN)
+ {
+ // getImportedKeys (RelationController.cxx /source/ui/relationdesign) /Zeile 475
+ String sreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable"));
+ if (getTableNamesAsNameAccess().hasByName(sreftablename))
+ {
+ TableVector.addElement(sreftablename);
+ }
+ }
+ }
+ if (TableVector.size() > 0)
+ {
+ sTotReferencedTables = new String[TableVector.size()];
+ TableVector.copyInto(sTotReferencedTables);
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return sTotReferencedTables;
+ }
+
+ /**@deprecated use 'RelationController' class instead
+ *
+ * @param _sreferencedtablename
+ * @return
+ */
+ public String[][] getKeyColumns(String _sreferencedtablename)
+ {
+ String[][] skeycolumnnames = null;
+ try
+ {
+ for (int i = 0; i < xIndexKeys.getCount(); i++)
+ {
+ XPropertySet xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xIndexKeys.getByIndex( i ) );
+ int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type"));
+ if (curtype == KeyType.FOREIGN)
+ {
+ String scurreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable"));
+ if (getTableNamesAsNameAccess().hasByName(scurreftablename))
+ {
+ if (scurreftablename.equals(_sreferencedtablename))
+ {
+ XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface( XColumnsSupplier.class, xPropertySet );
+ String[] smastercolnames = xColumnsSupplier.getColumns().getElementNames();
+ skeycolumnnames = new String[2][smastercolnames.length];
+ skeycolumnnames[0] = smastercolnames;
+ skeycolumnnames[1] = new String[smastercolnames.length];
+ for (int n = 0; n < smastercolnames.length; n++)
+ {
+ XPropertySet xcolPropertySet = UnoRuntime.queryInterface( XPropertySet.class, xColumnsSupplier.getColumns().getByName( smastercolnames[n] ) );
+ skeycolumnnames[1][n] = AnyConverter.toString(xcolPropertySet.getPropertyValue("RelatedColumn"));
+ }
+ return skeycolumnnames;
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return skeycolumnnames;
+ }
+
+
+ public void openFormDocument(boolean _bReadOnly)
+ {
+ try
+ {
+ Object oEmbeddedFactory = super.xMSF.createInstance("com.sun.star.embed.OOoEmbeddedObjectFactory");
+ int iEntryInitMode = EntryInitModes.DEFAULT_INIT; //TRUNCATE_INIT???
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+
+ public void setCommandComposingAttributes()
+ {
+ try
+ {
+ boolean bCatalogAtStart2 = xDBMetaData.isCatalogAtStart();
+ sCatalogSep = xDBMetaData.getCatalogSeparator();
+ sIdentifierQuote = xDBMetaData.getIdentifierQuoteString();
+ bCommandComposerAttributesalreadyRetrieved = true;
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+
+ /**
+ * @return Returns the bCatalogAtStart.
+ */
+ public boolean isCatalogAtStart()
+ {
+ if (!bCommandComposerAttributesalreadyRetrieved)
+ {
+ setCommandComposingAttributes();
+ }
+ return bCatalogAtStart;
+ }
+
+ /**
+ * @return Returns the sCatalogSep.
+ */
+ public String getCatalogSeparator()
+ {
+ if (!bCommandComposerAttributesalreadyRetrieved)
+ {
+ setCommandComposingAttributes();
+ }
+ return sCatalogSep;
+ }
+
+ /**
+ * @return Returns the sIdentifierQuote.
+ */
+ public String getIdentifierQuote()
+ {
+ if (!bCommandComposerAttributesalreadyRetrieved)
+ {
+ setCommandComposingAttributes();
+ }
+ return sIdentifierQuote;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/db/CommandName.java b/wizards/com/sun/star/wizards/db/CommandName.java
new file mode 100644
index 000000000000..aa8a4f9c7ea9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/CommandName.java
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.uno.Exception;
+import com.sun.star.wizards.common.JavaTools;
+
+public class CommandName
+{
+
+ protected CommandMetaData oCommandMetaData;
+ protected String CatalogName = "";
+ protected String SchemaName = "";
+ protected String TableName = "";
+ protected String DisplayName = "";
+ protected String ComposedName = "";
+ protected String AliasName = "";
+ protected boolean bCatalogAtStart;
+ protected String sCatalogSep;
+ protected String sIdentifierQuote;
+ protected boolean baddQuotation = true;
+
+ 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;
+ }
+ }
+ if ((_SchemaName != null) && (oCommandMetaData.xDBMetaData.supportsSchemasInTableDefinitions()))
+ {
+ if (!_SchemaName.equals(""))
+ {
+ SchemaName = _SchemaName;
+ }
+ }
+ if (_TableName != null)
+ {
+ if (!_TableName.equals(""))
+ {
+ TableName = _TableName;
+ }
+ }
+ 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);
+ }
+ }
+ }
+ 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);
+ }
+ }
+
+ public void setComposedCommandName()
+ {
+ if (this.setMetaDataAttributes())
+ {
+ if (CatalogName != null)
+ {
+ if (!CatalogName.equals(""))
+ {
+ if (bCatalogAtStart == true)
+ {
+ ComposedName = quoteName(CatalogName) + sCatalogSep;
+ }
+ }
+ }
+ if (SchemaName != null)
+ {
+ if (!SchemaName.equals(""))
+ {
+ ComposedName += quoteName(SchemaName) + ".";
+ }
+ }
+ if (ComposedName.equals(""))
+ {
+ ComposedName = quoteName(TableName);
+ }
+ else
+ {
+ ComposedName += quoteName(TableName);
+ }
+ 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;
+ }
+ }
+
+ public String quoteName(String _sName)
+ {
+ if (baddQuotation)
+ {
+ return quoteName(_sName, this.oCommandMetaData.getIdentifierQuote());
+ }
+ else
+ {
+ return _sName;
+ }
+ }
+
+ 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)
+ {
+ AliasName = _AliasName;
+ }
+
+ public String getAliasName()
+ {
+ return AliasName;
+ }
+
+ /**
+ * @return Returns the catalogName.
+ */
+ public String getCatalogName()
+ {
+ return CatalogName;
+ }
+
+ /**
+ * @return Returns the composedName.
+ */
+ public String getComposedName()
+ {
+ return ComposedName;
+ }
+
+ /**
+ * @return Returns the displayName.
+ */
+ public String getDisplayName()
+ {
+ return DisplayName;
+ }
+
+ /**
+ * @return Returns the schemaName.
+ */
+ public String getSchemaName()
+ {
+ return SchemaName;
+ }
+
+ /**
+ * @return Returns the tableName.
+ */
+ public String getTableName()
+ {
+ return TableName;
+ }
+
+ 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
new file mode 100644
index 000000000000..f46c3fd657d4
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/DBMetaData.java
@@ -0,0 +1,1121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.ui.dialogs.XExecutableDialog;
+
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XChild;
+import com.sun.star.container.XHierarchicalNameAccess;
+import com.sun.star.container.XHierarchicalNameContainer;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XComponent;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.sdb.XOfficeDatabaseDocument;
+import com.sun.star.sdb.XDocumentDataSource;
+import com.sun.star.sdb.tools.XConnectionTools;
+import com.sun.star.sdbcx.XColumnsSupplier;
+
+import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.util.XCloseable;
+import com.sun.star.util.XNumberFormatsSupplier;
+
+import com.sun.star.task.XInteractionHandler;
+import com.sun.star.sdb.XFormDocumentsSupplier;
+import com.sun.star.sdb.XQueryDefinitionsSupplier;
+import com.sun.star.sdb.XReportDocumentsSupplier;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XDatabaseMetaData;
+import com.sun.star.sdbc.XDataSource;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.sdb.XCompletedConnection;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.sdb.XQueriesSupplier;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbcx.XTablesSupplier;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NamedValueCollection;
+import com.sun.star.wizards.common.NumberFormatter;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.uno.Any;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class DBMetaData
+{
+
+ private XNameAccess xQueryNames;
+ public XDatabaseMetaData xDBMetaData;
+ private XDataSource m_dataSource;
+ private XPropertySet m_dataSourceSettings;
+ private XOfficeDatabaseDocument xModel;
+ private XPropertySet xDataSourcePropertySet;
+ public String[] DataSourceNames;
+ public String[] CommandNames;
+ public java.util.Vector CommandObjects = new Vector(1);
+ public Locale aLocale;
+ public int[] CommandTypes;
+ public String DataSourceName;
+ public com.sun.star.sdbc.XConnection DBConnection;
+ public com.sun.star.sdb.tools.XConnectionTools ConnectionTools;
+ public com.sun.star.lang.XMultiServiceFactory xMSF;
+ public XComponent xConnectionComponent;
+
+ private XNameAccess m_xTableNames;
+ private XInteractionHandler oInteractionHandler;
+ private XNameAccess xNameAccess;
+ private XInterface xDatabaseContext;
+ private XCompletedConnection xCompleted;
+ // private int[] nDataTypes = null;
+ private XWindowPeer xWindowPeer;
+ private String[] TableNames = new String[] {};
+ private String[] QueryNames = new String[] {};
+
+ protected int[][] WidthList;
+ protected static final int[] NumericTypes = {
+ DataType.TINYINT, // == -6;
+ DataType.BIGINT, // == -5
+ DataType.NUMERIC, // == - 2
+ DataType.DECIMAL, // == 3;
+ DataType.INTEGER, // == 4;
+ DataType.SMALLINT, // == 5;
+ DataType.FLOAT, // == 6;
+ DataType.REAL, // == 7;
+ DataType.DOUBLE, // == 8;
+ };
+ protected static final int[] BinaryTypes = { //new int[12];
+ DataType.BINARY,
+ DataType.VARBINARY,
+ DataType.LONGVARBINARY,
+ DataType.BLOB,
+ DataType.SQLNULL,
+ DataType.OBJECT,
+ DataType.DISTINCT,
+ DataType.STRUCT,
+ DataType.ARRAY,
+ DataType.CLOB,
+ DataType.REF
+ /* DataType.OTHER, */
+ };
+
+ private int iMaxColumnsInSelect;
+ private int iMaxColumnsInGroupBy;
+ private int iMaxColumnsInTable;
+ private int iMaxColumnNameLength = -1;
+ private int iMaxTableNameLength = -1;
+ private boolean bPasswordIsRequired;
+ private final static int NOLIMIT = 9999999;
+ protected final static int RID_DB_COMMON = 1000;
+ private final static int INVALID = 9999999;
+ public TypeInspector oTypeInspector;
+ private NumberFormatter oNumberFormatter = null;
+ private long lDateCorrection = INVALID;
+ private boolean bdisposeConnection = false;
+
+ public XPropertySet getDataSourcePropertySet()
+ {
+ return xDataSourcePropertySet;
+ }
+
+ public DBMetaData(XMultiServiceFactory xMSF)
+ {
+ getInterfaces(xMSF);
+ InitializeWidthList();
+ }
+
+ public DBMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter _oNumberFormatter)
+ {
+ oNumberFormatter = _oNumberFormatter;
+ aLocale = _aLocale;
+ getInterfaces(xMSF);
+ InitializeWidthList();
+ }
+
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ return oNumberFormatter;
+ }
+
+ public long getNullDateCorrection()
+ {
+ if (lDateCorrection == INVALID)
+ {
+ if (oNumberFormatter == null)
+ {
+ oNumberFormatter = getNumberFormatter();
+ }
+ lDateCorrection = oNumberFormatter.getNullDateCorrection();
+ }
+ return lDateCorrection;
+ }
+
+ void getInterfaces(XMultiServiceFactory xMSF)
+ {
+ try
+ {
+ this.xMSF = xMSF;
+ xDatabaseContext = (XInterface) xMSF.createInstance("com.sun.star.sdb.DatabaseContext");
+ xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xDatabaseContext );
+ XInterface xInteractionHandler = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler");
+ oInteractionHandler = UnoRuntime.queryInterface( XInteractionHandler.class, xInteractionHandler );
+ DataSourceNames = xNameAccess.getElementNames();
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void setCommandTypes()
+ {
+ int TableCount;
+ int QueryCount;
+ int CommandCount;
+ int i;
+ int a;
+ TableCount = JavaTools.getArraylength(TableNames);
+ QueryCount = JavaTools.getArraylength(QueryNames);
+ CommandCount = TableCount + QueryCount;
+ CommandTypes = new int[CommandCount];
+ 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++)
+ {
+ CommandTypes[a] = com.sun.star.sdb.CommandType.QUERY;
+ a += 1;
+ }
+ }
+ }
+
+ public boolean hasTableByName(String _stablename)
+ {
+ // getTableNames();
+ return getTableNamesAsNameAccess().hasByName(_stablename);
+ }
+
+ @SuppressWarnings("unchecked")
+ 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)
+ {
+ return getCommandByName(_tablename, com.sun.star.sdb.CommandType.TABLE);
+ }
+
+ public CommandObject getQueryByName(String _queryname)
+ {
+ return getCommandByName(_queryname, com.sun.star.sdb.CommandType.QUERY);
+ }
+
+ public CommandObject getCommandByName(String _commandname, int _commandtype)
+ {
+ CommandObject oCommand = null;
+ 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)
+ {
+ oCommand = new CommandObject(_commandname, _commandtype);
+ CommandObjects.addElement(oCommand);
+ }
+ return oCommand;
+ }
+
+ public void setQueryByName(String _QueryName)
+ {
+ CommandObject oQueryObject = new CommandObject(_QueryName, com.sun.star.sdb.CommandType.QUERY);
+ this.CommandObjects.addElement(oQueryObject);
+ }
+
+ public class CommandObject
+ {
+
+ private XNameAccess xColumns;
+ private XPropertySet xPropertySet;
+ private String Name;
+ private int CommandType;
+
+ public CommandObject(String _CommandName, int _CommandType)
+ {
+ try
+ {
+ Object oCommand;
+ this.Name = _CommandName;
+ this.CommandType = _CommandType;
+ // if (getTableNamesAsNameAccess() == null)
+ // {
+ // initCommandNames();
+ // }
+ if (CommandType == com.sun.star.sdb.CommandType.TABLE)
+ {
+ oCommand = getTableNamesAsNameAccess().getByName(Name);
+ }
+ else
+ {
+ oCommand = getQueryNamesAsNameAccess().getByName(Name);
+ }
+ XColumnsSupplier xCommandCols = UnoRuntime.queryInterface( XColumnsSupplier.class, oCommand );
+ xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oCommand );
+// TODO: Performance leak getColumns() take very long.
+ xColumns = UnoRuntime.queryInterface( XNameAccess.class, xCommandCols.getColumns() );
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+ public XNameAccess getColumns()
+ {
+ return xColumns;
+ }
+ public String getName()
+ {
+ return Name;
+ }
+ public XPropertySet getPropertySet()
+ {
+ return xPropertySet;
+ }
+ }
+
+ 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;
+ }
+
+ // public void initCommandNames()
+ // {
+ // getTableNames();
+ // }
+
+ public XNameAccess getQueryNamesAsNameAccess()
+ {
+ XQueriesSupplier xDBQueries = UnoRuntime.queryInterface( XQueriesSupplier.class, DBConnection );
+ xQueryNames = xDBQueries.getQueries();
+ return xQueryNames;
+ }
+
+ public XNameAccess getTableNamesAsNameAccess()
+ {
+ XTablesSupplier xDBTables = UnoRuntime.queryInterface( XTablesSupplier.class, DBConnection );
+ XNameAccess xTableNames = xDBTables.getTables();
+ return xTableNames;
+ }
+
+ public String[] getQueryNames()
+ {
+ if (QueryNames != null)
+ {
+ if (QueryNames.length > 0)
+ {
+ return QueryNames;
+ }
+ }
+ QueryNames = getQueryNamesAsNameAccess().getElementNames();
+ return QueryNames;
+ }
+
+ public String[] getTableNames()
+ {
+ if (TableNames != null)
+ {
+ if (TableNames.length > 0)
+ {
+ return TableNames;
+ }
+ }
+ TableNames = getTableNamesAsNameAccess().getElementNames();
+ return TableNames;
+ }
+
+ void InitializeWidthList()
+ {
+ WidthList = new int[17][2];
+ WidthList[0][0] = DataType.BIT; // == -7;
+ WidthList[1][0] = DataType.BOOLEAN; // = 16
+ WidthList[2][0] = DataType.TINYINT; // == -6;
+ WidthList[3][0] = DataType.BIGINT; // == -5;
+ WidthList[4][0] = DataType.LONGVARCHAR; // == -1;
+ WidthList[5][0] = DataType.CHAR; // == 1;
+ WidthList[6][0] = DataType.NUMERIC; // == 2;
+ WidthList[7][0] = DataType.DECIMAL; // == 3; [mit Nachkommastellen]
+ WidthList[8][0] = DataType.INTEGER; // == 4;
+ WidthList[9][0] = DataType.SMALLINT; // == 5;
+ WidthList[10][0] = DataType.FLOAT; // == 6;
+ WidthList[11][0] = DataType.REAL; // == 7;
+ WidthList[12][0] = DataType.DOUBLE; // == 8;
+ WidthList[13][0] = DataType.VARCHAR; // == 12;
+ WidthList[14][0] = DataType.DATE; // == 91;
+ WidthList[15][0] = DataType.TIME; // == 92;
+ WidthList[16][0] = DataType.TIMESTAMP; // == 93;
+ // NumericTypes are all types where aggregate functions can be performed on.
+ // Similarly to a major competitor date/time/timmestamp fields are not included
+
+
+ }
+
+ 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 DBMetaData.NOLIMIT;
+ }
+ else
+ {
+ return itablecount;
+ }
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ return - 1;
+ }
+ }
+
+ public int getMaxColumnsInSelect()
+ {
+ return iMaxColumnsInSelect;
+ }
+
+ public int getMaxColumnsInGroupBy()
+ {
+ return iMaxColumnsInGroupBy;
+ }
+
+ private void setMaxColumnsInSelect() throws SQLException
+ {
+ iMaxColumnsInSelect = xDBMetaData.getMaxColumnsInSelect();
+ if (iMaxColumnsInSelect == 0)
+ {
+ iMaxColumnsInSelect = DBMetaData.NOLIMIT;
+ }
+ }
+
+ private void setMaxColumnsInGroupBy() throws SQLException
+ {
+ iMaxColumnsInGroupBy = xDBMetaData.getMaxColumnsInGroupBy();
+ if (iMaxColumnsInGroupBy == 0)
+ {
+ iMaxColumnsInGroupBy = DBMetaData.NOLIMIT;
+ }
+ }
+
+ public int getMaxColumnsInTable() throws SQLException
+ {
+ iMaxColumnsInTable = xDBMetaData.getMaxColumnsInTable();
+ if (iMaxColumnsInTable == 0)
+ {
+ iMaxColumnsInTable = DBMetaData.NOLIMIT;
+ }
+ return iMaxColumnsInTable;
+ }
+
+ private void getDataSourceObjects() throws Exception
+ {
+ try
+ {
+ xDBMetaData = DBConnection.getMetaData();
+ getDataSourceInterfaces();
+ setMaxColumnsInGroupBy();
+ setMaxColumnsInSelect();
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ private void ensureDataSourceSettings() throws UnknownPropertyException, WrappedTargetException
+ {
+ if ( m_dataSourceSettings != null )
+ return;
+
+ XPropertySet dataSourceProperties = UnoRuntime.queryInterface( XPropertySet.class, getDataSource() );
+ m_dataSourceSettings = UnoRuntime.queryInterface( XPropertySet.class, dataSourceProperties.getPropertyValue( "Settings" ) );
+ }
+
+ public boolean isSQL92CheckEnabled()
+ {
+ boolean isSQL92CheckEnabled = false;
+ try
+ {
+ ensureDataSourceSettings();
+ isSQL92CheckEnabled = AnyConverter.toBoolean( m_dataSourceSettings.getPropertyValue( "EnableSQL92Check" ) );
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return isSQL92CheckEnabled;
+ }
+
+ public String verifyName(String _sname, int _maxlen)
+ {
+ if (_sname.length() > _maxlen)
+ {
+ return _sname.substring(0, _maxlen);
+ }
+ if (this.isSQL92CheckEnabled())
+ {
+ return Desktop.removeSpecialCharacters(xMSF, Configuration.getOfficeLocale(xMSF), _sname);
+ }
+ return _sname;
+ }
+
+ public XDataSource getDataSource()
+ {
+ if (m_dataSource == null)
+ {
+ try
+ {
+ Object oDataSource = xNameAccess.getByName(DataSourceName);
+ m_dataSource = UnoRuntime.queryInterface( XDataSource.class, oDataSource );
+ }
+ catch (com.sun.star.container.NoSuchElementException e)
+ {
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ }
+ }
+ return m_dataSource;
+ }
+
+ private void setDataSourceByName(String _DataSourceName, boolean bgetInterfaces)
+ {
+ try
+ {
+ this.DataSourceName = _DataSourceName;
+ getDataSourceInterfaces();
+ XDocumentDataSource xDocu = UnoRuntime.queryInterface( XDocumentDataSource.class, getDataSource() );
+ if (xDocu != null)
+ {
+ xModel = xDocu.getDatabaseDocument();
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void getDataSourceInterfaces() throws Exception
+ {
+ xCompleted = UnoRuntime.queryInterface( XCompletedConnection.class, getDataSource() );
+ xDataSourcePropertySet = UnoRuntime.queryInterface( XPropertySet.class, getDataSource() );
+ bPasswordIsRequired = ((Boolean) xDataSourcePropertySet.getPropertyValue("IsPasswordRequired")).booleanValue();
+ }
+
+ public boolean getConnection(PropertyValue[] curproperties)
+ {
+ try
+ {
+ XConnection xConnection = null;
+ if (Properties.hasPropertyValue(curproperties, "ActiveConnection"))
+ {
+ xConnection = UnoRuntime.queryInterface( XConnection.class, Properties.getPropertyValue( curproperties, "ActiveConnection" ) );
+ if (xConnection != null)
+ {
+ com.sun.star.container.XChild child = UnoRuntime.queryInterface( com.sun.star.container.XChild.class, xConnection );
+
+ m_dataSource = UnoRuntime.queryInterface( XDataSource.class, child.getParent() );
+ XDocumentDataSource xDocu = UnoRuntime.queryInterface( XDocumentDataSource.class, m_dataSource );
+ if (xDocu != null)
+ {
+ xModel = xDocu.getDatabaseDocument();
+ }
+ XPropertySet xPSet = UnoRuntime.queryInterface( XPropertySet.class, m_dataSource );
+ 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"))
+ {
+ m_dataSource = UnoRuntime.queryInterface( XDataSource.class, Properties.getPropertyValue( curproperties, "DataSource" ) );
+ XDocumentDataSource xDocu = UnoRuntime.queryInterface( XDocumentDataSource.class, this.m_dataSource );
+ if (xDocu != null)
+ {
+ xModel = xDocu.getDatabaseDocument();
+ }
+ return getConnection(m_dataSource);
+ }
+ 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);
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (UnknownPropertyException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (WrappedTargetException e)
+ {
+ e.printStackTrace(System.out);
+ }
+
+ return false;
+ }
+
+ private boolean getConnection(String _DataSourceName)
+ {
+ setDataSourceByName(_DataSourceName, true);
+ return getConnection( getDataSource() );
+ }
+
+ private boolean getConnection(com.sun.star.sdbc.XConnection _DBConnection)
+ {
+ try
+ {
+ this.DBConnection = _DBConnection;
+ this.ConnectionTools = UnoRuntime.queryInterface( XConnectionTools.class, this.DBConnection );
+ getDataSourceObjects();
+ return true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ private boolean getConnection(XDataSource _dataSource)
+ {
+ Resource oResource = new Resource(xMSF, "Database", "dbw");
+ try
+ {
+ int iMsg = 0;
+ boolean bgetConnection = false;
+ if (DBConnection != null)
+ {
+ xConnectionComponent.dispose();
+ }
+ getDataSourceInterfaces();
+ if (bPasswordIsRequired == false)
+ {
+ DBConnection = _dataSource.getConnection("", "");
+ bgetConnection = true;
+ }
+ else
+ {
+ XInteractionHandler xInteractionHandler = UnoRuntime.queryInterface( XInteractionHandler.class, xMSF.createInstance("com.sun.star.task.InteractionHandler") );
+ boolean bExitLoop = true;
+ do
+ {
+ XCompletedConnection xCompleted2 = UnoRuntime.queryInterface( XCompletedConnection.class, _dataSource );
+ try
+ {
+ DBConnection = xCompleted2.connectWithCompletion( xInteractionHandler );
+ 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);
+ }
+ if (bgetConnection == false)
+ {
+ String sMsgConnectionImpossible = oResource.getResText(RID_DB_COMMON + 35);
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgConnectionImpossible);
+ }
+ else
+ {
+ xConnectionComponent = UnoRuntime.queryInterface( XComponent.class, DBConnection );
+ ConnectionTools = UnoRuntime.queryInterface( XConnectionTools.class, DBConnection );
+ getDataSourceObjects();
+ }
+ 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 supportsPrimaryKeys()
+ {
+ boolean supportsPrimaryKeys = false;
+ try
+ {
+ ensureDataSourceSettings();
+ Any primaryKeySupport = (Any)m_dataSourceSettings.getPropertyValue( "PrimaryKeySupport" );
+ if ( AnyConverter.isVoid( primaryKeySupport ) )
+ supportsPrimaryKeys = supportsCoreSQLGrammar();
+ else
+ supportsPrimaryKeys = AnyConverter.toBoolean( primaryKeySupport );
+ }
+ catch ( Exception ex )
+ {
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, ex );
+ }
+ return supportsPrimaryKeys;
+ }
+
+ 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
+ {
+ XQueryDefinitionsSupplier xQueryDefinitionsSuppl = UnoRuntime.queryInterface( XQueryDefinitionsSupplier.class, m_dataSource );
+ XNameAccess xQueryDefs = xQueryDefinitionsSuppl.getQueryDefinitions();
+ XSingleServiceFactory xSSFQueryDefs = UnoRuntime.queryInterface( XSingleServiceFactory.class, xQueryDefs );
+ Object oQuery = xSSFQueryDefs.createInstance(); //"com.sun.star.sdb.QueryDefinition"
+ XPropertySet xPSet = UnoRuntime.queryInterface( XPropertySet.class, oQuery );
+
+ String s = _oSQLQueryComposer.m_xQueryAnalyzer.getQuery();
+ xPSet.setPropertyValue("Command", s);
+
+ XNameContainer xNameCont = UnoRuntime.queryInterface( XNameContainer.class, xQueryDefs );
+ ConnectionTools.getObjectNames().checkNameForCreate(com.sun.star.sdb.CommandType.QUERY, _QueryName);
+ xNameCont.insertByName(_QueryName, oQuery);
+ return true;
+ }
+ catch (WrappedTargetException exception)
+ {
+ SQLException sqlError = null;
+ try
+ {
+ sqlError = (SQLException) exception.TargetException;
+ }
+ catch (ClassCastException castError)
+ {
+ }
+
+ if (sqlError != null)
+ {
+ callSQLErrorMessageDialog(sqlError, null);
+ return false;
+ }
+ exception.printStackTrace(System.out);
+ }
+ catch (SQLException exception)
+ {
+ callSQLErrorMessageDialog(exception, null);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return false;
+ }
+
+ public void dispose()
+ {
+ if ((DBConnection != null) && (this.bdisposeConnection))
+ {
+ xConnectionComponent.dispose();
+ }
+ }
+
+ public XHierarchicalNameAccess getReportDocuments()
+ {
+ XReportDocumentsSupplier xReportDocumentSuppl = UnoRuntime.queryInterface( XReportDocumentsSupplier.class, this.xModel );
+ xReportDocumentSuppl.getReportDocuments();
+ XHierarchicalNameAccess xReportHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments() );
+ return xReportHier;
+ }
+
+ public XHierarchicalNameAccess getFormDocuments()
+ {
+ XFormDocumentsSupplier xFormDocumentSuppl = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, xModel );
+ XHierarchicalNameAccess xFormHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments() );
+ return xFormHier;
+ }
+
+ public boolean hasFormDocumentByName(String _sFormName)
+ {
+ XFormDocumentsSupplier xFormDocumentSuppl = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, xModel );
+ XNameAccess xFormNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xFormDocumentSuppl.getFormDocuments() );
+ return xFormNameAccess.hasByName(_sFormName);
+ }
+
+ public void addFormDocument(XComponent _xComponent)
+ {
+ XHierarchicalNameAccess _xFormDocNameAccess = getFormDocuments();
+ addDatabaseDocument(_xComponent, _xFormDocNameAccess, false);
+ }
+
+ public void addReportDocument(XComponent _xComponent, boolean _bcreatedynamicreport)
+ {
+ XHierarchicalNameAccess xReportDocNameAccess = getReportDocuments();
+ addDatabaseDocument(_xComponent, xReportDocNameAccess, _bcreatedynamicreport);
+ }
+
+ /**
+ * 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 _xDocNameAccess
+ * @param _bcreateTemplate describes the type of the document: "form" or "report"
+ */
+ public void addDatabaseDocument(XComponent _xComponent, XHierarchicalNameAccess _xDocNameAccess, boolean i_createTemplate)
+ {
+ try
+ {
+ XModel xDocumentModel = UnoRuntime.queryInterface( XModel.class, _xComponent );
+ String documentURL = xDocumentModel.getURL();
+ String basename = FileAccess.getBasename(documentURL, "/");
+ XCloseable xCloseable = UnoRuntime.queryInterface( XCloseable.class, _xComponent );
+ xCloseable.close(false);
+
+ NamedValueCollection creationArgs = new NamedValueCollection();
+ creationArgs.put( "Name", basename );
+ creationArgs.put( "URL", documentURL );
+ creationArgs.put( "AsTemplate", new Boolean( i_createTemplate ) );
+ XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, _xDocNameAccess );
+ Object oDBDocument = xDocMSF.createInstanceWithArguments( "com.sun.star.sdb.DocumentDefinition", creationArgs.getPropertyValues() );
+ XHierarchicalNameContainer xHier = 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 = UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface );
+ xSimpleFileAccess.kill(documentURL);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void createTypeInspector() throws SQLException
+ {
+ oTypeInspector = new TypeInspector(xDBMetaData.getTypeInfo());
+ }
+
+ public TypeInspector getDBDataTypeInspector()
+ {
+ return oTypeInspector;
+ }
+
+ private String[] StringsFromResultSet(XResultSet _xResultSet, int _icol)
+ {
+ String[] sColValues = null;
+ try
+ {
+ XRow xRow = UnoRuntime.queryInterface( XRow.class, _xResultSet );
+ Vector aColVector = new Vector();
+ while (_xResultSet.next())
+ {
+ aColVector.addElement(xRow.getString(_icol));
+ }
+ sColValues = new String[aColVector.size()];
+ aColVector.toArray(sColValues);
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace();
+ }
+ return sColValues;
+ }
+
+ public String[] getCatalogNames()
+ {
+ try
+ {
+ XResultSet xResultSet = xDBMetaData.getCatalogs();
+ return StringsFromResultSet(xResultSet, 1);
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ public String[] getSchemaNames()
+ {
+ try
+ {
+ XResultSet xResultSet = xDBMetaData.getSchemas();
+ return StringsFromResultSet(xResultSet, 1);
+ }
+ 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 = UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface );
+ String storepath = FileAccess.getOfficePath(xMSF, "Temp", xSimpleFileAccess) + "/" + _storename;
+ XStorable xStoreable = 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)
+ {
+ 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()
+ {
+ 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)
+ {
+ xWindowPeer = windowPeer;
+ }
+
+ public void callSQLErrorMessageDialog(SQLException oSQLException, XWindow _xWindow)
+ {
+ try
+ {
+ Object oDialog = xMSF.createInstance("com.sun.star.sdb.ErrorMessageDialog");
+ XInitialization xInitialization = UnoRuntime.queryInterface( XInitialization.class, oDialog );
+ PropertyValue[] aPropertyValue = new PropertyValue[2];
+ aPropertyValue[0] = Properties.createProperty("SQLException", oSQLException);
+ aPropertyValue[1] = Properties.createProperty("ParentWindow", _xWindow);
+ xInitialization.initialize(aPropertyValue);
+ XExecutableDialog xExecutableDialog = UnoRuntime.queryInterface( XExecutableDialog.class, oDialog );
+ xExecutableDialog.execute();
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public void finish()
+ {
+ xQueryNames = null;
+ oInteractionHandler = null;
+ xNameAccess = null;
+ xDatabaseContext = null;
+ xDBMetaData = null;
+ m_dataSource = null;
+ xModel = null;
+ xCompleted = null;
+ xDataSourcePropertySet = null;
+ xWindowPeer = null;
+ DBConnection = null;
+ ConnectionTools = null;
+ xMSF = null;
+ xConnectionComponent = null;
+ CommandObjects = null;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java
new file mode 100644
index 000000000000..5c65d73794f0
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/DatabaseObjectWizard.java
@@ -0,0 +1,75 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package com.sun.star.wizards.db;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XFrame;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.NamedValueCollection;
+import com.sun.star.wizards.ui.WizardDialog;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * is a base class for a wizard creating a database object
+ * @author frank.schoenheit@sun.com
+ */
+public abstract class DatabaseObjectWizard extends WizardDialog
+{
+ protected final PropertyValue[] m_wizardContext;
+ protected final XDatabaseDocumentUI m_docUI;
+ protected final XFrame m_frame;
+
+ protected DatabaseObjectWizard( final XMultiServiceFactory i_orb, final int i_helpIDBase, final PropertyValue[] i_wizardContext )
+ {
+ super( i_orb, i_helpIDBase );
+ m_wizardContext = i_wizardContext;
+
+ final NamedValueCollection wizardContext = new NamedValueCollection( m_wizardContext );
+ m_docUI = wizardContext.queryOrDefault( "DocumentUI", (XDatabaseDocumentUI)null, XDatabaseDocumentUI.class );
+
+ if ( m_docUI != null )
+ {
+ XController docController = UnoRuntime.queryInterface( XController.class, m_docUI );
+ m_frame = docController.getFrame();
+ }
+ else
+ {
+ XFrame parentFrame = wizardContext.queryOrDefault( "ParentFrame", (XFrame)null, XFrame.class );
+ if ( parentFrame != null )
+ m_frame = parentFrame;
+ else
+ m_frame = Desktop.getActiveFrame( xMSF );
+ }
+ }
+
+ protected final void loadSubComponent( final int i_type, final String i_name, final boolean i_forEditing )
+ {
+ try
+ {
+ m_docUI.loadComponent( i_type, i_name, i_forEditing );
+ }
+ catch ( IllegalArgumentException ex )
+ {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, null, ex );
+ }
+ catch ( NoSuchElementException ex )
+ {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, null, ex );
+ }
+ catch ( SQLException ex )
+ {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, null, ex );
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java
new file mode 100644
index 000000000000..041aab5f5300
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/FieldColumn.java
@@ -0,0 +1,471 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+// 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
+{
+ protected int ColIndex;
+
+ private Object DefaultValue;
+ private String m_sFieldName;
+ private String m_sDisplayFieldName;
+ private String FieldTitle;
+ private String m_sCommandName;
+ private int m_nDBFormatKey;
+ private int m_nFieldType;
+ private XPropertySet m_xColPropertySet;
+
+ // field meta data
+ private int FieldWidth;
+ private int StandardFormatKey;
+ private boolean bIsNumberFormat;
+
+ private static boolean bFormatKeysInitialized = false;
+ private static int iDateFormatKey;
+ private static int iDateTimeFormatKey;
+ private static int iNumberFormatKey;
+ private static int iTextFormatKey;
+ private static int iTimeFormatKey;
+ private static int iLogicalFormatKey;
+
+ private CommandMetaData m_aCommandMetaData;
+
+ 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);
+ initializeFormatKeys(oCommandMetaData, oTable.getColumns());
+ }
+
+ public FieldColumn(CommandMetaData oCommandMetaData, String _FieldName, String _CommandName, boolean _bInstantiateByDisplayName)
+ {
+ m_sCommandName = _CommandName;
+ if (_bInstantiateByDisplayName)
+ {
+ m_sDisplayFieldName = _FieldName;
+ m_sFieldName = getOnlyFieldName(_FieldName, _CommandName);
+ }
+ else
+ {
+ m_sFieldName = _FieldName;
+ m_sDisplayFieldName = composeDisplayFieldName(_CommandName, m_sFieldName);
+ }
+ FieldTitle = m_sFieldName;
+ m_aCommandMetaData = oCommandMetaData;
+ }
+
+ 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;
+ initializeFormatKeys(oCommandMetaData, _xColumns);
+ }
+
+ public int getFieldType()
+ {
+ if (m_nFieldType == 0)
+ {
+ DBMetaData.CommandObject oTable = m_aCommandMetaData.getTableByName(m_sCommandName);
+ initializeFormatKeys(m_aCommandMetaData, oTable.getColumns());
+ }
+ return m_nFieldType;
+ }
+
+ public int getFieldWidth()
+ {
+ getFieldType(); // will collect meta data 'bout the column, if not already done so
+ return FieldWidth;
+ }
+
+ public int getDBFormatKey()
+ {
+ getFieldType(); // will collect meta data 'bout the column, if not already done so
+ return m_nDBFormatKey;
+ }
+
+ public int getStandardFormatKey()
+ {
+ getFieldType(); // will collect meta data 'bout the column, if not already done so
+ return StandardFormatKey;
+ }
+ public boolean isNumberFormat()
+ {
+ getFieldType(); // will collect meta data 'bout the column, if not already done so
+ return bIsNumberFormat;
+ }
+
+ /**
+ * 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 _sCommandName, String _sFieldName)
+ {
+ return _sCommandName + "." + _sFieldName;
+ }
+
+ private void initializeFormatKeys(CommandMetaData oCommandMetaData, XNameAccess _xColumns)
+ {
+ try
+ {
+ m_xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(m_sFieldName));
+ ColIndex = JavaTools.FieldInList(_xColumns.getElementNames(), m_sFieldName) + 1;
+ m_nFieldType = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Type"));
+ getTyperelatedFieldData();
+
+ if (bFormatKeysInitialized == false)
+ {
+ final NumberFormatter aNumberFormatter = oCommandMetaData.getNumberFormatter();
+
+ iDateFormatKey = aNumberFormatter.getDateFormatKey();
+ iDateTimeFormatKey = aNumberFormatter.getDateTimeFormatKey();
+ iNumberFormatKey = aNumberFormatter.getNumberFormatKey();
+ iTextFormatKey = aNumberFormatter.getTextFormatKey();
+ iTimeFormatKey = aNumberFormatter.getTimeFormatKey();
+ iLogicalFormatKey = aNumberFormatter.getLogicalFormatKey();
+ bFormatKeysInitialized = true;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public XPropertySet getXColumnPropertySet()
+ {
+ getFieldType(); // will collect meta data 'bout the column, if not already done so
+ return m_xColPropertySet;
+ }
+
+ public void setCommandName(String _CommandName)
+ {
+ m_sCommandName = _CommandName;
+ }
+
+ public String getDisplayFieldName()
+ {
+ return m_sDisplayFieldName;
+ }
+
+ public String getCommandName()
+ {
+ return m_sCommandName;
+ }
+
+ public String getFieldName()
+ {
+ return m_sFieldName;
+ }
+
+ public String getFieldTitle()
+ {
+ return FieldTitle;
+ }
+
+ public void setFieldTitle(String _sTitle)
+ {
+ FieldTitle = _sTitle;
+ }
+
+ public static String getCommandName(String _DisplayName)
+ {
+ String locCommandName = null;
+ String[] sFieldMetaData = JavaTools.ArrayoutofString(_DisplayName, ".");
+ if (sFieldMetaData.length >= 2)
+ {
+ String locfieldname = sFieldMetaData[sFieldMetaData.length - 1];
+ locCommandName = _DisplayName.substring(0, _DisplayName.length() - locfieldname.length() - 1);
+ }
+ return locCommandName;
+ }
+
+ public boolean isBoolean()
+ {
+ boolean bIsBoolean = false;
+ switch ( getFieldType() )
+ {
+ case DataType.BIT: // == -7;
+ case DataType.BOOLEAN:
+ bIsBoolean = true;
+ break;
+ default:
+ bIsBoolean = false;
+ }
+ return bIsBoolean;
+ }
+
+ private void getTyperelatedFieldData()
+ {
+ try
+ {
+ switch ( getFieldType() )
+ {
+ 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;
+ StandardFormatKey = iNumberFormatKey;
+ FieldWidth = 5;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.SMALLINT: // == 5;
+ StandardFormatKey = iNumberFormatKey;
+ FieldWidth = 5;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.INTEGER: // == 4;
+ StandardFormatKey = iNumberFormatKey;
+ FieldWidth = 10;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.BIGINT: // == -5;
+ StandardFormatKey = iNumberFormatKey;
+ FieldWidth = 15;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.CHAR: // == 1;
+ StandardFormatKey = iTextFormatKey;
+ getTextFieldWidth(10);
+ bIsNumberFormat = false;
+ break;
+
+ case DataType.VARCHAR: // == 12;
+ StandardFormatKey = iTextFormatKey;
+ getTextFieldWidth(30);
+ bIsNumberFormat = false;
+ break;
+
+ case DataType.LONGVARCHAR: // == -1;
+ StandardFormatKey = iTextFormatKey;
+ getTextFieldWidth(60);
+ bIsNumberFormat = false;
+ break;
+
+ case DataType.NUMERIC: // == 2;
+ StandardFormatKey = iNumberFormatKey;
+ FieldWidth = 20;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.DECIMAL: // == 3; [mit Nachkommastellen]
+ StandardFormatKey = iNumberFormatKey;
+ FieldWidth = 10 + AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Scale")) + 1;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.FLOAT: // == 6;
+ StandardFormatKey = iNumberFormatKey;
+ FieldWidth = 10 + AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Scale")) + 1;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.REAL: // == 7;
+ StandardFormatKey = iNumberFormatKey;
+ FieldWidth = 10 + AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Scale")) + 1;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.DOUBLE: // == 8;
+ StandardFormatKey = iNumberFormatKey;
+ FieldWidth = 10 + AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Scale")) + 1;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.DATE: // == 91;
+ StandardFormatKey = iDateFormatKey;
+ FieldWidth = 10;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.TIME: // == 92;
+ StandardFormatKey = iTimeFormatKey;
+ FieldWidth = 10;
+ bIsNumberFormat = true;
+ break;
+
+ case DataType.TIMESTAMP: // == 93;
+ StandardFormatKey = iDateTimeFormatKey;
+ FieldWidth = 20;
+ bIsNumberFormat = true;
+ break;
+ }
+
+ Object oKey = m_xColPropertySet.getPropertyValue("FormatKey");
+ if (AnyConverter.isVoid(oKey))
+ {
+ m_nDBFormatKey = StandardFormatKey;
+ }
+ else
+ {
+ m_nDBFormatKey = AnyConverter.toInt(oKey);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ m_nDBFormatKey = StandardFormatKey;
+ }
+ }
+
+ private void getTextFieldWidth(int iWidth)
+ {
+ try
+ {
+ FieldWidth = AnyConverter.toInt(m_xColPropertySet.getPropertyValue("Precision"));
+ if (FieldWidth > 0)
+ {
+ if (FieldWidth > (2 * iWidth))
+ {
+ FieldWidth = 2 * iWidth;
+ }
+ else if (FieldWidth == 0)
+ {
+ FieldWidth = iWidth;
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void initDefaultValue()
+ {
+ switch (getFieldType())
+ {
+ case DataType.BIT: // == -7;
+ case DataType.BOOLEAN:
+ DefaultValue = (Object) Integer.valueOf("1");
+ break;
+
+ case DataType.TINYINT: // == -6;
+ DefaultValue = (Object) Integer.valueOf("98");
+ break;
+
+ case DataType.SMALLINT: // == 5;
+ DefaultValue = (Object) Integer.valueOf("987");
+ break;
+
+ case DataType.INTEGER: // == 4;
+ DefaultValue = (Object) Integer.valueOf("9876");
+ break;
+
+ case DataType.BIGINT: // == -5;
+ DefaultValue = (Object) Integer.valueOf("98765");
+ break;
+
+ case DataType.CHAR: // == 1;
+ DefaultValue = (Object) String.valueOf('x');
+ break;
+
+ case DataType.VARCHAR: // == 12;
+ DefaultValue = (Object) BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
+ break;
+
+ case DataType.LONGVARCHAR: // == -1;
+ DefaultValue = (Object) BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
+ break;
+
+ case DataType.NUMERIC: // == 2;
+ DefaultValue = (Object) Double.valueOf("9876.5");
+ break;
+
+ case DataType.DECIMAL: // == 3; [mit Nachkommastellen]
+ DefaultValue = (Object) Double.valueOf("9876.5");
+ break;
+
+ case DataType.FLOAT: // == 6;
+ DefaultValue = (Object) Double.valueOf("9876.5");
+ break;
+
+ case DataType.REAL: // == 7;
+ DefaultValue = (Object) Double.valueOf("9876.5");
+ break;
+
+ case DataType.DOUBLE: // == 8;
+ DefaultValue = (Object) Double.valueOf("9876.54");
+ break;
+
+ case DataType.DATE: // == 91;
+ DefaultValue = (Object) Double.valueOf("42510");
+ break;
+
+ case DataType.TIME: // == 92;
+ DefaultValue = (Object) Double.valueOf("10");
+ break;
+
+ case DataType.TIMESTAMP: // == 93;
+ DefaultValue = (Object) Double.valueOf("5454110");
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ public Object getDefaultValue()
+ {
+ if ( DefaultValue == null )
+ initDefaultValue();
+ return DefaultValue;
+ }
+
+}
diff --git a/wizards/com/sun/star/wizards/db/MANIFEST.MF b/wizards/com/sun/star/wizards/db/MANIFEST.MF
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/MANIFEST.MF
diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java
new file mode 100644
index 000000000000..bad14c2faa20
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.beans.PropertyValue;
+
+import java.util.*;
+import com.sun.star.lang.Locale;
+import com.sun.star.wizards.common.*;
+
+public class QueryMetaData extends CommandMetaData
+{
+
+ private SQLQueryComposer oSQLQueryComposer = null;
+ FieldColumn CurFieldColumn;
+ public String Command;
+ // 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
+ {
+
+ final static int SOSUMMARYQUERY = 0;
+ final static int SODETAILQUERY = 1;
+ }
+
+ public QueryMetaData(XMultiServiceFactory xMSF, Locale CharLocale, NumberFormatter oNumberFormatter)
+ {
+ super(xMSF, CharLocale, oNumberFormatter);
+ }
+
+ public QueryMetaData(XMultiServiceFactory _xMSF)
+ {
+ super(_xMSF);
+ }
+
+ public void setFilterConditions(PropertyValue[][] _FilterConditions)
+ {
+ this.m_aFilterConditions = _FilterConditions;
+ }
+
+ public PropertyValue[][] getFilterConditions()
+ {
+ if (m_aFilterConditions == null)
+ {
+ m_aFilterConditions = new PropertyValue[][]
+ {
+ };
+ }
+ return m_aFilterConditions;
+ }
+
+ public void setGroupByFilterConditions(PropertyValue[][] _GroupByFilterConditions)
+ {
+ this.GroupByFilterConditions = _GroupByFilterConditions;
+ }
+
+ public PropertyValue[][] getGroupByFilterConditions()
+ {
+ return this.GroupByFilterConditions;
+ }
+// public void addFieldColumn(String _FieldName, String _sCommandName){
+// FieldColumn oFieldColumn = getFieldColumn(_FieldName, _sCommandName);
+// if (oFieldColumn == null){
+// FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length + 1];
+// System.arraycopy(FieldColumns, 0, LocFieldColumns, 0, FieldColumns.length);
+// LocFieldColumns[FieldColumns.length] = new FieldColumn(this, _FieldName, _sCommandName);
+// FieldColumns = LocFieldColumns;
+// }
+// }
+ public void addSeveralFieldColumns(String[] _FieldNames, String _sCommandName)
+ {
+ Vector oToBeAddedFieldColumns = new Vector();
+ 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 (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++)
+ {
+ LocFieldColumns[nOldFieldCount + i] = (FieldColumn) oToBeAddedFieldColumns.elementAt(i);
+ }
+ FieldColumns = LocFieldColumns;
+ }
+ }
+
+ public void reorderFieldColumns(String[] _sDisplayFieldNames)
+ {
+ FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length];
+ 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)
+ {
+ Vector oRemainingFieldColumns = new Vector();
+ int a = 0;
+ 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[] LocFieldColumns = new FieldColumn[FieldColumns.length - 1];
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ if (!FieldColumns[i].getFieldName().equals(_sFieldName))
+ {
+ if (!FieldColumns[i].getCommandName().equals(_sCommandName))
+ {
+ LocFieldColumns[a] = FieldColumns[i];
+ a++;
+ }
+ }
+ }
+ FieldColumns = LocFieldColumns;
+ }
+ }
+
+ public String[] getIncludedCommandNames()
+ {
+ // FieldColumn CurQueryField;
+ Vector CommandNamesV = new Vector(1);
+ // String CurCommandName;
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ final FieldColumn CurQueryField = FieldColumns[i];
+ final String CurCommandName = CurQueryField.getCommandName();
+ if (!CommandNamesV.contains(CurCommandName))
+ {
+ CommandNamesV.addElement(CurCommandName);
+ }
+ }
+ String[] sIncludedCommandNames = new String[CommandNamesV.size()];
+ CommandNamesV.toArray(sIncludedCommandNames);
+ return sIncludedCommandNames;
+ }
+
+ public static String[] getIncludedCommandNames(String[] _FieldNames)
+ {
+ Vector CommandNames = new Vector(1);
+ for (int i = 0; i < _FieldNames.length; i++)
+ {
+ String CurCommandName = "";
+ String[] MetaList = JavaTools.ArrayoutofString(_FieldNames[i], ".");
+ if (MetaList.length > 1)
+ {
+ for (int a = 0; a < MetaList.length - 1; a++)
+ {
+ CurCommandName += MetaList[a];
+ }
+ if (!CommandNames.contains(CurCommandName))
+ {
+ CommandNames.addElement(CurCommandName);
+ }
+ }
+ }
+ String[] sIncludedCommandNames = new String[CommandNames.size()];
+ CommandNames.toArray(sIncludedCommandNames);
+ return sIncludedCommandNames;
+ }
+
+ public String[] getFieldNamesOfCommand(String _sCommandName)
+ {
+ CommandObject oTable = getTableByName(_sCommandName);
+ return oTable.getColumns().getElementNames();
+ }
+
+ public void initializeFieldTitleSet(boolean _bAppendMode)
+ {
+ try
+ {
+ // this.getIncludedCommandNames(); // fills the var CommandNamesV indirectly :-(
+ if (FieldTitleSet == null)
+ {
+ FieldTitleSet = new HashMap();
+ }
+ String[] aCommandNames = getIncludedCommandNames();
+ for (int i = 0; i < aCommandNames.length; i++)
+ {
+ String sCommandName = aCommandNames[i];
+ CommandObject oTable = getTableByName(sCommandName);
+ String sTableName = oTable.getName();
+ String[] LocFieldNames = oTable.getColumns().getElementNames();
+ for (int a = 0; a < LocFieldNames.length; a++)
+ {
+ String sDisplayFieldName = FieldColumn.composeDisplayFieldName(sTableName, LocFieldNames[a]);
+ if (!FieldTitleSet.containsKey(sDisplayFieldName))
+ {
+ FieldTitleSet.put(sDisplayFieldName, LocFieldNames[a]);
+ }
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public String[] getUniqueAggregateFieldNames()
+ {
+ Vector UniqueAggregateFieldVector = new Vector(0);
+ for (int i = 0; i < AggregateFieldNames.length; i++)
+ {
+ if (!UniqueAggregateFieldVector.contains(AggregateFieldNames[i][0]))
+ {
+ UniqueAggregateFieldVector.add(AggregateFieldNames[i][0]);
+ }
+ }
+ UniqueAggregateFieldNames = new String[UniqueAggregateFieldVector.size()];
+ UniqueAggregateFieldVector.toArray(UniqueAggregateFieldNames);
+ return UniqueAggregateFieldNames;
+ }
+
+ public boolean hasNumericalFields()
+ {
+ for (int i = 0; i < FieldColumns.length; i++)
+ {
+ if (FieldColumns[i].isNumberFormat())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int getAggregateIndex(String _DisplayFieldName)
+ {
+ int iAggregate = -1;
+ if (Type == QueryType.SOSUMMARYQUERY)
+ {
+ iAggregate = JavaTools.FieldInTable(AggregateFieldNames, _DisplayFieldName);
+ }
+ return iAggregate;
+ }
+ public SQLQueryComposer getSQLQueryComposer()
+ {
+ if ( oSQLQueryComposer == null )
+ oSQLQueryComposer = new SQLQueryComposer(this);
+ return oSQLQueryComposer;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/db/RecordParser.java b/wizards/com/sun/star/wizards/db/RecordParser.java
new file mode 100644
index 000000000000..6c8ddb5b2c36
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/RecordParser.java
@@ -0,0 +1,306 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.sdbcx.XColumnsSupplier;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.sdb.XCompletedExecution;
+import com.sun.star.lang.Locale;
+import com.sun.star.wizards.common.InvalidQueryException;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NumberFormatter;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.task.XInteractionHandler;
+
+public class RecordParser extends QueryMetaData
+{
+
+ XNameAccess xColumns;
+ com.sun.star.sdbc.XRow xRow;
+ com.sun.star.sdbc.XRow xResultSetRow;
+ public XResultSet ResultSet;
+ XInterface xRowSet;
+ XCompletedExecution xExecute;
+ XColumnsSupplier xRowSetColumnsSupplier;
+ XComponent xRowSetComponent;
+ XInteractionHandler xInteraction;
+ public FieldColumn[] GroupFieldColumns;
+ public FieldColumn[] RecordFieldColumns;
+
+ public RecordParser(XMultiServiceFactory _xMSF, Locale _aLocale, NumberFormatter _oNumberFormatter)
+ {
+ super(_xMSF, _aLocale, _oNumberFormatter);
+ getInterfaces();
+ }
+
+ /** Creates a new instance of RecordParser */
+ public RecordParser(XMultiServiceFactory _xMSF)
+ {
+ super(_xMSF);
+ getInterfaces();
+ }
+
+ 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.task.InteractionHandler");
+ xInteraction = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, oInteraction);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return Any.VOID;
+ }
+
+ public Object getColumnValue(int ColIndex, int iType)
+ {
+ boolean bResult;
+ Object oAny = Any.VOID;
+ switch (iType)
+ {
+ case DataType.BIT: // == -7;
+ case DataType.BOOLEAN:
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.TINYINT: // == -6;
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.BIGINT: // == -5;
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.CHAR: // == 1;
+ oAny = getColumnStringValue(ColIndex);
+ break;
+
+ case DataType.VARCHAR: // == 12;
+ oAny = getColumnStringValue(ColIndex);
+ // double sResult = xResultSetRow.getClob(ColIndex); //???
+ break;
+
+ case DataType.LONGVARCHAR: // == -1;
+ oAny = getColumnStringValue(ColIndex);
+ // double sResult = xResultSetRow.getCharacterStream(ColIndex);
+ break;
+
+ case DataType.NUMERIC: // == 2;
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.INTEGER: // == 4;
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.SMALLINT: // == 5;
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.DECIMAL: // == 3; [mit Nachkommastellen]
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.FLOAT: // == 6;
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.REAL: // == 7;
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.DOUBLE: // == 8;
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.DATE: // == 91;
+ oAny = getColumnDoubleValue(ColIndex, true);
+ break;
+
+ case DataType.TIME: // == 92;
+ oAny = getColumnDoubleValue(ColIndex, false);
+ break;
+
+ case DataType.TIMESTAMP: // == 93;
+ oAny = getColumnDoubleValue(ColIndex, true);
+ break;
+ }
+
+ // Is the index OK; increment?
+ // String sValue = xResultSetRow.getString(ColIndex);
+ 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
+ {
+ 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].getFieldName();
+ 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)
+ {
+ FieldColumn[] LocFieldColumns = new FieldColumn[_FieldNames.length];
+ for (int i = 0; i < _FieldNames.length; i++)
+ {
+ LocFieldColumns[i] = super.getFieldColumnByFieldName(_FieldNames[i]);
+ }
+ return LocFieldColumns;
+ }
+
+ public Object getGroupColumnValue(int ColIndex)
+ {
+ FieldColumn CurDBFieldColumn = this.GroupFieldColumns[ColIndex];
+ return getColumnValue(CurDBFieldColumn.ColIndex, CurDBFieldColumn.getFieldType());
+ }
+
+ 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.getFieldType()); //FinalColIndex
+ }
+ DataVector.addElement(RecordValueArray);
+ return true;
+ }
+
+ 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
new file mode 100644
index 000000000000..acf47581d3e2
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/RelationController.java
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import java.util.Vector;
+
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.JavaTools;
+
+/**
+ * @author bc93774
+ *
+ * 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;
+ 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)
+ {
+ super(_CommandMetaData, _CatalogName, _SchemaName, _TableName, _baddQuotation);
+ }
+
+ 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());
+ }
+ sReferencedTableNames = new String[aReferencedTableVector.size()];
+ aReferencedTableVector.toArray(sReferencedTableNames);
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return sReferencedTableNames;
+ }
+
+ 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(), oLocCommandName.getTableName());
+ 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.supportsSchemasInDataManipulation())
+ {
+ 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 (sPrimarySchema == null || 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]);
+ }
+ 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
new file mode 100644
index 000000000000..0a52f6a3a7a9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
@@ -0,0 +1,433 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import java.util.Vector;
+
+// 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.XIndexAccess;
+// import com.sun.star.container.XNameAccess;
+import com.sun.star.sdbcx.XColumnsSupplier;
+// import com.sun.star.sdb.XColumn;
+import com.sun.star.sdb.XSQLQueryComposerFactory;
+import com.sun.star.sdb.XSingleSelectQueryComposer;
+import com.sun.star.sdb.XSingleSelectQueryAnalyzer;
+import com.sun.star.ui.dialogs.XExecutableDialog;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.awt.XWindow;
+
+import com.sun.star.wizards.common.*;
+
+public class SQLQueryComposer
+{
+
+ public XColumnsSupplier xColSuppl;
+ // XSQLQueryComposer xSQLQueryComposer;
+ QueryMetaData CurDBMetaData;
+ // String m_sSelectClause;
+ // String m_sFromClause;
+ public XSingleSelectQueryAnalyzer m_xQueryAnalyzer;
+ Vector composedCommandNames = new Vector(1);
+ private XSingleSelectQueryComposer m_xQueryComposer;
+ XMultiServiceFactory xMSF;
+ boolean bincludeGrouping = true;
+
+ public SQLQueryComposer(QueryMetaData _CurDBMetaData)
+ {
+ try
+ {
+ this.CurDBMetaData = _CurDBMetaData;
+ xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, CurDBMetaData.DBConnection);
+ 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 */ 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)
+ {
+ if (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, DisplayFieldName) > -1)
+ {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ public String getSelectClause(boolean _baddAliasFieldNames) throws SQLException
+ {
+ String sSelectBaseClause = "SELECT ";
+ String sSelectClause = sSelectBaseClause;
+ for (int i = 0; i < CurDBMetaData.FieldColumns.length; i++)
+ {
+ if (addtoSelectClause(CurDBMetaData.FieldColumns[i].getDisplayFieldName()))
+ {
+ int iAggregate = CurDBMetaData.getAggregateIndex(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
+ if (iAggregate > -1)
+ {
+ sSelectClause += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + getComposedAliasFieldName(CurDBMetaData.AggregateFieldNames[iAggregate][0]) + ")";
+ if (_baddAliasFieldNames)
+ {
+ sSelectClause += getAliasFieldNameClause(CurDBMetaData.AggregateFieldNames[iAggregate][0]);
+ }
+ }
+ else
+ {
+ sSelectClause += getComposedAliasFieldName(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
+ if (_baddAliasFieldNames)
+ {
+ sSelectClause += getAliasFieldNameClause(CurDBMetaData.FieldColumns[i].getDisplayFieldName());
+ }
+ }
+ sSelectClause += ", ";
+ }
+ }
+ // TODO: little bit unhandy version of remove the append 'comma' at the end
+ if (sSelectClause.equals(sSelectBaseClause))
+ {
+ sSelectClause = sSelectClause.substring(0, sSelectClause.length() - 1);
+ }
+ else
+ {
+ sSelectClause = sSelectClause.substring(0, sSelectClause.length() - 2);
+ }
+ return sSelectClause;
+ }
+
+ 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.getFilterConditions().length; i++)
+ {
+ m_xQueryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions());
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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
+ {
+ XPropertySet xColumnPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xColumnIndexAccess.getByIndex(i));
+ String sName = (String) xColumnPropertySet.getPropertyValue("Name");
+ if (JavaTools.FieldInTable(CurDBMetaData.getSortFieldNames(), sName) == -1)
+ {
+ boolean bascend = AnyConverter.toBoolean(xColumnPropertySet.getPropertyValue("IsAscending"));
+ m_xQueryComposer.appendOrderByColumn(xColumnPropertySet, bascend);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ }
+
+ 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"));
+ m_xQueryComposer.appendOrderByColumn(xColumn, bascend);
+ }
+
+ public void appendSortingcriteria(boolean _baddAliasFieldNames) throws SQLException
+ {
+ String sOrder = "";
+ 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 = m_xQueryAnalyzer.getOrder();
+ if (sOrder.length() > 0)
+ {
+ sOrder += ", ";
+ }
+ sOrder += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + CurDBMetaData.AggregateFieldNames[iAggregate][0] + ")";
+ sOrder += " " + CurDBMetaData.getSortFieldNames()[i][1];
+ m_xQueryComposer.setOrder(sOrder);
+ }
+ else
+ {
+ appendSortingCriterion(i, _baddAliasFieldNames);
+ }
+ sOrder = m_xQueryAnalyzer.getOrder();
+ }
+ // just for debug!
+ sOrder = m_xQueryComposer.getOrder();
+ int dummy = 0;
+ }
+
+ public void appendGroupByColumns(boolean _baddAliasFieldNames) throws SQLException
+ {
+ for (int i = 0; i < CurDBMetaData.GroupFieldNames.length; i++)
+ {
+ XPropertySet xColumn = CurDBMetaData.getColumnObjectByFieldName(CurDBMetaData.GroupFieldNames[i], _baddAliasFieldNames);
+ m_xQueryComposer.appendGroupByColumn(xColumn);
+ }
+ String s = m_xQueryAnalyzer.getQuery();
+ }
+
+ 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++)
+ {
+ _filterconditions[n][m].Name = getComposedAliasFieldName(_filterconditions[n][m].Name);
+ }
+ }
+ return _filterconditions;
+ }
+
+ public String getQuery()
+ {
+ return m_xQueryAnalyzer.getQuery();
+ }
+
+ public String getFromClause()
+ {
+ String sFromClause = "FROM";
+ composedCommandNames.clear();
+ 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(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames)
+ {
+ return setQueryCommand(_xParentWindow,_bincludeGrouping, _baddAliasFieldNames,true);
+ }
+ public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames, boolean addQuery)
+ {
+ try
+ {
+ String s;
+ bincludeGrouping = _bincludeGrouping;
+ if ( addQuery )
+ {
+ String sFromClause = getFromClause();
+ String sSelectClause = getSelectClause(_baddAliasFieldNames);
+ String queryclause = sSelectClause + " " + sFromClause;
+ m_xQueryAnalyzer.setQuery(queryclause);
+ if (CurDBMetaData.getFilterConditions() != null)
+ {
+ if (CurDBMetaData.getFilterConditions().length > 0)
+ {
+ CurDBMetaData.setFilterConditions(replaceConditionsByAlias(CurDBMetaData.getFilterConditions()));
+ m_xQueryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions());
+ }
+ }
+ }
+ s = m_xQueryAnalyzer.getQuery();
+ if (_bincludeGrouping)
+ {
+ appendGroupByColumns(_baddAliasFieldNames);
+ if (CurDBMetaData.GroupByFilterConditions.length > 0)
+ {
+ m_xQueryComposer.setStructuredHavingClause(CurDBMetaData.GroupByFilterConditions);
+ }
+ }
+ appendSortingcriteria(_baddAliasFieldNames);
+
+ s = m_xQueryAnalyzer.getQuery();
+ return true;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ displaySQLErrorDialog(exception, _xParentWindow);
+ return false;
+ }
+ }
+
+ private String getComposedAliasFieldName(String _fieldname)
+ {
+ FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByDisplayName(_fieldname);
+ CommandName curComposedCommandName = getComposedCommandByDisplayName(CurFieldColumn.getCommandName());
+ if ( curComposedCommandName == null )
+ return _fieldname;
+ String curAliasName = curComposedCommandName.getAliasName();
+ return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.getFieldName());
+ }
+
+ private CommandName getComposedCommandByAliasName(String _AliasName)
+ {
+ if (composedCommandNames != null)
+ {
+ CommandName curComposedName;
+ 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)
+ {
+ CommandName curComposedName;
+ 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)
+ {
+ int a = 0;
+ String AliasName = "";
+ boolean bAliasNameexists = true;
+ String locAliasName = _TableName;
+ while (bAliasNameexists == true)
+ {
+ bAliasNameexists = (getComposedCommandByAliasName(locAliasName) != null);
+ if (bAliasNameexists)
+ {
+ a++;
+ locAliasName = _TableName + "_" + String.valueOf(a);
+ }
+ else
+ {
+ AliasName = locAliasName;
+ }
+ }
+ return AliasName;
+ }
+
+ private String quoteName(String _sname)
+ {
+ return CommandName.quoteName(_sname, CurDBMetaData.getIdentifierQuote());
+ }
+
+ 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);
+ PropertyValue[] rDispatchArguments = new PropertyValue[3];
+ rDispatchArguments[0] = Properties.createProperty("Title", Configuration.getProductName(CurDBMetaData.xMSF) + " Base");
+ rDispatchArguments[1] = Properties.createProperty("ParentWindow", _xParentWindow);
+ rDispatchArguments[2] = Properties.createProperty("SQLException", _exception);
+ xInitialize.initialize(rDispatchArguments);
+ xExecute.execute();
+ //TODO dispose???
+ }
+ catch (Exception typeexception)
+ {
+ typeexception.printStackTrace(System.out);
+ }
+ }
+ public XSingleSelectQueryComposer getQueryComposer()
+ {
+ return m_xQueryComposer;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java
new file mode 100644
index 000000000000..8e3b740417c4
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java
@@ -0,0 +1,861 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.wizards.common.JavaTools;
+import java.util.Vector;
+
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.ContainerEvent;
+import com.sun.star.container.XContainer;
+import com.sun.star.container.XContainerListener;
+import com.sun.star.container.XHierarchicalNameAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdbcx.KeyType;
+import com.sun.star.sdbcx.XAppend;
+import com.sun.star.sdbcx.XColumnsSupplier;
+import com.sun.star.sdbcx.XDataDescriptorFactory;
+import com.sun.star.sdbcx.XDrop;
+import com.sun.star.sdbcx.XKeysSupplier;
+import com.sun.star.uno.AnyConverter;
+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
+{
+
+ XDataDescriptorFactory xTableDataDescriptorFactory;
+ XPropertySet xPropTableDataDescriptor;
+ private XNameAccess xNameAccessColumns;
+ private XIndexAccess xIndexAccessKeys;
+ public XDataDescriptorFactory xColumnDataDescriptorFactory;
+ XContainer xTableContainer;
+ XAppend xTableAppend;
+ XDrop xTableDrop;
+ private XAppend xKeyAppend;
+ private XDrop xKeyDrop;
+ private String[] sTableFilters = null;
+ private Vector columncontainer;
+ private Vector keycolumncontainer;
+ public XHierarchicalNameAccess xTableHierarchicalNameAccess;
+ private CommandName ComposedTableName;
+ private XAppend xKeyColAppend;
+ private XColumnsSupplier xKeyColumnSupplier;
+ private XPropertySet xKey;
+ private boolean bIDFieldisInserted = false;
+ private String IDFieldName = "";
+ private String sColumnAlreadyExistsMessage = "";
+// 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;
+ }
+ }
+
+ public boolean getConnection(PropertyValue[] _curPropertyValue)
+ {
+ if (super.getConnection(_curPropertyValue))
+ {
+ // XTablesSupplier xDBTables = (XTablesSupplier) UnoRuntime.queryInterface(XTablesSupplier.class, DBConnection);
+ // xTableNames = xDBTables.getTables();
+ xTableAppend = UnoRuntime.queryInterface( XAppend.class, getTableNamesAsNameAccess() );
+ xTableDrop = UnoRuntime.queryInterface( XDrop.class, getTableNamesAsNameAccess() );
+ xTableDataDescriptorFactory = UnoRuntime.queryInterface( XDataDescriptorFactory.class, getTableNamesAsNameAccess() );
+ xPropTableDataDescriptor = xTableDataDescriptorFactory.createDataDescriptor();
+ XColumnsSupplier xColumnsSupplier = UnoRuntime.queryInterface( XColumnsSupplier.class, xPropTableDataDescriptor );
+ xNameAccessColumns = xColumnsSupplier.getColumns();
+ xColumnDataDescriptorFactory = UnoRuntime.queryInterface( XDataDescriptorFactory.class, xNameAccessColumns );
+ try
+ {
+ createTypeInspector();
+ sTableFilters = (String[]) AnyConverter.toArray(getDataSourcePropertySet().getPropertyValue("TableFilter"));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ 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++)
+ {
+ 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 (nDataType != oTypeInspector.INVALID)
+ {
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (PropertyVetoException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (WrappedTargetException e)
+ {
+ e.printStackTrace(System.out);
+ }
+
+ return false;
+ }
+
+ public boolean isColunnNameDuplicate(XNameAccess _xColumns, XPropertySet _xToBeAppendedPropertySet)
+ {
+ try
+ {
+ String sColumnName = (String) AnyConverter.toString(_xToBeAppendedPropertySet.getPropertyValue("Name"));
+ if (_xColumns.hasByName(sColumnName))
+ {
+ String sMessage = JavaTools.replaceSubString(sColumnAlreadyExistsMessage, sColumnName, "%FIELDNAME");
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMessage);
+ return true;
+ }
+ return false;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ /**
+ * creates the table under the passed name
+ * @param _catalogname
+ * @param _schemaname
+ * @param _tablename is made unique if necessary
+ * @param _fieldnames
+ * @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;
+ }
+ }
+ if (breturn)
+ {
+ assignTableProperty("Name", _tablename);
+ assignTableProperty("CatalogName", _catalogname);
+ assignTableProperty("SchemaName", _schemaname);
+ xTableContainer = (XContainer) UnoRuntime.queryInterface(XContainer.class, getTableNamesAsNameAccess());
+ 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)
+ {
+ xKeyAppend.appendByDescriptor(xKey);
+ }
+ }
+ if (breturn)
+ {
+ // TODO: LLA: describe what is he doing here.
+ 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);
+ }
+ }
+ }
+ 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 (getTableNamesAsNameAccess().hasByName(_tablename))
+ {
+ xTableDrop.dropByName(_tablename);
+ }
+ }
+ if (bIDFieldisInserted)
+ {
+ this.dropColumnbyName(this.IDFieldName);
+ bIDFieldisInserted = false;
+ }
+ return false;
+ }
+ catch (SQLException oSQLException)
+ {
+ super.callSQLErrorMessageDialog(oSQLException, xWindow);
+ }
+ catch (Exception e1)
+ {
+ e1.printStackTrace(System.out);
+ }
+ 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;
+ }
+
+ 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
+ {
+ return modifyColumn(_soldname, "Name", _snewname);
+ }
+ 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++)
+ {
+ ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ catch (WrappedTargetException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ 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))
+ {
+ oColumnDescriptor.xColPropertySet = _xColPropertySet;
+ oColumnDescriptor.Name = (String) _xColPropertySet.getPropertyValue("Name");
+ columncontainer.remove(i);
+ columncontainer.insertElementAt(oColumnDescriptor, i);
+ return true;
+ }
+ }
+ }
+ }
+ 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++)
+ {
+ ColumnDescriptor oColumnDescriptor = (ColumnDescriptor) columncontainer.get(i);
+ if (oColumnDescriptor != null)
+ {
+ if (oColumnDescriptor.Name.equals(_sname))
+ {
+ columncontainer.remove(i);
+ }
+ }
+ }
+ }
+ }
+ 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);
+ }
+ }
+ 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 null;
+ }
+
+ public XPropertySet getByName(String _fieldname)
+ {
+ ColumnDescriptor oColumnDescriptor = getColumnDescriptorByName(_fieldname);
+ if (oColumnDescriptor != null)
+ {
+ return oColumnDescriptor.xColPropertySet;
+ }
+ else
+ {
+ 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);
+ }
+ 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;
+ }
+
+ public boolean addColumn(PropertyValue[] _aNewPropertyValues)
+ {
+ try
+ {
+ String sname = (String) Properties.getPropertyValue(_aNewPropertyValues, "Name");
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ return false;
+ }
+
+ 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)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ public boolean addColumn(String _columnname, XPropertySet _xNewColPropertySet)
+ {
+ try
+ {
+ if (!hasByName(_columnname))
+ {
+ if (_columnname.equals(""))
+ {
+ return false;
+ }
+ else
+ {
+ ColumnPropertySet oPropertySet = new ColumnPropertySet(oTypeInspector, xColumnDataDescriptorFactory.createDataDescriptor());
+ oPropertySet.assignNewPropertySet(_columnname, _xNewColPropertySet);
+ ColumnDescriptor oColumnDescriptor = new ColumnDescriptor(oPropertySet.xPropertySet, _columnname);
+ columncontainer.add(oColumnDescriptor);
+ return true;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return false;
+ }
+
+ 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);
+ this.columncontainer.add(0, oColumnDescriptor);
+ this.bIDFieldisInserted = true;
+ return xColPropertySet;
+ }
+ catch (RuntimeException e1)
+ {
+ e1.printStackTrace(System.out);
+ }
+ }
+ }
+ 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 (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ }
+ catch (RuntimeException 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();
+ }
+
+ 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
+ {
+ 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)
+ {
+ }
+
+ /**
+ * @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))
+ {
+ 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
+ {
+ getDataSourcePropertySet().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
new file mode 100644
index 000000000000..1f22801fd8c5
--- /dev/null
+++ b/wizards/com/sun/star/wizards/db/TypeInspector.java
@@ -0,0 +1,465 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.db;
+
+import java.util.Vector;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.sdbc.ColumnSearch;
+import com.sun.star.sdbc.ColumnValue;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbc.XRow;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.JavaTools;
+
+public class TypeInspector
+{
+
+ private String[] sDataTypeNames;
+ private int[] nDataTypeInfos;
+ private int[] nPrecisionInfos;
+ private int[] nNullableInfos;
+ private int[] nSearchables;
+ 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
+ };
+ final int INVALID = 999999;
+ XResultSet xResultSet;
+
+ public class TypeInfo
+ {
+
+ public int nDataType;
+ public String sDataTypeName;
+ public boolean bisAutoIncrementable;
+
+ public TypeInfo(int _nDataType, String _sDataTypeName, boolean _bisAutoIncrementable)
+ {
+ nDataType = _nDataType;
+ sDataTypeName = _sDataTypeName;
+ bisAutoIncrementable = _bisAutoIncrementable;
+ }
+ }
+
+ public TypeInspector(XResultSet _xResultSet)
+ {
+ try
+ {
+ xResultSet = _xResultSet;
+ Vector<String> aTypeNameVector = new Vector<String>();
+ Vector<Integer> aTypeVector = new Vector<Integer>();
+ Vector<Integer> aNullableVector = new Vector<Integer>();
+ Vector<Boolean> aAutoIncrementVector = new Vector<Boolean>();
+ Vector<Integer> aPrecisionVector = new Vector<Integer>();
+ Vector<Integer> aMinScaleVector = new Vector<Integer>();
+ Vector<Integer> aMaxScaleVector = new Vector<Integer>();
+ Vector<Integer> aSearchableVector = new Vector<Integer>();
+ // 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)));
+
+ }
+ 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;
+ }
+ }
+
+ 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
+ {
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ return ColumnValue.NO_NULLS;
+ }
+
+ 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)
+ {
+ int i = getDataTypeIndex(_xColPropertySet, false);
+ if (i > -1)
+ {
+ return nNullableInfos[i];
+ }
+ else
+ {
+ return ColumnValue.NO_NULLS;
+ }
+ }
+
+ 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)
+ {
+ nPrecision = AnyConverter.toInt(_xColPropertySet.getPropertyValue("Precision"));
+ nScale = AnyConverter.toInt(_xColPropertySet.getPropertyValue("Scale"));
+ }
+ boolean bleaveloop = false;
+ int startindex = 0;
+ while (!bleaveloop)
+ {
+ int i = JavaTools.FieldInIntTable(nDataTypeInfos, nDataType, startindex);
+ 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]))
+ {
+ return i;
+ }
+ }
+ }
+ else
+ {
+ return i;
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return -1;
+ }
+
+ public boolean supportsDataType(int _curDataType)
+ {
+ return (JavaTools.FieldInIntTable(nDataTypeInfos, _curDataType) > -1);
+ }
+
+ 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)
+ {
+ String ret = "";
+ for (int i = 0; i < nDataTypeInfos.length; i++)
+ {
+ 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())
+ {
+ ret = sDataTypeNames[i]; // this fits best !
+ break;
+ }
+ else if (ret.length() == 0)
+ {
+ // in case we dont find anything else, we at return a typename
+ // with the correct class
+ ret = sDataTypeNames[i];
+ }
+ }
+ }
+// System.out.println( "_curDataType="+_curDataType+",precision="+precision+",ret="+
+ return ret;
+ }
+
+ 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)
+ {
+ int retDataType = _curDataType;
+ if (!supportsDataType(_curDataType))
+ {
+ switch (_curDataType)
+ {
+ case DataType.BIT:
+ retDataType = convertDataType(DataType.BOOLEAN);
+ break;
+ case DataType.BOOLEAN:
+ retDataType = convertDataType(DataType.BIT);
+ break;
+ case DataType.TINYINT:
+ retDataType = convertDataType(DataType.SMALLINT);
+ break;
+ case DataType.SMALLINT:
+ retDataType = convertDataType(DataType.INTEGER);
+ break;
+ case DataType.INTEGER:
+ retDataType = convertDataType(DataType.FLOAT);
+ break;
+ case DataType.FLOAT:
+ retDataType = convertDataType(DataType.REAL);
+ break;
+ case DataType.DATE:
+ case DataType.TIME:
+ retDataType = convertDataType(DataType.TIMESTAMP);
+ break;
+ case DataType.TIMESTAMP:
+ case DataType.REAL:
+ case DataType.BIGINT:
+ retDataType = convertDataType(DataType.DOUBLE);
+ break;
+ case DataType.DOUBLE:
+ retDataType = convertDataType(DataType.NUMERIC);
+ break;
+ case DataType.NUMERIC:
+ retDataType = convertDataType(DataType.DECIMAL);
+ 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();
+ break;
+ default:
+ retDataType = getLastConversionFallbackDataType();
+ }
+ }
+ 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];
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return INVALID;
+
+ }
+
+ 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
+ *2) FLOAT
+ *3) REAL
+ *4) DOUBLE
+ *5) NUMERIC
+ *6) DECIMAL *
+ * If no appropriate datatype is found ther first available numeric type after DataType.INTEGER
+ * according to the 'convertDataType' method is returned
+ */
+ /**TODO the fallback order is the same as implemented in the method 'convertDataType'.
+ * It's not very elegant to have the same intelligence
+ * on several spots in the class!!
+ *
+ */
+ public TypeInfo findAutomaticPrimaryKeyType()
+ {
+ int nDataType;
+ for (int n = 0; n < this.nNumericFallBackList.length; n++)
+ {
+ nDataType = nNumericFallBackList[n];
+ boolean bleaveloop = false;
+ int startindex = 0;
+ while (!bleaveloop)
+ {
+ int i = JavaTools.FieldInIntTable(nDataTypeInfos, nDataType, startindex);
+ bleaveloop = (i < 0);
+ if (!bleaveloop)
+ {
+ if (this.bisAutoIncrementableInfos[i])
+ {
+ return new TypeInfo(nDataType, this.sDataTypeNames[i], true);
+ }
+ 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);
+ }
+}
diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java
new file mode 100644
index 000000000000..fb4191277b8c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/document/Control.java
@@ -0,0 +1,359 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.document;
+
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XLayoutConstrains;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.container.XNamed;
+import com.sun.star.wizards.common.*;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.lang.IllegalArgumentException;
+
+public class Control extends Shape
+{
+
+ XControlModel xControlModel;
+ XControl xControl;
+ public XPropertySet xPropertySet;
+ XPropertySet xControlPropertySet;
+ XWindowPeer xWindowPeer;
+ Object oDefaultValue;
+ GridControl oGridControl;
+ String sServiceName;
+ XNamed xNamed;
+ final int SOMAXTEXTSIZE = 50;
+ private int icontroltype;
+ protected XNameContainer xFormName;
+ protected final int IIMGFIELDWIDTH = 3000;
+
+ public Control()
+ {
+ }
+
+ 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);
+ 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);
+ xFormName = _xFormName;
+ createControl(_icontroltype, _aPoint, _aSize, _xGroupShapes, null);
+ }
+
+ 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
+ {
+ icontroltype = _icontroltype;
+ sServiceName = oFormHandler.sModelServices[getControlType()];
+ Object oControlModel = oFormHandler.xMSFDoc.createInstance(sServiceName);
+ xControlModel = UnoRuntime.queryInterface( XControlModel.class, oControlModel );
+ xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oControlModel );
+
+ XPropertySetInfo xPSI = xPropertySet.getPropertySetInfo();
+ if ( xPSI.hasPropertyByName( "MouseWheelBehavior" ) )
+ xPropertySet.setPropertyValue( "MouseWheelBehavior", new Short( com.sun.star.awt.MouseWheelBehavior.SCROLL_DISABLED ) );
+
+ insertControlInContainer(_FieldName);
+ xControlShape.setControl(xControlModel);
+ if (_xGroupShapes == null)
+ {
+ oFormHandler.xDrawPage.add(xShape);
+ }
+ else
+ {
+ _xGroupShapes.add(xShape);
+ }
+ xControl = oFormHandler.xControlAccess.getControl(xControlModel);
+ xControlPropertySet = 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);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public String getControlName(String _fieldname)
+ {
+ String controlname = "";
+ switch (getControlType())
+ {
+ case FormHandler.SOLABEL:
+ controlname = "lbl" + _fieldname;
+ break;
+ case FormHandler.SOTEXTBOX:
+ controlname = "txt" + _fieldname;
+ break;
+ case FormHandler.SOCHECKBOX:
+ controlname = "chk" + _fieldname;
+ break;
+ case FormHandler.SODATECONTROL:
+ controlname = "dat" + _fieldname;
+ break;
+ case FormHandler.SOTIMECONTROL:
+ controlname = "tim" + _fieldname;
+ break;
+ case FormHandler.SONUMERICCONTROL:
+ controlname = "fmt" + _fieldname;
+ break;
+ case FormHandler.SOGRIDCONTROL:
+ controlname = "grd" + _fieldname;
+ break;
+ case FormHandler.SOIMAGECONTROL:
+ controlname = "img" + _fieldname;
+ break;
+ default:
+ controlname = "ctrl" + _fieldname;
+ }
+ return controlname;
+ }
+
+ private void setDefaultValue(Object DatabaseField)
+ {
+ oDefaultValue = Helper.getUnoPropertyValue(DatabaseField, "DefaultValue");
+ }
+
+ public int getPreferredWidth(String sText)
+ {
+ Size aPeerSize = getPreferredSize(sText);
+ return ((aPeerSize.Width + 10) * oFormHandler.getXPixelFactor());
+ }
+
+ public int getPreferredHeight(String sText)
+ {
+ Size aPeerSize = getPreferredSize(sText);
+ if (getControlType() == FormHandler.SOCHECKBOX)
+ {
+ return (aPeerSize.Height * oFormHandler.getXPixelFactor());
+ }
+ else
+ {
+ return ((aPeerSize.Height + 2) * oFormHandler.getXPixelFactor());
+ }
+ }
+
+ public int getPreferredWidth()
+ {
+ if (getControlType() == FormHandler.SOIMAGECONTROL)
+ {
+ return IIMGFIELDWIDTH;
+ }
+ 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 (getControlType() == FormHandler.SOCHECKBOX)
+ {
+ return ((aPeerSize.Width * oFormHandler.getXPixelFactor()));
+ }
+ else
+ {
+ return ((aPeerSize.Width * oFormHandler.getXPixelFactor()) + 200);
+ }
+ }
+ }
+
+ public int getPreferredHeight()
+ {
+ if (getControlType() == FormHandler.SOIMAGECONTROL)
+ {
+ return 2000;
+ }
+ 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());
+ }
+ }
+
+ 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();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ 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 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 if (getControlType() == FormHandler.SOCHECKBOX)
+ {
+ aPreferredSize = getPeer().getPreferredSize();
+ }
+ else if (getControlType() == 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 (getControlType() == 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", "");
+ }
+ return aPreferredSize;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ /**
+ * @return
+ */
+ 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
new file mode 100644
index 000000000000..b0b1523840a9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.document;
+
+import com.sun.star.awt.Point;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.db.FieldColumn;
+
+/**
+ * @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 DatabaseControl extends Control
+{
+
+ private int m_nFieldType;
+ // private int iMemofieldwidth = IIMGFIELDWIDTH;
+ // private int iMemofieldheight = -1;
+ // private FieldColumn m_FieldColumn;
+
+ public DatabaseControl(GridControl _oGridControl, FieldColumn _curfieldcolumn)
+ {
+ super();
+ // m_FieldColumn = _curfieldcolumn;
+ if (_curfieldcolumn.getFieldType() != DataType.TIMESTAMP)
+ {
+ createGridColumn(_oGridControl, _curfieldcolumn, _curfieldcolumn.getFieldType(), _curfieldcolumn.getFieldTitle());
+ }
+ }
+
+ public DatabaseControl(GridControl _oGridControl, FieldColumn _curfieldcolumn, int _fieldtype, String _columntitle)
+ {
+ super();
+ // m_FieldColumn = _curfieldcolumn;
+ createGridColumn(_oGridControl, _curfieldcolumn, _fieldtype, _columntitle);
+ }
+
+ protected int getFieldType()
+ {
+ return m_nFieldType;
+ }
+
+ private void createGridColumn(GridControl _oGridControl, FieldColumn _curfieldcolumn, int _fieldtype, String _columntitle)
+ {
+ try
+ {
+ m_nFieldType = _fieldtype;
+ String sFieldName = _curfieldcolumn.getFieldName();
+ String sUniqueName = Desktop.getUniqueName(_oGridControl.xNameAccess, sFieldName);
+
+ String sGridColumnName = getGridColumnName();
+ XPropertySet xPropColumn = _oGridControl.xGridColumnFactory.createColumn(sGridColumnName);
+ xPropColumn.setPropertyValue("Name", sUniqueName);
+ boolean bHidden = false;
+ if (_fieldtype == DataType.LONGVARBINARY) //TODO CONTROLType abfragen!!!!!!
+ {
+ bHidden = true;
+ }
+ xPropColumn.setPropertyValue("Hidden", new Boolean(bHidden));
+ xPropColumn.setPropertyValue("DataField", sFieldName);
+ xPropColumn.setPropertyValue("Label", _columntitle);
+ xPropColumn.setPropertyValue("Width", new Integer(0)); // Width of column is adjusted to Columname
+
+ XPropertySetInfo xPSI = xPropColumn.getPropertySetInfo();
+ if ( xPSI.hasPropertyByName( "MouseWheelBehavior" ) )
+ xPropColumn.setPropertyValue( "MouseWheelBehavior", new Short( com.sun.star.awt.MouseWheelBehavior.SCROLL_DISABLED ) );
+
+ setNumericLimits();
+ _oGridControl.xNameContainer.insertByName(sFieldName, xPropColumn);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ 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
+ {
+ m_nFieldType = _fieldtype;
+ Helper.setUnoPropertyValue(xControlModel, "DataField", _curFieldName);
+ setNumericLimits();
+ }
+ 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
+ {
+ m_nFieldType = _fieldtype;
+ Helper.setUnoPropertyValue(xControlModel, "DataField", _curFieldName);
+ setNumericLimits();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ private String getGridColumnName()
+ {
+ for (int i = 0; i < FormHandler.oControlData.length; i++)
+ {
+ if (FormHandler.oControlData[i].DataType == getFieldType())
+ {
+ return FormHandler.oControlData[i].GridColumnName;
+ }
+ }
+ return "";
+ }
+
+ public int getControlHeight()
+ {
+ if (getControlType() == FormHandler.SOIMAGECONTROL)
+ {
+ // return oFormHandler.getImageControlHeight();
+ final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4;
+ return nMemofieldheight;
+ }
+ else
+ {
+ if (getFieldType() == DataType.LONGVARCHAR)
+ {
+ // Helper.setUnoPropertyValue(xControlModel, "MultiLine", Boolean.TRUE);
+ final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4;
+ return nMemofieldheight;
+ }
+ else if (getControlType() == FormHandler.SOCHECKBOX)
+ {
+ return super.getPreferredHeight();
+ }
+ }
+ return oFormHandler.getControlReferenceHeight();
+ }
+
+ public int getControlWidth()
+ {
+ if (getControlType() == FormHandler.SOIMAGECONTROL)
+ {
+ return 2 * getControlHeight();
+ }
+ if (getFieldType() == DataType.LONGVARCHAR)
+ {
+ return 2 * getControlHeight();
+ }
+ else
+ {
+ return getPreferredWidth();
+ }
+ }
+
+ private static long m_nLongMax = 0;
+ public static long getLongMax()
+ {
+ if (m_nLongMax == 0)
+ {
+ }
+ return m_nLongMax;
+ }
+ public void setNumericLimits()
+ {
+ try
+ {
+ if (getControlType() == FormHandler.SONUMERICCONTROL)
+ {
+ xPropertySet.setPropertyValue("TreatAsNumber", Boolean.TRUE);
+ // Math.
+ // 2^63 - 1 = 9223372036854775807
+ // int nIntMax = 0x7fffffff;
+ // int nIntMin = -0x80000000;
+ // long nLongMax = nIntMax;
+ // nLongMax <<= (4*4);
+ // nLongMax |= 0xffff;
+ // nLongMax <<= (4*4);
+ // nLongMax |= 0xffff;
+
+ // long nLongMin = nIntMin;
+ // nLongMin <<= (8*4);
+
+ // long nLong2 = (long)9223372036854775807;
+
+ switch (getFieldType())
+ {
+ case DataType.BIGINT:
+ xPropertySet.setPropertyValue("EffectiveMax", new Double(Long.MAX_VALUE));
+ xPropertySet.setPropertyValue("EffectiveMin", new Double(Long.MIN_VALUE));
+ break;
+ case DataType.INTEGER:
+ xPropertySet.setPropertyValue("EffectiveMax", new Double(Integer.MAX_VALUE));
+ xPropertySet.setPropertyValue("EffectiveMin", new Double(Integer.MIN_VALUE));
+ break;
+ case DataType.SMALLINT:
+ xPropertySet.setPropertyValue("EffectiveMax", new Double(Short.MAX_VALUE));
+ xPropertySet.setPropertyValue("EffectiveMin", new Double(Short.MIN_VALUE));
+ 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 (getControlType() == FormHandler.SOTEXTBOX)
+ // { // com.sun.star.sdbc.DataType.CHAR, com.sun.star.sdbc.DataType.VARCHAR, com.sun.star.sdbc.DataType.LONGVARCHAR
+ // }
+ else if (getControlType() == FormHandler.SOIMAGECONTROL)
+ {
+ xPropertySet.setPropertyValue("ScaleMode", com.sun.star.awt.ImageScaleMode.Isotropic);
+ }
+ }
+ 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
new file mode 100644
index 000000000000..7b558d67cd9f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/document/FormHandler.java
@@ -0,0 +1,594 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.document;
+
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XDevice;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XChild;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.view.XControlAccess;
+import com.sun.star.wizards.common.*;
+
+import com.sun.star.sdbc.DataType;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.XInterface;
+import com.sun.star.drawing.XControlShape;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPageSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapeGrouper;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.form.XFormsSupplier;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.container.XNamed;
+
+public class FormHandler
+{
+
+ public XFormsSupplier xFormsSupplier;
+ public XMultiServiceFactory xMSFDoc;
+ public XMultiServiceFactory xMSF;
+ public XDrawPage xDrawPage;
+ private XDrawPageSupplier xDrawPageSupplier;
+ public String[] sModelServices = new String[8];
+ public static ControlData[] oControlData;
+
+ public final static int SOLABEL = 0;
+ public final static int SOTEXTBOX = 1;
+ public final static int SOCHECKBOX = 2;
+ public final static int SODATECONTROL = 3;
+ public final static int SOTIMECONTROL = 4;
+ public final static int SONUMERICCONTROL = 5;
+ 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;
+ int iYPixelFactor = -1;
+ int iXNirwanaPos = 50000;
+ int iYNirwanaPos = 50000;
+ public int nLabelHeight = -1;
+ public int nDBRefHeight = -1;
+ public int BasicLabelDiffHeight = -1;
+ XNameAccess xNamedForms;
+ XControlAccess xControlAccess;
+ XShapeGrouper xShapeGrouper;
+ XNameContainer xNamedFormContainer;
+
+ public class ControlData
+ {
+
+ int DataType;
+ int ControlType;
+ String ControlService;
+ String GridColumnName;
+ boolean bIsText;
+ }
+
+ /** Creates a new instance of FormHandler */
+ public FormHandler(XMultiServiceFactory _xMSF, XTextDocument xTextDocument)
+ {
+ this.xMSF = _xMSF;
+ xDrawPageSupplier = (XDrawPageSupplier) UnoRuntime.queryInterface(XDrawPageSupplier.class, xTextDocument);
+ xDrawPage = xDrawPageSupplier.getDrawPage();
+ xFormsSupplier = (XFormsSupplier) UnoRuntime.queryInterface(XFormsSupplier.class, xDrawPage);
+ xShapeGrouper = (XShapeGrouper) UnoRuntime.queryInterface(XShapeGrouper.class, xDrawPage);
+ xControlAccess = (XControlAccess) UnoRuntime.queryInterface(XControlAccess.class, xTextDocument.getCurrentController());
+ xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ sModelServices[SOLABEL] = "com.sun.star.form.component.FixedText";
+ sModelServices[SOTEXTBOX] = "com.sun.star.form.component.TextField";
+ sModelServices[SOCHECKBOX] = "com.sun.star.form.component.CheckBox";
+ sModelServices[SODATECONTROL] = "com.sun.star.form.component.DateField";
+ sModelServices[SOTIMECONTROL] = "com.sun.star.form.component.TimeField";
+ sModelServices[SONUMERICCONTROL] = "com.sun.star.form.component.FormattedField";
+ sModelServices[SOGRIDCONTROL] = "com.sun.star.form.component.GridControl";
+ sModelServices[SOIMAGECONTROL] = "com.sun.star.form.component.DatabaseImageControl";
+
+ oControlData = new ControlData[22];
+ oControlData[0] = createControlData(DataType.BIT, SOCHECKBOX, "CheckBox", "CheckBox", false);
+ oControlData[1] = createControlData(DataType.BOOLEAN, SOCHECKBOX, "CheckBox", "CheckBox", false);
+ oControlData[2] = createControlData(DataType.TINYINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
+ oControlData[3] = createControlData(DataType.SMALLINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
+ oControlData[4] = createControlData(DataType.INTEGER, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
+ oControlData[5] = createControlData(DataType.BIGINT, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
+ oControlData[6] = createControlData(DataType.FLOAT, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
+ oControlData[7] = createControlData(DataType.REAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
+ oControlData[8] = createControlData(DataType.DOUBLE, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
+ oControlData[9] = createControlData(DataType.NUMERIC, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
+ oControlData[10] = createControlData(DataType.DECIMAL, SONUMERICCONTROL, "FormattedField", "FormattedField", false);
+ oControlData[11] = createControlData(DataType.CHAR, SOTEXTBOX, "TextField", "TextField", false);
+ oControlData[12] = createControlData(DataType.VARCHAR, SOTEXTBOX, "TextField", "TextField", true);
+ oControlData[13] = createControlData(DataType.LONGVARCHAR, SOTEXTBOX, "TextField", "TextField", true);
+ oControlData[14] = createControlData(DataType.DATE, SODATECONTROL, "DateField", "DateField", false);
+ oControlData[15] = createControlData(DataType.TIME, SOTIMECONTROL, "TimeField", "TimeField", false);
+ oControlData[16] = createControlData(DataType.TIMESTAMP, SODATECONTROL, "DateField", "TextField", false);
+ // oImageControlData = new ControlData[4];
+ oControlData[17] = createControlData(DataType.BINARY, SOIMAGECONTROL, "ImageControl", "TextField", false);
+ oControlData[18] = createControlData(DataType.VARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false);
+ oControlData[19] = createControlData(DataType.LONGVARBINARY, SOIMAGECONTROL, "ImageControl", "TextField", false);
+ oControlData[20] = createControlData(DataType.BLOB, SOIMAGECONTROL, "ImageControl", "TextField", false);
+
+ oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, "ImageControl", "TextField", false);
+ }
+
+ public int getControlType(int _fieldtype)
+ {
+ for (int i = 0; i < oControlData.length; i++)
+ {
+ if (oControlData[i].DataType == _fieldtype)
+ {
+ final int nType = oControlData[i].ControlType;
+ return nType;
+ }
+ }
+ return -1;
+ }
+
+ public void setglobalMultiServiceFactory(XMultiServiceFactory _xMSF)
+ {
+ xMSF = _xMSF;
+ }
+
+ public String getModelServiceName(int _fieldtype)
+ {
+ int icontroltype = getControlType(_fieldtype);
+ if (icontroltype > -1)
+ {
+ return sModelServices[icontroltype];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ 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);
+
+ 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;
+ xDrawPage.remove(oLabelControl.xShape);
+ xDrawPage.remove(oTextControl.xShape);
+ }
+
+ public ControlData createControlData(int _datatype, int _controltype, String _scontrolservicename, String _gridcolumnname, boolean _bIsTextControl)
+ {
+ ControlData curControlData = new ControlData();
+ curControlData.DataType = _datatype;
+ curControlData.ControlType = _controltype;
+ curControlData.ControlService = _scontrolservicename;
+ curControlData.GridColumnName = _gridcolumnname;
+ curControlData.bIsText = _bIsTextControl;
+ return curControlData;
+ }
+
+ 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))
+ {
+ String ControlValue = AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
+ return ControlValue;
+ }
+ else
+ {
+ throw new UnknownHiddenControlException(xNamedForm, ControlName, sMsg);
+ }
+ }
+ 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);
+ }
+ Helper.setUnoPropertyValue(xHiddenControl, "HiddenValue", ControlValue);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public class UnknownHiddenControlException extends java.lang.Throwable
+ {
+
+ 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>");
+ sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, ControlName, "<CONTROLNAME>");
+ SystemDialog.showMessageBox(xMSFDoc, "ErrorBox", VclWindowPeerAttribute.OK, sMsgHiddenControlisMissing);
+ }
+ }
+
+ 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);
+ }
+ }
+ 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 (belongsToForm(xDrawPage.getByIndex(i), _FormName))
+ {
+ XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ xDrawPage.remove(xShape);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void removeElement( XNameContainer _parentContainer, String _formName )
+ {
+ try
+ {
+ _parentContainer.removeByName( _formName );
+ }
+ catch ( WrappedTargetException e )
+ {
+ e.printStackTrace( System.err );
+ }
+ catch( final NoSuchElementException e )
+ {
+ e.printStackTrace( System.err );
+ }
+ }
+
+ public boolean belongsToForm(Object _oDrawPageElement, String _FormName)
+ {
+ XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement);
+ 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"))
+ {
+ XChild xChild = (XChild) UnoRuntime.queryInterface(XChild.class, xControlModel);
+ XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xChild.getParent());
+ String sName = xNamed.getName();
+ return _FormName.equals(sName);
+ }
+ }
+ 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);
+ XNameContainer xNamedForm;
+ 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)
+ {
+ return insertFormbyName(_FormName, _xNamedFormContainer);
+ }
+
+ 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);
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return xNamedForm;
+ }
+
+ /**
+ * @return
+ */
+ public int getXPixelFactor()
+ {
+ if (iXPixelFactor == -1)
+ {
+ initializeBasicControlValues();
+ }
+ return iXPixelFactor;
+ }
+
+ /**
+ * @return
+ */
+ public int getYPixelFactor()
+ {
+ if (iYPixelFactor == -1)
+ {
+ initializeBasicControlValues();
+ }
+ return iYPixelFactor;
+ }
+
+ /**
+ * @param i
+ */
+ public void setXPixelFactor(int i)
+ {
+ iXPixelFactor = i;
+ }
+
+ /**
+ * @param i
+ */
+ public void setYPixelFactor(int i)
+ {
+ iYPixelFactor = i;
+ }
+
+ /**
+ * @return
+ */
+ public int getImageControlHeight()
+ {
+ return iImageControlHeight;
+ }
+
+ /**
+ * @param 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)
+// try {
+// this.xDrawPage.remove(ControlList[i].xShape);
+ {
+ ControlList[i].setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos));
+// String sControlName = (String) ControlList[i].xPropertySet.getPropertyValue("Name");
+//
+// if (_xNamedForm.hasByName(sControlName))
+// _xNamedForm.removeByName(sControlName);
+// } 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--)
+ {
+ 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)
+ {
+ 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--)
+ {
+ 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;
+ }
+ }
+
+ /**
+ * @return
+ */
+ public int getBasicLabelDiffHeight()
+ {
+ if (this.BasicLabelDiffHeight == -1)
+ {
+ initializeBasicControlValues();
+ }
+ return BasicLabelDiffHeight;
+ }
+
+ /**
+ * @return
+ */
+ public int getControlReferenceHeight()
+ {
+ if (this.nDBRefHeight == -1)
+ {
+ initializeBasicControlValues();
+ }
+ return nDBRefHeight;
+ }
+
+ /**
+ * @return
+ */
+ public int getLabelHeight()
+ {
+ if (this.nLabelHeight == -1)
+ {
+ initializeBasicControlValues();
+ }
+ return nLabelHeight;
+ }
+
+ 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)
+ {
+ ex.printStackTrace(System.out);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java
new file mode 100644
index 000000000000..66bae37e1ed3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/document/GridControl.java
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.document;
+
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.db.FieldColumn;
+import com.sun.star.sdbc.*;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.form.XGridColumnFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+
+public class GridControl extends Shape
+{
+
+ FieldColumn[] fieldcolumns;
+ public XNameContainer xNameContainer;
+ public XGridColumnFactory xGridColumnFactory;
+ public XPropertySet xPropertySet;
+ XNameAccess xNameAccess;
+ final String SODEFAULTNAME = "Grid1";
+ 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 = UnoRuntime.queryInterface( XNameContainer.class, oGridModel );
+ xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, oGridModel );
+ _xFormName.insertByName(_sname, oGridModel);
+ xControlModel = UnoRuntime.queryInterface( XControlModel.class, oGridModel );
+ xControlShape.setControl(xControlModel);
+ xPropertySet = UnoRuntime.queryInterface( XPropertySet.class, oGridModel );
+ oFormHandler.xDrawPage.add(xShape);
+ xGridColumnFactory = UnoRuntime.queryInterface( XGridColumnFactory.class, oGridModel );
+ 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.getFieldType() == DataType.TIMESTAMP)
+ {
+ TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, "", "dbw"), this, curfieldcolumn);
+ }
+ else
+ {
+ Control oControl = new DatabaseControl(this, curfieldcolumn);
+ }
+ }
+
+ }
+ 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
new file mode 100644
index 000000000000..4cb78cd967c3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java
@@ -0,0 +1,457 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.document;
+
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.document.XDocumentProperties;
+import com.sun.star.document.XDocumentPropertiesSupplier;
+import com.sun.star.document.XEventsSupplier;
+import com.sun.star.document.XTypeDetection;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.wizards.common.*;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.WindowAttribute;
+import com.sun.star.awt.WindowDescriptor;
+import com.sun.star.awt.XToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.sheet.XCellRangeData;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.XCellRange;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XFrames;
+import com.sun.star.frame.XFramesSupplier;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XStorable;
+import com.sun.star.frame.XTerminateListener;
+import com.sun.star.util.XCloseable;
+import com.sun.star.util.XModifiable;
+
+public class OfficeDocument
+{
+
+ private XWindowPeer xWindowPeer;
+ private XMultiServiceFactory xMSF;
+
+ /** Creates a new instance of OfficeDocument */
+ public OfficeDocument(XMultiServiceFactory _xMSF)
+ {
+ xMSF = _xMSF;
+ }
+
+ 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();
+ oEventProperties[0].Name = "EventType";
+ oEventProperties[0].Value = EventType; // "Service", "StarBasic"
+ oEventProperties[1] = new PropertyValue();
+ oEventProperties[1].Name = "Script"; //"URL";
+ oEventProperties[1].Value = EventURL;
+ xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties);
+ }
+ 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);
+ }
+ }
+ catch (PropertyVetoException exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ /**
+ * Create a new office document, attached to the given frame.
+ * @param desktop
+ * @param frame
+ * @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)
+ {
+
+ PropertyValue[] loadValues = new PropertyValue[2];
+ loadValues[0] = new PropertyValue();
+ loadValues[0].Name = "ReadOnly";
+ loadValues[0].Value = readonly ? Boolean.TRUE : Boolean.FALSE;
+ loadValues[1] = new PropertyValue();
+ loadValues[1].Name = "Preview";
+ loadValues[1].Value = preview ? Boolean.TRUE : Boolean.FALSE;
+
+ Object oDocument = null;
+ com.sun.star.frame.XComponentLoader xComponentLoader = null;
+ XInterface xInterface = null;
+ String sURL = "private:factory/" + sDocumentType;
+
+ 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);
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return oDocument;
+ }
+
+ public static XFrame createNewFrame(XMultiServiceFactory xMSF, XTerminateListener listener)
+ {
+ return createNewFrame(xMSF, listener, "_blank");
+ }
+
+ public static XFrame createNewFrame(XMultiServiceFactory xMSF, XTerminateListener listener, String FrameName)
+ {
+ XFrame xFrame = null;
+ if (FrameName.equalsIgnoreCase("WIZARD_LIVE_PREVIEW"))
+ {
+ xFrame = createNewPreviewFrame(xMSF, listener);
+ }
+ else
+ {
+ XFrame xF = (XFrame) UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xMSF));
+ xFrame = xF.findFrame(FrameName, 0);
+ if (listener != null)
+ {
+ XFramesSupplier xFS = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xF);
+ XFrames xFF = xFS.getFrames();
+ xFF.remove(xFrame);
+ XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xF);
+ xDesktop.addTerminateListener(listener);
+ }
+ }
+ return xFrame;
+ }
+
+ 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)
+ {
+ // 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;
+
+ //create a new blank container window
+ XWindowPeer xPeer = null;
+ 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);
+
+ //define some further properties of the frame window
+ //if it's needed .-)
+ //xPeer->setBackground(...);
+
+ //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)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ xFrame.initialize(xWindow);
+
+ //from now this frame is useable ...
+ //and not part of the desktop tree.
+ //You are alone with him .-)
+
+ if (listener != null)
+ {
+ Desktop.getDesktop(xMSF).addTerminateListener(listener);
+ }
+
+ return xFrame;
+
+ }
+
+ 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
+ {
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return oDocument;
+ }
+
+ 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)
+ {
+ oStoreProperties = new PropertyValue[1];
+ oStoreProperties[0] = new PropertyValue();
+ oStoreProperties[0].Name = "FilterName";
+ oStoreProperties[0].Value = FilterName;
+ }
+ else
+ {
+ oStoreProperties = new PropertyValue[0];
+ }
+ if (bStoreToUrl == true)
+ {
+ xStoreable.storeToURL(StorePath, oStoreProperties);
+ }
+ else
+ {
+ xStoreable.storeAsURL(StorePath, oStoreProperties);
+ }
+ return true;
+ }
+ catch (Exception exception)
+ {
+
+ exception.printStackTrace(System.out);
+ //TODO make sure that the peer of the dialog is used when available
+ showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMsgSavingImpossible);
+ return false;
+ }
+ }
+
+ public static boolean close(XComponent xComponent)
+ {
+ boolean bState = false;
+ XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
+
+ if (xModel != null)
+ {
+ XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, xModel);
+
+ if (xCloseable != null)
+ {
+ try
+ {
+ xCloseable.close(true);
+ bState = true;
+ }
+ catch (com.sun.star.util.CloseVetoException exCloseVeto)
+ {
+ System.out.println("could not close doc");
+ bState = false;
+ }
+ }
+ else
+ {
+ XComponent xDisposeable = (XComponent) UnoRuntime.queryInterface(XComponent.class, xModel);
+ xDisposeable.dispose();
+ bState = true;
+ }
+ }
+ return bState;
+ }
+
+ public static void ArraytoCellRange(Object[][] datalist, Object oTable, int xpos, int ypos)
+ {
+ try
+ {
+ int rowcount = datalist.length;
+ if (rowcount > 0)
+ {
+ int colcount = datalist[0].length;
+ if (colcount > 0)
+ {
+ XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oTable);
+ 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)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public static PropertyValue[] getFileMediaDecriptor(XMultiServiceFactory xmsf, String url)
+ throws Exception
+ {
+ Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
+
+ PropertyValue[][] mediaDescr = new PropertyValue[1][1];
+ mediaDescr[0][0] = new PropertyValue();
+ mediaDescr[0][0].Name = "URL";
+ mediaDescr[0][0].Value = url;
+
+ String type = ((XTypeDetection) UnoRuntime.queryInterface(XTypeDetection.class, typeDetect)).queryTypeByDescriptor(mediaDescr, true);
+
+ 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
+ {
+ Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
+ return (PropertyValue[]) xNameAccess.getByName(type);
+ }
+
+ /**
+ * returns the count of slides in a presentation,
+ * or the count of pages in a draw document.
+ * @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);
+ return xDrawPagesSupplier.getDrawPages().getCount();
+ }
+
+ public static XDocumentProperties getDocumentProperties(Object document)
+ {
+ XDocumentPropertiesSupplier xDocumentPropertiesSupplier = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, document);
+ return xDocumentPropertiesSupplier.getDocumentProperties();
+ }
+
+ public static int showMessageBox(XMultiServiceFactory xMSF, 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()
+ {
+ 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)
+ {
+ xWindowPeer = windowPeer;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/document/Shape.java b/wizards/com/sun/star/wizards/document/Shape.java
new file mode 100644
index 000000000000..b2ef1a27e662
--- /dev/null
+++ b/wizards/com/sun/star/wizards/document/Shape.java
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.document;
+
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.drawing.XControlShape;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.text.TextContentAnchorType;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+
+/**
+ * @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 Shape
+{
+
+ public XShape xShape;
+ protected FormHandler oFormHandler;
+ public XServiceInfo xServiceInfo;
+ protected Point aPoint;
+ protected Size aSize;
+ protected XControlShape xControlShape;
+ public XMultiServiceFactory xMSF;
+ public XShapes xShapes;
+
+ 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()
+ {
+ }
+
+ 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()
+ {
+ return xShape.getSize();
+ }
+
+ public void setSize(Size _aSize)
+ {
+ try
+ {
+ xShape.setSize(_aSize);
+ }
+ catch (PropertyVetoException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public Point getPosition()
+ {
+ return xShape.getPosition();
+ }
+
+ 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
new file mode 100644
index 000000000000..88733ee883c1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.document;
+
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.db.FieldColumn;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.sdbc.*;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.drawing.XControlShape;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+
+public class TimeStampControl extends DatabaseControl
+{
+
+ DatabaseControl oDateControl;
+ DatabaseControl oTimeControl;
+// XShape xGroupShape;
+ Resource oResource;
+ private String sDateAppendix; // = GetResText(RID_FORM + 4)
+ private String sTimeAppendix; // = GetResText(RID_FORM + 5)
+ XShapes xGroupShapes = null;
+ double nreldatewidth;
+ double nreltimewidth;
+ int nTimeWidth;
+ int nDBWidth;
+ int nDateWidth;
+ XShape xShapeGroup;
+
+ 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);
+ int nDBHeight = oDateControl.getControlHeight();
+ nDateWidth = oDateControl.getPreferredWidth();
+ 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));
+ 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);
+ nreltimewidth = 1.0 - nreldatewidth;
+ }
+
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ return null;
+ }
+
+ 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.getFieldTitle() + " " + sDateAppendix);
+ oTimeControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.TIME, _curfieldcolumn.getFieldTitle() + " " + sTimeAppendix);
+ }
+
+ public void setPropertyValue(String _sPropertyName, Object _aPropertyValue) throws Exception
+ {
+ oDateControl.setPropertyValue(_sPropertyName, _aPropertyValue);
+ oTimeControl.setPropertyValue(_sPropertyName, _aPropertyValue);
+ }
+
+ 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 Size getSize()
+ {
+ int ncontrolwidth = oDateControl.xShape.getSize().Width + oTimeControl.xShape.getSize().Width;
+ return new Size(ncontrolwidth, oDateControl.xShape.getSize().Height);
+ }
+
+ public Point getPosition()
+ {
+ return xShapeGroup.getPosition();
+ }
+
+ public void setPosition(Point _aPoint)
+ {
+ // --> TESTING
+ Point aBeforePt = xShapeGroup.getPosition();
+ // <--
+ xShapeGroup.setPosition(_aPoint);
+// oDateControl.xShape.setPosition(_aPoint);
+// Point atimepoint = new Point(oDateControl.xShape.getPosition().X + oDateControl.xShape.getSize().Width, oDateControl.xShape.getPosition().Y );
+// oTimeControl.xShape.setPosition(atimepoint);
+ // --> TESTING
+ Point aAfterPt = xShapeGroup.getPosition();
+ // <--
+ }
+
+ 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
new file mode 100644
index 000000000000..067c4dce09f1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/CGFax.java
@@ -0,0 +1,60 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 int cp_Style;
+ public boolean cp_PrintCompanyLogo;
+ public boolean cp_PrintDate;
+ public boolean cp_PrintSubjectLine;
+ public boolean cp_PrintSalutation;
+ public boolean cp_PrintCommunicationType;
+ public boolean cp_PrintGreeting;
+ public boolean cp_PrintFooter;
+ public String cp_CommunicationType;
+ public String cp_Salutation;
+ public String cp_Greeting;
+ public int cp_SenderAddressType;
+ public String cp_SenderCompanyName;
+ public String cp_SenderStreet;
+ public String cp_SenderPostCode;
+ public String cp_SenderState;
+ public String cp_SenderCity;
+ public String cp_SenderFax;
+ public int cp_ReceiverAddressType;
+ public String cp_Footer;
+ public boolean cp_FooterOnlySecondPage;
+ public boolean cp_FooterPageNumbers;
+ 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
new file mode 100644
index 000000000000..232d4ee8c163
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/CGFaxWizard.java
@@ -0,0 +1,38 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 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
new file mode 100644
index 000000000000..b20dc0890e56
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/CallWizard.java
@@ -0,0 +1,257 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.task.XJob;
+import com.sun.star.task.XJobExecutor;
+import com.sun.star.uno.Type;
+
+/**
+ * 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 (<CODE>__writeRegistryServiceInfo</CODE>).
+ *
+ * @author $author$
+ * @version $Revision: 1.3.192.1 $
+ */
+public class CallWizard
+{
+
+ /**
+ * Gives a factory for creating the service. This method is called by the
+ * <code>JavaLoader</code>
+ *
+ * <p></p>
+ *
+ * @param stringImplementationName The implementation name of the component.
+ * @param xMSF The service manager, who gives access to every known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single registry key accessible.
+ *
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the component.
+ *
+ * @see com.sun.star.comp.loader.JavaLoader#
+ */
+ public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey)
+ {
+ XSingleServiceFactory xsingleservicefactory = null;
+
+ if (stringImplementationName.equals(WizardImplementation.class.getName()))
+ {
+ xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey);
+ }
+
+ return xsingleservicefactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key. This method is called
+ * by the <code>JavaLoader</code>.
+ *
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single registry key accessible.
+ *
+ * @return returns true if the operation succeeded
+ *
+ * @see com.sun.star.comp.loader.JavaLoader#
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey)
+ {
+ return FactoryHelper.writeRegistryServiceInfo(WizardImplementation.class.getName(), WizardImplementation.__serviceName, xregistrykey);
+ }
+
+ /**
+ * 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
+ {
+
+ /**
+ * The constructor of the inner class has a XMultiServiceFactory parameter.
+ *
+ * @param xmultiservicefactoryInitialization A special service factory could be
+ * introduced while initializing.
+ */
+ public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
+ xmultiservicefactory = xmultiservicefactoryInitialization;
+
+ if (xmultiservicefactory != null)
+ {
+ }
+ }
+
+ /**
+ * Execute Wizard
+ *
+ * @param str only valid parameter is 'start' at the moment.
+ */
+ public void trigger(String str)
+ {
+ if (str.equalsIgnoreCase("start"))
+ {
+ FaxWizardDialogImpl lw = new FaxWizardDialogImpl(xmultiservicefactory);
+ 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.
+ */
+ private XMultiServiceFactory xmultiservicefactory;
+
+ /**
+ * This method is a member of the interface for initializing an object directly
+ * after its creation.
+ *
+ * @param object This array of arbitrary objects will be passed to the component
+ * after its creation.
+ *
+ * @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
+ {
+ }
+
+ /**
+ * 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];
+ stringSupportedServiceNames[0] = __serviceName;
+
+ return (stringSupportedServiceNames);
+ }
+
+ /**
+ * This method returns true, if the given service will be supported by the
+ * component.
+ *
+ * @param stringService Service name.
+ *
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService(String stringService)
+ {
+ boolean booleanSupportsService = false;
+
+ 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. to realise hashing functionality
+ * when the object is introspected. Two objects that return the same ID also
+ * have to return the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to return an empty
+ * sequence. Important: If the object aggregates other objects the ID has to be
+ * unique for the whole combination of objects.
+ *
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
+ };
+
+ try
+ {
+ byteReturn = ("" + 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 (WizardImplementation.class.getName());
+ }
+
+ /**
+ * Provides a sequence of all types (usually interface types) provided by the
+ * object.
+ *
+ * @return Sequence of all types (usually interface types) provided by the
+ * service.
+ */
+ 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)
+ {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.java b/wizards/com/sun/star/wizards/fax/FaxDocument.java
new file mode 100644
index 000000000000..8eafbed257d1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/FaxDocument.java
@@ -0,0 +1,212 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+import com.sun.star.wizards.text.*;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XTerminateListener;
+import com.sun.star.text.*;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.style.NumberingType;
+import com.sun.star.style.ParagraphAdjust;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.style.XStyle;
+
+public class FaxDocument extends TextDocument
+{
+
+ XDesktop xDesktop;
+ boolean keepLogoFrame = true;
+ boolean keepTypeFrame = true;
+
+ public FaxDocument(XMultiServiceFactory xMSF, XTerminateListener listener)
+ {
+ super(xMSF, listener, "WIZARD_LIVE_PREVIEW");
+ }
+
+ public XWindowPeer getWindowPeer()
+ {
+ XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument);
+ return xWindowPeer;
+ }
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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)
+ {
+ xTextDocument.lockControllers();
+ try
+ {
+ XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ com.sun.star.container.XNameAccess xNameAccess = null;
+ xNameAccess = xStyleFamiliesSupplier.getStyleFamilies();
+
+ com.sun.star.container.XNameContainer xPageStyleCollection = null;
+ xPageStyleCollection = (com.sun.star.container.XNameContainer) UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles"));
+
+ XText xFooterText;
+ XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle));
+
+ if (bState)
+ {
+ Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(true));
+ xFooterText = (XText) UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText"));
+ xFooterText.setString(sText);
+ if (bPageNumber)
+ {
+ //Adding the Page Number
+ XTextCursor myCursor = xFooterText.createTextCursor();
+ myCursor.gotoEnd(false);
+ xFooterText.insertControlCharacter(myCursor, ControlCharacter.PARAGRAPH_BREAK, false);
+ XPropertySet xCursorPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, myCursor);
+ xCursorPSet.setPropertyValue("ParaAdjust", ParagraphAdjust.CENTER);
+ 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));
+ xFooterText.insertTextContent(xFooterText.getEnd(), xPageNumberField, false);
+ }
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(false));
+ }
+ xTextDocument.unlockControllers();
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+ }
+
+ public boolean hasElement(String sElement)
+ {
+ if (xTextDocument != null)
+ {
+ TextSectionHandler mySectionHandler = new TextSectionHandler(xMSF, xTextDocument);
+ return mySectionHandler.hasTextSectionByName(sElement);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public void switchUserField(String sFieldName, String sNewContent, boolean bState)
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
+ if (bState)
+ {
+ myFieldHandler.changeUserFieldContent(sFieldName, sNewContent);
+ }
+ else
+ {
+ myFieldHandler.changeUserFieldContent(sFieldName, "");
+ }
+ }
+
+ 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"));
+ myFieldHandler.changeUserFieldContent("Street", (String) Helper.getUnoObjectbyName(oUserDataAccess, "street"));
+ myFieldHandler.changeUserFieldContent("PostCode", (String) Helper.getUnoObjectbyName(oUserDataAccess, "postalcode"));
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void killEmptyUserFields()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
+ myFieldHandler.removeUserFieldByContent("");
+ }
+
+ public void killEmptyFrames()
+ {
+ try
+ {
+ if (!keepLogoFrame)
+ {
+ XTextFrame xTF = TextFrameHandler.getFrameByName("Company Logo", xTextDocument);
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
+ }
+ if (!keepTypeFrame)
+ {
+ XTextFrame xTF = TextFrameHandler.getFrameByName("Communication Type", xTextDocument);
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
+ }
+ }
+ 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
new file mode 100644
index 000000000000..8c81ba5e5fec
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java
@@ -0,0 +1,628 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+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
+{
+
+ 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;
+
+ 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 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 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
new file mode 100644
index 000000000000..743173373b54
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogConst.java
@@ -0,0 +1,115 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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";
+
+ /* ====================================
+ * 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
new file mode 100644
index 000000000000..dac35cabc04a
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
@@ -0,0 +1,873 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.NoValidPathException;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.document.XDocumentProperties;
+import com.sun.star.document.XDocumentPropertiesSupplier;
+import com.sun.star.graphic.XGraphicProvider;
+import com.sun.star.graphic.XGraphic;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.RuntimeException;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.text.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.task.XInteractionHandler;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.CloseVetoException;
+import com.sun.star.util.XCloseable;
+import com.sun.star.wizards.document.*;
+import com.sun.star.wizards.ui.*;
+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
+{
+
+ 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;
+ String sFaxPath;
+ String sWorkPath;
+ String sPath;
+ 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)
+ {
+ super(xmsf);
+ }
+
+ 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.ServiceManager";
+ 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)
+ {
+
+ running = true;
+ try
+ {
+ //Number of steps on WizardDialog:
+ setMaxStep(5);
+
+ //instatiate The Document Frame for the Preview
+ myFaxDoc = new FaxDocument(xMSF, this);
+
+ //create the dialog:
+ drawNaviBar();
+ buildStep1();
+ buildStep2();
+ buildStep3();
+ buildStep4();
+ buildStep5();
+
+ initializeSalutation();
+ initializeGreeting();
+ initializeCommunication();
+ initializePaths();
+
+ //special Control for setting the save Path:
+ insertPathSelectionControl();
+
+ //load the last used settings from the registry and apply listeners to the controls:
+ initConfiguration();
+
+ initializeTemplates(xMSF);
+
+ //update the dialog UI according to the loaded Configuration
+ updateUI();
+
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ {
+ myPathSelection.initializePath();
+ }
+
+ XWindow xContainerWindow = myFaxDoc.xFrame.getContainerWindow();
+ XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
+ createWindowPeer(xWindowPeer);
+
+ //add the Roadmap to the dialog:
+ insertRoadmap();
+
+ //load the last used document and apply last used settings:
+ //TODO:
+ setConfiguration();
+
+ //If the configuration does not define Greeting/Salutation/CommunicationType yet choose a default
+ setDefaultForGreetingAndSalutationAndCommunication();
+
+ //disable funtionality that is not supported by the template:
+ initializeElements();
+
+ //disable the document, so that the user cannot change anything:
+ myFaxDoc.xFrame.getComponentWindow().setEnable(false);
+
+ executeDialog(myFaxDoc.xFrame);
+ removeTerminateListener();
+ closeDocument();
+ running = false;
+
+ }
+ catch (Exception exception)
+ {
+ removeTerminateListener();
+ exception.printStackTrace(System.out);
+ running = false;
+ return;
+ }
+ }
+
+ public void cancelWizard()
+ {
+ xDialog.endExecute();
+ running = false;
+ }
+
+ public boolean finishWizard()
+ {
+ switchToStep(getCurrentStep(), getMaxStep());
+ myFaxDoc.setWizardTemplateDocInfo(resources.resFaxWizardDialog_title, resources.resTemplateDescription);
+ try
+ {
+ //myFaxDoc.xTextDocument.lockControllers();
+ FileAccess fileAccess = new FileAccess(xMSF);
+ sPath = myPathSelection.getSelectedPath();
+ if (sPath.equals(""))
+ {
+ myPathSelection.triggerPathPicker();
+ sPath = myPathSelection.getSelectedPath();
+ }
+ sPath = fileAccess.getURL(sPath);
+
+ //first, if the filename was not changed, thus
+ //it is coming from a saved session, check if the
+ // file exists and warn the user.
+ if (!filenameChanged)
+ {
+ 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 false;
+ }
+ }
+ }
+ myFaxDoc.setWizardTemplateDocInfo(resources.resFaxWizardDialog_title, resources.resTemplateDescription);
+ myFaxDoc.killEmptyUserFields();
+ myFaxDoc.keepLogoFrame = (chkUseLogo.getState() != 0);
+ myFaxDoc.keepTypeFrame = (chkUseCommunicationType.getState() != 0);
+ myFaxDoc.killEmptyFrames();
+
+
+ bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath, "writer8_template", false, "Template could not be saved to" + sPath);
+ if (bSaveSuccess)
+ {
+ saveConfiguration();
+ XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
+ PropertyValue loadValues[] = new PropertyValue[4];
+ loadValues[0] = new PropertyValue();
+ loadValues[0].Name = "AsTemplate";
+ loadValues[1] = new PropertyValue();
+ loadValues[1].Name = "MacroExecutionMode";
+ 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[3] = new PropertyValue();
+ loadValues[3].Name = "InteractionHandler";
+ loadValues[3].Value = xIH;
+
+
+ if (bEditTemplate)
+ {
+ loadValues[0].Value = Boolean.FALSE;
+ }
+ else
+ {
+ loadValues[0].Value = Boolean.TRUE;
+ }
+ Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), sPath, "_default", loadValues);
+ XTextDocument xTextDocument = (com.sun.star.text.XTextDocument) oDoc;
+ 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
+ {
+ //TODO: Error Handling
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ xDialog.endExecute();
+ running = false;
+ }
+ return true;
+ }
+
+ public void closeDocument()
+ {
+ try
+ {
+ //xComponent.dispose();
+ XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myFaxDoc.xFrame);
+ xCloseable.close(false);
+ }
+ catch (CloseVetoException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void insertRoadmap()
+ {
+ addRoadmap();
+ int i = 0;
+ i = insertRoadmapItem(0, true, resources.RoadmapLabels[RM_TYPESTYLE], RM_TYPESTYLE);
+ i = insertRoadmapItem(i, true, resources.RoadmapLabels[RM_ELEMENTS], RM_ELEMENTS);
+ i = insertRoadmapItem(i, true, resources.RoadmapLabels[RM_SENDERRECEIVER], RM_SENDERRECEIVER);
+ i = insertRoadmapItem(i, false, resources.RoadmapLabels[RM_FOOTER], RM_FOOTER);
+ i = insertRoadmapItem(i, true, resources.RoadmapLabels[RM_FINALSETTINGS], RM_FINALSETTINGS);
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ }
+
+ private class myPathSelectionListener implements XPathSelectionListener
+ {
+
+ public void validatePath()
+ {
+ if (myPathSelection.usedPathPicker)
+ {
+ filenameChanged = true;
+ }
+ myPathSelection.usedPathPicker = false;
+ }
+ }
+
+ 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.sDefaultDirectory = sUserTemplatePath;
+ myPathSelection.sDefaultName = "myFaxTemplate.ott";
+ myPathSelection.sDefaultFilter = "writer8_template";
+ myPathSelection.addSelectionListener(new myPathSelectionListener());
+ }
+
+ private void insertIcons()
+ {
+ try
+ {
+ Object oGS = xMSF.createInstance("com.sun.star.graphic.GraphicProvider");
+ XGraphicProvider xGraphicProvider = (XGraphicProvider) UnoRuntime.queryInterface(XGraphicProvider.class, oGS);
+
+ PropertyValue GraphicValues[] = new PropertyValue[1];
+ GraphicValues[0] = new PropertyValue();
+ GraphicValues[0].Name = "URL";
+ GraphicValues[0].Value = "private:resource/svx/imagelist/18000/18022";
+ XGraphic xGraphic = xGraphicProvider.queryGraphic(GraphicValues);
+
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ private void updateUI()
+ {
+ UnoDataAware.updateUI(mainDA);
+ UnoDataAware.updateUI(faxDA);
+ }
+
+ 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)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ 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);
+
+ setControlProperty("lstBusinessStyle", "StringItemList", BusinessFiles[0]);
+ setControlProperty("lstPrivateStyle", "StringItemList", PrivateFiles[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;
+ }
+ }
+
+ 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()
+ {
+ setControlProperty("lstSalutation", "StringItemList", resources.SalutationLabels);
+ }
+
+ public void initializeGreeting()
+ {
+ setControlProperty("lstGreeting", "StringItemList", resources.GreetingLabels);
+ }
+
+ public void initializeCommunication()
+ {
+ setControlProperty("lstCommunicationType", "StringItemList", resources.CommunicationLabels);
+ }
+
+ private void setDefaultForGreetingAndSalutationAndCommunication()
+ {
+ XTextComponent xTextComponent;
+ xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ if (xTextComponent.getText().equals(""))
+ {
+ xTextComponent.setText(resources.SalutationLabels[0]);
+ }
+ xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ if (xTextComponent.getText().equals(""))
+ {
+ xTextComponent.setText(resources.GreetingLabels[0]);
+ }
+ xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
+ if (xTextComponent.getText().equals(""))
+ {
+ xTextComponent.setText(resources.CommunicationLabels[0]);
+ }
+ }
+
+ 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(UnoDataAware.attachListBox(myConfig.cp_BusinessFax, "cp_Style", lstBusinessStyle, null, true));
+ mainDA.add(UnoDataAware.attachListBox(myConfig.cp_PrivateFax, "cp_Style", lstPrivateStyle, null, true));
+
+ CGFax cgl = myConfig.cp_BusinessFax;
+
+ faxDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintCompanyLogo", chkUseLogo, null, true));
+ faxDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintSubjectLine", chkUseSubject, null, true));
+ faxDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintSalutation", chkUseSalutation, null, true));
+ faxDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintDate", chkUseDate, null, true));
+ faxDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintCommunicationType", chkUseCommunicationType, null, true));
+ faxDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintGreeting", chkUseGreeting, null, true));
+ faxDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintFooter", chkUseFooter, null, true));
+ 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(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(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(UnoDataAware.attachEditControl(cgl, "cp_TemplateName", txtTemplateName, null, true));
+ faxDA.add(UnoDataAware.attachEditControl(cgl, "cp_TemplatePath", myPathSelection.xSaveTextBox, null, true));
+
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace();
+ }
+
+ }
+
+ 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)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void setConfiguration()
+ {
+ //set correct Configuration tree:
+ if (optBusinessFax.getState())
+ {
+ optBusinessFaxItemChanged();
+ }
+ if (optPrivateFax.getState())
+ {
+ optPrivateFaxItemChanged();
+ }
+ }
+
+ 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);
+ setControlProperty("lstPrivateStyle", "Enabled", Boolean.FALSE);
+ lstBusinessStyleItemChanged();
+ enableSenderReceiver();
+ setPossibleFooter(true);
+ }
+
+ public void lstBusinessStyleItemChanged()
+ {
+ xTextDocument = myFaxDoc.loadAsPreview(BusinessFiles[1][lstBusinessStyle.getSelectedItemPos()], false);
+ initializeElements();
+ setElements();
+ }
+
+ 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);
+ setControlProperty("lstPrivateStyle", "Enabled", Boolean.TRUE);
+ lstPrivateStyleItemChanged();
+ disableSenderReceiver();
+ setPossibleFooter(false);
+ }
+
+ public void lstPrivateStyleItemChanged()
+ {
+ xTextDocument = myFaxDoc.loadAsPreview(PrivateFiles[1][lstPrivateStyle.getSelectedItemPos()], false);
+ initializeElements();
+ setElements();
+ }
+
+ public void txtTemplateNameTextChanged()
+ {
+ XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentProperties xDocProps = xDocPropsSuppl.getDocumentProperties();
+ String TitleName = txtTemplateName.getText();
+ xDocProps.setTitle(TitleName);
+ }
+
+ public void optSenderPlaceholderItemChanged()
+ {
+ setControlProperty("lblSenderName", "Enabled", Boolean.FALSE);
+ setControlProperty("lblSenderStreet", "Enabled", Boolean.FALSE);
+ setControlProperty("lblPostCodeCity", "Enabled", Boolean.FALSE);
+ setControlProperty("lblSenderFax", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderName", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderStreet", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderPostCode", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderState", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderCity", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderFax", "Enabled", Boolean.FALSE);
+ myFaxDoc.fillSenderWithUserData();
+ }
+
+ public void optSenderDefineItemChanged()
+ {
+ setControlProperty("lblSenderName", "Enabled", Boolean.TRUE);
+ setControlProperty("lblSenderStreet", "Enabled", Boolean.TRUE);
+ setControlProperty("lblPostCodeCity", "Enabled", Boolean.TRUE);
+ setControlProperty("lblSenderFax", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderName", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderStreet", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderPostCode", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderState", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderCity", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderFax", "Enabled", Boolean.TRUE);
+ txtSenderNameTextChanged();
+ txtSenderStreetTextChanged();
+ txtSenderPostCodeTextChanged();
+ txtSenderStateTextChanged();
+ txtSenderCityTextChanged();
+ txtSenderFaxTextChanged();
+ }
+
+ public void optReceiverPlaceholderItemChanged()
+ {
+ OfficeDocument.attachEventCall(xTextDocument, "OnNew", "StarBasic", "macro:///Template.Correspondence.Placeholder()");
+ }
+
+ public void optReceiverDatabaseItemChanged()
+ {
+ OfficeDocument.attachEventCall(xTextDocument, "OnNew", "StarBasic", "macro:///Template.Correspondence.Database()");
+ }
+
+ public void optCreateFaxItemChanged()
+ {
+ bEditTemplate = false;
+ }
+
+ public void optMakeChangesItemChanged()
+ {
+ bEditTemplate = true;
+ }
+
+ public void txtSenderNameTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("Company", txtSenderName.getText());
+ }
+
+ public void txtSenderStreetTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("Street", txtSenderStreet.getText());
+ }
+
+ public void txtSenderCityTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("City", txtSenderCity.getText());
+ }
+
+ public void txtSenderPostCodeTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("PostCode", txtSenderPostCode.getText());
+ }
+
+ public void txtSenderStateTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("State", txtSenderState.getText());
+ }
+
+ public void txtSenderFaxTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myFaxDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("Fax", txtSenderFax.getText());
+ }
+ //switch Elements on/off -------------------------------------------------------
+ public void setElements()
+ {
+ //UI relevant:
+ if (optSenderDefine.getState())
+ {
+ optSenderDefineItemChanged();
+ }
+ if (optSenderPlaceholder.getState())
+ {
+ optSenderPlaceholderItemChanged();
+ }
+ chkUseLogoItemChanged();
+ chkUseSubjectItemChanged();
+ chkUseSalutationItemChanged();
+ chkUseGreetingItemChanged();
+ chkUseCommunicationItemChanged();
+ chkUseDateItemChanged();
+ chkUseFooterItemChanged();
+ txtTemplateNameTextChanged();
+
+ //not UI relevant:
+ if (optReceiverDatabase.getState())
+ {
+ optReceiverDatabaseItemChanged();
+ }
+ if (optReceiverPlaceholder.getState())
+ {
+ optReceiverPlaceholderItemChanged();
+ }
+ if (optCreateFax.getState())
+ {
+ optCreateFaxItemChanged();
+ }
+ if (optMakeChanges.getState())
+ {
+ optMakeChangesItemChanged();
+ }
+ }
+
+ public void chkUseLogoItemChanged()
+ {
+ if (myFaxDoc.hasElement("Company Logo"))
+ {
+ myFaxDoc.switchElement("Company Logo", (chkUseLogo.getState() != 0));
+ }
+ }
+
+ public void chkUseSubjectItemChanged()
+ {
+ if (myFaxDoc.hasElement("Subject Line"))
+ {
+ myFaxDoc.switchElement("Subject Line", (chkUseSubject.getState() != 0));
+ }
+ }
+
+ public void chkUseDateItemChanged()
+ {
+ if (myFaxDoc.hasElement("Date"))
+ {
+ myFaxDoc.switchElement("Date", (chkUseDate.getState() != 0));
+ }
+ }
+
+ 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());
+ myFaxDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
+ }
+ else
+ {
+ myFaxDoc.switchFooter("First Page", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
+ myFaxDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
+ }
+
+ //enable/disable roadmap item for footer page
+ XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER);
+ Helper.setUnoPropertyValue(BPaperItem, "Enabled", new Boolean(bFooterPossible));
+
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void chkFooterNextPagesItemChanged()
+ {
+ chkUseFooterItemChanged();
+ }
+
+ public void chkFooterPageNumbersItemChanged()
+ {
+ chkUseFooterItemChanged();
+ }
+
+ public void txtFooterTextChanged()
+ {
+ chkUseFooterItemChanged();
+ }
+
+ 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()
+ {
+ XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ myFaxDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
+ }
+
+ public void lstSalutationTextChanged()
+ {
+ }
+
+ 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()
+ {
+ XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
+ myFaxDoc.switchUserField("CommunicationType", xTextComponent.getText(), (chkUseCommunicationType.getState() != 0));
+ }
+
+ public void lstCommunicationTextChanged()
+ {
+ }
+
+ 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()
+ {
+ XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ myFaxDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
+ }
+
+ public void lstGreetingTextChanged()
+ {
+ }
+
+ private void setPossibleFooter(boolean bState)
+ {
+ setControlProperty("chkUseFooter", "Enabled", new Boolean(bState));
+ if (!bState)
+ {
+ chkUseFooter.setState((short) 0);
+ }
+ chkUseFooterItemChanged();
+ }
+
+ private void enableSenderReceiver()
+ {
+ XInterface BPaperItem = getRoadmapItemByID(RM_SENDERRECEIVER);
+ Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.TRUE);
+ }
+
+ 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
new file mode 100644
index 000000000000..0043d25590d8
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.java
@@ -0,0 +1,182 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+{
+
+ final static String UNIT_NAME = "dbwizres";
+ final static String MODULE_NAME = "dbw";
+ final static int RID_FAXWIZARDDIALOG_START = 3200;
+ final static int RID_FAXWIZARDCOMMUNICATION_START = 3270;
+ final static int RID_FAXWIZARDGREETING_START = 3280;
+ 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;
+ String resoptPrivateFax_value;
+ String reschkUseLogo_value;
+ String reschkUseSubject_value;
+ String reschkUseSalutation_value;
+ String reschkUseGreeting_value;
+ String reschkUseFooter_value;
+ String resoptSenderPlaceholder_value;
+ String resoptSenderDefine_value;
+ String restxtTemplateName_value;
+ String resoptCreateFax_value;
+ String resoptMakeChanges_value;
+ String reslblBusinessStyle_value;
+ String reslblPrivateStyle_value;
+ String reslblIntroduction_value;
+ String reslblSenderAddress_value;
+ String reslblSenderName_value;
+ String reslblSenderStreet_value;
+ String reslblPostCodeCity_value;
+ String reslblFooter_value;
+ String reslblFinalExplanation1_value;
+ String reslblFinalExplanation2_value;
+ String reslblTemplateName_value;
+ String reslblTemplatePath_value;
+ String reslblProceed_value;
+ String reslblTitle1_value;
+ String reslblTitle3_value;
+ String reslblTitle4_value;
+ String reslblTitle5_value;
+ String reslblTitle6_value;
+ String reschkFooterNextPages_value;
+ String reschkFooterPageNumbers_value;
+ String reschkUseDate_value;
+ String reschkUseCommunicationType_value;
+ String resLabel1_value;
+ String resoptReceiverPlaceholder_value;
+ String resoptReceiverDatabase_value;
+ String resLabel2_value;
+
+ public FaxWizardDialogResources(XMultiServiceFactory xmsf)
+ {
+ super(xmsf, UNIT_NAME, MODULE_NAME);
+ /**
+ * Delete the String, uncomment the getResText method
+ *
+ */
+ resFaxWizardDialog_title = getResText(RID_FAXWIZARDDIALOG_START + 1);
+ resLabel9_value = getResText(RID_FAXWIZARDDIALOG_START + 2);
+ resoptBusinessFax_value = getResText(RID_FAXWIZARDDIALOG_START + 3);
+ resoptPrivateFax_value = getResText(RID_FAXWIZARDDIALOG_START + 4);
+ reschkUseLogo_value = getResText(RID_FAXWIZARDDIALOG_START + 5);
+ reschkUseSubject_value = getResText(RID_FAXWIZARDDIALOG_START + 6);
+ reschkUseSalutation_value = getResText(RID_FAXWIZARDDIALOG_START + 7);
+ reschkUseGreeting_value = getResText(RID_FAXWIZARDDIALOG_START + 8);
+ reschkUseFooter_value = getResText(RID_FAXWIZARDDIALOG_START + 9);
+ resoptSenderPlaceholder_value = getResText(RID_FAXWIZARDDIALOG_START + 10);
+ resoptSenderDefine_value = getResText(RID_FAXWIZARDDIALOG_START + 11);
+ restxtTemplateName_value = getResText(RID_FAXWIZARDDIALOG_START + 12);
+ resoptCreateFax_value = getResText(RID_FAXWIZARDDIALOG_START + 13);
+ resoptMakeChanges_value = getResText(RID_FAXWIZARDDIALOG_START + 14);
+ reslblBusinessStyle_value = getResText(RID_FAXWIZARDDIALOG_START + 15);
+ reslblPrivateStyle_value = getResText(RID_FAXWIZARDDIALOG_START + 16);
+ reslblIntroduction_value = getResText(RID_FAXWIZARDDIALOG_START + 17);
+ reslblSenderAddress_value = getResText(RID_FAXWIZARDDIALOG_START + 18);
+ reslblSenderName_value = getResText(RID_FAXWIZARDDIALOG_START + 19);
+ reslblSenderStreet_value = getResText(RID_FAXWIZARDDIALOG_START + 20);
+ reslblPostCodeCity_value = getResText(RID_FAXWIZARDDIALOG_START + 21);
+ reslblFooter_value = getResText(RID_FAXWIZARDDIALOG_START + 22);
+ reslblFinalExplanation1_value = getResText(RID_FAXWIZARDDIALOG_START + 23);
+ reslblFinalExplanation2_value = getResText(RID_FAXWIZARDDIALOG_START + 24);
+ reslblTemplateName_value = getResText(RID_FAXWIZARDDIALOG_START + 25);
+ reslblTemplatePath_value = getResText(RID_FAXWIZARDDIALOG_START + 26);
+ reslblProceed_value = getResText(RID_FAXWIZARDDIALOG_START + 27);
+ reslblTitle1_value = getResText(RID_FAXWIZARDDIALOG_START + 28);
+ reslblTitle3_value = getResText(RID_FAXWIZARDDIALOG_START + 29);
+ reslblTitle4_value = getResText(RID_FAXWIZARDDIALOG_START + 30);
+ reslblTitle5_value = getResText(RID_FAXWIZARDDIALOG_START + 31);
+ reslblTitle6_value = getResText(RID_FAXWIZARDDIALOG_START + 32);
+ reschkFooterNextPages_value = getResText(RID_FAXWIZARDDIALOG_START + 33);
+ reschkFooterPageNumbers_value = getResText(RID_FAXWIZARDDIALOG_START + 34);
+ reschkUseDate_value = getResText(RID_FAXWIZARDDIALOG_START + 35);
+ reschkUseCommunicationType_value = getResText(RID_FAXWIZARDDIALOG_START + 36);
+ resLabel1_value = getResText(RID_FAXWIZARDDIALOG_START + 37);
+ resoptReceiverPlaceholder_value = getResText(RID_FAXWIZARDDIALOG_START + 38);
+ resoptReceiverDatabase_value = getResText(RID_FAXWIZARDDIALOG_START + 39);
+ resLabel2_value = getResText(RID_FAXWIZARDDIALOG_START + 40);
+ loadRoadmapResources();
+ loadSalutationResources();
+ loadGreetingResources();
+ loadCommunicationResources();
+ 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++)
+ {
+ 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 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);
+ }
+ }
+} \ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/fax/MANIFEST.MF b/wizards/com/sun/star/wizards/fax/MANIFEST.MF
new file mode 100644
index 000000000000..4e699ee9073b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.fax.CallWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/fax/makefile.mk b/wizards/com/sun/star/wizards/fax/makefile.mk
new file mode 100644
index 000000000000..247aaf063529
--- /dev/null
+++ b/wizards/com/sun/star/wizards/fax/makefile.mk
@@ -0,0 +1,62 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = fax
+PACKAGE = com$/sun$/star$/wizards$/fax
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar java_uno_accessbridge commonwizards.jar
+
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/fax
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ CallWizard.java \
+ CGFax.java \
+ FaxDocument.java \
+ FaxWizardDialog.java \
+ CGFaxWizard.java \
+ FaxWizardDialogConst.java \
+ FaxWizardDialogResources.java \
+ FaxWizardDialogImpl.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java
new file mode 100644
index 000000000000..9a8e73951c69
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.uno.Type;
+import com.sun.star.wizards.common.Properties;
+
+/** 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
+ * (<CODE>__writeRegistryServiceInfo</CODE>).
+ * @author Bertram Nolte
+ */
+public class CallFormWizard
+{
+
+ /** Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the
+ * component.
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param stringImplementationName The implementation name of the component.
+ * @param xmultiservicefactory The service manager, who gives access to every
+ * known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * 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)
+ {
+ 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;
+ }
+
+ /** Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>.
+ * @return returns true if the operation succeeded
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single
+ * registry key accessible.
+ */
+ 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
+ {
+ private PropertyValue[] m_wizardContext;
+
+ /** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param xmultiservicefactoryInitialization A special service factory
+ * could be introduced while initializing.
+ */
+ public FormWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
+ super();
+ m_serviceFactory = xmultiservicefactoryInitialization;
+ }
+
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.compareTo("start") == 0)
+ {
+ FormWizard CurFormWizard = new FormWizard( m_serviceFactory, m_wizardContext );
+ CurFormWizard.startFormWizard();
+ }
+ }
+ 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 m_serviceFactory;
+
+ /** This method is a member of the interface for initializing an object
+ * directly after its creation.
+ * @param object This array of arbitrary objects will be passed to the
+ * component after its creation.
+ * @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
+ {
+ m_wizardContext = Properties.convertToPropertyValueArray(object);
+ }
+
+ /** 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];
+
+ stringSupportedServiceNames[0] = __serviceName;
+
+ return (stringSupportedServiceNames);
+ }
+
+ /** This method returns true, if the given service will be
+ * supported by the component.
+ * @param stringService Service name.
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService(String stringService)
+ {
+ boolean booleanSupportsService = false;
+
+ 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.
+ * to realise hashing functionality when the object is introspected.
+ * Two objects that return the same ID also have to return
+ * the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to
+ * return an empty sequence. Important: If the object
+ * aggregates other objects the ID has to be unique for the
+ * whole combination of objects.
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId()
+ {
+ byte[] 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 (FormWizardImplementation.class.getName());
+ }
+
+ /** Provides a sequence of all types (usually interface types)
+ * provided by the object.
+ * @return Sequence of all types (usually interface types) provided by the
+ * service.
+ */
+ 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)
+ {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
new file mode 100644
index 000000000000..2844e0b53104
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import com.sun.star.awt.XCheckBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.WizardDialog;
+import com.sun.star.wizards.ui.UIConsts;
+
+public class DataEntrySetter
+{
+
+ private WizardDialog CurUnoDialog;
+ private short curtabindex;
+ private XRadioButton optNewDataOnly;
+ private XRadioButton optDisplayAllData;
+ private XCheckBox chknomodification;
+ private XCheckBox chknodeletion;
+ private XCheckBox chknoaddition;
+
+ public DataEntrySetter(WizardDialog _CurUnoDialog)
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ curtabindex = (short) (FormWizard.SODATA_PAGE * 100);
+ Integer IDataStep = new Integer(FormWizard.SODATA_PAGE);
+ String sNewDataOnly = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 44); //
+ String sDisplayAllData = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 46); //
+ String sNoModification = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 47); // AllowUpdates
+ String sNoDeletion = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 48); // AllowDeletes
+ 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)
+ });
+
+ 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()
+ {
+ PropertyValue[] retProperties;
+ 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;
+ boolean bAllowInserts = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknoaddition), "State")).shortValue()) != 1;
+ retProperties[0] = Properties.createProperty("AllowUpdates", new Boolean(bAllowUpdates));
+ retProperties[1] = Properties.createProperty("AllowDeletes", new Boolean(bAllowDeletes));
+ retProperties[2] = Properties.createProperty("AllowInserts", new Boolean(bAllowInserts));
+ }
+ else
+ {
+ retProperties = new PropertyValue[1];
+ retProperties[0] = Properties.createProperty("IgnoreResult", new Boolean(true));
+ }
+ return retProperties;
+
+ }
+
+ 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
new file mode 100644
index 000000000000..f5555421a4b3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FieldLinker.java
@@ -0,0 +1,312 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import com.sun.star.awt.ItemEvent;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XListBox;
+import com.sun.star.uno.Exception;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.db.RelationController;
+import com.sun.star.wizards.ui.UnoDialog;
+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
+{
+
+ private XFixedText[] lblSlaveFields;
+ private XFixedText[] lblMasterFields;
+ private XListBox[] lstSlaveFields;
+ private XListBox[] lstMasterFields;
+ private final int SOMASTERINDEX = 1;
+ private final int SOSLAVEINDEX = 0;
+ private int SOFIRSTLINKLST = 0;
+ private int SOSECLINKLST = 1;
+ private int SOTHIRDLINKLST = 2;
+ private int SOFOURTHLINKLST = 3;
+ private int[] SOLINKLST = null;
+ private String[] sSlaveListHeader;
+ private String[] sMasterListHeader; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
+ private String sSlaveHidString;
+ private String sMasterHidString;
+ private Integer IListBoxPosX;
+
+ 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",
+ "LineCount",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE,
+ new Boolean(bDoEnable),
+ UIConsts.INTEGER_12,
+ sSlaveHidString,
+ Short.valueOf(UnoDialog.getListBoxLineCount()),
+ 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",
+ "LineCount",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE,
+ new Boolean(bDoEnable),
+ UIConsts.INTEGER_12,
+ sMasterHidString,
+ Short.valueOf(UnoDialog.getListBoxLineCount()),
+ 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)
+ {
+ // setMaxSelIndex();
+ boolean bSlaveField = lstSlaveFields[curindex].getSelectedItemPos() > 0;
+ boolean bMasterField = lstMasterFields[curindex].getSelectedItemPos() > 0;
+ boolean bDoEnable = (bSlaveField && bMasterField);
+ if (!bDoEnable)
+ {
+ moveupSelectedItems(curindex, bDoEnable);
+ }
+ else
+ {
+ toggleControlRow(curindex + 1, true);
+ }
+ }
+
+ protected int getMaxSelIndex()
+ {
+ int MaxSelIndex = -1;
+ for (int i = 0; i < rowcount; i++)
+ {
+ if ((lstSlaveFields[i].getSelectedItemPos() > 0) && (lstMasterFields[i].getSelectedItemPos() > 0))
+ {
+ MaxSelIndex += 1;
+ }
+ }
+ return MaxSelIndex;
+ }
+
+ 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 });
+ }
+ }
+ }
+
+ 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});
+
+ 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)
+ {
+ // short[] MasterSelList = null;
+ // short[] SlaveSelList = null;
+ String[] MasterLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOMASTERINDEX);
+ String[] SlaveLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOSLAVEINDEX);
+ String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames); // add '-undefiened-'
+ String[] ViewSlaveFieldNames = addNoneFieldItemToList(_AllSlaveFieldNames);
+ 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)
+ {
+ return _oRelationController.getImportedKeyColumns(_sReferencedTableName);
+ }
+
+ /**
+ * @return the LinkFieldnames of the joins. When no LinkFieldNames were selected the returned Array is empty.
+ * When Joins were assigned duplicate a null value is returned
+ *
+ */
+ public String[][] getLinkFieldNames()
+ {
+ // setMaxSelIndex();
+ int nSelectedIndex = getMaxSelIndex();
+ String[][] LinkFieldNames = new String[2][nSelectedIndex + 1];
+ for (int i = 0; i <= nSelectedIndex; i++)
+ {
+ LinkFieldNames[0][i] = lstSlaveFields[i].getSelectedItem();
+ LinkFieldNames[1][i] = lstMasterFields[i].getSelectedItem();
+ }
+ int iduplicate = JavaTools.getDuplicateFieldIndex(LinkFieldNames);
+ if (iduplicate != -1)
+ {
+ String sLinkFieldsAreDuplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 19);
+ String sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLinkFieldsAreDuplicate, LinkFieldNames[0][iduplicate], "<FIELDNAME1>");
+ sLocLinkFieldsAreDuplicate = JavaTools.replaceSubString(sLocLinkFieldsAreDuplicate, LinkFieldNames[1][iduplicate], "<FIELDNAME2>");
+ CurUnoDialog.setCurrentStep(FormWizard.SOFIELDLINKER_PAGE);
+ CurUnoDialog.enableNavigationButtons(true, true, true);
+ CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sLocLinkFieldsAreDuplicate);
+ CurUnoDialog.setFocus("lstSlaveFieldLink" + (iduplicate + 1));
+ return null;
+ }
+ return LinkFieldNames;
+
+ }
+
+ public void enable(boolean _bdoenable)
+ {
+ CurUnoDialog.setStepEnabled(IStep.intValue(), _bdoenable);
+ }
+
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
+
+ public void itemStateChanged(ItemEvent EventObject)
+ {
+ int ikey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
+ enableNextControlRow(ikey);
+ }
+
+ 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
new file mode 100644
index 000000000000..fa1f9ce56074
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/Finalizer.java
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.ui.*;
+
+/**
+ * @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 Finalizer
+{
+
+ WizardDialog CurUnoDialog;
+ short curtabindex;
+ XRadioButton optModifyForm;
+ XRadioButton optWorkWithForm;
+ XTextComponent txtFormName;
+ FormDocument oFormDocument;
+
+ public Finalizer(WizardDialog _CurUnoDialog)
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ curtabindex = (short) (FormWizard.SOSTORE_PAGE * 100);
+
+ String slblFormName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 50);
+ String slblProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 51);
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ }
+
+ 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));
+ }
+ }
+
+ public void toggleFinishButton()
+ {
+ CurUnoDialog.enableFinishButton(txtFormName.getText().length() > 0);
+ }
+
+ public String getName()
+ {
+ return txtFormName.getText();
+ }
+
+ public boolean getOpenForEditing()
+ {
+ return optModifyForm.getState() ? true : false;
+ }
+
+ public boolean finish()
+ {
+// if (!oFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sFormName)){
+ 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
new file mode 100644
index 000000000000..8e2c36ae0966
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import com.sun.star.awt.XCheckBox;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.WizardDialog;
+import com.sun.star.wizards.db.RelationController;
+
+/**
+ * @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 FormConfiguration
+{
+
+ WizardDialog CurUnoDialog;
+ short curtabindex;
+ XRadioButton optOnExistingRelation;
+ XCheckBox chkcreateSubForm;
+ XRadioButton optSelectManually;
+ XFixedText lblSubFormDescription;
+ XFixedText lblRelations;
+ XListBox lstRelations;
+ String[] sreferencedTables;
+ // Integer ISubFormStep;
+ CommandFieldSelection CurSubFormFieldSelection;
+ String SSUBFORMMODE = "toggleSubFormMode";
+ String STOGGLESTEPS = "toggleSteps";
+ String SONEXISTINGRELATIONSELECTION = "onexistingRelationSelection";
+ boolean bsupportsRelations;
+ RelationController oRelationController = null;
+
+ public FormConfiguration(WizardDialog _CurUnoDialog)
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ curtabindex = (short) (FormWizard.SOSUBFORM_PAGE * 100);
+ Integer ISubFormStep = new Integer(FormWizard.SOSUBFORM_PAGE);
+ String sOnExistingRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 5);
+ String sOnManualRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 7);
+ String sSelectManually = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 4);
+ String sSelectRelation = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 8);
+ String sSubFormDescription = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 3);
+
+ // CheckBox 'Add sub form'
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ CurUnoDialog.insertInfoImage(97, 120, ISubFormStep.intValue());
+ }
+
+ // public void disableSubFormCheckBox()
+ // {
+ // Helper.setUnoPropertyValue(UnoDialog.getModel(chkcreateSubForm), "Enabled", Boolean.FALSE);
+ // }
+
+ public RelationController getRelationController()
+ {
+ return oRelationController;
+ }
+
+ public boolean areexistingRelationsdefined()
+ {
+ return ((chkcreateSubForm.getState() == 1) && (optOnExistingRelation.getState()));
+ }
+
+ 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)
+ {
+ oRelationController = _oRelationController;
+ sreferencedTables = oRelationController.getExportedKeys();
+ bsupportsRelations = (sreferencedTables.length > 0);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), "StringItemList", sreferencedTables);
+ this.CurSubFormFieldSelection = _CurSubFormFieldSelection;
+ toggleRelationsListbox();
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), "Enabled", new Boolean(bsupportsRelations && (chkcreateSubForm.getState() == 1)));
+ }
+
+ public void toggleSteps()
+ {
+ boolean bDoEnableFollowingSteps;
+ if (chkcreateSubForm.getState() == 1)
+ {
+ if (optOnExistingRelation.getState())
+ {
+ onexistingRelationSelection();
+ }
+ else if (optSelectManually.getState())
+ {
+ CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, (CurSubFormFieldSelection.getSelectedFieldNames().length > 0));
+ CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true);
+ }
+ }
+ else
+ {
+ CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, false);
+ CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false);
+ CurUnoDialog.enablefromStep(FormWizard.SOCONTROL_PAGE, true);
+ }
+ toggleRelationsListbox();
+ }
+
+ public String getreferencedTableName()
+ {
+ if (areexistingRelationsdefined())
+ {
+ short[] iselected = (short[]) Helper.getUnoArrayPropertyValue(UnoDialog.getModel(lstRelations), "SelectedItems");
+ if (iselected != null)
+ {
+ if (iselected.length > 0)
+ {
+ return sreferencedTables[iselected[0]];
+ }
+ }
+ }
+ return "";
+ }
+
+ public void onexistingRelationSelection()
+ {
+ String scurreferencedTableName = getreferencedTableName();
+ if (scurreferencedTableName.length() > 0)
+ {
+ if (CurSubFormFieldSelection.getSelectedCommandName().equals(scurreferencedTableName))
+ {
+ CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, true);
+ CurUnoDialog.setStepEnabled(FormWizard.SOFIELDLINKER_PAGE, false);
+ return;
+ }
+ else
+ {
+ CurUnoDialog.setStepEnabled(FormWizard.SOSUBFORMFIELDS_PAGE, true);
+ CurUnoDialog.enablefromStep(FormWizard.SOFIELDLINKER_PAGE, false);
+ return;
+ }
+ }
+ CurUnoDialog.enablefromStep(FormWizard.SOSUBFORMFIELDS_PAGE, false);
+ }
+
+ 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()
+ {
+ 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
new file mode 100644
index 000000000000..9a0c58fd41b8
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java
@@ -0,0 +1,731 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.task.XStatusIndicator;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.db.*;
+import com.sun.star.wizards.document.Control;
+import com.sun.star.wizards.document.DatabaseControl;
+import com.sun.star.wizards.document.FormHandler;
+import com.sun.star.wizards.document.Shape;
+import com.sun.star.wizards.document.TimeStampControl;
+
+public class FormControlArranger
+{
+
+ protected DatabaseControl[] DBControlList = null;
+
+ private XNameContainer xFormName;
+ private XMultiServiceFactory xMSF;
+ private Control[] LabelControlList = null;
+ private XStatusIndicator xProgressBar;
+ private FieldColumn[] FieldColumns;
+ private DatabaseControl curDBControl;
+ // Control curLabelControl;
+ private int icurArrangement;
+ private boolean bIsFirstRun;
+ private boolean bIsVeryFirstRun;
+ private boolean bControlsareCreated;
+ private int cXOffset;
+ private int cYOffset;
+ private static final int cVertDistance = 200;
+ private static final int cHoriDistance = 300;
+ private static final int cLabelGap = 100;
+ private static final double CMAXREDUCTION = 0.7;
+ private FormHandler oFormHandler;
+ private int iReduceWidth;
+ private int nXTCPos;
+ private int nYTCPos;
+ private int nXDBPos;
+ private int nYDBPos;
+ private int nTCHeight;
+ private int nTCWidth;
+ private int nDBHeight;
+ private int nDBWidth;
+ private int nMaxTCWidth;
+ private int nFormWidth;
+ private int nFormHeight;
+ private int nMaxRowY;
+ private int nSecMaxRowY;
+ private int nMaxColRightX;
+ private int a;
+ private int StartA;
+ private int nMaxDBYPos = 0; //the maximum YPosition of a DBControl in the form
+ private Short NBorderType = new Short((short) 1); //3-D Border
+
+ public FormControlArranger(FormHandler _oFormHandler, XNameContainer _xFormName, CommandMetaData oDBMetaData, XStatusIndicator _xProgressBar, Point _StartPoint, Size _FormSize)
+ {
+ FieldColumns = oDBMetaData.FieldColumns;
+ xMSF = oDBMetaData.xMSF;
+ xFormName = _xFormName;
+ xProgressBar = _xProgressBar;
+ LabelControlList = new Control[FieldColumns.length];
+ DBControlList = new DatabaseControl[FieldColumns.length];
+ oFormHandler = _oFormHandler;
+ cXOffset = _StartPoint.X;
+ 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)
+ {
+ if (curDBControl.getControlType() == FormHandler.SOCHECKBOX)
+ {
+ return getCheckBoxDiffHeight(_index);
+ }
+ }
+ return oFormHandler.getBasicLabelDiffHeight();
+ }
+
+ public void setBorderType(short _nBorderType)
+ {
+ NBorderType = new Short(_nBorderType);
+ }
+
+ public Control[] getLabelControlList()
+ {
+ return LabelControlList;
+ }
+
+ private int getCheckBoxDiffHeight(int LastIndex)
+ {
+ if ((LastIndex < DBControlList.length))
+ {
+ if (DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX)
+ {
+ return (int) ((oFormHandler.getControlReferenceHeight() - DBControlList[LastIndex].getControlHeight()) / 2);
+ }
+ }
+ return 0;
+ }
+
+ private boolean isReducable(int _index)
+ {
+ boolean bisreducable = false;
+ int ntype = this.FieldColumns[_index].getFieldType();
+ switch (ntype)
+ {
+ case DataType.TINYINT:
+ case DataType.SMALLINT:
+ case DataType.INTEGER:
+ case DataType.FLOAT:
+ case DataType.DATE:
+ case DataType.TIME:
+ case DataType.TIMESTAMP:
+ case DataType.REAL:
+ case DataType.DOUBLE:
+ case DataType.NUMERIC:
+ case DataType.DECIMAL:
+ case DataType.BIT:
+ case DataType.BOOLEAN:
+ bisreducable = false;
+ break;
+ case DataType.VARCHAR:
+ short nTextLen;
+ try
+ {
+ nTextLen = AnyConverter.toShort(DBControlList[_index].xPropertySet.getPropertyValue("MaxTextLen"));
+ if ((nTextLen == 0) || (nTextLen > 20))
+ {
+ bisreducable = true;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ break;
+ case DataType.BIGINT:
+ bisreducable = true;
+ break;
+ default:
+ bisreducable = true;
+ }
+ if (nTCWidth > 0.9 * CMAXREDUCTION * nDBWidth)
+ {
+ bisreducable = false;
+ }
+ return bisreducable;
+ }
+
+ private int getControlGroupWidth()
+ {
+ if (nDBWidth > nTCWidth)
+ {
+ return nDBWidth;
+ }
+ else
+ {
+ return nTCWidth;
+ }
+ }
+
+ 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)
+ {
+ // Fieldwidths in the line can be made smaller..
+ adjustLineWidth(StartA, a, nLeftDist, -1);
+ nYTCPos = nMaxRowY + cVertDistance;
+ nYDBPos = nYTCPos + nTCHeight;
+// if ((nYDBPos + nDBHeight) > nMaxDBYPos)
+// nMaxDBYPos = nYDBPos + nDBHeight;
+ nXTCPos = cXOffset;
+ nXDBPos = cXOffset;
+ bIsFirstRun = true;
+ StartA = a + 1;
+ }
+ else
+ {
+ // FieldWidths in the line can be made wider...
+ 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;
+ this.LabelControlList[a].setPosition(new Point(cXOffset, nYTCPos));
+ 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);
+ StartA = a;
+ }
+ }
+
+ private int getCorrWidth(int StartIndex, int EndIndex, int nDist, int Widthfactor)
+ {
+ int ShapeCount;
+ if (Widthfactor > 0)
+ {
+ // shapes are made wide
+ ShapeCount = EndIndex - StartIndex + 1;
+ }
+ else
+ {
+ // shapes are made more narrow
+ ShapeCount = iReduceWidth;
+ }
+ return (nDist) / ShapeCount;
+ }
+
+ /**
+ *
+ * @param StartIndex
+ * @param EndIndex
+ * @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)
+ {
+ int CorrWidth = getCorrWidth(StartIndex, EndIndex, nDist, WidthFactor);
+ int iLocTCPosX = cXOffset;
+ for (int i = StartIndex; i <= EndIndex; i++)
+ {
+ int nControlBaseWidth = 0;
+ curDBControl = this.DBControlList[i];
+ Control 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 (((curLabelControl.getSize().Width > curDBControl.getSize().Width)) && (WidthFactor > 0))
+ {
+ nControlBaseWidth = curLabelControl.getSize().Width;
+ }
+ else
+ {
+ nControlBaseWidth = curDBControl.getSize().Width;
+ }
+ if (FieldColumns[i].getFieldType() == 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));
+ }
+ }
+ else
+ {
+ if (this.isReducable(i) || WidthFactor > 0)
+ {
+ 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)
+ {
+ int nColRightX;
+ if (icurArrangement == FormWizard.SOTOPJUSTIFIED)
+ {
+ if (bIsDBField)
+ {
+ // Only at DBControls you can measure the Value of nMaxRowY
+ if (bIsFirstRun)
+ {
+ nMaxRowY = nYPos + nHeight;
+ nSecMaxRowY = nMaxRowY;
+ }
+ else
+ {
+ int nRowY = nYPos + nHeight;
+ if (nRowY >= nMaxRowY)
+ {
+ int nOldMaxRowY = nMaxRowY;
+ nSecMaxRowY = nOldMaxRowY;
+ nMaxRowY = nRowY;
+ }
+ }
+ }
+ }
+ // Find the outer right point
+ if (bIsFirstRun)
+ {
+ nMaxColRightX = nXPos + nWidth;
+ bIsFirstRun = false;
+ }
+ else
+ {
+ nColRightX = nXPos + nWidth;
+ 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++)
+ {
+ try
+ {
+ insertLabel(i, _iAlign);
+ insertDBControl(i);
+ bIsVeryFirstRun = false;
+ DBControlList[i].setPropertyValue("LabelControl", LabelControlList[i].xPropertySet);
+ resetPosSizes(i);
+ xProgressBar.setValue(i + 1);
+ }
+ catch (RuntimeException e)
+ {
+ int dummy = 0;
+ }
+ }
+ xProgressBar.end();
+ bControlsareCreated = true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public boolean areControlsexisting()
+ {
+ if (DBControlList != null)
+ {
+ if (DBControlList.length > 0)
+ {
+ return (DBControlList[0] != null);
+ }
+ }
+ return false;
+ }
+
+ private void initializeControlColumn(int LastIndex)
+ {
+ bIsFirstRun = true;
+ StartA = LastIndex + 1;
+ a = 0;
+ }
+
+ private void resetPosSizes(int LastIndex)
+ {
+ int nYRefPos = nYDBPos;
+ switch (icurArrangement)
+ {
+ case FormWizard.SOCOLUMNARLEFT:
+ nYDBPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
+ nYRefPos = nYDBPos;
+ if ((nYDBPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1)))
+ {
+ repositionColumnarLeftControls(LastIndex);
+ nXTCPos = nMaxColRightX + 2 * cHoriDistance;
+ nXDBPos = nXTCPos + this.cLabelGap + nMaxTCWidth;
+ nYDBPos = cYOffset;
+ nYRefPos = nYDBPos;
+ initializeControlColumn(LastIndex);
+ }
+ else
+ {
+ /*a = a + 1;*/
+ /* a += 1;*/
+ ++a;
+ }
+ nYTCPos = nYDBPos + this.getLabelDiffHeight(LastIndex);
+ 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)))
+ {
+ nXDBPos = nMaxColRightX + cHoriDistance;
+ nXTCPos = nXDBPos;
+ nYRefPos = nYDBPos;
+ nYDBPos = cYOffset + nTCHeight + cVertDistance;
+ nYTCPos = cYOffset;
+ initializeControlColumn(LastIndex);
+ }
+ else
+ {
+ a = a + 1;
+ }
+ if ((nYRefPos + nDBHeight + cVertDistance) > nMaxDBYPos)
+ {
+ nMaxDBYPos = nYRefPos + nDBHeight + cVertDistance;
+ }
+ break;
+
+ case FormWizard.SOTOPJUSTIFIED:
+ if (this.isReducable(a))
+ {
+ iReduceWidth = iReduceWidth + 1;
+ }
+ 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)
+ {
+ bIsFirstRun = true;
+ for (int i = StartA; i <= LastIndex; i++)
+ {
+ if (i == StartA)
+ {
+ nXTCPos = LabelControlList[i].getPosition().X;
+ nXDBPos = nXTCPos + nMaxTCWidth + cHoriDistance;
+ }
+ LabelControlList[i].setSize(new Size(nMaxTCWidth, nTCHeight));
+ resetDBShape(DBControlList[i], nXDBPos);
+ checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
+ }
+ }
+
+ 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()
+ {
+ this.nMaxDBYPos = 0;
+ nXTCPos = cXOffset;
+ nTCWidth = 2000;
+ nDBWidth = 2000;
+ nDBHeight = oFormHandler.getControlReferenceHeight();
+ nTCHeight = oFormHandler.getLabelHeight();
+ iReduceWidth = 0;
+ if (icurArrangement == FormWizard.SOCOLUMNARLEFT)
+ {
+ nYTCPos = cYOffset + this.getLabelDiffHeight(0);
+ nXDBPos = cXOffset + 3050;
+ nYDBPos = cYOffset;
+ }
+ 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].getFieldTitle());
+ LabelControlList[i].setSize(new Size(nTCWidth, nTCHeight));
+ }
+ else
+ {
+ nTCWidth = LabelControlList[i].getSize().Width;
+ }
+ }
+ else
+ {
+ Point aPoint = new Point(nXTCPos, nYTCPos);
+ Size aSize = new Size(nTCWidth, nTCHeight);
+ final String sFieldName = FieldColumns[i].getFieldName();
+ this.LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, sFieldName, aPoint, aSize);
+ if (bIsVeryFirstRun)
+ {
+ if (icurArrangement == FormWizard.SOCOLUMNARTOP)
+ {
+ nYDBPos = nYTCPos + nTCHeight;
+ }
+ }
+ String sTitle = FieldColumns[i].getFieldTitle();
+ nTCWidth = LabelControlList[i].getPreferredWidth(sTitle);
+ }
+ Control 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;
+ }
+ }
+ 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);
+ }
+ }
+
+ private void insertDBControl(int i)
+ {
+ try
+ {
+ String sFieldName = FieldColumns[i].getFieldName();
+ int nFieldType = FieldColumns[i].getFieldType();
+
+ Point aPoint = new Point(nXDBPos, nYDBPos);
+ if (bControlsareCreated)
+ {
+ DBControlList[i].setPosition(aPoint);
+ }
+ else
+ {
+ if (nFieldType == DataType.TIMESTAMP)
+ {
+ DBControlList[i] = new TimeStampControl(new Resource(xMSF, "FormWizard", "dbw"), oFormHandler, xFormName, sFieldName, aPoint);
+ }
+ else
+ {
+ DBControlList[i] = new DatabaseControl(oFormHandler, xFormName, sFieldName, nFieldType, aPoint);
+ if (DBControlList[i].getControlType() == FormHandler.SOCHECKBOX)
+ {
+ // Checkboxes have no Label near by
+ DBControlList[i].setPropertyValue("Label", "");
+ }
+ }
+ }
+ DatabaseControl aDBControl = DBControlList[i];
+ nDBHeight = aDBControl.getControlHeight();
+ nDBWidth = aDBControl.getControlWidth();
+ if (nFieldType != DataType.TIMESTAMP)
+ {
+ aDBControl.setSize(new Size(nDBWidth, nDBHeight));
+ }
+ if (aDBControl.getControlType() == FormHandler.SOCHECKBOX)
+ {
+ nYDBPos = nYDBPos + /*(int)*/ ((oFormHandler.getControlReferenceHeight() - nDBHeight) / 2);
+ aPoint = new Point(nXDBPos, nYDBPos);
+ aDBControl.setPosition(aPoint);
+ }
+ if (nFieldType == DataType.LONGVARCHAR) /* memo */
+ {
+ Helper.setUnoPropertyValue(LabelControlList[i], "MultiLine", Boolean.TRUE);
+ }
+ checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
+ aDBControl.setPropertyValue("Border", NBorderType);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ private int assignFieldLength(int _fieldlength)
+ {
+ if (_fieldlength >= 65535)
+ {
+ return -1;
+ }
+ else
+ {
+ return _fieldlength;
+ }
+ }
+
+ public int getFormHeight()
+ {
+ return nMaxDBYPos - this.cYOffset;
+ }
+
+ public int getEntryPointY()
+ {
+ if (this.icurArrangement == FormWizard.SOCOLUMNARTOP)
+ {
+ Control curLabelControl2 = LabelControlList[0];
+ return curLabelControl2.getPosition().Y;
+ }
+ else
+ {
+ DatabaseControl curDBControl2 = DBControlList[0];
+ return curDBControl2.getPosition().Y;
+ }
+ }
+
+ 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++)
+ {
+ 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;
+ }
+
+ 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
new file mode 100644
index 000000000000..ae1a795368e4
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FormDocument.java
@@ -0,0 +1,594 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import java.util.Vector;
+
+import com.sun.star.wizards.text.TextDocument;
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.db.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.text.TextStyleHandler;
+import com.sun.star.wizards.text.ViewHandler;
+import com.sun.star.wizards.document.Control;
+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
+{
+ protected Vector oControlForms = new Vector();
+ protected CommandMetaData oMainFormDBMetaData;
+ protected CommandMetaData oSubFormDBMetaData;
+ protected String[][] LinkFieldNames;
+
+ private FormHandler oFormHandler;
+ private ViewHandler oViewHandler;
+ private TextStyleHandler oTextStyleHandler;
+ private XPropertySet xPropPageStyle;
+ private final int SOFORMGAP = 2000;
+ private boolean bhasSubForm;
+ private UIControlArranger curUIControlArranger;
+ private StyleApplier curStyleApplier;
+ private int nPageWidth;
+ private int nPageHeight;
+ private int nFormWidth;
+ private int nFormHeight;
+ private Point aMainFormPoint;
+ private final static String SOMAINFORM = "MainForm";
+ private final static String SOSUBFORM = "SubForm";
+
+ public FormDocument(XMultiServiceFactory xMSF)
+ {
+ 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;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void addUIFormController(UIControlArranger _curUIControlArranger)
+ {
+ this.curUIControlArranger = _curUIControlArranger;
+ }
+
+ public void addStyleApplier(StyleApplier _curStyleApplier)
+ {
+ this.curStyleApplier = _curStyleApplier;
+ }
+
+ private String getDataSourceName()
+ {
+ return this.oMainFormDBMetaData.DataSourceName;
+ }
+
+ private void adjustPageStyle()
+ {
+ try
+ {
+ int nMargin;
+ int totfieldcount = getMainFieldCount() + getSubFieldCount();
+ 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 _bShouldHaveSubForm, boolean _bModifySubForm, Short _NBorderType)
+ {
+ bhasSubForm = _bShouldHaveSubForm;
+ adjustPageStyle();
+ if (_baddParentForm)
+ {
+ if (oControlForms.size() == 0)
+ {
+ final ControlForm aMainControlForm = new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.SOGRID));
+ oControlForms.addElement(aMainControlForm);
+ }
+ else
+ {
+ oFormHandler.removeControlsofForm(SOMAINFORM);
+ ((ControlForm) oControlForms.get(0)).oFormController = null;
+ }
+ ((ControlForm) oControlForms.get(0)).initialize(curUIControlArranger.getSelectedArrangement(0), _NBorderType);
+ }
+ if (_bShouldHaveSubForm)
+ {
+ if (oControlForms.size() == 1)
+ {
+ adjustMainFormSize(_NBorderType);
+ final ControlForm aSubControlForm = new ControlForm(this, SOSUBFORM, getSubFormPoint(), getSubFormSize());
+ oControlForms.addElement(aSubControlForm);
+ /* ((ControlForm) oControlForms.get(1))*/
+ aSubControlForm.initialize(curUIControlArranger.getSelectedArrangement(1), _NBorderType);
+ }
+ 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
+ {
+ ControlForm aMainForm = (ControlForm) oControlForms.get(0);
+ // boolean bHasSubForm = aMainForm.xFormContainer.hasByName(SOSUBFORM);
+ // WRONG if (oFormHandler.hasFormByName(SOSUBFORM))
+ if (aMainForm.xFormContainer != null && aMainForm.xFormContainer.hasByName(SOSUBFORM))
+ {
+ oFormHandler.removeControlsofForm(SOSUBFORM);
+ oFormHandler.removeElement( aMainForm.xFormContainer, SOSUBFORM );
+ ((ControlForm) oControlForms.get(1)).oFormController = null;
+ // aMainForm.xFormContainer = null; // .removeFormByName(SOSUBFORM);
+ oControlForms.remove(1);
+ adjustMainFormSize(_NBorderType);
+ }
+ }
+ }
+
+ private int getMainFieldCount()
+ {
+ return oMainFormDBMetaData.getFieldNames().length;
+ }
+ private int getSubFieldCount()
+ {
+ return oSubFormDBMetaData.getFieldNames().length;
+ }
+
+ private Size getMainFormSize(int _curArrangement)
+ {
+ int nMainFormHeight = nFormHeight;
+ if (bhasSubForm)
+ {
+ if (_curArrangement == FormWizard.SOGRID)
+ {
+ nMainFormHeight = (int) ((double) (nFormHeight - SOFORMGAP) / 2);
+ }
+ else
+ {
+ int nTotalFieldCount = getMainFieldCount() + getSubFieldCount();
+ nMainFormHeight = (int) (((double) getMainFieldCount() / (double) nTotalFieldCount) * ((double) (nFormHeight - SOFORMGAP) / 2));
+ }
+ }
+ Size aMainFormSize = new Size(nFormWidth, nMainFormHeight);
+ return aMainFormSize;
+ }
+
+ private Size getSubFormSize()
+ {
+// int nSubFormHeight = (int) ((double)nFormHeight/2) - SOFORMGAP;
+// int nSubFormFieldCount = this.oSubFormDBMetaData.FieldNames.length;
+// int totfieldcount = oMainFormDBMetaData.FieldNames.length + nSubFormFieldCount;
+ int nMainFormHeight = ((ControlForm) oControlForms.get(0)).getActualFormHeight();
+ Size aSubFormSize = new Size(nFormWidth, nFormHeight - nMainFormHeight - SOFORMGAP);
+ return aSubFormSize;
+ }
+
+ private Point getSubFormPoint()
+ {
+ ControlForm curMainControlForm = ((ControlForm) oControlForms.get(0));
+ return new Point(curMainControlForm.aStartPoint.X,
+ (curMainControlForm.aStartPoint.Y + curMainControlForm.getFormSize().Height + SOFORMGAP));
+ }
+
+ 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);
+ }
+ }
+
+ 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)
+ {
+ Point aPoint = oSubControlForm.oGridControl.getPosition();
+ 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
+ {
+// oSubControlForm.oFormController.adjustYPositions(_idiffheight);
+ 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++)
+ {
+ ControlForm curControlForm = ((ControlForm) oControlForms.get(i));
+ if (curControlForm.Name.equals(_sname))
+ {
+ return curControlForm;
+ }
+ }
+ return null;
+ }
+
+ public ControlForm[] getControlForms()
+ {
+ return (ControlForm[]) oControlForms.toArray();
+ }
+
+ 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))
+ {
+ 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)
+ {
+ oSubControlForm.xPropertySet.setPropertyValue("DetailFields", LinkFieldNames[0]);
+ oSubControlForm.xPropertySet.setPropertyValue("MasterFields", LinkFieldNames[1]);
+ oSubControlForm.finalizeControls();
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
+ finally
+ {
+ unlockallControllers();
+ }
+ }
+
+ public class ControlForm
+ {
+
+ XNameContainer xFormContainer;
+ GridControl oGridControl;
+ FormControlArranger oFormController;
+ int curArrangement;
+ FormDocument oFormDocument;
+ String Name;
+ Point aStartPoint;
+ private Size aFormSize;
+ CommandMetaData oDBMetaData;
+ XPropertySet xPropertySet;
+
+ public ControlForm(FormDocument _oFormDocument, String _sname, Point _astartPoint, Size _aFormSize)
+ {
+ aStartPoint = _astartPoint;
+ aFormSize = _aFormSize;
+ oFormDocument = _oFormDocument;
+ Name = _sname;
+ 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)
+ {
+ boolean badaptControlStyles = false;
+ xTextDocument.lockControllers();
+ curArrangement = _curArrangement;
+ 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)
+ {
+ oFormHandler.moveShapesToNirwana(getLabelControls());
+ oFormHandler.moveShapesToNirwana(getDatabaseControls());
+ }
+ }
+ if (curArrangement == FormWizard.SOGRID)
+ {
+ insertGridControl(_NBorderType);
+ badaptControlStyles = true;
+ }
+ 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))
+ {
+ ControlForm curSubControlForm = ((ControlForm) oControlForms.get(1));
+ if (curSubControlForm != null)
+ {
+ adjustSubFormPosSize(_NBorderType);
+ }
+ }
+ setFormSize(new Size(aFormSize.Width, getActualFormHeight()));
+ unlockallControllers();
+ }
+
+ public Control[] getLabelControls()
+ {
+ if (oFormController != null)
+ {
+ return oFormController.getLabelControlList();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Size getFormSize()
+ {
+ return aFormSize;
+ }
+
+ private Size getAvailableFormSize()
+ {
+ if (this.Name.equals(SOMAINFORM))
+ {
+ setFormSize(getMainFormSize(curArrangement));
+ }
+ else
+ {
+ setFormSize(getSubFormSize());
+ }
+ return aFormSize;
+ }
+
+ public void setFormSize(Size _aSize)
+ {
+ aFormSize = _aSize;
+ oFormController.setFormSize(aFormSize);
+ }
+
+ private void setStartPoint(Point _aPoint)
+ {
+ aStartPoint = _aPoint;
+ if (oFormController != null)
+ {
+ oFormController.setStartPoint(_aPoint);
+ }
+ }
+
+ private int getActualFormHeight()
+ {
+ if (curArrangement == FormWizard.SOGRID)
+ {
+ return oGridControl.xShape.getSize().Height;
+ }
+ else
+ {
+ return oFormController.getFormHeight();
+ }
+ }
+
+ 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);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public DatabaseControl[] getDatabaseControls()
+ {
+ if (oFormController != null)
+ {
+ return oFormController.DBControlList;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public GridControl getGridControl()
+ {
+ return oGridControl;
+ }
+
+ 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);
+ }
+ }
+
+ 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))
+ {
+ oFormHandler.removeShape(oLabelControls[i].xShape);
+ oFormHandler.removeShape(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
new file mode 100644
index 000000000000..eb25fb65c78d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/FormWizard.java
@@ -0,0 +1,481 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.sdb.application.DatabaseObject;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NoValidPathException;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.db.DatabaseObjectWizard;
+import com.sun.star.wizards.db.RelationController;
+import com.sun.star.wizards.document.OfficeDocument;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.UIConsts;
+
+public class FormWizard extends DatabaseObjectWizard
+{
+
+ private CommandFieldSelection curDBCommandFieldSelection;
+ private FormConfiguration curFormConfiguration;
+ private CommandFieldSelection curSubFormFieldSelection;
+ private FormDocument curFormDocument;
+ private FieldLinker curFieldLinker;
+ private UIControlArranger curControlArranger;
+ private DataEntrySetter CurDataEntrySetter;
+ private StyleApplier curStyleApplier;
+ private Finalizer curFinalizer;
+ private static String slblFields;
+ private static String slblSelFields;
+ private String sShowBinaryFields = "";
+ private String serrFormNameexists = "";
+ public static final int SOMAIN_PAGE = 1;
+ public static final int SOSUBFORM_PAGE = 2;
+ public static final int SOSUBFORMFIELDS_PAGE = 3;
+ public static final int SOFIELDLINKER_PAGE = 4;
+ public static final int SOCONTROL_PAGE = 5;
+ public static final int SODATA_PAGE = 6;
+ public static final int SOSTYLE_PAGE = 7;
+ public static final int SOSTORE_PAGE = 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;
+ private String slblTables;
+ private boolean m_openForEditing;
+ private boolean m_success = false;
+ private String FormName;
+
+ public FormWizard( XMultiServiceFactory i_servicFactory, final PropertyValue[] i_wizardContext )
+ {
+ super( i_servicFactory, 34400, i_wizardContext );
+ 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)
+ });
+ drawNaviBar();
+ if (getFormResources() == true)
+ {
+ setRightPaneHeaders(m_oResource, UIConsts.RID_FORM + 90, 8);
+ }
+ }
+
+ // @Override
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ try
+ {
+ if ((nOldStep < SOCONTROL_PAGE) && (nNewStep >= SOCONTROL_PAGE))
+ {
+ curFormDocument.initialize(curDBCommandFieldSelection.isModified(), curFormConfiguration.hasSubForm(), curSubFormFieldSelection.isModified(), getBorderType());
+ curDBCommandFieldSelection.setModified(false);
+ curSubFormFieldSelection.setModified(false);
+ }
+ switch (nNewStep)
+ {
+ case SOMAIN_PAGE:
+ curDBCommandFieldSelection.setModified(false);
+ break;
+ case SOSUBFORM_PAGE:
+ {
+ final String sCommandName = curDBCommandFieldSelection.getSelectedCommandName();
+ RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData, sCommandName);
+ curFormConfiguration.initialize(curSubFormFieldSelection, oRelationController);
+ }
+ break;
+ case SOSUBFORMFIELDS_PAGE:
+ {
+ String sPreSelectedTableName = curFormConfiguration.getreferencedTableName();
+ boolean bReadOnly = (sPreSelectedTableName.length() > 0);
+ if (sPreSelectedTableName.length() == 0)
+ {
+ final String sTableName = curSubFormFieldSelection.getSelectedCommandName();
+ String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames();
+ curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames);
+ }
+ else
+ {
+ curSubFormFieldSelection.preselectCommand(sPreSelectedTableName, bReadOnly);
+ }
+ }
+ break;
+ case SOFIELDLINKER_PAGE:
+ {
+ final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames();
+ final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames();
+ curFieldLinker.initialize(aMainFieldNames, aSubFieldNames, curFormDocument.LinkFieldNames);
+ }
+ break;
+ case SOCONTROL_PAGE:
+ curControlArranger.enableSubFormImageList(curFormConfiguration.hasSubForm());
+ break;
+ case SODATA_PAGE:
+ break;
+ case SOSTYLE_PAGE:
+ break;
+ case SOSTORE_PAGE:
+ {
+ String sTableName = this.curDBCommandFieldSelection.getSelectedCommandName();
+ this.curFinalizer.initialize(sTableName, curFormDocument);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ protected Short getBorderType()
+ {
+ return curStyleApplier.getBorderType();
+ }
+
+ // @Override
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+ switch (nOldStep)
+ {
+ case SOMAIN_PAGE:
+ {
+ final String sTableName = curDBCommandFieldSelection.getSelectedCommandName();
+ final String[] aFieldNames = curDBCommandFieldSelection.getSelectedFieldNames();
+ curFormDocument.oMainFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames);
+
+ final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames();
+ try
+ {
+ curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aMainFieldNames, 1);
+ }
+ catch (java.lang.Exception e)
+ {}
+ }
+ break;
+ case SOSUBFORM_PAGE:
+ break;
+ case SOSUBFORMFIELDS_PAGE:
+ {
+ final String sTableName = curSubFormFieldSelection.getSelectedCommandName();
+ final String[] aFieldNames = curSubFormFieldSelection.getSelectedFieldNames();
+ curFormDocument.oSubFormDBMetaData.initializeFieldColumns(true, sTableName, aFieldNames);
+
+ final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames();
+ try
+ {
+ curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aSubFieldNames, 0);
+ }
+ catch (java.lang.Exception e)
+ {}
+ }
+ break;
+ case SOFIELDLINKER_PAGE:
+ curFormDocument.LinkFieldNames = curFieldLinker.getLinkFieldNames();
+ break;
+ case SOCONTROL_PAGE:
+ break;
+ case SODATA_PAGE:
+ break;
+ case SOSTYLE_PAGE:
+ break;
+ case SOSTORE_PAGE:
+ break;
+ default:
+ break;
+ }
+ }
+
+ 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);
+ // Label Help Text
+ 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(SOMAIN_PAGE), new Integer(210)
+ });
+
+ curFormConfiguration = new FormConfiguration(this);
+ curFormDocument.xProgressBar.setValue(30);
+
+ curSubFormFieldSelection = new CommandFieldSelection(this, curFormDocument.oSubFormDBMetaData, SOSUBFORMFIELDS_PAGE, 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(SOSUBFORMFIELDS_PAGE), new Integer(210)
+ });
+
+ curFormDocument.xProgressBar.setValue(40);
+
+ curFieldLinker = new FieldLinker(this, SOFIELDLINKER_PAGE, 95, 30, 210, 34441);
+ curFormDocument.xProgressBar.setValue(50);
+
+ curControlArranger = new UIControlArranger(this, curFormDocument);
+ curFormDocument.addUIFormController(curControlArranger);
+ curFormDocument.xProgressBar.setValue(60);
+
+ CurDataEntrySetter = new DataEntrySetter(this);
+ curFormDocument.xProgressBar.setValue(70);
+
+ curStyleApplier = new StyleApplier(this, curFormDocument);
+ curFormDocument.addStyleApplier(curStyleApplier);
+ curFormDocument.xProgressBar.setValue(80);
+
+ curFinalizer = new Finalizer(this);
+ curFormDocument.xProgressBar.setValue(100);
+
+ enableNavigationButtons(false, false, false);
+ curFormDocument.xProgressBar.end();
+ }
+
+ // @Override
+ public boolean finishWizard()
+ {
+ int ncurStep = getCurrentStep();
+ if ((switchToStep(ncurStep, SOSTORE_PAGE)) || (ncurStep == SOSTORE_PAGE))
+ {
+ this.curFinalizer.initialize(curDBCommandFieldSelection.getSelectedCommandName(), this.curFormDocument);
+ String sNewFormName = curFinalizer.getName();
+ if (!curFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sNewFormName))
+ {
+ m_openForEditing = curFinalizer.getOpenForEditing();
+ FormName = curFinalizer.getName();
+ if (curFormDocument.finalizeForms(CurDataEntrySetter, curFieldLinker, curFormConfiguration))
+ {
+
+ if (curFinalizer.finish())
+ {
+ m_success = true;
+ xDialog.endExecute();
+ return true;
+ }
+ }
+ }
+ else
+ {
+ String smessage = JavaTools.replaceSubString(serrFormNameexists, sNewFormName, "%FORMNAME");
+ showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage);
+ }
+ }
+ return false;
+ }
+
+ // @Override
+ public void cancelWizard()
+ {
+ m_success = false;
+ xDialog.endExecute();
+ }
+
+ public void insertFormRelatedSteps()
+ {
+ addRoadmap();
+ int i = 0;
+ i = insertRoadmapItem(0, true, m_oResource.getResText(UIConsts.RID_FORM + 80), SOMAIN_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 81), SOSUBFORM_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 82), SOSUBFORMFIELDS_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 83), SOFIELDLINKER_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 84), SOCONTROL_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 85), SODATA_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 86), SOSTYLE_PAGE);
+ i = insertRoadmapItem(i, false, m_oResource.getResText(UIConsts.RID_FORM + 87), SOSTORE_PAGE);
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ }
+
+ public void startFormWizard()
+ {
+ try
+ {
+ curFormDocument = new FormDocument(xMSF);
+ if ( curFormDocument.oMainFormDBMetaData.getConnection( m_wizardContext ) )
+ {
+ curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[]
+ {
+ Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection)
+ });
+ curFormDocument.xProgressBar.setValue(20);
+ buildSteps();
+ this.curDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
+ XWindowPeer xWindowPeer2 = createWindowPeer(curFormDocument.xWindowPeer);
+ curFormDocument.oMainFormDBMetaData.setWindowPeer( xWindowPeer2 );
+ insertFormRelatedSteps();
+ short dialogReturn = executeDialog(curFormDocument.xFrame);
+ xComponent.dispose();
+ if ( ( dialogReturn == 0 ) && m_success )
+ {
+ curFormDocument.oMainFormDBMetaData.addFormDocument( curFormDocument.xComponent );
+ loadSubComponent( DatabaseObject.FORM, FormName, m_openForEditing );
+ }
+ }
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ if ((!m_success) && (curFormDocument != null))
+ {
+ OfficeDocument.close(curFormDocument.xComponent);
+ }
+ }
+
+ private boolean getFormResources()
+ {
+ sShowBinaryFields = m_oResource.getResText(UIConsts.RID_FORM + 2);
+ slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6);
+ slblFields = m_oResource.getResText(UIConsts.RID_FORM + 12);
+ slblSelFields = m_oResource.getResText(UIConsts.RID_FORM + 1);
+ serrFormNameexists = m_oResource.getResText(UIConsts.RID_FORM + 98);
+
+ return true;
+ }
+
+ public class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ {
+
+ protected int ID;
+
+ // @Override
+ public int getID()
+ {
+ return ID;
+ }
+
+ // @Override
+ 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;
+ }
+ }
+ }
+
+ // @Override
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (ID == 1)
+ {
+ toggleMainFormSteps();
+ }
+ else
+ {
+ toggleSubFormSteps();
+ }
+ }
+
+ // @Override
+ 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
+ {
+ toggleSubFormSteps();
+ }
+ }
+ // @Override
+ public void moveItemDown(String item)
+ {
+ }
+
+ // @Override
+ public void moveItemUp(String item)
+ {
+ }
+
+ private boolean toggleSubFormSteps()
+ {
+ curSubFormFieldSelection.setModified(true);
+ boolean benable = curSubFormFieldSelection.getSelectedFieldNames().length > 0;
+ enablefromStep(SOFIELDLINKER_PAGE, benable);
+ if (benable)
+ {
+ curFieldLinker.enable(!curFormConfiguration.areexistingRelationsdefined());
+ }
+ return benable;
+ }
+
+ private void toggleMainFormSteps()
+ {
+ curDBCommandFieldSelection.setModified(true);
+ boolean benable = curDBCommandFieldSelection.getSelectedFieldNames().length > 0;
+ enablefromStep(SOSUBFORM_PAGE, benable);
+ setControlProperty("btnWizardNext", "Enabled", new Boolean(benable));
+ if (benable)
+ {
+ if (curFormConfiguration.hasSubForm())
+ {
+ benable = toggleSubFormSteps();
+ }
+ else
+ {
+ setStepEnabled(SOSUBFORMFIELDS_PAGE, false);
+ setStepEnabled(SOFIELDLINKER_PAGE, false);
+ }
+ }
+ setControlProperty("btnWizardFinish", "Enabled", new Boolean(benable));
+ }
+ }
+}
+
+
+
+
+
diff --git a/wizards/com/sun/star/wizards/form/MANIFEST.MF b/wizards/com/sun/star/wizards/form/MANIFEST.MF
new file mode 100644
index 000000000000..af4c0a07d529
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.form.CallFormWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java
new file mode 100644
index 000000000000..79e0321a3c0b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/StyleApplier.java
@@ -0,0 +1,494 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.NoValidPathException;
+import com.sun.star.wizards.document.Control;
+import com.sun.star.wizards.document.DatabaseControl;
+import com.sun.star.wizards.document.GridControl;
+import com.sun.star.wizards.document.TimeStampControl;
+import com.sun.star.wizards.text.TextStyleHandler;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.ui.UIConsts;
+import java.util.ArrayList;
+
+// TODO: Style Templates fuer OOo?
+
+public class StyleApplier
+{
+
+ private WizardDialog CurUnoDialog;
+ private XPropertySet xPageStylePropertySet;
+ private XMultiServiceFactory xMSF;
+ private short curtabindex;
+ private XRadioButton optNoBorder;
+ private XRadioButton opt3DLook;
+ private XRadioButton optFlat;
+ private XListBox lstStyles;
+ private Desktop.OfficePathRetriever curofficepath;// String[][] sLayoutFiles;
+ private FormDocument curFormDocument;
+ private short iOldLayoutPos;
+ private int SOLAYOUTLST = 0;
+ private static final String SCHANGELAYOUT = "changeLayout";
+ private static final String SCHANGEBORDERTYPE = "changeBorderLayouts";
+ private String[] StyleNames;
+ private String[] StyleNodeNames;
+ private String[] FileNames;
+ // private String StylesPath;
+ private final static int SOBACKGROUNDCOLOR = 0;
+ private final static int SODBTEXTCOLOR = 1;
+ private final static int SOLABELTEXTCOLOR = 2;
+// final static int SODBCONTROLBACKGROUNDCOLOR = 3;
+ private final static int SOLABELBACKGROUNDCOLOR = 4;
+ private final static int SOBORDERCOLOR = 5;
+ private Short IBorderValue = new Short((short) 1);
+
+ public StyleApplier(WizardDialog _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException
+ {
+// try
+// {
+ this.curFormDocument = _curFormDocument;
+ xMSF = curFormDocument.xMSF;
+
+ TextStyleHandler oTextStyleHandler = new TextStyleHandler(xMSF, curFormDocument.xTextDocument);
+ xPageStylePropertySet = oTextStyleHandler.getStyleByName("PageStyles", "Standard");
+ this.CurUnoDialog = _CurUnoDialog;
+ curtabindex = (short) (FormWizard.SOSTYLE_PAGE * 100);
+ Integer IStyleStep = new Integer(FormWizard.SOSTYLE_PAGE);
+ String sPageStyles = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 86);
+ String sNoBorder = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 29);
+ String s3DLook = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 30);
+ String sFlat = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 31);
+ String sFieldBorder = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 28);
+// XInterface xUcbInterface = (XInterface) _curFormDocument.xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+ setStyles();
+ short[] SelLayoutPos;
+ 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)
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+
+ 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);
+ }
+ }
+ */
+ 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)
+ {
+ short iStyle = getStyleIndex();
+ if ((iStyle != iOldLayoutPos) || _bapplyalways)
+ {
+ if (iStyle > -1)
+ {
+ iOldLayoutPos = iStyle;
+ String sFileName = FileNames[iStyle]; //Style = lstStyles.getSelectedItem();
+ int[] iStyles = getStyleColors(sFileName);
+ applyDBControlProperties(iStyles);
+ }
+ }
+ }
+
+ public void changeLayout()
+ {
+ short iPos = lstStyles.getSelectedItemPos();
+ if (iPos != iOldLayoutPos)
+ {
+ iOldLayoutPos = iPos;
+ String sFileName = FileNames[iPos]; //Style = lstStyles.getSelectedItem();
+ int[] iStyles = getStyleColors(sFileName);
+ applyDBControlProperties(iStyles);
+ }
+ curFormDocument.unlockallControllers();
+ }
+
+ /* public void changeLayout(){
+ / curFormDocument.xTextDocument.lockControllers();
+ applyStyle(true, false);
+ curFormDocument.unlockallControllers();
+ }
+ */
+ public Short getBorderType()
+ {
+ return IBorderValue;
+ }
+
+ 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);
+ }
+ 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);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ curFormDocument.unlockallControllers();
+ }
+
+ public void disposing(EventObject eventObject)
+ {
+ }
+
+ private int getStyleColor(String[] _sDataList, String _sHeader, String _sPropertyDescription)
+ {
+ int iColor = -1;
+ int index = JavaTools.FieldInList(_sDataList, _sHeader);
+ if (index > -1)
+ {
+ String sPropName = "";
+ int iStyleColor;
+ while (((sPropName.indexOf("}") < 0) && (index < _sDataList.length - 1)))
+ {
+ String scurline = _sDataList[index++];
+ if ((scurline.indexOf(_sPropertyDescription)) > 0)
+ {
+ if (scurline.indexOf(":") > 0)
+ {
+ String[] sPropList = JavaTools.ArrayoutofString(scurline, ":");
+ String sPropValue = sPropList[1];
+ sPropValue.trim();
+ if (sPropValue.indexOf("#") > 0)
+ {
+ sPropValue = JavaTools.replaceSubString(sPropValue, "", ";");
+ sPropValue = JavaTools.replaceSubString(sPropValue, "", " ");
+ return Integer.decode(sPropValue).intValue();
+ }
+ }
+ }
+ }
+ }
+ return -1;
+ }
+
+ private XMultiServiceFactory getMSF()
+ {
+ return xMSF;
+ }
+
+ private ArrayList<String> getStylePaths()
+ {
+ ArrayList<String> aStylePaths = new ArrayList<String>();
+ try
+ {
+ // TODO: check different languages in header layouts
+ aStylePaths = FileAccess.getOfficePaths(getMSF(), "Config", "", "");
+ FileAccess.combinePaths(getMSF(), aStylePaths, "/wizard/form/styles");
+
+ String[][] LayoutFiles = FileAccess.getFolderTitles(getMSF(), null, aStylePaths, ".css");
+
+ }
+ catch (com.sun.star.wizards.common.NoValidPathException e)
+ {
+ // if there are problems, don't show anything is a little bit hard.
+ aStylePaths.add("default");
+ }
+ return aStylePaths;
+ }
+
+ private String getStylePath()
+ {
+// TODO: umstellen auf mehrere Pfade
+ String StylesPath = "";
+ try
+ {
+ StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", "");
+ StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles");
+ }
+ catch (NoValidPathException e)
+ {
+ }
+ return StylesPath;
+ }
+
+ private int[] getStyleColors(String _filename)
+ {
+ String sFilePath = getStylePath() + "/" + _filename;
+ int[] oStylePropList = new int[6];
+ String[] sData = FileAccess.getDataFromTextFile(xMSF, sFilePath);
+ oStylePropList[SOBACKGROUNDCOLOR] = getStyleColor(sData, ".toctitle {", "background-color:");
+ oStylePropList[SODBTEXTCOLOR] = getStyleColor(sData, ".doctitle {", "color:");
+ oStylePropList[SOLABELTEXTCOLOR] = getStyleColor(sData, ".toctitle {", "color:");
+// oStylePropList[SODBCONTROLBACKGROUNDCOLOR] = getStyleColor(sData, "body {", "background-color:");
+// oStylePropList[SOLABELBACKGROUNDCOLOR] = getStyleColor(sData, ".toctitle {", "background-color:");
+ oStylePropList[SOBORDERCOLOR] = getStyleColor(sData, ".tcolor {", "border-color:");
+ return oStylePropList;
+ }
+
+ 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"))
+ {
+ xPropertySet.setPropertyValue("BackgroundColor", Integer.decode("#DDDDDD"));
+ }
+ }
+ 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)
+ {
+ DatabaseControl aDBControl = DBControls[n];
+ if (aDBControl != null)
+ {
+ if (aDBControl.xServiceInfo.supportsService("com.sun.star.drawing.ShapeCollection"))
+ {
+ TimeStampControl oTimeStampControl = (TimeStampControl) aDBControl;
+ for (int i = 0; i < 2; i++)
+ {
+ XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i);
+ setDBControlColors(xPropertySet, _iStyleColors);
+ }
+ }
+ else
+ {
+ setDBControlColors(aDBControl.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]));
+// if (_iStyleColors[SOCONTROLBACKGROUNDCOLOR] > -1)
+// LabelControls[n].xPropertySet.setPropertyValue("BackgroundColor", new Integer(_iStyleColors[SOCONTROLBACKGROUNDCOLOR]));
+ }
+ }
+ }
+ }
+ xPageStylePropertySet.setPropertyValue("BackColor", new Integer(_iStyleColors[SOBACKGROUNDCOLOR]));
+ }
+ 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
new file mode 100644
index 000000000000..b596efe143ea
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java
@@ -0,0 +1,504 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.form;
+
+import com.sun.star.awt.ItemEvent;
+
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XItemListener;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.lang.EventObject;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.NoValidPathException;
+import com.sun.star.wizards.document.Control;
+// import com.sun.star.wizards.ui.ImageList;
+import com.sun.star.wizards.ui.ButtonList;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+
+import javax.swing.DefaultListModel;
+import javax.swing.ListModel;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+public class UIControlArranger
+{
+
+ private FormWizard CurUnoDialog;
+ private FormDocument curFormDocument;
+ private short curtabindex;
+ private XRadioButton optAlignLeft;
+ private XRadioButton optAlignRight;
+ private XControl flnLabelPlacement;
+ private String[] HelpTexts = new String[4];
+ // private String[] sArrangementHeader = new String[2];
+ // private ArrangeImageList[] m_aArrangeList = new ArrangeImageList[2];
+ private ArrangeButtonList[] m_aArrangeList = new ArrangeButtonList[2];
+ private Integer IControlStep;
+ private final int SOBASEIMAGEYPOSITION = 66;
+ private final int SOIMAGELISTHEIGHT = 60;
+ private final String SOALIGNMETHOD = "alignLabelControls";
+
+ public UIControlArranger(FormWizard _CurUnoDialog, FormDocument _curFormDocument) throws NoValidPathException
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ this.curFormDocument = _curFormDocument;
+ curtabindex = (short) (FormWizard.SOCONTROL_PAGE * 100);
+ IControlStep = new Integer(FormWizard.SOCONTROL_PAGE);
+ String sLabelPlacment = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 32);
+ String sAlignLeft = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 33);
+ String sAlignRight = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 34);
+
+ // Label "Label Placement" -----------------
+ 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)
+ });
+ // Radio Button "Align Left"
+ 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)
+ });
+ // Radio Button "Align Right"
+ 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)
+ });
+
+
+ HelpTexts[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 36); // "Columnar - Labels Left"
+ HelpTexts[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 37); // "Columnar - Labels of Top"
+ HelpTexts[2] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40); // "As Data Sheet"
+ HelpTexts[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 39); // In Blocks - Labels Above"
+
+// flnLabelPlacement = CurUnoDialog.insertFixedLine("lnArrangementHeader1",
+// new String[]
+// {
+// "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+// },
+// new Object[]
+// {
+// UIConsts.INTEGERS[8], sArrangementHeader[0], new Integer(97), new Integer(60), IControlStep, new Short(curtabindex++), new Integer(207)
+// });
+//
+// boolean bEnabled = true;
+// int nBtnWidth = 16;
+// int nXPos = 97;
+// int nYPos = 70;
+// CurUnoDialog.insertButton("btnLayout1", "btnLayout1",
+// new String[]
+// {
+// "Enabled",
+// "Height",
+// "HelpURL",
+// "Label",
+// "PositionX",
+// "PositionY",
+// "Step",
+// "TabIndex",
+// "Width"
+// },
+// new Object[]
+// {
+// Boolean.valueOf(bEnabled),
+// new Integer(14),
+///* TODO: WRONG!*/ "HID:34452",
+// "1",
+// new Integer(nXPos + nBtnWidth),
+// new Integer(nYPos),
+// IControlStep,
+// new Short(curtabindex++),
+// new Integer(16)
+// });
+
+ DefaultListModel imageModel = new DefaultListModel();
+ for (int i = 0; i < HelpTexts.length; i++)
+ {
+ imageModel.addElement(new Integer(i));
+ }
+ String sMainArrangementHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 41); // "Arrangement of the main form"
+ m_aArrangeList[0] = new ArrangeButtonList(0, imageModel, sMainArrangementHeader);
+
+ String sSubArrangementHeader = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 42); // "Arrangement of the sub form"
+ m_aArrangeList[1] = new ArrangeButtonList(1, imageModel, sSubArrangementHeader);
+ enableAlignControlGroup(false);
+ }
+
+ public int getSelectedArrangement(int _formindex)
+ {
+ return m_aArrangeList[_formindex].m_aButtonList.getSelected() + 1;
+ }
+
+ private class LayoutRenderer implements ButtonList.IImageRenderer
+ {
+ int Index = 1;
+
+ public Object[] getImageUrls(Object listitem)
+ {
+
+ int ResId = UIConsts.RID_IMG_FORM + (2 * ((Integer) listitem).intValue());
+ Index++;
+ 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)
+ {
+ if (listItem == null)
+ {
+ return "";
+ }
+ return HelpTexts[((Integer) listItem).intValue()];
+
+ }
+ }
+
+ public void enableSubFormImageList(boolean _bdoEnable)
+ {
+ m_aArrangeList[1].m_aButtonList.setenabled(_bdoEnable);
+ CurUnoDialog.setControlProperty("lnLabelPlacment_2", "Enabled", new Boolean(_bdoEnable));
+ }
+
+ public short getAlignValue()
+ {
+ Short IAlignValue = null;
+ if (optAlignLeft.getState())
+ {
+ IAlignValue = new Short((short) 0);
+ }
+ else
+ {
+ 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));
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ 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 int formindex;
+// private ImageList m_aButtonList = null; // new ImageList();
+//
+// public ArrangeImageList(int _formindex, ListModel model, String _sArrangementHeader)
+// {
+// formindex = _formindex;
+// Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT);
+// // Label ArrangementHeader ----------------------
+// CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1),
+// new String[]
+// {
+// "Height", "Label", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+// },
+// new Object[]
+// {
+// UIConsts.INTEGERS[8], _sArrangementHeader, new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207)
+// });
+//
+// int nypos = SOBASEIMAGEYPOSITION + 12 + _formindex * SOIMAGELISTHEIGHT;
+// m_aButtonList = new ImageList();
+// m_aButtonList.setPos(new Size(107, nypos));
+// m_aButtonList.setImageSize(new Size(26, 26));
+// m_aButtonList.setCols(4);
+// m_aButtonList.setRows(1);
+// m_aButtonList.m_aControlName = "ImageList_" + formindex;
+// m_aButtonList.setStep(new Short((short) FormWizard.SOCONTROL_PAGE));
+// m_aButtonList.setShowButtons(false);
+// m_aButtonList.setRenderer(new LayoutRenderer());
+// m_aButtonList.setSelectionGap(new Size(2, 2));
+// m_aButtonList.setGap(new Size(3, 3));
+// m_aButtonList.scaleImages = Boolean.FALSE;
+// m_aButtonList.tabIndex = (int) curtabindex++;
+// m_aButtonList.helpURL = 34453 + (formindex * 4);
+//
+// m_aButtonList.setListModel(model);
+// m_aButtonList.create(CurUnoDialog);
+// m_aButtonList.setSelected(FormWizard.SOGRID - 1);
+// m_aButtonList.addItemListener(this);
+// }
+//
+// 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)
+// {
+// // TODO Auto-generated method stub
+// }
+//
+// public void itemStateChanged(ItemEvent arg0)
+// {
+// try
+// {
+// if (m_aArrangeList[formindex].m_aButtonList.isenabled())
+// {
+// boolean bEnableAlignControlGroup;
+// if (curFormDocument.oControlForms.size() == 2)
+// {
+// final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1);
+// final int nSelected1 = (m_aArrangeList[1].m_aButtonList.getSelected() + 1);
+//
+// bEnableAlignControlGroup = ((nSelected0 == FormWizard.SOCOLUMNARLEFT) ||
+// (nSelected1 == FormWizard.SOCOLUMNARLEFT));
+// }
+// else
+// {
+// final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1);
+// bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT);
+// }
+// enableAlignControlGroup(bEnableAlignControlGroup);
+// final Short nBorderType = CurUnoDialog.getBorderType();
+// final int nSelected = m_aButtonList.getSelected() + 1;
+// ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(nSelected, nBorderType);
+// }
+// }
+// catch (RuntimeException e)
+// {
+// e.printStackTrace();
+// }
+// }
+//
+// /* (non-Javadoc)
+// * @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent)
+// */
+// 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)
+// {
+// // TODO Auto-generated method stub
+// }
+//
+// /* (non-Javadoc)
+// * @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent)
+// */
+// 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)
+// {
+// // TODO Auto-generated method stub
+// }
+// }
+
+ private class ArrangeButtonList implements XItemListener
+ {
+
+ private int formindex;
+ private ButtonList m_aButtonList = null; // new ImageList();
+
+ public ArrangeButtonList(int _formindex, ListModel model, String _sArrangementHeader)
+ {
+ formindex = _formindex;
+ Integer YPos = new Integer(SOBASEIMAGEYPOSITION + _formindex * SOIMAGELISTHEIGHT);
+ // Label ArrangementHeader ----------------------
+ CurUnoDialog.insertFixedLine("lnLabelPlacment_" + (_formindex + 1),
+ new String[]
+ {
+ "Height",
+ "Label",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ UIConsts.INTEGERS[8],
+ _sArrangementHeader,
+ new Integer(97),
+ YPos,
+ IControlStep,
+ new Short(curtabindex++),
+ new Integer(207)
+ });
+
+ int nypos = SOBASEIMAGEYPOSITION + 12 - 5 + _formindex * SOIMAGELISTHEIGHT;
+ m_aButtonList = new ButtonList();
+ m_aButtonList.setPos(new Size(107, nypos));
+ m_aButtonList.setButtonSize(new Size(26 + 6, 26 + 5));
+ m_aButtonList.setCols(4);
+ m_aButtonList.setRows(1);
+ m_aButtonList.setName( "ButtonList_" + formindex );
+ m_aButtonList.setStep(Short.valueOf((short) FormWizard.SOCONTROL_PAGE));
+ m_aButtonList.setShowButtons(false); // shows a button line at ''wrong'' position like |<| 1..4/4 |>|
+ m_aButtonList.setRenderer(new LayoutRenderer());
+ m_aButtonList.setSelectionGap(new Size(2, 2));
+ m_aButtonList.setGap(new Size(3, 3));
+// m_aButtonList.scaleImages = Boolean.FALSE;
+ m_aButtonList.tabIndex = (int) curtabindex++;
+ m_aButtonList.helpURL = 34453 + (formindex * 4);
+
+ m_aButtonList.setListModel(model);
+ m_aButtonList.create(CurUnoDialog);
+ m_aButtonList.setSelected(FormWizard.SOGRID - 1);
+ m_aButtonList.addItemListener(this);
+ }
+
+ 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)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public void itemStateChanged(ItemEvent arg0)
+ {
+ try
+ {
+ if (m_aArrangeList[formindex].m_aButtonList.isenabled())
+ {
+ boolean bEnableAlignControlGroup;
+ if (curFormDocument.oControlForms.size() == 2)
+ {
+ final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1);
+ final int nSelected1 = (m_aArrangeList[1].m_aButtonList.getSelected() + 1);
+
+ bEnableAlignControlGroup = ((nSelected0 == FormWizard.SOCOLUMNARLEFT) ||
+ (nSelected1 == FormWizard.SOCOLUMNARLEFT));
+ }
+ else
+ {
+ final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1);
+ bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT);
+ }
+ enableAlignControlGroup(bEnableAlignControlGroup);
+ final Short nBorderType = CurUnoDialog.getBorderType();
+ final int nSelected = m_aButtonList.getSelected() + 1;
+ ((FormDocument.ControlForm) curFormDocument.oControlForms.get(formindex)).initialize(nSelected, nBorderType);
+ }
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent)
+ */
+ 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)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent)
+ */
+ 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)
+ {
+ // TODO Auto-generated method stub
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/form/makefile.mk b/wizards/com/sun/star/wizards/form/makefile.mk
new file mode 100644
index 000000000000..092135289fc9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/form/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = form
+PACKAGE = com$/sun$/star$/wizards$/form
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar commonwizards.jar
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/form
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+#SRS2NAME = dbwizres
+#SRC2FILES= dbwizres.src
+#RESLIB2SRSFILES= $(SRS)$/dbwizres.srs
+#RESLIB2NAME= dbw
+
+JAVAFILES= \
+ CallFormWizard.java \
+ Finalizer.java \
+ FormWizard.java \
+ DataEntrySetter.java \
+ FieldLinker.java \
+ FormConfiguration.java \
+ FormControlArranger.java\
+ FormDocument.java \
+ StyleApplier.java \
+ UIControlArranger.java \
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/letter/CGLetter.java b/wizards/com/sun/star/wizards/letter/CGLetter.java
new file mode 100644
index 000000000000..986d43bac5bb
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/CGLetter.java
@@ -0,0 +1,66 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 int cp_Style;
+ public boolean cp_BusinessPaper;
+ public CGPaperElementLocation cp_CompanyLogo = new CGPaperElementLocation();
+ public CGPaperElementLocation cp_CompanyAddress = new CGPaperElementLocation();
+ public boolean cp_PaperCompanyAddressReceiverField;
+ public boolean cp_PaperFooter;
+ public double cp_PaperFooterHeight;
+ public int cp_Norm;
+ public boolean cp_PrintCompanyLogo;
+ public boolean cp_PrintCompanyAddressReceiverField;
+ public boolean cp_PrintLetterSigns;
+ public boolean cp_PrintSubjectLine;
+ public boolean cp_PrintSalutation;
+ public boolean cp_PrintBendMarks;
+ public boolean cp_PrintGreeting;
+ public boolean cp_PrintFooter;
+ public String cp_Salutation;
+ public String cp_Greeting;
+ public int cp_SenderAddressType;
+ public String cp_SenderCompanyName;
+ public String cp_SenderStreet;
+ public String cp_SenderPostCode;
+ public String cp_SenderState;
+ public String cp_SenderCity;
+ public int cp_ReceiverAddressType;
+ public String cp_Footer;
+ public boolean cp_FooterOnlySecondPage;
+ public boolean cp_FooterPageNumbers;
+ 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
new file mode 100644
index 000000000000..0a6cfd90ab42
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/CGLetterWizard.java
@@ -0,0 +1,39 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 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
new file mode 100644
index 000000000000..7c8b28bc93ed
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/CGPaperElementLocation.java
@@ -0,0 +1,40 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 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
new file mode 100644
index 000000000000..f3508512807d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/CallWizard.java
@@ -0,0 +1,257 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.task.XJob;
+import com.sun.star.task.XJobExecutor;
+import com.sun.star.uno.Type;
+
+/**
+ * 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 (<CODE>__writeRegistryServiceInfo</CODE>).
+ *
+ * @author $author$
+ * @version $Revision: 1.3.192.1 $
+ */
+public class CallWizard
+{
+
+ /**
+ * Gives a factory for creating the service. This method is called by the
+ * <code>JavaLoader</code>
+ *
+ * <p></p>
+ *
+ * @param stringImplementationName The implementation name of the component.
+ * @param xMSF The service manager, who gives access to every known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single registry key accessible.
+ *
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the component.
+ *
+ * @see com.sun.star.comp.loader.JavaLoader#
+ */
+ public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey)
+ {
+ XSingleServiceFactory xsingleservicefactory = null;
+
+ if (stringImplementationName.equals(WizardImplementation.class.getName()))
+ {
+ xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey);
+ }
+
+ return xsingleservicefactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key. This method is called
+ * by the <code>JavaLoader</code>.
+ *
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single registry key accessible.
+ *
+ * @return returns true if the operation succeeded
+ *
+ * @see com.sun.star.comp.loader.JavaLoader#
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey)
+ {
+ return FactoryHelper.writeRegistryServiceInfo(WizardImplementation.class.getName(), WizardImplementation.__serviceName, xregistrykey);
+ }
+
+ /**
+ * 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
+ {
+
+ /**
+ * The constructor of the inner class has a XMultiServiceFactory parameter.
+ *
+ * @param xmultiservicefactoryInitialization A special service factory could be
+ * introduced while initializing.
+ */
+ public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
+ xmultiservicefactory = xmultiservicefactoryInitialization;
+
+ if (xmultiservicefactory != null)
+ {
+ }
+ }
+
+ /**
+ * Execute Wizard
+ *
+ * @param str only valid parameter is 'start' at the moment.
+ */
+ public void trigger(String str)
+ {
+ if (str.equalsIgnoreCase("start"))
+ {
+ LetterWizardDialogImpl lw = new LetterWizardDialogImpl(xmultiservicefactory);
+ 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.
+ */
+ private XMultiServiceFactory xmultiservicefactory;
+
+ /**
+ * This method is a member of the interface for initializing an object directly
+ * after its creation.
+ *
+ * @param object This array of arbitrary objects will be passed to the component
+ * after its creation.
+ *
+ * @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
+ {
+ }
+
+ /**
+ * 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];
+ stringSupportedServiceNames[0] = __serviceName;
+
+ return (stringSupportedServiceNames);
+ }
+
+ /**
+ * This method returns true, if the given service will be supported by the
+ * component.
+ *
+ * @param stringService Service name.
+ *
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService(String stringService)
+ {
+ boolean booleanSupportsService = false;
+
+ 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. to realise hashing functionality
+ * when the object is introspected. Two objects that return the same ID also
+ * have to return the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to return an empty
+ * sequence. Important: If the object aggregates other objects the ID has to be
+ * unique for the whole combination of objects.
+ *
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
+ };
+
+ try
+ {
+ byteReturn = ("" + 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 (WizardImplementation.class.getName());
+ }
+
+ /**
+ * Provides a sequence of all types (usually interface types) provided by the
+ * object.
+ *
+ * @return Sequence of all types (usually interface types) provided by the
+ * service.
+ */
+ 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)
+ {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.java b/wizards/com/sun/star/wizards/letter/LetterDocument.java
new file mode 100644
index 000000000000..0c981c6e066e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/LetterDocument.java
@@ -0,0 +1,330 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+import com.sun.star.wizards.text.*;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XTerminateListener;
+import com.sun.star.table.BorderLine;
+import com.sun.star.text.*;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.drawing.XShape;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.style.NumberingType;
+import com.sun.star.style.ParagraphAdjust;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.style.XStyle;
+
+public class LetterDocument extends TextDocument
+{
+
+ XDesktop xDesktop;
+ boolean keepLogoFrame = true;
+ boolean keepBendMarksFrame = true;
+ boolean keepLetterSignsFrame = true;
+ boolean keepSenderAddressRepeatedFrame = true;
+ boolean keepAddressFrame = true;
+
+ public LetterDocument(XMultiServiceFactory xMSF, XTerminateListener listener)
+ {
+ super(xMSF, listener, "WIZARD_LIVE_PREVIEW");
+ }
+
+ public XWindowPeer getWindowPeer()
+ {
+ XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument);
+ return xWindowPeer;
+ }
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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
+ {
+ xTextDocument.lockControllers();
+ XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ com.sun.star.container.XNameAccess xNameAccess = null;
+ xNameAccess = xStyleFamiliesSupplier.getStyleFamilies();
+
+ com.sun.star.container.XNameContainer xPageStyleCollection = null;
+ xPageStyleCollection = (com.sun.star.container.XNameContainer) UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles"));
+
+ XText xFooterText;
+ XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle));
+
+ if (bState)
+ {
+ Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(true));
+ xFooterText = (XText) UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText"));
+ xFooterText.setString(sText);
+ if (bPageNumber)
+ {
+ //Adding the Page Number
+ XTextCursor myCursor = xFooterText.createTextCursor();
+ myCursor.gotoEnd(false);
+ xFooterText.insertControlCharacter(myCursor, ControlCharacter.PARAGRAPH_BREAK, false);
+ XPropertySet xCursorPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, myCursor);
+ xCursorPSet.setPropertyValue("ParaAdjust", ParagraphAdjust.CENTER);
+ 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));
+ xFooterText.insertTextContent(xFooterText.getEnd(), xPageNumberField, false);
+ }
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(false));
+ }
+ xTextDocument.unlockControllers();
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+ }
+
+ public boolean hasElement(String sElement)
+ {
+ if (xTextDocument != null)
+ {
+ TextSectionHandler SH = new TextSectionHandler(xMSF, xTextDocument);
+ return SH.hasTextSectionByName(sElement);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public void switchUserField(String sFieldName, String sNewContent, boolean bState)
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
+ if (bState)
+ {
+ myFieldHandler.changeUserFieldContent(sFieldName, sNewContent);
+ }
+ else
+ {
+ myFieldHandler.changeUserFieldContent(sFieldName, "");
+ }
+ }
+
+ 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"));
+ myFieldHandler.changeUserFieldContent("Street", (String) Helper.getUnoObjectbyName(oUserDataAccess, "street"));
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void killEmptyUserFields()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
+ myFieldHandler.removeUserFieldByContent("");
+ }
+
+ public void killEmptyFrames()
+ {
+ try
+ {
+ if (!keepLogoFrame)
+ {
+ XTextFrame xTF = TextFrameHandler.getFrameByName("Company Logo", xTextDocument);
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
+ }
+ if (!keepBendMarksFrame)
+ {
+ XTextFrame xTF = TextFrameHandler.getFrameByName("Bend Marks", xTextDocument);
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
+ }
+ if (!keepLetterSignsFrame)
+ {
+ XTextFrame xTF = TextFrameHandler.getFrameByName("Letter Signs", xTextDocument);
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
+ }
+ if (!keepSenderAddressRepeatedFrame)
+ {
+ XTextFrame xTF = TextFrameHandler.getFrameByName("Sender Address Repeated", xTextDocument);
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
+ }
+ if (!keepAddressFrame)
+ {
+ XTextFrame xTF = TextFrameHandler.getFrameByName("Sender Address", xTextDocument);
+ if (xTF != null)
+ {
+ xTF.dispose();
+ }
+ }
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+
+ 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)
+ {
+
+ iWidth = Width;
+ iHeight = Height;
+ iXPos = XPos;
+ iYPos = YPos;
+
+ try
+ {
+ xFrame = (XTextFrame) UnoRuntime.queryInterface(XTextFrame.class, xMSFDoc.createInstance("com.sun.star.text.TextFrame"));
+ xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xFrame);
+
+ setFramePosition();
+ Helper.setUnoPropertyValue(xShape, "AnchorType", TextContentAnchorType.AT_PAGE);
+ Helper.setUnoPropertyValue(xShape, "SizeType", new Short(SizeType.FIX));
+
+ Helper.setUnoPropertyValue(xFrame, "TextWrap", WrapTextMode.THROUGHT);
+ Helper.setUnoPropertyValue(xFrame, "Opaque", Boolean.TRUE);
+ Helper.setUnoPropertyValue(xFrame, "BackColor", new Integer(15790320));
+
+ BorderLine myBorder = new BorderLine();
+ myBorder.OuterLineWidth = 0;
+ Helper.setUnoPropertyValue(xFrame, "LeftBorder", myBorder);
+ Helper.setUnoPropertyValue(xFrame, "RightBorder", myBorder);
+ Helper.setUnoPropertyValue(xFrame, "TopBorder", myBorder);
+ Helper.setUnoPropertyValue(xFrame, "BottomBorder", myBorder);
+ Helper.setUnoPropertyValue(xFrame, "Print", new Boolean(false));
+
+ XTextCursor xTextCursor = xTextDocument.getText().createTextCursor();
+ xTextCursor.gotoEnd(true);
+ XText xText = xTextDocument.getText();
+ xText.insertTextContent(xTextCursor, xFrame, false);
+
+ XText xFrameText = xFrame.getText();
+ XTextCursor xFrameCursor = xFrameText.createTextCursor();
+ XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFrameCursor);
+ xCursorProps.setPropertyValue("CharWeight", new Float(com.sun.star.awt.FontWeight.BOLD));
+ xCursorProps.setPropertyValue("CharColor", new Integer(16777215));
+ xCursorProps.setPropertyValue("CharFontName", new String("Albany"));
+ xCursorProps.setPropertyValue("CharHeight", new Float(18));
+
+ xFrameText.insertString(xFrameCursor, FrameText, false);
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ 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));
+ Helper.setUnoPropertyValue(xFrame, "Width", new Integer(iWidth));
+ Helper.setUnoPropertyValue(xFrame, "HoriOrientPosition", new Integer(iXPos));
+ Helper.setUnoPropertyValue(xFrame, "VertOrientPosition", new Integer(iYPos));
+ Helper.setUnoPropertyValue(xFrame, "HoriOrientRelation", new Short(RelOrientation.PAGE_FRAME));
+ Helper.setUnoPropertyValue(xFrame, "VertOrientRelation", new Short(RelOrientation.PAGE_FRAME));
+ }
+
+ public void removeFrame()
+ {
+ if (xFrame != null)
+ {
+ try
+ {
+ xTextDocument.getText().removeTextContent(xFrame);
+ }
+ 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
new file mode 100644
index 000000000000..e0b8a8c2579e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
@@ -0,0 +1,913 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+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(); //Resources Object
+ LetterWizardDialogResources resources;
+
+ 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 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 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 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
new file mode 100755
index 000000000000..b94ac6f0c0ac
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogConst.java
@@ -0,0 +1,93 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 static final String OPTBUSINESSLETTER_ITEM_CHANGED = "optBusinessLetterItemChanged";
+ public static final String OPTPRIVOFFICIALLETTER_ITEM_CHANGED = "optPrivOfficialLetterItemChanged";
+ public static final String OPTPRIVATELETTER_ITEM_CHANGED = "optPrivateLetterItemChanged";
+ public static final String LSTBUSINESSSTYLE_ACTION_PERFORMED = null;
+ public static final String LSTBUSINESSSTYLE_ITEM_CHANGED = "lstBusinessStyleItemChanged";
+ public static final String LSTPRIVOFFICIALSTYLE_ACTION_PERFORMED = null;
+ public static final String LSTPRIVOFFICIALSTYLE_ITEM_CHANGED = "lstPrivOfficialStyleItemChanged";
+ public static final String CHKBUSINESSPAPER_ITEM_CHANGED = "chkBusinessPaperItemChanged";
+ public static final String LSTPRIVATESTYLE_ACTION_PERFORMED = null;
+ public static final String LSTPRIVATESTYLE_ITEM_CHANGED = "lstPrivateStyleItemChanged";
+ public static final String CHKPAPERCOMPANYLOGO_ITEM_CHANGED = "chkPaperCompanyLogoItemChanged";
+ public static final String NUMLOGOHEIGHT_TEXT_CHANGED = "numLogoHeightTextChanged";
+ public static final String NUMLOGOX_TEXT_CHANGED = "numLogoXTextChanged";
+ public static final String NUMLOGOWIDTH_TEXT_CHANGED = "numLogoWidthTextChanged";
+ public static final String NUMLOGOY_TEXT_CHANGED = "numLogoYTextChanged";
+ public static final String CHKCOMPANYRECEIVER_ITEM_CHANGED = "chkCompanyReceiverItemChanged";
+ public static final String CHKPAPERFOOTER_ITEM_CHANGED = "chkPaperFooterItemChanged";
+ public static final String NUMFOOTERHEIGHT_TEXT_CHANGED = "numFooterHeightTextChanged";
+ public static final String CHKPAPERCOMPANYADDRESS_ITEM_CHANGED = "chkPaperCompanyAddressItemChanged";
+ public static final String NUMADDRESSHEIGHT_TEXT_CHANGED = "numAddressHeightTextChanged";
+ public static final String NUMADDRESSX_TEXT_CHANGED = "numAddressXTextChanged";
+ public static final String NUMADDRESSWIDTH_TEXT_CHANGED = "numAddressWidthTextChanged";
+ public static final String NUMADDRESSY_TEXT_CHANGED = "numAddressYTextChanged";
+ public static final String LSTLETTERNORM_ACTION_PERFORMED = null;
+ public static final String LSTLETTERNORM_ITEM_CHANGED = "lstLetterNormItemChanged";
+ public static final String CHKUSELOGO_ITEM_CHANGED = "chkUseLogoItemChanged";
+ public static final String CHKUSEADDRESSRECEIVER_ITEM_CHANGED = "chkUseAddressReceiverItemChanged";
+ public static final String CHKUSESIGNS_ITEM_CHANGED = "chkUseSignsItemChanged";
+ public static final String CHKUSESUBJECT_ITEM_CHANGED = "chkUseSubjectItemChanged";
+ public static final String CHKUSEBENDMARKS_ITEM_CHANGED = "chkUseBendMarksItemChanged";
+ public static final String CHKUSEFOOTER_ITEM_CHANGED = "chkUseFooterItemChanged";
+ public static final String CHKUSESALUTATION_ITEM_CHANGED = "chkUseSalutationItemChanged";
+ public static final String CHKUSEGREETING_ITEM_CHANGED = "chkUseGreetingItemChanged";
+ public static final String LSTSALUTATION_ACTION_PERFORMED = null;
+ public static final String LSTSALUTATION_ITEM_CHANGED = "lstSalutationItemChanged";
+ public static final String LSTSALUTATION_TEXT_CHANGED = "lstSalutationTextChanged";
+ public static final String LSTGREETING_ACTION_PERFORMED = null;
+ public static final String LSTGREETING_ITEM_CHANGED = "lstGreetingItemChanged";
+ public static final String LSTGREETING_TEXT_CHANGED = "lstGreetingTextChanged";
+ public static final String OPTSENDERPLACEHOLDER_ITEM_CHANGED = "optSenderPlaceholderItemChanged";
+ public static final String OPTSENDERDEFINE_ITEM_CHANGED = "optSenderDefineItemChanged";
+ public static final String OPTRECEIVERPLACEHOLDER_ITEM_CHANGED = "optReceiverPlaceholderItemChanged";
+ public static final String OPTRECEIVERDATABASE_ITEM_CHANGED = "optReceiverDatabaseItemChanged";
+ public static final String TXTSENDERNAME_TEXT_CHANGED = "txtSenderNameTextChanged";
+ public static final String TXTSENDERSTREET_TEXT_CHANGED = "txtSenderStreetTextChanged";
+ public static final String TXTSENDERCITY_TEXT_CHANGED = "txtSenderCityTextChanged";
+ public static final String TXTSENDERPOSTCODE_TEXT_CHANGED = "txtSenderPostCodeTextChanged";
+ public static final String TXTSENDERSTATE_TEXT_CHANGED = "txtSenderStateTextChanged";
+ 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 OPTCREATELETTER_ITEM_CHANGED = "optCreateLetterItemChanged";
+ public static final String OPTMAKECHANGES_ITEM_CHANGED = "optMakeChangesItemChanged";
+ public static final String FILETEMPLATEPATH_TEXT_CHANGED = null;
+ public static final String imageURLImageControl1 = null;
+ public static final String imageURLImageControl2 = null;
+ public static final String imageURLImageControl3 = null;
+ public static final int HID = 40768;
+ public static final int HIDMAIN = 40820;
+} \ No newline at end of file
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java
new file mode 100644
index 000000000000..0a6407dbde1d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogEvents.java
@@ -0,0 +1,89 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 static final String OPTBUSINESSLETTER_ITEM_CHANGED = null;
+ public static final String OPTPRIVOFFICIALLETTER_ITEM_CHANGED = null;
+ public static final String OPTPRIVATELETTER_ITEM_CHANGED = null;
+ public static final String LSTBUSINESSSTYLE_ACTION_PERFORMED = null;
+ public static final String LSTBUSINESSSTYLE_ITEM_CHANGED = null;
+ public static final String LSTPRIVOFFICIALSTYLE_ACTION_PERFORMED = null;
+ public static final String LSTPRIVOFFICIALSTYLE_ITEM_CHANGED = null;
+ public static final String CHKBUSINESSPAPER_ITEM_CHANGED = null;
+ public static final String LSTPRIVATESTYLE_ACTION_PERFORMED = null;
+ public static final String LSTPRIVATESTYLE_ITEM_CHANGED = null;
+ public static final String CHKPAPERCOMPANYLOGO_ITEM_CHANGED = null;
+ public static final String NUMLOGOHEIGHT_TEXT_CHANGED = null;
+ public static final String NUMLOGOX_TEXT_CHANGED = null;
+ public static final String NUMLOGOWIDTH_TEXT_CHANGED = null;
+ public static final String NUMLOGOY_TEXT_CHANGED = null;
+ public static final String CHKCOMPANYRECEIVER_ITEM_CHANGED = null;
+ public static final String CHKPAPERFOOTER_ITEM_CHANGED = null;
+ public static final String NUMFOOTERHEIGHT_TEXT_CHANGED = null;
+ public static final String CHKPAPERCOMPANYADDRESS_ITEM_CHANGED = null;
+ public static final String NUMADDRESSHEIGHT_TEXT_CHANGED = null;
+ public static final String NUMADDRESSX_TEXT_CHANGED = null;
+ public static final String NUMADDRESSWIDTH_TEXT_CHANGED = null;
+ public static final String NUMADDRESSY_TEXT_CHANGED = null;
+ public static final String LSTLETTERNORM_ACTION_PERFORMED = null;
+ public static final String LSTLETTERNORM_ITEM_CHANGED = null;
+ public static final String CHKUSELOGO_ITEM_CHANGED = null;
+ public static final String CHKUSEADDRESSRECEIVER_ITEM_CHANGED = null;
+ public static final String CHKUSESIGNS_ITEM_CHANGED = null;
+ public static final String CHKUSESUBJECT_ITEM_CHANGED = null;
+ public static final String CHKUSEBENDMARKS_ITEM_CHANGED = null;
+ public static final String CHKUSEFOOTER_ITEM_CHANGED = null;
+ public static final String CHKUSESALUTATION_ITEM_CHANGED = null;
+ public static final String CHKUSEGREETING_ITEM_CHANGED = null;
+ public static final String LSTSALUTATION_ACTION_PERFORMED = null;
+ public static final String LSTSALUTATION_ITEM_CHANGED = null;
+ public static final String LSTGREETING_ACTION_PERFORMED = null;
+ public static final String LSTGREETING_ITEM_CHANGED = null;
+ public static final String OPTSENDERFIXED_ITEM_CHANGED = null;
+ public static final String OPTSENDERPLACEHOLDER_ITEM_CHANGED = null;
+ public static final String OPTSENDERDEFINE_ITEM_CHANGED = null;
+ public static final String OPTRECEIVERPLACEHOLDER_ITEM_CHANGED = null;
+ public static final String OPTRECEIVERDATABASE_ITEM_CHANGED = null;
+ public static final String TXTSENDERNAME_TEXT_CHANGED = null;
+ public static final String TXTSENDERSTREET_TEXT_CHANGED = null;
+ public static final String TXTSENDERCITY_TEXT_CHANGED = null;
+ public static final String TXTSENDERPOSTCODE_TEXT_CHANGED = null;
+ public static final String TXTFOOTER_TEXT_CHANGED = null;
+ public static final String CHKFOOTERNEXTPAGES_ITEM_CHANGED = null;
+ public static final String CHKFOOTERPAGENUMBERS_ITEM_CHANGED = null;
+ public static final String TXTTEMPLATENAME_TEXT_CHANGED = null;
+ public static final String OPTCREATELETTER_ITEM_CHANGED = null;
+ public static final String OPTMAKECHANGES_ITEM_CHANGED = null;
+ public static final String FILETEMPLATEPATH_TEXT_CHANGED = null;
+ 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
new file mode 100644
index 000000000000..106fb68a172e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
@@ -0,0 +1,1543 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.NoValidPathException;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.document.MacroExecMode;
+import com.sun.star.document.XDocumentProperties;
+import com.sun.star.document.XDocumentPropertiesSupplier;
+import com.sun.star.ucb.CommandAbortedException;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.text.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.task.XInteractionHandler;
+import com.sun.star.text.XTextFrame;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.CloseVetoException;
+import com.sun.star.util.XCloseable;
+import com.sun.star.wizards.document.*;
+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
+{
+
+ 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[] NormNames;
+ String sTemplatePath;
+ String sUserTemplatePath;
+ String sBitmapPath;
+ String sLetterPath;
+ String sLetterLangPackPath;
+ String sWorkPath;
+ String sCurrentNorm;
+ String sPath;
+ 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;
+ final static int RM_SENDERRECEIVER = 4;
+ final static int RM_FOOTER = 5;
+ final static int RM_FINALSETTINGS = 6;
+
+ public LetterWizardDialogImpl(XMultiServiceFactory xmsf)
+ {
+ super(xmsf);
+ this.xmsf = xmsf;
+ }
+
+ 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.ServiceManager";
+ 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)
+ {
+
+ running = true;
+ try
+ {
+ //Number of steps on WizardDialog:
+ setMaxStep(6);
+
+ //instatiate The Document Frame for the Preview
+ myLetterDoc = new LetterDocument(xMSF, this);
+
+ //create the dialog:
+ drawNaviBar();
+ buildStep1();
+ buildStep2();
+ buildStep3();
+ buildStep4();
+ buildStep5();
+ buildStep6();
+
+ initializePaths();
+ initializeNorms();
+ initializeSalutation();
+ initializeGreeting();
+
+
+ //special Control for setting the save Path:
+ insertPathSelectionControl();
+
+ //load the last used settings from the registry and apply listeners to the controls:
+ initConfiguration();
+
+ //set the language according to the Linguistic
+ int oL = getOfficeLinguistic();
+ myConfig.cp_BusinessLetter.cp_Norm = oL;
+ myConfig.cp_PrivateOfficialLetter.cp_Norm = oL;
+ myConfig.cp_PrivateLetter.cp_Norm = oL;
+ initializeTemplates(xMSF);
+
+ if (myConfig.cp_BusinessLetter.cp_Greeting.equals(""))
+ {
+ myConfig.cp_BusinessLetter.cp_Greeting = resources.GreetingLabels[0];
+ }
+ if (myConfig.cp_BusinessLetter.cp_Salutation.equals(""))
+ {
+ myConfig.cp_BusinessLetter.cp_Salutation = resources.SalutationLabels[0];
+ }
+ if (myConfig.cp_PrivateOfficialLetter.cp_Greeting.equals(""))
+ {
+ myConfig.cp_PrivateOfficialLetter.cp_Greeting = resources.GreetingLabels[1];
+ }
+ if (myConfig.cp_PrivateOfficialLetter.cp_Salutation.equals(""))
+ {
+ myConfig.cp_PrivateOfficialLetter.cp_Salutation = resources.SalutationLabels[1];
+ }
+ if (myConfig.cp_PrivateLetter.cp_Greeting.equals(""))
+ {
+ myConfig.cp_PrivateLetter.cp_Greeting = resources.GreetingLabels[2];
+ }
+ 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();
+ }
+
+ XWindow xContainerWindow = myLetterDoc.xFrame.getContainerWindow();
+ XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
+ createWindowPeer(xWindowPeer);
+
+ //add the Roadmap to the dialog:
+ insertRoadmap();
+
+ //load the last used document and apply last used settings:
+ setConfiguration();
+
+ //If the configuration does not define Greeting/Salutation yet choose a default
+ setDefaultForGreetingAndSalutation();
+
+ //disable funtionality that is not supported by the template:
+ initializeElements();
+
+ //disable the document, so that the user cannot change anything:
+ myLetterDoc.xFrame.getComponentWindow().setEnable(false);
+
+ executeDialog(myLetterDoc.xFrame);
+ removeTerminateListener();
+ closeDocument();
+ running = false;
+
+ }
+ catch (Exception exception)
+ {
+ removeTerminateListener();
+ exception.printStackTrace(System.out);
+ running = false;
+ return;
+ }
+ }
+
+ public void cancelWizard()
+ {
+ xDialog.endExecute();
+ running = false;
+ }
+
+ public boolean finishWizard()
+ {
+ switchToStep(getCurrentStep(), getMaxStep());
+ try
+ {
+ //myLetterDoc.xTextDocument.lockControllers();
+ FileAccess fileAccess = new FileAccess(xMSF);
+ sPath = myPathSelection.getSelectedPath();
+ if (sPath.equals(""))
+ {
+ myPathSelection.triggerPathPicker();
+ sPath = myPathSelection.getSelectedPath();
+ }
+ sPath = fileAccess.getURL(sPath);
+
+ //first, if the filename was not changed, thus
+ //it is coming from a saved session, check if the
+ // file exists and warn the user.
+ if (!filenameChanged)
+ {
+ 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 false;
+ }
+ }
+ }
+ myLetterDoc.setWizardTemplateDocInfo(resources.resLetterWizardDialog_title, resources.resTemplateDescription);
+ myLetterDoc.killEmptyUserFields();
+ myLetterDoc.keepLogoFrame = (chkUseLogo.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))
+ {
+ myLetterDoc.keepSenderAddressRepeatedFrame = false;
+ }
+ if ((chkBusinessPaper.getState() != 0) && (chkPaperCompanyAddress.getState() != 0))
+ {
+ myLetterDoc.keepAddressFrame = false;
+ }
+ }
+
+ myLetterDoc.killEmptyFrames();
+
+
+ bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath, "writer8_template", false, "Template could not be saved to " + sPath);
+
+ if (bSaveSuccess)
+ {
+ saveConfiguration();
+ XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
+ PropertyValue loadValues[] = new PropertyValue[4];
+ loadValues[0] = new PropertyValue();
+ loadValues[0].Name = "AsTemplate";
+ loadValues[1] = new PropertyValue();
+ loadValues[1].Name = "MacroExecutionMode";
+ 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[3] = new PropertyValue();
+ loadValues[3].Name = "InteractionHandler";
+ loadValues[3].Value = xIH;
+
+ if (bEditTemplate)
+ {
+ loadValues[0].Value = Boolean.FALSE;
+ }
+ else
+ {
+ loadValues[0].Value = Boolean.TRUE;
+ }
+ Object oDoc = OfficeDocument.load(Desktop.getDesktop(xMSF), sPath, "_default", loadValues);
+ XTextDocument xTextDocument = (com.sun.star.text.XTextDocument) oDoc;
+ 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
+ {
+ //TODO: Error Handling
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ xDialog.endExecute();
+ running = false;
+ }
+ return true;
+ }
+
+ public void closeDocument()
+ {
+ try
+ {
+ //xComponent.dispose();
+ XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myLetterDoc.xFrame);
+ xCloseable.close(false);
+ }
+ catch (CloseVetoException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ 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);
+ setControlProperty("lblPrivOfficialStyle", "Enabled", Boolean.FALSE);
+ setControlProperty("lstPrivOfficialStyle", "Enabled", Boolean.FALSE);
+ setControlProperty("lblPrivateStyle", "Enabled", Boolean.FALSE);
+ setControlProperty("lstPrivateStyle", "Enabled", Boolean.FALSE);
+ lstBusinessStyleItemChanged();
+ enableSenderReceiver();
+ setPossibleFooter(true);
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ {
+ myPathSelection.initializePath();
+ }
+ }
+
+ 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);
+ setControlProperty("lblPrivOfficialStyle", "Enabled", Boolean.TRUE);
+ setControlProperty("lstPrivOfficialStyle", "Enabled", Boolean.TRUE);
+ setControlProperty("lblPrivateStyle", "Enabled", Boolean.FALSE);
+ setControlProperty("lstPrivateStyle", "Enabled", Boolean.FALSE);
+ lstPrivOfficialStyleItemChanged();
+ disableBusinessPaper();
+ enableSenderReceiver();
+ setPossibleFooter(true);
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ {
+ myPathSelection.initializePath();
+ }
+ }
+
+ 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);
+ setControlProperty("lblPrivOfficialStyle", "Enabled", Boolean.FALSE);
+ setControlProperty("lstPrivOfficialStyle", "Enabled", Boolean.FALSE);
+ setControlProperty("lblPrivateStyle", "Enabled", Boolean.TRUE);
+ setControlProperty("lstPrivateStyle", "Enabled", Boolean.TRUE);
+ lstPrivateStyleItemChanged();
+ disableBusinessPaper();
+ disableSenderReceiver();
+ setPossibleFooter(false);
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ {
+ myPathSelection.initializePath();
+ }
+ }
+
+ public void optSenderPlaceholderItemChanged()
+ {
+ setControlProperty("lblSenderName", "Enabled", Boolean.FALSE);
+ setControlProperty("lblSenderStreet", "Enabled", Boolean.FALSE);
+ setControlProperty("lblPostCodeCity", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderName", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderStreet", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderPostCode", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderState", "Enabled", Boolean.FALSE);
+ setControlProperty("txtSenderCity", "Enabled", Boolean.FALSE);
+ myLetterDoc.fillSenderWithUserData();
+ }
+
+ public void optSenderDefineItemChanged()
+ {
+ setControlProperty("lblSenderName", "Enabled", Boolean.TRUE);
+ setControlProperty("lblSenderStreet", "Enabled", Boolean.TRUE);
+ setControlProperty("lblPostCodeCity", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderName", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderStreet", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderPostCode", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderState", "Enabled", Boolean.TRUE);
+ setControlProperty("txtSenderCity", "Enabled", Boolean.TRUE);
+ txtSenderNameTextChanged();
+ txtSenderStreetTextChanged();
+ txtSenderPostCodeTextChanged();
+ txtSenderStateTextChanged();
+ txtSenderCityTextChanged();
+ }
+
+ public void optCreateLetterItemChanged()
+ {
+ bEditTemplate = false;
+ }
+
+ public void optMakeChangesItemChanged()
+ {
+ bEditTemplate = true;
+ }
+
+ public void optReceiverPlaceholderItemChanged()
+ {
+ OfficeDocument.attachEventCall(xTextDocument, "OnNew", "StarBasic", "macro:///Template.Correspondence.Placeholder()");
+ }
+
+ public void optReceiverDatabaseItemChanged()
+ {
+ OfficeDocument.attachEventCall(xTextDocument, "OnNew", "StarBasic", "macro:///Template.Correspondence.Database()");
+ }
+
+ public void lstBusinessStyleItemChanged()
+ {
+ xTextDocument = myLetterDoc.loadAsPreview(BusinessFiles[1][lstBusinessStyle.getSelectedItemPos()], false);
+ myLetterDoc.xTextDocument.lockControllers();
+ initializeElements();
+ chkBusinessPaperItemChanged();
+ setElements(false);
+ myLetterDoc.xTextDocument.unlockControllers();
+ activate();
+ }
+
+ public void lstPrivOfficialStyleItemChanged()
+ {
+ xTextDocument = myLetterDoc.loadAsPreview(OfficialFiles[1][lstPrivOfficialStyle.getSelectedItemPos()], false);
+ myLetterDoc.xTextDocument.lockControllers();
+ initializeElements();
+ setPossibleSenderData(true);
+ setElements(false);
+ myLetterDoc.xTextDocument.unlockControllers();
+ activate();
+ }
+
+ public void lstPrivateStyleItemChanged()
+ {
+ xTextDocument = myLetterDoc.loadAsPreview(PrivateFiles[1][lstPrivateStyle.getSelectedItemPos()], false);
+ myLetterDoc.xTextDocument.lockControllers();
+ initializeElements();
+ setElements(true);
+ myLetterDoc.xTextDocument.unlockControllers();
+ activate();
+ }
+
+ public void numLogoHeightTextChanged()
+ {
+ BusCompanyLogo.iHeight = (int) (numLogoHeight.getValue() * 1000);
+ BusCompanyLogo.setFramePosition();
+ }
+
+ public void numLogoWidthTextChanged()
+ {
+ BusCompanyLogo.iWidth = (int) (numLogoWidth.getValue() * 1000);
+ BusCompanyLogo.setFramePosition();
+ }
+
+ public void numLogoXTextChanged()
+ {
+ BusCompanyLogo.iXPos = (int) (numLogoX.getValue() * 1000);
+ BusCompanyLogo.setFramePosition();
+ }
+
+ public void numLogoYTextChanged()
+ {
+ BusCompanyLogo.iYPos = (int) (numLogoY.getValue() * 1000);
+ BusCompanyLogo.setFramePosition();
+ }
+
+ public void numAddressWidthTextChanged()
+ {
+ BusCompanyAddress.iWidth = (int) (numAddressWidth.getValue() * 1000);
+ BusCompanyAddress.setFramePosition();
+ }
+
+ public void numAddressXTextChanged()
+ {
+ BusCompanyAddress.iXPos = (int) (numAddressX.getValue() * 1000);
+ BusCompanyAddress.setFramePosition();
+ }
+
+ public void numAddressYTextChanged()
+ {
+ BusCompanyAddress.iYPos = (int) (numAddressY.getValue() * 1000);
+ BusCompanyAddress.setFramePosition();
+ }
+
+ public void numAddressHeightTextChanged()
+ {
+ BusCompanyAddress.iHeight = (int) (numAddressHeight.getValue() * 1000);
+ BusCompanyAddress.setFramePosition();
+ }
+
+ 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)
+ {
+ //minimal value is required, otherwise the frame creation fails
+ if (numLogoWidth.getValue() == 0)
+ {
+ numLogoWidth.setValue(0.1);
+ }
+ 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));
+ setControlProperty("numLogoHeight", "Enabled", Boolean.TRUE);
+ setControlProperty("lblCompanyLogoHeight", "Enabled", Boolean.TRUE);
+ setControlProperty("numLogoWidth", "Enabled", Boolean.TRUE);
+ setControlProperty("lblCompanyLogoWidth", "Enabled", Boolean.TRUE);
+ setControlProperty("numLogoX", "Enabled", Boolean.TRUE);
+ setControlProperty("lblCompanyLogoX", "Enabled", Boolean.TRUE);
+ setControlProperty("numLogoY", "Enabled", Boolean.TRUE);
+ setControlProperty("lblCompanyLogoY", "Enabled", Boolean.TRUE);
+ setPossibleLogo(false);
+ }
+ else
+ {
+ if (BusCompanyLogo != null)
+ {
+ BusCompanyLogo.removeFrame();
+ }
+ setControlProperty("numLogoHeight", "Enabled", Boolean.FALSE);
+ setControlProperty("lblCompanyLogoHeight", "Enabled", Boolean.FALSE);
+ setControlProperty("numLogoWidth", "Enabled", Boolean.FALSE);
+ setControlProperty("lblCompanyLogoWidth", "Enabled", Boolean.FALSE);
+ setControlProperty("numLogoX", "Enabled", Boolean.FALSE);
+ setControlProperty("lblCompanyLogoX", "Enabled", Boolean.FALSE);
+ setControlProperty("numLogoY", "Enabled", Boolean.FALSE);
+ setControlProperty("lblCompanyLogoY", "Enabled", Boolean.FALSE);
+ setPossibleLogo(true);
+ }
+ }
+
+ public void chkPaperCompanyAddressItemChanged()
+ {
+ if (chkPaperCompanyAddress.getState() != 0)
+ {
+// minimal value is required, otherwise the frame creation fails
+ if (numAddressWidth.getValue() == 0)
+ {
+ numAddressWidth.setValue(0.1);
+ }
+ 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));
+ setControlProperty("numAddressHeight", "Enabled", Boolean.TRUE);
+ setControlProperty("lblCompanyAddressHeight", "Enabled", Boolean.TRUE);
+ setControlProperty("numAddressWidth", "Enabled", Boolean.TRUE);
+ setControlProperty("lblCompanyAddressWidth", "Enabled", Boolean.TRUE);
+ setControlProperty("numAddressX", "Enabled", Boolean.TRUE);
+ setControlProperty("lblCompanyAddressX", "Enabled", Boolean.TRUE);
+ setControlProperty("numAddressY", "Enabled", Boolean.TRUE);
+ setControlProperty("lblCompanyAddressY", "Enabled", Boolean.TRUE);
+ if (myLetterDoc.hasElement("Sender Address"))
+ {
+ myLetterDoc.switchElement("Sender Address", (false));
+ }
+ if (chkCompanyReceiver.getState() != 0)
+ {
+ setPossibleSenderData(false);
+ }
+ }
+ else
+ {
+ if (BusCompanyAddress != null)
+ {
+ BusCompanyAddress.removeFrame();
+ }
+ setControlProperty("numAddressHeight", "Enabled", Boolean.FALSE);
+ setControlProperty("lblCompanyAddressHeight", "Enabled", Boolean.FALSE);
+ setControlProperty("numAddressWidth", "Enabled", Boolean.FALSE);
+ setControlProperty("lblCompanyAddressWidth", "Enabled", Boolean.FALSE);
+ setControlProperty("numAddressX", "Enabled", Boolean.FALSE);
+ setControlProperty("lblCompanyAddressX", "Enabled", Boolean.FALSE);
+ setControlProperty("numAddressY", "Enabled", Boolean.FALSE);
+ setControlProperty("lblCompanyAddressY", "Enabled", Boolean.FALSE);
+ if (myLetterDoc.hasElement("Sender Address"))
+ {
+ myLetterDoc.switchElement("Sender Address", (true));
+ }
+ setPossibleSenderData(true);
+ if (optSenderDefine.getState())
+ {
+ optSenderDefineItemChanged();
+ }
+ if (optSenderPlaceholder.getState())
+ {
+ optSenderPlaceholderItemChanged();
+ }
+ }
+ }
+
+ public void chkCompanyReceiverItemChanged()
+ {
+ XTextFrame xReceiverFrame = null;
+
+ if (chkCompanyReceiver.getState() != 0)
+ {
+ try
+ {
+ xReceiverFrame = TextFrameHandler.getFrameByName("Receiver Address", xTextDocument);
+ Integer FrameWidth = (Integer) Helper.getUnoPropertyValue(xReceiverFrame, "Width");
+ int iFrameWidth = FrameWidth.intValue();
+ Integer FrameX = (Integer) Helper.getUnoPropertyValue(xReceiverFrame, "HoriOrientPosition");
+ int iFrameX = FrameX.intValue();
+ Integer FrameY = (Integer) Helper.getUnoPropertyValue(xReceiverFrame, "VertOrientPosition");
+ int iFrameY = FrameY.intValue();
+
+ //Height of the Company Address in the Receiver Field
+ int iReceiverHeight = (int) (0.5 * 1000);
+ BusCompanyAddressReceiver = myLetterDoc.new BusinessPaperObject(" ", iFrameWidth, iReceiverHeight, iFrameX, (iFrameY - iReceiverHeight));
+
+ setPossibleAddressReceiver(false);
+ }
+ catch (NoSuchElementException e)
+ {
+ // TODO Error Message: Template modified!
+ e.printStackTrace();
+ }
+ catch (WrappedTargetException e)
+ {
+ e.printStackTrace();
+ }
+ if (chkPaperCompanyAddress.getState() != 0)
+ {
+ setPossibleSenderData(false);
+ }
+ }
+ else
+ {
+ if (BusCompanyAddressReceiver != null)
+ {
+ BusCompanyAddressReceiver.removeFrame();
+ }
+ setPossibleAddressReceiver(true);
+ setPossibleSenderData(true);
+ if (optSenderDefine.getState())
+ {
+ optSenderDefineItemChanged();
+ }
+ if (optSenderPlaceholder.getState())
+ {
+ optSenderPlaceholderItemChanged();
+ }
+ }
+ }
+
+ public void chkPaperFooterItemChanged()
+ {
+
+ if (chkPaperFooter.getState() != 0)
+ {
+ //minimal value is required, otherwise the frame creation fails
+ 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)
+ {
+ BusFooter.removeFrame();
+ }
+ setControlProperty("numFooterHeight", "Enabled", Boolean.FALSE);
+ setControlProperty("lblFooterHeight", "Enabled", Boolean.FALSE);
+ setPossibleFooter(true);
+ }
+ }
+
+ //switch Elements on/off -------------------------------------------------------
+ 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)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ 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)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void chkUseSignsItemChanged()
+ {
+ if (myLetterDoc.hasElement("Letter Signs"))
+ {
+ myLetterDoc.switchElement("Letter Signs", (chkUseSigns.getState() != 0));
+ }
+ }
+
+ public void chkUseSubjectItemChanged()
+ {
+ if (myLetterDoc.hasElement("Subject Line"))
+ {
+ myLetterDoc.switchElement("Subject Line", (chkUseSubject.getState() != 0));
+ }
+ }
+
+ public void chkUseBendMarksItemChanged()
+ {
+ if (myLetterDoc.hasElement("Bend Marks"))
+ {
+ myLetterDoc.switchElement("Bend Marks", (chkUseBendMarks.getState() != 0));
+ }
+ }
+
+ 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());
+ myLetterDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
+ }
+ else
+ {
+ myLetterDoc.switchFooter("First Page", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
+ myLetterDoc.switchFooter("Standard", bFooterPossible, (chkFooterPageNumbers.getState() != 0), txtFooter.getText());
+ }
+
+ //enable/disable roadmap item for footer page
+ XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER);
+ Helper.setUnoPropertyValue(BPaperItem, "Enabled", new Boolean(bFooterPossible));
+
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void chkFooterNextPagesItemChanged()
+ {
+ chkUseFooterItemChanged();
+ }
+
+ public void chkFooterPageNumbersItemChanged()
+ {
+ chkUseFooterItemChanged();
+ }
+
+ private void setPossibleFooter(boolean bState)
+ {
+ setControlProperty("chkUseFooter", "Enabled", new Boolean(bState));
+ chkUseFooterItemChanged();
+ }
+
+ 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"))
+ {
+ setControlProperty("chkUseLogo", "Enabled", new Boolean(bState));
+ chkUseLogoItemChanged();
+ }
+ }
+
+ public void txtFooterTextChanged()
+ {
+ chkUseFooterItemChanged();
+ }
+
+ public void txtSenderNameTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("Company", txtSenderName.getText());
+ }
+
+ public void txtSenderStreetTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("Street", txtSenderStreet.getText());
+ }
+
+ public void txtSenderCityTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("City", txtSenderCity.getText());
+ }
+
+ public void txtSenderPostCodeTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("PostCode", txtSenderPostCode.getText());
+ }
+
+ public void txtSenderStateTextChanged()
+ {
+ TextFieldHandler myFieldHandler = new TextFieldHandler(myLetterDoc.xMSF, xTextDocument);
+ myFieldHandler.changeUserFieldContent("State", txtSenderState.getText());
+ }
+
+ public void txtTemplateNameTextChanged()
+ {
+ XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentProperties xDocProps = xDocPropsSuppl.getDocumentProperties();
+ String TitleName = txtTemplateName.getText();
+ xDocProps.setTitle(TitleName);
+ }
+
+ 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()
+ {
+ XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ myLetterDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
+ }
+
+ public void lstSalutationTextChanged()
+ {
+ }
+
+ 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()
+ {
+ XTextComponent xTextComponent;
+ xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ if (xTextComponent.getText().equals(""))
+ {
+ xTextComponent.setText(resources.SalutationLabels[0]);
+ }
+ xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ if (xTextComponent.getText().equals(""))
+ {
+ xTextComponent.setText(resources.GreetingLabels[0]);
+ }
+ }
+
+ public void lstGreetingItemChanged()
+ {
+ XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ myLetterDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
+ }
+
+ public void lstGreetingTextChanged()
+ {
+ }
+
+ // ----------------------------------------------------------------------------
+ public void chkBusinessPaperItemChanged()
+ {
+ //enable/disable Roadmap Entry Business Paper
+ if (chkBusinessPaper.getState() != 0)
+ {
+ enableBusinessPaper();
+ }
+ else
+ {
+ disableBusinessPaper();
+ setPossibleSenderData(true);
+ }
+ }
+
+ 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))
+ {
+ oL = i;
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ //fall back to English:
+ for (int i = 0; i < Norms.length; i++)
+ {
+ if (Norms[i].equalsIgnoreCase("en-US"))
+ {
+ oL = i;
+ found = true;
+ break;
+ }
+ }
+ }
+ return oL;
+ }
+
+ 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)
+ {
+ setControlProperty("txtSenderCity", "Enabled", new Boolean(bState));
+ setControlProperty("txtSenderName", "Enabled", new Boolean(bState));
+ setControlProperty("txtSenderPostCode", "Enabled", new Boolean(bState));
+ setControlProperty("txtSenderStreet", "Enabled", new Boolean(bState));
+ setControlProperty("txtSenderCity", "Enabled", new Boolean(bState));
+ setControlProperty("txtSenderState", "Enabled", new Boolean(bState));
+ setControlProperty("lblSenderName", "Enabled", new Boolean(bState));
+ setControlProperty("lblSenderStreet", "Enabled", new Boolean(bState));
+ setControlProperty("lblPostCodeCity", "Enabled", new Boolean(bState));
+ }
+ }
+
+ private void enableSenderReceiver()
+ {
+ XInterface BPaperItem = getRoadmapItemByID(RM_SENDERRECEIVER);
+ Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.TRUE);
+ }
+
+ private void disableSenderReceiver()
+ {
+ XInterface BPaperItem = getRoadmapItemByID(RM_SENDERRECEIVER);
+ Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.FALSE);
+ }
+
+ private void enableBusinessPaper()
+ {
+ XInterface BPaperItem = getRoadmapItemByID(RM_BUSINESSPAPER);
+ Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.TRUE);
+ chkPaperCompanyLogoItemChanged();
+ chkPaperCompanyAddressItemChanged();
+ chkPaperFooterItemChanged();
+ chkCompanyReceiverItemChanged();
+ }
+
+ private void disableBusinessPaper()
+ {
+ XInterface BPaperItem = getRoadmapItemByID(RM_BUSINESSPAPER);
+ Helper.setUnoPropertyValue(BPaperItem, "Enabled", Boolean.FALSE);
+ if (BusCompanyLogo != null)
+ {
+ BusCompanyLogo.removeFrame();
+ }
+ if (BusCompanyAddress != null)
+ {
+ BusCompanyAddress.removeFrame();
+ }
+ if (BusFooter != null)
+ {
+ BusFooter.removeFrame();
+ }
+ if (BusCompanyAddressReceiver != null)
+ {
+ BusCompanyAddressReceiver.removeFrame();
+ }
+ setPossibleAddressReceiver(true);
+ setPossibleFooter(true);
+ setPossibleLogo(true);
+ if (myLetterDoc.hasElement("Sender Address"))
+ {
+ myLetterDoc.switchElement("Sender Address", (true));
+ }
+
+ }
+
+ public void lstLetterNormItemChanged()
+ {
+ //when the norm changes, the correct template needs to be reloaded
+ sCurrentNorm = Norms[getCurrentLetter().cp_Norm];
+ initializeTemplates(xMSF);
+ if (optBusinessLetter.getState())
+ {
+ lstBusinessStyleItemChanged();
+ }
+ if (optPrivOfficialLetter.getState())
+ {
+ lstPrivOfficialStyleItemChanged();
+ }
+ if (optPrivateLetter.getState())
+ {
+ lstPrivateStyleItemChanged();
+ }
+ }
+
+ public void initializeSalutation()
+ {
+ setControlProperty("lstSalutation", "StringItemList", resources.SalutationLabels);
+ }
+
+ public void initializeGreeting()
+ {
+ setControlProperty("lstGreeting", "StringItemList", resources.GreetingLabels);
+ }
+
+ 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 sLetterSubPath = "/wizard/letter/";
+
+ try
+ {
+ sTemplatePath = FileAccess.deleteLastSlashfromUrl(sTemplatePath);
+ String[] PathParts = sTemplatePath.split("/");
+ String nuString = "";
+ String sMainPath;
+ for (int i = 0; i < (PathParts.length - 1); i++)
+ {
+ nuString = nuString + PathParts[i] + "/";
+ }
+ String sLocLetterPath;
+ sMainPath = nuString;
+ sMainPath = FileAccess.deleteLastSlashfromUrl(sMainPath);
+
+ sLetterPath = sMainPath + sLetterSubPath;
+ //sLetterLangPackPath = FileAccess.combinePaths(xMSF, sTemplatePath, sLetterSubPath);
+
+ 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);
+ 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"))
+ {
+ sLocLetterPath = FileAccess.deleteLastSlashfromUrl(nameList1[i] + sLetterSubPath);
+ try
+ {
+ nameList1b = xSimpleFileAccess.getFolderContents(sLocLetterPath, true);
+ for (int j = 0; j < nameList1b.length; j++)
+ {
+ String theFileNameb = FileAccess.getFilename(nameList1b[j]);
+ allPaths.add(nameList1[i] + sLetterSubPath + theFileNameb);
+ }
+ }
+ 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++)
+ {
+ boolean found = false;
+ for (int t = 0; t < nameList1.length; t++)
+ {
+ if (FileAccess.getFilename(nameList2[i]).equalsIgnoreCase(FileAccess.getFilename(nameList1[t])))
+ {
+ found = true;
+ }
+ }
+ if (!found)
+ {
+ allPaths.add(nameList2[i]);
+ }
+ }
+ nameList = allPaths.toArray();
+
+
+ }
+ catch (CommandAbortedException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ //} catch (NoValidPathException e) {
+ // TODO Auto-generated catch block
+ // e.printStackTrace();
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ 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++)
+ {
+ 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];
+ 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];
+ 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++;
+ **/
+ }
+ }
+
+
+ Norms = new String[NormsVector.size()];
+ NormsVector.toArray(Norms);
+
+ NormPaths = new String[NormsPathVector.size()];
+ NormsPathVector.toArray(NormPaths);
+
+ LanguageLabels = new String[LanguageLabelsVector.size()];
+ LanguageLabelsVector.toArray(LanguageLabels);
+
+ //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 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)
+ {
+ 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
+ });
+// }
+// catch (com.sun.star.wizards.common.NoValidPathException e)
+// {
+// return false;
+// }
+ return true;
+ }
+
+ 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")));
+ setControlProperty("chkUseSubject", "Enabled", new Boolean(myLetterDoc.hasElement("Subject Line")));
+ setControlProperty("chkUseSigns", "Enabled", new Boolean(myLetterDoc.hasElement("Letter Signs")));
+ myLetterDoc.updateDateFields();
+ }
+
+ public void setConfiguration()
+ {
+ //set correct Configuration tree:
+
+ if (optBusinessLetter.getState())
+ {
+ optBusinessLetterItemChanged();
+ }
+ if (optPrivOfficialLetter.getState())
+ {
+ optPrivOfficialLetterItemChanged();
+ }
+ if (optPrivateLetter.getState())
+ {
+ optPrivateLetterItemChanged();
+ }
+ }
+
+ public void setElements(boolean privLetter)
+ {
+ //UI relevant:
+ if (optSenderDefine.getState())
+ {
+ optSenderDefineItemChanged();
+ }
+ if (optSenderPlaceholder.getState())
+ {
+ optSenderPlaceholderItemChanged();
+ }
+ chkUseSignsItemChanged();
+ chkUseSubjectItemChanged();
+ chkUseSalutationItemChanged();
+ chkUseGreetingItemChanged();
+ chkUseBendMarksItemChanged();
+ chkUseAddressReceiverItemChanged();
+ txtTemplateNameTextChanged();
+
+ //not UI relevant:
+ if (optReceiverDatabase.getState() && !privLetter)
+ {
+ optReceiverDatabaseItemChanged();
+ }
+ if (optReceiverPlaceholder.getState() && !privLetter)
+ {
+ optReceiverPlaceholderItemChanged();
+ }
+ if (optCreateLetter.getState())
+ {
+ optCreateLetterItemChanged();
+ }
+ if (optMakeChanges.getState())
+ {
+ optMakeChangesItemChanged();
+ }
+ }
+
+ public void insertRoadmap()
+ {
+ addRoadmap();
+ int i = 0;
+ i = insertRoadmapItem(0, true, resources.RoadmapLabels[RM_TYPESTYLE], RM_TYPESTYLE);
+ i = insertRoadmapItem(i, false, resources.RoadmapLabels[RM_BUSINESSPAPER], RM_BUSINESSPAPER);
+ i = insertRoadmapItem(i, true, resources.RoadmapLabels[RM_ELEMENTS], RM_ELEMENTS);
+ i = insertRoadmapItem(i, true, resources.RoadmapLabels[RM_SENDERRECEIVER], RM_SENDERRECEIVER);
+ i = insertRoadmapItem(i, false, resources.RoadmapLabels[RM_FOOTER], RM_FOOTER);
+ i = insertRoadmapItem(i, true, resources.RoadmapLabels[RM_FINALSETTINGS], RM_FINALSETTINGS);
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ }
+
+ private class myPathSelectionListener implements XPathSelectionListener
+ {
+
+ public void validatePath()
+ {
+ if (myPathSelection.usedPathPicker)
+ {
+ filenameChanged = true;
+ }
+ myPathSelection.usedPathPicker = false;
+ }
+ }
+
+ 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.sDefaultDirectory = sUserTemplatePath;
+ myPathSelection.sDefaultName = "myLetterTemplate.ott";
+ myPathSelection.sDefaultFilter = "writer8_template";
+ myPathSelection.addSelectionListener(new myPathSelectionListener());
+ }
+
+ 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(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));
+ mainDA.add(UnoDataAware.attachCheckBox(myConfig.cp_BusinessLetter, "cp_BusinessPaper", chkBusinessPaper, null, true));
+
+ CGLetter cgl = myConfig.cp_BusinessLetter;
+
+ CGPaperElementLocation cgpl = myConfig.cp_BusinessLetter.cp_CompanyLogo;
+ CGPaperElementLocation cgpa = myConfig.cp_BusinessLetter.cp_CompanyAddress;
+
+ businessDA.add(UnoDataAware.attachCheckBox(cgpl, "cp_Display", chkPaperCompanyLogo, null, true));
+ businessDA.add(UnoDataAware.attachNumericControl(cgpl, "cp_Width", numLogoWidth, null, true));
+ businessDA.add(UnoDataAware.attachNumericControl(cgpl, "cp_Height", numLogoHeight, null, true));
+ businessDA.add(UnoDataAware.attachNumericControl(cgpl, "cp_X", numLogoX, null, true));
+ businessDA.add(UnoDataAware.attachNumericControl(cgpl, "cp_Y", numLogoY, null, true));
+ businessDA.add(UnoDataAware.attachCheckBox(cgpa, "cp_Display", chkPaperCompanyAddress, null, true));
+ businessDA.add(UnoDataAware.attachNumericControl(cgpa, "cp_Width", numAddressWidth, null, true));
+ businessDA.add(UnoDataAware.attachNumericControl(cgpa, "cp_Height", numAddressHeight, null, true));
+ businessDA.add(UnoDataAware.attachNumericControl(cgpa, "cp_X", numAddressX, null, true));
+ businessDA.add(UnoDataAware.attachNumericControl(cgpa, "cp_Y", numAddressY, null, true));
+
+ businessDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PaperCompanyAddressReceiverField", chkCompanyReceiver, null, true));
+ businessDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PaperFooter", chkPaperFooter, null, true));
+ businessDA.add(UnoDataAware.attachNumericControl(cgl, "cp_PaperFooterHeight", numFooterHeight, null, true));
+
+ letterDA.add(UnoDataAware.attachListBox(cgl, "cp_Norm", lstLetterNorm, null, true));
+ letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintCompanyLogo", chkUseLogo, null, true));
+ letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintCompanyAddressReceiverField", chkUseAddressReceiver, null, true));
+ letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintLetterSigns", chkUseSigns, null, true));
+ letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintSubjectLine", chkUseSubject, null, true));
+ letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintSalutation", chkUseSalutation, null, true));
+ letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintBendMarks", chkUseBendMarks, null, true));
+ letterDA.add(UnoDataAware.attachCheckBox(cgl, "cp_PrintGreeting", chkUseGreeting, null, true));
+ 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(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(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(UnoDataAware.attachEditControl(cgl, "cp_TemplateName", txtTemplateName, null, true));
+ letterDA.add(UnoDataAware.attachEditControl(cgl, "cp_TemplatePath", myPathSelection.xSaveTextBox, null, true));
+
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace();
+ }
+
+ }
+
+ private void updateUI()
+ {
+ UnoDataAware.updateUI(mainDA);
+ UnoDataAware.updateUI(letterDA);
+ UnoDataAware.updateUI(businessDA);
+ }
+
+ 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)
+ {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java
new file mode 100644
index 000000000000..01731d989ebc
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.java
@@ -0,0 +1,207 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+{
+
+ final static String UNIT_NAME = "dbwizres";
+ final static String MODULE_NAME = "dbw";
+ final static int RID_LETTERWIZARDDIALOG_START = 3000;
+ final static int RID_LETTERWIZARDGREETING_START = 3080;
+ final static int RID_LETTERWIZARDSALUTATION_START = 3090;
+ 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;
+ String resoptPrivOfficialLetter_value;
+ String resoptPrivateLetter_value;
+ String reschkBusinessPaper_value;
+ String reschkPaperCompanyLogo_value;
+ String reschkPaperCompanyAddress_value;
+ String reschkPaperFooter_value;
+ String reschkCompanyReceiver_value;
+ String reschkUseLogo_value;
+ String reschkUseAddressReceiver_value;
+ String reschkUseSigns_value;
+ String reschkUseSubject_value;
+ String reschkUseSalutation_value;
+ String reschkUseBendMarks_value;
+ String reschkUseGreeting_value;
+ String reschkUseFooter_value;
+ String resoptSenderPlaceholder_value;
+ String resoptSenderDefine_value;
+ String resoptReceiverPlaceholder_value;
+ String resoptReceiverDatabase_value;
+ String reschkFooterNextPages_value;
+ String reschkFooterPageNumbers_value;
+ String restxtTemplateName_value;
+ String resoptCreateLetter_value;
+ String resoptMakeChanges_value;
+ String reslblBusinessStyle_value;
+ String reslblPrivOfficialStyle_value;
+ String reslblPrivateStyle_value;
+ String reslblIntroduction_value;
+ String reslblLogoHeight_value;
+ String reslblLogoWidth_value;
+ String reslblLogoX_value;
+ String reslblLogoY_value;
+ String reslblAddressHeight_value;
+ String reslblAddressWidth_value;
+ String reslblAddressX_value;
+ String reslblAddressY_value;
+ String reslblFooterHeight_value;
+ String reslblLetterNorm_value;
+ String reslblSenderAddress_value;
+ String reslblSenderName_value;
+ String reslblSenderStreet_value;
+ String reslblPostCodeCity_value;
+ String reslblReceiverAddress_value;
+ String reslblFooter_value;
+ String reslblFinalExplanation1_value;
+ String reslblFinalExplanation2_value;
+ String reslblTemplateName_value;
+ String reslblTemplatePath_value;
+ String reslblProceed_value;
+ String reslblTitle1_value;
+ String reslblTitle3_value;
+ String reslblTitle2_value;
+ String reslblTitle4_value;
+ String reslblTitle5_value;
+ String reslblTitle6_value;
+
+ public LetterWizardDialogResources(XMultiServiceFactory xmsf)
+ {
+ super(xmsf, UNIT_NAME, MODULE_NAME);
+
+ resLetterWizardDialog_title = getResText(RID_LETTERWIZARDDIALOG_START + 1);
+ resLabel9_value = getResText(RID_LETTERWIZARDDIALOG_START + 2);
+ resoptBusinessLetter_value = getResText(RID_LETTERWIZARDDIALOG_START + 3);
+ resoptPrivOfficialLetter_value = getResText(RID_LETTERWIZARDDIALOG_START + 4);
+ resoptPrivateLetter_value = getResText(RID_LETTERWIZARDDIALOG_START + 5);
+ reschkBusinessPaper_value = getResText(RID_LETTERWIZARDDIALOG_START + 6);
+ reschkPaperCompanyLogo_value = getResText(RID_LETTERWIZARDDIALOG_START + 7);
+ reschkPaperCompanyAddress_value = getResText(RID_LETTERWIZARDDIALOG_START + 8);
+ reschkPaperFooter_value = getResText(RID_LETTERWIZARDDIALOG_START + 9);
+ reschkCompanyReceiver_value = getResText(RID_LETTERWIZARDDIALOG_START + 10);
+ reschkUseLogo_value = getResText(RID_LETTERWIZARDDIALOG_START + 11);
+ reschkUseAddressReceiver_value = getResText(RID_LETTERWIZARDDIALOG_START + 12);
+ reschkUseSigns_value = getResText(RID_LETTERWIZARDDIALOG_START + 13);
+ reschkUseSubject_value = getResText(RID_LETTERWIZARDDIALOG_START + 14);
+ reschkUseSalutation_value = getResText(RID_LETTERWIZARDDIALOG_START + 15);
+ reschkUseBendMarks_value = getResText(RID_LETTERWIZARDDIALOG_START + 16);
+ reschkUseGreeting_value = getResText(RID_LETTERWIZARDDIALOG_START + 17);
+ reschkUseFooter_value = getResText(RID_LETTERWIZARDDIALOG_START + 18);
+ resoptSenderPlaceholder_value = getResText(RID_LETTERWIZARDDIALOG_START + 19);
+ resoptSenderDefine_value = getResText(RID_LETTERWIZARDDIALOG_START + 20);
+ resoptReceiverPlaceholder_value = getResText(RID_LETTERWIZARDDIALOG_START + 21);
+ resoptReceiverDatabase_value = getResText(RID_LETTERWIZARDDIALOG_START + 22);
+ reschkFooterNextPages_value = getResText(RID_LETTERWIZARDDIALOG_START + 23);
+ reschkFooterPageNumbers_value = getResText(RID_LETTERWIZARDDIALOG_START + 24);
+ restxtTemplateName_value = getResText(RID_LETTERWIZARDDIALOG_START + 25);
+ resoptCreateLetter_value = getResText(RID_LETTERWIZARDDIALOG_START + 26);
+ resoptMakeChanges_value = getResText(RID_LETTERWIZARDDIALOG_START + 27);
+ reslblBusinessStyle_value = getResText(RID_LETTERWIZARDDIALOG_START + 28);
+ reslblPrivOfficialStyle_value = getResText(RID_LETTERWIZARDDIALOG_START + 29);
+ reslblPrivateStyle_value = getResText(RID_LETTERWIZARDDIALOG_START + 30);
+ reslblIntroduction_value = getResText(RID_LETTERWIZARDDIALOG_START + 31);
+ reslblLogoHeight_value = getResText(RID_LETTERWIZARDDIALOG_START + 32);
+ reslblLogoWidth_value = getResText(RID_LETTERWIZARDDIALOG_START + 33);
+ reslblLogoX_value = getResText(RID_LETTERWIZARDDIALOG_START + 34);
+ reslblLogoY_value = getResText(RID_LETTERWIZARDDIALOG_START + 35);
+ reslblAddressHeight_value = getResText(RID_LETTERWIZARDDIALOG_START + 36);
+ reslblAddressWidth_value = getResText(RID_LETTERWIZARDDIALOG_START + 37);
+ reslblAddressX_value = getResText(RID_LETTERWIZARDDIALOG_START + 38);
+ reslblAddressY_value = getResText(RID_LETTERWIZARDDIALOG_START + 39);
+ reslblFooterHeight_value = getResText(RID_LETTERWIZARDDIALOG_START + 40);
+ reslblLetterNorm_value = getResText(RID_LETTERWIZARDDIALOG_START + 41);
+ reslblSenderAddress_value = getResText(RID_LETTERWIZARDDIALOG_START + 42);
+ reslblSenderName_value = getResText(RID_LETTERWIZARDDIALOG_START + 43);
+ reslblSenderStreet_value = getResText(RID_LETTERWIZARDDIALOG_START + 44);
+ reslblPostCodeCity_value = getResText(RID_LETTERWIZARDDIALOG_START + 45);
+ reslblReceiverAddress_value = getResText(RID_LETTERWIZARDDIALOG_START + 46);
+ reslblFooter_value = getResText(RID_LETTERWIZARDDIALOG_START + 47);
+ reslblFinalExplanation1_value = getResText(RID_LETTERWIZARDDIALOG_START + 48);
+ reslblFinalExplanation2_value = getResText(RID_LETTERWIZARDDIALOG_START + 49);
+ reslblTemplateName_value = getResText(RID_LETTERWIZARDDIALOG_START + 50);
+ reslblTemplatePath_value = getResText(RID_LETTERWIZARDDIALOG_START + 51);
+ reslblProceed_value = getResText(RID_LETTERWIZARDDIALOG_START + 52);
+ reslblTitle1_value = getResText(RID_LETTERWIZARDDIALOG_START + 53);
+ reslblTitle3_value = getResText(RID_LETTERWIZARDDIALOG_START + 54);
+ reslblTitle2_value = getResText(RID_LETTERWIZARDDIALOG_START + 55);
+ reslblTitle4_value = getResText(RID_LETTERWIZARDDIALOG_START + 56);
+ reslblTitle5_value = getResText(RID_LETTERWIZARDDIALOG_START + 57);
+ reslblTitle6_value = getResText(RID_LETTERWIZARDDIALOG_START + 58);
+
+ loadRoadmapResources();
+ loadSalutationResources();
+ loadGreetingResources();
+ 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++)
+ {
+ 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 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
new file mode 100644
index 000000000000..82994f40dc6b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/LocaleCodes.java
@@ -0,0 +1,202 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+{
+
+ final static String UNIT_NAME = "svtres";
+ final static String MODULE_NAME = "svt";
+ PropertyValue[] allLanguageStrings;
+
+ public LocaleCodes(XMultiServiceFactory xmsf)
+ {
+ super(xmsf, UNIT_NAME, MODULE_NAME);
+ allLanguageStrings = getStringList(16635); // STR_ARR_SVT_LANGUAGE_TABLE from svtools/source/misc/langtab.src
+ }
+
+ public String getLanguageString(String MSID)
+ {
+ String LS = "unknown Language";
+ 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[135];
+
+ Ids[0] = "Afrikaans;af;1078";
+ Ids[1] = "Albanian;sq;1052";
+ Ids[2] = "Arabic - United Arab Emirates;ar-ae;14337";
+ Ids[3] = "Arabic - Bahrain;ar-bh;15361";
+ Ids[4] = "Arabic - Algeria;ar-dz;5121";
+ Ids[5] = "Arabic - Egypt;ar-eg;3073";
+ Ids[6] = "Arabic - Iraq;ar-iq;2049";
+ Ids[7] = "Arabic - Jordan;ar-jo;11265";
+ Ids[8] = "Arabic - Kuwait;ar-kw;13313";
+ Ids[9] = "Arabic - Lebanon;ar-lb;12289";
+ Ids[10] = "Arabic - Libya;ar-ly;4097";
+ Ids[11] = "Arabic - Morocco;ar-ma;6145";
+ Ids[12] = "Arabic - Oman;ar-om;8193";
+ Ids[13] = "Arabic - Qatar;ar-qa;16385";
+ Ids[14] = "Arabic - Saudi Arabia;ar-sa;1025";
+ Ids[15] = "Arabic - Syria;ar-sy;10241";
+ Ids[16] = "Arabic - Tunisia;ar-tn;7169";
+ Ids[17] = "Arabic - Yemen;ar-ye;9217";
+ Ids[18] = "Armenian;hy;1067";
+ Ids[19] = "Azeri - Latin;az-az;1068";
+ Ids[20] = "Azeri - Cyrillic;az-az;2092";
+ Ids[21] = "Basque;eu;1069";
+ Ids[22] = "Belarusian;be;1059";
+ Ids[23] = "Bulgarian;bg;1026";
+ Ids[24] = "Catalan;ca;1027";
+ Ids[25] = "Chinese - China;zh-cn;2052";
+ Ids[26] = "Chinese - Hong Kong SAR;zh-hk;3076";
+ Ids[27] = "Chinese - Macau SAR;zh-mo;5124";
+ Ids[28] = "Chinese - Singapore;zh-sg;4100";
+ Ids[29] = "Chinese - Taiwan;zh-tw;1028";
+ Ids[30] = "Croatian;hr;1050";
+ Ids[31] = "Czech;cs;1029";
+ Ids[32] = "Danish;da;1030";
+ Ids[33] = "Dutch - The Netherlands;nl-nl;1043";
+ Ids[34] = "Dutch - Belgium;nl-be;2067";
+ Ids[35] = "English - Australia;en-au;3081";
+ Ids[36] = "English - Belize;en-bz;10249";
+ Ids[37] = "English - Canada;en-ca;4105";
+ Ids[38] = "English - Caribbean;en-cb;9225";
+ Ids[39] = "English - Ireland;en-ie;6153";
+ Ids[40] = "English - Jamaica;en-jm;8201";
+ Ids[41] = "English - New Zealand;en-nz;5129";
+ Ids[42] = "English - Phillippines;en-ph;13321";
+ Ids[43] = "English - South Africa;en-za;7177";
+ Ids[44] = "English - Trinidad;en-tt;11273";
+ Ids[45] = "English - United Kingdom;en-gb;2057";
+ Ids[46] = "English - United States;en-us;1033";
+ Ids[47] = "Estonian;et;1061";
+ Ids[48] = "Farsi;fa;1065";
+ Ids[49] = "Finnish;fi;1035";
+ Ids[50] = "Faroese;fo;1080";
+ Ids[51] = "French - France;fr-fr;1036";
+ Ids[52] = "French - Belgium;fr-be;2060";
+ Ids[53] = "French - Canada;fr-ca;3084";
+ Ids[54] = "French - Luxembourg;fr-lu;5132";
+ Ids[55] = "French - Switzerland;fr-ch;4108";
+ Ids[56] = "Gaelic - Ireland;gd-ie;2108";
+ Ids[57] = "Gaelic - Scotland;gd;1084";
+ Ids[58] = "German - Germany;de-de;1031";
+ Ids[59] = "German - Austria;de-at;3079";
+ Ids[60] = "German - Liechtenstein;de-li;5127";
+ Ids[61] = "German - Luxembourg;de-lu;4103";
+ Ids[62] = "German - Switzerland;de-ch;2055";
+ Ids[63] = "Greek;el;1032";
+ Ids[64] = "Hebrew;he;1037";
+ Ids[65] = "Hindi;hi;1081";
+ Ids[66] = "Hungarian;hu;1038";
+ Ids[67] = "Icelandic;is;1039";
+ Ids[68] = "Indonesian;id;1057";
+ Ids[69] = "Italian - Italy;it-it;1040";
+ Ids[70] = "Italian - Switzerland;it-ch;2064";
+ Ids[71] = "Japanese;ja;1041";
+ Ids[72] = "Korean;ko;1042";
+ Ids[73] = "Latvian;lv;1062";
+ Ids[74] = "Lithuanian;lt;1063";
+ Ids[75] = "FYRO Macedonian;mk;1071";
+ Ids[76] = "Malay - Malaysia;ms-my;1086";
+ Ids[77] = "Malay - Brunei;ms-bn;2110";
+ Ids[78] = "Maltese;mt;1082";
+ Ids[79] = "Marathi;mr;1102";
+ Ids[80] = "Norwegian - Bokm?l;no-no;1044";
+ Ids[81] = "Norwegian - Nynorsk;no-no;2068";
+ Ids[82] = "Polish;pl;1045";
+ Ids[83] = "Portuguese - Portugal;pt-pt;2070";
+ Ids[84] = "Portuguese - Brazil;pt-br;1046";
+ Ids[85] = "Raeto-Romance;rm;1047";
+ Ids[86] = "Romanian - Romania;ro;1048";
+ Ids[87] = "Romanian - Moldova;ro-mo;2072";
+ Ids[88] = "Russian;ru;1049";
+ Ids[89] = "Russian - Moldova;ru-mo;2073";
+ Ids[90] = "Sanskrit;sa;1103";
+ Ids[91] = "Serbian - Cyrillic;sr-sp;3098";
+ Ids[92] = "Serbian - Latin;sr-sp;2074";
+ Ids[93] = "Setsuana;tn;1074";
+ Ids[94] = "Slovenian;sl;1060";
+ Ids[95] = "Slovak;sk;1051";
+ Ids[96] = "Sorbian;sb;1070";
+ Ids[97] = "Spanish - Spain;es-es;1034";
+ Ids[98] = "Spanish - Argentina;es-ar;11274";
+ Ids[99] = "Spanish - Bolivia;es-bo;16394";
+ Ids[100] = "Spanish - Chile;es-cl;13322";
+ Ids[101] = "Spanish - Colombia;es-co;9226";
+ Ids[102] = "Spanish - Costa Rica;es-cr;5130";
+ Ids[103] = "Spanish - Dominican Republic;es-do;7178";
+ Ids[104] = "Spanish - Ecuador;es-ec;12298";
+ Ids[105] = "Spanish - Guatemala;es-gt;4106";
+ Ids[106] = "Spanish - Honduras;es-hn;18442";
+ Ids[107] = "Spanish - Mexico;es-mx;2058";
+ Ids[108] = "Spanish - Nicaragua;es-ni;19466";
+ Ids[109] = "Spanish - Panama;es-pa;6154";
+ Ids[110] = "Spanish - Peru;es-pe;10250";
+ Ids[111] = "Spanish - Puerto Rico;es-pr;20490";
+ Ids[112] = "Spanish - Paraguay;es-py;15370";
+ Ids[113] = "Spanish - El Salvador;es-sv;17418";
+ Ids[114] = "Spanish - Uruguay;es-uy;14346";
+ Ids[115] = "Spanish - Venezuela;es-ve;8202";
+ Ids[116] = "Sutu;sx;1072";
+ Ids[117] = "Swahili;sw;1089";
+ Ids[118] = "Swedish - Sweden;sv-se;1053";
+ Ids[119] = "Swedish - Finland;sv-fi;2077";
+ Ids[120] = "Tamil;ta;1097";
+ Ids[121] = "Tatar;tt;1092";
+ Ids[122] = "Thai;th;1054";
+ Ids[123] = "Turkish;tr;1055";
+ Ids[124] = "Tsonga;ts;1073";
+ Ids[125] = "Ukrainian;uk;1058";
+ Ids[126] = "Urdu;ur;1056";
+ Ids[127] = "Uzbek - Cyrillic;uz-uz;2115";
+ Ids[128] = "Uzbek - Latin;uz-uz;1091";
+ Ids[129] = "Vietnamese;vi;1066";
+ Ids[130] = "Xhosa;xh;1076";
+ Ids[131] = "Yiddish;yi;1085";
+ Ids[132] = "Zulu;zu;1077";
+ Ids[133] = "Khmer;km-kh;1107";
+ Ids[134] = "Burmese;my-mm;1109";
+
+ return Ids;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/letter/MANIFEST.MF b/wizards/com/sun/star/wizards/letter/MANIFEST.MF
new file mode 100644
index 000000000000..a83d3a91d4f0
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.letter.CallWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/letter/makefile.mk b/wizards/com/sun/star/wizards/letter/makefile.mk
new file mode 100644
index 000000000000..700d0b72dfb7
--- /dev/null
+++ b/wizards/com/sun/star/wizards/letter/makefile.mk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = letter
+PACKAGE = com$/sun$/star$/wizards$/letter
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar java_uno_accessbridge commonwizards.jar
+
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/letter
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ LetterDocument.java \
+ LetterWizardDialogConst.java \
+ LetterWizardDialogImpl.java \
+ CallWizard.java \
+ LetterWizardDialog.java \
+ LetterWizardDialogEvents.java \
+ LetterWizardDialogResources.java \
+ LocaleCodes.java \
+ CGLetter.java \
+ CGLetterWizard.java \
+ CGPaperElementLocation.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/makefile.mk b/wizards/com/sun/star/wizards/makefile.mk
new file mode 100644
index 000000000000..fb9c3e18558d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/makefile.mk
@@ -0,0 +1,149 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ = ..$/..$/..$/..
+PRJNAME = wizards
+TARGET = wizards_common
+PACKAGE = com$/sun$/star$/wizards
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar jut.jar java_uno.jar java_uno_accessbridge
+
+.IF "$(SYSTEM_SAXON)" == "YES"
+EXTRAJARFILES = $(SAXON_JAR)
+.ELSE
+JARFILES += saxon9.jar
+.ENDIF
+
+
+JARCLASSDIRS = \
+ com$/sun$/star$/wizards$/common \
+ com$/sun$/star$/wizards$/db \
+ com$/sun$/star$/wizards$/ui \
+ com$/sun$/star$/wizards$/document \
+ com$/sun$/star$/wizards$/text
+
+JARTARGET = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ common$/Desktop.java \
+ common$/NumberFormatter.java \
+ common$/FileAccess.java \
+ common$/Helper.java \
+ common$/InvalidQueryException.java \
+ common$/JavaTools.java \
+ common$/NoValidPathException.java \
+ common$/Properties.java \
+ common$/Resource.java \
+ common$/SystemDialog.java \
+ common$/Configuration.java \
+ common$/ConfigNode.java \
+ common$/ConfigGroup.java \
+ common$/ConfigSet.java \
+ common$/XMLProvider.java \
+ common$/XMLHelper.java \
+ common$/IRenderer.java \
+ common$/Indexable.java \
+ common$/TerminateWizardException.java \
+ common$/UCB.java \
+ common$/DebugHelper.java \
+ common$/PropertySetHelper.java \
+ common$/NumericalHelper.java \
+ common$/NamedValueCollection.java \
+ db$/DBMetaData.java \
+ db$/CommandMetaData.java \
+ db$/QueryMetaData.java \
+ db$/BlindtextCreator.java \
+ db$/FieldColumn.java \
+ db$/CommandName.java \
+ db$/RecordParser.java \
+ db$/TypeInspector.java \
+ db$/ColumnPropertySet.java \
+ db$/RelationController.java \
+ db$/TableDescriptor.java \
+ db$/SQLQueryComposer.java \
+ db$/DatabaseObjectWizard.java \
+ ui$/event$/AbstractListener.java \
+ ui$/event$/CommonListener.java \
+ ui$/event$/DataAware.java \
+ ui$/event$/DataAwareFields.java \
+ ui$/event$/EventNames.java \
+ ui$/event$/ListModelBinder.java \
+ ui$/event$/MethodInvocation.java \
+ ui$/event$/RadioDataAware.java \
+ ui$/event$/SimpleDataAware.java \
+ ui$/event$/Task.java \
+ ui$/event$/TaskEvent.java \
+ ui$/event$/TaskListener.java \
+ ui$/event$/UnoDataAware.java \
+ ui$/AggregateComponent.java \
+ ui$/CommandFieldSelection.java \
+ ui$/ControlScroller.java \
+ ui$/DBLimitedFieldSelection.java \
+ ui$/DocumentPreview.java \
+ ui$/FilterComponent.java \
+ ui$/FieldSelection.java \
+ ui$/ImageList.java \
+ ui$/ButtonList.java \
+ ui$/PathSelection.java \
+ ui$/PeerConfig.java \
+ ui$/SortingComponent.java \
+ ui$/TitlesComponent.java \
+ ui$/WizardDialog.java \
+ ui$/UIConsts.java \
+ ui$/UnoDialog.java \
+ ui$/UnoDialog2.java \
+ ui$/XCommandSelectionListener.java \
+ ui$/XFieldSelectionListener.java \
+ ui$/XPathSelectionListener.java \
+ ui$/XCompletion.java \
+ document$/Control.java \
+ document$/DatabaseControl.java \
+ document$/FormHandler.java \
+ document$/GridControl.java \
+ document$/OfficeDocument.java \
+ document$/Shape.java \
+ document$/TimeStampControl.java \
+ text$/TextDocument.java \
+ text$/TextFieldHandler.java \
+ text$/TextFrameHandler.java \
+ text$/TextSectionHandler.java \
+ text$/TextStyleHandler.java \
+ text$/TextTableHandler.java \
+ text$/ViewHandler.java
+
+
+#JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:s/.java/.class/))
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
new file mode 100644
index 000000000000..ec6ab3895fca
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Type;
+import com.sun.star.wizards.common.Properties;
+
+/** 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
+ * (<CODE>__writeRegistryServiceInfo</CODE>).
+ * @author Bertram Nolte
+ */
+public class CallQueryWizard
+{
+
+ /** Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the
+ * component.
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param stringImplementationName The implementation name of the component.
+ * @param xmultiservicefactory The service manager, who gives access to every
+ * known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * 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)
+ {
+ 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;
+ }
+
+ /** Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>.
+ * @return returns true if the operation succeeded
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single
+ * registry key accessible.
+ */
+ 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
+ {
+ private PropertyValue[] m_wizardContext;
+ // <properties>
+ public String Command;
+ public final Integer CommandType = com.sun.star.sdb.CommandType.QUERY;
+ // </properties>
+
+ /** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param xmultiservicefactoryInitialization A special service factory
+ * could be introduced while initializing.
+ */
+ public QueryWizardImplementation( XMultiServiceFactory i_serviceFactory )
+ {
+ super();
+ m_serviceFactory = i_serviceFactory;
+ registerProperty( "Command", (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) );
+ registerProperty( "CommandType", PropertyAttribute.READONLY );
+ }
+
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.compareTo("start") == 0)
+ {
+ QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext );
+ Command = CurQueryWizard.startQueryWizard();
+ }
+ }
+ 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 m_serviceFactory;
+
+ /** This method is a member of the interface for initializing an object
+ * directly after its creation.
+ * @param object This array of arbitrary objects will be passed to the
+ * component after its creation.
+ * @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
+ {
+ m_wizardContext = Properties.convertToPropertyValueArray(object);
+ }
+
+ /** 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];
+
+ stringSupportedServiceNames[0] = __serviceName;
+
+ return (stringSupportedServiceNames);
+ }
+
+ /** This method returns true, if the given service will be
+ * supported by the component.
+ * @param stringService Service name.
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService(String stringService)
+ {
+ boolean booleanSupportsService = false;
+
+ 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.
+ * to realise hashing functionality when the object is introspected.
+ * Two objects that return the same ID also have to return
+ * the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to
+ * return an empty sequence. Important: If the object
+ * aggregates other objects the ID has to be unique for the
+ * whole combination of objects.
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId()
+ {
+ byte[] 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 (QueryWizardImplementation.class.getName());
+ }
+
+ /** Provides a sequence of all types (usually interface types)
+ * provided by the object.
+ * @return Sequence of all types (usually interface types) provided by the
+ * service.
+ */
+ 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)
+ {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java
new file mode 100644
index 000000000000..35d1edf37bde
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/Finalizer.java
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import com.sun.star.wizards.common.*;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.wizards.db.*;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.uno.*;
+import com.sun.star.wizards.ui.*;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class Finalizer
+{
+ private QueryWizard m_queryWizard;
+ private String resQuery;
+ private XTextComponent m_aTxtTitle;
+ private XRadioButton xRadioDisplayQuery;
+ private QuerySummary CurDBMetaData;
+
+ public Finalizer( QueryWizard i_queryWizard, QuerySummary _CurDBMetaData )
+ {
+ short curtabindex = (short) (100 * QueryWizard.SOSUMMARY_PAGE);
+ String reslblQueryTitle;
+ String resoptDisplayQuery;
+ String resoptModifyQuery;
+ String resflnSummary;
+ String reslblHowGoOn;
+ this.m_queryWizard = i_queryWizard;
+ this.CurDBMetaData = _CurDBMetaData;
+ reslblQueryTitle = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 5);
+ resoptDisplayQuery = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 6);
+ resoptModifyQuery = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 7);
+ resflnSummary = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 87);
+ reslblHowGoOn = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 8);
+ resQuery = m_queryWizard.m_oResource.getResText(UIConsts.RID_QUERY + 1);
+ int curHelpIndex = 40955;
+
+ m_queryWizard.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.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(52)
+ });
+ m_aTxtTitle = m_queryWizard.insertTextField("txtQueryTitle", "changeTitle", this, 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.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(90)
+ });
+ m_queryWizard.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.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(112)
+ });
+ this.xRadioDisplayQuery = m_queryWizard.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.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118)
+ });
+
+ m_queryWizard.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.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118)
+ });
+ m_queryWizard.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_queryWizard.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)
+ });
+ }
+
+ public void changeTitle()
+ {
+ final String TitleName = m_aTxtTitle.getText();
+ m_queryWizard.enableFinishButton( TitleName.length() > 0 );
+ }
+
+ /* 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(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(m_aTxtTitle), "Text", sCurQueryName);
+ }
+ }
+
+ CurDBMetaData.setSummaryString();
+ m_queryWizard.setControlProperty("txtSummary", "Text", CurDBMetaData.getSummaryString());
+ return sCurQueryName;
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return "";
+ }
+ }
+
+ private String getTitle()
+ {
+ final String sTitle = (String) Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text");
+ return sTitle;
+ }
+
+ public String finish()
+ {
+ String queryName = getTitle();
+ if ( CurDBMetaData.getSQLQueryComposer().setQueryCommand( m_queryWizard.xWindow, true, true )
+ && CurDBMetaData.createQuery( CurDBMetaData.getSQLQueryComposer(), queryName )
+ )
+ return queryName;
+
+ return "";
+ }
+
+ public final boolean displayQueryDesign()
+ {
+ try
+ {
+ final short state = AnyConverter.toShort( Helper.getUnoPropertyValue( UnoDialog.getModel( xRadioDisplayQuery ), "State" ) );
+ final boolean viewMode = state == (short)1;
+ return !viewMode;
+ }
+ catch ( IllegalArgumentException ex )
+ {
+ Logger.getLogger( Finalizer.class.getName() ).log( Level.SEVERE, null, ex );
+ }
+ return false;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/query/MANIFEST.MF b/wizards/com/sun/star/wizards/query/MANIFEST.MF
new file mode 100644
index 000000000000..abb009f220e9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.query.CallQueryWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java
new file mode 100644
index 000000000000..f570970e0fe8
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/QuerySummary.java
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+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.*;
+import com.sun.star.wizards.db.*;
+import com.sun.star.beans.*;
+
+public class QuerySummary extends QueryMetaData
+{
+
+ final protected int RID_QUERY = 2300;
+ final protected int RID_REPORT = 2400;
+ String sSummary;
+ Resource oResource;
+ // XMultiServiceFactory xMSF;
+ private String sSeparator;
+ private String sReturnChar;
+ private String sAnd;
+ private String sOr;
+
+ public QuerySummary(XMultiServiceFactory _xMSF, Resource _oResource)
+ {
+ super(_xMSF);
+ this.oResource = _oResource;
+ // this.xMSF = _xMSF;
+ sAnd = oResource.getResText(RID_QUERY + 38);
+ sOr = oResource.getResText(RID_QUERY + 39);
+ sSeparator = oResource.getResText(RID_QUERY + 91);
+ sReturnChar = String.valueOf((char) 13) + String.valueOf((char) 13);
+ }
+
+ /* 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
+ {
+ String sFieldNamesFraction = "";
+ String sSortingFraction = "";
+ String sFilterFraction = "";
+ String sAggregateFraction = "";
+ String sGroupByFraction = "";
+ String sHavingFraction = "";
+ sFieldNamesFraction = combineFieldNameFraction() + 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())
+ {
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public String getSummaryString()
+ {
+ return sSummary;
+ }
+
+ 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)
+ {
+ PropertyValue[] curfilterconditions = _filterconditions[0];
+ for (int i = 0; i < curfilterconditions.length; i++)
+ {
+ sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[0][i], this);
+ sconditions = appendClauseSeparator(sconditions, " " + sAnd + " ", i, curfilterconditions.length);
+ }
+ }
+ else
+ {
+
+ for (int i = 0; i < _filterconditions.length; i++)
+ {
+ sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0], this);
+ sconditions = appendClauseSeparator(sconditions, " " + sOr + " ", i, _filterconditions.length);
+ }
+ }
+ String sreturn = sStart + sconditions;
+ return sreturn;
+ }
+ }
+ return oResource.getResText(_AlternativeResID);
+ }
+
+ 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++)
+ {
+ CurString = BaseString;
+ FieldColumn CurDBFieldColumn = super.getFieldColumnByDisplayName(FieldColumns[i].getDisplayFieldName());
+ int iAggregate = getAggregateIndex(FieldColumns[i].getFieldName());
+ if (iAggregate > -1)
+ {
+ String sAggregateDisplay = AggregateFieldNames[iAggregate][1] + "(" + AggregateFieldNames[iAggregate][0] + ")";
+ CurString = JavaTools.replaceSubString(CurString, sAggregateDisplay, "<FIELDNAME>");
+ }
+ else
+ {
+ 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)
+ {
+ 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)
+ {
+ return ArrayFieldsToString(_InitResID, _FieldNames);
+ }
+ }
+ return oResource.getResText(_AlternativeResID);
+ }
+
+ 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]).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)
+ {
+ 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)
+ {
+ String CurString = "";
+ String sReturn = oResource.getResText(_InitResID);
+ int FieldCount = _FieldNames.length;
+ 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]).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]).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
new file mode 100644
index 000000000000..53fc67f01192
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/QueryWizard.java
@@ -0,0 +1,503 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XFrame;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.db.DatabaseObjectWizard;
+import com.sun.star.wizards.db.QueryMetaData;
+import com.sun.star.wizards.ui.AggregateComponent;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.FieldSelection;
+import com.sun.star.wizards.ui.FilterComponent;
+import com.sun.star.wizards.ui.SortingComponent;
+import com.sun.star.wizards.ui.TitlesComponent;
+
+public class QueryWizard extends DatabaseObjectWizard
+{
+ public static final String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox";
+ private static final int SOFIELDSELECTION_PAGE = 1;
+ private static final int SOSORTING_PAGE = 2;
+ private static final int SOFILTER_PAGE = 3;
+ private static final int SOAGGREGATE_PAGE = 4;
+ private static final int SOGROUPSELECTION_PAGE = 5;
+ private static final int SOGROUPFILTER_PAGE = 6;
+ private static final int SOTITLES_PAGE = 7;
+ protected static final int SOSUMMARY_PAGE = 8;
+ private CommandFieldSelection CurDBCommandFieldSelection;
+ private SortingComponent CurSortingComponent;
+ private FieldSelection CurGroupFieldSelection;
+ private TitlesComponent CurTitlesComponent;
+ private FilterComponent CurFilterComponent;
+ private FilterComponent CurGroupFilterComponent;
+ private AggregateComponent CurAggregateComponent;
+ private Finalizer CurFinalizer;
+ private QuerySummary CurDBMetaData;
+ private String reslblFieldHeader;
+ private String reslblAliasHeader;
+ private String reslblFields;
+ private String reslblSelFields;
+ private String reslblTables;
+ private String resQueryWizard;
+ private String reslblGroupBy;
+ private String resmsgNonNumericAsGroupBy;
+ private String m_createdQuery;
+
+ public QueryWizard( XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext )
+ {
+ super( xMSF, 40970, i_wizardContext );
+ addResourceHandler("QueryWizard", "dbw");
+ CurDBMetaData = new QuerySummary(xMSF, m_oResource);
+ }
+
+/* public static void main(String args[])
+ {
+ String ConnectStr = "uno:pipe,name=foo;urp;StarOffice.ServiceManager";
+ try
+ {
+ XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
+ if (xLocMSF != null)
+ {
+ PropertyValue[] curproperties = new PropertyValue[1];
+ curproperties[0] = Properties.createProperty("DatabaseLocation", "file:///G:/temp/abc.odb");
+// curproperties[0] = Properties.createProperty("DataSourceName", "TESTDB");
+
+ QueryWizard CurQueryWizard = new QueryWizard(xLocMSF);
+ CurQueryWizard.startQueryWizard(xLocMSF, curproperties);
+ }
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ }*/
+
+ public final XFrame getFrame()
+ {
+ return m_frame;
+ }
+
+ public String startQueryWizard()
+ {
+ try
+ {
+ if ( CurDBMetaData.getConnection( m_wizardContext ) )
+ {
+ 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);
+ 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)
+ });
+ drawNaviBar();
+ setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8);
+ this.setMaxStep(8);
+ buildSteps();
+ this.CurDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
+
+ XWindowPeer windowPeer = UnoRuntime.queryInterface( XWindowPeer.class, m_frame.getContainerWindow() );
+ createWindowPeer(windowPeer);
+ CurDBMetaData.setWindowPeer(this.xControl.getPeer());
+ insertQueryRelatedSteps();
+ executeDialog( m_frame.getContainerWindow().getPosSize() );
+ }
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ CurGroupFilterComponent = null;
+ CurTitlesComponent = null;
+ CurAggregateComponent = null;
+ CurDBCommandFieldSelection = null;
+ xWindowPeer = null;
+ CurFinalizer = null;
+ CurDBMetaData.finish();
+ CurDBMetaData = null;
+ System.gc();
+
+ return m_createdQuery;
+ }
+
+ 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++)
+ {
+ oRoadmapItem = this.xIndexContRoadmap.getByIndex(i);
+ CurItemID = AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmapItem, "ID"));
+ switch (CurItemID)
+ {
+ case SOAGGREGATE_PAGE:
+ if (_bEnabled == true)
+ {
+ bEnabled = ((CurDBMetaData.hasNumericalFields()) && (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar()));
+ }
+ break;
+ case SOGROUPSELECTION_PAGE:
+ bEnabled = CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY;
+ break;
+ case SOGROUPFILTER_PAGE:
+ bEnabled = false;
+ if (_bEnabled == true)
+ {
+ bEnabled = (CurDBMetaData.GroupByFilterConditions.length > 0);
+ }
+
+ break;
+ default:
+ if (CurItemID > CurStep)
+ {
+ bEnabled = _bEnabled;
+ }
+ else
+ {
+ bEnabled = true;
+ }
+ break;
+ }
+ super.setStepEnabled(CurItemID, bEnabled);
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void insertQueryRelatedSteps()
+ {
+ try
+ {
+ setRMItemLabels(m_oResource, UIConsts.RID_QUERY + 80);
+ addRoadmap();
+ int i = 0;
+ i = insertRoadmapItem(0, true, SOFIELDSELECTION_PAGE - 1, SOFIELDSELECTION_PAGE);
+ i = insertRoadmapItem(i, false, SOSORTING_PAGE - 1, SOSORTING_PAGE); // Orderby is always supported
+ i = insertRoadmapItem(i, false, SOFILTER_PAGE - 1, SOFILTER_PAGE);
+ if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar())
+ {
+ i = insertRoadmapItem(i, CurDBMetaData.hasNumericalFields(), SOAGGREGATE_PAGE - 1, SOAGGREGATE_PAGE);
+ }
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
+ i = insertRoadmapItem(i, false, SOGROUPSELECTION_PAGE - 1, SOGROUPSELECTION_PAGE);
+ i = insertRoadmapItem(i, false, SOGROUPFILTER_PAGE - 1, SOGROUPFILTER_PAGE);
+ }
+ // if (CurDBMetaData.xDBMetaData.supportsColumnAliasing()) don't use -> too dangerous!!!
+ i = insertRoadmapItem(i, false, SOTITLES_PAGE - 1, SOTITLES_PAGE);
+ i = insertRoadmapItem(i, false, SOSUMMARY_PAGE - 1, SOSUMMARY_PAGE);
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ Resource.showCommonResourceError(xMSF);
+ }
+ }
+
+ public void buildSteps()
+ {
+ try
+ {
+// curDBCommandFieldSelection = new CommandFieldSelection(this, curFormDocument.oMainFormDBMetaData, 92, slblFields, slblSelFields, slblTables, true, 34411);
+// curDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
+
+ CurDBCommandFieldSelection = new CommandFieldSelection(this, CurDBMetaData, 120, reslblFields, reslblSelFields, reslblTables, true, 40850);
+ CurDBCommandFieldSelection.setAppendMode(true);
+ CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
+ CurSortingComponent = new SortingComponent(this, SOSORTING_PAGE, 95, 27, 210, 40865);
+ CurFilterComponent = new FilterComponent(this, xMSF, SOFILTER_PAGE, 97, 27, 209, 3, CurDBMetaData, 40878);
+ CurFilterComponent.addNumberFormats();
+
+ if (CurDBMetaData.xDBMetaData.supportsCoreSQLGrammar())
+ {
+ CurAggregateComponent = new AggregateComponent(this, CurDBMetaData, SOAGGREGATE_PAGE, 97, 69, 209, 5, 40895);
+ }
+ if (CurDBMetaData.xDBMetaData.supportsGroupBy())
+ {
+ CurGroupFieldSelection = new FieldSelection(this, SOGROUPSELECTION_PAGE, 95, 27, 210, 150, reslblFields, this.reslblGroupBy, 40915, false);
+ CurGroupFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
+ CurGroupFilterComponent = new FilterComponent(this, xMSF, SOGROUPFILTER_PAGE, 97, 27, 209, 3, CurDBMetaData, 40923);
+ }
+ CurTitlesComponent = new TitlesComponent(this, SOTITLES_PAGE, 97, 37, 207, 7, reslblFieldHeader, reslblAliasHeader, 40940);
+ CurFinalizer = new Finalizer(this, CurDBMetaData);
+ enableNavigationButtons(false, false, false);
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ Resource.showCommonResourceError(xMSF);
+ }
+ }
+
+ public boolean finishWizard()
+ {
+ int ncurStep = getCurrentStep();
+ if ( ( ncurStep == SOSUMMARY_PAGE )
+ || ( switchToStep( ncurStep, SOSUMMARY_PAGE ) )
+ )
+ {
+ m_createdQuery = CurFinalizer.finish();
+ if ( m_createdQuery.length() > 0 )
+ {
+ loadSubComponent( CommandType.QUERY, m_createdQuery, CurFinalizer.displayQueryDesign() );
+ xDialog.endExecute();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ try
+ {
+ if (nOldStep <= SOGROUPSELECTION_PAGE && nNewStep > SOGROUPSELECTION_PAGE)
+ {
+ 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 SOFIELDSELECTION_PAGE:
+ break;
+ case SOSORTING_PAGE:
+ CurSortingComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.getSortFieldNames());
+ break;
+ case SOFILTER_PAGE:
+ CurFilterComponent.initialize(CurDBMetaData.getFilterConditions(), CurDBMetaData.getDisplayFieldNames());
+ break;
+ case SOAGGREGATE_PAGE:
+ CurAggregateComponent.initialize();
+ break;
+ case SOGROUPSELECTION_PAGE:
+ break;
+ case SOGROUPFILTER_PAGE:
+ CurGroupFilterComponent.initialize(CurDBMetaData.GroupByFilterConditions, CurDBMetaData.getGroupFieldNames());
+ break;
+ case SOTITLES_PAGE:
+ CurTitlesComponent.initialize(CurDBMetaData.getDisplayFieldNames(), CurDBMetaData.FieldTitleSet);
+ break;
+ case SOSUMMARY_PAGE:
+ CurFinalizer.initialize();
+ break;
+ default:
+ break;
+ }
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+ switch (nOldStep)
+ {
+ case SOFIELDSELECTION_PAGE:
+ CurDBMetaData.reorderFieldColumns(CurDBCommandFieldSelection.getSelectedFieldNames());
+ CurDBMetaData.initializeFieldTitleSet(true);
+ CurDBMetaData.setNumericFields();
+ searchForOutdatedFields();
+ break;
+ case SOSORTING_PAGE:
+ CurDBMetaData.setSortFieldNames(CurSortingComponent.getSortFieldNames());
+ break;
+ case SOFILTER_PAGE:
+ CurDBMetaData.setFilterConditions(CurFilterComponent.getFilterConditions());
+ break;
+ case SOAGGREGATE_PAGE:
+ CurDBMetaData.AggregateFieldNames = CurAggregateComponent.getAggregateFieldNames();
+ break;
+ case SOGROUPSELECTION_PAGE:
+ break;
+ case SOGROUPFILTER_PAGE:
+ CurDBMetaData.setGroupByFilterConditions(this.CurGroupFilterComponent.getFilterConditions());
+ break;
+ case SOTITLES_PAGE:
+ CurDBMetaData.setFieldTitles(CurTitlesComponent.getFieldTitles());
+ break;
+ case SOSUMMARY_PAGE:
+ break;
+ default:
+ break;
+ }
+ if (nOldStep < SOGROUPSELECTION_PAGE && nNewStep >= SOGROUPSELECTION_PAGE)
+ {
+ 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);
+ CurGroupFieldSelection.setMultipleMode(false);
+ setStepEnabled(SOGROUPFILTER_PAGE, CurAggregateComponent.isGroupingpossible() && CurDBMetaData.NonAggregateFieldNames.length > 0);
+ }
+ }
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void searchForOutdatedFields()
+ {
+ String[] sFieldNames = CurDBMetaData.getFieldNames();
+ String[][] sRemovedFields = JavaTools.removeOutdatedFields(CurDBMetaData.getSortFieldNames(), sFieldNames);
+ CurDBMetaData.setSortFieldNames(sRemovedFields);
+ CurDBMetaData.setFilterConditions(JavaTools.removeOutdatedFields(CurDBMetaData.getFilterConditions(), sFieldNames));
+ CurDBMetaData.AggregateFieldNames = JavaTools.removeOutdatedFields(CurDBMetaData.AggregateFieldNames, sFieldNames);
+ }
+
+ 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
+ {
+
+ protected int 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 shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (ID == 1)
+ {
+ CurDBMetaData.addSeveralFieldColumns(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
+ enableWizardSteps(NewItems);
+ CurDBCommandFieldSelection.changeSelectedFieldNames(CurDBMetaData.getDisplayFieldNames());
+ CurDBCommandFieldSelection.toggleCommandListBox(NewItems);
+ }
+ else
+ {
+ boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", new Boolean(bEnabled));
+ }
+ }
+
+ 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)
+ {
+ enableWizardSteps(NewItems);
+ String[] sSelfieldNames = CurDBMetaData.getFieldNames(SelItems, CurDBCommandFieldSelection.getSelectedCommandName());
+ CurDBCommandFieldSelection.addItemsToFieldsListbox(sSelfieldNames);
+ CurDBMetaData.removeSeveralFieldColumnsByDisplayFieldName(SelItems);
+ CurDBCommandFieldSelection.toggleCommandListBox(NewItems);
+
+ }
+ else
+ {
+ boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
+ String CurDisplayFieldName = SelItems[0];
+ if (JavaTools.FieldInList(CurDBMetaData.NonAggregateFieldNames, CurDisplayFieldName) > -1)
+ {
+ showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, resmsgNonNumericAsGroupBy);
+ CurGroupFieldSelection.xSelectedFieldsListBox.addItems(SelItems, CurGroupFieldSelection.xSelectedFieldsListBox.getItemCount());
+ String FieldList[] = CurGroupFieldSelection.xFieldsListBox.getItems();
+ int index = JavaTools.FieldInList(FieldList, CurDisplayFieldName);
+ if (index > -1)
+ {
+ CurGroupFieldSelection.xFieldsListBox.removeItems((short) index, (short) 1);
+ }
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPFILTER_PAGE), "Enabled", new Boolean(bEnabled));
+ }
+ }
+ }
+
+ public void moveItemDown(String item)
+ {
+ }
+
+ public void moveItemUp(String item)
+ {
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/query/makefile.mk b/wizards/com/sun/star/wizards/query/makefile.mk
new file mode 100644
index 000000000000..af5056ba5221
--- /dev/null
+++ b/wizards/com/sun/star/wizards/query/makefile.mk
@@ -0,0 +1,61 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = query
+PACKAGE = com$/sun$/star$/wizards$/query
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar jut.jar java_uno.jar commonwizards.jar
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/query
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+#SRS2NAME = dbwizres
+#SRC2FILES= dbwizres.src
+#RESLIB2SRSFILES= $(SRS)$/dbwizres.srs
+#RESLIB2NAME= dbw
+
+JAVAFILES= \
+ CallQueryWizard.java \
+ Finalizer.java \
+ QueryWizard.java \
+ QuerySummary.java\
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java
new file mode 100644
index 000000000000..89aa7f471705
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.wizards.common.NamedValueCollection;
+
+/** 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
+ * (<CODE>__writeRegistryServiceInfo</CODE>).
+ * @author Bertram Nolte
+ */
+public class CallReportWizard
+{
+
+ static boolean bWizardstartedalready;
+
+/* public static void main(String args[])
+ {
+ String ConnectStr = "uno:pipe,name=fs93730;urp;StarOffice.ServiceManager";
+ try
+ {
+ XMultiServiceFactory orb = Desktop.connect(ConnectStr);
+ if ( orb != null )
+ {
+ PropertyValue[] curproperties = new PropertyValue[1];
+ curproperties[0] = Properties.createProperty("DataSourceName", "countries");
+
+ ReportWizard wizard = new ReportWizard( orb, curproperties );
+ wizard.startReportWizard();
+ }
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ }*/
+
+ /** Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the
+ * component.
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param stringImplementationName The implementation name of the component.
+ * @param xMSF The service manager, who gives access to every
+ * known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * 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)
+ {
+ com.sun.star.lang.XSingleServiceFactory xsingleservicefactory = null;
+ if (stringImplementationName.equals(
+ ReportWizardImplementation.class.getName()))
+ {
+ xsingleservicefactory = com.sun.star.comp.loader.FactoryHelper.getServiceFactory(
+ ReportWizardImplementation.class,
+ ReportWizardImplementation.__serviceName,
+ xMSF,
+ xregistrykey);
+ }
+ return xsingleservicefactory;
+ }
+
+ /** Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>.
+ * @return returns true if the operation succeeded
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single
+ * registry key accessible.
+ */
+ public static boolean __writeRegistryServiceInfo(com.sun.star.registry.XRegistryKey xregistrykey)
+ {
+ return com.sun.star.comp.loader.FactoryHelper.writeRegistryServiceInfo(
+ ReportWizardImplementation.class.getName(),
+ ReportWizardImplementation.__serviceName,
+ 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
+ {
+
+ private PropertyValue[] m_wizardContext;
+
+ /** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param xmultiservicefactoryInitialization A special service factory
+ * could be introduced while initializing.
+ */
+ public ReportWizardImplementation(com.sun.star.lang.XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
+ super();
+ xmultiservicefactory = xmultiservicefactoryInitialization;
+ }
+
+ public void trigger(String sEvent)
+ {
+ try
+ {
+ if (sEvent.compareTo("start") == 0)
+ {
+ if (bWizardstartedalready != true)
+ {
+ ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext );
+ CurReportWizard.startReportWizard();
+ }
+ bWizardstartedalready = false;
+ }
+ else if (sEvent.compareTo("fill") == 0)
+ {
+ Dataimport CurDataimport = new Dataimport(xmultiservicefactory);
+ if (m_wizardContext != null)
+ {
+ NamedValueCollection context = new NamedValueCollection( m_wizardContext );
+ XTextDocument textDocument = context.queryOrDefault( "TextDocument", null, XTextDocument.class );
+ XDatabaseDocumentUI documentUI = context.queryOrDefault( "DocumentUI", null, XDatabaseDocumentUI.class );
+ if ( textDocument != null )
+ {
+ CurDataimport.createReport(xmultiservicefactory, documentUI, textDocument, m_wizardContext);
+ }
+ }
+ }
+ }
+ 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.report.CallReportWizard";
+ /** The service manager, that gives access to all registered services.
+ */
+ private com.sun.star.lang.XMultiServiceFactory xmultiservicefactory;
+
+ /** This method is a member of the interface for initializing an object
+ * directly after its creation.
+ * @param object This array of arbitrary objects will be passed to the
+ * component after its creation.
+ * @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
+ {
+ this.m_wizardContext = Properties.convertToPropertyValueArray(object);
+
+ // 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];
+
+ stringSupportedServiceNames[ 0] = __serviceName;
+
+ return (stringSupportedServiceNames);
+ }
+
+ /** This method returns true, if the given service will be
+ * supported by the component.
+ * @param stringService Service name.
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService(String stringService)
+ {
+ boolean booleanSupportsService = false;
+
+ 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.
+ * to realise hashing functionality when the object is introspected.
+ * Two objects that return the same ID also have to return
+ * the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to
+ * return an empty sequence. Important: If the object
+ * aggregates other objects the ID has to be unique for the
+ * whole combination of objects.
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId()
+ {
+ byte[] 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());
+ }
+
+ /** Provides a sequence of all types (usually interface types)
+ * provided by the object.
+ * @return Sequence of all types (usually interface types) provided by the
+ * service.
+ */
+ 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)
+ {
+ 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
new file mode 100644
index 000000000000..eb6ce3229ac4
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/DBColumn.java
@@ -0,0 +1,482 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.beans.PropertyState;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertyState;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNamed;
+// import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.style.ParagraphAdjust;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XTableColumns;
+import com.sun.star.table.XTableRows;
+import com.sun.star.text.XDependentTextField;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextRange;
+import com.sun.star.text.XTextTable;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XNumberFormats;
+import com.sun.star.wizards.db.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.text.TextDocument;
+import com.sun.star.wizards.text.TextTableHandler;
+import com.sun.star.wizards.text.TextFieldHandler;
+
+public class DBColumn
+{
+
+ public XCell xValCell;
+ public XTextRange xValTextCell;
+ public XTextCursor xValCellCursor;
+ public XNumberFormats xValCellNumberFormats;
+ public XCell xNameCell;
+ public XTextRange xNameTextCell;
+ public boolean bAlignLeft;
+ public Object DefaultValue;
+ public String CharFontName;
+ public int FormatKey;
+ public PropertyState PropertyState;
+ public int ValColumn = 1;
+ public int ValRow = 0;
+ public FieldColumn CurDBField;
+ private XTextTable xTextTable;
+ private XTableColumns xTableColumns;
+ private XCellRange xCellRange;
+ public XNamed xTableName;
+ private boolean bIsGroupColumn;
+ TextDocument oTextDocument;
+ RecordParser CurDBMetaData;
+ RecordTable CurRecordTable;
+ TextTableHandler oTextTableHandler;
+
+ public DBColumn(TextTableHandler _oTextTableHandler, RecordParser _CurDBMetaData, int i) throws Exception
+ {
+ 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) 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)
+ {
+ CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.RecordFieldColumns[i].getFieldName());
+ }
+ else
+ {
+ CurDBField = CurDBMetaData.getFieldColumnByFieldName(CurDBMetaData.getRecordFieldName(i));
+ }
+ if (_bForce)
+ {
+ assignCells(i, true);
+ }
+ else
+ {
+ for (int n = 0; n < CurRecordTable.xTableColumns.getCount(); n++)
+ {
+ assignCells(n, false);
+ }
+ }
+ }
+
+ private boolean assignCells(int _nColumn, boolean _bforce)
+ {
+ 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.getFieldName(), 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);
+ }
+ 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
+ {
+ 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 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.getFieldName(), 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();
+ }
+ }
+ }
+ }
+
+ private void getTableColumns(String TableName)
+ {
+ try
+ {
+ 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();
+ }
+ }
+
+ public void initializeNumberFormat()
+ {
+ if (CurDBField.isBoolean())
+ {
+ NumberFormatter oNumberFormatter = oTextTableHandler.getNumberFormatter();
+ int iLogicalFormatKey = oNumberFormatter.setBooleanReportDisplayNumberFormat();
+ oNumberFormatter.setNumberFormat(xValCell, iLogicalFormatKey, oNumberFormatter);
+ }
+ else
+ {
+ oTextTableHandler.getNumberFormatter().setNumberFormat(xValCell, CurDBField.getDBFormatKey(), 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.getFieldName(), 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.getFieldName(), CurDBField.getFieldTitle());
+ }
+
+ public void formatValueCell()
+ {
+ initializeNumberFormat();
+ if (checkforLeftAlignment())
+ {
+ bAlignLeft = true;
+ }
+ }
+
+ private boolean checkforLeftAlignment()
+ {
+ bAlignLeft = ((CurDBField.isNumberFormat()) && (ValColumn == xTableColumns.getCount() - 1));
+ return bAlignLeft;
+ }
+
+ public void modifyCellContent(XCellRange xCellRange, Object CurGroupValue)
+ {
+ try
+ {
+ 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);
+ }
+ }
+
+ public void modifyCellContent(Object CurGroupValue)
+ {
+ double dblValue = 0;
+ try
+ {
+ if (xValCell != null)
+ {
+ 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))
+ {
+ dblValue = (double) AnyConverter.toLong(CurGroupValue);
+ }
+ else if (AnyConverter.isShort(CurGroupValue))
+ {
+ dblValue = (double) AnyConverter.toShort(CurGroupValue);
+ }
+ xValCell.setValue(dblValue);
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ System.err.println(exception);
+ }
+ }
+ // If the parameter CurGroupValue is null the placeholders are inserted
+ public void replaceValueCellofTable(boolean _bIsLandscape)
+ {
+ try
+ {
+ Object CurGroupValue;
+ if (bIsGroupColumn == false && CurDBField.isNumberFormat() == false)
+ {
+ CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.getFieldWidth(), _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames());
+ }
+ else
+ {
+ CurGroupValue = CurDBField.getDefaultValue();
+ }
+ modifyCellContent(CurGroupValue);
+ if (bAlignLeft)
+ {
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.LEFT_value));
+ }
+
+ int nFieldType = CurDBField.getFieldType();
+ if ((nFieldType == com.sun.star.sdbc.DataType.BIT) ||
+ (nFieldType == com.sun.star.sdbc.DataType.BOOLEAN))
+ {
+ CharFontName = "StarSymbol";
+ Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
+ if (bIsGroupColumn == false)
+ {
+ Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.CENTER_value));
+ }
+ }
+ else
+ {
+ if (PropertyState == com.sun.star.beans.PropertyState.DEFAULT_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);
+ }
+ }
+ }
+ }
+ catch (com.sun.star.beans.UnknownPropertyException exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void setCellFont()
+ {
+ try
+ {
+ XPropertyState xPropertyState;
+ int nFieldType = CurDBField.getFieldType();
+ if ((nFieldType == com.sun.star.sdbc.DataType.BIT) ||
+ (nFieldType == 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"));
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ private boolean isNameCell(XTextCursor xCellCursor, String CurFieldName, String CompString)
+ {
+ try
+ {
+ 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)))
+ {
+ 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;
+ }
+ }
+ // 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!!!!
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java
new file mode 100644
index 000000000000..8547758a08e6
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/Dataimport.java
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.text.XTextDocument;
+
+import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.uno.Exception;
+
+public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionListener
+{ // extends ReportWizard
+
+ // ReportTextDocument CurReportDocument;
+ IReportDocument CurReportDocument;
+
+// PropertyValue[] CurProperties;
+ static boolean bStopProcess;
+ static String sProgressDBConnection;
+ static String sProgressDataImport;
+ static String sProgressBaseCurRecord;
+ static String sProgressCurRecord;
+ static String sProgressTitle;
+ static String sStop;
+
+// public static final String TBLRECORDSECTION = ReportTextDocument.TBLRECORDSECTION;
+// public static final String TBLGROUPSECTION = ReportTextDocument.TBLGROUPSECTION;
+// public static final String RECORDSECTION = ReportTextDocument.RECORDSECTION;
+// public static final String GROUPSECTION = ReportTextDocument.GROUPSECTION;
+// public static final String COPYOFTBLRECORDSECTION = ReportTextDocument.COPYOFTBLRECORDSECTION;
+// 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);
+
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ // bStopProcess = true;
+ CurReportDocument.StopProcess();
+ }
+
+// public static void main(String args[])
+// {
+// String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.NamingService";
+// XMultiServiceFactory xMSF = null;
+// try
+// {
+// xMSF = com.sun.star.wizards.common.Desktop.connect(ConnectStr);
+// if (xMSF != null)
+// {
+// System.out.println("Connected to " + ConnectStr);
+// }
+// PropertyValue[] curproperties = new PropertyValue[3];
+// 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/MyDocAssign.odb"); //baseLocation ); "DataSourceName", "db1");
+//// curproperties[0] = Properties.createProperty("DataSourceName", "Bibliography");
+// curproperties[1] = Properties.createProperty("CommandType", new Integer(CommandType.TABLE));
+// curproperties[2] = Properties.createProperty("Command", "Table2");
+//
+// Dataimport CurDataimport = new Dataimport(xMSF);
+// TextDocument oTextDocument = new TextDocument(xMSF, true, null);
+// CurDataimport.createReport(xMSF, oTextDocument.xTextDocument, curproperties);
+//
+// }
+// catch (Exception e)
+// {
+// e.printStackTrace(System.out);
+// }
+// catch (java.lang.Exception javaexception)
+// {
+// javaexception.printStackTrace(System.out);
+// }
+// }
+ public void showProgressDisplay(XMultiServiceFactory xMSF, boolean bgetConnection)
+ {
+ 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)
+ {
+ 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;
+ }
+ 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, IReportDocument _CurReportDocument, PropertyValue[] _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();
+ }
+
+ public void createReport( XMultiServiceFactory xMSF, XDatabaseDocumentUI i_documentUI, XTextDocument _textDocument,
+ PropertyValue[] properties)
+ {
+ CurReportDocument = ReportTextImplementation.create( xMSF, i_documentUI, _textDocument, m_oResource );
+ 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
new file mode 100644
index 000000000000..82e478bac781
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.wizards.db.*;
+
+import java.util.Vector;
+
+public class GroupFieldHandler extends FieldSelection
+{
+
+ private IReportDocument CurReportDocument;
+ private Vector GroupFieldVector = new Vector();
+ private QueryMetaData CurDBMetaData;
+ private WizardDialog oWizardDialog;
+ private 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);
+
+ 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);
+ }
+ }
+
+ public boolean isGroupField(String _FieldName)
+ {
+ return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1);
+ }
+
+ public void initialize()
+ {
+ try
+ {
+ 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]))
+ {
+ 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);
+ }
+ }
+
+ 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 = xSelectedFieldsListBox.getItemCount();
+ if (iSelCount >= MAXSELFIELDS)
+ {
+ CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, "Enabled", Boolean.FALSE);
+ }
+ }
+
+ public void selectFields(boolean bMoveAll)
+ {
+ int iSelCount = xSelectedFieldsListBox.getItemCount();
+ if (iSelCount < MAXSELFIELDS)
+ {
+ super.selectFields(bMoveAll);
+ }
+
+ }
+
+ /* protected */ class FieldSelectionListener implements com.sun.star.wizards.ui.XFieldSelectionListener
+ {
+
+ public void moveItemDown(String Selitem)
+ {
+ CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems());
+ }
+
+ public void moveItemUp(String item)
+ {
+ CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems());
+ }
+
+ public void shiftFromLeftToRight(String[] Selitems, String[] Newitems)
+ {
+ String CurGroupTitle = Selitems[0];
+ int iSelCount = xSelectedFieldsListBox.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);
+ }
+ }
+
+ public void shiftFromRightToLeft(String[] OldSelitems, String[] Newitems)
+ {
+ int iSelPos = OldSelitems.length;
+ if (iSelPos > 0)
+ {
+ String OldGroupTitle = OldSelitems[0];
+ String[] NewSelList = xSelectedFieldsListBox.getItems();
+ CurReportDocument.liveupdate_removeGroupName(NewSelList, OldGroupTitle, GroupFieldVector);
+ String[] NewSelGroupNames = xSelectedFieldsListBox.getItems();
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", "Enabled", new Boolean(NewSelGroupNames.length == 0));
+
+ // CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems());
+ }
+ }
+
+ public int getID()
+ {
+ // 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
new file mode 100755
index 000000000000..6422befd65f0
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
@@ -0,0 +1,119 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+/**
+ * This Interface separate the ReportBuilderImplementation from the layout.
+ * Only these less methods are allowed to access from the ReportBuilderImplementation.
+ * @author ll93751
+ */
+public interface IReportBuilderLayouter
+{
+
+ /**
+ * Get the internal name of the current layout.
+ * This name identifies the layout in the internal access list.
+ * @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.
+ * @return localized name of the layout.
+ */
+ public String getLocalizedName();
+
+ /**
+ * For Landscape give nOrientation == com.sun.star.wizards.report.ReportLayouter.SOOPTLANDSCAPE
+ * All other numbers are interpreted as portrait format.
+ * @param nOrientation
+ */
+ public void setPageOrientation(int nOrientation);
+
+ /**
+ * dispose the layouter
+ */
+ public void dispose();
+
+ /**
+ * Set the table name of the report
+ * This is the name to the database table.
+ * @param _nType something of com.sun.star.sdb.CommandType
+ * @param TableName
+ */
+ public void setTableName(int _nType, String TableName);
+
+ /**
+ * Insert the field names, these are the field names out of a given datebase table
+ * @param FieldNames
+ */
+ public void insertFieldNames(final String[] FieldNames);
+
+ /**
+ * Insert the field type (Varchar, int, ...) as internal an int representation.
+ * @param FieldTypes
+ */
+ public void insertFieldTypes(int[] FieldTypes);
+
+ /**
+ * Insert the field width in count of chars as given in the database.
+ * @param FieldWidths
+ */
+ public void insertFieldWidths(int[] FieldWidths);
+
+ /**
+ * Insert the titles of the field names. This names are free formed
+ * @param _aFieldTitles
+ */
+ public void insertFieldTitles(String[] _aFieldTitles);
+
+ /**
+ * Insert the names of the groups, the group names are names out of the field names.
+ *
+ * If a group name is given here, it will not shown in the fields/titles, but must be in the field string list.
+ * @param _aGroupFieldNames
+ */
+ public void insertGroupNames(String[] _aGroupFieldNames);
+
+ /**
+ * This method redraws the whole layout with all it's content
+ */
+ public void layout();
+
+ /**
+ * Initialize the current Layouter with data's out of an other Layouter.
+ *
+ * This Method copies the internal fields, groups and titles
+ * @param aOtherLayouter
+ */
+ public void initializeData(IReportBuilderLayouter aOtherLayouter);
+
+ public void loadAndSetBackgroundTemplate(String LayoutTemplatePath);
+}
diff --git a/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
new file mode 100755
index 000000000000..59fd096fe363
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/IReportDefinitionReadAccess.java
@@ -0,0 +1,61 @@
+ /*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.report.XReportDefinition;
+
+/**
+ * This interface contains only one function to give access to the ReportDefinition.
+ * The ReportDefinition will be initialized very late, late after the ReportLayouters.
+ * So we need this interface for the late access.
+ * @author ll93751
+ */
+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
+ */
+ public XMultiServiceFactory getGlobalMSF();
+
+ /**
+ * Returns the file path to the default report definition, we need this name for early initialisation
+ * @return
+ */
+ public String getDefaultHeaderLayout();
+}
diff --git a/wizards/com/sun/star/wizards/report/IReportDocument.java b/wizards/com/sun/star/wizards/report/IReportDocument.java
new file mode 100644
index 000000000000..702a776f9c98
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/IReportDocument.java
@@ -0,0 +1,268 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.wizards.common.Resource;
+import java.util.ArrayList;
+import java.util.Vector;
+
+/**
+ * New Interface which gives us the possibility to switch on the fly between the old
+ * Wizard and the new Sun Report Builder Wizard, which use the same UI.
+ *
+ * @author ll93751
+ */
+public interface IReportDocument
+{
+ // -------------------------------------------------------------------------
+ // initialisation
+ // -------------------------------------------------------------------------
+ public void initialize(
+ final XDatabaseDocumentUI i_documentUI,
+ final Resource i_resource
+ );
+
+ // -------------------------------------------------------------------------
+ // 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
+ * It is a Report Builder in the new Wizard
+ * @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
+ * @param TableName
+ * @param FieldNames
+ */
+ public void initializeFieldColumns(final int _aType, final String TableName, final String[] FieldNames);
+
+ /**
+ * Empties the report document
+ */
+ public void clearDocument();
+
+ /**
+ * Empties the report document, if we called back, don't remove Grouping/Sorting
+ */
+ public void removeTextTableAndTextSection();
+
+ // -------------------------------------------------------------------------
+ // Second step: Label field titles
+ // -------------------------------------------------------------------------
+ /**
+ * Set new names for the titles
+ * @param sFieldTitles
+ */
+ public void setFieldTitles(final String[] sFieldTitles);
+
+ /**
+ * Change a the name of the 'title' of one field.
+ * It is possible to give all element names new names which are used as
+ * element title of a given element name.
+ * This is only used as a preview
+ * @param FieldName
+ * @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
+ * @param CurGroupTitle
+ * @param GroupFieldVector
+ * @param ReportPath
+ * @param iSelCount
+ * @return
+ */
+ public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount);
+
+ 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
+ * @param CurGroupTitle
+ * @param GroupFieldVector
+ */
+ public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, java.util.Vector GroupFieldVector);
+
+ /**
+ * set the list how to group
+ * @param aGroupList
+ */
+ public void setGrouping(String[] aGroupList);
+ // -------------------------------------------------------------------------
+ // Fourth step: Sorting
+ // -------------------------------------------------------------------------
+ /**
+ * Set the list how to sort
+ * @param 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 ArrayList getReportPath();
+
+ public String getLayoutPath();
+
+ public String getContentPath();
+
+ /**
+ * Called if a new Layout is selected
+ * @param LayoutTemplatePath
+ */
+ public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/);
+
+ /**
+ * Called if a new Template is selected
+ * @param ContentTemplatePath
+ */
+ public void liveupdate_changeContentTemplate(String ContentTemplatePath);
+
+ // public String[] getLayoutTemplates();
+ // public String[] getContentTemplates();
+ public void layout_selectFirstPage();
+
+ 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.
+ * @param _sTitleName
+ */
+ public void liveupdate_updateReportTitle(String _sTitleName);
+
+ /**
+ * Store the document by the given name
+ * @param Name
+ * @param OpenMode
+ */
+ public void store(String Name, int OpenMode) throws com.sun.star.uno.Exception;
+
+ /**
+ * The current report is added to the DB View under the given name
+ *
+ * TODO: add Name to this functionality
+ */
+ public void addReportToDBView();
+
+ public void importReportData(ReportWizard aWizard);
+
+ /**
+ * Create the final Report document
+ * @param Name
+ * @param _bAsTemplate
+ * @param _bOpenInDesign
+ * @return
+ */
+ public void createAndOpenReportDocument(
+ final String Name,
+ final boolean _bAsTemplate,
+ final boolean _bOpenInDesign
+ );
+
+ public void dispose();
+ // -------------------------------------------------------------------------
+ // Garbage dump
+ // -------------------------------------------------------------------------
+ /* DataImport */
+ // ???
+ // public void addTextSectionCopies();
+ // ???
+ public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] Properties);
+ // ???
+ public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF);
+ // ???
+ // public com.sun.star.lang.XMultiServiceFactory getDocumentServiceFactory();
+ /**
+ * set a internal variable to stop a maybe longer DB access.
+ */
+ public void StopProcess(); // cancel
+
+ /**
+ * Returns a string list of layouts.
+ * @return
+ */
+ public String[][] getDataLayout();
+
+ /**
+ * Returns a string list of header layouts
+ * @return
+ */
+ public String[][] getHeaderLayout();
+
+ public void setCommandType(int CommandType);
+
+ public void setCommand(String Command);
+
+ /**
+ * check internal invariants
+ * @throws a
+ */
+ public void checkInvariants() throws java.lang.Exception;
+}
diff --git a/wizards/com/sun/star/wizards/report/MANIFEST.MF b/wizards/com/sun/star/wizards/report/MANIFEST.MF
new file mode 100644
index 000000000000..1a4f8da6e3b0
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.report.CallReportWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/report/RecordTable.java b/wizards/com/sun/star/wizards/report/RecordTable.java
new file mode 100644
index 000000000000..b4af7f7fa94b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/RecordTable.java
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XTableColumns;
+import com.sun.star.table.XTableRows;
+import com.sun.star.text.XTextTable;
+import com.sun.star.uno.Exception;
+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;
+ public XCellRange xCellRange;
+ public XTextTable xTextTable;
+ private TextTableHandler oTextTableHandler;
+ public XTableColumns xTableColumns;
+ public XTableRows xTableRows;
+
+ public RecordTable(TextTableHandler _oTextTableHandler)
+ {
+ try
+ {
+ 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))
+ {
+ 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);
+ }
+ 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);
+ }
+ 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();
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
new file mode 100644
index 000000000000..1482e118e516
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
@@ -0,0 +1,293 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+//import com.sun.star.ucb.CommandAbortedException;
+import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XTextComponent;
+//import com.sun.star.container.XHierarchicalNameAccess;
+//import com.sun.star.container.XNameAccess;
+//import com.sun.star.lang.EventObject;
+//import com.sun.star.lang.XMultiServiceFactory;
+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;
+ XTextComponent xTitleTextBox;
+ XTextComponent[] xSaveTextBox = new XTextComponent[2];
+ Object chkTemplate;
+ String CHANGEREPORTTITLE_FUNCNAME = "changeReportTitle";
+ String TOGGLESUBTEMPLATECONTROLS_FUNCNAME = "toggleSubTemplateControls";
+// String slblHowProceed;
+// String slblChooseReportKind;
+ String TemplatePath;
+ String StoreName;
+ boolean bfinalaskbeforeOverwrite;
+ String DefaultName;
+ String OldDefaultName;
+ // ReportTextDocument CurReportDocument;
+ IReportDocument CurReportDocument;
+ // 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);
+// 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);
+
+ 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)
+ });
+
+ 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("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.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)
+ });
+ }
+
+
+ /*
+ * 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);
+ }
+// private boolean fileexists(XMultiServiceFactory _xMSF, String _spath){
+// try {
+// XInterface xUcbInterface = (XInterface) _xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
+// XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
+// return xSimpleFileAccess.exists(_spath);
+// } catch (Exception exception) {
+// 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)
+ {
+ OldDefaultName = DefaultName;
+ }
+ xTitleTextBox.setText(DefaultName);
+ }
+
+ public String getStoreName()
+ {
+ if (CurUnoDialog != null)
+ {
+ String LocStoreName = xTitleTextBox.getText();
+ if (!LocStoreName.equals(""))
+ {
+ StoreName = LocStoreName;
+ }
+ }
+ return (StoreName);
+ }
+
+ public String getStorePath()
+ {
+ 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 "";
+ }
+ }
+
+ public void changeReportTitle()
+ {
+ final String TitleName = xTitleTextBox.getText();
+ CurReportDocument.liveupdate_updateReportTitle(TitleName);
+ CurUnoDialog.enableFinishButton(!"".equals(TitleName));
+ }
+
+ public int getReportOpenMode()
+ {
+ 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;
+ }
+
+ public boolean finish()
+ {
+ StoreName = getStoreName();
+ if (!CurReportDocument.getRecordParser().getReportDocuments().hasByHierarchicalName(StoreName))
+ {
+ try
+ {
+ CurReportDocument.store(StoreName, getReportOpenMode());
+ ReportWizard.bCloseDocument = false;
+ return true;
+ }
+ catch(Exception e)
+ {
+ CurUnoDialog.showMessageBox("ErrorBox", VclWindowPeerAttribute.OK,e.getLocalizedMessage() );
+ CurUnoDialog.enableFinishButton(false);
+ return false;
+ }
+ }
+ 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);
+ CurUnoDialog.enableFinishButton(false);
+ return false;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
new file mode 100644
index 000000000000..a8d26d68cd41
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportImplementationHelper.java
@@ -0,0 +1,68 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.db.RecordParser;
+
+/**
+ *
+ * @author ll93751
+ */
+public class ReportImplementationHelper
+{
+
+ private RecordParser m_aCurDBMetaData;
+ private XMultiServiceFactory m_xMSF;
+ protected int m_nDefaultPageOrientation;
+
+ /**
+ *
+ * @param _aMSF
+ * @param _nOrientation
+ */
+ public ReportImplementationHelper(XMultiServiceFactory _aMSF, int _nOrientation)
+ {
+ m_xMSF = _aMSF;
+ m_nDefaultPageOrientation = _nOrientation;
+ }
+
+ public RecordParser getRecordParser()
+ {
+ if (m_aCurDBMetaData == null)
+ {
+ m_aCurDBMetaData = new RecordParser(getMSF());
+ }
+ 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
new file mode 100644
index 000000000000..d1532b47dc4a
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java
@@ -0,0 +1,341 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.awt.XListBox;
+// import com.sun.star.awt.XTextComponent;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.*;
+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;
+// static String sReportTitle;
+// static String slblDataStructure;
+// static String slblPageLayout;
+// static String sOrganizeFields;
+ XListBox xContentListBox;
+ XListBox xLayoutListBox;
+ int iOldContentPos;
+ int iOldLayoutPos;
+ // ReportTextDocument CurReportDocument;
+ IReportDocument CurReportDocument;
+ public String[][] LayoutFiles;
+ public String[][] ContentFiles;
+ // private Desktop.OfficePathRetriever curofficepath;
+ Object aOrientationImage;
+ // boolean m_bLandscape = true;
+ private XMultiServiceFactory m_xMSF;
+
+ public ReportLayouter(XMultiServiceFactory _xMSF, IReportDocument _CurReportDocument, UnoDialog _CurUnoDialog)
+ {
+ 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);
+// 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);
+
+ // 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)
+ });
+
+ 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)
+ });
+
+ 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;
+// LayoutFiles = FileAccess.getFolderTitles(m_xMSF, "stl", CurReportDocument.getReportPath());
+ 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 = 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)
+ });
+
+ 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)
+ });
+
+ 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);
+ }
+ }
+ 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();
+ }
+
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
+
+ public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
+ 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)
+ {
+ case SOCONTENTLST:
+ iPos = xContentListBox.getSelectedItemPos();
+ if (iPos != iOldContentPos)
+ {
+ iOldContentPos = iPos;
+ CurReportDocument.liveupdate_changeContentTemplate(ContentFiles[1][iPos]);
+ }
+ break;
+
+ case SOLAYOUTLST:
+ iPos = xLayoutListBox.getSelectedItemPos();
+ if (iPos != iOldLayoutPos)
+ {
+ iOldLayoutPos = iPos;
+ CurReportDocument.liveupdate_changeLayoutTemplate(LayoutFiles[1][iPos]/*, Desktop.getBitmapPath(m_xMSF)*/);
+ }
+ break;
+
+ case SOOPTLANDSCAPE:
+ // CurReportDocument.getDoc().changePageOrientation(true);
+ try
+ {
+ CurReportDocument.setPageOrientation(SOOPTLANDSCAPE);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ }
+ Helper.setUnoPropertyValue(aOrientationImage, "ImageURL", CurUnoDialog.getWizardImageUrl(1002, 1003));
+
+ break;
+
+ case SOOPTPORTRAIT:
+ // CurReportDocument.getDoc().changePageOrientation( false);
+ try
+ {
+ CurReportDocument.setPageOrientation(SOOPTPORTRAIT);
+ }
+ 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:
+ break;
+ }
+ }
+ 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
+ {
+ 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));
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
new file mode 100644
index 000000000000..3ab9e704b9b9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
@@ -0,0 +1,786 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.text.XRelativeTextContentRemove;
+import com.sun.star.text.XTextContent;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Vector;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.db.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.ui.*;
+import com.sun.star.sdb.CommandType;
+// import com.sun.star.table.XCell;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.text.TextTableHandler;
+import com.sun.star.wizards.text.TextSectionHandler;
+import com.sun.star.wizards.text.TextStyleHandler;
+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;
+ private Rectangle PosSize;
+ // private String ReportFolderName;
+ public Vector DBColumnsVector;
+ private RecordTable CurRecordTable;
+ private String sMsgTableNotExisting;
+ private String sMsgCommonReportError;
+ private String ContentTemplatePath;
+ private String LayoutTemplatePath;
+ // private String sMsgInvalidTextField;
+ private String sMsgEndAutopilot;
+ public boolean bIsCurLandscape;
+ public TextTableHandler oTextTableHandler;
+ public TextSectionHandler oTextSectionHandler;
+ public FormHandler oFormHandler;
+ public TextStyleHandler oTextStyleHandler;
+ public TextFieldHandler oTextFieldHandler;
+ public ViewHandler oViewHandler;
+ public NumberFormatter oNumberFormatter;
+ public static final String TBLRECORDSECTION = "Tbl_RecordSection";
+ public static final String TBLGROUPSECTION = "Tbl_GroupField";
+ public static final String RECORDSECTION = "RecordSection";
+ public static final String GROUPSECTION = "GroupField";
+ public static final String COPYOFTBLRECORDSECTION = "CopyOf" + TBLRECORDSECTION;
+ 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);
+ }
+
+ 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();
+ }
+
+ public NumberFormatter getNumberFormatter()
+ {
+ return oNumberFormatter;
+ }
+
+ public boolean checkReportLayoutMode(String[] GroupFieldNames)
+ {
+ try
+ {
+ 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;
+ }
+ 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();
+ }
+
+ 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)
+ {
+ 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)
+ {
+ 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()));
+ }
+
+ public void updateReportTitle(String _sTitleName)
+ {
+ m_xDocProps.setTitle(_sTitleName);
+ }
+
+ public void getReportPageStyles()
+ {
+ 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);
+ }
+ }
+
+ public void changePageOrientation(boolean bNewLandscape)
+ {
+ 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)
+ {
+ 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);
+ }
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public boolean loadSectionsfromTemplate(String sTemplateUrl)
+ {
+ try
+ {
+ 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)
+ {
+ 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)
+ {
+ return false;
+ }
+ else
+ {
+ CurDBColumn.formatValueCell();
+ DBColumnsVector.set(i, CurDBColumn);
+ replaceFieldValueInGroupTable(CurDBColumn, i);
+ }
+ }
+ return true;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ public void setupRecordSection(String TemplateName)
+ {
+ this.ContentTemplatePath = TemplateName;
+ if (CurDBMetaData.getRecordFieldNames().length > 0)
+ {
+ 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);
+ }
+ }
+ else
+ {
+ CurRecordTable = null;
+ }
+ }
+
+ public void refreshGroupFields(String[] _sNewNames)
+ {
+ int nSize = DBColumnsVector.size();
+ for (int i = 0; i < nSize; i++)
+ {
+ DBColumn CurDBColumn = (DBColumn) DBColumnsVector.elementAt(i);
+ String sFieldName = CurDBColumn.CurDBField.getFieldName();
+ if (!sFieldName.equals(_sNewNames[i]))
+ {
+ 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++)
+ {
+ ((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);
+ }
+ }
+
+ 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)
+ {
+ 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)
+ {
+ 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(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 RemoveCount = ColCount - RecordCount;
+ xColumns.removeByIndex(0, RemoveCount);
+ }
+ else 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))
+ {
+ DBColumnsVector.add(CurDBColumn);
+ }
+ else
+ {
+ DBColumnsVector.set(i + GroupCount, CurDBColumn);
+ }
+ }
+ }
+ 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)
+ {
+ removeGroupNamesofRecordTable(iSelCount);
+ FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByTitle(CurGroupTitle);
+ GroupFieldVector.addElement(CurFieldColumn.getFieldName());
+ 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.getFieldName(), 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);
+ }
+ }
+ catch (Exception exception)
+ {
+ showCommonReportErrorBox(exception);
+ }
+
+ }
+
+ 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.getFieldName());
+ 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)
+ {
+ showCommonReportErrorBox(exception);
+ }
+ }
+
+ public void removeGroupNamesofRecordTable(int GroupFieldCount)
+ {
+ int CurFieldCount = DBColumnsVector.size();
+ if (CurFieldCount > GroupFieldCount)
+ {
+ for (int i = CurFieldCount - 1; i >= GroupFieldCount; 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);
+ }
+
+ public void getallDBColumns()
+ {
+ try
+ {
+ 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 (CurRecordTable == null)
+ {
+ CurRecordTable = new RecordTable(oTextTableHandler);
+ }
+ CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i - CurDBMetaData.GroupFieldNames.length);
+ }
+ if (CurDBColumn != null)
+ {
+ if (CurDBColumn.xNameCell != null)
+ {
+ DBColumnsVector.addElement(CurDBColumn);
+ }
+ 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--;
+ }
+ }
+ 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.getFieldName());
+ DBColumn oDBColumn2 = getDBColumnByName(oFieldColumn2.getFieldName());
+ if (oDBColumn1.ValColumn < oDBColumn2.ValColumn)
+ {
+ 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++)
+ {
+ DBColumn oDBColumn = (DBColumn) DBColumnsVector.get(i);
+ if (oDBColumn.CurDBField.getFieldName().equals(_FieldName))
+ {
+ return oDBColumn;
+ }
+ }
+ return null;
+ }
+
+ public static FieldColumn[] removeFieldColumnByFieldName(String _FieldName, FieldColumn[] _FieldColumns)
+ {
+ try
+ {
+ Vector aFieldColumns = new Vector();
+ for (int i = 0; i < _FieldColumns.length; i++)
+ {
+ FieldColumn CurFieldColumn = _FieldColumns[i];
+ if (!CurFieldColumn.getFieldName().equals(_FieldName))
+ {
+ aFieldColumns.add(CurFieldColumn);
+ }
+ }
+ 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++)
+ {
+ 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)
+ {
+ oTextSectionHandler.removeTextSectionbyName(sSectionName);
+ }
+ }
+ }
+
+ private String[] getLayoutTextTableNames()
+ {
+ 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;
+ }
+
+ 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 sTableName = sTableNames[i];
+ if (JavaTools.FieldInList(sLayoutTableNames, sTableName) < 0)
+ {
+ 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 sTableName = sTableNames[i];
+ if (JavaTools.FieldInList(sLayoutTableNames, sTableName) > -1)
+ {
+ if (!sTableName.equals(sLayoutTableNames[0]))
+ {
+ XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName));
+ boolean bleaveloop = false;
+ while (!bleaveloop)
+ {
+ try
+ {
+// xRelativeTextContentRemove.removeTextContentBefore(xTextContent);
+ xRelativeTextContentRemove.removeTextContentAfter(xTextContent);
+ // IllegalArgumentException may be thrown when no paragraphbreak is there
+ }
+ catch (IllegalArgumentException iexception)
+ {
+ bleaveloop = true;
+ }
+ }
+ }
+ oTextTableHandler.removeTextTablebyName(sTableName);
+ }
+ }
+ }
+
+ public void setLayoutSectionsVisible(boolean _IsVisible)
+ {
+ try
+ {
+ 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));
+ }
+ }
+ 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++)
+ {
+ 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
new file mode 100644
index 000000000000..05f7ad2a6a5b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -0,0 +1,734 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.container.XNamed;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XFrame;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.table.XCellRange;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextTable;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.InvalidQueryException;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.lang.XMultiServiceFactory;
+
+import com.sun.star.sdb.application.DatabaseObject;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.db.DBMetaData;
+import com.sun.star.wizards.db.SQLQueryComposer;
+import com.sun.star.wizards.document.OfficeDocument;
+import com.sun.star.wizards.ui.UIConsts;
+import java.util.ArrayList;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author ll93751
+ */
+public class ReportTextImplementation extends ReportImplementationHelper implements IReportDocument
+{
+
+ private ReportTextDocument m_aDoc;
+ private Object m_aInitialDoc;
+ private Resource m_resource;
+ private XDatabaseDocumentUI m_documentUI;
+
+ private void setInitialDocument(Object _aDoc)
+ {
+ m_aInitialDoc = _aDoc;
+ }
+
+ /**
+ * This is a TEMPORARY function to give direct access to the old text document.
+ * We have to remove this!!!
+ * @return
+ */
+ ReportTextDocument getDoc()
+ {
+ if (m_aDoc == null)
+ {
+ if (m_aInitialDoc instanceof XTextDocument)
+ {
+ m_aDoc = new ReportTextDocument(getMSF(), (XTextDocument) m_aInitialDoc, m_resource, getRecordParser());
+ }
+ else if (m_aInitialDoc instanceof String)
+ {
+ m_aDoc = new ReportTextDocument(getMSF(), (String) m_aInitialDoc, m_resource, getRecordParser());
+ }
+ else
+ {
+ throw new RuntimeException("Unknown type for setInitialDocument() given.");
+ }
+ }
+ return m_aDoc;
+ }
+
+ public void clearDocument()
+ {
+ getDoc().oTextSectionHandler.removeAllTextSections();
+ getDoc().oTextTableHandler.removeAllTextTables();
+ getDoc().DBColumnsVector = new Vector();
+ }
+
+ protected ReportTextImplementation( XMultiServiceFactory i_serviceFactory )
+ {
+ super( i_serviceFactory, ReportLayouter.SOOPTLANDSCAPE );
+ }
+
+ public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource )
+ {
+ m_documentUI = i_documentUI;
+ m_resource = i_resource;
+
+ if ( m_aInitialDoc == null )
+ setInitialDocument( getLayoutPath() );
+
+ initialResources();
+ }
+
+ static IReportDocument create( XMultiServiceFactory i_serviceFactory, XDatabaseDocumentUI i_documentUI, XTextDocument i_initialDocument, Resource i_resources )
+ {
+ ReportTextImplementation a = new ReportTextImplementation( i_serviceFactory );
+ a.setInitialDocument(i_initialDocument);
+ a.initialize( i_documentUI, i_resources );
+ return a;
+ }
+
+ public XWindowPeer getWizardParent()
+ {
+ return getDoc().xWindowPeer;
+ }
+ static String sMsgQueryCreationImpossible;
+ static String sReportFormNotExisting;
+ static String sMsgHiddenControlMissing;
+ static String sMsgEndAutopilot;
+ static String sMsgConnectionImpossible;
+ static String sMsgNoConnection;
+ static String[] ReportMessages = new String[4];
+
+ private void initialResources()
+ {
+ sReportFormNotExisting = m_resource.getResText(UIConsts.RID_REPORT + 64);
+ sMsgQueryCreationImpossible = m_resource.getResText(UIConsts.RID_REPORT + 65);
+ sMsgHiddenControlMissing = m_resource.getResText(UIConsts.RID_REPORT + 66);
+ sMsgEndAutopilot = m_resource.getResText(UIConsts.RID_DB_COMMON + 33);
+ sMsgNoConnection = m_resource.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++)
+ {
+ 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
+ {
+ XInterface xTextSection = (XInterface) getDocumentServiceFactory().createInstance("com.sun.star.text.TextSection");
+ XTextContent xTextSectionContent = UnoRuntime.queryInterface( XTextContent.class, xTextSection );
+ xNamedTextSection = 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)
+ {
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ 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)
+ {
+ XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
+ XNamed xNamedTable = UnoRuntime.queryInterface( XNamed.class, xTextTable );
+ xNamedTable.setName(_snewname);
+ }
+
+ 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
+ {
+ 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 = 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("")))
+ {
+ DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
+ if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()))
+ {
+ getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command");
+ getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command);
+ getRecordParser().getSQLQueryComposer().prependSortingCriteria();
+ }
+ else
+ {
+ nCommandType = com.sun.star.sdb.CommandType.QUERY;
+ getRecordParser().Command = sQueryName;
+ }
+ }
+
+ bexecute = getRecordParser().executeCommand(nCommandType); //sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot, sFieldNameList, true);
+ if (bexecute)
+ {
+ bexecute = getRecordParser().getFields(sFieldNameList, true);
+ }
+ return bexecute;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ 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)
+ {
+ return false;
+ }
+ }
+ private boolean m_bStopProcess;
+
+ public void StopProcess()
+ {
+ m_bStopProcess = true;
+ }
+
+ public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF)
+ {
+ try
+ {
+ 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)
+ {
+ 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] = 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))
+ {
+ // RowIndex += 1;
+ breset = false;
+ for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
+ {
+ 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);
+ }
+ }
+ getRecordParser().getcurrentRecordData(DataVector);
+ // updateProgressDisplay(RowIndex);
+ }
+ insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount);
+ }
+ else
+ {
+ getDoc().unlockallControllers();
+ return;
+ }
+ }
+ 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();
+ }
+
+ private void insertDataToRecordTable(XTextCursor xTextCursor, Vector DataVector, int FieldCount)
+ {
+ 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)
+ {
+ xTextTable.getRows().insertByIndex(xTextTable.getRows().getCount(), DataLength - 1);
+ }
+ OfficeDocument.ArraytoCellRange(RecordArray, xTextTable, 0, 1);
+ }
+ DataVector.removeAllElements();
+ }
+// public void updateProgressDisplay(int iCounter)
+// {
+// try
+// {
+// if (iCounter % 10 == 0)
+// {
+// sProgressCurRecord = JavaTools.replaceSubString(sProgressBaseCurRecord, String.valueOf(iCounter), "<COUNT>");
+// setControlProperty("lblCurProgress", "Label", sProgressCurRecord);
+// super.xReschedule.reschedule();
+// }
+// }
+// catch (java.lang.Exception jexception)
+// {
+// 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++)
+ {
+ 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);
+ }
+ }
+ }
+
+ public XFrame getFrame()
+ {
+ return m_aDoc.xFrame;
+ }
+
+ public XMultiServiceFactory getDocumentServiceFactory()
+ {
+ return m_aDoc.xMSFDoc;
+ }
+
+ public void store(String _sName, int _nOpenMode) throws com.sun.star.uno.Exception
+ {
+ 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)
+ {
+ return getDoc().addGroupNametoDocument(GroupNames, CurGroupTitle, GroupFieldVector, ReportPath, iSelCount);
+ }
+
+ public void refreshGroupFields(String[] _sNewNames)
+ {
+ getDoc().refreshGroupFields(_sNewNames);
+ }
+
+ // public boolean isGroupField(String _FieldName)
+ // {
+ // return getDoc().isGroupField(_FieldName);
+ // }
+ public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, Vector GroupFieldVector)
+ {
+ getDoc().removeGroupName(NewSelGroupNames, CurGroupTitle, GroupFieldVector);
+ }
+
+ public void setPageOrientation(int nOrientation) throws com.sun.star.lang.IllegalArgumentException
+ {
+ // LLA: should we lock controllers here?
+ // CurReportDocument.getDoc().xTextDocument.lockControllers();
+ if (nOrientation == ReportLayouter.SOOPTLANDSCAPE)
+ {
+ getDoc().changePageOrientation(true);
+ }
+ else if (nOrientation == ReportLayouter.SOOPTPORTRAIT)
+ {
+ getDoc().changePageOrientation(false);
+ }
+ else
+ {
+ throw new com.sun.star.lang.IllegalArgumentException("Unknown Orientation.");
+ }
+ // CurReportDocument.getDoc().unlockallControllers();
+ }
+
+ public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/)
+ {
+ getDoc().swapLayoutTemplate(LayoutTemplatePath/*, BitmapPath*/);
+ }
+
+ public void liveupdate_changeContentTemplate(String ContentTemplatePath)
+ {
+ getDoc().swapContentTemplate(ContentTemplatePath);
+ }
+
+ public void layout_setupRecordSection(String TemplateName)
+ {
+ getDoc().setupRecordSection(TemplateName);
+ }
+
+ public void removeTextTableAndTextSection()
+ {
+ getDoc().oTextSectionHandler.removeTextSectionbyName("RecordSection");
+ getDoc().oTextTableHandler.removeTextTablebyName("Tbl_RecordSection");
+ }
+
+ public void layout_selectFirstPage()
+ {
+ getDoc().oViewHandler.selectFirstPage(getDoc().oTextTableHandler);
+ }
+
+ public void dispose()
+ {
+ OfficeDocument.dispose(getMSF(), getComponent());
+ }
+
+ public XComponent getComponent()
+ {
+ return getDoc().xComponent;
+ }
+
+ public void liveupdate_changeUserFieldContent(String fieldname, String sfieldtitle)
+ {
+ getDoc().oTextFieldHandler.changeUserFieldContent(fieldname, sfieldtitle);
+ }
+
+ public void liveupdate_updateReportTitle(String _sTitleName)
+ {
+ }
+
+ public void addReportToDBView()
+ {
+ getRecordParser().addReportDocument(getComponent(), true);
+ }
+
+ public void createAndOpenReportDocument( String sReportName, boolean _bAsTemplate, boolean _bOpenInDesign )
+ {
+ try
+ {
+ m_documentUI.loadComponent( DatabaseObject.REPORT, sReportName, _bOpenInDesign );
+ }
+ catch ( Exception ex )
+ {
+ Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ }
+ }
+
+ public void initializeFieldColumns(final int _nType, final String TableName, final String[] FieldNames)
+ {
+ getRecordParser().initializeFieldColumns(FieldNames, TableName);
+ }
+
+ public void setFieldTitles(String[] sFieldTitles)
+ {
+ getRecordParser().setFieldTitles(sFieldTitles);
+ }
+
+ public void setSorting(String[][] aSortFieldNames)
+ {
+ getRecordParser().setSortFieldNames(aSortFieldNames);
+ }
+
+ public void setGrouping(String[] aGroupFieldNames)
+ {
+ getRecordParser().prependSortFieldNames(aGroupFieldNames);
+ }
+
+// 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
+ try
+ {
+ m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
+ // m_sReportPath = FileAccess.combinePaths(getMSF(), m_sReportPath, "/wizard/report");
+ FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report");
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ return m_aReportPath;
+ }
+
+ public String getContentPath()
+ {
+ ArrayList aReportPath = getReportPath();
+ for (int i = 0; i < aReportPath.size(); i++)
+ {
+ String sPath = (String) aReportPath.get(i);
+ sPath += "/cnt-default.ott";
+ if (FileAccess.isPathValid(getMSF(), sPath))
+ {
+ return sPath;
+ }
+ }
+ return "";
+ }
+
+ public String getLayoutPath()
+ {
+ ArrayList aReportPath = getReportPath();
+ for (int i = 0; i < aReportPath.size(); i++)
+ {
+ String sPath = (String) aReportPath.get(i);
+ sPath += "/stl-default.ott";
+ if (FileAccess.isPathValid(getMSF(), sPath))
+ {
+ return sPath;
+ }
+ }
+ return "";
+ }
+
+ public int getDefaultPageOrientation()
+ {
+ return m_nDefaultPageOrientation;
+ }
+
+ public String[][] getDataLayout()
+ {
+ String[][] ContentFiles;
+ try
+ {
+// ContentFiles = FileAccess.getFolderTitles(m_xMSF, "cnt", CurReportDocument.getReportPath());
+ ContentFiles = FileAccess.getFolderTitles(getMSF(), "cnt", getReportPath());
+ }
+ catch (com.sun.star.wizards.common.NoValidPathException e)
+ {
+ ContentFiles = new String[2][];
+ String[] a = new String[1];
+ String[] b = new String[1];
+ a[0] = "DefaultLayoutOfData";
+ b[0] = "default";
+ ContentFiles[1] = a;
+ ContentFiles[0] = b;
+ }
+ return ContentFiles;
+ }
+
+ public String[][] getHeaderLayout()
+ {
+ String[][] LayoutFiles;
+ try
+ {
+// LayoutFiles = FileAccess.getFolderTitles(m_xMSF, "stl", CurReportDocument.getReportPath());
+ LayoutFiles = FileAccess.getFolderTitles(getMSF(), "stl", getReportPath());
+ }
+ catch (com.sun.star.wizards.common.NoValidPathException e)
+ {
+ LayoutFiles = new String[2][];
+ String[] a = new String[1];
+ String[] b = new String[1];
+ a[0] = "DefaultLayoutOfHeaders";
+ b[0] = "default";
+ LayoutFiles[1] = a;
+ LayoutFiles[0] = b;
+ }
+ return LayoutFiles;
+ }
+
+ public void importReportData(ReportWizard _aWizard)
+ {
+ Dataimport CurDataimport = new Dataimport(_aWizard.xMSF);
+ CurDataimport.CurReportDocument = this;
+ _aWizard.importReportData(_aWizard.xMSF, CurDataimport);
+ }
+
+ public void setCommandType(int _nCommand)
+ {
+ // already set somewhere else
+ }
+
+ public void setCommand(String _sCommand)
+ {
+ getRecordParser().Command = _sCommand;
+ }
+
+ public void checkInvariants() throws java.lang.Exception
+ {
+ }
+}
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java
new file mode 100644
index 000000000000..2bffd2b4bea3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -0,0 +1,761 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.report;
+
+// import java.util.Vector;
+
+import com.sun.star.awt.TextEvent;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XTextListener;
+import com.sun.star.beans.PropertyValue;
+
+import com.sun.star.container.XContentEnumerationAccess;
+import com.sun.star.deployment.XPackageInformationProvider;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.logging.XLogger;
+import com.sun.star.logging.XLoggerPool;
+import com.sun.star.sdb.CommandType;
+
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+
+import com.sun.star.logging.LogLevel;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.db.DBMetaData;
+import com.sun.star.wizards.db.DatabaseObjectWizard;
+import com.sun.star.wizards.db.SQLQueryComposer;
+import com.sun.star.wizards.ui.CommandFieldSelection;
+import com.sun.star.wizards.ui.FieldSelection;
+import com.sun.star.wizards.ui.SortingComponent;
+import com.sun.star.wizards.ui.TitlesComponent;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.XCompletion;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Map;
+
+public class ReportWizard extends DatabaseObjectWizard implements XTextListener, XCompletion
+{
+ protected FieldSelection CurGroupFieldSelection;
+ private SortingComponent CurSortingComponent;
+ private TitlesComponent CurTitlesComponent;
+ private CommandFieldSelection CurDBCommandFieldSelection;
+ private GroupFieldHandler CurGroupFieldHandler;
+ private ReportLayouter CurReportLayouter;
+ private ReportFinalizer CurReportFinalizer;
+ private int nReportMode = ReportFinalizer.SOCREATEDOCUMENT;
+ private String m_sReportName = "";
+ protected static final String SOREPORTFORMNAME = "ReportSource";
+ private static final int SOMAINPAGE = 1;
+ private static final int SOTITLEPAGE = 2;
+ protected static final int SOGROUPPAGE = 3;
+ private static final int SOSORTPAGE = 4;
+ protected static final int SOTEMPLATEPAGE = 5;
+ protected static final int SOSTOREPAGE = 6;
+
+ private IReportDocument m_reportDocument;
+ private static String sMsgWizardName;
+ private static String slblFields;
+ private static String slblSelFields;
+ private static String sShowBinaryFields;
+ private String[] WizardHeaderText = new String[6];
+ private static String slblColumnTitles;
+ private static String slblColumnNames;
+ private static String slblTables;
+ protected static boolean bCloseDocument;
+ private boolean bHasEscapeProcessing = true;
+
+ public ReportWizard( XMultiServiceFactory i_serviceFactory, final PropertyValue[] i_wizardContext )
+ {
+ super(i_serviceFactory, 34320, i_wizardContext );
+ 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[]
+ {
+ Integer.valueOf(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");
+ m_reportDocument.removeTextTableAndTextSection();
+ }
+ switch (nNewStep)
+ {
+ case SOMAINPAGE:
+ CurDBCommandFieldSelection.setModified(false);
+ break;
+
+ case SOTITLEPAGE:
+ String[] aFieldNames = m_reportDocument.getRecordParser().getFieldNames();
+ Map aFieldTitleSet = m_reportDocument.getRecordParser().getFieldTitleSet();
+ CurTitlesComponent.initialize(aFieldNames, aFieldTitleSet);
+ break;
+
+ case SOGROUPPAGE:
+ CurGroupFieldHandler.initialize();
+ break;
+
+ case SOSORTPAGE:
+ String[] aFieldNames2 = m_reportDocument.getRecordParser().getFieldNames();
+ String[][] aSortFieldNames = m_reportDocument.getRecordParser().getSortFieldNames();
+ CurSortingComponent.initialize(aFieldNames2, aSortFieldNames);
+ int nLength = m_reportDocument.getRecordParser().GroupFieldNames.length;
+ CurSortingComponent.setReadOnlyUntil(nLength, false);
+ break;
+
+ case SOTEMPLATEPAGE:
+ break;
+
+ case SOSTOREPAGE:
+ //TODO initialize with suitable PathName
+ CurReportFinalizer.initialize(m_reportDocument.getRecordParser());
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ protected void leaveStep(int nOldStep, int nNewStep)
+ {
+
+ switch (nOldStep)
+ {
+ case SOMAINPAGE:
+ String[] aSelectedFieldNames = CurDBCommandFieldSelection.getSelectedFieldNames();
+ String aTableName = CurDBCommandFieldSelection.getSelectedCommandName();
+ int nType = CurDBCommandFieldSelection.getSelectedCommandType();
+ m_reportDocument.initializeFieldColumns(nType, aTableName, aSelectedFieldNames);
+ if (CurDBCommandFieldSelection.isModified())
+ {
+ // cleanup document
+ m_reportDocument.clearDocument();
+ m_reportDocument.getRecordParser().setGroupFieldNames(new String[]{});
+ CurGroupFieldHandler.removeGroupFieldNames();
+ }
+ break;
+
+ case SOTITLEPAGE:
+ String[] sFieldTitles = CurTitlesComponent.getFieldTitles();
+ // set new field name titles
+ // CurReportDocument.getRecordParser().setFieldTitles(sFieldTitles);
+ m_reportDocument.setFieldTitles(sFieldTitles);
+ break;
+
+ case SOGROUPPAGE:
+ // TODO: DESIGN!!! a getter should return a value!!!
+ CurGroupFieldHandler.getGroupFieldNames(m_reportDocument.getRecordParser());
+ String[] aGroupFieldNames = m_reportDocument.getRecordParser().GroupFieldNames;
+ // CurReportDocument.getRecordParser().prependSortFieldNames(aGroupFieldNames);
+ m_reportDocument.setGrouping(aGroupFieldNames);
+ break;
+
+ case SOSORTPAGE:
+ String[][] aSortFieldNames = CurSortingComponent.getSortFieldNames();
+ // CurReportDocument.getRecordParser().SortFieldNames = aSortFieldNames;
+ m_reportDocument.setSorting(aSortFieldNames);
+ // TODO: why do we make a switch here
+ super.enablefromStep(SOTEMPLATEPAGE, true);
+ break;
+
+ case SOTEMPLATEPAGE:
+ break;
+
+ case SOSTOREPAGE:
+ break;
+
+ default:
+ break;
+ }
+
+ if ((nOldStep < SOTEMPLATEPAGE) && (super.getNewStep() >= SOTEMPLATEPAGE))
+ {
+// this is called before SOTEMPLATEPAGE, after SOGROUPPAGE
+ m_reportDocument.getRecordParser().createRecordFieldNames();
+ CurReportLayouter.initialize(m_reportDocument.getContentPath());
+ }
+ }
+
+ private void dialogFinish()
+ {
+ this.xComponent.dispose();
+ if (bCloseDocument == true)
+ {
+ m_reportDocument.dispose();
+ return;
+ }
+
+ if ( ( nReportMode == ReportFinalizer.SOCREATETEMPLATE )
+ || ( nReportMode == ReportFinalizer.SOUSETEMPLATE )
+ )
+ {
+ m_reportDocument.addReportToDBView();
+ boolean bOpenInDesign = (nReportMode == ReportFinalizer.SOCREATETEMPLATE);
+ m_reportDocument.createAndOpenReportDocument( m_sReportName, true, bOpenInDesign);
+ }
+ else
+ {
+ m_reportDocument.importReportData(this);
+ m_reportDocument.createAndOpenReportDocument( m_sReportName, false, false );
+ }
+ }
+
+ private boolean executeQuery()
+ {
+ boolean bQueryCreated = false;
+ if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE)
+ {
+ bQueryCreated = m_reportDocument.getRecordParser().getSQLQueryComposer().setQueryCommand(this.xWindow, false, false);
+
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ String sQuery = m_reportDocument.getRecordParser().getSQLQueryComposer().getQuery();
+ m_reportDocument.setCommand(sQuery);
+ }
+ else
+ {
+ try
+ {
+ String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
+ DBMetaData.CommandObject oCommand = m_reportDocument.getRecordParser().getQueryByName(sQueryName);
+ bHasEscapeProcessing = m_reportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet());
+ String sCommand = (String) oCommand.getPropertySet().getPropertyValue("Command");
+ if (bHasEscapeProcessing)
+ {
+ // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command");
+ bQueryCreated = (!sCommand.equals(""));
+ m_reportDocument.getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(sCommand);
+ m_reportDocument.getRecordParser().getSQLQueryComposer().prependSortingCriteria();
+// TODO: check with query
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ m_reportDocument.setCommand(m_reportDocument.getRecordParser().getSQLQueryComposer().getQuery());
+ bQueryCreated = true;
+ }
+ else
+ {
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ m_reportDocument.setCommand(sCommand);
+ bQueryCreated = true;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ if (!bQueryCreated)
+ {
+ super.vetoableChange(null);
+ }
+ return bQueryCreated;
+ }
+ public void buildSteps()
+ {
+ // CurReportDocument.getDoc().xProgressBar.setValue(30);
+ CurDBCommandFieldSelection = new CommandFieldSelection(this, m_reportDocument.getRecordParser(), 100, slblFields, slblSelFields, slblTables, true, 34330);
+ CurDBCommandFieldSelection.addFieldSelectionListener(new FieldSelectionListener());
+ if ( !isReportBuilderInstalled() )
+ {
+ 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(m_reportDocument, this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(60);
+ CurSortingComponent = new SortingComponent(this, SOSORTPAGE, 95, 30, 210, 34346);
+ // CurReportDocument.getDoc().xProgressBar.setValue(70);
+ CurReportLayouter = new ReportLayouter(xMSF, m_reportDocument, this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(80);
+ CurReportFinalizer = new ReportFinalizer(xMSF, m_reportDocument, this);
+ // CurReportDocument.getDoc().xProgressBar.setValue(100);
+ bCloseDocument = true;
+ // CurReportDocument.getDoc().xProgressBar.end();
+ enableNavigationButtons(false, false, false);
+ }
+
+ public boolean finishWizard()
+ {
+ final int ncurStep = getCurrentStep();
+ if ((switchToStep(ncurStep, SOSTOREPAGE)) || (ncurStep == SOSTOREPAGE))
+ {
+ if (this.executeQuery())
+ {
+ if (CurReportFinalizer.finish())
+ {
+ nReportMode = CurReportFinalizer.getReportOpenMode();
+ m_sReportName = CurReportFinalizer.getStoreName();
+ xDialog.endExecute();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void cancelWizard()
+ {
+ 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);
+ }
+
+ private boolean isReportBuilderInstalled()
+ {
+ //! Check if the new Report Builder Extension is available
+ XContentEnumerationAccess a = 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)
+ {
+ return false;
+ }
+ if (e.hasMoreElements())
+ {
+ return true;
+ }
+ 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 = UnoRuntime.queryInterface( XPackageInformationProvider.class, aSingleton );
+ final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner");
+ return sLocation;
+ }
+
+private static XLogger m_xLogger;
+
+private static void initializeLogger(XMultiServiceFactory _xMSF)
+{
+ XComponentContext xContext = Helper.getComponentContext(_xMSF);
+
+ final Object aLoggerPool = xContext.getValueByName("/singletons/com.sun.star.logging.LoggerPool");
+ if (aLoggerPool == null)
+ {
+ System.out.println("Can't get singleton from logging");
+ }
+ final XLoggerPool xLoggerPool = UnoRuntime.queryInterface( XLoggerPool.class, aLoggerPool );
+ m_xLogger = xLoggerPool.getNamedLogger("com.sun.star.wizards.ReportBuilder");
+}
+
+public static XLogger getLogger()
+{
+ return m_xLogger;
+}
+
+ public void startReportWizard()
+ {
+ initializeLogger(xMSF);
+ getLogger().log(LogLevel.SEVERE, "Start Report Wizard");
+
+ if ( isReportBuilderInstalled() )
+ {
+ // 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
+ {
+ 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 });
+ m_reportDocument = (IReportDocument) aMethod.invoke(a, new Object[] { xMSF });
+ }
+ catch (Exception e)
+ {
+ // 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
+ {
+ if (m_reportDocument == null)
+ {
+ // Fallback, if there is no reportbuilder wizard implementation, we use the old wizard
+ m_reportDocument = new ReportTextImplementation( xMSF );
+ }
+
+ m_reportDocument.initialize( m_docUI, m_oResource );
+
+ if ( m_reportDocument.getRecordParser().getConnection( m_wizardContext ) )
+ {
+ buildSteps();
+
+ m_reportDocument.checkInvariants();
+
+ this.CurDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
+
+ createWindowPeer(m_reportDocument.getWizardParent());
+
+ m_reportDocument.getRecordParser().setWindowPeer(this.xControl.getPeer());
+ insertQueryRelatedSteps();
+ short RetValue = executeDialog(m_reportDocument.getFrame().getComponentWindow().getPosSize());
+ if ( RetValue == 0 )
+ dialogFinish();
+ }
+ m_reportDocument.getRecordParser().dispose();
+ }
+ catch (java.io.IOException e)
+ {
+ String sMessage = e.getMessage();
+ if (sMessage.equals("default.otr"))
+ {
+ sMessage = m_oResource.getResText(UIConsts.RID_REPORT + 92);
+ }
+ else
+ {
+ }
+ // show a dialog with the error message
+ SystemDialog.showMessageBox(xMSF, "ErrorBox", VclWindowPeerAttribute.OK, sMessage);
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ }
+
+ public void importReportData(final XMultiServiceFactory xMSF, final Dataimport CurDataimport)
+ {
+ boolean bDocisStored = false;
+ try
+ {
+ boolean bexecute = false;
+ if (!bHasEscapeProcessing)
+ {
+ bexecute = m_reportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.QUERY); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
+ }
+ else
+ {
+ bexecute = m_reportDocument.getRecordParser().executeCommand(com.sun.star.sdb.CommandType.COMMAND); // sMsgQueryCreationImpossible + (char) 13 + sMsgEndAutopilot))
+ }
+ if (bexecute)
+ {
+ bexecute = m_reportDocument.getRecordParser().getFields(m_reportDocument.getRecordParser().getFieldNames(), false);
+ }
+ if (bexecute)
+ {
+ // CurDataimport.insertDatabaseDatatoReportDocument(xMSF);
+ m_reportDocument.insertDatabaseDatatoReportDocument(xMSF);
+ }
+
+ if (CurReportFinalizer.getReportOpenMode() == ReportFinalizer.SOCREATEDOCUMENT)
+ {
+ bDocisStored = m_reportDocument.getRecordParser().storeDatabaseDocumentToTempPath(m_reportDocument.getComponent(), CurReportFinalizer.getStoreName());
+ }
+ }
+ catch (com.sun.star.wizards.common.InvalidQueryException queryexception)
+ {
+ }
+ CurDataimport.xComponent.dispose();
+ if (bDocisStored)
+ {
+ m_reportDocument.getRecordParser().addReportDocument(m_reportDocument.getComponent(), false);
+ }
+
+ m_reportDocument.getRecordParser().dispose();
+ }
+
+ public boolean getReportResources(boolean bgetProgressResourcesOnly)
+ {
+ sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_REPORT);
+ if (bgetProgressResourcesOnly == false)
+ {
+ sShowBinaryFields = m_oResource.getResText(UIConsts.RID_REPORT + 60);
+ 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);
+ }
+ slblColumnTitles = m_oResource.getResText(UIConsts.RID_REPORT + 70);
+ slblColumnNames = m_oResource.getResText(UIConsts.RID_REPORT + 71);
+ return true;
+ }
+
+ public static String getBlindTextNote(Object _aDocument, Resource _oResource)
+ {
+ String sBlindTextNote = "";
+ if (_aDocument instanceof ReportTextImplementation)
+ {
+ sBlindTextNote = _oResource.getResText(UIConsts.RID_REPORT + 75);
+ sBlindTextNote = JavaTools.replaceSubString(sBlindTextNote, String.valueOf((char) 13), "<BR>");
+ }
+ return sBlindTextNote;
+ }
+
+ public void enableRoadmapItems(boolean _bEnabled)
+ {
+ try
+ {
+ 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)
+ {
+ bEnabled = _bEnabled;
+ }
+ else
+ {
+ bEnabled = true;
+ }
+
+ Helper.setUnoPropertyValue(oRoadmapItem, "Enabled", new Boolean(bEnabled));
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ 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
+ {
+ 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);
+ m_reportDocument.liveupdate_changeUserFieldContent(fieldname, sContent);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void disposing(EventObject EventObject)
+ {
+ }
+
+ public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue)
+ {
+ switch (_ndialogpage)
+ {
+ case SOMAINPAGE:
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void toggleSortingPage()
+ {
+ int nlCommandType = this.CurDBCommandFieldSelection.getSelectedCommandType();
+ boolean bdoenable = (nlCommandType == CommandType.TABLE);
+ if (!bdoenable)
+ {
+ String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
+ DBMetaData.CommandObject oCommand = m_reportDocument.getRecordParser().getQueryByName(sQueryName);
+ bdoenable = m_reportDocument.getRecordParser().hasEscapeProcessing(oCommand.getPropertySet());
+ }
+ 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;
+ }
+
+ public void setID(String sIncSuffix)
+ {
+ m_nID = 1;
+ if (sIncSuffix != null)
+ {
+ if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
+ {
+ String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
+ m_nID = Integer.parseInt(sID);
+ }
+ }
+ }
+
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ 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));
+ }
+ }
+
+ 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);
+ }
+ 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()
+// {
+//
+// Calendar aCalendar = new GregorianCalendar();
+// aCalendar.setTimeInMillis(1202382900000L);
+// String aCalStr = aCalendar.toString();
+//
+// Date aDate = new Date();
+// aDate.setSeconds(0);
+// aDate.setMinutes(15);
+// aDate.setHours(12);
+// // aDate.setMonth(2);
+// // aDate.setYear(2008);
+// // aDate.setDay(7);
+// long nTime = aDate.getTime();
+// Long aLong = new Long(nTime);
+// String aStr = aLong.toString();
+//
+// Date aNewDate = new Date(1202382900000L);
+//// aNewDate.
+// String aDateStr = aNewDate.toString();
+//// Datetime aNewTime = new Time(1202382900);
+//// String aTimeStr = aNewTime.toString();
+//
+// }
+}
diff --git a/wizards/com/sun/star/wizards/report/delzip b/wizards/com/sun/star/wizards/report/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/delzip
diff --git a/wizards/com/sun/star/wizards/report/makefile.mk b/wizards/com/sun/star/wizards/report/makefile.mk
new file mode 100644
index 000000000000..b31639d21a46
--- /dev/null
+++ b/wizards/com/sun/star/wizards/report/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = report
+PACKAGE = com$/sun$/star$/wizards$/report
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar commonwizards.jar
+
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/report
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ CallReportWizard.java \
+ DBColumn.java \
+ Dataimport.java \
+ GroupFieldHandler.java \
+ IReportDocument.java \
+ IReportBuilderLayouter.java \
+ IReportDefinitionReadAccess.java \
+ RecordTable.java \
+ ReportFinalizer.java \
+ ReportImplementationHelper.java \
+ ReportLayouter.java \
+ ReportTextDocument.java \
+ ReportTextImplementation.java \
+ ReportWizard.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/reportbuilder/Manifest.mf b/wizards/com/sun/star/wizards/reportbuilder/Manifest.mf
new file mode 100644
index 000000000000..53dbd3422d9c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/Manifest.mf
@@ -0,0 +1,2 @@
+Class-Path: report.jar commonwizards.jar
+
diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
new file mode 100644
index 000000000000..6a90214696a5
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
@@ -0,0 +1,748 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder;
+
+import com.sun.star.util.XModeSelector;
+
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XHierarchicalNameContainer;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.report.XReportDefinition;
+import com.sun.star.sdb.XSubDocument;
+import com.sun.star.sdb.application.DatabaseObject;
+import com.sun.star.sdb.application.XDatabaseDocumentUI;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.ucb.XCommandProcessor;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XModifiable;
+import com.sun.star.util.XURLTransformer;
+import com.sun.star.wizards.common.NoValidPathException;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.db.FieldColumn;
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import java.util.Vector;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.NamedValueCollection;
+import com.sun.star.wizards.report.IReportBuilderLayouter;
+import com.sun.star.wizards.report.IReportDefinitionReadAccess;
+import com.sun.star.wizards.report.IReportDocument;
+import com.sun.star.wizards.report.ReportImplementationHelper;
+import com.sun.star.wizards.report.ReportLayouter;
+import com.sun.star.wizards.report.ReportWizard;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * 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
+ implements IReportDocument, IReportDefinitionReadAccess
+{
+ private Resource m_resource;
+ private XDatabaseDocumentUI m_documentUI;
+
+ private static final int MAXIMUM_GROUPCOUNT = 4;
+
+ private ReportBuilderImplementation( XMultiServiceFactory _serviceFactory )
+ {
+ // creates an access to the ReportBuilder Extension
+ super(_serviceFactory, ReportLayouter.SOOPTLANDSCAPE);
+ }
+
+ public static IReportDocument create( XMultiServiceFactory i_serviceFactory )
+ {
+ return new ReportBuilderImplementation( i_serviceFactory );
+ }
+
+ public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource )
+ {
+ m_documentUI = i_documentUI;
+ m_resource = i_resource;
+ }
+
+ public void clearDocument()
+ {
+ }
+
+ public XWindowPeer getWizardParent()
+ {
+ final XWindowPeer aWindowPeer = UnoRuntime.queryInterface( XWindowPeer.class, getFrame().getComponentWindow() );
+ return aWindowPeer;
+ }
+ private XFrame m_xFrame = null;
+ // private ReportBuilderLayouter m_aReportBuilderLayouter = null;
+ private String m_sReportBuilderLayoutName = "";
+
+ /**
+ * Get access to the current ReportLayouter, which depends on the name.
+ * To change the ReportBuilderLayouter use <code>setReportBuilderLayouterName(String Name)</code>.
+ * @return
+ */
+ private IReportBuilderLayouter getReportBuilderLayouter()
+ {
+ final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) getLayoutMap().get(m_sReportBuilderLayoutName);
+ return aReportBuilderLayouter;
+ }
+ private Object m_aReportDocument;
+ private XPropertySet m_documentDefinition;
+ private XReportDefinition m_reportDocument;
+
+ /**
+ * initialize the Report Builder and open it representation
+ * @param _aDoc
+ * @param _xConnection
+ */
+ private void initialize(Object _aDoc)
+ {
+ m_aReportDocument = _aDoc;
+
+ try
+ {
+ NamedValueCollection creationArgs = new NamedValueCollection();
+ creationArgs.put( "DocumentServiceName", "com.sun.star.report.ReportDefinition" );
+ creationArgs.put( "Mode", "remote" );
+
+ XComponent[] docDefinition = new XComponent[] { null };
+ XComponent reportDefinitionComp = m_documentUI.createComponentWithArguments(
+ DatabaseObject.REPORT, creationArgs.getPropertyValues(), docDefinition );
+
+ m_documentDefinition = UnoRuntime.queryInterface( XPropertySet.class, docDefinition[0] );
+ m_reportDocument = UnoRuntime.queryInterface( XReportDefinition.class, reportDefinitionComp );
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ ReportWizard.getLogger().log(com.sun.star.logging.LogLevel.SEVERE, "Problems with initialize the ReportDefinition" + e.getMessage());
+
+ }
+
+ switchOffPropertyBrowser();
+ switchOffAddFieldWindow();
+
+ setPageOrientation(m_nDefaultPageOrientation, false /* NO_LAYOUT*/);
+ }
+
+ private XModeSelector getModeSelector()
+ {
+ final XController xController = getReportDefinition().getCurrentController();
+ final XModeSelector xModeSelector = UnoRuntime.queryInterface( XModeSelector.class, xController );
+ return xModeSelector;
+ }
+
+ private void switchOffAddFieldWindow()
+ {
+ try
+ {
+ getModeSelector().setMode("remote");
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ int dummy = 0;
+ }
+ }
+
+ private void switchOnAddFieldWindow()
+ {
+ try
+ {
+ getModeSelector().setMode("normal");
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ int dummy = 0;
+ }
+ }
+
+ private void sleep(int _nSeconds)
+ {
+ try
+ {
+ Thread.sleep(_nSeconds * 1000);
+ }
+ catch (java.lang.InterruptedException e)
+ {
+ }
+
+ }
+
+ private void switchOffPropertyBrowser()
+ {
+ try
+ {
+ final XController xController = getReportDefinition().getCurrentController();
+ final XDispatchProvider xDP = 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 = 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();
+ aURL[0].Complete = ".uno:ControlProperties";
+ xURLTransformer.parseStrict(aURL);
+
+ final XDispatch xDispatch = xDP.queryDispatch(aURL[0], "_self", 0);
+ PropertyValue[] xEmpty = new PropertyValue[0];
+ xDispatch.dispatch(aURL[0], xEmpty);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ int dummy = 0;
+ }
+ }
+
+ 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
+ */
+ public XFrame getFrame()
+ {
+ if (m_xFrame == null)
+ {
+ initialize(getRecordParser().getReportDocuments());
+ m_xFrame = getReportDefinition().getCurrentController().getFrame();
+ setPageOrientation(m_nDefaultPageOrientation, true /* NO_LAYOUT*/);
+ }
+ return m_xFrame;
+ }
+
+ public boolean reconnectToDatabase(XMultiServiceFactory xMSF, PropertyValue[] Properties)
+ {
+ return false;
+ }
+
+ public void insertDatabaseDatatoReportDocument(XMultiServiceFactory xMSF)
+ {
+ }
+
+ public void StopProcess()
+ {
+ }
+
+ public void store(String Name, int OpenMode) throws com.sun.star.uno.Exception
+ {
+ // store into the ZIP Storage
+ if (OpenMode == 1 /* static Report */)
+ {
+ // we will store later
+ return;
+ }
+
+ final XCommandProcessor xProcessor = UnoRuntime.queryInterface( XCommandProcessor.class, m_documentDefinition );
+ final com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command();
+ aCommand.Name = "store";
+
+ xProcessor.execute(aCommand, xProcessor.createCommandIdentifier(), null);
+
+ final XHierarchicalNameContainer aNameContainer = UnoRuntime.queryInterface(XHierarchicalNameContainer.class, m_aReportDocument);
+ aNameContainer.insertByHierarchicalName( Name, m_documentDefinition );
+ }
+
+ public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount)
+ {
+ final int GroupCount = GroupFieldVector.size();
+ if (GroupCount < MAXIMUM_GROUPCOUNT)
+ {
+ final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle);
+ GroupFieldVector.addElement(CurFieldColumn.getFieldName());
+ }
+ return true;
+ }
+
+ public void refreshGroupFields(String[] _sNewNames)
+ {
+ }
+
+ public void liveupdate_removeGroupName(String[] NewSelGroupNames, String CurGroupTitle, Vector GroupFieldVector)
+ {
+ final FieldColumn CurFieldColumn = getRecordParser().getFieldColumnByTitle(CurGroupTitle);
+ GroupFieldVector.removeElement(CurFieldColumn.getFieldName());
+ }
+
+ private void setPageOrientation(int nOrientation, boolean bDoLayout)
+ {
+ getReportBuilderLayouter().setPageOrientation(nOrientation);
+ if (bDoLayout)
+ {
+ getReportBuilderLayouter().layout();
+ }
+ }
+
+ public void setPageOrientation(int nOrientation)
+ {
+ setPageOrientation(nOrientation, true);
+ }
+
+ public void liveupdate_changeLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/)
+ {
+ /* Right Listbox */
+ final IReportBuilderLayouter aLayouter = getReportBuilderLayouter();
+ aLayouter.loadAndSetBackgroundTemplate(LayoutTemplatePath);
+ aLayouter.layout();
+ }
+
+ /**
+ * Change the current Layouter by a new one with the given Name _sName.
+ * If there exist no other layouter with the given name, nothing happens, the layouter will not change to
+ * an illegal one.
+ * @param _sName Name of the other layouter.
+ */
+ public void setReportBuilderLayouterName(String _sName)
+ {
+ final IReportBuilderLayouter aCurrentLayouter = getReportBuilderLayouter();
+ final IReportBuilderLayouter aNewLayouter = (IReportBuilderLayouter) m_aLayoutMap.get(_sName);
+ if (aNewLayouter != null)
+ {
+ m_sReportBuilderLayoutName = _sName;
+ aNewLayouter.initializeData(aCurrentLayouter);
+ aNewLayouter.layout();
+ }
+ }
+
+ public void liveupdate_changeContentTemplate(String ContentTemplatePath)
+ {
+ /* Left Listbox */
+ setReportBuilderLayouterName(ContentTemplatePath);
+ }
+
+ public void layout_setupRecordSection(String TemplateName)
+ {
+ }
+
+ public void removeTextTableAndTextSection()
+ {
+ }
+
+ public void layout_selectFirstPage()
+ {
+ }
+
+ private void closeReportDefinition()
+ {
+ try
+ {
+ if ( m_documentDefinition != null )
+ {
+ // set the document to "not modified", to ensure that it won't ask the user before closing
+ XModifiable documentModify = UnoRuntime.queryInterface( XModifiable.class, m_reportDocument );
+ documentModify.setModified( false );
+ // actually close
+ XSubDocument subComponent = UnoRuntime.queryInterface( XSubDocument.class, m_documentDefinition );
+ subComponent.close();
+ }
+ }
+ catch ( Exception ex )
+ {
+ Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ }
+ m_documentDefinition = null;
+ m_reportDocument = null;
+ }
+
+ public void dispose()
+ {
+ getReportBuilderLayouter().dispose();
+ closeReportDefinition();
+ }
+
+ public XComponent getComponent()
+ {
+ return null;
+ }
+
+ public void liveupdate_changeUserFieldContent(String fieldName, String titlename)
+ {
+ }
+
+ public void liveupdate_updateReportTitle(String _sTitleName)
+ {
+ }
+
+ public void addReportToDBView()
+ {
+ }
+
+ private XComponent loadReport( final String i_reportName )
+ {
+ try
+ {
+ return m_documentUI.loadComponent( DatabaseObject.REPORT, i_reportName, false );
+ }
+ catch ( Exception ex )
+ {
+ Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ }
+ return null;
+ }
+
+ private XComponent loadReportFromDocumentDefinition()
+ {
+ final XCommandProcessor commandProcessor = UnoRuntime.queryInterface(XCommandProcessor.class, m_documentDefinition);
+
+ com.sun.star.ucb.Command aCommand = new com.sun.star.ucb.Command();
+ aCommand.Name = "open";
+ try
+ {
+ final Object result = commandProcessor.execute( aCommand, commandProcessor.createCommandIdentifier(), null );
+ return UnoRuntime.queryInterface( XComponent.class, result );
+ }
+ catch ( Exception ex )
+ {
+ Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ }
+ return null;
+ }
+
+ public void createAndOpenReportDocument( String i_name, boolean i_asTemplate, boolean i_openForEditing )
+ {
+ if ( i_openForEditing )
+ {
+ // we won't destroy the report builder window, also don't create a document
+ // Do we need to reopen the report builder with the known name?
+ switchOnAddFieldWindow();
+ switchOnPropertyBrowser();
+ return;
+ }
+
+ if ( i_asTemplate )
+ {
+ // don't need the report definition anymore - the document it represents has already been stored
+ closeReportDefinition();
+
+ // open the report, again, this time not in design, but containing data
+ loadReport( i_name );
+ }
+ else
+ {
+ // execute the report from the (yet unsaved) report definition
+ XComponent document = loadReportFromDocumentDefinition();
+
+ // don't need the report definition anymore
+ closeReportDefinition();
+
+ // store the generated report
+ if ( getRecordParser().storeDatabaseDocumentToTempPath( document, i_name ) )
+ getRecordParser().addReportDocument( document, false );
+ }
+
+ dispose();
+ }
+
+ private XConnection getConnection()
+ {
+ return getRecordParser().DBConnection;
+ }
+
+ public void initializeFieldColumns(final int _nType, final String TableName, final String[] FieldNames)
+ {
+ getRecordParser().initializeFieldColumns(FieldNames, TableName);
+
+ 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++)
+ {
+ FieldTypes[i] = a.FieldColumns[i].getFieldType();
+ FieldWidths[i] = a.FieldColumns[i].getFieldWidth();
+ }
+ getReportBuilderLayouter().setTableName(_nType, TableName);
+ getReportBuilderLayouter().insertFieldNames(FieldNames);
+ getReportBuilderLayouter().insertFieldTypes(FieldTypes);
+ getReportBuilderLayouter().insertFieldWidths(FieldWidths);
+
+ getReportBuilderLayouter().layout();
+ }
+
+ public void setFieldTitles(String[] _aFieldTitles)
+ {
+ getRecordParser().setFieldTitles(_aFieldTitles);
+
+ getReportBuilderLayouter().insertFieldTitles(_aFieldTitles);
+ getReportBuilderLayouter().layout();
+ }
+
+ public void setSorting(String[][] _aSortFieldNames)
+ {
+ getRecordParser().setSortFieldNames(_aSortFieldNames);
+ }
+
+ public void setGrouping(String[] _aGroupFieldNames)
+ {
+ getRecordParser().prependSortFieldNames(_aGroupFieldNames);
+
+ getReportBuilderLayouter().insertGroupNames(_aGroupFieldNames);
+ getReportBuilderLayouter().layout();
+ }
+
+ public String getLayoutPath()
+ {
+ return "default";
+ }
+ private ArrayList m_aReportPath;
+
+ public ArrayList getReportPath()
+ {
+ if (m_aReportPath == null)
+ {
+ try
+ {
+ // Check general availability of office paths
+ m_aReportPath = FileAccess.getOfficePaths( getMSF(), "Template", "share", "/wizard" );
+ FileAccess.combinePaths( getMSF(), m_aReportPath, "/wizard/report" );
+ }
+ catch ( NoValidPathException ex )
+ {
+ Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ }
+ }
+ return m_aReportPath;
+ }
+
+ public String getContentPath()
+ {
+ return "";
+ }
+
+ public int getDefaultPageOrientation()
+ {
+ return m_nDefaultPageOrientation;
+ }
+
+ /**
+ * Helper function to get a com.sun.star.wizards.report.layout.ReportBuilderLayouter by it's name
+ *
+ * @param _sClassName
+ * @return the object or null
+ */
+ private IReportBuilderLayouter getLayoutInstanceFrom(String _sClassName)
+ {
+ try
+ {
+ // TODO: Use Package.getPackages(...)
+ final Class a = Class.forName(_sClassName);
+
+ final Constructor cTor = a.getConstructor(new Class[]
+ {
+ IReportDefinitionReadAccess.class, Resource.class
+ });
+ Object[] aParams = new Object[2];
+ aParams[0] = this;
+ aParams[1] = m_resource;
+ final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) cTor.newInstance(aParams);
+ return aReportBuilderLayouter;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ private LinkedHashMap m_aLayoutMap = null;
+
+ private void insertIntoLayoutMap(IReportBuilderLayouter _aLayout)
+ {
+ insertIntoLayoutMap(_aLayout, false);
+ }
+
+ private void insertIntoLayoutMap(IReportBuilderLayouter _aLayout, boolean _bDefault)
+ {
+ if (_aLayout != null)
+ {
+ final String sName = _aLayout.getName();
+ if (_bDefault)
+ {
+ m_sReportBuilderLayoutName = sName; // here we set the default layout name!
+ }
+ m_aLayoutMap.put(sName, _aLayout);
+ }
+ }
+
+ /**
+ * Initialize all well known com.sun.star.wizards.report.layout.ReportBuilderLayouter Objects and create exact one instance.
+ */
+ private LinkedHashMap getLayoutMap()
+ {
+ if (m_aLayoutMap == null)
+ {
+ // The LayoutMap is empty, so we create a new LinkedHashMap
+ m_aLayoutMap = new LinkedHashMap();
+
+ // TODO: We must know the name of a layouts, There should be a way to say where to find, not the names.
+ IReportBuilderLayouter aLayout = getLayoutInstanceFrom("com.sun.star.wizards.reportbuilder.layout.Tabular");
+ insertIntoLayoutMap(aLayout, true);
+ aLayout = getLayoutInstanceFrom("com.sun.star.wizards.reportbuilder.layout.ColumnarSingleColumn");
+ insertIntoLayoutMap(aLayout);
+ aLayout = getLayoutInstanceFrom("com.sun.star.wizards.reportbuilder.layout.ColumnarTwoColumns");
+ insertIntoLayoutMap(aLayout);
+ aLayout = getLayoutInstanceFrom("com.sun.star.wizards.reportbuilder.layout.ColumnarThreeColumns");
+ insertIntoLayoutMap(aLayout);
+ aLayout = getLayoutInstanceFrom("com.sun.star.wizards.reportbuilder.layout.InBlocksLabelsAbove");
+ insertIntoLayoutMap(aLayout);
+ aLayout = getLayoutInstanceFrom("com.sun.star.wizards.reportbuilder.layout.InBlocksLabelsLeft");
+ insertIntoLayoutMap(aLayout);
+
+ }
+ return m_aLayoutMap;
+ }
+
+ /**
+ * 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()];
+
+ // run through the whole layoutmap and
+ final Set aKeys = getLayoutMap().keySet();
+ final Iterator aKeyIterator = aKeys.iterator();
+ int i = 0;
+ while (aKeyIterator.hasNext())
+ {
+ final String sKey = (String) aKeyIterator.next();
+ a[i] = sKey;
+ final IReportBuilderLayouter aLayouter = (IReportBuilderLayouter) m_aLayoutMap.get(sKey);
+ b[i++] = aLayouter.getLocalizedName();
+ }
+
+ ContentFiles[1] = a;
+ 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");
+ FileAccess.combinePaths(getMSF(), aReportPath, "/wizard/report");
+
+ LayoutFiles = FileAccess.getFolderTitles(getMSF(), null, aReportPath, ".otr");
+ }
+ catch (com.sun.star.wizards.common.NoValidPathException e)
+ {
+ // if there are problems, don't show anything is a little bit hard.
+ LayoutFiles = new String[2][];
+ String[] a = new String[1];
+ String[] b = new String[1];
+ a[0] = "DefaultLayoutOfHeaders";
+ b[0] = "default";
+ LayoutFiles[1] = a;
+ LayoutFiles[0] = b;
+ }
+ for (int i = 0; i < LayoutFiles[0].length; i++)
+ {
+ if (LayoutFiles[0][i].equals("default"))
+ {
+ m_sDefaultHeaderLayoutPath = LayoutFiles[1][i];
+ break;
+ }
+ }
+ return LayoutFiles;
+ }
+
+ public XReportDefinition getReportDefinition()
+ {
+ if (m_reportDocument == null)
+ {
+ throw new NullPointerException("Report Definition is not already initialized, check if you too early access the report definition.");
+ }
+ return m_reportDocument;
+ }
+
+ public XMultiServiceFactory getGlobalMSF()
+ {
+ return getMSF();
+ }
+
+ public void importReportData(ReportWizard aWizard)
+ {
+ }
+
+ public String getDefaultHeaderLayout()
+ {
+ return m_sDefaultHeaderLayoutPath;
+ }
+
+ public void setCommand(String _sCommand)
+ {
+ getRecordParser().Command = _sCommand;
+ getReportDefinition().setCommand(_sCommand);
+ }
+
+ public void setCommandType(int _nCommand)
+ {
+ getReportDefinition().setCommandType(_nCommand);
+ }
+
+
+ public void checkInvariants() throws java.lang.Exception
+ {
+ final String sDefaultHeaderLayoutPath = getDefaultHeaderLayout();
+ if (sDefaultHeaderLayoutPath == null)
+ {
+ throw new java.io.IOException("default.otr");
+ }
+
+ FileAccess aAccess = new FileAccess(getGlobalMSF());
+ if (! aAccess.exists(sDefaultHeaderLayoutPath, true))
+ {
+ throw new java.io.IOException("default.otr");
+ }
+ }
+
+}
+
+
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
new file mode 100644
index 000000000000..ccb74ebf6f07
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
@@ -0,0 +1,105 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XSection;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.report.IReportDefinitionReadAccess;
+import com.sun.star.wizards.ui.UIConsts;
+
+/**
+ *
+ * @author ll93751
+ */
+public class ColumnarSingleColumn extends ReportBuilderLayouter
+{
+
+ public ColumnarSingleColumn(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
+ {
+ super(_xDefinitionAccess, _aResource);
+ }
+
+ public String getName()
+ {
+ return "ColumnarSingleColumnLayoutOfData";
+ }
+
+ public String getLocalizedName()
+ {
+ final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 81);
+ return sLocalizedName;
+ }
+
+ protected void insertDetailFields()
+ {
+ copyDetailProperties();
+
+ final String[] aFieldTitleNames = getFieldTitleNames();
+ if (aFieldTitleNames == null)
+ {
+ return;
+ }
+ final String[] aFieldNames = getFieldNames();
+ if (aFieldNames == null)
+ {
+ return;
+ }
+// int nGroups = getReportDefinition().getGroups().getCount();
+
+ final XSection xSection = getReportDefinition().getDetail();
+
+ Rectangle aRect = new Rectangle();
+
+ final int nLabelWidth = getMaxLabelWidth();
+ final SectionObject aSOLabel = getDesignTemplate().getDetailLabel();
+ aSOLabel.setFontToBold();
+ final SectionObject aSOTextField = getDesignTemplate().getDetailTextField();
+
+ final int nWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups()) - nLabelWidth;
+
+ for (int i = 0; i < aFieldNames.length; i++)
+ {
+ aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+ final String sLabel = aFieldTitleNames[i];
+ aRect = insertLabel(xSection, sLabel, aRect, nLabelWidth, aSOLabel);
+ final String sFieldName = convertToFieldName(aFieldNames[i]);
+ aRect = insertFormattedField(xSection, sFieldName, aRect, nWidth, aSOTextField);
+ int nHeight = aRect.Height;
+ aRect.Y += Math.max(aSOLabel.getHeight(LayoutConstants.LabelHeight), nHeight);
+ }
+ aRect.Y += aSOLabel.getHeight(LayoutConstants.EmptyLineHeight); // one empty line
+ 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
new file mode 100644
index 000000000000..2dc468fb09e7
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
@@ -0,0 +1,62 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.report.IReportDefinitionReadAccess;
+import com.sun.star.wizards.ui.*;
+
+/**
+ *
+ * @author ll93751
+ */
+public class ColumnarThreeColumns extends ColumnarTwoColumns
+{
+
+ public ColumnarThreeColumns(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
+ {
+ super(_xDefinitionAccess, _aResource);
+ }
+
+ public String getName()
+ {
+ return "ColumnarThreeColumnsLayoutOfData";
+ }
+
+ public String getLocalizedName()
+ {
+ final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 83);
+ return sLocalizedName;
+ }
+
+ protected void insertDetailFields()
+ {
+ insertDetailFields(3);
+ }
+}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
new file mode 100644
index 000000000000..d79713524021
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
@@ -0,0 +1,137 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XSection;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.report.IReportDefinitionReadAccess;
+import com.sun.star.wizards.ui.UIConsts;
+
+/**
+ *
+ * @author ll93751
+ */
+public class ColumnarTwoColumns extends ReportBuilderLayouter
+{
+
+ public ColumnarTwoColumns(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
+ {
+ super(_xDefinitionAccess, _aResource);
+ }
+
+ public String getName()
+ {
+ return "ColumnarTwoColumnsLayoutOfData";
+ }
+
+ public String getLocalizedName()
+ {
+ final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 82);
+ return sLocalizedName;
+ }
+
+ protected void insertDetailFields()
+ {
+ insertDetailFields(2);
+ }
+
+ protected void insertDetailFields(int _nColumns)
+ {
+ copyDetailProperties();
+
+ if (_nColumns < 1)
+ {
+ return;
+ }
+ final String[] aFieldTitleNames = getFieldTitleNames();
+ if (aFieldTitleNames == null)
+ {
+ return;
+ }
+ final String[] aFieldNames = getFieldNames();
+ if (aFieldNames == null)
+ {
+ return;
+ }
+// int nGroups = getReportDefinition().getGroups().getCount();
+
+ final XSection xSection = getReportDefinition().getDetail();
+
+ Rectangle aRect = new Rectangle();
+
+ final int nLabelWidth = getMaxLabelWidth(); // 3000;
+
+ final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups());
+ int i = 0;
+ int nRows = aFieldNames.length / _nColumns;
+ if ((aFieldNames.length % _nColumns) != 0)
+ {
+ ++nRows;
+ }
+ final int nWidth = (nUsablePageWidth - nLabelWidth * _nColumns) / _nColumns;
+ if (nWidth < 0)
+ {
+ // TODO: error message in logging
+ return;
+ }
+
+ final SectionObject aSOLabel = getDesignTemplate().getDetailLabel();
+ aSOLabel.setFontToBold();
+ final SectionObject aSOTextField = getDesignTemplate().getDetailTextField();
+ int nMaxHeight = 0;
+ for (int x = 0; x < _nColumns; x++)
+ {
+ aRect.Y = 0;
+ for (int y = 0; y < nRows; y++)
+ {
+ aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups()) + x * (nWidth + nLabelWidth);
+ if (i < aFieldNames.length)
+ {
+ final String sLabel = aFieldTitleNames[i];
+ aRect = insertLabel(xSection, sLabel, aRect, nLabelWidth, aSOLabel);
+ final String sFieldName = convertToFieldName(aFieldNames[i]);
+ aRect = insertFormattedField(xSection, sFieldName, aRect, nWidth, aSOTextField);
+
+ aRect.Y += Math.max(aSOLabel.getHeight(LayoutConstants.LabelHeight), aRect.Height);
+ ++i;
+ }
+ }
+ nMaxHeight = Math.max(aRect.Y, nMaxHeight);
+ }
+ aRect.Y = Math.max(aSOLabel.getHeight(LayoutConstants.LabelHeight) * nRows, nMaxHeight);
+ aRect.Y += aSOLabel.getHeight(LayoutConstants.EmptyLineHeight); // one empty line
+ 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
new file mode 100644
index 000000000000..55fdafe6c79a
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
@@ -0,0 +1,333 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.beans.PropertyValue;
+// import com.sun.star.container.NoSuchElementException;
+// import com.sun.star.lang.IndexOutOfBoundsException;
+// import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.report.XFixedText;
+import com.sun.star.report.XFormattedField;
+import com.sun.star.report.XGroup;
+import com.sun.star.report.XGroups;
+import com.sun.star.report.XReportDefinition;
+import com.sun.star.report.XSection;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Properties;
+
+/**
+ *
+ * @author ll93751
+ */
+public class DesignTemplate
+{
+
+ private XReportDefinition m_xReportDefinition;
+ XMultiServiceFactory m_xGlobalMSF;
+ String m_sFilename;
+
+ private DesignTemplate()
+ {
+ }
+ // -------------------------------------------------------------------------
+ // All functions from XReportDefinition, we use
+ // -------------------------------------------------------------------------
+ XGroups getGroups()
+ {
+ 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;
+ private SectionObject[] m_aGroupTextField;
+
+ SectionObject getDetailLabel()
+ {
+ if (m_aDetailLabel == null)
+ {
+ return SectionEmptyObject.create();
+ }
+ return m_aDetailLabel;
+ }
+
+ SectionObject getDetailTextField()
+ {
+ if (m_aDetailTextField == null)
+ {
+ return SectionEmptyObject.create();
+ }
+ return m_aDetailTextField;
+ }
+
+ SectionObject getGroupTextField(int _nGroup)
+ {
+ return getGroupSectionObject(m_aGroupTextField, _nGroup);
+ }
+
+ SectionObject getGroupLabel(int _nGroup)
+ {
+ return getGroupSectionObject(m_aGroupLabel, _nGroup);
+ }
+
+ private SectionObject getGroupSectionObject(SectionObject _aGroupList[], int _nGroup)
+ {
+ SectionObject a = null;
+ if (_nGroup < _aGroupList.length)
+ {
+ a = _aGroupList[_nGroup];
+ }
+ else
+ {
+ // if there are not enough groups, the last one will win
+ if (_aGroupList.length > 0)
+ {
+ a = _aGroupList[_aGroupList.length - 1];
+ }
+ }
+ // we show if the group is null
+ if (a == null)
+ {
+ a = SectionEmptyObject.create();
+ // a empty group has to use bold font
+ a.setPropertyValue("CharWeight", new Float(com.sun.star.awt.FontWeight.BOLD));
+ }
+ return a;
+ }
+
+ // we analyse the loaded ReportDefinition, we want to know the FontDescriptor of all XSections
+ private void analyseReportDefinition()
+ {
+ final XSection xDetailSection = m_xReportDefinition.getDetail();
+ final int nDetailCount = xDetailSection.getCount();
+ for (int i = 0; i < nDetailCount; i++)
+ {
+ try
+ {
+ Object aObj = xDetailSection.getByIndex(i);
+ // is aObj a label
+ // is aObj a textfield
+ // m_aDetailLabel_FD
+ // m_aDetailTextField_FD
+ XFixedText aFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aObj);
+ if (aFixedText != null &&
+ m_aDetailLabel == null)
+ {
+ m_aDetailLabel = SectionLabel.create(aFixedText);
+ }
+ else
+ {
+ XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj);
+ if (aFormattedField != null &&
+ m_aDetailTextField == null)
+ {
+ m_aDetailTextField = SectionTextField.create(aFormattedField);
+ }
+ }
+ int dummy = 0;
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException ex)
+ {
+ }
+ catch (com.sun.star.lang.WrappedTargetException ex)
+ {
+ }
+ }
+
+ final XGroups xGroups = m_xReportDefinition.getGroups();
+ final int nGroupCount = xGroups.getCount();
+ // create a m_aGroupLabel_FD[]
+ // create a m_aGroupTextField_FD[]
+ m_aGroupLabel = new SectionObject[nGroupCount];
+ m_aGroupTextField = new SectionObject[nGroupCount];
+
+ for (int nGroup = 0; nGroup < nGroupCount; nGroup++)
+ {
+ try
+ {
+ Object aGroup = xGroups.getByIndex(nGroup);
+ XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup);
+ XSection xGroupSection = xGroup.getHeader();
+
+ final int nCount = xGroupSection.getCount();
+ for (int i = 0; i < nCount; i++)
+ {
+ try
+ {
+ Object aObj = xGroupSection.getByIndex(i);
+ 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] = SectionLabel.create(aFixedText);
+ }
+ else
+ {
+ XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj);
+ if (aFormattedField != null &&
+ m_aGroupTextField[nGroup] == null)
+ {
+ m_aGroupTextField[nGroup] = SectionTextField.create(aFormattedField);
+ }
+ }
+ int dummy = 0;
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException ex)
+ {
+ }
+ catch (com.sun.star.lang.WrappedTargetException ex)
+ {
+ }
+ }
+ }
+ catch (com.sun.star.container.NoSuchElementException ex)
+ {
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException ex)
+ {
+ }
+ catch (com.sun.star.lang.WrappedTargetException ex)
+ {
+ }
+ }
+ }
+
+ /**
+ * close our current ReportDefinition
+ */
+ void close()
+ {
+ try
+ {
+ m_xReportDefinition.close(true);
+ }
+ catch (com.sun.star.util.CloseVetoException e)
+ {
+ }
+ }
+
+ /**
+ * create a new DesignTemplate by try to load a otr file from the given path.
+ * Internally we store the loaded ReportDefinition.
+ *
+ * @param _xMSF
+ * @param _sPath
+ * @return
+ */
+ public static DesignTemplate create(XMultiServiceFactory _xMSF, String _sPath)
+ {
+ DesignTemplate a = new DesignTemplate();
+ try
+ {
+ a.load(_xMSF, _sPath);
+ }
+ catch (com.sun.star.lang.WrappedTargetRuntimeException e)
+ {
+ // this should not happen
+ a = null;
+ throw new java.lang.RuntimeException(e.getMessage());
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ a = null;
+ }
+ catch (Exception e)
+ {
+ a = null;
+ }
+ return a;
+ }
+
+ private void load(XMultiServiceFactory _xMSF, String _sPath) throws com.sun.star.uno.Exception
+ {
+ m_xGlobalMSF = _xMSF;
+ m_sFilename = _sPath;
+ final Object aObj = _xMSF.createInstance("com.sun.star.report.ReportDefinition");
+ m_xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj);
+
+ PropertyValue[] aLoadProps = new PropertyValue[2];
+ aLoadProps[0] = Properties.createProperty("URL", _sPath);
+ aLoadProps[1] = Properties.createProperty("ReadOnly", Boolean.TRUE);
+
+ m_xReportDefinition.load(aLoadProps);
+ analyseReportDefinition();
+ }
+
+ public XReportDefinition getReportDefinition()
+ {
+ return m_xReportDefinition;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
new file mode 100644
index 000000000000..9fd891a446f2
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
@@ -0,0 +1,166 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XSection;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.report.IReportDefinitionReadAccess;
+import com.sun.star.wizards.ui.*;
+
+/**
+ *
+ * @author ll93751
+ */
+public class InBlocksLabelsAbove extends ColumnarTwoColumns
+{
+
+ public InBlocksLabelsAbove(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
+ {
+ super(_xDefinitionAccess, _aResource);
+ }
+
+ public String getName()
+ {
+ return "InBlocksLabelsAboveLayoutOfData";
+ }
+
+ public String getLocalizedName()
+ {
+ final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 85);
+ return sLocalizedName;
+ }
+
+ protected void insertDetailFields()
+ {
+ copyDetailProperties();
+
+ final String[] aFieldTitleNames = getFieldTitleNames();
+ if (aFieldTitleNames == null)
+ {
+ return;
+ }
+ final String[] aFieldNames = getFieldNames();
+ if (aFieldNames == null)
+ {
+ return;
+ }
+// int nGroups = getReportDefinition().getGroups().getCount();
+
+ final XSection xSection = getReportDefinition().getDetail();
+
+ Rectangle aRectLabels = new Rectangle();
+ Rectangle aRectFields = new Rectangle();
+
+
+ final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups());
+
+ int i = 0;
+ int nCount = aFieldTitleNames.length;
+ // int x = 0;
+ aRectLabels.Y = 0;
+ aRectLabels.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+
+ aRectFields.Y = LayoutConstants.LabelHeight;
+ aRectFields.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+
+ // first run only calculates the width.
+ int nDelta = 0;
+ int nFieldWidth = 3000;
+ while (nCount > 0)
+ {
+ // String sLabel = aFieldTitleNames[i];
+ // int nLabelWidth = 3000;
+ // String sFieldName = convertToFieldName(aFieldNames[i]);
+ aRectFields.X += nFieldWidth;
+ // aRectLabels.X += nFieldWidth;
+
+ final int nNextX = aRectFields.X + nFieldWidth;
+ if (nNextX > (getPageWidth() - getRightPageIndent()))
+ {
+ // all other values are not from interest.
+ break;
+ }
+
+ ++i;
+ --nCount;
+ }
+ final int nDeltaTotal = nUsablePageWidth - i * nFieldWidth;
+ nDelta = nDeltaTotal;
+ if (i > 0)
+ {
+ nDelta = nDeltaTotal / i;
+ }
+
+ aRectLabels.Y = 0;
+ aRectLabels.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+
+ final SectionObject aSOLabel = getDesignTemplate().getDetailLabel();
+ aSOLabel.setFontToBold();
+ final SectionObject aSOTextField = getDesignTemplate().getDetailTextField();
+
+ aRectFields.Y = aSOLabel.getHeight(LayoutConstants.LabelHeight);
+ aRectFields.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+ i = 0;
+ nCount = aFieldTitleNames.length;
+ int nLastHeight = 0;
+ while (nCount > 0)
+ {
+ final String sLabel = aFieldTitleNames[i];
+ final int nLabelWidth = 3000 + nDelta;
+ aRectLabels = insertLabel(xSection, sLabel, aRectLabels, nLabelWidth, aSOLabel);
+ final String sFieldName = convertToFieldName(aFieldNames[i]);
+ nFieldWidth = 3000 + nDelta;
+ aRectFields = insertFormattedField(xSection, sFieldName, aRectFields, nFieldWidth, aSOTextField);
+ nLastHeight = Math.max(nLastHeight, aRectFields.Height);
+ int nNextX = aRectFields.X + nFieldWidth;
+ if (nNextX > (getPageWidth() - getRightPageIndent()) & nCount > 1)
+ {
+ int nHeight = (aSOLabel.getHeight(LayoutConstants.LabelHeight) + Math.max(aSOTextField.getHeight(LayoutConstants.FormattedFieldHeight), nLastHeight));
+ nLastHeight = 0;
+ aRectLabels.Y += nHeight; // 2 * label height
+ aRectLabels.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+
+ aRectFields.Y += nHeight;
+ aRectFields.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+ }
+ ++i;
+ --nCount;
+ }
+ aRectFields.Y += Math.max(aSOTextField.getHeight(LayoutConstants.FormattedFieldHeight), nLastHeight);
+ aRectFields.Y += aSOTextField.getHeight(LayoutConstants.EmptyLineHeight); // one empty line
+ 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
new file mode 100644
index 000000000000..c03cf7cec909
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
@@ -0,0 +1,133 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XSection;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.report.IReportDefinitionReadAccess;
+import com.sun.star.wizards.ui.*;
+
+/**
+ *
+ * @author ll93751
+ */
+public class InBlocksLabelsLeft extends ColumnarTwoColumns
+{
+
+ public InBlocksLabelsLeft(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
+ {
+ super(_xDefinitionAccess, _aResource);
+ }
+
+ public String getName()
+ {
+ return "InBlocksLabelsLeftLayoutOfData";
+ }
+
+ public String getLocalizedName()
+ {
+ final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 84);
+ return sLocalizedName;
+ }
+
+ protected void insertDetailFields()
+ {
+ copyDetailProperties();
+
+ final String[] aFieldTitleNames = getFieldTitleNames();
+ if (aFieldTitleNames == null)
+ {
+ return;
+ }
+ final String[] aFieldNames = getFieldNames();
+ if (aFieldNames == null)
+ {
+ return;
+ }
+// int nGroups = getReportDefinition().getGroups().getCount();
+
+ final XSection xSection = getReportDefinition().getDetail();
+
+ Rectangle aRectLabelFields = new Rectangle();
+
+ final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups());
+
+ final int nLabelWidth = getMaxLabelWidth(); // 3000;
+ int nFieldWidth = 3000;
+
+ final int nFactor = nUsablePageWidth / (nLabelWidth + nFieldWidth);
+ int nDeltaTotal = 0;
+ int nDelta = 0;
+ if (nFactor > 0)
+ {
+ nDeltaTotal = nUsablePageWidth - (nFactor * (nLabelWidth + nFieldWidth));
+ nDelta = nDeltaTotal / nFactor;
+ }
+
+ int i = 0;
+ int nCount = aFieldTitleNames.length;
+ // int x = 0;
+ aRectLabelFields.Y = 0;
+ aRectLabelFields.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+
+ SectionObject aSOLabel = getDesignTemplate().getDetailLabel();
+ aSOLabel.setFontToBold();
+ SectionObject aSOTextField = getDesignTemplate().getDetailTextField();
+ int nLastHeight = 0;
+ while (nCount > 0)
+ {
+ final String sLabel = aFieldTitleNames[i];
+// nLabelWidth = 3000;
+ aRectLabelFields = insertLabel(xSection, sLabel, aRectLabelFields, nLabelWidth, aSOLabel);
+ final String sFieldName = convertToFieldName(aFieldNames[i]);
+ nFieldWidth = 3000 + nDelta;
+ aRectLabelFields = insertFormattedField(xSection, sFieldName, aRectLabelFields, nFieldWidth, aSOTextField);
+ nLastHeight = Math.max(aRectLabelFields.Height, nLastHeight);
+ final int nNextX = aRectLabelFields.X + nLabelWidth + nFieldWidth;
+ if (nNextX > (getPageWidth() - getRightPageIndent()))
+ {
+ // TODO: label height is fix
+ aRectLabelFields.Y += Math.max(aSOTextField.getHeight(LayoutConstants.FormattedFieldHeight), nLastHeight);
+ nLastHeight = 0;
+ aRectLabelFields.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+ }
+ ++i;
+ --nCount;
+ }
+ aRectLabelFields.Y += Math.max(aSOLabel.getHeight(LayoutConstants.EmptyLineHeight), nLastHeight); // one empty line
+ 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/LayoutConstants.java b/wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java
new file mode 100644
index 000000000000..c31ce4b5f277
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/LayoutConstants.java
@@ -0,0 +1,52 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+/**
+ *
+ * @author ll93751
+ */
+public class LayoutConstants
+{
+ public static final int LabelHeight = 500;
+ public static final int FormattedFieldHeight = 500;
+ public static final int EmptyLineHeight = 500;
+
+ public static final int BinaryHeight = 4000;
+ public static final int MemoFieldHeight = 4000;
+
+ public static final int LineHeight = 250;
+
+ /**
+ * Groups will indent
+ * This is the factor (5mm) which will multiply with the current indent
+ */
+ public static final int IndentFactorWidth = 500;
+}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
new file mode 100644
index 000000000000..a10affa9ea2c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
@@ -0,0 +1,1693 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.awt.FontDescriptor;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XLayoutConstrains;
+import com.sun.star.awt.XUnitConversion;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.report.XFixedLine;
+import com.sun.star.report.XFixedText;
+import com.sun.star.report.XFormattedField;
+import com.sun.star.report.XGroup;
+import com.sun.star.report.XGroups;
+import com.sun.star.report.XImageControl;
+import com.sun.star.report.XReportComponent;
+import com.sun.star.report.XReportControlModel;
+import com.sun.star.report.XReportDefinition;
+import com.sun.star.report.XSection;
+import com.sun.star.drawing.XShape;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.style.XStyle;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XNumberFormatTypes;
+import com.sun.star.util.XNumberFormats;
+import com.sun.star.util.XNumberFormatsSupplier;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.PropertySetHelper;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.report.IReportBuilderLayouter;
+import com.sun.star.wizards.report.IReportDefinitionReadAccess;
+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: 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;
+
+ /**
+ * dispose the ReportBuilderLayouter
+ */
+ public void dispose()
+ {
+ closeDesignTemplate();
+ m_xReportDefinitionReadAccess = null;
+ // m_xReportBuilderLayouter = null;
+ }
+
+ /**
+ * The Constructor is protected, this is a abstract class, use Tabular or other to create an instance.
+ * @param _xDefinitionAccess
+ * @param _aResource
+ */
+ protected ReportBuilderLayouter(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
+ {
+ m_xReportDefinitionReadAccess = _xDefinitionAccess;
+ m_aResource = _aResource;
+ }
+
+ /**
+ * Access to the current ReportDefinition
+ * @return the ReportDefinition
+ */
+ public XReportDefinition getReportDefinition()
+ {
+ // we have to ask our parent for this value
+ return m_xReportDefinitionReadAccess.getReportDefinition();
+ }
+
+ /**
+ * Access to the global MultiServiceFactory
+ * @return the global Service Factory
+ */
+ private XMultiServiceFactory getGlobalMSF()
+ {
+ return m_xReportDefinitionReadAccess.getGlobalMSF();
+ }
+
+ /**
+ * Layout the complete report new, by all information we know until this time.
+ *
+ * If there are some information less, it is no problem for this function, they will be leaved out.
+ * It is possible to call this function after every change, but be careful, could take a little bit longer.
+ */
+ public synchronized void layout()
+ {
+ try
+ {
+ // we bring the clear and insert methods together, this should be a little bit smoother
+ clearReportHeader();
+ insertReportHeader();
+
+ clearReportFooter();
+ insertReportFooter();
+
+ clearPageHeader();
+ insertPageHeader();
+
+ clearPageFooter();
+ insertPageFooter();
+
+ clearGroups();
+ insertGroups();
+
+ clearDetails();
+ // clearFieldTitles();
+ insertDetailFieldTitles();
+ insertDetailFields();
+ }
+ catch (java.lang.ArrayIndexOutOfBoundsException e)
+ {
+ // could happen, if you change the count of values
+ }
+ catch (java.lang.RuntimeException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ // Exception not set. Not from interest here.
+ int dummy = 0;
+ }
+ }
+ // -------------------------------------------------------------------------
+ /**
+ * Remove all Groups
+ */
+ protected void clearGroups()
+ {
+ final XGroups xGroups = getReportDefinition().getGroups();
+// int nCount = xGroups.getCount();
+ while (xGroups.hasElements())
+ {
+ try
+ {
+ xGroups.removeByIndex(0);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // Exception not set. Not from interest here.
+ }
+ }
+ }
+ // -------------------------------------------------------------------------
+ /**
+ * Remove all fields
+ * @param _xSectionToClear
+ */
+ private void emptySection(XSection _xSectionToClear)
+ {
+ if (_xSectionToClear == null)
+ {
+ return;
+ }
+ // int nCount = _xSectionToClear.getCount();
+ while (_xSectionToClear.hasElements())
+ {
+ try
+ {
+ final Object aObj = _xSectionToClear.getByIndex(0);
+ final XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aObj);
+ _xSectionToClear.remove(aShape);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // Exception not set.
+ int dummy = 0;
+ }
+
+ }
+ }
+
+ private void clearDetails()
+ {
+ final XSection xSection = getReportDefinition().getDetail();
+ emptySection(xSection);
+ }
+// public void clearFieldTitles()
+// {
+// }
+ /**
+ *
+ * @param _nGroupCount
+ * @return the left indent in 1/100mm
+ */
+ protected int getLeftGroupIndent(int _nGroupCount)
+ {
+// TODO: Fix values for group indent (1/2cm) only the first 2 groups
+ int nIndent = 0;
+ final int MAX_INDENT = 2;
+ if (_nGroupCount <= MAX_INDENT)
+ {
+ nIndent = _nGroupCount * LayoutConstants.IndentFactorWidth;
+ }
+ else
+ {
+ nIndent = MAX_INDENT * LayoutConstants.IndentFactorWidth;
+ }
+ return nIndent;
+ }
+ /**
+ * Get left page indent.
+ * The left indent is the area on the left side which will no be printed.
+ * The default is 2000 1/100mm what is 2cm of DIN A4.
+ * @return the left indent in 1/100mm
+ */
+ int m_nLeftIndent = -1;
+
+ protected int getLeftPageIndent()
+ {
+ if (m_nLeftIndent < 0)
+ {
+ m_nLeftIndent = getFromPageStyles("LeftMargin", 2000);
+ }
+ return m_nLeftIndent;
+ }
+ /**
+ * Get right page indent.
+ * The right indent is the area on the right side which will no be printed.
+ * The default is 2000 1/100mm what is 2cm of DIN A4.
+ * @return the right indent in 1/100mm
+ */
+ int m_nRightIndent = -1;
+
+ protected int getRightPageIndent()
+ {
+ if (m_nRightIndent < 0)
+ {
+ m_nRightIndent = getFromPageStyles("RightMargin", 2000);
+ }
+ return m_nRightIndent;
+ }
+
+ private XStyle getUsedStyle(String _sStyleName)
+ {
+ XStyle aUsedStyle = null;
+ final XNameAccess xNameAccess = getReportDefinition().getStyleFamilies();
+ try
+ {
+ // <Analysecode>
+ // String[] aNames = xNameAccess.getElementNames();
+ // </Analysecode>
+
+ // get all Page Styles
+ final Object aPageStylesObj = xNameAccess.getByName(_sStyleName);
+ 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();
+ for (int i = 0; i < aElementNames.length; i++)
+ {
+ final String sName = aElementNames[i];
+ final Object aObj = xContainer.getByName(sName);
+ final XStyle xStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, aObj);
+ if (xStyle.isInUse())
+ {
+ aUsedStyle = xStyle;
+ break;
+ }
+ }
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // TODO: Exception not set.
+ e.printStackTrace();
+ }
+ return aUsedStyle;
+ }
+
+ protected int getFromPageStyles(String _sStyleName, int _nDefault)
+ {
+ int nValue = _nDefault;
+ final XStyle xStyle = getUsedStyle("PageStyles");
+ if (xStyle != null)
+ {
+ // we found the page style which is in use
+ final PropertySetHelper aHelper = new PropertySetHelper(xStyle);
+ nValue = aHelper.getPropertyValueAsInteger(_sStyleName, nValue);
+ }
+ return nValue;
+ }
+
+ protected void setToPageStyles(String _sStyleName, Object _aObj)
+ {
+ final XStyle xStyle = getUsedStyle("PageStyles");
+ if (xStyle != null)
+ {
+ final PropertySetHelper aHelper = new PropertySetHelper(xStyle);
+ 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)
+ {
+ m_nPageWidth = getFromPageStyles("Width", 21000);
+ }
+ return m_nPageWidth;
+ }
+ // -------------------------------------------------------------------------
+ /**
+ * Stores the Group names. To insert/create a report with such group names, call layout()
+ * @param _aGroupNames
+ */
+ public void insertGroupNames(String[] _aGroupNames)
+ {
+ m_aGroupNames = _aGroupNames;
+ }
+
+ protected void copyGroupProperties(int _nGroup)
+ {
+ 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);
+ 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);
+ XSection xGroupSection = xGroup.getHeader();
+
+ // copy Properties
+ copyProperties(xForeignGroupSection, xGroupSection);
+ }
+ }
+ catch (Exception e)
+ {
+ int dummy = 0;
+ }
+ }
+ }
+ // -------------------------------------------------------------------------
+ protected void insertGroups()
+ {
+ if (m_aGroupNames == null)
+ {
+ return;
+ }
+
+ final XGroups xGroups = getReportDefinition().getGroups();
+ final int nLeftPageIndent = getLeftPageIndent();
+ final int nLabelWidth = getMaxLabelWidth(); // 3000;
+ final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups());
+ final int nFieldWidth = nUsablePageWidth - nLabelWidth;
+
+ // 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++)
+ {
+ 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);
+
+ 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);
+
+ Rectangle aRect = new Rectangle();
+ aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
+ SectionObject aSO = getDesignTemplate().getGroupLabel(i);
+ int nLabelHeight = 0;
+// if (aSO != null)
+// {
+ nLabelHeight = aSO.getHeight(LayoutConstants.LabelHeight);
+ 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 = LayoutConstants.LineHeight;
+ 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);
+ }
+ }
+
+ // -------------------------------------------------------------------------
+ /**
+ * Give a list off all field title names to insert the field title names, call layout()
+ * @param _aFieldTitleNames
+ */
+ public void insertFieldTitles(String[] _aFieldTitleNames)
+ {
+ m_aFieldTitleNames = _aFieldTitleNames;
+ }
+
+ // -------------------------------------------------------------------------
+ protected String getTitleFromFieldName(String _sField)
+ {
+ for (int i = 0; i < m_aFieldNames.length; i++)
+ {
+ if (m_aFieldNames[i].equals(_sField))
+ {
+ return m_aFieldTitleNames[i];
+ }
+ }
+ return "";
+ }
+
+ protected int getTypeFromFieldName(String _sField)
+ {
+ for (int i = 0; i < m_aFieldNames.length; i++)
+ {
+ if (m_aFieldNames[i].equals(_sField))
+ {
+ return m_aFieldTypes[i];
+ }
+ }
+ return 0;
+ }
+
+ protected boolean listContains(String[] _aList, String _aValue)
+ {
+ for (int i = 0; i < _aList.length; i++)
+ {
+ if (_aList[i].equals(_aValue))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ // -------------------------------------------------------------------------
+ /**
+ * Helper to get all field names without the names which are already in the group names
+ * @param _aList
+ * @param _aGetResultFrom
+ * @return
+ */
+ protected String[] getNamesWithoutGroupNames(String[] _aList, String[] _aGetResultFrom)
+ {
+ if (_aList == null /* || _aGetResultsFrom == null */)
+ {
+ return new String[]
+ {
+ }; /* empty list */
+ }
+ if (getCountOfGroups() == 0)
+ {
+ if (_aGetResultFrom != null)
+ {
+ return _aGetResultFrom;
+ }
+ return _aList;
+ }
+ final int nNewLength = _aList.length - getCountOfGroups();
+ String[] aNewList = new String[nNewLength];
+ int j = 0;
+ for (int i = 0; i < _aList.length; i++)
+ {
+ final String sField = _aList[i];
+ if (listContains(m_aGroupNames, sField) == true)
+ {
+ continue;
+ }
+ if (_aGetResultFrom != null)
+ {
+ aNewList[j++] = _aGetResultFrom[i];
+ }
+ else
+ {
+ aNewList[j++] = sField;
+ }
+ if (j == nNewLength)
+ {
+ break; // Emergency break, we leave the result list.
+ }
+ }
+ return aNewList;
+ }
+
+ // -------------------------------------------------------------------------
+ protected int calculateFieldWidth(int _nLeftIndent, int _nFieldCount)
+ {
+ int nWidth = 3000;
+ if (_nFieldCount > 0)
+ {
+ nWidth = (getPageWidth() - getLeftPageIndent() - getRightPageIndent() - _nLeftIndent) / _nFieldCount;
+ }
+ return nWidth;
+ }
+
+ protected String[] getFieldTitleNames()
+ {
+ return getNamesWithoutGroupNames(m_aFieldNames, m_aFieldTitleNames);
+ }
+ // -------------------------------------------------------------------------
+ abstract protected void insertDetailFieldTitles();
+ // -------------------------------------------------------------------------
+ /**
+ * Give a list off all field names to insert the field names, call layout()
+ * @param _aFieldNames
+ */
+ public void insertFieldNames(String[] _aFieldNames)
+ {
+ m_aFieldNames = _aFieldNames;
+ }
+
+ public void insertFieldTypes(int[] _aFieldTypes)
+ {
+ m_aFieldTypes = _aFieldTypes;
+ }
+
+ public void insertFieldWidths(int[] _aFieldWidths)
+ {
+ m_aFieldWidths = _aFieldWidths;
+ }
+
+ protected int getCountOfGroups()
+ {
+ return ((m_aGroupNames == null) ? 0 : m_aGroupNames.length);
+ }
+
+ // -------------------------------------------------------------------------
+ protected String[] getFieldNames()
+ {
+ return getNamesWithoutGroupNames(m_aFieldNames, null);
+ }
+
+ abstract protected void insertDetailFields();
+
+ protected void copyDetailProperties()
+ {
+ if (getDesignTemplate() != null)
+ {
+ try
+ {
+ XSection xForeignSection = getDesignTemplate().getDetail();
+ if (xForeignSection != null)
+ {
+ XSection xSection = getReportDefinition().getDetail();
+
+ // copy Properties
+ copyProperties(xForeignSection, xSection);
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+ // -------------------------------------------------------------------------
+ protected Rectangle insertLabel(XSection _xSection, String _sLabel, Rectangle _aRect, int _nWidth, SectionObject _aSO)
+ {
+ if (_xSection != null)
+ {
+ try
+ {
+ final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText");
+ final XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
+
+
+ int nHeight = LayoutConstants.LabelHeight; // default height of label is fixed.
+ if (_aSO != null)
+ {
+ if (_aSO instanceof SectionEmptyObject)
+ {
+ float fCharWeight = _aSO.getCharWeight(com.sun.star.awt.FontWeight.NORMAL);
+ if (fCharWeight > 0.1f)
+ {
+ xFixedText.setCharWeight(fCharWeight);
+ }
+ }
+ else
+ {
+// TODO: there seems to be some problems with copy all properties from the design template to the current design
+ final FontDescriptor aFD = _aSO.getFontDescriptor();
+ if (aFD != null)
+ {
+ xFixedText.setFontDescriptor(aFD);
+ copyProperties(_aSO.getParent(), xFixedText);
+ }
+ nHeight = _aSO.getHeight(LayoutConstants.LabelHeight);
+ }
+ }
+ xFixedText.setLabel(_sLabel);
+
+ xFixedText.setPositionX(_aRect.X);
+ xFixedText.setPositionY(_aRect.Y);
+
+ // Width will calculate from outside.
+ // We have to set, because there exist no right default (0)
+ xFixedText.setWidth(_nWidth);
+ _aRect.X += _nWidth;
+ xFixedText.setHeight(nHeight);
+ _xSection.add(xFixedText);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // TODO: Exception not set.
+ int dummy = 0;
+ }
+ }
+ return _aRect;
+ }
+ // -------------------------------------------------------------------------
+ protected String convertToFieldName(String _sElementName)
+ {
+ final StringBuffer aDataField = new StringBuffer(32);
+ aDataField.append("field:[").append(_sElementName).append(']');
+ return aDataField.toString();
+
+ }
+ protected String convertFromFieldName(String _sName)
+ {
+ if (_sName.startsWith("field:["))
+ {
+ int nCloseBrace = _sName.lastIndexOf("]");
+ final String sName = _sName.substring(7, nCloseBrace).trim();
+ return sName;
+ }
+ return _sName;
+ }
+ // -------------------------------------------------------------------------
+ /**
+ * Insert a already formatted field name into a given section
+ *
+ * Use 'convertToFieldName(dbfield)' to convert a dbfield name in the right.
+ *
+ * @param _xSection in which section the formatted field will store
+ * @param _sFormattedfield as String a dbfield or an other function
+ * @param _aRect .X, .Y are the absolute position (1/100mm) where the formatted field will set
+ * @param _nWidth the width of the field in 1/100mm
+ * @param _aSO
+ * @return a new Rectangle with the new Rect.X position, Rect.Y will not change.
+ */
+ 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);
+ }
+
+ protected Rectangle insertFormattedField(XSection _xSection, String _sFormattedfield, Rectangle _aRect, int _nWidth, SectionObject _aSO, short _nAlignment)
+ {
+ if (_xSection != null)
+ {
+ try
+ {
+ Object aField;
+ int nHeight = LayoutConstants.FormattedFieldHeight;
+
+ int nType = getTypeFromFieldName(convertFromFieldName(_sFormattedfield));
+ if (nType == DataType.BINARY ||
+ nType == DataType.VARBINARY ||
+ nType == DataType.LONGVARBINARY)
+ {
+ aField = getMSFofReportDefinition().createInstance("com.sun.star.report.ImageControl");
+ nHeight = LayoutConstants.BinaryHeight;
+ }
+ else
+ {
+ aField = getMSFofReportDefinition().createInstance("com.sun.star.report.FormattedField");
+ nHeight = LayoutConstants.FormattedFieldHeight;
+ if (nType == DataType.LONGVARCHAR) /* memo */
+ {
+ nHeight = LayoutConstants.MemoFieldHeight; // special case for memo
+ }
+ }
+ _aRect.Height = nHeight;
+
+ final XReportControlModel xReportControlModel = (XReportControlModel) UnoRuntime.queryInterface(XReportControlModel.class, aField);
+ if (xReportControlModel != null)
+ {
+ // #i86907# not documented right in idl description.
+ xReportControlModel.setDataField(_sFormattedfield);
+ if (_aSO != null)
+ {
+ // TODO: there seems to be some problems with copy all properties from the design template to the current design
+ final FontDescriptor aFD = _aSO.getFontDescriptor();
+ if (aFD != null)
+ {
+ xReportControlModel.setFontDescriptor(aFD);
+ copyProperties(_aSO.getParent(), xReportControlModel);
+ }
+ nHeight = _aSO.getHeight(nHeight);
+ }
+ xReportControlModel.setPositionX(_aRect.X);
+ xReportControlModel.setPositionY(_aRect.Y);
+ xReportControlModel.setWidth(_nWidth);
+ _aRect.X += _nWidth;
+ xReportControlModel.setHeight(nHeight);
+
+ if (nType == DataType.BINARY ||
+ nType == DataType.VARBINARY ||
+ nType == DataType.LONGVARBINARY)
+ {
+ // aField = getMSFofReportDefinition().createInstance("com.sun.star.report.ImageControl");
+ final XImageControl xImageControl = (XImageControl) UnoRuntime.queryInterface(XImageControl.class, xReportControlModel);
+ if (xImageControl != null)
+ {
+ // xImageControl.setScaleImage(true);
+
+ xImageControl.setScaleMode(com.sun.star.awt.ImageScaleMode.Isotropic);
+ }
+ }
+ else
+ {
+ try
+ {
+ xReportControlModel.setParaAdjust(_nAlignment);
+ // if (nType == DataType.LONGVARCHAR)
+ // {
+ // xReportControlModel.???
+ // }
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ // seems we not able to set ParaAdjust
+ }
+ }
+ // spezial case rpt:now() (default date format)
+ if (_sFormattedfield.equals("rpt:now()"))
+ {
+ final XFormattedField xFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, xReportControlModel);
+
+ XNumberFormatsSupplier x = xFormattedField.getFormatsSupplier();
+ XNumberFormats xFormats = x.getNumberFormats();
+ 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();
+ aLocale.Language = Locale.getDefault().getLanguage();
+
+ int nFormat = x3.getStandardFormat(com.sun.star.util.NumberFormat.DATE, aLocale);
+ xFormattedField.setFormatKey(nFormat);
+ }
+ _xSection.add(xReportControlModel);
+ }
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // TODO: Exception not set.
+ int dummy = 0;
+ }
+ }
+ return _aRect;
+ }
+
+ // -------------------------------------------------------------------------
+// TODO: check with Query, this code will not work with Queries
+ public void setTableName(int _aType, String _sTableName)
+ {
+ m_aCommandType = _aType;
+ m_sTableName = _sTableName;
+
+ // 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());
+ m_xMSF = xMSF;
+ }
+ return m_xMSF;
+ }
+ // -------------------------------------------------------------------------
+ protected Rectangle insertVerticalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight)
+ {
+ 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)
+ {
+ try
+ {
+ final Object aFixedLine = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedLine");
+ final XFixedLine xFixedLine = (XFixedLine) UnoRuntime.queryInterface(XFixedLine.class, aFixedLine);
+
+ xFixedLine.setOrientation(_nOrientation);
+ // TODO: line width is fixed
+ xFixedLine.setLineWidth(8);
+
+ xFixedLine.setPositionX(_aRect.X);
+ xFixedLine.setPositionY(_aRect.Y);
+
+ xFixedLine.setWidth(_nWidth);
+ _aRect.X += _nWidth;
+ xFixedLine.setHeight(_nHeight);
+ _xSection.add(xFixedLine);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // TODO: Exception not set.
+ int dummy = 0;
+ }
+ }
+ return _aRect;
+ }
+ // -------------------------------------------------------------------------
+ protected void clearReportHeader()
+ {
+ XSection xSection;
+ try
+ {
+ if (getReportDefinition().getReportHeaderOn())
+ {
+ xSection = getReportDefinition().getReportHeader();
+ emptySection(xSection);
+ }
+ }
+ catch (com.sun.star.container.NoSuchElementException e)
+ {
+ // Exception not set. Not really from interest.
+ }
+ }
+
+ protected void insertReportHeader()
+ {
+ if (getDesignTemplate() != null)
+ {
+ if (getDesignTemplate().getReportHeaderOn())
+ {
+ // copy all Section information from Page Header to our Header
+ try
+ {
+ XSection xForeignSection = getDesignTemplate().getReportHeader();
+
+ if (xForeignSection != null)
+ {
+ getReportDefinition().setReportHeaderOn(true);
+ XSection xSection = getReportDefinition().getReportHeader();
+
+ // copy Sections
+ copySection(xForeignSection, xSection);
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ else
+ {
+ // we won't a page header
+ getReportDefinition().setReportHeaderOn(false);
+ }
+ }
+ }
+
+ protected void clearReportFooter()
+ {
+ XSection xSection;
+ try
+ {
+ if (getReportDefinition().getReportFooterOn())
+ {
+ xSection = getReportDefinition().getReportFooter();
+ emptySection(xSection);
+ }
+ }
+ catch (com.sun.star.container.NoSuchElementException e)
+ {
+ // Exception not set. Not really from interest.
+ }
+ }
+
+ protected void insertReportFooter()
+ {
+ if (getDesignTemplate() != null)
+ {
+ if (getDesignTemplate().getReportFooterOn())
+ {
+ // copy all Section information from Page Header to our Header
+ try
+ {
+ XSection xForeignSection = getDesignTemplate().getReportFooter();
+
+ if (xForeignSection != null)
+ {
+ getReportDefinition().setReportFooterOn(true);
+ XSection xSection = getReportDefinition().getReportFooter();
+
+ // copy Sections
+ copySection(xForeignSection, xSection);
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ else
+ {
+ // we won't a page header
+ getReportDefinition().setReportFooterOn(false);
+ }
+ }
+ }
+ // -------------------------------------------------------------------------
+ protected void clearPageHeader()
+ {
+ XSection xSection;
+ try
+ {
+ if (getReportDefinition().getPageHeaderOn())
+ {
+ xSection = getReportDefinition().getPageHeader();
+ emptySection(xSection);
+ }
+ }
+ catch (com.sun.star.container.NoSuchElementException e)
+ {
+ // Exception not set. Not really from interest.
+ }
+ }
+
+// protected static String getDateString(String _sFormat)
+// {
+// GregorianCalendar aCalendar = new GregorianCalendar();
+// StringBuffer aBuf = new StringBuffer();
+//
+// Locale aLocale = new Locale("en","US");
+// SimpleDateFormat aFormat = new SimpleDateFormat(_sFormat, aLocale);
+// aBuf = aFormat.format(aCalendar.getTime(), aBuf, new FieldPosition(0) );
+// // DebugHelper.writeInfo("Date: " + aBuf.toString());
+// return aBuf.toString();
+// }
+
+// protected String getCurrentDate()
+// {
+// Calendar aCalendar = Calendar.getInstance();
+//// aCalendar.setTimeInMillis(1202382900000L);
+//// aCalendar.
+// Date aDate = new Date();
+// String sDate = DateFormat.getDateInstance().format(aDate);
+// // String aCalStr = aCalendar.toString();
+// return sDate;
+// //
+//// Date aDate = new Date();
+//// aDate.setSeconds(0);
+//// aDate.setMinutes(15);
+//// aDate.setHours(12);
+//// // aDate.setMonth(2);
+//// // aDate.setYear(2008);
+//// // aDate.setDay(7);
+//// long nTime = aDate.getTime();
+//// Long aLong = new Long(nTime);
+//// String aStr = aLong.toString();
+////
+//// Date aNewDate = new Date(1202382900000L);
+////// aNewDate.
+//// String aDateStr = aNewDate.toString();
+////// Datetime aNewTime = new Time(1202382900);
+////// String aTimeStr = aNewTime.toString();
+////
+//
+// }
+ protected void clearPageFooter()
+ {
+ XSection xSection;
+ try
+ {
+ if (getReportDefinition().getPageFooterOn())
+ {
+ xSection = getReportDefinition().getPageFooter();
+ emptySection(xSection);
+ }
+ }
+ catch (com.sun.star.container.NoSuchElementException e)
+ {
+ // Exception not set. Should not from interest here.
+ }
+ }
+
+ public void setPageOrientation(int _nOrientation)
+ {
+ final int nWidth = getFromPageStyles("Width", 0);
+ final int nHeight = getFromPageStyles("Height", 0);
+
+ if (com.sun.star.wizards.report.ReportLayouter.SOOPTLANDSCAPE == _nOrientation)
+ {
+ setToPageStyles("IsLandscape", Boolean.TRUE);
+ if (nWidth < nHeight)
+ {
+ setToPageStyles("Width", new Integer(nHeight));
+ setToPageStyles("Height", new Integer(nWidth));
+ }
+ }
+ else
+ {
+ setToPageStyles("IsLandscape", Boolean.FALSE);
+ if (nHeight < nWidth)
+ {
+ setToPageStyles("Width", new Integer(nHeight));
+ setToPageStyles("Height", new Integer(nWidth));
+ }
+ }
+ // dirty the PageWidth
+ 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
+ */
+ Size getPreferredSize(String _sText, FontDescriptor _aFont)
+ {
+ 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 PropertySetHelper aPropertySetHelper = new PropertySetHelper(xFixedTextModel);
+// aPropertySetHelper.showProperties();
+ aPropertySetHelper.setPropertyValueDontThrow("FontDescriptor", _aFont);
+
+ final Object aUnoCtrlFixedText = getGlobalMSF().createInstance("com.sun.star.awt.UnoControlFixedText");
+// XServiceInfo xServiceInfo2 = (XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, aUnoCtrlFixedText);
+// String[] sServices2 = xServiceInfo2.getSupportedServiceNames();
+
+ final XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, aUnoCtrlFixedText);
+ xWindow.setVisible(false);
+
+ 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);
+ xFixedText.setText(_sText);
+
+ 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());
+ xControl.createPeer(null, xPeerOfReportDefinition);
+
+ final XWindowPeer x = xControl.getPeer();
+
+ 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);
+ xFixedTextDeleter.dispose();
+
+ final XComponent xFixedTextModelDeleter = (XComponent) UnoRuntime.queryInterface(XComponent.class, aFixedTextModel);
+ xFixedTextModelDeleter.dispose();
+ }
+ catch (Exception e)
+ {
+ // TODO: Exception not set.
+ }
+ return aSizeMM_100TH;
+ }
+
+ protected String getTableName()
+ {
+ if (m_sTableName != null)
+ {
+ return m_sTableName;
+ }
+ return "";
+ }
+
+ protected String getUserNameFromConfiguration()
+ {
+ String sFirstName = "";
+ String sLastName = "";
+ try
+ {
+ Object oProdNameAccess = Configuration.getConfigurationRoot(getGlobalMSF(), "org.openoffice.UserProfile/Data", false);
+ sFirstName = (String) Helper.getUnoObjectbyName(oProdNameAccess, "givenname");
+ sLastName = (String) Helper.getUnoObjectbyName(oProdNameAccess, "sn");
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return sFirstName + " " + sLastName;
+ }
+
+ /**
+ * 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);
+
+
+ XPropertySetInfo xForeignPropInfo = xFrom.getPropertySetInfo();
+ XPropertySetInfo xSectionPropInfo = xTo.getPropertySetInfo();
+ Property[] aAllProperties = xForeignPropInfo.getProperties();
+ for (int i = 0; i < aAllProperties.length; i++)
+ {
+ String sPropertyName = aAllProperties[i].Name;
+ if (xSectionPropInfo.hasPropertyByName(sPropertyName))
+ {
+ try
+ {
+ Property aDestProp = xForeignPropInfo.getPropertyByName(sPropertyName);
+ if ((aDestProp.Attributes & PropertyAttribute.READONLY) == 0)
+ {
+ xTo.setPropertyValue(sPropertyName, xFrom.getPropertyValue(sPropertyName));
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ }
+ }
+
+ /**
+ * 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);
+
+ try
+ {
+ XEnumeration xEnum = _xFromSection.createEnumeration();
+ while (xEnum.hasMoreElements())
+ {
+ Object aEnumObj = xEnum.nextElement();
+ XReportComponent aComponent = (XReportComponent) UnoRuntime.queryInterface(XReportComponent.class, aEnumObj);
+
+ // XCloneable aClone = (XCloneable)UnoRuntime.queryInterface(XCloneable.class, aEnumObj);
+ if (aComponent != null)
+ {
+ Object aClone = aComponent.createClone();
+ if (aClone != null)
+ {
+ String sName = aComponent.getName();
+ com.sun.star.awt.Point aPosition = aComponent.getPosition();
+ Size aSize = aComponent.getSize();
+
+ XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aClone);
+ String sShapeType = aShape.getShapeType();
+ com.sun.star.awt.Point aShapePoint = aShape.getPosition();
+ Size aShapeSize = aShape.getSize();
+
+ // normally 'createClone' will create a real clone of the component,
+ // but there seems some problems, we have to controll.
+ copyProperties(aComponent, aClone);
+
+ // aShape.setPosition(aComponent.getPosition());
+ // aShape.setSize(aComponent.getSize());
+ _xToSection.add(aShape);
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ // String sName = xForeignSection.getName();
+ // int dummy = 0;
+ }
+
+ protected void insertPageHeader()
+ {
+ if (getDesignTemplate() != null)
+ {
+ if (getDesignTemplate().getPageHeaderOn())
+ {
+ // copy all Section information from Page Header to our Header
+ try
+ {
+ XSection xForeignSection = getDesignTemplate().getPageHeader();
+
+ if (xForeignSection != null)
+ {
+ getReportDefinition().setPageHeaderOn(true);
+ XSection xSection = getReportDefinition().getPageHeader();
+
+ // copy Sections
+ copySection(xForeignSection, xSection);
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ return;
+ }
+ else
+ {
+ // we won't a page header
+ // getReportDefinition().setPageHeaderOn(true);
+ getReportDefinition().setPageHeaderOn(false);
+ }
+ }
+ else
+ {
+ if (getReportDefinition() == null)
+ {
+ return;
+ }
+ // there is no foreign report definition
+ // TODO: #i86902# rpt:Title() out of the document
+
+ // TODO: #i86902# rpt:Author() can't set with something like rpt:author()
+ // TODO: #i86902# more fieldnames need.
+ final String sTitleTitle = getResource().getResText(UIConsts.RID_REPORT + 86); // "Title:"
+ final String sTitle = getTableName(); // "Default title, this is a first draft report generated by the new report wizard.";
+ final String sAuthorTitle = getResource().getResText(UIConsts.RID_REPORT + 87); // "Author:"
+ final String sAuthor = getUserNameFromConfiguration(); // "You"; // rpt:fieldvalue();
+ final String sDateTitle = getResource().getResText(UIConsts.RID_REPORT + 88); // "Date:"
+ // TODO: #i86911# Date: we need to set the style of the date.
+ final String sDate = "rpt:now()"; // getDateString("EEE, d MMM yyyy HH:mm:ss zzzz");
+
+ try
+ {
+ getReportDefinition().setPageHeaderOn(true);
+ XSection xSection = null;
+ xSection = getReportDefinition().getPageHeader();
+
+ Rectangle aRect = new Rectangle();
+ aRect.X = getLeftPageIndent();
+ SectionObject aSOLabel = SectionEmptyObject.create();
+ aSOLabel.setFontToBold();
+ aRect.Y = aSOLabel.getHeight(LayoutConstants.LabelHeight);
+
+ final int nWidth = 3000;
+
+ aRect = insertLabel(xSection, sTitleTitle, aRect, nWidth, aSOLabel);
+
+ final int nTitleWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - 3000;
+ // aRect = insertFormattedField(xSection, "rpt:Title()", aRect, nTitleWidth);
+ aRect = insertLabel(xSection, sTitle, aRect, nTitleWidth, aSOLabel);
+
+ aRect.Y += aSOLabel.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight;
+
+ aRect.X = getLeftPageIndent();
+ aRect = insertLabel(xSection, sAuthorTitle, aRect, nWidth, aSOLabel);
+ // aRect = insertFormattedField(xSection, "rpt:Author()", aRect, nWidth);
+ aRect = insertLabel(xSection, sAuthor, aRect, nTitleWidth, aSOLabel);
+
+ aRect.Y += aSOLabel.getHeight(LayoutConstants.LabelHeight);
+
+ aRect.X = getLeftPageIndent();
+ aRect = insertLabel(xSection, sDateTitle, aRect, nWidth, aSOLabel);
+ // aRect = insertFormattedField(xSection, "rpt:Date()", aRect, nWidth);
+ aRect = insertFormattedField(xSection, sDate, aRect, nTitleWidth, aSOLabel);
+
+ aRect.Y += aSOLabel.getHeight(LayoutConstants.FormattedFieldHeight) + LayoutConstants.LineHeight;
+
+ // draw a line under the label/formattedfield
+ aRect.X = getLeftPageIndent();
+ final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X;
+ final int nLineHeight = LayoutConstants.LineHeight;
+ insertHorizontalLine(xSection, aRect, nLineWidth, nLineHeight);
+
+ aRect.Y += nLineHeight;
+
+ xSection.setHeight(aRect.Y);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // TODO: Exception not set.
+ }
+ }
+ }
+
+ protected void insertPageFooter()
+ {
+ if (getDesignTemplate() != null)
+ {
+ if (getDesignTemplate().getPageFooterOn())
+ {
+ try
+ {
+ XSection xForeignSection = getDesignTemplate().getPageFooter();
+
+ if (xForeignSection != null)
+ {
+ getReportDefinition().setPageFooterOn(true);
+ XSection xSection = getReportDefinition().getPageFooter();
+
+ // copy Sections
+ copySection(xForeignSection, xSection);
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ else
+ {
+ // getReportDefinition().setPageFooterOn(true);
+ getReportDefinition().setPageFooterOn(false);
+ }
+ }
+ else
+ {
+ if (getReportDefinition() == null)
+ {
+ return;
+ }
+
+ // TODO: how should we arrive this code (set page and pagecount in the middle of the page footer)
+ // If there exists a design template, don't use it.
+
+ // we don't have a default report definition
+ final String sPageOf = getResource().getResText(UIConsts.RID_REPORT + 89); // 'Page #page# of #count#'
+
+ // Convert
+ // 'Page #page# of #count#'
+ // to something like
+ // '\"Page \" & PageNumber() & \" of \" & PageCount()'
+ // due to the fact that is is not fixed, where #page# or #count# occurs, we make it
+ // a little bit trickier.
+ // we first surround the string with double quotes,
+ // second, replace the #...#
+ // last, we remove double 'double quotes'.
+ final String sSurroundDoubleQuotes = "\"" + sPageOf + "\"";
+ final String sPageNumber = sSurroundDoubleQuotes.replaceAll("#page#", "\" & PageNumber() & \"");
+ final String sPageCount = sPageNumber.replaceAll("#count#", "\" & PageCount() & \"");
+ final String sNoLastUnusedQuotes = sPageCount.replaceAll(" & \\\"\\\"", "");
+ final String sNoFirstUnusedQuotes = sNoLastUnusedQuotes.replaceAll("\\\"\\\" & ", "");
+
+ final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent();
+
+ try
+ {
+ getReportDefinition().setPageFooterOn(true);
+ XSection xSection = null;
+ xSection = getReportDefinition().getPageFooter();
+
+ Rectangle aRect = new Rectangle();
+ aRect.X = getLeftPageIndent();
+
+ // draw a line over the label/formattedfield
+ final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X;
+ final int nLineHeight = LayoutConstants.LineHeight;
+ insertHorizontalLine(xSection, aRect, nLineWidth, nLineHeight);
+
+ aRect.Y += nLineHeight;
+ aRect.Y += LayoutConstants.LabelHeight;
+
+ final int nWidth = nUsablePageWidth;
+ aRect.X = getLeftPageIndent();
+
+ aRect = insertFormattedField(xSection, "rpt:" + sNoFirstUnusedQuotes, aRect, nWidth, null, (short) com.sun.star.awt.TextAlign.CENTER);
+
+ aRect.Y += LayoutConstants.FormattedFieldHeight + LayoutConstants.LineHeight;
+ xSection.setHeight(aRect.Y);
+ }
+ catch (Exception e)
+ {
+ // TODO: Exception not set.
+ }
+ }
+ }
+
+ protected Resource getResource()
+ {
+ return m_aResource;
+ }
+ 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_nLeftIndent;
+ private DesignTemplate m_xDesignTemplate = null;
+
+ public void initializeData(IReportBuilderLayouter _aOther)
+ {
+ if (_aOther instanceof ReportBuilderLayouter)
+ {
+ final ReportBuilderLayouter aOther = (ReportBuilderLayouter) _aOther;
+ m_aCommandType = aOther.m_aCommandType;
+ 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_nLeftIndent = aOther.m_nLeftIndent;
+ m_xDesignTemplate = aOther.m_xDesignTemplate;
+
+ // dirty PageWidth
+ m_nPageWidth = -1;
+ }
+ }
+
+ /**
+ * Get the maximal label width of all labels
+ * @return the width in 1/100mm
+ */
+ protected int getMaxLabelWidth()
+ {
+ int nWidth = 0;
+ final String[] aFieldTitles = m_aFieldTitleNames; // we want all Field Titles here // getFieldTitleNames();
+ 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++)
+ {
+ final String sGroupName = m_aGroupNames[i];
+ final SectionObject a = getDesignTemplate().getGroupLabel(i);
+ final FontDescriptor aFD = a.getFontDescriptor();
+ nWidth = Math.max(nWidth, getLabelWidth(sGroupName, aFD));
+ }
+
+ if (nWidth == 0)
+ {
+ nWidth = 3000;
+ }
+ else
+ {
+ nWidth += 500;
+ }
+ return nWidth;
+ }
+
+ /**
+ * Get width of a given string (Label) in 1/100mm
+ * @param _sLabel
+ * @return the width in 1/100mm
+ */
+ protected int getLabelWidth(String _sLabel)
+ {
+ return getLabelWidth(_sLabel, 0.0f, 0.0f);
+ }
+ XFixedText m_aFixedTextHelper = null;
+ HashMap m_aLabelWidthMap;
+
+ protected int getLabelWidth(String _sLabel, FontDescriptor _aFD)
+ {
+ float fCharWeight = 0.0f;
+ float fCharHeight = 0.0f;
+ if (_aFD != null)
+ {
+ fCharWeight = _aFD.Weight;
+ fCharHeight = _aFD.Height;
+ }
+ return getLabelWidth(_sLabel, fCharWeight, fCharHeight);
+ }
+
+ protected int getLabelWidth(String _sLabel, float _nCharWeight, float _nCharHeight)
+ {
+ int nWidth = 0;
+
+ if (m_aLabelWidthMap == null)
+ {
+ m_aLabelWidthMap = new HashMap();
+ }
+ // At first, try to get the Width out of a HashMap (Cache)
+ StringBuffer aKey = new StringBuffer(40);
+ final String sKey = aKey.append(_sLabel).append(_nCharWeight).append(_nCharHeight).toString();
+ if (m_aLabelWidthMap.containsKey(sKey))
+ {
+ final Object aWidth = m_aLabelWidthMap.get(sKey);
+ final Integer aIntegerWidth = (Integer) aWidth;
+ nWidth = aIntegerWidth.intValue();
+ }
+ else
+ {
+ try
+ {
+ if (m_aFixedTextHelper == null)
+ {
+ final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText");
+ m_aFixedTextHelper = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
+ }
+
+ m_aFixedTextHelper.setLabel(_sLabel);
+ if (_nCharWeight > 0.1f)
+ {
+ m_aFixedTextHelper.setCharWeight(_nCharWeight);
+ }
+ if (_nCharHeight > 0.1f)
+ {
+ m_aFixedTextHelper.setCharHeight(_nCharHeight);
+ }
+
+ final FontDescriptor xFont = m_aFixedTextHelper.getFontDescriptor();
+ final Size aSize = getPreferredSize(_sLabel, xFont);
+ nWidth = aSize.Width;
+ // cache the found width
+ m_aLabelWidthMap.put(sKey, new Integer(nWidth));
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // TODO: Exception not set.
+ }
+ }
+ return nWidth;
+ }
+
+ protected void doNotBreakInTable(Object _xSectionOrGroup)
+ {
+// try
+// {
+// _xSection.setKeepTogether(true);
+ final PropertySetHelper aHelper = new PropertySetHelper(_xSectionOrGroup);
+ aHelper.setPropertyValueDontThrow("KeepTogether", Boolean.TRUE);
+// }
+// catch (com.sun.star.uno.Exception e)
+// {
+// // Exception not set, but not really from interest.
+// }
+ }
+
+ protected DesignTemplate getDesignTemplate()
+ {
+ if (m_xDesignTemplate == null)
+ {
+ // initialise the report definition.
+ String sDefaultHeaderLayout = m_xReportDefinitionReadAccess.getDefaultHeaderLayout();
+ loadAndSetBackgroundTemplate(sDefaultHeaderLayout);
+
+ // 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++)
+// {
+// try
+// {
+// Object aOtherFunction = xOtherFunctions.getByIndex(i);
+// XFunctions xFunctions = getReportDefinition().getFunctions();
+// XFunction xFunction = xFunctions.createFunction();
+//
+// copyProperties(aOtherFunction, xFunction);
+// xFunctions.insertByIndex(xFunctions.getCount(), xFunction);
+// }
+// catch (com.sun.star.lang.IllegalArgumentException e)
+// {
+// }
+// catch (IndexOutOfBoundsException ex)
+// {
+// ex.printStackTrace();
+// }
+// catch (WrappedTargetException ex)
+// {
+// ex.printStackTrace();
+// }
+//
+// }
+
+ }
+ return m_xDesignTemplate;
+ }
+
+ /**
+ * If there already exists a foreign report definition, which we use to get the layout from
+ * close it.
+ * Veto is not allowed here.
+ */
+ private void closeDesignTemplate()
+ {
+ if (m_xDesignTemplate != null)
+ {
+ m_xDesignTemplate.close();
+ m_xDesignTemplate = null;
+ }
+ }
+
+ /**
+ * load the given string as a template and use it's content to paint the other
+ * @param LayoutTemplatePath
+ */
+ public void loadAndSetBackgroundTemplate(String LayoutTemplatePath)
+ {
+ closeDesignTemplate();
+
+ String sName = FileAccess.getFilename(LayoutTemplatePath);
+ if (sName.toLowerCase().equals("default.otr_") ||
+ LayoutTemplatePath.equals("DefaultLayoutOfHeaders"))
+ {
+ // this is the default layout, we don't want to have a layout for this.
+ }
+ else
+ {
+ XMultiServiceFactory xMSF = getGlobalMSF();
+ m_xDesignTemplate = DesignTemplate.create(xMSF, LayoutTemplatePath);
+ }
+ }
+}
+
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
new file mode 100644
index 000000000000..8df754795e63
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
@@ -0,0 +1,55 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.awt.FontDescriptor;
+
+/**
+ *
+ * @author ll93751
+ */
+public class SectionEmptyObject extends SectionObject
+{
+
+ protected SectionEmptyObject()
+ {
+ m_aParentObject = null;
+ }
+
+ public static SectionObject create()
+ {
+ SectionEmptyObject a = new SectionEmptyObject();
+ return a;
+ }
+
+ public FontDescriptor getFontDescriptor()
+ {
+ return null;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
new file mode 100644
index 000000000000..ae3766fd3391
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
@@ -0,0 +1,74 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.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.
+// PropertySetHelper aHelper = new PropertySetHelper(_aFixedText);
+// aHelper.showProperties();
+ }
+
+ public static SectionObject create(XFixedText _aFixedText)
+ {
+ final SectionLabel a = new SectionLabel(_aFixedText);
+ return a;
+ }
+
+ /**
+ * Return the current FontDescriptor
+ * @return
+ */
+ public FontDescriptor getFontDescriptor()
+ {
+ FontDescriptor a = null;
+ try
+ {
+ 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
new file mode 100644
index 000000000000..fa33e85d39cb
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
@@ -0,0 +1,86 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.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;
+
+ public SectionObject()
+ {
+ m_aParentObject = null;
+ }
+
+ protected Object getParent()
+ {
+ return m_aParentObject;
+ }
+
+ abstract public FontDescriptor getFontDescriptor();
+
+ private PropertySetHelper getPropertySetHelper()
+ {
+ if (m_aPropertySetHelper == null)
+ {
+ m_aPropertySetHelper = new PropertySetHelper(getParent());
+ }
+ return m_aPropertySetHelper;
+ }
+
+ public int getHeight(int _nDefault)
+ {
+ final int nHeight = getPropertySetHelper().getPropertyValueAsInteger("Height", _nDefault);
+ 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
new file mode 100644
index 000000000000..2a11fcd56f04
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
@@ -0,0 +1,67 @@
+/*
+ * ***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.awt.FontDescriptor;
+import com.sun.star.report.XFormattedField;
+
+/**
+ *
+ * @author ll93751
+ */
+public class SectionTextField extends SectionObject
+{
+
+ protected SectionTextField(XFormattedField _aFormattedField)
+ {
+ m_aParentObject = _aFormattedField;
+ // We would like to know, what properties are in this object.
+ }
+
+ public static SectionObject create(XFormattedField _aFormattedField)
+ {
+ SectionTextField a = new SectionTextField(_aFormattedField);
+ return a;
+ }
+
+ public FontDescriptor getFontDescriptor()
+ {
+ FontDescriptor a = null;
+ try
+ {
+ XFormattedField aField = (XFormattedField) getParent();
+ a = aField.getFontDescriptor();
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ }
+ return a;
+ }
+}
+
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
new file mode 100644
index 000000000000..0fe168b28263
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
@@ -0,0 +1,154 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.reportbuilder.layout;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XGroup;
+import com.sun.star.report.XGroups;
+import com.sun.star.report.XSection;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.report.IReportDefinitionReadAccess;
+import com.sun.star.wizards.ui.UIConsts;
+
+/**
+ *
+ * @author ll93751
+ */
+public class Tabular extends ReportBuilderLayouter
+{
+
+ public Tabular(IReportDefinitionReadAccess _xDefinitionAccess, Resource _aResource)
+ {
+ super(_xDefinitionAccess, _aResource);
+ }
+
+ public String getName()
+ {
+ return "DefaultLayoutOfData";
+ }
+
+ public String getLocalizedName()
+ {
+ String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 80);
+ return sLocalizedName;
+ }
+
+ protected void insertDetailFields()
+ {
+ copyDetailProperties();
+
+ String[] aFieldNames = getFieldNames();
+ if (aFieldNames == null)
+ {
+ return;
+ }
+ if (aFieldNames.length == 0)
+ {
+ return;
+ }
+// int nGroups = getReportDefinition().getGroups().getCount();
+
+ final XSection xSection = getReportDefinition().getDetail();
+
+ Rectangle aRect = new Rectangle();
+ aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+
+ final int nWidth = calculateFieldWidth(getLeftGroupIndent(getCountOfGroups()), aFieldNames.length);
+ final SectionObject aSO = getDesignTemplate().getDetailTextField();
+ int nHeight = LayoutConstants.FormattedFieldHeight;
+ for (int i = 0; i < aFieldNames.length; i++)
+ {
+ final String sFieldName = convertToFieldName(aFieldNames[i]);
+ aRect = insertFormattedField(xSection, sFieldName, aRect, nWidth, aSO);
+ nHeight = Math.max(aRect.Height, nHeight);
+ }
+ nHeight = Math.max(aSO.getHeight(nHeight), nHeight);
+ xSection.setHeight(nHeight);
+ }
+
+ protected void insertDetailFieldTitles()
+ {
+ final String[] aFieldTitleNames = getFieldTitleNames();
+ if (aFieldTitleNames == null)
+ {
+ return;
+ }
+ if (aFieldTitleNames.length == 0)
+ {
+ return;
+ }
+ final int nGroups = getReportDefinition().getGroups().getCount();
+ try
+ {
+ XSection xSection = null;
+ SectionObject aSO = null;
+ if (nGroups == 0)
+ {
+ // Spezial case, there is no Group.
+ final XGroups xGroups = getReportDefinition().getGroups();
+ final XGroup xGroup = xGroups.createGroup();
+ xGroup.setHeaderOn(true);
+
+ xGroups.insertByIndex(xGroups.getCount(), xGroup);
+ xSection = xGroup.getHeader();
+ copyGroupProperties(0);
+ aSO = getDesignTemplate().getDetailLabel();
+ aSO.setFontToBold();
+ }
+ else
+ {
+ 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);
+ xSection = xGroup.getHeader();
+
+ // We don't need to copy the GroupProperties, because this is done in the insertGroup() member function
+ // copyGroupProperties(0);
+ aSO = getDesignTemplate().getGroupLabel(nGroups - 1);
+ }
+
+ Rectangle aRect = new Rectangle();
+// TODO: getCountOfGroups() == nGroups???
+ aRect.X = getLeftPageIndent() + getLeftGroupIndent(getCountOfGroups());
+ // TODO: group line is fix
+ aRect.Y = aSO.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight; // group height + a little empty line
+ final int nWidth = calculateFieldWidth(getLeftGroupIndent(getCountOfGroups()), aFieldTitleNames.length);
+
+ for (int i = 0; i < aFieldTitleNames.length; i++)
+ {
+ aRect = insertLabel(xSection, aFieldTitleNames[i], aRect, nWidth, aSO);
+ }
+ xSection.setHeight(aSO.getHeight(LayoutConstants.LabelHeight) + LayoutConstants.LineHeight + aSO.getHeight(LayoutConstants.LabelHeight));
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/makefile.mk b/wizards/com/sun/star/wizards/reportbuilder/layout/makefile.mk
new file mode 100644
index 000000000000..1af9e7c53862
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/makefile.mk
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = reportbuilderwizardlayouts
+PACKAGE = com$/sun$/star$/wizards$/reportbuilder$/layout
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar commonwizards.jar report.jar
+
+# CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = \
+ com$/sun$/star$/wizards$/reportbuilder$/layout \
+ com$/sun$/star$/wizards$/report
+
+# JARTARGET = $(TARGET).jar
+# JARCLASSPATH = commonwizards.jar report.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ LayoutConstants.java \
+ ReportBuilderLayouter.java \
+ Tabular.java \
+ ColumnarSingleColumn.java \
+ ColumnarTwoColumns.java \
+ ColumnarThreeColumns.java \
+ InBlocksLabelsAbove.java \
+ InBlocksLabelsLeft.java \
+ SectionObject.java \
+ SectionEmptyObject.java \
+ SectionLabel.java \
+ SectionTextField.java \
+ DesignTemplate.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/com/sun/star/wizards/reportbuilder/makefile.mk b/wizards/com/sun/star/wizards/reportbuilder/makefile.mk
new file mode 100644
index 000000000000..d9a1a7447fe8
--- /dev/null
+++ b/wizards/com/sun/star/wizards/reportbuilder/makefile.mk
@@ -0,0 +1,55 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = reportbuilderwizard
+PACKAGE = com$/sun$/star$/wizards$/reportbuilder
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar commonwizards.jar report.jar
+
+# CUSTOMMANIFESTFILE= Manifest.mf
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/reportbuilder
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar report.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ ReportBuilderImplementation.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/table/CGCategory.java b/wizards/com/sun/star/wizards/table/CGCategory.java
new file mode 100644
index 000000000000..ea74b33f09ad
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/CGCategory.java
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Configuration;
+
+/**
+ * @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
+ */
+// import com.sun.star.wizards.common.ConfigGroup;
+public class CGCategory
+{
+
+ public String Name;
+ public int Index;
+ private String[] Tables;
+ private final String CGROOTPATH = "/org.openoffice.Office.TableWizard/TableWizard/";
+ XMultiServiceFactory xMSF;
+ XNameAccess xNameAccessTablesNode;
+ XNameAccess xNameAccessCurBusinessNode;
+ Object oconfigView;
+
+ public CGCategory(XMultiServiceFactory _xMSF)
+ {
+ xMSF = _xMSF;
+ }
+
+ public void initialize(String category)
+ {
+ try
+ {
+ oconfigView = Configuration.getConfigurationRoot(xMSF, CGROOTPATH, false); //business/Tables
+ xNameAccessCurBusinessNode = Configuration.getChildNodebyName(
+ UnoRuntime.queryInterface(XNameAccess.class, oconfigView),
+ category);
+ }
+ 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;
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/table/CGTable.java b/wizards/com/sun/star/wizards/table/CGTable.java
new file mode 100644
index 000000000000..a1878bdeb02f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/CGTable.java
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Desktop;
+
+public class CGTable
+{
+
+ XMultiServiceFactory xMSF;
+ XNameAccess xNameAccessFieldsNode;
+ XNameAccess xNameAccessTableNode;
+ public String Index;
+ public String Name;
+ private Object oconfigView;
+ private final String CGROOTPATH = "/org.openoffice.Office.TableWizard/TableWizard/";
+
+ 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 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;
+ }
+ 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
new file mode 100644
index 000000000000..4aeb66cf66ca
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.uno.Type;
+import com.sun.star.wizards.common.Properties;
+
+/** 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
+ * (<CODE>__writeRegistryServiceInfo</CODE>).
+ * @author Bertram Nolte
+ */
+public class CallTableWizard
+{
+
+ /** Gives a factory for creating the service.
+ * This method is called by the <code>JavaLoader</code>
+ * <p>
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the
+ * component.
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param stringImplementationName The implementation name of the component.
+ * @param xmultiservicefactory The service manager, who gives access to every
+ * known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * 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)
+ {
+ 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;
+ }
+
+ /** Writes the service information into the given registry key.
+ * This method is called by the <code>JavaLoader</code>.
+ * @return returns true if the operation succeeded
+ * @see com.sun.star.comp.loader.JavaLoader#
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single
+ * registry key accessible.
+ */
+ 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
+ {
+
+ private PropertyValue[] m_wizardContext;
+ // <properties>
+ public String Command;
+ public final Integer CommandType = com.sun.star.sdb.CommandType.TABLE;
+ // </properties>
+
+ /** The constructor of the inner class has a XMultiServiceFactory parameter.
+ * @param i_serviceFactory
+ */
+ public TableWizardImplementation(com.sun.star.lang.XMultiServiceFactory i_serviceFactory)
+ {
+ super();
+ m_serviceFactory = i_serviceFactory;
+ registerProperty( "Command", (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) );
+ registerProperty( "CommandType", PropertyAttribute.READONLY );
+ }
+
+ public void trigger( String sEvent )
+ {
+ try
+ {
+ if ( sEvent.compareTo("start") == 0 )
+ {
+ TableWizard CurTableWizard = new TableWizard( m_serviceFactory, m_wizardContext );
+ Command = CurTableWizard.startTableWizard();
+ }
+ }
+ 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 m_serviceFactory;
+
+ /** This method is a member of the interface for initializing an object
+ * directly after its creation.
+ * @param object This array of arbitrary objects will be passed to the
+ * component after its creation.
+ * @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
+ {
+ m_wizardContext = Properties.convertToPropertyValueArray(object);
+ }
+
+ /** 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];
+
+ stringSupportedServiceNames[0] = __serviceName;
+
+ return (stringSupportedServiceNames);
+ }
+
+ /** This method returns true, if the given service will be
+ * supported by the component.
+ * @param stringService Service name.
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService(String stringService)
+ {
+ boolean booleanSupportsService = false;
+
+ 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.
+ * to realise hashing functionality when the object is introspected.
+ * Two objects that return the same ID also have to return
+ * the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to
+ * return an empty sequence. Important: If the object
+ * aggregates other objects the ID has to be unique for the
+ * whole combination of objects.
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId()
+ {
+ byte[] 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 (TableWizardImplementation.class.getName());
+ }
+
+ /** Provides a sequence of all types (usually interface types)
+ * provided by the object.
+ * @return Sequence of all types (usually interface types) provided by the
+ * service.
+ */
+ 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)
+ {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/table/FieldDescription.java b/wizards/com/sun/star/wizards/table/FieldDescription.java
new file mode 100644
index 000000000000..d26e58783aba
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/FieldDescription.java
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import java.util.Vector;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Properties;
+
+public class FieldDescription
+{
+ private String tablename = "";
+// String fieldname;
+ private String keyname;
+ private XNameAccess xNameAccessTableNode;
+ private XPropertySet xPropertySet;
+ private Vector aPropertyValues;
+// PropertyValue[] aPropertyValues;
+ private Integer Type;
+ private Integer Scale;
+ private Integer Precision;
+ private Boolean DefaultValue;
+ private String Name;
+ private XMultiServiceFactory xMSF;
+ private Locale aLocale;
+
+ public FieldDescription(XMultiServiceFactory _xMSF, Locale _aLocale, ScenarioSelector _curscenarioselector, String _fieldname, String _keyname, int _nmaxcharCount)
+ {
+ xMSF = _xMSF;
+ aLocale = _aLocale;
+ tablename = _curscenarioselector.getTableName();
+ Name = _fieldname;
+ keyname = _keyname;
+ aPropertyValues = new Vector();
+ xNameAccessTableNode = _curscenarioselector.oCGTable.xNameAccessFieldsNode;
+ XNameAccess xNameAccessFieldNode;
+ if (_curscenarioselector.bcolumnnameislimited)
+ {
+ xNameAccessFieldNode = Configuration.getChildNodebyDisplayName(xMSF, aLocale, xNameAccessTableNode, keyname, "ShortName", _nmaxcharCount);
+ }
+ else
+ {
+ xNameAccessFieldNode = Configuration.getChildNodebyDisplayName(xMSF, aLocale, xNameAccessTableNode, keyname, "Name", _nmaxcharCount);
+ }
+ setFieldProperties(xNameAccessFieldNode);
+ }
+
+ 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));
+ }
+
+ public void setName(String _newfieldname)
+ {
+ for (int i = 0; i < aPropertyValues.size(); i++)
+ {
+ PropertyValue aPropertyValue = (PropertyValue) aPropertyValues.get(i);
+ if (aPropertyValue.Name.equals("Name"))
+ {
+ aPropertyValue.Value = _newfieldname;
+ aPropertyValues.set(i, aPropertyValue);
+ Name = _newfieldname;
+ return;
+ }
+ }
+ }
+
+ public String getName()
+ {
+ return Name;
+ }
+
+ 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));
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return bexists;
+ }
+
+ 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")));
+// Scale =
+ }
+ 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);
+ }
+ }
+
+ public PropertyValue[] getPropertyValues()
+ {
+ if (aPropertyValues != null)
+ {
+ PropertyValue[] aProperties = new PropertyValue[aPropertyValues.size()];
+ aPropertyValues.toArray(aProperties);
+ return aProperties;
+ }
+ return null;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java
new file mode 100644
index 000000000000..205413bd50f3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java
@@ -0,0 +1,433 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import com.sun.star.awt.FontDescriptor;
+import com.sun.star.awt.ItemEvent;
+import com.sun.star.awt.XButton;
+import com.sun.star.awt.XItemListener;
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.db.TableDescriptor;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+
+public class FieldFormatter implements XItemListener
+{
+
+ TableWizard CurUnoDialog;
+ TableDescriptor curTableDescriptor;
+ Object oColumnDescriptorModel;
+ XTextComponent txtfieldname;
+ XListBox xlstFieldNames;
+ XButton btnplus;
+ XButton btnminus;
+ XButton btnShiftUp;
+ XButton btnShiftDown;
+ short curtabindex;
+ String TOGGLEBUTTONS = "toggleButtons";
+ String ADDFIELDNAME = "addFieldName";
+ String REMOVEFIELDNAME = "removeFieldName";
+ String MODIFYFIELDNAME = "modifyFieldName";
+ String[] fieldnames;
+ String suntitled;
+ Integer IFieldFormatStep;
+
+ public FieldFormatter(TableWizard _CurUnoDialog, TableDescriptor _curTableDescriptor)
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ curtabindex = (short) (TableWizard.SOFIELDSFORMATPAGE * 100);
+ IFieldFormatStep = new Integer(TableWizard.SOFIELDSFORMATPAGE);
+ String sFieldName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 23);
+ String sFieldNames = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 25);
+ String sfieldinfo = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 20);
+ String sbtnplushelptext = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 45);
+ String sbtnminushelptext = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 46);
+
+ 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
+ {
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+
+ FontDescriptor oFontDesc = new FontDescriptor();
+ 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)
+ });
+
+ 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)
+ });
+ 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)
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+
+
+ 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)
+ });
+
+ 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)
+ });
+ txtfieldname.addTextListener(CurUnoDialog);
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(btnplus, sbtnplushelptext);
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(btnminus, sbtnminushelptext);
+ }
+
+ 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"
+ curTableDescriptor = _curTableDescriptor;
+ Helper.setUnoPropertyValue(oColumnDescriptorModel, "ActiveConnection", _curTableDescriptor.DBConnection);
+ txtfieldname.setMaxTextLen((short) this.curTableDescriptor.getMaxColumnNameLength());
+ }
+ else
+ {
+ int nStep = ((Integer) Helper.getUnoPropertyValue(oColumnDescriptorModel, "Step")).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
+ });
+ updateColumnDescriptor(_fieldnames[0], curTableDescriptor.getByName(_fieldnames[0]));
+ toggleButtons();
+ CurUnoDialog.setFocus("lstfieldnames");
+ }
+
+ public void toggleButtons()
+ {
+ boolean benableShiftUpButton = false;
+ boolean benableShiftDownButton = false;
+ boolean bfieldnameisselected = Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems") != null;
+ int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames);
+ boolean blistispopulated = (ilistcount > 0);
+ if (bfieldnameisselected)
+ {
+ int iselpos = xlstFieldNames.getSelectedItemPos();
+ benableShiftUpButton = (iselpos != 0);
+ benableShiftDownButton = (iselpos != ilistcount - 1);
+ }
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftUp), "Enabled", new Boolean(benableShiftUpButton));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftDown), "Enabled", new Boolean(benableShiftDownButton));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), "Enabled", new Boolean(blistispopulated));
+ CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, blistispopulated);
+ }
+
+ public void addFieldName()
+ {
+ String snewfieldname = Desktop.getUniqueName(xlstFieldNames.getItems(), suntitled, "");
+ short icount = xlstFieldNames.getItemCount();
+ if (CurUnoDialog.verifyfieldcount(icount))
+ {
+ xlstFieldNames.addItem(snewfieldname, icount);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ {
+ icount
+ });
+ toggleButtons();
+ FieldDescription curfielddescription = new FieldDescription(snewfieldname);
+ CurUnoDialog.fielditems.put(snewfieldname, curfielddescription);
+ curTableDescriptor.addColumn(curfielddescription.getPropertyValues());
+ updateColumnDescriptor(snewfieldname, curTableDescriptor.getByName(snewfieldname));
+ CurUnoDialog.setControlVisible("oColumnDescriptor", true);
+ CurUnoDialog.repaintDialogStep();
+ }
+ }
+
+ public void removeFieldName()
+ {
+ String[] fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
+ short ipos = UnoDialog.getSelectedItemPos(xlstFieldNames);
+ String fieldname = fieldnames[ipos];
+ xlstFieldNames.removeItems(ipos, (short) 1);
+ CurUnoDialog.fielditems.remove(fieldname);
+ int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames);
+ if ((ipos) < ilistcount)
+ {
+ 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
+ });
+ }
+ }
+ curTableDescriptor.dropColumnbyName(fieldname);
+ fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
+ boolean benable = ((ipos > -1) && (ipos < fieldnames.length));
+ if (benable)
+ {
+ String snewfieldname = fieldnames[ipos];
+ updateColumnDescriptor(snewfieldname, curTableDescriptor.getByName(snewfieldname));
+ toggleButtons();
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", "");
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), "Enabled", new Boolean(benable));
+ CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, benable);
+ }
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), "Enabled", new Boolean(benable));
+ CurUnoDialog.setControlVisible("oColumnDescriptor", benable);
+ CurUnoDialog.repaintDialogStep();
+ }
+
+ public void modifyFieldName()
+ {
+ String newfieldname = txtfieldname.getText();
+ String oldfieldname = xlstFieldNames.getSelectedItem();
+ 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);
+ CurUnoDialog.fielditems.remove(oldfieldname);
+ curfielddescription.setName(newfieldname);
+ CurUnoDialog.fielditems.put(newfieldname, curfielddescription);
+ String[] fieldnames = xlstFieldNames.getItems();
+ short ipos = xlstFieldNames.getSelectedItemPos();
+ fieldnames[ipos] = newfieldname;
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", fieldnames);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ {
+ ipos
+ });
+ }
+ }
+ }
+
+ 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);
+ }
+ toggleButtons();
+ }
+
+ 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);
+ }
+ toggleButtons();
+ }
+
+ public String[] shiftArrayItem(String[] _slist, int _oldindex, int _shiftcount)
+ {
+ int newindex = _oldindex + _shiftcount;
+ if ((newindex >= 0) && (newindex < _slist.length))
+ {
+ String buffer = _slist[newindex];
+ _slist[newindex] = _slist[_oldindex];
+ _slist[_oldindex] = buffer;
+ }
+ return _slist;
+ }
+
+ public boolean updateColumnofColumnDescriptor()
+ {
+ Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column");
+ XPropertySet xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn);
+ if (xColPropertySet != null)
+ {
+ curTableDescriptor.modifyColumn(txtfieldname.getText(), xColPropertySet);
+ return true;
+ }
+ return false;
+ }
+
+ 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)
+ {
+ XPropertySet xlocpropertyset = null;
+ return xlocpropertyset;
+ }
+
+ public void itemStateChanged(ItemEvent arg0)
+ {
+ String fieldname = xlstFieldNames.getSelectedItem();
+ XPropertySet xColumn = curTableDescriptor.getByName(fieldname);
+ updateColumnDescriptor(fieldname, xColumn);
+ toggleButtons();
+ }
+
+ public boolean iscompleted()
+ {
+ String[] sfieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
+ return sfieldnames.length > 0;
+ }
+
+ 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)
+ {
+ // 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
new file mode 100644
index 000000000000..43c6787a294c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/Finalizer.java
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.db.TableDescriptor;
+import com.sun.star.wizards.ui.*;
+
+public class Finalizer
+{
+
+ TableWizard CurUnoDialog;
+ short curtabindex;
+ XRadioButton optModifyTable;
+ XRadioButton optWorkWithTable;
+ XRadioButton optStartFormWizard;
+ XTextComponent txtTableName;
+ XListBox xCatalogListBox;
+ XListBox xSchemaListBox;
+ TableDescriptor curtabledescriptor;
+ public String SETCOMPLETIONFLAG = "setCompletionFlag";
+ public static int WORKWITHTABLEMODE = 0;
+ public static int MODIFYTABLEMODE = 1;
+ public static int STARTFORMWIZARDMODE = 2;
+
+ public Finalizer(TableWizard _CurUnoDialog, TableDescriptor _curtabledescriptor)
+ {
+ try
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ this.curtabledescriptor = _curtabledescriptor;
+ curtabindex = (short) (TableWizard.SOFINALPAGE * 100);
+ Integer IFINALSTEP = new Integer(TableWizard.SOFINALPAGE);
+ String slblTableName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 34);
+ String slblProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 36);
+ 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 slblCatalog = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 49);
+ String slblSchema = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 50);
+ String[] sCatalogNames = curtabledescriptor.getCatalogNames();
+ String[] sSchemaNames = curtabledescriptor.getSchemaNames();
+ int nListBoxPosX = 97;
+ int ndiffPosY = 0;
+ boolean bsupportsSchemata = false;
+ 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)
+ });
+ 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)
+ });
+ txtTableName.addTextListener(CurUnoDialog);
+ txtTableName.setMaxTextLen((short) this.curtabledescriptor.getMaxTableNameLength());
+ if (this.curtabledescriptor.xDBMetaData.supportsCatalogsInTableDefinitions())
+ {
+ if (sCatalogNames != null)
+ {
+ if (sCatalogNames.length > 0)
+ {
+ bsupportsCatalogs = true;
+ String sCatalog = "";
+ try
+ {
+ sCatalog = curtabledescriptor.DBConnection.getCatalog();
+ }
+ 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)
+ });
+
+ 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(UnoDialog.getListBoxLineCount()), 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ nListBoxPosX = 200;
+ }
+ }
+ }
+ if (this.curtabledescriptor.xDBMetaData.supportsSchemasInTableDefinitions())
+ {
+ if (sSchemaNames != null)
+ {
+ if (sSchemaNames.length > 0)
+ {
+ bsupportsSchemata = true;
+ String sSchema = "";
+ try
+ {
+ sSchema = (String) curtabledescriptor.getDataSourcePropertySet().getPropertyValue("User");
+ }
+ 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)
+ });
+
+ 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(UnoDialog.getListBoxLineCount()), 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ }
+ }
+ 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)
+ });
+ }
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void initialize(String _firsttablename)
+ {
+ setTableName(_firsttablename);
+ }
+
+ public int finish()
+ {
+ if (optWorkWithTable.getState())
+ {
+ return WORKWITHTABLEMODE;
+ }
+ else if (optModifyTable.getState())
+ {
+ return MODIFYTABLEMODE;
+ }
+ else
+ {
+ return STARTFORMWIZARDMODE;
+ }
+ }
+
+ 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(""))
+ {
+ String ssuffix = Desktop.getIncrementSuffix(curtabledescriptor.getTableNamesAsNameAccess(), getComposedTableName(_tablename));
+ txtTableName.setText(_tablename + ssuffix);
+ setCompletionFlag();
+ }
+ }
+
+ public String getTableName()
+ {
+ return txtTableName.getText();
+ }
+
+ public String getTableName(String _firsttablename)
+ {
+ if (txtTableName.getText().equals(""))
+ {
+ setTableName(_firsttablename);
+ }
+ return txtTableName.getText();
+ }
+
+ public String getSchemaName()
+ {
+ if (xSchemaListBox != null)
+ {
+ return this.xSchemaListBox.getSelectedItem();
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ public String getCatalogName()
+ {
+ if (xCatalogListBox != null)
+ {
+ return this.xCatalogListBox.getSelectedItem();
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ public boolean iscompleted()
+ {
+ return (txtTableName.getText().length() > 0);
+ }
+
+ public void setCompletionFlag()
+ {
+ CurUnoDialog.setcompleted(TableWizard.SOFINALPAGE, iscompleted());
+ }
+
+ public void setFocusToTableNameControl()
+ {
+ CurUnoDialog.setFocus("txtTableName");
+ }
+}
diff --git a/wizards/com/sun/star/wizards/table/MANIFEST.MF b/wizards/com/sun/star/wizards/table/MANIFEST.MF
new file mode 100644
index 000000000000..0fcfe1d3e8f1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.table.CallTableWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
new file mode 100644
index 000000000000..d8ecf13a9ad9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
@@ -0,0 +1,460 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import com.sun.star.awt.XCheckBox;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.db.TableDescriptor;
+import com.sun.star.wizards.db.TypeInspector;
+import com.sun.star.wizards.ui.FieldSelection;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.XFieldSelectionListener;
+
+public class PrimaryKeyHandler implements XFieldSelectionListener
+{
+
+ private TableWizard CurUnoDialog;
+ private short curtabindex;
+ private final static String SPRIMEKEYMODE = "togglePrimeKeyFields";
+ private final static String SSINGLEKEYMODE = "toggleSinglePrimeKeyFields";
+ private final static String SSEVERALKEYMODE = "toggleSeveralPrimeKeyFields";
+ private XRadioButton optAddAutomatically;
+ private XRadioButton optUseExisting;
+ private XRadioButton optUseSeveral;
+ private XCheckBox chkUsePrimaryKey;
+ private XCheckBox chkcreatePrimaryKey;
+ private XCheckBox chkApplyAutoValueExisting;
+ private XCheckBox chkApplyAutoValueAutomatic;
+ private XListBox lstSinglePrimeKey;
+ private XFixedText lblPrimeFieldName;
+ private FieldSelection curPrimaryKeySelection;
+ private String[] fieldnames;
+ private TableDescriptor curTableDescriptor;
+ private int nAutoPrimeKeyDataType;
+ private boolean bAutoPrimaryKeysupportsAutoIncrmentation;
+ private final static String SAUTOMATICKEYFIELDNAME = "ID";
+
+ 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);
+ final String sExplanations = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 26);
+ final String screatePrimaryKey = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 27);
+ final String slblPrimeFieldName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 31);
+ final String sApplyAutoValue = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 33);
+ final String sAddAutomatically = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 28);
+ final String sUseExisting = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 29);
+ final String sUseSeveral = CurUnoDialog.m_oResource.getResText(UIConsts.RID_TABLE + 30);
+ final String slblAvailableFields = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 4);
+ final 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)
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+
+ lstSinglePrimeKey = CurUnoDialog.insertListBox("lstSinglePrimeKey", "onPrimeKeySelected", null, this,
+ new String[]
+ {
+ "Dropdown",
+ "Enabled",
+ "Height",
+ "HelpURL",
+ "LineCount",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Boolean.TRUE,
+ Boolean.FALSE,
+ new Integer(12),
+ "HID:41231",
+ Short.valueOf(UnoDialog.getListBoxLineCount()),
+ 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)
+ });
+ curPrimaryKeySelection = new FieldSelection(CurUnoDialog, IPRIMEKEYSTEP.intValue(), 116, 142, 208, 47, slblAvailableFields, slblSelPrimaryFields, 41234, false);
+ curPrimaryKeySelection.addFieldSelectionListener(this);
+
+ }
+
+ public void initialize()
+ {
+ // boolean breselect;
+ fieldnames = curTableDescriptor.getNonBinaryFieldNames();
+ String[] skeyfieldnames = curPrimaryKeySelection.getSelectedFieldNames();
+ curPrimaryKeySelection.initialize(fieldnames, false);
+ 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 (JavaTools.FieldInList(fieldnames, selfield) > -1)
+ {
+ lstSinglePrimeKey.selectItem(selfield, true);
+ }
+ }
+ togglePrimeKeyFields();
+ }
+
+ private boolean isAutoPrimeKeyAutoIncrementationsupported()
+ {
+ TypeInspector.TypeInfo aAutoPrimeTypeInfo;
+ aAutoPrimeTypeInfo = curTableDescriptor.oTypeInspector.findAutomaticPrimaryKeyType();
+ return aAutoPrimeTypeInfo.bisAutoIncrementable;
+ }
+
+ public boolean iscompleted()
+ {
+ if (chkcreatePrimaryKey.getState() == 0)
+ {
+ return true;
+ }
+ if (this.optAddAutomatically.getState())
+ {
+ return true;
+ }
+ if (optUseExisting.getState())
+ {
+ fieldnames = curTableDescriptor.getNonBinaryFieldNames();
+ String selfield = lstSinglePrimeKey.getSelectedItem();
+ if (selfield != null)
+ {
+ return (JavaTools.FieldInList(fieldnames, selfield) > -1);
+ }
+ }
+ if (optUseSeveral.getState())
+ {
+ fieldnames = curTableDescriptor.getNonBinaryFieldNames();
+ String[] skeyfieldnames = curPrimaryKeySelection.getSelectedFieldNames();
+ String[] snewkeyfieldnames = JavaTools.removeOutdatedFields(skeyfieldnames, fieldnames);
+ return (snewkeyfieldnames.length > 0);
+ }
+ return false;
+ }
+
+ 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));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optUseExisting), "Enabled", new Boolean(bdoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optUseSeveral), "Enabled", new Boolean(bdoEnable));
+ //toggle subcontrols of the radiobuttons...
+ toggleAutomaticAutoValueCheckBox();
+ boolean benableSinglePrimekeyControls = bdoEnable && optUseExisting.getState();
+ toggleSinglePrimeKeyFields(benableSinglePrimekeyControls);
+ boolean benableSeveralPrimekeyControls = bdoEnable && optUseSeveral.getState();
+ curPrimaryKeySelection.toggleListboxControls(new Boolean(benableSeveralPrimekeyControls));
+ // toggle the following steps of the dialog...
+ if (!bdoEnable)
+ {
+ CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, true);
+ }
+ 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);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return false;
+ }
+
+ public boolean isAutomaticMode()
+ {
+ boolean bisAutomaticMode = false;
+ if (chkcreatePrimaryKey.getState() == 1)
+ {
+ bisAutomaticMode = ((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), "State")).shortValue() == (short) 1;
+ }
+ return bisAutomaticMode;
+ }
+
+ 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;
+ }
+ }
+ 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);
+ }
+ }
+
+ 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));
+ boolean bdoenableAutoValueCheckBox = (isAutoIncrementatable(lstSinglePrimeKey.getSelectedItem()) && _bdoenable);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), "Enabled", new Boolean(bdoenableAutoValueCheckBox));
+ }
+
+ private void toggleSeveralPrimeKeyFields()
+ {
+ boolean bdoEnable = (this.optUseSeveral.getState());
+ curPrimaryKeySelection.toggleListboxControls(new Boolean(bdoEnable));
+ }
+
+ 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 null;
+ }
+
+ public int getID()
+ {
+ return 0;
+ }
+
+ public void moveItemDown(String Selitem)
+ {
+ }
+
+ public void moveItemUp(String Selitem)
+ {
+ }
+
+ public void setID(String sIncSuffix)
+ {
+ }
+
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, (curPrimaryKeySelection.getSelectedFieldNames().length > 0));
+ }
+
+ 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
new file mode 100644
index 000000000000..4f985c18e055
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
@@ -0,0 +1,385 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import java.util.Vector;
+
+import com.sun.star.awt.ItemEvent;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XItemListener;
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.db.TableDescriptor;
+import com.sun.star.wizards.ui.FieldSelection;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+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
+{
+ final static int PRIVATE = 0;
+ final static int BUSINESS = 1;
+
+ private XFixedText lblExplanation;
+ private XFixedText lblCategories;
+ private XRadioButton optBusiness;
+ private XRadioButton optPrivate;
+ private XListBox xTableListBox;
+ private TableWizard CurTableWizardUnoDialog;
+ private TableDescriptor curtabledescriptor;
+ private CGCategory oCGCategory;
+ protected CGTable oCGTable;
+ private String SELECTCATEGORY = "selectCategory";
+ private int curcategory;
+ protected boolean bcolumnnameislimited;
+ private int imaxcolumnchars;
+ private String smytable;
+ private Locale aLocale;
+ private XMultiServiceFactory xMSF;
+
+ public ScenarioSelector(TableWizard _CurUnoDialog, TableDescriptor _curtabledescriptor, String _reslblFields, String _reslblSelFields)
+ {
+ super(_CurUnoDialog, TableWizard.SOMAINPAGE, 91, 108, 230, 80, _reslblFields, _reslblSelFields, 41209, true);
+ CurTableWizardUnoDialog = _CurUnoDialog;
+ xMSF = CurUnoDialog.xMSF;
+ aLocale = Configuration.getOfficeLocale(xMSF);
+ curtabledescriptor = _curtabledescriptor;
+ imaxcolumnchars = this.curtabledescriptor.getMaxColumnNameLength();
+ bcolumnnameislimited = (imaxcolumnchars > 0) && (imaxcolumnchars < 16);
+ 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 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)
+ });
+
+ 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)
+ });
+
+ optBusiness = CurTableWizardUnoDialog.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)
+ });
+
+ optPrivate = CurTableWizardUnoDialog.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)
+ });
+
+ 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
+ {
+ 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(UnoDialog.getListBoxLineCount()), new Integer(91), new Integer(92), IMAINSTEP, new Short(pretabindex++), getListboxWidth()
+ });
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ initializeCategory(BUSINESS);
+ }
+
+ public void selectCategory()
+ {
+ if (optBusiness.getState())
+ {
+ initializeCategory(BUSINESS);
+ }
+ else
+ {
+ initializeCategory(PRIVATE);
+ }
+ }
+
+ public void initializeCategory(int _iCategory)
+ {
+ try
+ {
+ oCGCategory.initialize(
+ _iCategory == PRIVATE ? "private" : "business");
+ 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
+ });
+ oCGTable.initialize(oCGCategory.xNameAccessTablesNode, _iTable);
+ super.initialize(oCGTable.getFieldNames(bcolumnnameislimited, imaxcolumnchars), true);
+ }
+
+ public String[] getSelectedFieldNames()
+ {
+ String[] displayfieldnames = super.getSelectedFieldNames();
+ Vector<String> afieldnameVector = new Vector<String>();
+ int a = 0;
+ for (int i = 0; i < displayfieldnames.length; i++)
+ {
+ try
+ {
+ FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(displayfieldnames[i]);
+ if (ofielddescription != null)
+ {
+ afieldnameVector.addElement(ofielddescription.getName());
+ a++;
+ }
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ String[] fieldnames = new String[a];
+ afieldnameVector.toArray(fieldnames);
+ return fieldnames;
+ }
+
+ public boolean iscompleted()
+ {
+ return getSelectedFieldNames().length > 0;
+ }
+
+ public void addColumnsToDescriptor()
+ {
+ XNameAccess xNameAccessFieldNode;
+ String[] fieldnames = getSelectedFieldNames();
+ for (int i = 0; i < fieldnames.length; i++)
+ {
+ try
+ {
+ FieldDescription curfielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(fieldnames[i]);
+ PropertyValue[] aProperties = curfielddescription.getPropertyValues();
+ this.curtabledescriptor.addColumn(aProperties);
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+ }
+
+ public String getTableName()
+ {
+ return xTableListBox.getSelectedItem();
+ }
+
+ public String getFirstTableName()
+ {
+ String[] fieldnames = super.getSelectedFieldNames();
+ if ((fieldnames.length) > 0)
+ {
+ for (int i = 0; i < CurTableWizardUnoDialog.fielditems.size(); i++)
+ {
+ String stablename = "";
+ try
+ {
+ FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(fieldnames[i]);
+ stablename = ofielddescription.gettablename();
+ }
+ catch (RuntimeException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ if (!stablename.equals(""))
+ {
+ return stablename;
+ }
+ }
+ }
+ return smytable;
+ }
+
+ public void fillupTables()
+ {
+// if (optBusiness.getState())
+// else
+ }
+
+ public void fillupFieldsListbox()
+ {
+ super.emptyFieldsListBoxes();
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.sun.star.awt.XItemListener#itemStateChanged(com.sun.star.awt.ItemEvent)
+ */
+ 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)
+ {
+ }
+ protected int ID;
+
+ public int getID()
+ {
+ return ID;
+ }
+
+ public void setID(String sIncSuffix)
+ {
+ }
+
+ public void shiftFromLeftToRight(String[] SelItems, String[] NewItems)
+ {
+ if (!CurTableWizardUnoDialog.verifyfieldcount(NewItems.length))
+ {
+ for (int i = 0; i < SelItems.length; i++)
+ {
+ int selindex = JavaTools.FieldInList(NewItems, SelItems[i]);
+ super.xSelectedFieldsListBox.removeItems((short) selindex, (short) 1);
+ /**TODO In this context the items should be better placed at their original position.
+ * but how is this position retrieved?
+ */
+ super.xFieldsListBox.addItem(SelItems[i], xFieldsListBox.getItemCount());
+ }
+ }
+ else
+ {
+ for (int i = 0; i < NewItems.length; i++)
+ {
+ int iduplicate;
+ if (CurTableWizardUnoDialog.fielditems.containsKey(NewItems[i]))
+ {
+ iduplicate = JavaTools.getDuplicateFieldIndex(NewItems, NewItems[i]);
+ if (iduplicate != -1)
+ {
+ XNameAccess xNameAccessFieldNode;
+ String sdisplayname = Desktop.getUniqueName(NewItems, NewItems[iduplicate], "");
+ FieldDescription curfielddescription = new FieldDescription(xMSF, aLocale, this, sdisplayname, NewItems[iduplicate], imaxcolumnchars);
+ CurTableWizardUnoDialog.fielditems.put(sdisplayname, curfielddescription);
+ NewItems[iduplicate] = sdisplayname;
+ setSelectedFieldNames(NewItems);
+ }
+ }
+ else
+ {
+ CurTableWizardUnoDialog.fielditems.put(NewItems[i], new FieldDescription(xMSF, aLocale, this, NewItems[i], NewItems[i], imaxcolumnchars));
+ }
+ }
+ }
+ CurTableWizardUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0);
+ }
+
+ public void shiftFromRightToLeft(String[] SelItems, String[] NewItems)
+ {
+ for (int i = 0; i < SelItems.length; i++)
+ {
+ if (CurTableWizardUnoDialog.fielditems.containsKey(SelItems[i]))
+ {
+ CurTableWizardUnoDialog.fielditems.remove(SelItems[i]);
+ this.curtabledescriptor.dropColumnbyName(SelItems[i]);
+ }
+ }
+ CurTableWizardUnoDialog.setcompleted(TableWizard.SOMAINPAGE, NewItems.length > 0);
+ }
+
+ public void moveItemDown(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
new file mode 100644
index 000000000000..1444cc946675
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/TableWizard.java
@@ -0,0 +1,438 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+import java.util.Hashtable;
+
+import com.sun.star.awt.TextEvent;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XTextListener;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sdb.CommandType;
+import com.sun.star.sdb.application.DatabaseObject;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.task.XJobExecutor;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.db.DatabaseObjectWizard;
+import com.sun.star.wizards.db.TableDescriptor;
+import com.sun.star.wizards.ui.*;
+
+public class TableWizard extends DatabaseObjectWizard implements XTextListener, XCompletion
+{
+
+ static String slblFields;
+ static String slblSelFields;
+ Finalizer curFinalizer;
+ ScenarioSelector curScenarioSelector;
+ FieldFormatter curFieldFormatter;
+ PrimaryKeyHandler curPrimaryKeyHandler;
+ String sMsgWizardName = "";
+ public Hashtable fielditems;
+ int wizardmode;
+ String tablename;
+ String serrToManyFields;
+ String serrTableNameexists;
+ String scomposedtablename;
+ TableDescriptor curTableDescriptor;
+ public static final int SONULLPAGE = 0;
+ public static final int SOMAINPAGE = 1;
+ public static final int SOFIELDSFORMATPAGE = 2;
+ public static final int SOPRIMARYKEYPAGE = 3;
+ public static final int SOFINALPAGE = 4;
+ private String sMsgColumnAlreadyExists = "";
+ String WizardHeaderText[] = new String[8];
+
+ private String m_tableName;
+
+ public TableWizard( XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext )
+ {
+ super( xMSF, 41200, i_wizardContext );
+ 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)
+ });
+ 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)
+ {
+ case SOMAINPAGE:
+ curScenarioSelector.addColumnsToDescriptor();
+ break;
+ case SOFIELDSFORMATPAGE:
+ curFieldFormatter.updateColumnofColumnDescriptor();
+ String[] sfieldnames = curFieldFormatter.getFieldNames();
+ super.setStepEnabled(SOFIELDSFORMATPAGE, sfieldnames.length > 0);
+ curScenarioSelector.setSelectedFieldNames(sfieldnames);
+ break;
+ case SOPRIMARYKEYPAGE:
+ break;
+ case SOFINALPAGE:
+ break;
+ default:
+ break;
+ }
+ }
+
+ protected void enterStep(int nOldStep, int nNewStep)
+ {
+ switch (nNewStep)
+ {
+ case SOMAINPAGE:
+ break;
+ case SOFIELDSFORMATPAGE:
+ curFieldFormatter.initialize(curTableDescriptor, this.curScenarioSelector.getSelectedFieldNames());
+ break;
+ case SOPRIMARYKEYPAGE:
+ curPrimaryKeyHandler.initialize();
+ break;
+ case SOFINALPAGE:
+ curFinalizer.initialize(curScenarioSelector.getFirstTableName());
+ break;
+ default:
+ break;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.XCompletion#iscompleted(int)
+ */
+ 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:
+ return false;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean)
+ */
+ 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)
+ {
+ 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)
+ {
+ super.setStepEnabled(SOFIELDSFORMATPAGE, true);
+ super.setStepEnabled(SOPRIMARYKEYPAGE, true);
+ if (bPrimaryKeysiscompleted)
+ {
+ super.enablefromStep(SOFINALPAGE, true);
+ super.enableFinishButton(bFinalPageiscompleted);
+ }
+ else
+ {
+ super.enablefromStep(SOFINALPAGE, false);
+ enableNextButton(false);
+ }
+ }
+ else if (_ndialogpage == SOFIELDSFORMATPAGE)
+ {
+ super.enablefromStep(super.getCurrentStep() + 1, iscompleted(SOFIELDSFORMATPAGE));
+ }
+ else
+ {
+ 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);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+*/
+ public void buildSteps()
+ {
+ curScenarioSelector = new ScenarioSelector(this, this.curTableDescriptor, slblFields, slblSelFields);
+ curFieldFormatter = new FieldFormatter(this, curTableDescriptor);
+ if ( this.curTableDescriptor.supportsPrimaryKeys() )
+ {
+ curPrimaryKeyHandler = new PrimaryKeyHandler(this, curTableDescriptor);
+ }
+ curFinalizer = new Finalizer(this, curTableDescriptor);
+ enableNavigationButtons(false, false, false);
+ }
+
+ public boolean createTable()
+ {
+ boolean bIsSuccessfull = true;
+ boolean bTableCreated = false;
+ String schemaname = curFinalizer.getSchemaName();
+ String catalogname = curFinalizer.getCatalogName();
+ if (curTableDescriptor.supportsPrimaryKeys())
+ {
+ String[] keyfieldnames = curPrimaryKeyHandler.getPrimaryKeyFields(curTableDescriptor);
+ 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)
+ {
+ bIsSuccessfull = curTableDescriptor.createTable(catalogname, schemaname, tablename, curScenarioSelector.getSelectedFieldNames());
+ }
+ if ((!bIsSuccessfull) && (curPrimaryKeyHandler.isAutomaticMode()))
+ {
+ curTableDescriptor.dropColumnbyName(curPrimaryKeyHandler.getAutomaticFieldName());
+ }
+ return bIsSuccessfull;
+ }
+
+ public boolean 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.length() > 0 )
+ {
+ if (!curTableDescriptor.hasTableByName(scomposedtablename))
+ {
+ wizardmode = curFinalizer.finish();
+ if (createTable())
+ {
+ final boolean editTableDesign = (wizardmode == Finalizer.MODIFYTABLEMODE );
+ loadSubComponent( DatabaseObject.TABLE, curTableDescriptor.getComposedTableName(), editTableDesign );
+ m_tableName = curTableDescriptor.getComposedTableName();
+ super.xDialog.endExecute();
+ return true;
+ }
+ }
+ else
+ {
+ String smessage = JavaTools.replaceSubString(serrTableNameexists, tablename, "%TABLENAME");
+ super.showMessageBox("WarningBox", com.sun.star.awt.VclWindowPeerAttribute.OK, smessage);
+ curFinalizer.setFocusToTableNameControl();
+ }
+ }
+ return false;
+ }
+
+ private void callFormWizard()
+ {
+ try
+ {
+ Object oFormWizard = this.xMSF.createInstance("com.sun.star.wizards.form.CallFormWizard");
+
+ NamedValueCollection wizardContext = new NamedValueCollection();
+ wizardContext.put( "ActiveConnection", curTableDescriptor.DBConnection );
+ wizardContext.put( "DataSource", curTableDescriptor.getDataSource() );
+ wizardContext.put( "CommandType", CommandType.TABLE );
+ wizardContext.put( "Command", scomposedtablename );
+ wizardContext.put( "DocumentUI", m_docUI );
+ XInitialization xInitialization = UnoRuntime.queryInterface( XInitialization.class, oFormWizard );
+ xInitialization.initialize( wizardContext.getPropertyValues() );
+ XJobExecutor xJobExecutor = UnoRuntime.queryInterface( XJobExecutor.class, oFormWizard );
+ xJobExecutor.trigger("start");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void cancelWizard()
+ {
+ xDialog.endExecute();
+ }
+
+ 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.supportsPrimaryKeys())
+ {
+ 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
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ }
+
+ public String startTableWizard( )
+ {
+ try
+ {
+ curTableDescriptor = new TableDescriptor(xMSF, super.xWindow, this.sMsgColumnAlreadyExists);
+ if ( curTableDescriptor.getConnection( m_wizardContext ) )
+ {
+ buildSteps();
+ createWindowPeer();
+ curTableDescriptor.setWindowPeer(this.xControl.getPeer());
+ insertFormRelatedSteps();
+ short RetValue = executeDialog();
+ xComponent.dispose();
+ if ( RetValue == 0 )
+ {
+ if ( wizardmode == Finalizer.STARTFORMWIZARDMODE )
+ callFormWizard();
+ return m_tableName;
+ }
+ }
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ return "";
+ }
+
+ 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);
+ 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;
+ }
+ }
+ 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())
+ {
+ 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/makefile.mk b/wizards/com/sun/star/wizards/table/makefile.mk
new file mode 100644
index 000000000000..c0d62baa7cac
--- /dev/null
+++ b/wizards/com/sun/star/wizards/table/makefile.mk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = table
+PACKAGE = com$/sun$/star$/wizards$/table
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar commonwizards.jar
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/table
+JARTARGET = $(TARGET).jar
+JARCLASSPATH = commonwizards.jar
+
+# --- Files --------------------------------------------------------
+#SRS2NAME = dbwizres
+#SRC2FILES= dbwizres.src
+#RESLIB2SRSFILES= $(SRS)$/dbwizres.srs
+#RESLIB2NAME= dbw
+
+JAVAFILES= \
+ CallTableWizard.java \
+ Finalizer.java \
+ FieldDescription.java \
+ CGCategory.java \
+ CGTable.java \
+ FieldFormatter.java \
+ PrimaryKeyHandler.java \
+ ScenarioSelector.java \
+ TableWizard.java \
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java
new file mode 100644
index 000000000000..4fe2e9f0d710
--- /dev/null
+++ b/wizards/com/sun/star/wizards/text/TextDocument.java
@@ -0,0 +1,483 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.document.XDocumentProperties;
+import com.sun.star.document.XDocumentPropertiesSupplier;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFramesSupplier;
+import com.sun.star.frame.XLoadable;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XModule;
+import com.sun.star.frame.XTerminateListener;
+import com.sun.star.frame.XStorable;
+import com.sun.star.i18n.NumberFormatIndex;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.PropertyVetoException;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.task.XStatusIndicatorFactory;
+import com.sun.star.text.XPageCursor;
+import com.sun.star.text.XSimpleText;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextViewCursor;
+import com.sun.star.text.XTextViewCursorSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.DateTime;
+import com.sun.star.util.XModifiable;
+import com.sun.star.util.XNumberFormatsSupplier;
+import com.sun.star.util.XRefreshable;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.Helper.DateUtils;
+import com.sun.star.wizards.document.OfficeDocument;
+
+public class TextDocument
+{
+
+ public XComponent xComponent;
+ public com.sun.star.text.XTextDocument xTextDocument;
+ public com.sun.star.util.XNumberFormats NumberFormats;
+ public com.sun.star.document.XDocumentProperties m_xDocProps;
+ public com.sun.star.task.XStatusIndicator xProgressBar;
+ public com.sun.star.frame.XFrame xFrame;
+ public XText xText;
+ public XMultiServiceFactory xMSFDoc;
+ public XMultiServiceFactory xMSF;
+ public com.sun.star.util.XNumberFormatsSupplier xNumberFormatsSupplier;
+ public com.sun.star.awt.XWindowPeer xWindowPeer;
+ public int PageWidth;
+ public int ScaleWidth;
+ public Size DocSize;
+ public com.sun.star.awt.Rectangle PosSize;
+ public com.sun.star.lang.Locale CharLocale;
+ 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)
+ {
+ 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)
+ {
+ this.xMSF = xMSF;
+
+ xFrame = OfficeDocument.createNewFrame(xMSF, listener);
+ xTextDocument = loadAsPreview(_sPreviewURL, true);
+ xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+
+ if (bShowStatusIndicator)
+ {
+ showStatusIndicator();
+ }
+ init();
+ }
+
+ // creates an instance of TextDocument from the desktop's current frame
+ public TextDocument(XMultiServiceFactory xMSF, boolean bShowStatusIndicator, XTerminateListener listener)
+ {
+ this.xMSF = xMSF;
+
+ XDesktop xDesktop = Desktop.getDesktop(xMSF);
+ XFramesSupplier xFrameSupplier = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
+ xFrame = xFrameSupplier.getActiveFrame();
+ xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
+ xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+
+ if (bShowStatusIndicator)
+ {
+ showStatusIndicator();
+ }
+ init();
+ }
+
+ public static class ModuleIdentifier
+ {
+
+ private String m_identifier;
+
+ protected final String getIdentifier()
+ {
+ return m_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)
+ {
+ 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"));
+
+ XLoadable xLoadable = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, xTextDocument);
+ xLoadable.initNew();
+
+ 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);
+ PropertyValue[] loadArgs = new PropertyValue[]
+ {
+ new PropertyValue("Model", -1, xTextDocument, com.sun.star.beans.PropertyState.DIRECT_VALUE)
+ };
+ xLoader.loadComponentFromURL("private:object", "_blank", 0, loadArgs);
+
+ // remember some things for later usage
+ xFrame = xTextDocument.getCurrentController().getFrame();
+ xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ }
+ 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)
+ {
+ this.xMSF = xMSF;
+ xFrame = _textDocument.getCurrentController().getFrame();
+ xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _textDocument);
+ xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ //PosSize = xFrame.getComponentWindow().getPosSize();
+ if (bshowStatusIndicator)
+ {
+ XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
+ xProgressBar = xStatusIndicatorFactory.createStatusIndicator();
+ xProgressBar.start("", 100);
+ xProgressBar.setValue(5);
+ }
+ xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
+ xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+
+ XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ m_xDocProps = xDocPropsSuppl.getDocumentProperties();
+ CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale");
+ xText = xTextDocument.getText();
+ }
+
+ 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);
+ XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ m_xDocProps = xDocPropsSuppl.getDocumentProperties();
+ CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale");
+ xStorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ xText = xTextDocument.getText();
+ }
+
+ 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)
+ {
+ PropertyValue loadValues[] = new PropertyValue[3];
+ // open document in the Preview mode
+ loadValues[0] = new PropertyValue();
+ loadValues[0].Name = "ReadOnly";
+ loadValues[0].Value = Boolean.TRUE;
+ loadValues[1] = new PropertyValue();
+ loadValues[1].Name = "AsTemplate";
+ loadValues[1].Value = asTemplate ? Boolean.TRUE : Boolean.FALSE;
+ loadValues[2] = new PropertyValue();
+ loadValues[2].Name = "Preview";
+ 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
+ {
+ XModifiable xModi = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xTextDocument);
+ xModi.setModified(false);
+ }
+ catch (PropertyVetoException e1)
+ {
+ e1.printStackTrace(System.out);
+ }
+ }
+ Object oDoc = OfficeDocument.load(xFrame, sDefaultTemplate, "_self", loadValues);
+ xTextDocument = (com.sun.star.text.XTextDocument) oDoc;
+ DocSize = getPageSize();
+ xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+
+ ViewHandler myViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
+ try
+ {
+ myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
+ myFieldHandler.updateDocInfoFields();
+
+ return xTextDocument;
+
+ }
+
+ 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();
+ com.sun.star.container.XNameContainer xPageStyleCollection = null;
+ xPageStyleCollection = (com.sun.star.container.XNameContainer) UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles"));
+ XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName("First Page"));
+ return (Size) Helper.getUnoPropertyValue(xPageStyle, "Size");
+
+ }
+ 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)
+ {
+ this.xMSF = xMSF;
+ XDesktop xDesktop = Desktop.getDesktop(xMSF);
+
+ xFrame = OfficeDocument.createNewFrame(xMSF, listener);
+ Object oDoc = OfficeDocument.load(xFrame, URL, "_self", xArgs);
+ xTextDocument = (XTextDocument) oDoc;
+ xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ XWindow xWindow = xFrame.getComponentWindow();
+
+ xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
+ xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xNumberFormatsSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+
+ XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ m_xDocProps = xDocPropsSuppl.getDocumentProperties();
+ CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale");
+ }
+
+ public static XTextCursor createTextCursor(Object oCursorContainer)
+ {
+ XSimpleText xText = (XSimpleText) UnoRuntime.queryInterface(XSimpleText.class, oCursorContainer);
+ XTextCursor xTextCursor = xText.createTextCursor();
+ return xTextCursor;
+ }
+
+ // Todo: This method is unsecure because the last index is not necessarily the last section
+
+ // Todo: This Routine should be modified, because I cannot rely on the last Table in the document to be the last in the TextTables sequence
+ // to make it really safe you must acquire the Tablenames before the insertion and after the insertion of the new Table. By comparing the
+ // 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)
+ {
+ int iScale = 200;
+ xTextDocument.lockControllers();
+ int iScaleLen = ScaleString.length();
+ com.sun.star.text.XTextCursor xTextCursor = createTextCursor(xTextDocument.getText());
+ xTextCursor.gotoStart(false);
+ com.sun.star.wizards.common.Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
+ xTextCursor.setString(ScaleString);
+ XTextViewCursorSupplier xViewCursor = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
+ XTextViewCursor xTextViewCursor = xViewCursor.getViewCursor();
+ xTextViewCursor.gotoStart(false);
+ int iFirstPos = xTextViewCursor.getPosition().X;
+ xTextViewCursor.gotoEnd(false);
+ int iLastPos = xTextViewCursor.getPosition().X;
+ iScale = (iLastPos - iFirstPos) / iScaleLen;
+ xTextCursor.gotoStart(false);
+ xTextCursor.gotoEnd(true);
+ xTextCursor.setString("");
+ unlockallControllers();
+ return iScale;
+ }
+
+ public void unlockallControllers()
+ {
+ while (xTextDocument.hasControllersLocked() == true)
+ {
+ xTextDocument.unlockControllers();
+ }
+ }
+
+ public void refresh()
+ {
+ XRefreshable xRefreshable = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, xTextDocument);
+ xRefreshable.refresh();
+ }
+
+ /**
+ * This method sets the Author of a Wizard-generated template correctly
+ * and adds a explanatory sentence to the template description.
+ * @param WizardName The name of the Wizard.
+ * @param TemplateDescription The old Description which is being appended with another sentence.
+ * @return void.
+ */
+ 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;
+
+ 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;
+ DateUtils du = new DateUtils(xMSF, this.xTextDocument);
+ int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY);
+ String myDate = du.format(ff, currentDate);
+
+ XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentProperties xDocProps2 = xDocPropsSuppl.getDocumentProperties();
+ xDocProps2.setAuthor(fullname);
+ xDocProps2.setModifiedBy(fullname);
+ String description = xDocProps2.getDescription();
+ description = description + " " + TemplateDescription;
+ description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>");
+ description = JavaTools.replaceSubString(description, myDate, "<current_date>");
+ xDocProps2.setDescription(description);
+ }
+ catch (NoSuchElementException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (WrappedTargetException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ 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
+ {
+ XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextContent);
+ xText.removeTextContent(xTextContent);
+ return true;
+ }
+ catch (NoSuchElementException e)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ /**
+ * Apparently there is no other way to get the
+ * page count of a text document other than using a cursor and
+ * making it jump to the last page...
+ * @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);
+ XController xController = xModel.getCurrentController();
+ XTextViewCursorSupplier xTextVCS = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
+ XTextViewCursor xTextVC = xTextVCS.getViewCursor();
+ XPageCursor xPC = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class, xTextVC);
+ xPC.jumpToLastPage();
+ return xPC.getPage();
+ }
+
+ /* Possible Values for "OptionString" are: "LoadCellStyles", "LoadTextStyles", "LoadFrameStyles",
+ "LoadPageStyles", "LoadNumberingStyles", "OverwriteStyles" */
+}
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
new file mode 100644
index 000000000000..5d8c677c621e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
@@ -0,0 +1,348 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Vector;
+
+import com.sun.star.text.XDependentTextField;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextFieldsSupplier;
+import com.sun.star.text.XTextRange;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.DateTime;
+import com.sun.star.util.XRefreshable;
+import com.sun.star.util.XUpdatable;
+import com.sun.star.wizards.common.Helper;
+
+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)
+ {
+ 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)
+ {
+ try
+ {
+ XTextRange xTextRange = xTextCursor.getEnd();
+ Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
+ if (com.sun.star.uno.AnyConverter.isVoid(oTextField))
+ {
+ return "";
+ }
+ else
+ {
+ XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
+ XPropertySet xMaster = xDependent.getTextFieldMaster();
+ String UserFieldContent = (String) xMaster.getPropertyValue("Content");
+ return UserFieldContent;
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return "";
+ }
+
+ public void insertUserField(XTextCursor xTextCursor, String FieldName, String FieldTitle)
+ {
+ try
+ {
+ XInterface xField = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextField.User");
+ XDependentTextField xDepField = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, xField);
+ XTextContent xFieldContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xField);
+ if (xTextFieldsSupplier.getTextFieldMasters().hasByName("com.sun.star.text.FieldMaster.User." + FieldName))
+ {
+ Object oMaster = xTextFieldsSupplier.getTextFieldMasters().getByName("com.sun.star.text.FieldMaster.User." + FieldName);
+ XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, oMaster);
+ xComponent.dispose();
+ }
+ XPropertySet xPSet = createUserField(FieldName, FieldTitle);
+ xDepField.attachTextFieldMaster(xPSet);
+ xTextCursor.getText().insertTextContent(xTextCursor, xFieldContent, false);
+
+// try
+// {
+// XPropertySet xTestProp = xDepField.getTextFieldMaster();
+// String UserFieldName = (String) xTestProp.getPropertyValue("Name");
+// // UserFieldName == FieldName?
+// int dummy = 0;
+// }
+// catch (com.sun.star.uno.Exception e)
+// {
+// int dummy2 = 0;
+// }
+
+ }
+ 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");
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oMaster);
+ xPSet.setPropertyValue("Name", FieldName);
+ xPSet.setPropertyValue("Content", FieldTitle);
+
+ // DEBUG
+ // String sFieldName = (String)xPSet.getPropertyValue("Name");
+
+ return xPSet;
+ }
+
+ private XDependentTextField[] getTextFieldsByProperty(String _PropertyName, Object _aPropertyValue, String _TypeName) throws Exception
+ {
+ try
+ {
+ XDependentTextField[] xDependentFields;
+ Vector xDependentVector = new Vector();
+ if (xTextFieldsSupplier.getTextFields().hasElements())
+ {
+ XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
+ while (xEnum.hasMoreElements())
+ {
+ 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))
+ {
+ if (_TypeName.equals("String"))
+ {
+ String sValue = AnyConverter.toString(oValue);
+ if (sValue.equals(_aPropertyValue))
+ {
+ 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)
+ {
+ xDependentVector.addElement(xDependent);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (xDependentVector.size() > 0)
+ {
+ xDependentFields = new XDependentTextField[xDependentVector.size()];
+ xDependentVector.toArray(xDependentFields);
+ return xDependentFields;
+ }
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace(System.out);
+ }
+ return null;
+ }
+
+ public void changeUserFieldContent(String _FieldName, String _FieldContent)
+ {
+ try
+ {
+ XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Name", _FieldName, "String");
+ if (xDependentTextFields != null)
+ {
+ for (int i = 0; i < xDependentTextFields.length; i++)
+ {
+ xDependentTextFields[i].getTextFieldMaster().setPropertyValue("Content", _FieldContent);
+ }
+ refreshTextFields();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void updateDocInfoFields()
+ {
+ 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.ExtendedUser"))
+ {
+ XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
+ xUp.update();
+ }
+ if (xSI.supportsService("com.sun.star.text.TextField.User"))
+ {
+ XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
+ xUp.update();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void updateDateFields()
+ {
+ try
+ {
+ XEnumeration xEnum = xTextFieldsSupplier.getTextFields().createEnumeration();
+ Calendar cal = new GregorianCalendar();
+ DateTime dt = new DateTime();
+ dt.Day = (short) cal.get(Calendar.DAY_OF_MONTH);
+ dt.Year = (short) cal.get(Calendar.YEAR);
+ dt.Month = (short) cal.get(Calendar.MONTH);
+ dt.Month++;
+
+ 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", Boolean.FALSE);
+ xPSet.setPropertyValue("DateTimeValue", dt);
+ }
+ }
+ }
+ 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));
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void removeUserFieldByContent(String _FieldContent)
+ {
+ try
+ {
+ XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("Content", _FieldContent, "String");
+ if (xDependentTextFields != null)
+ {
+ for (int i = 0; i < xDependentTextFields.length; i++)
+ {
+ xDependentTextFields[i].dispose();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void changeExtendedUserFieldContent(short UserDataPart, String _FieldContent)
+ {
+ try
+ {
+ XDependentTextField[] xDependentTextFields = getTextFieldsByProperty("UserDataType", new Short(UserDataPart), "Short");
+ if (xDependentTextFields != null)
+ {
+ for (int i = 0; i < xDependentTextFields.length; i++)
+ {
+ xDependentTextFields[i].getTextFieldMaster().setPropertyValue("Content", _FieldContent);
+ }
+ }
+ refreshTextFields();
+ }
+ 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
new file mode 100644
index 000000000000..562444a1ad84
--- /dev/null
+++ b/wizards/com/sun/star/wizards/text/TextFrameHandler.java
@@ -0,0 +1,51 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextFrame;
+import com.sun.star.text.XTextFramesSupplier;
+import com.sun.star.uno.UnoRuntime;
+
+public class TextFrameHandler
+{
+
+ public static XTextFrame getFrameByName(String sFrameName, XTextDocument xTD) throws NoSuchElementException, WrappedTargetException
+ {
+ XTextFramesSupplier xFrameSupplier = (XTextFramesSupplier) UnoRuntime.queryInterface(XTextFramesSupplier.class, xTD);
+ 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
new file mode 100644
index 000000000000..42fd75879c3c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.text.ControlCharacter;
+import com.sun.star.text.SectionFileLink;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextSectionsSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+
+public class TextSectionHandler
+{
+
+ public XTextSectionsSupplier xTextSectionsSupplier;
+ private XMultiServiceFactory xMSFDoc;
+ private XTextDocument xTextDocument;
+ private XText xText;
+
+ /** Creates a new instance of TextSectionHandler */
+ 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
+ {
+ XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections();
+ if (xAllTextSections.hasByName(SectionName) == true)
+ {
+ Object oTextSection = xTextSectionsSupplier.getTextSections().getByName(SectionName);
+ removeTextSection(oTextSection);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public boolean hasTextSectionByName(String SectionName)
+ {
+ com.sun.star.container.XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections();
+ return xAllTextSections.hasByName(SectionName);
+ }
+
+ 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)
+ {
+ 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);
+ }
+ }
+ }
+ 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
+ {
+ 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++)
+ {
+ oTextSection = xAllTextSections.getByIndex(i);
+ Helper.setUnoPropertyValues(oTextSection, new String[]
+ {
+ "FileLink", "LinkRegion"
+ }, new Object[]
+ {
+ oSectionLink, ""
+ });
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void breakLinkOfTextSection(Object oTextSection)
+ {
+ SectionFileLink oSectionLink = new SectionFileLink();
+ oSectionLink.FileURL = "";
+ Helper.setUnoPropertyValues(oTextSection, new String[]
+ {
+ "FileLink", "LinkRegion"
+ }, new Object[]
+ {
+ oSectionLink, ""
+ });
+ }
+
+ public void linkSectiontoTemplate(String TemplateName, String SectionName)
+ {
+ try
+ {
+ Object oTextSection = xTextSectionsSupplier.getTextSections().getByName(SectionName);
+ linkSectiontoTemplate(oTextSection, TemplateName, SectionName);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ 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
+ });
+ 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);
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ public void insertTextSection(String sectionName, String templateName, XTextCursor position)
+ {
+ try
+ {
+ Object xTextSection;
+ if (xTextSectionsSupplier.getTextSections().hasByName(sectionName) == true)
+ {
+ xTextSection = xTextSectionsSupplier.getTextSections().getByName(sectionName);
+ }
+ else
+ {
+ xTextSection = xMSFDoc.createInstance("com.sun.star.text.TextSection");
+ XTextContent xTextContentSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
+ position.getText().insertTextContent(position, xTextContentSection, false);
+ }
+ linkSectiontoTemplate(xTextSection, templateName, sectionName);
+ }
+ 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
new file mode 100644
index 000000000000..e6c952e65785
--- /dev/null
+++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.awt.Size;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.style.XStyleLoader;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+
+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)
+ {
+ this.xMSFDoc = xMSF;
+ this.xTextDocument = xTextDocument;
+ xStyleFamiliesSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ }
+
+ 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++)
+ {
+ CurOptionName = StyleOptions[i].Name;
+ StyleOptions[i].Value = new Boolean((CurOptionName.compareTo(OptionString) == 0) || (CurOptionName.compareTo("OverwriteStyles") == 0));
+ }
+ xStyleLoader.loadStylesFromURL(sTemplateUrl, StyleOptions);
+ }
+ 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 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)
+ {
+ 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
new file mode 100644
index 000000000000..d3646a7cfa37
--- /dev/null
+++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.frame.XFrame;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.BreakType;
+import com.sun.star.table.XCellRange;
+import com.sun.star.text.XSimpleText;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextTable;
+import com.sun.star.text.XTextTablesSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XNumberFormatsSupplier;
+import com.sun.star.view.XSelectionSupplier;
+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 XTextTablesSupplier xTextTablesSupplier;
+ public XMultiServiceFactory xMSFDoc;
+ public XTextDocument xTextDocument;
+ public XSimpleText xSimpleText;
+ private XText xText;
+ 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 NumberFormatter getNumberFormatter()
+ {
+ return oNumberFormatter;
+ }
+
+ 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);
+ }
+ return xTextTable;
+ }
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ 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)
+ {
+ xTextCursor = xTextDocument.getText().createTextCursor();
+ xTextCursor.gotoEnd(false);
+ }
+ xTextCursor.getText().insertTextContent(xTextCursor, xTextContentTable, false);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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--)
+ {
+ removeTextTable(xAllTextTables.getByIndex(i));
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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)
+ {
+ 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
+ {
+ XNameAccess xAllTextTables = xTextTablesSupplier.getTextTables();
+ if (xAllTextTables.hasByName(TableName) == true)
+ {
+ removeTextTable(xAllTextTables.getByName(TableName));
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void renameTextTable(String OldTableName, String NewTableName)
+ {
+ try
+ {
+ XNameAccess xTextTableNames = xTextTablesSupplier.getTextTables();
+ if (xTextTableNames.hasByName(OldTableName))
+ {
+ Object oTextTable = xTextTableNames.getByName(OldTableName);
+ XNamed xTextTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextTable);
+ xTextTableName.setName(NewTableName);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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){
+ // CorrBreakValue = BreakValue;
+ Helper.setUnoPropertyValue(oTextTable, "BreakType", BreakType.NONE);
+ // }
+ 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));
+ }
+ 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
new file mode 100644
index 000000000000..e29ad10cfbb1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/text/ViewHandler.java
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.beans.PropertyVetoException;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.text.XPageCursor;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.text.XTextRange;
+import com.sun.star.text.XTextViewCursor;
+import com.sun.star.text.XTextViewCursorSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.view.XViewSettingsSupplier;
+import com.sun.star.wizards.common.Helper;
+
+public class ViewHandler
+{
+
+ private XTextViewCursorSupplier xTextViewCursorSupplier;
+ private XMultiServiceFactory xMSFDoc;
+ private XTextDocument xTextDocument;
+ private XStyleFamiliesSupplier xStyleFamiliesSupplier;
+ private XViewSettingsSupplier xViewSettingsSupplier;
+
+ /** Creates a new instance of View */
+ public ViewHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
+ {
+ this.xMSFDoc = xMSF;
+ this.xTextDocument = xTextDocument;
+ xTextViewCursorSupplier = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
+ xViewSettingsSupplier = (XViewSettingsSupplier) UnoRuntime.queryInterface(XViewSettingsSupplier.class, xTextDocument.getCurrentController());
+ xStyleFamiliesSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ }
+
+ 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();
+ xPageCursor.jumpToStartOfPage();
+ Helper.setUnoPropertyValue(xPageCursor, "PageDescName", "First Page");
+ Object oPageStyles = xStyleFamiliesSupplier.getStyleFamilies().getByName("PageStyles");
+ XNameAccess xName = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oPageStyles);
+ Object oPageStyle = xName.getByName("First Page");
+ XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
+ XTextContent xTextTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xAllTextTables.getByIndex(0));
+ XTextRange xRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xTextTable.getAnchor().getText());
+ xViewTextCursor.gotoRange(xRange, false);
+// if (xPageCursor.getPage() == (short) 1) {
+// Helper.setUnoPropertyValue(xTextTable, "PageDescName", "First Page");
+// TextTableHandler.resetBreakTypeofTextTable(xTextTable);
+// }
+ // }
+ XTextRange xHeaderRange = (XTextRange) Helper.getUnoPropertyValue(oPageStyle, "HeaderText", XTextRange.class);
+ if (!com.sun.star.uno.AnyConverter.isVoid(xHeaderRange))
+ {
+ xViewTextCursor.gotoRange(xHeaderRange, false);
+ xViewTextCursor.collapseToStart();
+ }
+ else
+ {
+ System.out.println("No Headertext available");
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void setViewSetting(String Setting, Object Value) throws UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException
+ {
+ xViewSettingsSupplier.getViewSettings().setPropertyValue(Setting, Value);
+ }
+
+ 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
new file mode 100644
index 000000000000..55a6b35dc7e9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/AggregateComponent.java
@@ -0,0 +1,611 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.Vector;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.db.*;
+import com.sun.star.lang.EventObject;
+//import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.beans.*;
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.uno.AnyConverter;
+
+import com.sun.star.awt.*;
+
+public class AggregateComponent extends ControlScroller
+{
+
+ String[] sFunctions;
+ String[] sFunctionOperators = new String[]
+ {
+ "SUM", "AVG", "MIN", "MAX"
+ };
+ ;
+ QueryMetaData CurDBMetaData;
+ XButton optDetailQuery;
+ XButton optSummaryQuery;
+ String soptDetailQuery;
+ String soptSummaryQuery;
+ String slblAggregate;
+ String slblFieldNames;
+ String sDuplicateAggregateFunction;
+ int Count;
+ int iQueryType;
+ final int SOADDROW = 1;
+ final int SOREMOVEROW = 2;
+ final int CONTROLROWDIST = 18;
+ Vector ControlRowVector;
+ String OPTIONBUTTONDETAILQUERY_ITEM_CHANGED = "toggleComponent";
+ String OPTIONBUTTONSUMMARYQUERY_ITEM_CHANGED = "toggleComponent";
+ String LISTBOXFUNCTIONS_ACTION_PERFORMED;
+ String LISTBOXFUNCTIONS_ITEM_CHANGED;
+ String LISTBOXFIELDNAMES_ACTION_PERFORMED;
+ String LISTBOXFIELDNAMES_ITEM_CHANGED;
+ 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();
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ Resource.showCommonResourceError(CurDBMetaData.xMSF);
+ }
+ }
+
+ 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
+ {
+
+ 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;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+ }
+
+ public int getCount()
+ {
+ return Count;
+ }
+
+ 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);
+ slblAggregate = CurUnoDialog.m_oResource.getResText(BaseID + 16);
+ slblFieldNames = CurUnoDialog.m_oResource.getResText(BaseID + 17);
+ sFunctions = CurUnoDialog.m_oResource.getResArray(BaseID + 40, 4);
+
+ 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)
+ {
+ ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(_index);
+ oControlRow.setVisible(_bIsVisible);
+ if (_index >= (this.CurDBMetaData.AggregateFieldNames.length))
+ {
+ oControlRow.settovoid();
+ }
+ }
+
+ protected void addRow()
+ {
+ int fieldcount = super.getTotalFieldCount();
+ registerControlGroupAtIndex(fieldcount);
+ 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));
+ oControlRow.settovoid();
+ }
+ fieldcount++;
+ super.setTotalFieldCount(fieldcount);
+ toggleButtons();
+ CurUnoDialog.repaintDialogStep();
+ }
+
+ protected void removeRow()
+ {
+ int fieldcount = super.getTotalFieldCount();
+ if (fieldcount > 0)
+ {
+ ControlRow oControlRow;
+ fieldcount--;
+ if ((fieldcount + 1) <= super.getBlockIncrementation())
+ {
+ oControlRow = (ControlRow) ControlRowVector.elementAt(fieldcount);
+ oControlRow.setVisible(false);
+ }
+ super.setScrollValue(getScrollValue() - 1, (fieldcount));
+ super.unregisterControlGroup(fieldcount);
+
+ }
+ toggleButtons();
+ CurUnoDialog.repaintDialogStep();
+ }
+
+ 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)));
+ int fieldcount = super.getCurFieldCount();
+ 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)));
+ togglefollowingDialogSteps();
+ }
+
+ public void toggleComponent()
+ {
+ CurDBMetaData.Type = getQueryType();
+ boolean benableComponent = isAggregateComponentEnabled();
+ CurUnoDialog.setControlProperty("lblAggregate", "Enabled", new Boolean(benableComponent));
+ CurUnoDialog.setControlProperty("lblFieldnames", "Enabled", new Boolean(benableComponent));
+ toggleButtons();
+ super.toggleComponent(benableComponent);
+ super.toggleControls(benableComponent);
+ togglefollowingDialogSteps();
+ }
+
+ 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;
+ }
+ }
+ }
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return false;
+ }
+
+ 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++)
+ {
+ ControlRow oControlRow = (ControlRow) ControlRowVector.elementAt(i);
+// if (i == _index)
+// oControlRow.settovoid();
+// else
+ 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++;
+ }
+ }
+ }
+ }
+ 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[][]
+ {
+ };
+ }
+ else
+ {
+ return CurDBMetaData.AggregateFieldNames;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ public void initialize()
+ {
+ CurDBMetaData.setNumericFields();
+ initializeScrollFields();
+ int icount = CurDBMetaData.AggregateFieldNames.length;
+ if (icount == 0)
+ {
+ super.initialize(1);
+ hideControlRowsfromindex(1);
+ }
+ else
+ {
+ super.initialize(icount);
+ hideControlRowsfromindex(icount);
+ }
+ toggleComponent();
+ CurUnoDialog.repaintDialogStep();
+ }
+
+ protected void initializeScrollFields()
+ {
+ ControlRow curControlRow;
+ 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[]
+ {
+ };
+ 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)
+ super.registerControlGroup(currowproperties, _index);
+ }
+
+ private String getFunctionControlName(int _index)
+ {
+ String namesuffix = "_" + String.valueOf(_index + 1);
+ return "lstfunctions" + namesuffix;
+ }
+
+ private String getFieldsControlName(int _index)
+ {
+ String namesuffix = "_" + String.valueOf(_index + 1);
+ return "lstFieldnames" + namesuffix;
+ }
+
+ private boolean hasonlycompletefunctions()
+ {
+ int maxfieldcount = super.getCurFieldCount();
+ if (maxfieldcount > 0)
+ {
+ ControlRow curcontrolrow = (ControlRow) this.ControlRowVector.elementAt(maxfieldcount - 1);
+ return curcontrolrow.isComplete();
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ 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);
+ }
+ }
+
+ private String getSelectedFieldName()
+ {
+ return xFieldListBox.getSelectedItem();
+ }
+
+ private String getSelectedFunction()
+ {
+ return xFunctionListBox.getSelectedItem();
+ }
+
+ private void setVisible(boolean _bvisible)
+ {
+ CurUnoDialog.setControlVisible(getFunctionControlName(index), _bvisible);
+ CurUnoDialog.setControlVisible(getFieldsControlName(index), _bvisible);
+ }
+
+ private void insertFieldNames()
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xFieldListBox), "StringItemList", CurDBMetaData.NumericFieldNames);
+ }
+
+ 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()
+ {
+ CurUnoDialog.deselectListBox(xFieldListBox);
+ CurUnoDialog.deselectListBox(xFunctionListBox);
+ }
+
+ protected class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
+
+ public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
+ try
+ {
+ toggleButtons();
+ togglefollowingDialogSteps();
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java
new file mode 100644
index 000000000000..634261145079
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/ButtonList.java
@@ -0,0 +1,908 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.Size;
+import com.sun.star.awt.XActionListener;
+import com.sun.star.awt.XButton;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XItemEventBroadcaster;
+import com.sun.star.awt.XItemListener;
+// import com.sun.star.awt.XView;
+import com.sun.star.awt.XWindow;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.IRenderer;
+import com.sun.star.wizards.common.PropertySetHelper;
+// import com.sun.star.wizards.ui.event.*;
+import javax.swing.ListModel;
+import javax.swing.event.ListDataEvent;
+
+/**
+ *
+ * @author rpiterman,ll93751
+ */
+public class ButtonList implements XItemEventBroadcaster, XActionListener
+{
+
+ private XFixedText lblImageText;
+ private XButton btnBack;
+ private XButton btnNext;
+ private XFixedText lblCounter;
+ private XControl m_aButtons[];
+ private boolean benabled = true;
+ private UnoDialog2 oUnoDialog;
+ private Size gap = new Size(4, 4);
+ private int cols = 4;
+ private int rows = 3;
+ private Size m_aButtonSize = new Size(20, 20);
+ private Size pos;
+ private Size selectionGap = new Size(2, 2);
+ private boolean showButtons = true;
+ private Short step;
+ private boolean refreshOverNull = true;
+ private int imageTextLines = 1;
+ private boolean rowSelect = false;
+ public int tabIndex;
+ public Boolean scaleImages = Boolean.TRUE;
+ private String m_aControlName = "il";
+ private int m_nCurrentSelection = -1;
+ private int pageStart = 0;
+ public int helpURL = 0;
+ private IImageRenderer renderer;
+ private ListModel listModel;
+ public IRenderer counterRenderer = new SimpleCounterRenderer();
+ private final static int LINE_HEIGHT = 8; //private MethodInvocation METHOD_MOUSE_ENTER_IMAGE;
+
+ /** Getter for property m_aButtonSize.
+ * @return Value of property m_aButtonSize.
+ *
+ */
+ public Size getButtonSize()
+ {
+ return this.m_aButtonSize;
+ }
+ public void setName(String _sName)
+ {
+ m_aControlName = _sName;
+ }
+
+ /** Setter for property m_aButtonSize.
+ * @param imageSize New value of property m_aButtonSize.
+ */
+ public void setButtonSize(Size imageSize)
+ {
+ this.m_aButtonSize = imageSize;
+ }
+
+// @Override
+ public void disposing(EventObject arg0)
+ {
+ // throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ public void create(UnoDialog2 dialog)
+ {
+ oUnoDialog = dialog;
+
+ int imageTextHeight = imageTextLines * LINE_HEIGHT;
+
+ int nXPos = pos.Width + 1;
+ int nYPos = pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height;
+ int nWidth = cols * (m_aButtonSize.Width + gap.Width) + gap.Width - 2;
+
+ lblImageText = dialog.insertLabel(m_aControlName + "_imageText",
+ new String[]
+ {
+ "Height",
+ "HelpURL",
+ "Label",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Tabstop",
+ "Width"
+ },
+ new Object[]
+ {
+ Integer.valueOf(imageTextHeight),
+ "",
+ "(1)",
+ Integer.valueOf(nXPos),
+ Integer.valueOf(nYPos),
+ step,
+ Short.valueOf((short) 0),
+ Boolean.FALSE,
+ Integer.valueOf(nWidth)
+ });
+
+
+ if (showButtons)
+ {
+ final String[] pNames1 = new String[]
+ {
+ "Height",
+ "HelpURL",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Tabstop",
+ "Width"
+ };
+
+ final Integer btnSize = Integer.valueOf(14);
+
+// TODO: if list of strings not the same length of list object, office will die.
+ btnBack = dialog.insertButton(m_aControlName + "_btnBack", "prevPage", this, pNames1, new Object[]
+ {
+ btnSize,
+ "HID:" + helpURL++,
+ Integer.valueOf(pos.Width),
+ Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
+ step,
+ Short.valueOf((short) (tabIndex + 1)),
+ Boolean.TRUE,
+ btnSize
+ });
+
+ btnNext = dialog.insertButton(m_aControlName + "_btnNext", "nextPage", this, pNames1, new Object[]
+ {
+ btnSize,
+ "HID:" + helpURL++,
+ Integer.valueOf(pos.Width + (m_aButtonSize.Width + gap.Width) * cols + gap.Width - btnSize.intValue() + 1),
+ Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + 1),
+ step,
+ new Short((short) (tabIndex + 2)),
+ Boolean.TRUE,
+ btnSize
+ });
+
+ lblCounter = dialog.insertLabel(m_aControlName + "_lblCounter", pNames1, new Object[]
+ {
+ Integer.valueOf(LINE_HEIGHT),
+ "",
+ Integer.valueOf(pos.Width + btnSize.intValue() + 1),
+ Integer.valueOf(pos.Height + (m_aButtonSize.Height + gap.Height) * rows + gap.Height + imageTextHeight + ((btnSize.intValue() - LINE_HEIGHT) / 2)),
+ step,
+ Short.valueOf((short) 0),
+ Boolean.FALSE,
+ Integer.valueOf(cols * (m_aButtonSize.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", ">");
+
+
+ }
+
+ m_tabIndex = new Short((short) tabIndex);
+
+ m_aButtons = new XControl[rows * cols];
+
+
+ m_aButtonHeight = Integer.valueOf(m_aButtonSize.Height);
+ m_aButtonWidth = Integer.valueOf(m_aButtonSize.Width);
+
+ for (int r = 0; r < rows; r++)
+ {
+ for (int c = 0; c < cols; c++)
+ {
+ XButton aButton = createButton(dialog, r, c);
+ XControl aControl = (XControl)UnoRuntime.queryInterface(XControl.class, aButton);
+ m_aButtons[r * cols + c] = aControl;
+ }
+ }
+ refreshImages();
+ }
+
+ private Integer m_aButtonHeight;
+ private Integer m_aButtonWidth;
+ private Short m_tabIndex;
+
+ private XButton createButton(UnoDialog2 dialog, int _row, int _col)
+ {
+ String sButtonName = m_aControlName + "_button" + (_row * cols + _col);
+ int nButtonX = getButtonPosX(_col);
+ int nButtonY = getButtonPosY(_row);
+ XButton aButton = dialog.insertImageButton(sButtonName, this,
+ new String[]
+ {
+ /* "Border", */
+ /* "BackgroundColor", */
+ "Height",
+ "HelpURL",
+ /* "Label", */
+ "PositionX",
+ "PositionY",
+ /* "ScaleImage", */
+ "Step",
+ "TabIndex",
+ "Tabstop",
+ "Toggle",
+ "Width"
+ },
+ new Object[]
+ {
+ /* Short.valueOf((short) 1), */ /* NO_BORDER, */
+ /* BACKGROUND_COLOR, */
+ m_aButtonHeight,
+ "HID:" + helpURL++,
+ /* "Test", */
+ Integer.valueOf(nButtonX),
+ Integer.valueOf(nButtonY),
+ /* scaleImages, */
+ step,
+ m_tabIndex,
+ Boolean.TRUE,
+ Boolean.TRUE, /* Toggle */
+ m_aButtonWidth
+ });
+
+ XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, aButton);
+ win.setEnable(true);
+ win.setVisible(true);
+ return aButton;
+ }
+
+ private int getButtonPosX(int _col)
+ {
+ final int nXPos = pos.Width + _col * (m_aButtonSize.Width + gap.Width) + gap.Width;
+ return nXPos;
+ }
+
+ private int getButtonPosY(int _row)
+ {
+ final int nYPos = pos.Height + _row * (m_aButtonSize.Height + gap.Height) + gap.Height;
+ return nYPos;
+ }
+
+ private void refreshImages()
+ {
+ if (showButtons)
+ {
+ refreshCounterText();
+ }
+ if (refreshOverNull)
+ {
+ for (int i = 0; i < m_aButtons.length; i++)
+ {
+ setVisible(m_aButtons[i], false);
+ }
+ }
+ boolean focusable = true;
+ for (int i = 0; i < m_aButtons.length; i++)
+ {
+ Object[] oResources = renderer.getImageUrls(getObjectFor(i));
+ if (oResources != null)
+ {
+ if (oResources.length == 1)
+ {
+ Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "ImageURL", (String) oResources[0]);
+ }
+ else if (oResources.length == 2)
+ {
+ oUnoDialog.getPeerConfiguration().setImageUrl(m_aButtons[i].getModel(), oResources[0], oResources[1]);
+// Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "ImageURL", oResources[0]);
+ }
+ boolean bTabStop = Boolean.TRUE; // focusable ? Boolean.TRUE : Boolean.FALSE;
+ Helper.setUnoPropertyValue(m_aButtons[i].getModel(), "Tabstop", bTabStop);
+ // Object aEnabled = Helper.getUnoPropertyValue(m_aButtons[i].getModel(), "Enabled");
+ if (refreshOverNull)
+ {
+ setVisible(m_aButtons[i], true);
+ }
+ focusable = false;
+ }
+ }
+// refreshSelection();
+ }
+
+ private void refreshCounterText()
+ {
+ Helper.setUnoPropertyValue(getModel(lblCounter), "Label", counterRenderer.render(new Counter(pageStart + 1, pageEnd(), listModel.getSize())));
+ }
+
+ private int pageEnd()
+ {
+ int i = pageStart + cols * rows;
+ if (i > listModel.getSize() - 1)
+ {
+ return listModel.getSize();
+ }
+ else
+ {
+ return i;
+ }
+ }
+
+ /** Utility field holding list of ItemListeners. */
+ private transient java.util.ArrayList<XItemListener> m_aItemListenerList;
+ private void setVisible(Object control, boolean visible)
+ {
+ final XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, control);
+ xWindow.setVisible(visible);
+ }
+
+ /**
+ *
+ * @param i
+ * @return the Object in the list model corresponding to the given image index.
+ */
+ private Object getObjectFor(int i)
+ {
+ int ii = getIndexFor(i);
+ if (listModel.getSize() <= ii)
+ {
+ return null;
+ }
+ else
+ {
+ return listModel.getElementAt(ii);
+ }
+ }
+
+ /**
+ *
+ * @param i
+ * @return the index in the listModel for the given image index.
+ */
+ private int getIndexFor(int i)
+ {
+ return pageStart + i;
+ }
+
+ private int getImageIndexFor(int i)
+ {
+ return i - pageStart;
+ }
+
+ 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
+ else
+ refreshImages();
+ */ //m_nCurrentSelection = 0;
+ //pageStart = 0;
+ //if (event.refreshImages();
+ }
+
+ public void intervalAdded(ListDataEvent event)
+ {
+ if (event.getIndex0() <= m_nCurrentSelection)
+ {
+ if (event.getIndex1() <= m_nCurrentSelection)
+ {
+ m_nCurrentSelection += event.getIndex1() - event.getIndex0() + 1;
+ }
+ }
+ if (event.getIndex0() < pageStart || event.getIndex1() < (pageStart + getRows() + getCols()))
+ {
+ refreshImages();
+ }
+ }
+
+ public void intervalRemoved(ListDataEvent event)
+ {
+ //contentsChanged(event);
+ }
+
+ /** Registers ItemListener to receive events.
+ * @param listener The listener to register.
+ *
+ */
+ // @Override
+ public synchronized void addItemListener(XItemListener listener)
+ {
+ if (m_aItemListenerList == null)
+ {
+ m_aItemListenerList = new java.util.ArrayList<XItemListener>();
+ }
+ m_aItemListenerList.add(listener);
+ }
+
+ /** Removes ItemListener from the list of listeners.
+ * @param listener The listener to remove.
+ *
+ */
+ public synchronized void removeItemListener(XItemListener listener)
+ {
+ if (m_aItemListenerList != null)
+ {
+ m_aItemListenerList.remove(listener);
+ }
+ }
+
+ /** Notifies all registered listeners about the event.
+ *
+ * @param event The event to be fired
+ *
+ */
+ 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)
+ {
+ if (m_aItemListenerList == null)
+ {
+ return;
+ }
+ list = (java.util.ArrayList) m_aItemListenerList.clone();
+ }
+ for (int i = 0; i < list.size(); i++)
+ {
+ ((com.sun.star.awt.XItemListener) list.get(i)).itemStateChanged(null);
+ }
+ }
+
+ /**
+ * @return
+ */
+ public int getCols()
+ {
+ return cols;
+ }
+
+ /**
+ * @return
+ */
+ public Size getGap()
+ {
+ return gap;
+ }
+
+ /**
+ * @return
+ */
+ public ListModel getListModel()
+ {
+ return listModel;
+ }
+
+ /**
+ * @return
+ */
+ public Short getStep()
+ {
+ return step;
+ }
+
+ /**
+ * @return
+ */
+ public int getPageStart()
+ {
+ return pageStart;
+ }
+
+ /**
+ * @return
+ */
+ public Size getPos()
+ {
+ return pos;
+ }
+
+ /**
+ * @return
+ */
+ public IImageRenderer getRenderer()
+ {
+ return renderer;
+ }
+
+ /**
+ * @return
+ */
+ public int getRows()
+ {
+ return rows;
+ }
+
+ /**
+ * @return
+ */
+ public int getSelected()
+ {
+ return m_nCurrentSelection;
+ }
+
+ /**
+ * @return
+ */
+ public Size getSelectionGap()
+ {
+ return selectionGap;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isShowButtons()
+ {
+ return showButtons;
+ }
+
+ /**
+ * @param i
+ */
+ public void setCols(int i)
+ {
+ cols = i;
+ }
+
+ /**
+ * @param size
+ */
+ public void setGap(Size size)
+ {
+ gap = size;
+ }
+
+ /**
+ * @param model
+ */
+ public void setListModel(ListModel model)
+ {
+ listModel = model;
+ }
+
+ /**
+ * @param short1
+ */
+ public void setStep(Short short1)
+ {
+ step = short1;
+ }
+
+ /**
+ * @param i
+ */
+ public void setPageStart(int i)
+ {
+ if (i == pageStart)
+ {
+ return;
+ }
+ pageStart = i;
+ enableButtons();
+ refreshImages();
+ }
+
+ /**
+ * @param _size
+ */
+ public void setPos(Size _size)
+ {
+ pos = _size;
+ }
+
+ /**
+ * @param _renderer
+ */
+ public void setRenderer(IImageRenderer _renderer)
+ {
+ this.renderer = _renderer;
+ }
+
+ /**
+ * @param i
+ */
+ public void setRows(int i)
+ {
+ rows = i;
+ }
+
+ /**
+ * @param i
+ */
+ public void setSelected(int i)
+ {
+ if (rowSelect && (i >= 0))
+ {
+ i = (i / cols) * cols;
+ }
+ if (m_nCurrentSelection == i)
+ {
+ return;
+ }
+ m_nCurrentSelection = i;
+ refreshImageText();
+ refreshSelection();
+ fireItemSelected();
+ }
+
+/*
+ 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))
+ {
+ setSelected(i);
+ return;
+ }
+ }
+ }
+ setSelected(-1);
+
+ }
+*/
+
+ /**
+ * set the text under the button list
+ */
+ private void refreshImageText()
+ {
+ Object item = m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null;
+ final String sText = " " + renderer.render(item);
+ Helper.setUnoPropertyValue(getModel(lblImageText), "Label", sText);
+ }
+
+ /**
+ * @param size
+ */
+ public void setSelectionGap(Size size)
+ {
+ selectionGap = size;
+ }
+
+ /**
+ * @param b
+ */
+ public void setShowButtons(boolean b)
+ {
+ showButtons = b;
+ }
+
+ public void nextPage()
+ {
+ if (pageStart < getListModel().getSize() - rows * cols)
+ {
+ setPageStart(pageStart + rows * cols);
+ }
+ }
+
+ public void prevPage()
+ {
+ if (pageStart == 0)
+ {
+ return;
+ }
+ int i = pageStart - rows * cols;
+ if (i < 0)
+ {
+ i = 0;
+ }
+ setPageStart(i);
+ }
+
+ 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)
+ {
+ Helper.setUnoPropertyValue(getModel(control), "Enabled", enable);
+ }
+
+ private Object getModel(Object control)
+ {
+ return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel();
+ }
+
+ 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);
+ }
+
+
+ public Object[] getSelectedObjects()
+ {
+ return new Object[]
+ {
+ getListModel().getElementAt(m_nCurrentSelection)
+ };
+ }
+
+
+ /**
+ */
+ public static interface IImageRenderer extends IRenderer
+ {
+
+ /**
+ *
+ * @param listItem
+ * @return two resource ids for an image referenced in the imaglist resourcefile of the
+ * wizards project; The second one of them is designed to be used for High Contrast Mode.
+ */
+ public Object[] getImageUrls(Object listItem);
+ }
+
+ private static class SimpleCounterRenderer implements IRenderer
+ {
+
+ // @Override
+ 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 Counter(int start_, int end_, int max_)
+ {
+ start = start_;
+ end = end_;
+ max = max_;
+ }
+ }
+
+ public Object getSelectedObject()
+ {
+ return m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null;
+ }
+
+
+ public void setRowSelect(boolean b)
+ {
+ rowSelect = b;
+ }
+
+ public boolean isRowSelect()
+ {
+ return rowSelect;
+ }
+
+
+ /**
+ * jump to the given item (display the screen
+ * that contains the given item).
+ * @param i
+ */
+ public void display(int i)
+ {
+ int is = (getCols() * getRows());
+ int ps = (listModel.getSize() / is) * is;
+ setPageStart(ps);
+ }
+
+ /**
+ * @return
+ */
+ public boolean isenabled()
+ {
+ return benabled;
+ }
+
+ /**
+ * @param b
+ */
+ public void setenabled(boolean b)
+ {
+
+ for (int i = 0; i < m_aButtons.length; i++)
+ {
+ UnoDialog2.setEnabled(m_aButtons[i], 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;
+ }
+
+/**
+ * refresh on all buttons, the selected button will get state pressed
+ */
+ private void refreshSelection()
+ {
+ // reset all buttons to not set
+ for (int i = 0; i < m_aButtons.length; i++)
+ {
+ if (m_aButtons[i] != null)
+ {
+ XControlModel xModel = (XControlModel)UnoDialog2.getModel(m_aButtons[i]);
+ PropertySetHelper aHelper = new PropertySetHelper(xModel);
+ if (i == m_nCurrentSelection)
+ {
+ final short one = 1;
+ aHelper.setPropertyValueDontThrow("State", Short.valueOf(one));
+ }
+ else
+ {
+ final short zero = 0;
+ aHelper.setPropertyValueDontThrow("State", Short.valueOf(zero));
+ }
+ }
+ }
+ }
+
+/**
+ * implementation of XActionListener
+ * will call if a button from the m_aButtonList is pressed.
+ * @param actionEvent
+ */
+// @Override
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ // bStopProcess = true;
+ XControlModel xModel = (XControlModel)UnoDialog2.getModel(actionEvent.Source);
+ PropertySetHelper aHelper = new PropertySetHelper(xModel);
+
+ int nState = aHelper.getPropertyValueAsInteger("State", -1);
+ if (nState == 0)
+ {
+ // this will avoid a wrong state, if already pressed.
+ aHelper.setPropertyValueDontThrow("State", Short.valueOf((short)1));
+ }
+
+ // check which Button is pressed.
+ String sControlName = aHelper.getPropertyValueAsString("Name", "");
+ final String sButton = sControlName.substring(7 + m_aControlName.length());
+ int nButton = new Integer(sButton).intValue();
+
+ // int image = getImageFromEvent(event);
+ int index = getIndexFor(nButton);
+ if (index < listModel.getSize())
+ {
+ // focus(image);
+ setSelected(index);
+ }
+
+ }
+
+
+}
diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
new file mode 100644
index 000000000000..ddca1039706a
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
@@ -0,0 +1,474 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.wizards.common.*;
+import com.sun.star.wizards.db.*;
+// import com.sun.star.awt.XWindow;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.sdb.CommandType;
+// import com.sun.star.sdbc.SQLException;
+import com.sun.star.uno.AnyConverter;
+// import com.sun.star.uno.UnoRuntime;
+import com.sun.star.awt.*;
+import com.sun.star.beans.PropertyValue;
+import java.text.Collator;
+import java.util.Comparator;
+
+public class CommandFieldSelection extends FieldSelection implements Comparator
+{
+
+ private CommandMetaData CurDBMetaData;
+ private XListBox xTableListBox;
+ private XFixedText xlblTable;
+ // private String SFILLUPFIELDSLISTBOX = "fillUpFieldsListbox";
+ private String sTableListBoxName;
+ private String sTableLabelName;
+ private String sQueryPrefix;
+ private String sTablePrefix;
+ private short m_iSelPos = -1;
+ private short iOldSelPos = -1;
+ private boolean bpreselectCommand = true;
+ private boolean bgetQueries;
+ // boolean AppendMode;
+ private WizardDialog oWizardDialog;
+ private Collator aCollator = null;
+
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
+
+ public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
+ short[] SelItems = (short[]) CurUnoDialog.getControlProperty(sTableListBoxName, "SelectedItems");
+ if (SelItems.length > 0)
+ {
+ iOldSelPos = m_iSelPos;
+ m_iSelPos = SelItems[0];
+ if ((m_iSelPos > -1) && (m_iSelPos != iOldSelPos))
+ {
+ if (!AppendMode)
+ {
+ oWizardDialog.enablefromStep(IStep.intValue() + 1, false);
+ }
+ fillUpFieldsListbox();
+ }
+ }
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+ }
+
+ /**
+ * instantiates a CommandFieldSelection with a preselected command
+ * @param _CurUnoDialog
+ * @param _CurDBMetaData
+ * @param iStep
+ * @param _iHeight
+ * @param _reslblFields
+ * @param _reslblSelFields
+ * @param _reslblTables
+ * @param _bgetQueries
+ * @param _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
+ * @param _CurDBMetaData
+ * @param _iHeight
+ * @param _reslblFields
+ * @param _reslblSelFields
+ * @param _reslblTables
+ * @param _bgetQueries
+ * @param _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
+ {
+ this.AppendMode = !_bgetQueries;
+ this.bgetQueries = _bgetQueries;
+ this.CurDBMetaData = _CurDBMetaData;
+ toggleListboxControls(Boolean.FALSE);
+ sTableLabelName = "lblTables_" + super.sIncSuffix;
+ sTableListBoxName = "lstTables_" + super.sIncSuffix;
+ sTablePrefix = getTablePrefix();
+ sQueryPrefix = getQueryPrefix();
+ Integer LabelWidth = new Integer(getListboxWidth().intValue() + 6);
+ // Label 'Tables or Queries'
+ 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
+ });
+ // DropDown Listbox TableNames
+ 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(UnoDialog.getListBoxLineCount()), new Integer(95), new Integer(37), IStep, new Short((short) 4), getListboxWidth()
+ });
+ // XWindow xTableListBoxWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTableListBox);
+ fillupCommandListBox();
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ /**
+ * @return Returns the sQueryPrefix.
+ */
+ public String getQueryPrefix()
+ {
+ if (sQueryPrefix == null)
+ {
+ sQueryPrefix = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 22);
+ }
+ return sQueryPrefix;
+ }
+
+ private String getCommandPrefix(int _nCommandType)
+ {
+ if (_nCommandType == CommandType.TABLE)
+ {
+ return getTablePrefix();
+ }
+ else if (_nCommandType == CommandType.QUERY)
+ {
+ return getQueryPrefix();
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ /**
+ * @return Returns the sTablePrefix.
+ */
+ public String getTablePrefix()
+ {
+ if (sTablePrefix == null)
+ {
+ sTablePrefix = CurUnoDialog.m_oResource.getResText(UIConsts.RID_QUERY + 21);
+ }
+ return sTablePrefix;
+ }
+
+ 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"));
+ 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
+ short iSelPos = getselectedItemPos();
+ // String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, "StringItemList");
+ final String sSelectedTableName = xTableListBox.getItem(iSelPos);
+ if (!bgetQueries)
+ {
+ curCommandName = sSelectedTableName; // sLocList[iSelPos];
+ CurDBMetaData.setTableByName(curCommandName);
+ binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode);
+ }
+ else
+ {
+ if (sSelectedTableName.startsWith(sTablePrefix))
+ {
+ CurDBMetaData.setCommandType(CommandType.TABLE);
+ curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sTablePrefix);
+ CurDBMetaData.setTableByName(curCommandName);
+ binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode);
+ }
+ else
+ {
+ CurDBMetaData.setCommandType(CommandType.QUERY);
+ curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sQueryPrefix);
+ CurDBMetaData.setQueryByName(curCommandName);
+ binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.QUERY, AppendMode);
+ }
+ }
+ if (binitialize)
+ {
+ CurDBMetaData.setCommandName(curCommandName);
+ if (CurDBMetaData.m_aAllFieldNames != null)
+ {
+ if (CurDBMetaData.m_aAllFieldNames.length > 0)
+ {
+ initialize(CurDBMetaData.m_aAllFieldNames, AppendMode, CurDBMetaData.getMaxColumnsInSelect());
+ return;
+ }
+ }
+ }
+ emptyFieldsListBoxes();
+ }
+ 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
+ {
+ short[] iSelArray = new short[0];
+ boolean bgetFields = false;
+ String[] ContentList = new String[0];
+ // CurDBMetaData.initCommandNames();
+ if (bgetQueries)
+ {
+ ContentList = new String[CurDBMetaData.getTableNames().length + CurDBMetaData.getQueryNames().length];
+ System.arraycopy(CurDBMetaData.getQueryNames(), 0, ContentList, CurDBMetaData.getTableNames().length, CurDBMetaData.getQueryNames().length);
+ ContentList = setPrefixinArray(ContentList, sQueryPrefix, CurDBMetaData.getTableNames().length, CurDBMetaData.getQueryNames().length);
+ }
+ else
+ {
+ ContentList = new String[CurDBMetaData.getTableNames().length];
+ }
+ System.arraycopy(CurDBMetaData.getTableNames(), 0, ContentList, 0, CurDBMetaData.getTableNames().length);
+ if (bgetQueries)
+ {
+ ContentList = setPrefixinArray(ContentList, sTablePrefix, 0, CurDBMetaData.getTableNames().length);
+ }
+ java.util.Arrays.sort(ContentList, this);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList", ContentList);
+ short iSelPos = getselectedItemPos();
+ if (bpreselectCommand)
+ {
+ if (iSelPos > -1)
+ {
+ bgetFields = true;
+ iSelArray = new short[]
+ {
+ iSelPos
+ };
+ }
+ }
+ else
+ {
+ emptyFieldsListBoxes();
+ 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)
+ {
+ 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
+ this.aCollator = Collator.getInstance(aJavaLocale);
+ aCollator.setStrength(Collator.TERTIARY);
+ }
+ return aCollator;
+ }
+
+ public int compare(Object _oObject1, Object _oObject2)
+ {
+ return this.getCollator().compare(_oObject1, _oObject2);
+ }
+
+ 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)
+ {
+ boolean bdoenable = !(QueryMetaData.getIncludedCommandNames(_NewItems).length >= CurDBMetaData.getMaxTablesInSelect());
+ toggleCommandListBox(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()
+ {
+ 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()
+ {
+ 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(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
+ });
+ }
+ this.fillUpFieldsListbox();
+ }
+ else
+ {
+ 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)
+ {
+ 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 });
+ }
+ this.fillUpFieldsListbox();
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] {} );
+ this.fillUpFieldsListbox();
+ }
+ if (_bReadOnly)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "ReadOnly", new Boolean(_selitem.length() > 0));
+ }
+ toggleListboxButtons((short)-1,(short)-1);
+ }
+}
diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.java b/wizards/com/sun/star/wizards/ui/ControlScroller.java
new file mode 100644
index 000000000000..f42fe81134a9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java
@@ -0,0 +1,509 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.XScrollBar;
+import com.sun.star.awt.AdjustmentEvent;
+import com.sun.star.beans.*;
+import com.sun.star.awt.*;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.*;
+
+import java.util.*;
+
+public abstract class ControlScroller
+{
+
+ protected WizardDialog CurUnoDialog;
+ protected XMultiServiceFactory xMSF;
+ private Object oImgControl;
+ protected int ncurfieldcount;
+ protected int nblockincrement;
+ private int nlineincrement;
+ protected int nscrollvalue = 0;
+ protected int ntotfieldcount;
+ XScrollBar xScrollBar;
+ protected Vector scrollfields;
+ protected Integer ICompPosX;
+ protected int iCompPosX;
+ protected Integer ICompPosY;
+ protected int iCompPosY;
+ protected Integer ICompWidth;
+ protected int iCompWidth;
+ protected Integer ICompHeight;
+ protected int iCompHeight;
+ protected int iStartPosY;
+ protected short curtabindex;
+ int iStep;
+ protected Integer IStep;
+ protected int linedistance;
+ int iScrollBarWidth = 10;
+ int SORELFIRSTPOSY = 3;
+ protected int curHelpIndex;
+ String sIncSuffix;
+ protected Vector ControlGroupVector = new Vector();
+ protected PeerConfig oTitlePeerConfig;
+
+ class AdjustmentListenerImpl implements com.sun.star.awt.XAdjustmentListener
+ {
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+
+ public void adjustmentValueChanged(AdjustmentEvent AdjustEvent)
+ {
+ scrollControls();
+ }
+ }
+
+ /**
+ *
+ * @param _CurUnoDialog
+ * @param iStep
+ * @param iCompPosX
+ * @param iCompPosY
+ * @param iCompWidth
+ * @param _nblockincrement
+ * @param _firsthelpindex
+ * @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)
+ {
+ this.xMSF = _xMSF;
+ this.nblockincrement = _nblockincrement;
+ this.CurUnoDialog = _CurUnoDialog;
+ this.iStep = _iStep;
+ this.curHelpIndex = _firsthelpindex;
+ curtabindex = UnoDialog.setInitialTabindex(iStep);
+ this.linedistance = _nlinedistance;
+ IStep = new Integer(iStep);
+ this.iCompPosX = _iCompPosX;
+ this.iCompPosY = _iCompPosY;
+ this.ICompPosX = new Integer(iCompPosX);
+ this.ICompPosY = new Integer(iCompPosY);
+ this.iCompWidth = _iCompWidth;
+ this.ICompWidth = new Integer(iCompWidth);
+ this.iCompHeight = 2 * SORELFIRSTPOSY + nblockincrement * linedistance;
+ iStartPosY = iCompPosY + SORELFIRSTPOSY;
+ int ScrollHeight = iCompHeight - 2;
+ nlineincrement = 1;
+ sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "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
+ });
+ 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)
+ });
+ scrollfields = new Vector();
+ int ypos = iStartPosY + SORELFIRSTPOSY;
+ 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
+ });
+ }
+
+ protected void setScrollBarOrientationHorizontal()
+ {
+ Helper.setUnoPropertyValue(xScrollBar, "Orientation", new Integer(ScrollBarOrientation.HORIZONTAL));
+ }
+
+ /**
+ * @author bc93774
+ * @param _ntotfieldcount: The number of fields that are to be administered by the ControlScroller
+ */
+ 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)
+ });
+ }
+ else
+ {
+ Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[]
+ {
+ "Enabled", "ScrollValue"
+ }, new Object[]
+ {
+ Boolean.FALSE, new Integer(nscrollvalue)
+ });
+ }
+ fillupControls(true);
+ }
+ catch (java.lang.Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ protected void fillupControls(boolean binitialize)
+ {
+ int newindex;
+ PropertyValue[] oldproperties;
+ PropertyValue[] newproperties;
+ 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)
+ {
+ PropertyValue[] nameProps = (PropertyValue[]) scrollfields.get(guiRow);
+ PropertyValue[] valueProps = (PropertyValue[]) scrollfields.get(guiRow + nscrollvalue);
+ for (int n = 0; n < nameProps.length; n++)
+ {
+ if (CurUnoDialog.getDlgNameAccess().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)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("ScrollValue"), new Integer(_nscrollvalue));
+ scrollControls();
+ }
+ }
+
+ protected void setScrollValue(int _nscrollvalue, int _ntotfieldcount)
+ {
+ setTotalFieldCount(_ntotfieldcount);
+ setScrollValue(_nscrollvalue);
+ }
+
+ protected int getTotalFieldCount()
+ {
+ return ntotfieldcount;
+ }
+
+ protected int getCurFieldCount()
+ {
+ return ncurfieldcount;
+ }
+
+ private void setCurFieldCount()
+ {
+ if (ntotfieldcount > nblockincrement)
+ {
+ ncurfieldcount = nblockincrement;
+ }
+ else
+ {
+ ncurfieldcount = 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)
+ });
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "Enabled", Boolean.FALSE);
+ }
+ }
+
+ 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++)
+ {
+ PropertyValue[] curproperties = (PropertyValue[]) scrollfields.elementAt(n);
+ for (int m = 0; m < curproperties.length; m++)
+ {
+ PropertyValue curproperty = curproperties[m];
+ CurUnoDialog.setControlProperty(curproperty.Name, "Enabled", new Boolean(_bdoenable));
+ }
+ }
+
+ }
+
+ protected int getScrollValue()
+ {
+ return nscrollvalue;
+ }
+
+ protected void setLineIncrementation(int _nlineincrement)
+ {
+ this.nlineincrement = _nlineincrement;
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("LineIncrement"), new Integer(nlineincrement));
+
+ }
+
+ protected int getLineIncrementation()
+ {
+ return nlineincrement;
+ }
+
+ 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)
+ });
+ }
+
+ protected int getBlockIncrementation()
+ {
+ return nblockincrement;
+ }
+
+ 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)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ protected void scrollRowsInfo()
+ {
+ int cols =
+ 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);
+ }
+ }
+ }
+
+ /**
+ * updates the corresponding data to
+ * the control in guiRow and column
+ * @param guiRow 0 based row index
+ * @param column 0 based column index
+ * @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 + ")" );
+
+ return pv;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ protected PropertyValue fieldInfo(PropertyValue valueProp, PropertyValue nameProp)
+ {
+ if (CurUnoDialog.getDlgNameAccess().hasByName(nameProp.Name))
+ {
+ valueProp.Value = getControlData(nameProp.Name);
+ }
+ else
+ {
+ valueProp.Value = nameProp.Value;
+ }
+ return valueProp;
+ }
+
+ protected void unregisterControlGroup(int _index)
+ {
+ scrollfields.remove(_index);
+ }
+
+ 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)
+ {
+ return (PropertyValue[]) scrollfields.elementAt(_i);
+ }
+
+ protected void setControlData(String controlname, Object newvalue)
+ {
+ Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname));
+ String propertyname = UnoDialog.getDisplayProperty(oControlModel);
+ if (propertyname != "")
+ {
+ CurUnoDialog.setControlProperty(controlname, propertyname, newvalue);
+ }
+ }
+
+ 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()
+ {
+ scrollRowsInfo();
+ PropertyValue[] curproperties;
+ PropertyValue[][] retproperties;
+ retproperties = new PropertyValue[scrollfields.size()][];
+ try
+ {
+ for (int i = 0; i < scrollfields.size(); i++)
+ {
+ curproperties = (PropertyValue[]) scrollfields.elementAt(i);
+ retproperties[i] = curproperties;
+ }
+ return retproperties;
+ }
+ catch (java.lang.Exception ex)
+ {
+ ex.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ protected abstract void initializeScrollFields();
+
+ /** inserts a group of controls into the component. The group may either be a row or a column of controls
+ * The controls should be put on Step 99 (means made invisible at first). All the controlrows that are needed are than
+ * made visible automatically when calling "initialize(_fieldcount)"
+ * @author bc93774
+ * @param i: The index of the control group
+ * @param npos: Can be an x coordinate or an y coordinate which depends on the orientation of the scrollbar
+ */
+ 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
new file mode 100644
index 000000000000..341ab73828c5
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.XListBox;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+
+/**
+ * @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 abstract class DBLimitedFieldSelection
+{
+
+ protected XMultiServiceFactory xMSF;
+ protected WizardDialog CurUnoDialog;
+ protected String sNoField;
+ protected Integer IStep;
+ protected Integer ICompPosX;
+ protected Integer ICompPosY;
+ protected Integer ICompWidth;
+ protected final int rowcount = 4;
+ protected final int MAXSELINDEX = rowcount - 1;
+ protected short curtabindex;
+ protected int iCurPosY;
+ protected int FirstHelpIndex;
+ protected int iCompPosX;
+ // protected int MaxSelIndex;
+
+ public DBLimitedFieldSelection(WizardDialog _CurUnoDialog, int iStep, int _iCompPosX, int iCompPosY, int iCompWidth, int _FirstHelpIndex)
+ {
+ this.CurUnoDialog = _CurUnoDialog;
+ xMSF = CurUnoDialog.xMSF;
+ FirstHelpIndex = _FirstHelpIndex;
+ curtabindex = (short) (iStep * 100);
+ sNoField = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 8);
+ IStep = new Integer(iStep);
+ iCompPosX = _iCompPosX;
+ ICompPosX = new Integer(iCompPosX);
+ ICompPosY = new Integer(iCompPosY);
+ ICompWidth = new Integer(iCompWidth);
+ // boolean bDoEnable;
+ iCurPosY = iCompPosY;
+ for (int i = 0; i < rowcount; i++)
+ {
+ insertControlGroup(i);
+ }
+ }
+
+ protected abstract void insertControlGroup(int index);
+
+ protected abstract void toggleControlRow(int CurIndex, boolean bDoEnable);
+
+ protected abstract void enableNextControlRow(int CurIndex);
+
+ protected abstract void updateFromNextControlRow(int CurIndex);
+
+ // protected abstract void setMaxSelIndex();
+
+ protected abstract int getMaxSelIndex();
+
+ protected void moveupSelectedItems(int CurIndex, boolean bDoEnable)
+ {
+ // short iNextItemPos;
+ if ((bDoEnable == false) && (MAXSELINDEX > CurIndex))
+ {
+ for (int i = CurIndex; i < MAXSELINDEX; i++)
+ {
+ updateFromNextControlRow(i);
+ }
+ if (getMaxSelIndex() < rowcount - 2)
+ {
+ toggleControlRow(getMaxSelIndex() + 2, false);
+ }
+ }
+ else
+ {
+ toggleControlRow(CurIndex + 1, bDoEnable);
+ }
+ }
+
+ 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)
+ {
+ short[] SelList = null;
+ 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) };
+ }
+ else
+ {
+ SelList = new short[] { (short) (0) };
+ }
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList);
+ return;
+ }
+ }
+ 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);
+ short[] SelList = null;
+ int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldName);
+ 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
new file mode 100644
index 000000000000..173fae87f01b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/DocumentPreview.java
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XFrame;
+import com.sun.star.io.IOException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.CloseVetoException;
+import com.sun.star.util.XCloseable;
+import com.sun.star.wizards.common.Properties;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class DocumentPreview
+{
+
+ /**
+ * The window in which the preview is showed.
+ */
+ private XWindow xWindow;
+ /**
+ * The frame service which is used to show the preview
+ */
+ private XFrame xFrame;
+ /**
+ * 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
+
+ - create new frame with window inside
+ - load a component as preview into this frame
+ */
+ public DocumentPreview(XMultiServiceFactory xmsf, Object control) throws Exception
+ {
+
+ //((XWindow)UnoRuntime.queryInterface(XWindow.class,control)).addPaintListener(this);
+ xControl = (XControl) UnoRuntime.queryInterface(XControl.class, control);
+ //register this object as a listener, to close the frame when disposing.
+ //((XComponent) UnoRuntime.queryInterface(XComponent.class, control)).addEventListener(this);
+
+ createPreviewFrame(xmsf, xControl);
+ }
+
+ 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
+ {
+ 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
+ {
+ closeFrame();
+ createPreviewFrame(xmsf, xControl);
+ //System.out.println(xControl);
+ setDocument(url, loadArgs);
+ }
+
+ private void closeFrame() throws CloseVetoException
+ {
+ if (xFrame != null)
+ {
+ ((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
+ });
+ }
+ 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().
+ */
+ 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();
+
+ Object toolkit = xmsf.createInstance("com.sun.star.awt.Toolkit");
+ XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, toolkit);
+
+ WindowDescriptor aDescriptor = new WindowDescriptor();
+ aDescriptor.Type = WindowClass.SIMPLE;
+ aDescriptor.WindowServiceName = "window";
+ aDescriptor.ParentIndex = -1;
+ aDescriptor.Parent = controlPeer; //xWindowPeer; //argument !
+ aDescriptor.Bounds = new Rectangle(0, 0, r.Width, r.Height);
+ aDescriptor.WindowAttributes = VclWindowPeerAttribute.CLIPCHILDREN | WindowAttribute.SHOW;
+
+ XWindowPeer xPeer = xToolkit.createWindow(aDescriptor);
+ xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xPeer);
+ Object frame = xmsf.createInstance("com.sun.star.frame.Frame");
+ xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, frame);
+// XFrame xF = (XFrame) UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xmsf));
+// xFrame = xF.findFrame("_blank", 0);
+ xFrame.initialize(xWindow);
+ xWindow.setVisible(true);
+ }
+
+ public void dispose()
+ {
+ try
+ {
+ closeFrame();
+ }
+ 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
new file mode 100644
index 000000000000..803f85948721
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java
@@ -0,0 +1,697 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.FontDescriptor;
+import com.sun.star.awt.XListBox;
+// import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.common.JavaTools;
+
+import java.util.*;
+
+/**
+ *
+ * @author bc93774
+ */
+public class FieldSelection
+{
+ public XListBox xFieldsListBox; // Left ListBox
+ public XListBox xSelectedFieldsListBox; // right (selected) ListBox
+
+ protected UnoDialog CurUnoDialog;
+ protected String sIncSuffix;
+ protected int FirstHelpIndex;
+ protected boolean AppendMode = false;
+ protected Integer IStep;
+
+ protected int CompPosX;
+ protected int CompPosY;
+ protected int CompHeight;
+ protected int CompWidth;
+
+ private XFieldSelectionListener xFieldSelection;
+ private int maxfieldcount = 10000000;
+ private String[] AllFieldNames;
+ private Integer ListBoxWidth;
+
+ private Integer SelListBoxPosX;
+
+ private boolean bisModified = false;
+
+ private final static int SOCMDMOVESEL = 1;
+ private final static int SOCMDMOVEALL = 2;
+ private final static int SOCMDREMOVESEL = 3;
+ private final static int SOCMDREMOVEALL = 4;
+ private final static int SOCMDMOVEUP = 5;
+ private final static int SOCMDMOVEDOWN = 6;
+ private final static int SOFLDSLST = 7;
+ private final static int SOSELFLDSLST = 8;
+
+
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
+
+ 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)
+ {
+
+ case SOFLDSLST:
+ toggleListboxButtons((short) - 1, (short) - 1);
+ break;
+
+ case SOSELFLDSLST:
+ toggleListboxButtons((short) - 1, (short) - 1);
+ break;
+ default:
+ break;
+ }
+ com.sun.star.wizards.common.Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, "Enabled", Boolean.TRUE);
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+ }
+
+ class ActionListenerImpl implements com.sun.star.awt.XActionListener
+ {
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ try
+ {
+ int iKey = CurUnoDialog.getControlKey(actionEvent.Source, CurUnoDialog.ControlList);
+ switch (iKey)
+ {
+ case SOFLDSLST:
+ selectFields(false);
+ break;
+
+ case SOSELFLDSLST:
+ deselectFields(false);
+ break;
+
+ case SOCMDMOVESEL:
+ selectFields(false);
+ break;
+
+ case SOCMDMOVEALL:
+ selectFields(true);
+ break;
+
+ case SOCMDREMOVESEL:
+ deselectFields(false);
+ break;
+
+ case SOCMDREMOVEALL:
+ deselectFields(true);
+ break;
+
+ case SOCMDMOVEUP:
+ changeSelectionOrder(-1);
+ break;
+
+ case SOCMDMOVEDOWN:
+ changeSelectionOrder(1);
+ break;
+
+ default:
+ // System.err.println( exception);
+ break;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+ }
+
+ public void addFieldSelectionListener(XFieldSelectionListener xFieldSelection)
+ {
+ this.xFieldSelection = xFieldSelection;
+ this.xFieldSelection.setID(sIncSuffix);
+ }
+
+ public void setAppendMode(boolean _AppendMode)
+ {
+ AppendMode = _AppendMode;
+ }
+
+ 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
+ {
+ final String AccessTextMoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 39);
+ final String AccessTextRemoveSelected = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 40);
+ final String AccessTextMoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 41);
+ final String AccessTextRemoveAll = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 42);
+ final String AccessMoveFieldUp = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 43);
+ final String AccessMoveFieldDown = CurUnoDialog.m_oResource.getResText(UIConsts.RID_DB_COMMON + 44);
+
+ FirstHelpIndex = _FirstHelpIndex;
+ short curtabindex = UnoDialog.setInitialTabindex(_iStep);
+ int ShiftButtonCount = 2;
+ int a = 0;
+ this.CurUnoDialog = CurUnoDialog;
+ this.CompPosX = CompPosX;
+ this.CompPosY = CompPosY;
+ this.CompHeight = CompHeight;
+ this.CompWidth = CompWidth;
+ Object btnmoveall = null;
+ Object btnremoveall = null;
+
+ final int cmdButtonWidth = 16;
+ final int cmdButtonHoriDist = 4;
+ final int lblHeight = 8;
+ final int lblVertiDist = 2;
+
+ ListBoxWidth = new Integer(((CompWidth - 3 * cmdButtonHoriDist - 2 * cmdButtonWidth) / 2));
+ Integer cmdShiftButtonPosX = new Integer((CompPosX + ListBoxWidth.intValue() + cmdButtonHoriDist));
+ Integer ListBoxPosY = new Integer(CompPosY + lblVertiDist + lblHeight);
+ Integer ListBoxHeight = new Integer(CompHeight - 8 - 2);
+ SelListBoxPosX = new Integer(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist);
+
+ IStep = new Integer(_iStep);
+ if (bshowFourButtons == true)
+ {
+ ShiftButtonCount = 4;
+ }
+ Integer[] ShiftButtonPosY = getYButtonPositions(ShiftButtonCount);
+ Integer[] MoveButtonPosY = getYButtonPositions(2);
+ Integer cmdMoveButtonPosX = new Integer(SelListBoxPosX.intValue() + ListBoxWidth.intValue() + cmdButtonHoriDist);
+
+ Integer CmdButtonWidth = new Integer(cmdButtonWidth);
+
+ sIncSuffix = "_" + com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "lblFields_");
+
+ // Label
+ 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)
+ });
+
+ // Listbox 'Available fields'
+ 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
+ });
+
+ 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
+ });
+
+ 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
+ });
+ }
+ 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
+ });
+
+ 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
+ });
+ }
+
+ FontDescriptor oFontDesc = new FontDescriptor();
+ oFontDesc.Name = "StarSymbol";
+
+ // Label 'Fields in the form'
+ 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
+ });
+
+ // ListBox 'Fields in the form'
+ xSelectedFieldsListBox = 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
+ });
+
+ 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
+ });
+
+ 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
+ });
+
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveselected, AccessTextMoveSelected);
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(btnremoveselected, AccessTextRemoveSelected);
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(xFieldsListBox, JavaTools.replaceSubString(slblFields, "", "~"));
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(xSelectedFieldsListBox, JavaTools.replaceSubString(slblSelFields, "", "~"));
+ if (btnmoveall != null)
+ {
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveall, AccessTextMoveAll);
+ }
+ if (btnremoveall != null)
+ {
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(btnremoveall, AccessTextRemoveAll);
+ }
+ if (btnmoveup != null)
+ {
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveup, AccessMoveFieldUp);
+ }
+ if (btnmovedown != null)
+ {
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmovedown, AccessMoveFieldDown);
+ }
+
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ // Todo: If Value is getting smaller than zero -> throw exception
+ private Integer[] getYButtonPositions(int ButtonCount)
+ {
+ Integer[] YPosArray;
+ if (ButtonCount > 0)
+ {
+ YPosArray = new Integer[ButtonCount];
+ final int cmdButtonHeight = 14;
+ final int cmdButtonVertiDist = 2;
+
+ YPosArray[0] = new Integer( (CompPosY + 10 + (((CompHeight - 10) - (ButtonCount * cmdButtonHeight) - ((ButtonCount - 1) * cmdButtonVertiDist)) / 2)));
+ if (ButtonCount > 1)
+ {
+ for (int i = 1; i < ButtonCount; i++)
+ {
+ YPosArray[i] = new Integer(YPosArray[i - 1].intValue() + cmdButtonHeight + cmdButtonVertiDist);
+ }
+ }
+ return YPosArray;
+ }
+ return null;
+ }
+
+ public Integer getListboxWidth()
+ {
+ return this.ListBoxWidth;
+ }
+
+ private void changeSelectionOrder(int iNeighbor)
+ {
+ short[] iSelIndices = xSelectedFieldsListBox.getSelectedItemsPos();
+ // Todo: we are assuming that the array starts with the lowest index. Verfy this assumption!!!!!
+ if (iSelIndices.length == 1)
+ {
+ short iSelIndex = iSelIndices[0];
+ String[] NewItemList = xSelectedFieldsListBox.getItems();
+ String CurItem = NewItemList[iSelIndex];
+ String NeighborItem = NewItemList[iSelIndex + iNeighbor];
+ NewItemList[iSelIndex + iNeighbor] = CurItem;
+ NewItemList[iSelIndex] = NeighborItem;
+ CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", NewItemList);
+ xSelectedFieldsListBox.selectItem(CurItem, true);
+ if (xFieldSelection != null)
+ {
+ if (iNeighbor < 0)
+ {
+ xFieldSelection.moveItemUp(CurItem);
+ }
+ else
+ {
+ xFieldSelection.moveItemDown(CurItem);
+ }
+ }
+ }
+ }
+
+ public void toggleListboxControls(Boolean BDoEnable)
+ {
+ try
+ {
+ CurUnoDialog.setControlProperty("lblFields" + sIncSuffix, "Enabled", BDoEnable);
+ CurUnoDialog.setControlProperty("lblSelFields" + sIncSuffix, "Enabled", BDoEnable);
+ CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, "Enabled", BDoEnable);
+ CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "Enabled", BDoEnable);
+
+ if (BDoEnable.booleanValue() == true)
+ {
+ toggleListboxButtons((short) - 1, (short) - 1);
+ }
+ else
+ {
+ CurUnoDialog.setControlProperty("cmdRemoveAll" + sIncSuffix, "Enabled", BDoEnable);
+ CurUnoDialog.setControlProperty("cmdRemoveSelected" + sIncSuffix, "Enabled", BDoEnable);
+ toggleMoveButtons(BDoEnable.booleanValue(), BDoEnable.booleanValue());
+ }
+ }
+ 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
+ {
+ boolean bmoveUpenabled = false;
+ boolean bmoveDownenabled = false;
+ CurUnoDialog.selectListBoxItem(xFieldsListBox, iFieldsSelIndex);
+ CurUnoDialog.selectListBoxItem(xSelectedFieldsListBox, iSelFieldsSelIndex);
+ int SelListBoxSelLength = xSelectedFieldsListBox.getSelectedItems().length;
+ int ListBoxSelLength = xFieldsListBox.getSelectedItems().length;
+ boolean bIsFieldSelected = (ListBoxSelLength > 0);
+ int FieldCount = xFieldsListBox.getItemCount();
+ boolean bSelectSelected = (SelListBoxSelLength > 0);
+ int SelectCount = xSelectedFieldsListBox.getItemCount();
+ if (bSelectSelected)
+ {
+ short[] iSelIndices = xSelectedFieldsListBox.getSelectedItemsPos();
+ bmoveUpenabled = ((iSelIndices[0] > 0) && (iSelIndices.length == 1));
+ bmoveDownenabled = (((iSelIndices[SelListBoxSelLength - 1]) < (short) (SelectCount - 1)) && (iSelIndices.length == 1));
+ }
+ CurUnoDialog.setControlProperty("cmdRemoveAll" + sIncSuffix, "Enabled", new Boolean(SelectCount >= 1));
+ CurUnoDialog.setControlProperty("cmdRemoveSelected" + sIncSuffix, "Enabled", new Boolean(bSelectSelected));
+ toggleMoveButtons((FieldCount >= 1), bIsFieldSelected);
+ CurUnoDialog.setControlProperty("cmdMoveUp" + sIncSuffix, "Enabled", new Boolean(bmoveUpenabled));
+ CurUnoDialog.setControlProperty("cmdMoveDown" + sIncSuffix, "Enabled", new Boolean(bmoveDownenabled));
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ protected void toggleMoveButtons(boolean _btoggleMoveAll, boolean _btoggleMoveSelected)
+ {
+ boolean btoggleMoveAll = (((xFieldsListBox.getItemCount() + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveAll));
+ boolean btoggleMoveSelected = (((xFieldsListBox.getSelectedItems().length + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveSelected));
+ CurUnoDialog.setControlProperty("cmdMoveAll" + sIncSuffix, "Enabled", new Boolean(btoggleMoveAll));
+ CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, "Enabled", new Boolean(btoggleMoveSelected));
+ }
+
+ public void setMultipleMode(boolean _bisMultiple)
+ {
+ xFieldsListBox.setMultipleMode(_bisMultiple);
+ xSelectedFieldsListBox.setMultipleMode(_bisMultiple);
+ }
+
+ public void emptyFieldsListBoxes()
+ {
+ try
+ {
+ toggleListboxControls(Boolean.FALSE);
+ 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)
+ {
+ // int MaxIndex = SecondList.length;
+ xFieldsListBox.addItems(AllFieldNames, (short) 0);
+ toggleListboxButtons((short) - 1, (short) - 1);
+ }
+
+ public void intializeSelectedFields(String[] _SelectedFieldNames)
+ {
+ xSelectedFieldsListBox.addItems(_SelectedFieldNames, xSelectedFieldsListBox.getItemCount());
+ }
+
+ private void removeAllItems(XListBox _xListBox)
+ {
+ _xListBox.removeItems((short) 0, _xListBox.getItemCount());
+ }
+
+ // Note Boolean Parameter
+ public void initialize(String[] _AllFieldNames, boolean _AppendMode)
+ {
+ AppendMode = _AppendMode;
+ removeAllItems(xFieldsListBox);
+ xFieldsListBox.addItems(_AllFieldNames, (short) 0);
+ AllFieldNames = xFieldsListBox.getItems();
+ if ((xSelectedFieldsListBox.getItemCount() > 0) && (!AppendMode))
+ {
+ removeAllItems(xSelectedFieldsListBox);
+ }
+ toggleListboxControls(Boolean.TRUE);
+ }
+
+ public void initialize(String[][] _AllFieldNamesTable, boolean _AppendMode, int _maxfieldcount)
+ {
+ String[] AllFieldNames_ = new String[_AllFieldNamesTable.length];
+ for (int i = 0; i < _AllFieldNamesTable.length; i++)
+ {
+ AllFieldNames_[i] = _AllFieldNamesTable[i][0];
+ }
+ initialize(AllFieldNames_, _AppendMode, _maxfieldcount);
+ }
+
+ public void initialize(String[] _AllFieldNames, boolean _AppendMode, int _maxfieldcount)
+ {
+ maxfieldcount = _maxfieldcount;
+ initialize(_AllFieldNames, _AppendMode);
+ }
+
+ public void initialize(String[] _AllFieldNames, String[] _SelFieldNames, boolean _AppendMode)
+ {
+ removeAllItems(xSelectedFieldsListBox);
+ xSelectedFieldsListBox.addItems(_SelFieldNames, (short) 0);
+ initialize(_AllFieldNames, _AppendMode);
+ }
+
+ public void selectFields(boolean bMoveAll)
+ {
+ // int CurIndex;
+ short iFieldSelected = (short) - 1;
+ short iSelFieldSelected = (short) - 1;
+ // int MaxCurTarget = xSelectedFieldsListBox.getItemCount();
+ String[] SelFieldItems;
+ if (bMoveAll)
+ {
+ SelFieldItems = xFieldsListBox.getItems();
+ removeAllItems(xFieldsListBox);
+ if (!AppendMode)
+ {
+ removeAllItems(xSelectedFieldsListBox);
+ xSelectedFieldsListBox.addItems(AllFieldNames, (short) 0);
+ }
+ else
+ {
+ xSelectedFieldsListBox.addItems(SelFieldItems, xSelectedFieldsListBox.getItemCount());
+ }
+ }
+ else
+ {
+ SelFieldItems = xFieldsListBox.getSelectedItems();
+ int MaxSourceSelected = SelFieldItems.length;
+ if (MaxSourceSelected > 0)
+ {
+ iFieldSelected = xFieldsListBox.getSelectedItemPos();
+ iSelFieldSelected = xSelectedFieldsListBox.getSelectedItemPos();
+ short[] SourceSelList = new short[xFieldsListBox.getSelectedItemsPos().length];
+ SourceSelList = xFieldsListBox.getSelectedItemsPos();
+ xSelectedFieldsListBox.addItems(SelFieldItems, xSelectedFieldsListBox.getItemCount());
+ CurUnoDialog.removeSelectedItems(xFieldsListBox);
+ xSelectedFieldsListBox.selectItemPos((short) 0, xSelectedFieldsListBox.getSelectedItems().length > 0);
+ }
+ }
+ toggleListboxButtons(iFieldSelected, iSelFieldSelected);
+ if (xFieldSelection != null)
+ {
+ xFieldSelection.shiftFromLeftToRight(SelFieldItems, xSelectedFieldsListBox.getItems());
+ }
+ }
+
+ public void deselectFields(boolean bMoveAll)
+ {
+ // int m = 0;
+ String SearchString;
+ short iOldFieldSelected = xFieldsListBox.getSelectedItemPos();
+ short iOldSelFieldSelected = xSelectedFieldsListBox.getSelectedItemPos();
+ String[] OldSelFieldItems = xSelectedFieldsListBox.getSelectedItems();
+ if (bMoveAll)
+ {
+ OldSelFieldItems = xSelectedFieldsListBox.getItems();
+ removeAllItems(xFieldsListBox);
+ xFieldsListBox.addItems(AllFieldNames, (short) 0);
+ removeAllItems(xSelectedFieldsListBox);
+ }
+ else
+ {
+ int MaxOriginalCount = AllFieldNames.length;
+ // int MaxSelected = OldSelFieldItems.length;
+ String[] SelList = xFieldsListBox.getItems();
+ Vector<String> NewSourceVector = new Vector<String>();
+ for (int i = 0; i < MaxOriginalCount; i++)
+ {
+ SearchString = AllFieldNames[i];
+ if (JavaTools.FieldInList(SelList, SearchString) != -1)
+ {
+ NewSourceVector.addElement(SearchString);
+ }
+ else if (JavaTools.FieldInList(OldSelFieldItems, SearchString) != -1)
+ {
+ NewSourceVector.addElement(SearchString);
+ }
+ }
+ xFieldsListBox.removeItems((short) 0, xFieldsListBox.getItemCount());
+ if (NewSourceVector.size() > 0)
+ {
+ String[] NewSourceList = new String[NewSourceVector.size()];
+ NewSourceVector.toArray(NewSourceList);
+ xFieldsListBox.addItems(NewSourceList, (short) 0);
+ }
+ CurUnoDialog.removeSelectedItems(xSelectedFieldsListBox);
+ }
+ toggleListboxButtons(iOldFieldSelected, iOldSelFieldSelected);
+ String[] NewSelFieldItems = xSelectedFieldsListBox.getItems();
+ if (xFieldSelection != null)
+ {
+ xFieldSelection.shiftFromRightToLeft(OldSelFieldItems, NewSelFieldItems);
+ }
+ }
+
+ public void addItemsToFieldsListbox(String[] _sItems)
+ {
+ String[] sOldList = xFieldsListBox.getItems();
+ for (int i = 0; i < _sItems.length; i++)
+ {
+ if (JavaTools.FieldInList(sOldList, _sItems[i]) < 0)
+ {
+ xFieldsListBox.addItem(_sItems[i], xFieldsListBox.getItemCount());
+ }
+ }
+ }
+
+ public String[] getSelectedFieldNames()
+ {
+ return (String[]) CurUnoDialog.getControlProperty("lstSelFields" + sIncSuffix, "StringItemList");
+ }
+
+ 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)
+ {
+ bisModified = _bModified;
+ }
+
+ public boolean isModified()
+ {
+ return bisModified;
+ }
+
+ 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
new file mode 100644
index 000000000000..85b797d3b640
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java
@@ -0,0 +1,1089 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.Vector;
+import com.sun.star.awt.ItemEvent;
+import com.sun.star.awt.TextEvent;
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertyContainer;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lib.uno.helper.PropertySet;
+import com.sun.star.sdbc.DataType;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.wizards.common.NumberFormatter;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.db.FieldColumn;
+import com.sun.star.wizards.db.QueryMetaData;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+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 static String[] sBooleanValues;
+ // 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;
+ WizardDialog CurUnoDialog;
+ private int BaseID = 2300;
+ private String sIncSuffix;
+ private ControlRow[] oControlRows;
+ // private Vector FilterNames;
+ private String sDuplicateCondition;
+ final int SOOPTORMODE = 100;
+ final int SOOPTANDMODE = 101;
+ QueryMetaData oQueryMetaData;
+ int iDateTimeFormat;
+ int iDateFormat;
+ int iTimeFormat;
+ private PropertyValue[][] filterconditions;
+ private short curtabindex;
+ XMultiServiceFactory xMSF;
+ 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_FIRSTBOOLFIELDNAME = 256 + 1;
+ final int SO_SECONDBOOLFIELDNAME = 256 + 2;
+ final int SO_THIRDBOOLFIELDNAME = 256 + 3;
+ final int SO_FOURTHBOOLFIELDNAME = 256 + 4;
+ int SO_BOOLEANLIST[] =
+ {
+ SO_FIRSTBOOLFIELDNAME, SO_SECONDBOOLFIELDNAME, SO_THIRDBOOLFIELDNAME, SO_FOURTHBOOLFIELDNAME
+ };
+ 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
+ {
+
+ public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
+ {
+ int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
+ String sControlName = "";
+ switch (iKey)
+ {
+ // case SOOPTQUERYMODE:
+ // getfilterstate();
+ case SO_FIRSTFIELDNAME:
+ case SO_SECONDFIELDNAME:
+ case SO_THIRDFIELDNAME:
+ case SO_FOURTHFIELDNAME:
+ sControlName = getControlName(EventObject.Source);
+ String sControlNameSuffix = sIncSuffix + "_" + getIndexNumber(sControlName);
+ XListBox xCurFieldListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName));
+ String CurDisplayFieldName = xCurFieldListBox.getSelectedItem();
+ FieldColumn CurFieldColumn = new FieldColumn(oQueryMetaData, CurDisplayFieldName);
+
+ String sControlNameTextValue = "txtValue" + sControlNameSuffix;
+// String sControlNameBooleanList = "lstBoolean" + sControlNameSuffix;
+// if (aFieldColumn.FieldType == DataType.BOOLEAN)
+// {
+// // scheint aufgrund eines Fehlers in Toolkit nicht zu funktionieren
+// CurUnoDialog.setControlVisible(sControlNameTextValue, false);
+// CurUnoDialog.setControlVisible(sControlNameBooleanList, true);
+// }
+// else
+// {
+// CurUnoDialog.setControlVisible(sControlNameTextValue, true);
+// CurUnoDialog.setControlVisible(sControlNameBooleanList, false);
+
+ XControl xValueControl = CurUnoDialog.xDlgContainer.getControl(sControlNameTextValue);
+ XInterface xValueModel = (XInterface) UnoDialog.getModel(xValueControl);
+ Helper.setUnoPropertyValue(xValueModel, "TreatAsNumber", Boolean.valueOf(CurFieldColumn.isNumberFormat()));
+ final NumberFormatter aNumberFormatter = oQueryMetaData.getNumberFormatter();
+ aNumberFormatter.setNumberFormat(xValueModel, CurFieldColumn.getDBFormatKey(), aNumberFormatter);
+// }
+
+ break;
+ case SO_FIRSTCONDITION:
+ case SO_SECONDCONDITION:
+ case SO_THIRDCONDITION:
+ case SO_FOURTHCONDITION:
+ sControlName = getControlName(EventObject.Source);
+ break;
+ case SOOPTORMODE:
+ case SOOPTANDMODE:
+ // getfilterstate();
+ return;
+
+ case SO_FIRSTBOOLFIELDNAME:
+ case SO_SECONDBOOLFIELDNAME:
+ case SO_THIRDBOOLFIELDNAME:
+ case SO_FOURTHBOOLFIELDNAME:
+ sControlName = getControlName(EventObject.Source);
+ break;
+
+ default:
+ break;
+ }
+ togglefollowingControlRow(sControlName);
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+ }
+
+ class TextListenerImpl implements com.sun.star.awt.XTextListener
+ {
+
+ public void textChanged(TextEvent EventObject)
+ {
+ String sName = getControlName(EventObject.Source);
+ togglefollowingControlRow(sName);
+ }
+
+ public void disposing(EventObject EventObject)
+ {
+ }
+ }
+
+ public void fieldconditionchanged(ItemEvent EventObject)
+ {
+ String sName = getControlName(EventObject.Source);
+ togglefollowingControlRow(sName);
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject)
+ {
+ }
+
+ class ActionListenerImpl implements com.sun.star.awt.XActionListener
+ {
+
+ public void disposing(EventObject eventObject)
+ {
+ }
+
+ public void actionPerformed(com.sun.star.awt.ActionEvent actionEvent)
+ {
+ getfilterstate();
+ }
+ }
+
+ public static String getIndexNumber(String _sStr)
+ {
+ String sLastNumber = _sStr.substring(_sStr.length() - 1, _sStr.length());
+ return sLastNumber;
+ }
+
+ /**
+ * Enable the next ControlRow if the Condition is complete in the current line
+ *
+ * @param _scurName every control name ends with something like _1, _2, _3 this is the index number
+ * we try to interpret to check which line we currently use. (number - 1)
+ */
+ private void togglefollowingControlRow(String _scurName)
+ {
+ // String sNameSuffix = sIncSuffix + "_" + _scurName.substring(_scurName.length() - 1, _scurName.length());
+ int Index = Integer.valueOf(getIndexNumber(_scurName)).intValue();
+ if (Index < oControlRows.length)
+ {
+ boolean bValue = oControlRows[Index - 1].isConditionComplete();
+ 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());
+ final String sName = AnyConverter.toString(xPSet.getPropertyValue("Name"));
+ return sName;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return "";
+ }
+
+ public PropertyValue[][] getFilterConditions()
+ {
+ // ControlRow CurControlRow;
+ // getfilterstate();
+ int nFilterCount = getFilterCount();
+ if (nFilterCount > 0)
+ {
+ try
+ {
+ final String serviceName = "com.sun.star.beans.PropertyBag";
+ final XPropertyContainer column = (XPropertyContainer) UnoRuntime.queryInterface(XPropertyContainer.class, oQueryMetaData.xMSF.createInstance(serviceName));
+
+ column.addProperty("Type", PropertyAttribute.BOUND, DataType.VARCHAR);
+ column.addProperty("Name", PropertyAttribute.BOUND, "");
+ final XPropertySet columnSet = UnoRuntime.queryInterface(XPropertySet.class, column);
+
+ if ( oQueryMetaData.getSQLQueryComposer().getQuery().length() == 0)
+ {
+ final String fromClause = oQueryMetaData.getSQLQueryComposer().getFromClause();
+ StringBuffer sql = new StringBuffer();
+ sql.append(oQueryMetaData.getSQLQueryComposer().getSelectClause(true));
+ sql.append(' ');
+ sql.append(fromClause);
+ oQueryMetaData.getSQLQueryComposer().getQueryComposer().setElementaryQuery(sql.toString());
+ }
+ int a = 0;
+ for (int i = 0; i < RowCount; i++)
+ {
+ ControlRow CurControlRow = oControlRows[i];
+ if (CurControlRow.isEnabled())
+ {
+ if (CurControlRow.isConditionComplete())
+ {
+ String sFieldName = CurControlRow.getSelectedFieldName();
+ int nOperator = (int) CurControlRow.getSelectedOperator();
+ FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName);
+ columnSet.setPropertyValue("Name", aFieldColumn.getFieldName());
+ columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type"));
+ Object value = CurControlRow.getValue();
+ switch(aFieldColumn.getFieldType())
+ {
+ case DataType.TIMESTAMP:
+ case DataType.DATE:
+ value = ((Double)value) - oQueryMetaData.getNullDateCorrection();
+ break;
+ }
+ column.addProperty("Value", PropertyAttribute.MAYBEVOID, value);
+ columnSet.setPropertyValue("Value", value);
+ oQueryMetaData.getSQLQueryComposer().getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL,nOperator);
+ }
+ }
+ }
+ filterconditions = oQueryMetaData.getSQLQueryComposer().getQueryComposer().getStructuredFilter();
+ int[] iduplicate = JavaTools.getDuplicateFieldIndex(filterconditions);
+ 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", Integer.valueOf(1), Integer.valueOf(2)));
+ return new PropertyValue[][]
+ {
+ };
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.getLogger(FilterComponent.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ else
+ {
+ filterconditions = new PropertyValue[0][0];
+ }
+ return filterconditions;
+ }
+
+ public static String getDisplayCondition(String _BaseString, PropertyValue _filtercondition, QueryMetaData _CurDBMetaData)
+ {
+ try
+ {
+ String FieldName;
+ if (_CurDBMetaData != null)
+ {
+ FieldColumn CurDBFieldColumn = _CurDBMetaData.getFieldColumnByDisplayName(_filtercondition.Name);
+ 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 = "";
+ if (!AnyConverter.isVoid(_filtercondition.Value))
+ {
+ sDisplayValue = AnyConverter.toString(_filtercondition.Value);
+ }
+ sreturn = JavaTools.replaceSubString(sreturn, sDisplayValue, "<VALUE>");
+ return sreturn;
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return "";
+ }
+
+ private int getfilterstate()
+ {
+ boolean bisany = true;
+ int ifilterstate = SOI_MATCHALL;
+ bisany = (this.optMatchAny.getState()) == true;
+ if (bisany)
+ {
+ ifilterstate = SOI_MATCHANY;
+ }
+ else
+ {
+ ifilterstate = SOI_MATCHALL;
+ }
+ return ifilterstate;
+ }
+
+ private void addfiltercondition(int _index, String _curFieldName, Object _curValue, int _curOperator)
+ {
+ String ValString = String.valueOf(_curValue);
+ PropertyValue oPropertyValue = Properties.createProperty(_curFieldName, ValString, _curOperator);
+ getfilterstate();
+ if (getfilterstate() == this.SOI_MATCHALL)
+ {
+ if (_index == 0)
+ {
+ filterconditions[0] = new PropertyValue[getFilterCount()];
+ }
+ filterconditions[0][_index] = new PropertyValue();
+ filterconditions[0][_index] = oPropertyValue;
+ }
+ }
+
+ private int getFilterCount()
+ {
+ int a = 0;
+ for (int i = 0; i < RowCount; i++)
+ {
+ if (oControlRows[i].isEnabled() && oControlRows[i].isConditionComplete())
+ {
+ a++;
+ }
+ }
+ return a;
+ // FilterCount = a;
+ // return FilterCount;
+ }
+
+ /** 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)
+ {
+ this.curHelpID = _firstHelpID;
+ this.xMSF = _xMSF;
+ this.IStep = Integer.valueOf(iStep);
+
+ curtabindex = UnoDialog.setInitialTabindex(iStep);
+ this.CurUnoDialog = CurUnoDialog;
+ this.RowCount = FilterCount;
+ this.oQueryMetaData = _oQueryMetaData;
+ boolean bEnabled;
+ sIncSuffix = com.sun.star.wizards.common.Desktop.getIncrementSuffix(CurUnoDialog.getDlgNameAccess(), "optMatchAll");
+ // iStartPosX = iPosX;
+ // iStartPosY = iPosY;
+
+ 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);
+ sLogicOperators = CurUnoDialog.m_oResource.getResArray(BaseID + 26, 10 /* 7 */); // =, <>, <, >, <=, >=, like, !like, is null, !is null
+ sBooleanValues = CurUnoDialog.m_oResource.getResArray(BaseID + 36, 2); // true, false
+
+ sDuplicateCondition = CurUnoDialog.m_oResource.getResText(BaseID + 89);
+
+ // create Radiobuttons
+ // * match all
+ // * match one
+ optMatchAll = CurUnoDialog.insertRadioButton("optMatchAll" + sIncSuffix, SOOPTANDMODE, new ItemListenerImpl(),
+ new String[]
+ {
+ "Height",
+ "HelpURL",
+ "Label",
+ "PositionX",
+ "PositionY",
+ "State",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Integer.valueOf(9),
+ "HID:" + curHelpID++,
+ soptMatchAll,
+ Integer.valueOf(iPosX),
+ Integer.valueOf(iPosY),
+ Short.valueOf((short) 1),
+ IStep,
+ Short.valueOf(curtabindex++),
+ Integer.valueOf(203)
+ });
+ optMatchAny = CurUnoDialog.insertRadioButton("optMatchAny" + sIncSuffix, SOOPTORMODE, new ItemListenerImpl(),
+ new String[]
+ {
+ "Height",
+ "HelpURL",
+ "Label",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Integer.valueOf(9),
+ "HID:" + curHelpID++,
+ soptMatchAny,
+ Integer.valueOf(iPosX),
+ Integer.valueOf(iPosY + 12),
+ IStep,
+ Short.valueOf(curtabindex++),
+ Integer.valueOf(203)
+ });
+ getfilterstate();
+
+ oControlRows = new ControlRow[FilterCount];
+ for (int i = 0; i < FilterCount; i++)
+ {
+ bEnabled = (i == 0);
+ oControlRows[i] = new ControlRow(iPosX, iPosY + 20, i, bEnabled, (this.curHelpID + (i * 3)));
+ iPosY += 43;
+ }
+ }
+
+ public void initialize(PropertyValue[][] _filterconditions, String[] _fieldnames)
+ {
+ // String aFieldNamesWithAdditionalEmpty[] = new String[_fieldnames.length + 1];
+ // for (int i = 0; i < _fieldnames.length; i++)
+ // {
+ // aFieldNamesWithAdditionalEmpty[i] = _fieldnames[i];
+ // }
+ // aFieldNamesWithAdditionalEmpty[_fieldnames.length] = "";
+
+ int i;
+ for (i = 0; i < RowCount; i++)
+ {
+ oControlRows[i].setFieldNames(_fieldnames);
+ // oControlRows[i].setFieldNames(aFieldNamesWithAdditionalEmpty);
+ }
+ this.filterconditions = _filterconditions;
+ PropertyValue[] curfilterconditions;
+ // int a;
+ if (_filterconditions.length == 1)
+ {
+ curfilterconditions = filterconditions[0];
+ for (i = 0; i < curfilterconditions.length; i++)
+ {
+ oControlRows[i].setCondition(filterconditions[0][i]);
+ }
+ }
+ else
+ {
+ for (i = 0; i < filterconditions.length; i++)
+ {
+ oControlRows[i].setCondition(filterconditions[i][0]);
+ }
+ }
+ while (i < oControlRows.length)
+ {
+ oControlRows[i].settovoid();
+ boolean bdoenable;
+ if (i > 0)
+ {
+ bdoenable = oControlRows[i - 1].isConditionComplete();
+ }
+ else
+ {
+ bdoenable = true;
+ }
+ oControlRows[i].setEnabled(bdoenable);
+ i++;
+ }
+ }
+
+ public void addNumberFormats()
+ {
+ iDateFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("YYYY-MM-DD");
+ iTimeFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("HH:MM:SS");
+ iDateTimeFormat = oQueryMetaData.getNumberFormatter().defineNumberFormat("YYYY-MM-DD HH:MM:SS");
+ }
+
+ // -------------------------------------------------------------------------
+ //
+ //
+ // -------------------------------------------------------------------------
+ class ControlRow
+ {
+
+ private final static int SOLSTFIELDNAME = 3;
+ private final static int SOLSTOPERATOR = 4;
+ private final static int SOTXTVALUE = 5;
+ protected XInterface[] ControlElements = new XInterface[6];
+ private boolean m_bEnabled;
+ String[] FieldNames;
+
+ protected ControlRow(int iCompPosX, int iCompPosY, int Index, boolean _bEnabled, int _firstRowHelpID)
+ {
+ int nFieldWidth = 71;
+ int nOperatorWidth = 70;
+ int nValueWidth = 44;
+
+ int nPosX1 = iCompPosX + 10;
+ int nPosX2 = iCompPosX + 10 + nFieldWidth + 6; // 87
+ int nPosX3 = iCompPosX + 10 + nFieldWidth + 6 + nOperatorWidth + 6;
+
+
+ try
+ {
+ String sCompSuffix = sIncSuffix + "_" + String.valueOf(Index + 1);
+ m_bEnabled = _bEnabled;
+
+ // Label Field
+ ControlElements[0] = (XInterface) CurUnoDialog.insertLabel("lblFieldNames" + sCompSuffix,
+ new String[]
+ {
+ "Enabled",
+ "Height",
+ "Label",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Boolean.valueOf(isEnabled()),
+ Integer.valueOf(9),
+ slblFieldNames,
+ Integer.valueOf(nPosX1),
+ Integer.valueOf(iCompPosY + 13),
+ IStep,
+ Short.valueOf(curtabindex++),
+ Integer.valueOf(nFieldWidth)
+ });
+
+ // Label Operator
+ ControlElements[1] = (XInterface) CurUnoDialog.insertLabel("lblOperators" + sCompSuffix,
+ new String[]
+ {
+ "Enabled",
+ "Height",
+ "Label",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Boolean.valueOf(isEnabled()),
+ Integer.valueOf(9),
+ slblOperators,
+ Integer.valueOf(nPosX2),
+ Integer.valueOf(iCompPosY + 13),
+ IStep,
+ Short.valueOf(curtabindex++),
+ Integer.valueOf(nOperatorWidth)
+ });
+
+ // Label Value
+ ControlElements[2] = (XInterface) CurUnoDialog.insertLabel("lblValue" + sCompSuffix,
+ new String[]
+ {
+ "Enabled",
+ "Height",
+ "Label",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Boolean.valueOf(isEnabled()),
+ Integer.valueOf(9),
+ slblValue,
+ Integer.valueOf(nPosX3),
+ Integer.valueOf(iCompPosY + 13),
+ IStep,
+ Short.valueOf(curtabindex++),
+ Integer.valueOf(nValueWidth)
+ });
+
+ // Listbox Fields
+ ControlElements[SOLSTFIELDNAME] = (XInterface) CurUnoDialog.insertListBox("lstFieldName" + sCompSuffix, SO_FIELDNAMELIST[Index], null, new ItemListenerImpl(),
+ new String[]
+ {
+ "Enabled",
+ "Dropdown",
+ "Height",
+ "HelpURL",
+ "LineCount",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Boolean.valueOf(isEnabled()),
+ Boolean.TRUE,
+ Integer.valueOf(13),
+ "HID:" + _firstRowHelpID++,
+ Short.valueOf(UnoDialog.getListBoxLineCount() /* 7 */),
+ Integer.valueOf(nPosX1),
+ Integer.valueOf(iCompPosY + 23),
+ IStep,
+ Short.valueOf(curtabindex++),
+ Integer.valueOf(nFieldWidth)
+ });
+
+ // Listbox Operators
+ ControlElements[SOLSTOPERATOR] = (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[]
+ {
+ Boolean.valueOf(isEnabled()),
+ Boolean.TRUE,
+ Integer.valueOf(13),
+ "HID:" + _firstRowHelpID++,
+ Short.valueOf((short) sLogicOperators.length /* 7 */),
+ Integer.valueOf(nPosX2),
+ Integer.valueOf(iCompPosY + 23),
+ IStep,
+ sLogicOperators,
+ Short.valueOf(curtabindex++),
+ Integer.valueOf(nOperatorWidth)
+ });
+ ControlElements[SOTXTVALUE] = (XInterface) CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SO_TEXTFIELDLIST[Index], new TextListenerImpl(),
+ new String[]
+ {
+ "Enabled",
+ "Height",
+ "HelpURL",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Width"
+ },
+ new Object[]
+ {
+ Boolean.valueOf(isEnabled()),
+ Integer.valueOf(13),
+ "HID:" + _firstRowHelpID++,
+ Integer.valueOf(nPosX3),
+ Integer.valueOf(iCompPosY + 23),
+ IStep,
+ Short.valueOf(curtabindex++),
+ Integer.valueOf(nValueWidth)
+ });
+
+// ControlElements[6] = CurUnoDialog.insertListBox((new StringBuilder()).append("lstBoolean").append(sCompSuffix).toString(), SO_BOOLEANLIST[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) 2),
+// new Integer(nPosX3 + 44), new Integer(iCompPosY + 23),
+// IStep,
+// FilterComponent.sBooleanValues,
+// new Short(curtabindex++),
+// new Integer(nValueWidth)
+// });
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ /**
+ * @returns true if the current condition is complete, all needed fields are filled with values.
+ * So we can enable the next.
+ */
+ boolean isConditionComplete()
+ {
+ try
+ {
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems"));
+ if (SelFields.length > 0)
+ {
+ int nSelOperator = getSelectedOperator();
+ // short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
+ if (nSelOperator == com.sun.star.sdb.SQLFilterOperator.SQLNULL
+ || /* is null */ nSelOperator == com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL) /* is not null */
+
+ {
+ // disable value field
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[2]), "Enabled", Boolean.FALSE);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Enabled", Boolean.FALSE);
+
+ return true;
+ }
+ else
+ {
+ // enable value field
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[2]), "Enabled", Boolean.TRUE);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Enabled", Boolean.TRUE);
+ }
+ if (nSelOperator != -1)
+ {
+ Object oValue = Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue");
+ if (!AnyConverter.isVoid(oValue))
+ {
+ String sValue = (String.valueOf(oValue));
+ return (!sValue.equals(""));
+ }
+// String sBoolValue="";
+// short aSelectedBoolValue[] = (short[])Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[6]), "SelectedItems");
+// if (aSelectedBoolValue.length > 0)
+// {
+// sBoolValue = String.valueOf(aSelectedBoolValue[0] == 1);
+// return !sBoolValue.equals("");
+// }
+ }
+ }
+ return false;
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ private void fieldnamechanged(ItemEvent EventObject)
+ {
+ int i = 0;
+ }
+
+ 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))
+ {
+ String sValue = AnyConverter.toString(_filtercondition.Value);
+ if (sValue.indexOf("{D '") > -1)
+ {
+ sValue = JavaTools.replaceSubString(sValue, "", "{D '");
+ sValue = JavaTools.replaceSubString(sValue, "", "' }");
+ try
+ {
+ oQueryMetaData.getNumberFormatter().convertStringToNumber(iDateFormat, sValue);
+ }
+ catch (java.lang.Exception ex)
+ {
+ Logger.getLogger(FilterComponent.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ else if (sValue.indexOf("{T '") > -1)
+ {
+ sValue = JavaTools.replaceSubString(sValue, "", "{T '");
+ sValue = JavaTools.replaceSubString(sValue, "", "' }");
+ try
+ {
+ oQueryMetaData.getNumberFormatter().convertStringToNumber(iTimeFormat, sValue);
+ }
+ catch (java.lang.Exception ex)
+ {
+ Logger.getLogger(FilterComponent.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ }
+ 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)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
+
+ protected void setFieldNames(String[] _FieldNames)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "StringItemList", _FieldNames);
+ FieldNames = _FieldNames;
+ }
+
+ protected boolean isEnabled()
+ {
+ return m_bEnabled;
+ }
+
+ private void settovoid()
+ {
+ CurUnoDialog.deselectListBox(ControlElements[SOLSTFIELDNAME]);
+ CurUnoDialog.deselectListBox(ControlElements[SOLSTOPERATOR]);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue", com.sun.star.uno.Any.VOID);
+ }
+
+ private void setEnabled(boolean _bEnabled)
+ {
+ // enable all Controls Fieldname, operator, value
+ for (int i = 0; i < ControlElements.length; i++)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[i]), "Enabled", Boolean.valueOf(_bEnabled));
+ }
+ m_bEnabled = _bEnabled;
+ if (isEnabled())
+ {
+ 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
+ });
+ }
+ }
+ else if (!isConditionComplete())
+ {
+ 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;
+ }
+
+ // TODO: check if it is really useful to match the indices of the listbox the API constants
+ // =, <>, <, >, <=, >=, like, !like, is null, !is null
+ protected short getSelectedOperator()
+ {
+ try
+ {
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
+ switch (SelFields[0])
+ {
+ case 0:
+ return com.sun.star.sdb.SQLFilterOperator.EQUAL;
+ case 1:
+ return com.sun.star.sdb.SQLFilterOperator.NOT_EQUAL;
+ case 2:
+ return com.sun.star.sdb.SQLFilterOperator.LESS;
+ case 3:
+ return com.sun.star.sdb.SQLFilterOperator.GREATER;
+ case 4:
+ return com.sun.star.sdb.SQLFilterOperator.LESS_EQUAL;
+ case 5:
+ return com.sun.star.sdb.SQLFilterOperator.GREATER_EQUAL;
+ case 6:
+ return com.sun.star.sdb.SQLFilterOperator.LIKE;
+ case 7:
+ return com.sun.star.sdb.SQLFilterOperator.NOT_LIKE;
+ case 8:
+ return com.sun.star.sdb.SQLFilterOperator.SQLNULL;
+ case 9:
+ return com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL;
+ default:
+ return -1;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ return -1;
+ }
+
+ // TODO make a difference between Text and Numbers
+ protected Object getValue()
+ {
+ return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "EffectiveValue"));
+ }
+
+ protected Object getText()
+ {
+ return (Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOTXTVALUE]), "Text"));
+ }
+
+ protected String getDateTimeString(boolean bgetDate)
+ {
+ double dblValue = ((Double) getValue()).doubleValue();
+ NumberFormatter oNumberFormatter = oQueryMetaData.getNumberFormatter();
+ return oNumberFormatter.convertNumberToString(iDateTimeFormat, dblValue);
+ }
+ }
+}
+// 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
new file mode 100644
index 000000000000..dcd378369c5f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/ImageList.java
@@ -0,0 +1,1133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+
+import com.sun.star.awt.Key;
+import com.sun.star.awt.KeyEvent;
+import com.sun.star.awt.MouseEvent;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XButton;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XItemEventBroadcaster;
+import com.sun.star.awt.XItemListener;
+import com.sun.star.awt.XKeyListener;
+import com.sun.star.awt.XMouseListener;
+import com.sun.star.awt.XWindow;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.IRenderer;
+import com.sun.star.wizards.ui.event.*;
+
+
+//import com.sun.star.awt.ItemEvent;
+//import com.sun.star.awt.XItemListener;
+
+
+import javax.swing.ListModel;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+/**
+ *
+ * @author rpiterman
+ */
+public class ImageList implements XItemEventBroadcaster, ListDataListener
+{
+
+ // private XControl imgContainer;
+ private XFixedText lblImageText;
+ private XFixedText grbxSelectedImage;
+ private XButton btnBack;
+ private XButton btnNext;
+ private XFixedText lblCounter;
+ private XControl m_aImages[];
+ private boolean benabled = true;
+ private UnoDialog2 oUnoDialog;
+ private Size gap = new Size(4, 4);
+ private int cols = 4;
+ private int rows = 3;
+ private Size imageSize = new Size(20, 20);
+ private Size pos;
+ private Size selectionGap = new Size(2, 2);
+ private boolean showButtons = true;
+ private Short step;
+ 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 IImageRenderer renderer;
+ private ListModel listModel;
+ public IRenderer 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 MethodInvocation METHOD_MOUSE_EXIT_IMAGE;
+ private MethodInvocation METHOD_MOUSE_PRESSED;
+
+ /** Getter for property imageSize.
+ * @return Value of property imageSize.
+ *
+ */
+ public Size getImageSize()
+ {
+ return this.imageSize;
+ }
+
+ /** Setter for property imageSize.
+ * @param imageSize New value of property imageSize.
+ *
+ */
+ public void setImageSize(Size imageSize)
+ {
+ this.imageSize = imageSize;
+ }
+
+ class OMouseListener implements XMouseListener
+ {
+ public OMouseListener()
+ {}
+ public void mousePressed(MouseEvent arg0)
+ {
+ focus(getImageIndexFor(getSelected()));
+ }
+
+ public void mouseReleased(MouseEvent arg0)
+ {
+ }
+
+ public void mouseEntered(MouseEvent arg0)
+ {
+ }
+
+ public void mouseExited(MouseEvent arg0)
+ {
+ }
+
+ public void disposing(EventObject arg0)
+ {
+ }
+ }
+
+ public void create(UnoDialog2 dialog)
+ {
+ oUnoDialog = dialog;
+ dialogModel = dialog.xDialogModel;
+
+ int imageTextHeight = imageTextLines * LINE_HEIGHT;
+
+ PeerConfig opeerConfig = new PeerConfig(dialog);
+
+ MOVE_SELECTION_VALS[2] = step;
+
+ XControl 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 OMouseListener());
+
+ 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)
+ });
+
+
+ if (showButtons)
+ {
+ final Integer btnSize = new Integer(14);
+
+ 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
+ });
+
+ 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", ">");
+
+
+ }
+
+ imageKeyListener = new ImageKeyListener();
+ m_tabIndex = new Short((short) tabIndex);
+
+ m_aImages = new XControl[rows * cols];
+
+ 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)
+ {
+ e.printStackTrace();
+ }
+
+ m_imageHeight = new Integer(imageSize.Height);
+ m_imageWidth = new Integer(imageSize.Width);
+
+ for (int r = 0; r < rows; r++)
+ {
+ for (int c = 0; c < cols; c++)
+ {
+ m_aImages[r * cols + c] = createImage(dialog, r, c);
+ }
+ }
+ refreshImages();
+
+ listModel.addListDataListener(this);
+
+ }
+ private Integer m_imageHeight, m_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 m_tabIndex;
+
+ 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,
+ m_imageHeight,
+ "HID:" + helpURL++,
+ new Integer(getImagePosX(_col)),
+ new Integer(getImagePosY(_row)),
+ scaleImages,
+ step,
+ m_tabIndex,
+ Boolean.FALSE,
+ m_imageWidth
+ });
+
+ XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, image);
+ win.addMouseListener(uiEventListener);
+ win.addKeyListener(imageKeyListener);
+ //uiEventListener.add(imageName,EventNames.EVENT_MOUSE_ENTERED,METHOD_MOUSE_ENTER_IMAGE);
+ //uiEventListener.add(imageName,EventNames.EVENT_MOUSE_EXITED,METHOD_MOUSE_EXIT_IMAGE);
+ uiEventListener.add(imageName, EventNames.EVENT_MOUSE_PRESSED, METHOD_MOUSE_PRESSED);
+
+ return image;
+ }
+
+ private int getImagePosX(int col)
+ {
+ return pos.Width + col * (imageSize.Width + gap.Width) + gap.Width;
+ }
+
+ private int getImagePosY(int row)
+ {
+ return pos.Height + row * (imageSize.Height + gap.Height) + gap.Height;
+ }
+
+ private void refreshImages()
+ {
+ if (showButtons)
+ {
+ refreshCounterText();
+ }
+ hideSelection();
+ if (refreshOverNull)
+ {
+ for (int i = 0; i < m_aImages.length; i++)
+ {
+ setVisible(m_aImages[i], false);
+ }
+ }
+ boolean focusable = true;
+ for (int i = 0; i < m_aImages.length; i++)
+ {
+ Object[] oResources = renderer.getImageUrls(getObjectFor(i));
+ if (oResources != null)
+ {
+ if (oResources.length == 1)
+ {
+ Helper.setUnoPropertyValue(m_aImages[i].getModel(), "ImageURL", (String) oResources[0]);
+ }
+ else if (oResources.length == 2)
+ {
+ oUnoDialog.getPeerConfiguration().setImageUrl(m_aImages[i].getModel(), oResources[0], oResources[1]);
+ }
+ Helper.setUnoPropertyValue(m_aImages[i].getModel(), "Tabstop", focusable ? Boolean.TRUE : Boolean.FALSE);
+ if (refreshOverNull)
+ {
+ setVisible(m_aImages[i], true);
+ }
+ focusable = false;
+ }
+ }
+ refreshSelection();
+ }
+
+ private void refreshCounterText()
+ {
+ Helper.setUnoPropertyValue(getModel(lblCounter), "Label", counterRenderer.render(new Counter(pageStart + 1, pageEnd(), listModel.getSize())));
+ }
+
+ private int pageEnd()
+ {
+ int i = pageStart + cols * rows;
+ if (i > listModel.getSize() - 1)
+ {
+ return listModel.getSize();
+ }
+ else
+ {
+ return i;
+ }
+ }
+
+ private void refreshSelection()
+ {
+ if (selected < pageStart || selected >= (pageStart + rows * cols))
+ {
+ hideSelection();
+ }
+ else
+ {
+ moveSelection(getImageIndexFor(selected));
+ }
+ }
+
+ 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 Object[] MOVE_SELECTION_VALS = new Object[3];
+ /** Utility field holding list of ItemListeners. */
+ private transient java.util.ArrayList itemListenerList;
+
+ private void moveSelection(int image)
+ {
+ //System.out.println(image);
+ setVisible(grbxSelectedImage, false);
+
+ int row = image / cols;
+ int col = rowSelect ? 0 : image - (row * cols);
+
+ MOVE_SELECTION_VALS[0] = new Integer(getImagePosX(col) - selectionGap.Width);
+ MOVE_SELECTION_VALS[1] = new Integer(getImagePosY(row) - selectionGap.Height);
+
+ 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 < m_aImages.length; i++)
+ {
+ if (i != image)
+ {
+ defocus(i);
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop", Boolean.TRUE);
+ }
+ }
+ }
+
+ private void setVisible(Object control, boolean visible)
+ {
+ ((XWindow) UnoRuntime.queryInterface(XWindow.class, control)).setVisible(visible);
+ }
+
+ /**
+ *
+ * @param i
+ * @return the Object in the list model corresponding to the given image index.
+ */
+ private Object getObjectFor(int i)
+ {
+ int ii = getIndexFor(i);
+ if (listModel.getSize() <= ii)
+ {
+ return null;
+ }
+ else
+ {
+ return listModel.getElementAt(ii);
+ }
+ }
+
+ /**
+ *
+ * @param i
+ * @return the index in the listModel for the given image index.
+ */
+ private int getIndexFor(int i)
+ {
+ return pageStart + i;
+ }
+
+ private int getImageIndexFor(int i)
+ {
+ return i - pageStart;
+ }
+
+ 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
+ else
+ 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;
+ }
+ }
+ if (event.getIndex0() < pageStart || event.getIndex1() < (pageStart + getRows() + getCols()))
+ {
+ refreshImages();
+ }
+ }
+
+ public void intervalRemoved(ListDataEvent event)
+ {
+ //contentsChanged(event);
+ }
+
+ /** Registers ItemListener to receive events.
+ * @param listener The listener to register.
+ *
+ */
+ public synchronized void addItemListener(XItemListener listener)
+ {
+ if (itemListenerList == null)
+ {
+ itemListenerList = new java.util.ArrayList();
+ }
+ itemListenerList.add(listener);
+ }
+
+ /** Removes ItemListener from the list of listeners.
+ * @param listener The listener to remove.
+ *
+ */
+ public synchronized void removeItemListener(XItemListener listener)
+ {
+ if (itemListenerList != null)
+ {
+ itemListenerList.remove(listener);
+ }
+ }
+
+ /** Notifies all registered listeners about the event.
+ *
+ * @param event The event to be fired
+ *
+ */
+ 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)
+ {
+ if (itemListenerList == null)
+ {
+ return;
+ }
+ list = (java.util.ArrayList) itemListenerList.clone();
+ }
+ for (int i = 0; i < list.size(); i++)
+ {
+ ((com.sun.star.awt.XItemListener) list.get(i)).itemStateChanged(null);
+ }
+ }
+
+ /**
+ * @return
+ */
+ public int getCols()
+ {
+ return cols;
+ }
+
+ /**
+ * @return
+ */
+ public Size getGap()
+ {
+ return gap;
+ }
+
+ /**
+ * @return
+ */
+ public ListModel getListModel()
+ {
+ return listModel;
+ }
+
+ /**
+ * @return
+ */
+ public Short getStep()
+ {
+ return step;
+ }
+
+ /**
+ * @return
+ */
+ public int getPageStart()
+ {
+ return pageStart;
+ }
+
+ /**
+ * @return
+ */
+ public Size getPos()
+ {
+ return pos;
+ }
+
+ /**
+ * @return
+ */
+ public IImageRenderer getRenderer()
+ {
+ return renderer;
+ }
+
+ /**
+ * @return
+ */
+ public int getRows()
+ {
+ return rows;
+ }
+
+ /**
+ * @return
+ */
+ public int getSelected()
+ {
+ return selected;
+ }
+
+ /**
+ * @return
+ */
+ public Size getSelectionGap()
+ {
+ return selectionGap;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isShowButtons()
+ {
+ return showButtons;
+ }
+
+ /**
+ * @param i
+ */
+ public void setCols(int i)
+ {
+ cols = i;
+ }
+
+ /**
+ * @param size
+ */
+ public void setGap(Size size)
+ {
+ gap = size;
+ }
+
+ /**
+ * @param model
+ */
+ public void setListModel(ListModel model)
+ {
+ listModel = model;
+ }
+
+ /**
+ * @param short1
+ */
+ public void setStep(Short short1)
+ {
+ step = short1;
+ }
+
+ /**
+ * @param i
+ */
+ public void setPageStart(int i)
+ {
+ if (i == pageStart)
+ {
+ return;
+ }
+ pageStart = i;
+ enableButtons();
+ refreshImages();
+ }
+
+ /**
+ * @param size
+ */
+ public void setPos(Size size)
+ {
+ pos = size;
+ }
+
+ /**
+ * @param renderer
+ */
+ public void setRenderer(IImageRenderer renderer)
+ {
+ this.renderer = renderer;
+ }
+
+ /**
+ * @param i
+ */
+ public void setRows(int i)
+ {
+ rows = i;
+ }
+
+ /**
+ * @param i
+ */
+ 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)
+ {
+ if (object == null)
+ {
+ setSelected(-1);
+ }
+ else
+ {
+ for (int i = 0; i < getListModel().getSize(); i++)
+ {
+ if (getListModel().getElementAt(i).equals(object))
+ {
+ setSelected(i);
+ return;
+ }
+ }
+ }
+ setSelected(-1);
+
+ }
+
+ private void refreshImageText()
+ {
+ Object item = selected >= 0 ? getListModel().getElementAt(selected) : null;
+ Helper.setUnoPropertyValue(getModel(lblImageText), "Label", " " + renderer.render(item));
+ }
+
+ /**
+ * @param size
+ */
+ public void setSelectionGap(Size size)
+ {
+ selectionGap = size;
+ }
+
+ /**
+ * @param b
+ */
+ public void setShowButtons(boolean b)
+ {
+ showButtons = b;
+ }
+
+ public void nextPage()
+ {
+ if (pageStart < getListModel().getSize() - rows * cols)
+ {
+ setPageStart(pageStart + rows * cols);
+ }
+ }
+
+ public void prevPage()
+ {
+ if (pageStart == 0)
+ {
+ return;
+ }
+ int i = pageStart - rows * cols;
+ if (i < 0)
+ {
+ i = 0;
+ }
+ setPageStart(i);
+ }
+
+ 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)
+ {
+ Helper.setUnoPropertyValue(getModel(control), "Enabled", enable);
+ }
+
+ 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(m_aImages[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(m_aImages[i],imageBorder);
+ }
+ */
+ 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);
+ }
+
+ 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();
+
+ }
+
+ public void mousePressed(Object event)
+ {
+ int image = getImageFromEvent(event);
+ int index = getIndexFor(image);
+ if (index < listModel.getSize())
+ {
+ focus(image);
+ setSelected(index);
+ }
+ }
+
+ public Object[] getSelectedObjects()
+ {
+ return new Object[]
+ {
+ getListModel().getElementAt(selected)
+ };
+ }
+
+ /**
+ */
+ public static interface IImageRenderer extends IRenderer
+ {
+
+ /**
+ *
+ * @param listItem
+ * @return two resource ids for an image referenced in the imaglist resourcefile of the
+ * wizards project; The second one of them is designed to be used for High Contrast Mode.
+ */
+ public Object[] getImageUrls(Object listItem);
+ }
+
+ private static class SimpleCounterRenderer implements IRenderer
+ {
+
+ 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 Counter(int start_, int end_, int max_)
+ {
+ start = start_;
+ end = end_;
+ max = max_;
+ }
+ }
+
+ public Object getSelectedObject()
+ {
+ return selected >= 0 ? getListModel().getElementAt(selected) : null;
+ }
+
+ public void showSelected()
+ {
+ int oldPageStart = pageStart;
+ if (selected == -1)
+ {
+ pageStart += 0;
+ }
+ else
+ {
+ pageStart = (selected / m_aImages.length) * m_aImages.length;
+ }
+ if (oldPageStart != pageStart)
+ {
+ enableButtons();
+ refreshImages();
+ }
+ }
+
+ public void setRowSelect(boolean b)
+ {
+ rowSelect = b;
+ }
+
+ public boolean isRowSelect()
+ {
+ return rowSelect;
+ }
+
+ private class ImageKeyListener implements XKeyListener
+ {
+
+ /* (non-Javadoc)
+ * @see com.sun.star.awt.XKeyListener#keyPressed(com.sun.star.awt.KeyEvent)
+ */
+ 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;
+ if (newImage == image)
+ {
+ return;
+ }
+ if (isFocusable(newImage))
+ {
+ changeFocus(image, newImage);
+ }
+ }
+
+ private boolean isFocusable(int image)
+ {
+ return (image >= 0) && (getIndexFor(image) < listModel.getSize());
+ }
+
+ 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();
+ }
+ break;
+ case Key.DOWN:
+ if (row < getRows() - 1)
+ {
+ return getCols();
+ }
+ break;
+ case Key.LEFT:
+ if (col > 0)
+ {
+ return -1;
+ }
+ break;
+ case Key.RIGHT:
+ if (col < getCols() - 1)
+ {
+ return 1;
+ }
+ break;
+ case Key.SPACE:
+ select(ke);
+ }
+ return 0;
+ }
+
+ private void select(KeyEvent ke)
+ {
+ setSelected(getIndexFor(getImageFromEvent(ke)));
+ }
+
+ public void keyReleased(KeyEvent ke)
+ {
+ }
+
+ public void disposing(EventObject arg0)
+ {
+ }
+ }
+
+ private final void focus(int image)
+ {
+ Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop",
+ Boolean.TRUE);
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, m_aImages[image]);
+ xWindow.setFocus();
+ }
+
+ private final void defocus(int image)
+ {
+ Helper.setUnoPropertyValue(UnoDialog.getModel(m_aImages[image]), "Tabstop",
+ Boolean.FALSE);
+
+ }
+
+ /**
+ * jump to the given item (display the screen
+ * that contains the given item).
+ * @param i
+ */
+ public void display(int i)
+ {
+ int is = (getCols() * getRows());
+ int ps = (listModel.getSize() / is) * is;
+ setPageStart(ps);
+ }
+
+ /**
+ * @return
+ */
+ public boolean isenabled()
+ {
+ return benabled;
+ }
+
+ /**
+ * @param b
+ */
+ public void setenabled(boolean b)
+ {
+
+ for (int i = 0; i < m_aImages.length; i++)
+ {
+ UnoDialog2.setEnabled(m_aImages[i], 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
new file mode 100755
index 000000000000..4cb101382c6d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/PathSelection.java
@@ -0,0 +1,188 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Exception;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.SystemDialog;
+
+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 final int FOLDER = 0;
+ public static final int FILE = 1;
+ }
+
+ 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)
+ {
+ this.CurUnoDialog = CurUnoDialog;
+ this.xMSF = xMSF;
+ this.iDialogType = DialogType;
+ this.iTransferMode = TransferMode;
+
+ }
+
+ 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)
+ });
+
+ }
+
+ public void addSelectionListener(XPathSelectionListener xAction)
+ {
+ this.xAction = xAction;
+ }
+
+ public String getSelectedPath()
+ {
+ return xSaveTextBox.getText();
+ }
+
+ public void initializePath()
+ {
+ try
+ {
+ FileAccess myFA = new FileAccess(xMSF);
+ xSaveTextBox.setText(myFA.getPath(sDefaultDirectory + "/" + sDefaultName, null));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ 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:
+ usedPathPicker = true;
+ SystemDialog myFilePickerDialog = SystemDialog.createStoreDialog(xMSF);
+ myFilePickerDialog.callStoreDialog(sDefaultDirectory, sDefaultName, sDefaultFilter);
+ String sStorePath = myFilePickerDialog.sStorePath;
+ if (sStorePath != null)
+ {
+ FileAccess myFA = new FileAccess(xMSF);
+ xSaveTextBox.setText(myFA.getPath(sStorePath, null));
+ sDefaultDirectory = FileAccess.getParentDir(sStorePath);
+ sDefaultName = myFA.getFilename(sStorePath);
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case TransferMode.LOAD:
+ switch (iDialogType)
+ {
+ case DialogTypes.FOLDER:
+ //TODO: write code for picking a folder for loading
+ break;
+ case DialogTypes.FILE:
+ //TODO: write code for picking a file for loading
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ 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
new file mode 100644
index 000000000000..d3871ee62a5b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/PeerConfig.java
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.Vector;
+
+import com.sun.star.awt.*;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+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)
+ {
+ oUnoDialog = _oUnoDialog;
+ oUnoDialog.xWindow.addWindowListener(this);
+ }
+
+ class PeerTask
+ {
+
+ XControl xControl;
+ String[] propnames;
+ Object[] propvalues;
+
+ public PeerTask(XControl _xControl, String[] propNames_, Object[] propValues_)
+ {
+ propnames = propNames_;
+ propvalues = propValues_;
+ xControl = _xControl;
+ }
+ }
+
+ class ControlTask
+ {
+
+ Object oModel;
+ String propname;
+ Object propvalue;
+
+ public ControlTask(Object _oModel, String _propName, Object _propValue)
+ {
+ propname = _propName;
+ propvalue = _propValue;
+ oModel = _oModel;
+ }
+ }
+
+ class 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 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++)
+ {
+ 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))
+ {
+ 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;
+ }
+ }
+
+ public void windowHidden(EventObject arg0)
+ {
+ }
+
+ public void disposing(EventObject arg0)
+ {
+ }
+
+ /**
+ *
+ * @param oAPIControl an API control that the interface XControl can be derived from
+ * @param _saccessname
+ */
+ public void setAccessibleName(Object oAPIControl, String _saccessname)
+ {
+ XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oAPIControl);
+ setPeerProperties(xControl, new String[]
+ {
+ "AccessibleName"
+ }, new String[]
+ {
+ _saccessname
+ });
+ }
+
+ public void setAccessibleName(XControl _xControl, String _saccessname)
+ {
+ setPeerProperties(_xControl, new String[]
+ {
+ "AccessibleName"
+ }, new String[]
+ {
+ _saccessname
+ });
+ }
+
+ /**
+ *
+ * @param oAPIControl an API control that the interface XControl can be derived from
+ * @param _propnames
+ * @param _propvalues
+ */
+ public void setPeerProperties(Object oAPIControl, String[] _propnames, Object[] _propvalues)
+ {
+ XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oAPIControl);
+ setPeerProperties(xControl, _propnames, _propvalues);
+ }
+
+ public void setPeerProperties(XControl _xControl, String[] propnames, Object[] propvalues)
+ {
+ PeerTask oPeerTask = new PeerTask(_xControl, propnames, propvalues);
+ this.m_aPeerTasks.add(oPeerTask);
+ }
+
+ /**
+ * assigns an arbitrary property to a control as soon as the peer is created
+ * Note: The property 'ImageUrl' should better be assigned with 'setImageurl(...)', to consider the High Contrast Mode
+ * @param _ocontrolmodel
+ * @param _spropname
+ * @param _propvalue
+ */
+ public void setControlProperty(Object _ocontrolmodel, String _spropname, Object _propvalue)
+ {
+ ControlTask oControlTask = new ControlTask(_ocontrolmodel, _spropname, _propvalue);
+ this.aControlTasks.add(oControlTask);
+ }
+
+ /**
+ * 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
+ * wizards project
+ * @param _ocontrolmodel
+ * @param _nResId
+ * @param _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);
+ }
+
+ /**
+ * Assigns an image to the property 'ImageUrl' of a dialog control. The image ids that the Resource urls point to
+ * may be assigned in a Resource file outside the wizards project
+ * @param _ocontrolmodel
+ * @param _sResourceUrl
+ * @param _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
+ * wizards project
+ * @param _ocontrolmodel
+ * @param _oResource
+ * @param _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
new file mode 100644
index 000000000000..29b646d3e852
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java
@@ -0,0 +1,384 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.beans.PropertyChangeEvent;
+
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.*;
+import com.sun.star.awt.*;
+
+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
+ };
+ XListBox[] xSortListBox = new XListBox[4];
+
+ class ItemListenerImpl implements com.sun.star.awt.XItemListener
+ {
+
+ 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 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;
+ Integer IStep = new Integer(iStep);
+ Integer ICompPosX = new Integer(iCompPosX);
+ Integer ICompPosY = new Integer(iCompPosY);
+ Integer ICompWidth = new Integer(iCompWidth);
+
+ Integer IListBoxPosX = new Integer(iCompPosX + 6);
+ int iOptButtonWidth = 65;
+ Integer IOptButtonWidth = new Integer(iOptButtonWidth);
+ Integer IListBoxWidth = new Integer(iCompWidth - iOptButtonWidth - 12);
+ Integer IOptButtonPosX = new Integer(IListBoxPosX.intValue() + IListBoxWidth.intValue() + 6);
+ getResources();
+ com.sun.star.awt.XWindow[] xListBoxWindow = new com.sun.star.awt.XWindow[4];
+ boolean bDoEnable;
+ String HIDString;
+ int iCurPosY = iCompPosY;
+ 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
+ });
+
+ 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(UnoDialog.getListBoxLineCount()), "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))
+
+ 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))
+ iCurPosY = iCurPosY + 36;
+ FirstHelpIndex += 3;
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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);
+ sSortHeader[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 52);
+ sSortAscend[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 36);
+ sSortAscend[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 53);
+ sSortAscend[2] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 54);
+ sSortAscend[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 55);
+ sSortDescend[0] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 37);
+ sSortDescend[1] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 56);
+ sSortDescend[2] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 57);
+ sSortDescend[3] = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 58);
+ sSortCriteriaisduplicate = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 74);
+ sNoSorting = CurUnoDialog.m_oResource.getResText(UIConsts.RID_REPORT + 8);
+ return true;
+ }
+
+ public void initialize(String[] _FieldNames, String[][] _SortFieldNames)
+ {
+ int FieldCount = _FieldNames.length;
+ String[] ViewFieldNames = new String[FieldCount + 1];
+ ViewFieldNames[0] = sNoSorting;
+ for (int i = 0; i < FieldCount; i++)
+ {
+ ViewFieldNames[i + 1] = _FieldNames[i];
+ }
+ short[] SelList = null;
+ for (int i = 0; i < 4; i++)
+ {
+ if (i < _SortFieldNames.length)
+ {
+ SelList = new short[]
+ {
+ (short) (JavaTools.FieldInList(_FieldNames, _SortFieldNames[i][0]) + 1)
+ };
+ }
+ else
+ {
+ 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);
+ toggleSortListBox(i, (i <= _SortFieldNames.length));
+ }
+ }
+
+ private void setMaxSortIndex()
+ {
+ MaxSortIndex = -1;
+ for (int i = 0; i <= MAXSORTCRITERIAINDEX; i++)
+ {
+ if (xSortListBox[i].getSelectedItemPos() > 0)
+ {
+ MaxSortIndex += 1;
+ }
+ }
+ }
+
+ /**
+ * sets the controls of a Sorting criterion to readonly or not.
+ * @param _index index of the Sorting criterion
+ * @param _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++)
+ {
+ boolean breadonly = i < _index;
+ setReadOnly(i, breadonly);
+ }
+ }
+
+ private void enableNextSortListBox(int CurIndex)
+ {
+ try
+ {
+ setMaxSortIndex();
+ boolean bDoEnable = (xSortListBox[CurIndex].getSelectedItemPos() != 0);
+ if (!bDoEnable)
+ {
+ moveupSortItems(CurIndex, bDoEnable); //disableListBoxesfromIndex(CurIndex);
+ }
+ else
+ {
+ toggleSortListBox(CurIndex + 1, true);
+ }
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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++)
+ {
+ CurFieldName = xSortListBox[i].getSelectedItem();
+ SortFieldNames[i][0] = CurFieldName;
+ SortDescriptions[i] = CurFieldName;
+ iCurState = ((Short) CurUnoDialog.getControlProperty("optAscend" + new Integer(i + 1).toString(), "State")).shortValue();
+ SortFieldNames[i][0] = CurFieldName;
+ if (iCurState == 1)
+ {
+ SortFieldNames[i][1] = "ASC";
+ }
+ else
+ {
+ SortFieldNames[i][1] = "DESC";
+ }
+ }
+ // 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)
+ {
+ 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[][]
+ {
+ };
+ }
+ else
+ {
+ return SortFieldNames;
+ }
+ }
+ 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++)
+ {
+ toggleSortListBox(i, (false));
+ if (i < MaxSortIndex)
+ {
+ CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[]
+ {
+ 0
+ });
+ }
+ // xSortListBox[i+1].selectItemPos((short)0, true);
+ }
+ CurUnoDialog.setFocus("lblSort" + new Integer(CurIndex + 1));
+ MaxSortIndex = CurIndex - 1;
+ }
+ }
+
+ // The following code can be reactivated in a future version when task #100799 will be fixed
+ private void moveupSortItems(int CurIndex, boolean bDoEnable)
+ {
+ short iNextItemPos;
+ 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[]
+ {
+ });
+ toggleSortListBox(i, true);
+ CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[]
+ {
+ 0
+ });
+ }
+ }
+ if (MaxSortIndex < xSortListBox.length - 2)
+ {
+ toggleSortListBox(MaxSortIndex + 2, false);
+ }
+ }
+ else
+ {
+ toggleSortListBox(CurIndex + 1, bDoEnable);
+ }
+ }
+
+ 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
+ });
+ }
+ }
+ }
+ 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
new file mode 100644
index 000000000000..d4091c964e14
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/TitlesComponent.java
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.wizards.common.Properties;
+import com.sun.star.wizards.common.*;
+import com.sun.star.beans.*;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.awt.XTextListener;
+
+import java.util.*;
+
+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)
+ {
+ 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)
+ });
+ }
+
+ 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)
+ {
+ CurUnoDialog.setControlVisible(getColumnName(_index), _bIsVisible);
+ CurUnoDialog.setControlVisible(getTitleName(_index), _bIsVisible);
+ }
+
+ 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
+ {
+
+ PropertyValue[] regproperties;
+ XTextComponent xTextComponent;
+
+ 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)
+ });
+
+ 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)
+ });
+ }
+ }
+
+ private String getColumnName(int _index)
+ {
+ return SOLABELPREFIX + Integer.toString(_index + 1);
+ }
+
+ private String getTitleName(int _index)
+ {
+ return SOTITLEPREFIX + Integer.toString(_index + 1);
+ }
+
+ 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)
+ registerControlGroup(currowproperties, i);
+ }
+ }
+
+ private void adjustPosSizes()
+ {
+ String sLongestFieldName = JavaTools.getlongestArrayItem(fieldnames);
+ Size aSize = CurUnoDialog.getpreferredLabelSize(getColumnName(0), sLongestFieldName);
+ double dblMAPConversion = CurUnoDialog.getMAPConversionFactor(getColumnName(0));
+ int iFieldNameWidth = getFieldNameWidth(aSize.Width, dblMAPConversion) + 10;
+ 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++)
+ {
+ CurUnoDialog.setControlProperty(getColumnName(i), "Width", FieldNameWidth);
+ 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)
+ {
+ this.fieldnames = _fieldnames;
+ this.fieldtitleset = _fieldtitleset;
+ setFieldTitles();
+ initializeScrollFields();
+ super.initialize(fieldnames.length);
+ adjustPosSizes();
+// setComponentMouseTransparent();
+ }
+
+ private void setFieldTitles()
+ {
+ fieldtitles = new String[fieldnames.length];
+ 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
+ {
+ fieldtitles[i] = fieldnames[i];
+ }
+ }
+ }
+
+ 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()
+ {
+ PropertyValue[][] titlelist = this.getScrollFieldValues();
+ PropertyValue[] currowproperties;
+ PropertyValue curtitleproperty;
+ for (int i = 0; i < titlelist.length; i++)
+ {
+ currowproperties = titlelist[i];
+ curtitleproperty = currowproperties[1];
+ fieldtitles[i] = (String) curtitleproperty.Value;
+ }
+ refreshtitleset();
+ return fieldtitles;
+ }
+
+ private void refreshtitleset()
+ {
+ for (int i = 0; i < fieldnames.length; i++)
+ {
+ fieldtitleset.put(fieldnames[i], fieldtitles[i]);
+ }
+ }
+
+ 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
new file mode 100644
index 000000000000..bac864ecd09c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/UIConsts.java
@@ -0,0 +1,83 @@
+/*
+ * Created on 14.11.2003
+ *
+ * To change the template for this generated file go to
+ * 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 static final int RID_COMMON = 500;
+ public static final int RID_DB_COMMON = 1000;
+ public static final int RID_FORM = 2200;
+ public static final int RID_QUERY = 2300;
+ public static final int RID_REPORT = 2400;
+ public static final int RID_TABLE = 2500;
+ public static final int RID_IMG_REPORT = 1000;
+ 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";
+ /**
+ * 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
+ *
+ */
+ public static final int SOFIELDSELECTIONPAGE = 1;
+ public static final int SOSORTINGPAGE = 2;
+ public static final int SOFILTERPAGE = 3;
+ public static final int SOAGGREGATEPAGE = 4;
+ public static final int SOGROUPSELECTIONPAGE = 5;
+ 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)
+ };
+
+ class CONTROLTYPE
+ {
+
+ public static final int BUTTON = 1;
+ public static final int IMAGECONTROL = 2;
+ public static final int LISTBOX = 3;
+ public static final int COMBOBOX = 4;
+ public static final int CHECKBOX = 5;
+ public static final int RADIOBUTTON = 6;
+ public static final int DATEFIELD = 7;
+ public static final int EDITCONTROL = 8;
+ public static final int FILECONTROL = 9;
+ public static final int FIXEDLINE = 10;
+ public static final int FIXEDTEXT = 11;
+ public static final int FORMATTEDFIELD = 12;
+ public static final int GROUPBOX = 13;
+ public static final int HYPERTEXT = 14;
+ public static final int NUMERICFIELD = 15;
+ public static final int PATTERNFIELD = 16;
+ public static final int PROGRESSBAR = 17;
+ public static final int ROADMAP = 18;
+ public static final int SCROLLBAR = 19;
+ public static final int TIMEFIELD = 20;
+ public static final int CURRENCYFIELD = 21;
+ public static final int UNKNOWN = -1;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java
new file mode 100644
index 000000000000..5a181b84c4b5
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java
@@ -0,0 +1,1148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+import com.sun.star.awt.XReschedule;
+import com.sun.star.beans.Property;
+import com.sun.star.beans.XMultiPropertySet;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.*;
+import com.sun.star.frame.XFrame;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.*;
+import com.sun.star.wizards.common.*;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.ui.event.*;
+
+import java.util.Hashtable;
+
+public class UnoDialog implements EventNames
+{
+
+ public XMultiServiceFactory xMSF;
+ public XMultiServiceFactory MSFDialogModel;
+ public XNameContainer xDlgNames;
+ public XControlContainer xDlgContainer;
+ private XNameAccess m_xDlgNameAccess;
+ public XControl xControl;
+ public XDialog xDialog;
+ public XReschedule xReschedule;
+ public XWindow xWindow;
+ public XComponent xComponent;
+ public XInterface xDialogModel;
+ public XInterface xUnoDialog;
+ public XPropertySet xPSetDlg;
+ public XVclWindowPeer xVclWindowPeer;
+ public Hashtable ControlList;
+ public Resource m_oResource;
+ public XWindowPeer xWindowPeer = null;
+ private PeerConfig m_oPeerConfig;
+ protected AbstractListener guiEventListener;
+
+ public AbstractListener getGuiEventListener()
+ {
+ return guiEventListener;
+ }
+
+ public UnoDialog(XMultiServiceFactory xMSF, String[] PropertyNames, Object[] PropertyValues)
+ {
+ try
+ {
+ this.xMSF = xMSF;
+ ControlList = new Hashtable();
+ xDialogModel = (XInterface) xMSF.createInstance("com.sun.star.awt.UnoControlDialogModel");
+ XMultiPropertySet xMultiPSetDlg = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, xDialogModel);
+ xMultiPSetDlg.setPropertyValues(PropertyNames, PropertyValues);
+ MSFDialogModel = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xDialogModel);
+ xUnoDialog = (XInterface) xMSF.createInstance("com.sun.star.awt.UnoControlDialog");
+ xControl = (XControl) UnoRuntime.queryInterface(XControl.class, xUnoDialog);
+ XControlModel xControlModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, xDialogModel);
+ xControl.setModel(xControlModel);
+ xPSetDlg = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDialogModel);
+ xDlgContainer = (XControlContainer) UnoRuntime.queryInterface(XControlContainer.class, xUnoDialog);
+ xDlgNames = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, xDialogModel);
+ // xDlgNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDialogModel);
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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
+ {
+ String sName = (String) xPSet.getPropertyValue("Name");
+ Integer KeyObject = (Integer) ControlList.get(sName);
+ iKey = KeyObject.intValue();
+ }
+ 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)
+ {
+ createPeerConfiguration();
+ }
+ return m_oPeerConfig;
+ }
+
+ XNameAccess getDlgNameAccess()
+ {
+ if (m_xDlgNameAccess == null)
+ {
+ m_xDlgNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDialogModel);
+ }
+ return m_xDlgNameAccess;
+ }
+ public void setControlProperty(String ControlName, String PropertyName, Object PropertyValue)
+ {
+ try
+ {
+ if (PropertyValue != null)
+ {
+ if (getDlgNameAccess().hasByName(ControlName) == false)
+ {
+ return;
+ }
+ Object xControlModel = getDlgNameAccess().getByName(ControlName);
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
+ 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[]{};
+ */
+ }
+ xPSet.setPropertyValue(PropertyName, PropertyValue);
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public Resource getResource()
+ {
+ return m_oResource;
+ }
+
+ public void setControlProperties(String ControlName, String[] PropertyNames, Object[] PropertyValues)
+ {
+ try
+ {
+ if (PropertyValues != null)
+ {
+ if (getDlgNameAccess().hasByName(ControlName) == false)
+ {
+ return;
+ }
+ Object xControlModel = getDlgNameAccess().getByName(ControlName);
+ XMultiPropertySet xMultiPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, xControlModel);
+ xMultiPSet.setPropertyValues(PropertyNames, PropertyValues);
+ }
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public Object getControlProperty(String ControlName, String PropertyName)
+ {
+ try
+ {
+ Object xControlModel = getDlgNameAccess().getByName(ControlName);
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
+ Object oPropValue = xPSet.getPropertyValue(PropertyName);
+ // if (AnyConverter.isArray(oPropValue))
+ // return Helper.getArrayValue(oPropValue);
+ // else
+ return oPropValue;
+ }
+ 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
+ {
+ Object xControlModel = getDlgNameAccess().getByName(ControlName);
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
+ Property[] allProps = xPSet.getPropertySetInfo().getProperties();
+ for (int i = 0; i < allProps.length; i++)
+ {
+ String sName = allProps[i].Name;
+ System.out.println(sName);
+ }
+ }
+ 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 xControl2 = xDlgContainer.getControl(ControlName);
+ XView xView = (XView) UnoRuntime.queryInterface(XView.class, xControl2);
+ Size aSize = xView.getSize();
+ 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 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, xControl2);
+ Size aSize = xLayoutConstrains.getPreferredSize();
+ xFixedText.setText(OldText);
+ return aSize;
+ }
+
+ public void removeSelectedItems(XListBox xListBox)
+ {
+ short[] SelList = xListBox.getSelectedItemsPos();
+ int Sellen = SelList.length;
+ for (int i = Sellen - 1; i >= 0; i--)
+ {
+ xListBox.removeItems(SelList[i], (short) 1);
+ }
+ }
+
+ public static int getListBoxItemCount(XListBox _xListBox)
+ {
+ // This function may look ugly, but this is the only way to check the count
+ // of values in the model,which is always right.
+ // the control is only a view and could be right or not.
+ final String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), "StringItemList");
+ return fieldnames.length;
+ }
+
+ public static short getSelectedItemPos(XListBox _xListBox)
+ {
+ short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), "SelectedItems");
+ return ipos[0];
+ }
+
+ 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)
+ {
+ xListBox.addItem(ListItem, xListBox.getItemCount());
+ if (iSelIndex != -1)
+ {
+ xListBox.selectItemPos(iSelIndex, true);
+ }
+ }
+
+ 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)
+ {
+ 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);
+ 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
+ {
+ 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
+ {
+ 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
+ {
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ 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)
+ {
+ 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
+ {
+ 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)
+ {
+ 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
+ {
+ 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
+ {
+ 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)
+ {
+ 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
+ {
+ XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues);
+ if (xItemListener != null)
+ {
+ xRadioButton.addItemListener(xItemListener);
+ }
+ return xRadioButton;
+ }
+ 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
+ {
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ 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
+ {
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ /**
+ * @author bc93774
+ * The problem with setting the visibility of controls is that changing the current step
+ * of a dialog will automatically make all controls visible. The "Step" property always wins against
+ * the property "visible". Therfor a control meant to be invisible is placed on a step far far away.
+ * @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
+ {
+ int iCurStep = AnyConverter.toInt(getControlProperty(controlname, "Step"));
+ setControlProperty(controlname, "Step", new Integer(iStep));
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ /**
+ * @author bc93774
+ * The problem with setting the visibility of controls is that changing the current step
+ * of a dialog will automatically make all controls visible. The "Step" property always wins against
+ * the property "visible". Therfor a control meant to be invisible is placed on a step far far away.
+ * Afterwards the step property of the dialog has to be set with "repaintDialogStep". As the performance
+ * of that method is very bad it should be used only once for all controls
+ * @param controlname the name of the control
+ * @param bIsVisible sets the control visible or invisible
+ */
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ /**
+ * repaints the currentDialogStep
+ * @author bc93774
+ */
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ 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
+ };
+ 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)
+ {
+ jexception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ public void selectListBoxItem(XListBox xListBox, short iFieldsSelIndex)
+ {
+ if (iFieldsSelIndex > -1)
+ {
+ int FieldCount = xListBox.getItemCount();
+ if (FieldCount > 0)
+ {
+ if (iFieldsSelIndex < FieldCount)
+ {
+ xListBox.selectItemPos(iFieldsSelIndex, true);
+ }
+ else
+ {
+ xListBox.selectItemPos((short) (iFieldsSelIndex - 1), true);
+ }
+ }
+ }
+ }
+
+ /** deselects a Listbox. MultipleMode is not supported
+ *
+ * @param _xBasisListBox
+ */
+ public static void deselectListBox(XInterface _xBasisListBox)
+ {
+ Object oListBoxModel = getModel(_xBasisListBox);
+ Object sList = Helper.getUnoPropertyValue(oListBoxModel, "StringItemList");
+ Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", new String[]
+ {
+ });
+ Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", sList);
+ }
+
+ 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();
+ int WindowHeight = FramePosSize.Height;
+ int WindowWidth = FramePosSize.Width;
+ int DialogWidth = CurPosSize.Width;
+ int DialogHeight = CurPosSize.Height;
+ int iXPos = ((WindowWidth / 2) - (DialogWidth / 2));
+ int iYPos = ((WindowHeight / 2) - (DialogHeight / 2));
+ xWindow.setPosSize(iXPos, iYPos, DialogWidth, DialogHeight, PosSize.POS);
+ }
+
+ /**
+ *
+ * @param FramePosSize
+ * @return 0 for cancel, 1 for ok
+ * @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());
+ xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, xUnoDialog);
+ return xDialog.execute();
+ }
+
+ 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
+ * @return 0 for cancel, 1 for ok.
+ * @throws com.sun.star.uno.Exception
+ */
+ public short executeDialog(UnoDialog parent)
+ throws com.sun.star.uno.Exception
+ {
+ return executeDialog(parent.xWindow.getPosSize());
+ }
+
+ /**
+ *
+ * @param xComponent
+ * @return 0 for cancel, 1 for ok.
+ * @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)
+ {
+ XWindow w = frame.getComponentWindow();
+ if (w != null)
+ {
+ return executeDialog(w.getPosSize());
+ }
+ }
+
+ 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
+ {
+ return executeDialog(Desktop.getActiveFrame(xMSF));
+ }
+
+ public void setAutoMnemonic(String ControlName, boolean bValue)
+ {
+ Object oControl = xDlgContainer.getControl(ControlName);
+ xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oControl);
+ XWindowPeer xWindowPeer = xControl.getPeer();
+ XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xControl.getPeer());
+ xVclWindowPeer.setProperty("AutoMnemonics", new Boolean(bValue));
+ }
+
+ public void modifyFontWeight(String ControlName, float FontWeight)
+ {
+ FontDescriptor oFontDesc = new FontDescriptor();
+ oFontDesc.Weight = FontWeight;
+ setControlProperty(ControlName, "FontDescriptor", oFontDesc);
+ }
+
+ /**
+ * create a peer for this
+ * dialog, using the given
+ * peer as a parent.
+ * @param parentPeer
+ * @return
+ * @throws java.lang.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);
+ // TEUER!
+ xControl.createPeer(xToolkit, parentPeer);
+ xWindowPeer = xControl.getPeer();
+ return xControl.getPeer();
+ }
+
+ /**
+ * Creates a peer for this
+ * dialog, using the active OO frame
+ * as the parent window.
+ * @return
+ * @throws java.lang.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)
+ {
+ XControl xListControl = xDlgContainer.getControl(ListBoxName);
+ XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, xListControl);
+ String FirstItem = xListBox.getItem((short) 0);
+ if (FirstItem.equals(DelEntryName))
+ {
+ short SelPos = xListBox.getSelectedItemPos();
+ xListBox.removeItems((short) 0, (short) 1);
+ if (SelPos > 0)
+ {
+ setControlProperty(ListBoxName, "SelectedItems", new short[SelPos]);
+ xListBox.selectItemPos((short) (SelPos - 1), true);
+ }
+ }
+ }
+
+ 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();
+ XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xControlPeer);
+ xVclWindowPeer.setProperty(PropertyName, PropertyValue);
+ }
+
+ public static Object getModel(Object control)
+ {
+ XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, control);
+ XControlModel xModel = xControl.getModel();
+ return xModel;
+ }
+
+ public static void setEnabled(Object control, boolean enabled)
+ {
+ setEnabled(control, enabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ public static void setEnabled(Object control, Boolean enabled)
+ {
+ Helper.setUnoPropertyValue(getModel(control), "Enabled", enabled);
+ }
+
+ /**
+ * @author bc93774
+ * @param oControlModel the model of a control
+ * @return the LabelType according to UIConsts.CONTROLTYPE
+ */
+ 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;
+ }
+ }
+
+ /**
+ * @author bc93774
+ * @param oControlModel
+ * @return the name of the property that contains the value of a controlmodel
+ */
+ public static String getDisplayProperty(Object oControlModel)
+ {
+ XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oControlModel);
+ int itype = getControlModelType(oControlModel);
+ return getDisplayProperty(itype);
+ }
+
+ /**
+ * @author bc93774
+ * @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:
+ return "";
+ }
+ }
+
+ public void addResourceHandler(String _Unit, String _Module)
+ {
+ m_oResource = new Resource(xMSF, _Unit, _Module);
+ }
+
+ public static short setInitialTabindex(int _istep)
+ {
+ return (short) (_istep * 100);
+ }
+ private Boolean BisHighContrastModeActivated = null;
+
+ public boolean isHighContrastModeActivated()
+ {
+ if (xVclWindowPeer != null)
+ {
+ if (BisHighContrastModeActivated == null)
+ {
+ int nUIColor;
+ try
+ {
+ nUIColor = AnyConverter.toInt(this.xVclWindowPeer.getProperty("DisplayBackgroundColor"));
+ }
+ catch (IllegalArgumentException e)
+ {
+ e.printStackTrace(System.out);
+ return false;
+ }
+ //TODO: The following methods could be wrapped in an own class implementation
+ int nRed = getRedColorShare(nUIColor);
+ int nGreen = getGreenColorShare(nUIColor);
+ int nBlue = getBlueColorShare(nUIColor);
+ 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;
+ int nRedModulo = _nColor % 65536;
+ int nGreen = (int) (nRedModulo / 256);
+ int nGreenModulo = (nRedModulo % 256);
+ int nBlue = nGreenModulo;
+ return nRed;
+ }
+
+ 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;
+ int nRedModulo = _nColor % 65536;
+ int nGreen = (int) (nRedModulo / 256);
+ int nGreenModulo = (nRedModulo % 256);
+ int nBlue = nGreenModulo;
+ return nBlue;
+ }
+
+ 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;
+ }
+ }
+
+ public static short getListBoxLineCount()
+ {
+ return (short)20;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
new file mode 100644
index 000000000000..184a4a354b0c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
@@ -0,0 +1,384 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.ui.event.*;
+
+/**
+ * This class contains convenience methods for inserting components to a dialog.
+ * It was created for use with the automatic conversion of Basic XML Dialog
+ * description files to a Java class which builds the same dialog through the UNO API.<br/>
+ * It uses an Event-Listener method, which calls a method through reflection
+ * wenn an event on a component is trigered.
+ * see the classes AbstractListener, CommonListener, MethodInvocation for details.
+ */
+public class UnoDialog2 extends UnoDialog implements EventNames
+{
+
+ /**
+ * Override this method to return another listener.
+ * @return
+ */
+ protected AbstractListener createListener()
+ {
+ return new CommonListener();
+ }
+
+ 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)
+ {
+
+ XButton xButton = (XButton) insertControlModel2("com.sun.star.awt.UnoControlButtonModel", sName, sPropNames, oPropValues, XButton.class);
+
+ 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)
+ {
+ return insertButton(sName, actionPerformed, this, sPropNames, oPropValues);
+ }
+
+ public XButton insertImageButton(String sName, com.sun.star.awt.XActionListener actionPerformed, Object eventTarget, String[] sPropNames, Object[] oPropValues)
+ {
+
+ XButton xButton = (XButton) insertControlModel2("com.sun.star.awt.UnoControlButtonModel", sName, sPropNames, oPropValues, XButton.class);
+
+ if (actionPerformed != null)
+ {
+ xButton.addActionListener(actionPerformed);
+ }
+ return xButton;
+ }
+
+ public XButton insertImageButton(String sName, com.sun.star.awt.XActionListener actionPerformed, String[] sPropNames, Object[] oPropValues)
+ {
+ return insertImageButton(sName, actionPerformed, this, sPropNames, 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)
+ {
+ 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 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)
+ {
+ xComboBox.addActionListener((XActionListener) guiEventListener);
+ guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget);
+ }
+ 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);
+ }
+ return xComboBox;
+ }
+
+ 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)
+ {
+ XListBox xListBox = (XListBox) insertControlModel2("com.sun.star.awt.UnoControlListBoxModel", sName, sPropNames, oPropValues, XListBox.class);
+ if (actionPerformed != null)
+ {
+ xListBox.addActionListener((XActionListener) guiEventListener);
+ guiEventListener.add(sName, EVENT_ACTION_PERFORMED, actionPerformed, eventTarget);
+ }
+ 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)
+ {
+ return insertListBox(sName, actionPerformed, itemChanged, this, sPropNames, 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)
+ {
+ 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)
+ {
+ return insertRadioButton(sName, itemChanged, this, sPropNames, 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)
+ {
+ 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)
+ {
+ return insertTextField(sName, sTextChanged, this, sPropNames, 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(getDlgNameAccess(), "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(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)
+ {
+ XTextComponent xField = (XTextComponent) insertControlModel2(sModelClass, sName, sPropNames, oPropValues, XTextComponent.class);
+ 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)
+ {
+ 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)
+ {
+ return insertFileControl(sName, sTextChanged, this, sPropNames, 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)
+ {
+ return insertCurrencyField(sName, sTextChanged, this, sPropNames, 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)
+ {
+ return insertDateField(sName, sTextChanged, this, sPropNames, 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)
+ {
+ return insertNumericField(sName, sTextChanged, this, sPropNames, 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)
+ {
+ return insertTimeField(sName, sTextChanged, this, sPropNames, 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)
+ {
+ return insertPatternField(sName, sTextChanged, this, sPropNames, 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)
+ {
+ return insertFormattedField(sName, sTextChanged, this, sPropNames, 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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
+ {
+ //System.out.println("Inserting : " + componentName);
+ 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)
+ {
+ ex.printStackTrace();
+ }
+ final Object aObj = xDlgContainer.getControl(componentName);
+ return aObj;
+ }
+
+ 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]);
+ }
+
+
+ }
+
+ 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)
+ {
+ return "";
+ }
+
+ 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)
+ {
+ 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
new file mode 100644
index 000000000000..f17c44b82aa5
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java
@@ -0,0 +1,811 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.beans.*;
+
+import com.sun.star.wizards.ui.event.CommonListener;
+import com.sun.star.wizards.ui.event.EventNames;
+import com.sun.star.wizards.ui.event.MethodInvocation;
+import com.sun.star.uno.UnoRuntime;
+// import com.sun.star.awt.XItemEventBroadcaster;
+import com.sun.star.awt.*;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.XInterface;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.container.XIndexContainer;
+import com.sun.star.frame.XTerminateListener;
+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
+{
+
+ 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";
+ private static final String CANCEL_ACTION_PERFORMED = "cancelWizard_1";
+ private static final String HELP_ACTION_PERFORMED = "callHelp";
+ public VetoableChangeSupport vetos = new VetoableChangeSupport(this);
+ private String[] sRightPaneHeaders;
+ private int iButtonWidth = 50;
+ private int nNewStep = 1;
+ private int nOldStep = 1;
+ private int nMaxStep = 1;
+ protected XItemListener RoadmapItemListener;
+ protected XControl xRoadmapControl;
+ XItemEventBroadcaster xRoadmapBroadcaster;
+ String[] sRMItemLabels;
+ private Object oRoadmap;
+ private XSingleServiceFactory xSSFRoadmap;
+ public XIndexContainer xIndexContRoadmap;
+ private Resource oWizardResource;
+ public String sMsgEndAutopilot;
+ private int hid;
+ private boolean bTerminateListenermustberemoved = true;
+
+ /** Creates a new instance of WizardDialog
+ * the hid is used as following :
+ * "HID:(hid)" - the dialog
+ * "HID:(hid+1) - the help button
+ * "HID:(hid+2)" - the back button
+ * "HID:(hid+3)" - the next button
+ * "HID:(hid+4)" - the create button
+ * "HID:(hid+5)" - the cancel button
+ * @param xMSF
+ * @param 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");
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Resource getResource()
+ {
+ return oWizardResource;
+ }
+
+ public void activate()
+ {
+ try
+ {
+ XTopWindow top = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class, xWindow);
+ if (top != null)
+ {
+ top.toFront();
+ }
+ }
+ catch (Exception ex)
+ {
+ // do nothing;
+ }
+ }
+
+ public void setMaxStep(int i)
+ {
+ nMaxStep = i;
+ }
+
+ public int getMaxStep()
+ {
+ return nMaxStep;
+ }
+
+ public void setOldStep(int i)
+ {
+ nOldStep = i;
+ }
+
+ public int getOldStep()
+ {
+ return nOldStep;
+ }
+
+ public void setNewStep(int i)
+ {
+ nNewStep = i;
+ }
+
+ public int getNewStep()
+ {
+ return nNewStep;
+ }
+
+ /**
+ * @see java.beans.VetoableChangeListener#vetoableChange(java.beans.PropertyChangeEvent)
+ */
+ public void vetoableChange(java.beans.PropertyChangeEvent arg0)
+ {
+ nNewStep = nOldStep;
+ }
+
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ }
+ }
+
+ public void setRoadmapInteractive(boolean _bInteractive)
+ {
+ Helper.setUnoPropertyValue(oRoadmap, "Activated", new Boolean(_bInteractive));
+ }
+
+ public void setRoadmapComplete(boolean bComplete)
+ {
+ Helper.setUnoPropertyValue(oRoadmap, "Complete", new Boolean(bComplete));
+ }
+
+ public boolean isRoadmapComplete()
+ {
+ try
+ {
+ return AnyConverter.toBoolean(Helper.getUnoPropertyValue(oRoadmap, "Complete"));
+ }
+ catch (IllegalArgumentException exception)
+ {
+ exception.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ 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
+ {
+ return AnyConverter.toInt(Helper.getUnoPropertyValue(oRoadmap, "CurrentItemID"));
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return -1;
+ }
+ }
+
+ public void addRoadmap()
+ {
+ try
+ {
+ int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, "Height")).intValue();
+
+ // the roadmap control has got no real TabIndex ever
+ // that is not correct, but changing this would need time, so it is used
+ // without TabIndex as before
+ oRoadmap = insertControlModel("com.sun.star.awt.UnoControlRoadmapModel", "rdmNavi",
+ new String[]
+ {
+ "Height",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Tabstop",
+ "Width"
+ },
+ new Object[]
+ {
+ new Integer(iDialogHeight - 26),
+ new Integer(0),
+ new Integer(0),
+ new Integer(0),
+ new Short((short)0),
+ Boolean.TRUE,
+ new Integer(85)
+ });
+ XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap);
+ xPSet.setPropertyValue("Name", "rdmNavi");
+
+ xSSFRoadmap = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmap);
+ xIndexContRoadmap = (XIndexContainer) UnoRuntime.queryInterface(XIndexContainer.class, oRoadmap);
+ // XPropertySet xPropRoadmapModel = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap);
+ // xPropRoadmapModel.addPropertyChangeListener("CurrentItemID", new WizardDialog.RoadmapItemListener(this.xDialogModel));
+
+ MethodInvocation mi = new MethodInvocation("itemStateChanged", this, com.sun.star.awt.ItemEvent.class);
+ getGuiEventListener().add("rdmNavi", EventNames.EVENT_ITEM_CHANGED, mi);
+ xRoadmapControl = this.xDlgContainer.getControl("rdmNavi");
+ xRoadmapBroadcaster = (XItemEventBroadcaster) UnoRuntime.queryInterface(XItemEventBroadcaster.class, xRoadmapControl);
+ xRoadmapBroadcaster.addItemListener((XItemListener) getGuiEventListener());
+
+ // xRoadmapControl = this.xDlgContainer.getControl("rdmNavi");
+ // xRoadmapBroadcaster.addItemListener(new RoadmapItemListener());
+ Helper.setUnoPropertyValue(oRoadmap, "Text", oWizardResource.getResText(UIConsts.RID_COMMON + 16));
+ }
+ catch (NoSuchMethodException ex)
+ {
+ Resource.showCommonResourceError(xMSF);
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ }
+
+ public void setRMItemLabels(Resource _oResource, int StartResID)
+ {
+ sRMItemLabels = _oResource.getResArray(StartResID, nMaxStep);
+ }
+
+ 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)
+ {
+ return insertRoadmapItem(_Index, _bEnabled, sRMItemLabels[_LabelID], _CurItemID);
+ }
+
+ 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));
+ Helper.setUnoPropertyValue(oRoadmapItem, "ID", new Integer(_CurItemID));
+ xIndexContRoadmap.insertByIndex(Index, oRoadmapItem);
+ int NextIndex = Index + 1;
+ return NextIndex;
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return -1;
+ }
+ }
+
+ public int getRMItemCount()
+ {
+ return xIndexContRoadmap.getCount();
+ }
+
+ public XInterface getRoadmapItemByID(int _ID)
+ {
+ try
+ {
+ int CurID;
+ XInterface CurRoadmapItem;
+ 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)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
+
+ public boolean switchToStep(int _nOldStep, int _nNewStep)
+ {
+ nOldStep = _nOldStep;
+ nNewStep = _nNewStep;
+ return switchToStep();
+ }
+
+ private boolean switchToStep()
+ {
+ leaveStep(nOldStep, nNewStep);
+ if (nNewStep != nOldStep)
+ {
+ if (nNewStep == nMaxStep)
+ {
+ setControlProperty("btnWizardNext", "DefaultButton", Boolean.FALSE);
+ setControlProperty("btnWizardFinish", "DefaultButton", Boolean.TRUE);
+ }
+ else
+ {
+ setControlProperty("btnWizardNext", "DefaultButton", Boolean.TRUE);
+ setControlProperty("btnWizardFinish", "DefaultButton", Boolean.FALSE);
+ }
+ changeToStep(nNewStep);
+ enterStep(nOldStep, nNewStep);
+ return true;
+ }
+ return false;
+ }
+
+ abstract protected void leaveStep(int nOldStep, int nNewStep);
+
+ abstract protected void enterStep(int nOldStep, int nNewStep);
+
+ protected void changeToStep(int nNewStep)
+ {
+ Helper.setUnoPropertyValue(xDialogModel, "Step", new Integer(nNewStep));
+ setCurrentRoadmapItemID((short) (nNewStep));
+ enableNextButton(getNextAvailableStep() > 0);
+ enableBackButton(nNewStep != 1);
+ }
+
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.XCompletion#iscompleted(int)
+ */
+ /**
+ *
+ * @param _ndialogpage
+ * @return
+ */
+ public boolean iscompleted(int _ndialogpage)
+ {
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.XCompletion#ismodified(int)
+ */
+
+ /**
+ *
+ * @param _ndialogpage
+ * @return
+ */
+ public boolean ismodified(int _ndialogpage)
+ {
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.XCompletion#setcompleted(int, boolean)
+ */
+
+ /**
+ *
+ * @param _ndialogpage
+ * @param _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)
+ */
+
+ /**
+ *
+ * @param _ndialogpage
+ * @param ooldValue
+ * @param onewValue
+ */
+ public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue)
+ {
+ }
+
+ public void drawNaviBar()
+ {
+
+ try
+ {
+ short curtabindex = UIConsts.SOFIRSTWIZARDNAVITABINDEX;
+ Integer IButtonWidth = new Integer(iButtonWidth);
+ int iButtonHeight = 14;
+ Integer IButtonHeight = new Integer(iButtonHeight);
+ Integer ICurStep = new Integer(0);
+ int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, "Height")).intValue();
+ int iDialogWidth = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, "Width")).intValue();
+ int iHelpPosX = 8;
+ int iBtnPosY = iDialogHeight - iButtonHeight - 6;
+ int iCancelPosX = iDialogWidth - iButtonWidth - 6;
+ int iFinishPosX = iCancelPosX - 6 - iButtonWidth;
+ int iNextPosX = iFinishPosX - 6 - iButtonWidth;
+ 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)
+ });
+
+ 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"
+ };
+
+ 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("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
+ });
+
+ 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
+ });
+
+ 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);
+
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ }
+
+ 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)
+ {
+ setStepEnabled(_nStep, bEnabled);
+ if (getNextAvailableStep() > 0)
+ {
+ enableNextButton(bEnabled);
+ }
+ }
+
+ public void enableNavigationButtons(boolean _bEnableBack, boolean _bEnableNext, boolean _bEnableFinish)
+ {
+ enableBackButton(_bEnableBack);
+ enableNextButton(_bEnableNext);
+ enableFinishButton(_bEnableFinish);
+ }
+
+ public void enableBackButton(boolean enabled)
+ {
+ setControlProperty("btnWizardBack", "Enabled", enabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ public void enableNextButton(boolean enabled)
+ {
+ setControlProperty("btnWizardNext", "Enabled", enabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ public void enableFinishButton(boolean enabled)
+ {
+ setControlProperty("btnWizardFinish", "Enabled", enabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ 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)
+ {
+ for (int i = _iStep; i <= nMaxStep; i++)
+ {
+ setStepEnabled(i, _bDoEnable);
+ }
+ enableFinishButton(_bDoEnable);
+ if (!_bDoEnable)
+ {
+ enableNextButton(_iStep > getCurrentStep() + 1);
+ }
+ else
+ {
+ enableNextButton(!(getCurrentStep() == nMaxStep));
+ }
+ }
+ }
+
+ public boolean isStepEnabled(int _nStep)
+ {
+ try
+ {
+ boolean bIsEnabled;
+ XInterface xRoadmapItem = getRoadmapItemByID(_nStep);
+ if (xRoadmapItem == null)
+ // 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)
+ {
+ exception.printStackTrace(System.out);
+ return false;
+ }
+ }
+
+ public synchronized void gotoPreviousAvailableStep()
+ {
+ boolean bIsEnabled;
+ if (nNewStep > 1)
+ {
+ nOldStep = nNewStep;
+ nNewStep--;
+ while (nNewStep > 0)
+ {
+ bIsEnabled = isStepEnabled(nNewStep);
+ if (bIsEnabled)
+ {
+ break;
+ }
+ nNewStep--;
+ }
+ if (nNewStep == 0) // Exception???
+ {
+ nNewStep = nOldStep;
+ }
+ switchToStep();
+ }
+ }
+
+ //TODO discuss with rp
+ protected int getNextAvailableStep()
+ {
+ if (isRoadmapComplete())
+ {
+ for (int i = nNewStep + 1; i <= nMaxStep; i++)
+ {
+ if (isStepEnabled(i))
+ {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public synchronized void gotoNextAvailableStep()
+ {
+ nOldStep = nNewStep;
+ nNewStep = getNextAvailableStep();
+ if (nNewStep > -1)
+ {
+ switchToStep();
+ }
+ }
+
+ public abstract boolean finishWizard();
+
+ /**
+ * This function will call if the finish button is pressed on the UI.
+ */
+ public void finishWizard_1()
+ {
+ enableFinishButton(false);
+ boolean success = false;
+ try
+ {
+ success = finishWizard();
+ }
+ finally
+ {
+ if ( !success )
+ enableFinishButton( true );
+ }
+ if ( success )
+ removeTerminateListener();
+ }
+
+ public int getMaximalStep()
+ {
+ return this.nMaxStep;
+ }
+
+ public int getCurrentStep()
+ {
+ try
+ {
+ return AnyConverter.toInt(Helper.getUnoPropertyValue(this.MSFDialogModel, "Step"));
+ }
+ catch (com.sun.star.uno.Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return -1;
+ }
+ }
+
+ public void setCurrentStep(int _nNewstep)
+ {
+ nNewStep = _nNewstep;
+ changeToStep(nNewStep);
+ }
+
+ public void setRightPaneHeaders(Resource _oResource, int StartResID, int _nMaxStep)
+ {
+ String[] sRightPaneHeaders = _oResource.getResArray(StartResID, _nMaxStep);
+ setRightPaneHeaders(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++)
+ {
+ 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)
+ });
+ }
+ }
+
+ public void cancelWizard()
+ {
+ //can be overwritten by extending class
+ xDialog.endExecute();
+ }
+
+ public void callHelp()
+ {
+ //should be overwritten by extending class
+ }
+
+ public void removeTerminateListener()
+ {
+ if (bTerminateListenermustberemoved)
+ {
+ Desktop.getDesktop(xMSF).removeTerminateListener(this);
+ bTerminateListenermustberemoved = false;
+ }
+ }
+
+ /**
+ * called by the cancel button and
+ * by the window hidden event.
+ * if this method was not called before,
+ * perform a cancel.
+ */
+ public void cancelWizard_1()
+ {
+ cancelWizard();
+ removeTerminateListener();
+ }
+
+ public void windowHidden()
+ {
+ cancelWizard_1();
+ }
+
+ public void notifyTermination(EventObject arg0)
+ {
+ cancelWizard_1();
+ }
+
+ public void queryTermination(EventObject arg0)
+ throws TerminationVetoException
+ {
+ activate();
+ throw new TerminationVetoException();
+ }
+
+ 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
new file mode 100644
index 000000000000..24fbd10eb9dd
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/XCommandSelectionListener.java
@@ -0,0 +1,43 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 void CommandSelected(String CommandName);
+}
diff --git a/wizards/com/sun/star/wizards/ui/XCompletion.java b/wizards/com/sun/star/wizards/ui/XCompletion.java
new file mode 100644
index 000000000000..545345731e39
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/XCompletion.java
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 XCompletion
+{
+
+ public void setcompleted(int _ndialogpage, boolean _biscompleted);
+
+ public boolean iscompleted(int _ndialogpage);
+
+ public void setmodified(int _ndialogpage, Object ooldValue, Object onewValue);
+
+ public boolean ismodified(int _ndialogpage);
+}
diff --git a/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java b/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java
new file mode 100644
index 000000000000..b47ad2363709
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/XFieldSelectionListener.java
@@ -0,0 +1,53 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ */
+package com.sun.star.wizards.ui;
+
+/**
+ *
+ * @author bc93774
+ */
+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
new file mode 100755
index 000000000000..5c76c092a46f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/XPathSelectionListener.java
@@ -0,0 +1,34 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 void validatePath();
+}
diff --git a/wizards/com/sun/star/wizards/ui/event/AbstractListener.java b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
new file mode 100644
index 000000000000..ebbcba96f58c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import com.sun.star.awt.XControl;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Hashtable;
+
+/**
+ * This class is a base class for listener classes.
+ * It uses a hashtable to map between a ComponentName, EventName and a MethodInvokation Object.
+ * To use this class do the following:<br/>
+ * <list>
+ * <li>Write a subclass which implements the needed Listener(s).</li>
+ * in the even methods, use invoke(...).
+ * <li>When instanciating the component, register the subclass as the event listener.</li>
+ * <li>Write the methods which should be performed when the event occures.</li>
+ * <li>call the "add" method, to define a component-event-action mapping.</li>
+ * </list>
+ * @author rpiterman
+ */
+public class AbstractListener
+{
+
+ private Hashtable mHashtable = new Hashtable();
+
+ /** Creates a new instance of AbstractListener */
+ public AbstractListener()
+ {
+ }
+
+ public void add(String componentName, String eventName, String methodName, Object target)
+ {
+ try
+ {
+ add(componentName, eventName, new MethodInvocation(methodName, target));
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public void add(String componentName, String eventName, MethodInvocation mi)
+ {
+ mHashtable.put(componentName + eventName, mi);
+ }
+
+ public MethodInvocation get(String componentName, String eventName)
+ {
+ return (MethodInvocation) mHashtable.get(componentName + eventName);
+ }
+
+ 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)
+ {
+
+ System.out.println("=======================================================");
+ System.out.println("=== Note: An Exception was thrown which should have ===");
+ System.out.println("=== caused a crash. I caught it. Please report this ===");
+ System.out.println("=== to openoffice.org ===");
+ System.out.println("=======================================================");
+
+ ite.printStackTrace();
+
+ }
+ catch (IllegalAccessException iae)
+ {
+ iae.printStackTrace();
+ }
+ 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 ==");
+ System.out.println("=== to openoffice.org ==");
+ System.out.println("=======================================================");
+ ex.printStackTrace();
+ }
+
+ return null;
+ }
+
+ /**
+ * Rerurns the property "name" of the Object which is the source of the event.
+ */
+ 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
new file mode 100644
index 000000000000..18f33af2cef8
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.java
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import com.sun.star.awt.*;
+import com.sun.star.lang.EventObject;
+
+/**
+ *
+ * @author rpiterman
+ */
+public class CommonListener extends AbstractListener implements XActionListener, XItemListener, XTextListener, EventNames, XWindowListener, XMouseListener, XFocusListener, XKeyListener
+{
+
+ /** Creates a new instance of CommonListener */
+ public CommonListener()
+ {
+ }
+
+ /**
+ * Implementation of com.sun.star.awt.XActionListener
+ */
+ 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)
+ {
+ }
+
+ /**
+ * Implementation of com.sun.star.awt.XItemListener
+ */
+ public void itemStateChanged(ItemEvent itemEvent)
+ {
+ invoke(getEventSourceName(itemEvent), EVENT_ITEM_CHANGED, itemEvent);
+ }
+
+ /**
+ * Implementation of com.sun.star.awt.XTextListener
+ */
+ 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)
+ {
+ invoke(getEventSourceName(event), EVENT_WINDOW_RESIZED, event);
+ }
+
+ /**
+ * @see com.sun.star.awt.XWindowListener#windowMoved(com.sun.star.awt.WindowEvent)
+ */
+ 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)
+ {
+ invoke(getEventSourceName(event), EVENT_WINDOW_SHOWN, event);
+ }
+
+ /**
+ * @see com.sun.star.awt.XWindowListener#windowHidden(com.sun.star.lang.EventObject)
+ */
+ 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)
+ {
+ invoke(getEventSourceName(event), EVENT_MOUSE_PRESSED, event);
+ }
+
+ /**
+ * @see com.sun.star.awt.XMouseListener#mouseReleased(com.sun.star.awt.MouseEvent)
+ */
+ 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)
+ {
+ invoke(getEventSourceName(event), EVENT_MOUSE_ENTERED, event);
+ }
+
+ /**
+ * @see com.sun.star.awt.XMouseListener#mouseExited(com.sun.star.awt.MouseEvent)
+ */
+ 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)
+ {
+ invoke(getEventSourceName(event), EVENT_FOCUS_GAINED, event);
+ }
+
+ /**
+ * @see com.sun.star.awt.XFocusListener#focusLost(com.sun.star.awt.FocusEvent)
+ */
+ 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)
+ {
+ invoke(getEventSourceName(event), EVENT_KEY_PRESSED, event);
+ }
+
+ /**
+ * @see com.sun.star.awt.XKeyListener#keyReleased(com.sun.star.awt.KeyEvent)
+ */
+ public void keyReleased(KeyEvent event)
+ {
+ invoke(getEventSourceName(event), EVENT_KEY_RELEASED, event);
+ }
+}
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java
new file mode 100644
index 000000000000..b81b8e71bcdb
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java
@@ -0,0 +1,365 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * @author rpiterman
+ * DataAware objects are used to live-synchronize UI and DataModel/DataObject.
+ * It is used as listener on UI events, to keep the DataObject up to date.
+ * This class, as a base abstract class, sets a frame of functionality,
+ * delegating the data Object get/set methods to a Value object,
+ * and leaving the UI get/set methods abstract.
+ * Note that event listenning is *not* a part of this model.
+ * the updateData() or updateUI() methods should be porogramatically called.
+ * in child classes, the updateData() will be binded to UI event calls.
+ * <br><br>
+ * This class holds references to a Data Object and a Value object.
+ * The Value object "knows" how to get and set a value from the
+ * Data Object.
+ */
+public abstract class DataAware {
+
+ /**
+ * this is the data object.
+ */
+ protected Object dataObject;
+ //protected Method setMethod;
+ //protected Method getMethod;
+ /**
+ * A Value Object knows how to get/set a value
+ * from/to the data object.
+ */
+ protected Value value;
+
+ /**
+ * creates a DataAware object for the given data object and Value object.
+ * @param dataObject_
+ * @param value_
+ */
+ protected DataAware(Object dataObject_, Value value_) {
+ dataObject = dataObject_;
+ value = value_;
+ //getMethod = createGetMethod(dataPropName, dataObject);
+ //setMethod = createSetMethod(dataPropName, dataObject, getMethod.getReturnType());
+ }
+
+ /**
+ * returns the data object.
+ * @return
+ */
+ public Object getDataObject() {
+ return dataObject;
+ }
+
+ /**
+ * sets a new data object. Optionally
+ * update the UI.
+ * @param obj the new data object.
+ * @param updateUI if true updateUI() will be called.
+ */
+ public void setDataObject(Object obj, boolean updateUI) {
+
+ if (obj != null && !value.isAssignable(obj.getClass()))
+ throw new ClassCastException("can not cast new DataObject to original Class");
+
+ dataObject = obj;
+
+ if (updateUI)
+ updateUI();
+
+ }
+
+ /**
+ * Sets the given value to the data object.
+ * this method delegates the job to the
+ * Value object, but can be overwritten if
+ * another kind of Data is needed.
+ * @param newValue the new value to set to the DataObject.
+ */
+ protected void setToData(Object newValue) {
+ value.set(newValue,getDataObject());
+ }
+
+ /**
+ * gets the current value from the data obejct.
+ * this method delegates the job to
+ * the value object.
+ * @return the current value of the data object.
+ */
+ protected Object getFromData() {
+ return value.get(getDataObject());
+ }
+
+ /**
+ * sets the given value to the UI control
+ * @param newValue the value to set to the ui control.
+ */
+ protected abstract void setToUI(Object newValue);
+
+ /**
+ * gets the current value from the UI control.
+ * @return the current value from the UI control.
+ */
+ protected abstract Object getFromUI();
+
+ /**
+ * updates the UI control according to the
+ * current state of the data object.
+ */
+ public void updateUI() {
+ Object data = getFromData();
+ Object ui = getFromUI();
+ if (!equals(data, ui))
+ try {
+ setToUI(data);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ //TODO tell user...
+ }
+ enableControls(data);
+ }
+
+ /**
+ * enables
+ * @param currentValue
+ */
+ protected void enableControls(Object currentValue) {
+ }
+
+ /**
+ * updates the DataObject according to
+ * the current state of the UI control.
+ */
+ public void updateData() {
+ Object data = getFromData();
+ Object ui = getFromUI();
+ if (!equals(data, ui))
+ setToData(ui);
+ enableControls(ui);
+ }
+
+ public interface Listener {
+ public void eventPerformed(Object event);
+ }
+
+ /**
+ * compares the two given objects.
+ * This method is null safe and returns true also if both are null...
+ * If both are arrays, treats them as array of short and compares them.
+ * @param a first object to compare
+ * @param b second object to compare.
+ * @return true if both are null or both are equal.
+ */
+ protected boolean equals(Object a, Object b) {
+ if (a == null && b == null)
+ return true;
+ if (a == null || b == null)
+ return false;
+ if (a.getClass().isArray()) {
+ if (b.getClass().isArray())
+ return Arrays.equals((short[]) a, (short[]) b);
+ else
+ return false;
+ }
+ return a.equals(b);
+ }
+
+ /**
+ * given a collection containing DataAware objects,
+ * calls updateUI() on each memebr of the collection.
+ * @param dataAwares a collection containing DataAware objects.
+ */
+ public static void updateUI(Collection dataAwares) {
+ for (Iterator i = dataAwares.iterator(); i.hasNext();)
+ ((DataAware) i.next()).updateUI();
+ }
+
+ public static void updateData(Collection dataAwares) {
+ for (Iterator i = dataAwares.iterator(); i.hasNext();)
+ ((DataAware) i.next()).updateData();
+ }
+
+ /**
+ * /**
+ * Given a collection containing DataAware objects,
+ * sets the given DataObject to each DataAware object
+ * in the given collection
+ * @param dataAwares a collection of DataAware objects.
+ * @param dataObject new data object to set to the DataAware objects in the given collection.
+ * @param updateUI if true, calls updateUI() on each DataAware object.
+ */public static void setDataObject(Collection dataAwares, Object dataObject, boolean updateUI) {
+ for (Iterator i = dataAwares.iterator(); i.hasNext();)
+ ((DataAware) i.next()).setDataObject(dataObject, updateUI);
+ }
+
+ /**
+ * Value objects read and write a value from and
+ * to an object. Typically using reflection and JavaBeans properties
+ * or directly using memeber reflection API.
+ * DataAware delegates the handling of the DataObject
+ * to a Value object.
+ * 2 implementations currently exist: PropertyValue,
+ * using JavaBeans properties reflection, and DataAwareFields classes
+ * which implement different memeber types.
+ */
+ public interface Value {
+ /**
+ * gets a value from the given object.
+ * @param target the object to get the value from.
+ * @return the value from the given object.
+ */
+ public Object get(Object target);
+ /**
+ * sets a value to the given object.
+ * @param value the value to set to the object.
+ * @param target the object to set the value to.
+ */
+ public void set(Object value, Object target);
+ /**
+ * checks if this Value object can handle
+ * the given object type as a target.
+ * @param type the type of a target to check
+ * @return true if the given class is acceptible for
+ * the Value object. False if not.
+ */
+ public boolean isAssignable(Class type);
+ }
+
+ /**
+ * implementation of Value, handling JavaBeans properties through
+ * reflection.
+ * This Object gets and sets a value a specific
+ * (JavaBean-style) property on a given object.
+ * @author rp143992
+ */
+ public static class PropertyValue implements Value {
+ /**
+ * the get method of the JavaBean-style property
+ */
+ private Method getMethod;
+ /**
+ * the set method of the JavaBean-style property
+ */
+ private Method setMethod;
+
+ /**
+ * creates a PropertyValue for the property with
+ * the given name, of the given JavaBean object.
+ * @param propertyName the property to access. Must be a Cup letter (e.g. "Name" for getName() and setName("..."). )
+ * @param propertyOwner the object which "own" or "contains" the property.
+ */
+ public PropertyValue(String propertyName, Object propertyOwner) {
+ getMethod = createGetMethod(propertyName, propertyOwner);
+ setMethod = createSetMethod(propertyName, propertyOwner, getMethod.getReturnType());
+ }
+
+ /**
+ * called from the constructor, and creates a get method reflection object
+ * for the given property and object.
+ * @param propName the property name0
+ * @param obj the object which contains the property.
+ * @return the get method reflection object.
+ */
+ private static Class[] EMPTY_ARRAY = new Class[0];
+
+ protected Method createGetMethod(String propName, Object obj)
+ {
+ Method m = null;
+ try
+ { //try to get a "get" method.
+
+ m = obj.getClass().getMethod("get" + propName, EMPTY_ARRAY);
+ }
+ catch (NoSuchMethodException ex1)
+ {
+ throw new IllegalArgumentException("get" + propName + "() method does not exist on " + obj.getClass().getName());
+ }
+ return m;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
+ */
+ public Object get(Object target) {
+ try {
+ return getMethod.invoke(target, EMPTY_ARRAY);
+ } catch (IllegalAccessException ex1) {
+ ex1.printStackTrace();
+ } catch (InvocationTargetException ex2) {
+ ex2.printStackTrace();
+ } catch (NullPointerException npe) {
+ if (getMethod.getReturnType().equals(String.class))
+ return "";
+ if (getMethod.getReturnType().equals(Short.class))
+ return new Short((short) 0);
+ if (getMethod.getReturnType().equals(Integer.class))
+ return new Integer(0);
+ if (getMethod.getReturnType().equals(short[].class))
+ return new short[0];
+ }
+ return null;
+
+ }
+
+ protected Method createSetMethod(String propName, Object obj, Class paramClass) {
+ Method m = null;
+ try {
+ m = obj.getClass().getMethod("set" + propName, new Class[] { paramClass });
+ } catch (NoSuchMethodException ex1) {
+ throw new IllegalArgumentException("set" + propName + "(" + getMethod.getReturnType().getName() + ") method does not exist on " + obj.getClass().getName());
+ }
+ return m;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.event.DataAware.Value#set(java.lang.Object, java.lang.Object)
+ */
+ public void set(Object value, Object target) {
+ try {
+ setMethod.invoke(target, new Object[] {value});
+ } catch (IllegalAccessException ex1) {
+ ex1.printStackTrace();
+ } catch (InvocationTargetException ex2) {
+ ex2.printStackTrace();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.event.DataAware.Value#isAssignable(java.lang.Class)
+ */
+ public boolean isAssignable(Class type) {
+ return getMethod.getDeclaringClass().isAssignableFrom(type) &&
+ setMethod.getDeclaringClass().isAssignableFrom(type);
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
new file mode 100644
index 000000000000..74881d7b1f23
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
@@ -0,0 +1,507 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import java.lang.reflect.Field;
+
+import com.sun.star.uno.Any;
+
+/**
+ * This class is a factory for Value objects for different types of
+ * memebers.
+ * Other than some Value implementations classes this class contains static
+ * type conversion methods and factory methods.
+ *
+ * @see com.sun.star.wizards.ui.event.DataAware.Value
+ */
+public class DataAwareFields
+{
+
+ private static final String TRUE = "true";
+ private static final String FALSE = "false";
+
+ /**
+ * returns a Value Object which sets and gets values
+ * and converting them to other types, according to the "value" argument.
+ *
+ * @param owner
+ * @param fieldname
+ * @param value
+ * @return
+ * @throws NoSuchFieldException
+ */
+ public static DataAware.Value getFieldValueFor(Object owner, String fieldname, Object value)
+ {
+ 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);
+ }
+ else if (c.equals(Integer.TYPE))
+ {
+ 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);
+ }
+ else
+ {
+ return new SimpleFieldValue(f);
+ }
+ }
+ catch (NoSuchFieldException ex)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * an abstract implementation of DataAware.Value to access
+ * object memebers (fields) usign reflection.
+ */
+ private static abstract class FieldValue implements DataAware.Value
+ {
+
+ Field field;
+
+ public FieldValue(Field field_)
+ {
+ field = field_;
+ }
+
+ public boolean isAssignable(Class type)
+ {
+ return field.getDeclaringClass().isAssignableFrom(type);
+ }
+ }
+
+ private static class BooleanFieldValue extends FieldValue
+ {
+
+ private Class convertTo;
+
+ public BooleanFieldValue(Field f, Class convertTo_)
+ {
+ super(f);
+ convertTo = convertTo_;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
+ */
+ 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)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+ public void set(Object value, Object target)
+ {
+ try
+ {
+ field.setBoolean(target, toBoolean(value));
+ }
+ catch (IllegalAccessException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ private static class IntFieldValue extends FieldValue
+ {
+
+ private Class convertTo;
+
+ public IntFieldValue(Field f, Class convertTo_)
+ {
+ super(f);
+ convertTo = convertTo_;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
+ */
+ 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())
+ {
+ return toShortArray(i);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot convert int value to given type (" + convertTo.getName() + ").");
+ }
+ }
+ catch (IllegalAccessException ex)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+ public void set(Object value, Object target)
+ {
+ try
+ {
+ field.setInt(target, (int) toDouble(value));
+ }
+ catch (IllegalAccessException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ private static class DoubleFieldValue extends FieldValue
+ {
+
+ private Class convertTo;
+
+ public DoubleFieldValue(Field f, Class convertTo_)
+ {
+ super(f);
+ convertTo = convertTo_;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.ui.event.DataAware.Value#get(java.lang.Object)
+ */
+ 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)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+ public void set(Object value, Object target)
+ {
+ try
+ {
+ field.setDouble(target, toDouble(value));
+ }
+ catch (IllegalAccessException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ private static class ConvertedStringValue extends FieldValue
+ {
+
+ private Class convertTo;
+
+ public ConvertedStringValue(Field f, Class convertTo_)
+ {
+ super(f);
+ convertTo = convertTo_;
+ }
+
+ /* (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);
+
+ 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 Any.VOID;
+ }
+ else
+ {
+ return new Integer(s);
+ }
+ }
+ 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)
+ {
+ 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)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ private static class SimpleFieldValue extends FieldValue
+ {
+
+ 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)
+ {
+ 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
+ {
+ return field.get(target);
+ }
+ }
+ catch (IllegalAccessException ex)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+ public void set(Object value, Object target)
+ {
+ try
+ {
+ field.set(target, value);
+ }
+ catch (IllegalAccessException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ 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)
+ {
+ 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)
+ {
+ return b ? 1 : 0;
+ }
+
+ private static short[] toShortArray(double i)
+ {
+ return new short[]
+ {
+ (short) i
+ };
+ }
+
+ 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
new file mode 100644
index 000000000000..50aa32dc57aa
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/EventNames.java
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+/**
+ *
+ * @author rpiterman
+ */
+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_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_FOCUS_GAINED = "FGA";
+ 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_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
+}
diff --git a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
new file mode 100644
index 000000000000..b2dc75f22f48
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import javax.swing.ListModel;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+import com.sun.star.awt.XComboBox;
+import com.sun.star.awt.XListBox;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+
+/**
+ * @author rpiterman
+
+ * */
+public class ListModelBinder implements ListDataListener
+{
+
+ private XListBox unoList;
+ private Object unoListModel;
+ private ListModel listModel;
+ private Renderer renderer = new Renderer()
+ {
+
+ public String render(Object item)
+ {
+ if (item == null)
+ {
+ return "";
+ }
+ else
+ {
+ return item.toString();
+ }
+ }
+ };
+
+ public ListModelBinder(Object unoListBox, ListModel listModel_)
+ {
+ unoList = (XListBox) UnoRuntime.queryInterface(XListBox.class, unoListBox);
+ unoListModel = UnoDataAware.getModel(unoListBox);
+ setListModel(listModel_);
+ }
+
+ public void setListModel(ListModel newListModel)
+ {
+ if (listModel != null)
+ {
+ listModel.removeListDataListener(this);
+ }
+ listModel = newListModel;
+ listModel.addListDataListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.event.ListDataListener#contentsChanged(javax.swing.event.ListDataEvent)
+ */
+ 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)
+ {
+ remove(i, i);
+ insert(i);
+ }
+
+ protected void remove(short i1, short i2)
+ {
+ unoList.removeItems((short) i1, (short) (i2 - i1 + 1));
+ }
+
+ protected void insert(short i)
+ {
+ unoList.addItem(getItemString(i), i);
+ }
+
+ protected String getItemString(short i)
+ {
+ return getItemString(listModel.getElementAt((int) i));
+ }
+
+ protected String getItemString(Object item)
+ {
+ return renderer.render(item);
+ }
+
+ protected short[] getSelectedItems()
+ {
+ return (short[]) Helper.getUnoPropertyValue(unoListModel, "SelectedItems");
+ }
+
+ 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)
+ {
+ //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));
+ setSelectedItems(selected);*/
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.event.ListDataListener#intervalRemoved(javax.swing.event.ListDataEvent)
+ */
+ 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++;
+ }
+ }
+
+ Short[] newSelected = (removed > 0 ? new Short[selected.length - removed] : selected;
+ if (removed>0)
+
+ if (selected[i].intValue() >= lde.getIndex0())
+ */
+ }
+
+ public static interface Renderer
+ {
+
+ public String render(Object item);
+ }
+
+ 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[]
+ {
+ });
+ 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[]
+ {
+ });
+ 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
new file mode 100644
index 000000000000..c45a496c7849
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Encapsulate a Method invocation.
+ * In the constructor one defines a method, a target object and an optional
+ * Parameter.
+ * Then one calls "invoke", with or without a parameter. <br/>
+ * Limitations: I do not check anything myself. If the param is not ok, from the
+ * wrong type, or the mothod doesnot exist on the given object.
+ * You can trick this class howmuch you want: it will all throw exceptions
+ * on the java level. i throw no error warnings or my own excceptions...
+ * @author rpiterman
+ */
+public class MethodInvocation
+{
+
+ static final Class[] EMPTY_ARRAY =
+ {
+ };
+ //the method to invoke.
+ Method mMethod;
+ //the object to invoke the method on.
+ Object mObject;
+ //with one Parameter / without
+ boolean mWithParam;
+
+ /** Creates a new instance of MethodInvokation */
+ public MethodInvocation(String methodName, Object obj) throws NoSuchMethodException
+ {
+ this(methodName, obj, null);
+ }
+
+ 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);
+ }
+
+ public MethodInvocation(Method method, Object obj, Class paramClass)
+ {
+ mMethod = method;
+ mObject = obj;
+ mWithParam = !(paramClass == null);
+ }
+
+ /**
+ * Returns the result of calling the method on the object, or null, if no result.
+ */
+ public Object invoke(Object param) throws IllegalAccessException, InvocationTargetException
+ {
+ if (mWithParam)
+ {
+ 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
+ {
+ 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
new file mode 100644
index 000000000000..7dddea572503
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import com.sun.star.awt.XItemListener;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class RadioDataAware extends DataAware
+{
+
+ protected XRadioButton[] radioButtons;
+
+ 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)
+ {
+ 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()
+ {
+ 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)
+ {
+ final RadioDataAware da = new RadioDataAware(data,
+ 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
new file mode 100644
index 000000000000..8a9c2200d76d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+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_)
+ {
+ super(dataObject, value);
+ control = control_;
+ controlValue = controlValue_;
+ }
+
+ /*
+ protected void enableControls(Object value) {
+ 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);
+ }
+
+ /**
+ * Try to get from an arbitrary object a boolean value.
+ * Null returns Boolean.FALSE;
+ * A Boolean object returns itself.
+ * An Array returns true if it not empty.
+ * An Empty String returns Boolean.FALSE.
+ * everything else returns a Boolean.TRUE.
+ * @param value
+ * @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;
+ }
+
+ public void disableControls(Object[] controls) {
+ disableObjects = controls;
+ }
+ */
+ 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
new file mode 100644
index 000000000000..16feacd5e1fa
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/Task.java
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+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_)
+ {
+ taskName = taskName_;
+ subtaskName = subtaskName_;
+ max = max_;
+ }
+
+ public void start()
+ {
+ fireTaskStarted();
+ }
+
+ public void fail()
+ {
+ fireTaskFailed();
+ }
+
+ public int getMax()
+ {
+ return max;
+ }
+
+ public void setMax(int max_)
+ {
+ max = max_;
+ fireTaskStatusChanged();
+ }
+
+ public void advance(boolean success_)
+ {
+ if (success_)
+ {
+ successfull++;
+ }
+ else
+ {
+ failed++;
+ }
+ fireTaskStatusChanged();
+ if (failed + successfull == max)
+ {
+ fireTaskFinished();
+ }
+ }
+
+ public void advance(boolean success_, String nextSubtaskName)
+ {
+ advance(success_);
+ setSubtaskName(nextSubtaskName);
+ }
+
+ public int getStatus()
+ {
+ return successfull + failed;
+ }
+
+ public void addTaskListener(TaskListener tl)
+ {
+ listeners.add(tl);
+ }
+
+ public void removeTaskListener(TaskListener tl)
+ {
+ listeners.remove(tl);
+ }
+
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+
+ /**
+ * @return
+ */
+ public String getSubtaskName()
+ {
+ return subtaskName;
+ }
+
+ /**
+ * @return
+ */
+ public String getTaskName()
+ {
+ return taskName;
+ }
+
+ /**
+ * @param string
+ */
+ public void setSubtaskName(String string)
+ {
+ subtaskName = string;
+ fireSubtaskNameChanged();
+ }
+
+ /**
+ * @return
+ */
+ public int getFailed()
+ {
+ return failed;
+ }
+
+ /**
+ * @return
+ */
+ 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
new file mode 100644
index 000000000000..1c54cfea2fa6
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/TaskEvent.java
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import java.util.EventObject;
+
+/**
+ * @author rpiterman
+ *
+ * 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 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;
+
+ /**
+ * general constructor-
+ * @param source
+ * @param type_
+ * @param max_
+ * @param success_
+ * @param failed_
+ */
+ public TaskEvent(Task source, int type_)
+ {
+ super(source);
+ type = type_;
+ }
+
+ 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
new file mode 100644
index 000000000000..114747c30776
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/TaskListener.java
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import java.util.EventListener;
+
+/**
+ * @author rpiterman
+ *
+ * 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 void taskStarted(TaskEvent te);
+
+ public void taskFinished(TaskEvent te);
+
+ /**
+ * is called when the status of the task has advanced.
+ * @param te
+ */
+ 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
new file mode 100644
index 000000000000..632609d85f05
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.event;
+
+import com.sun.star.awt.*;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.Helper;
+
+/**
+ * @author rpiterman
+ *
+ * This class suppoprts imple cases where a UI control can
+ * be directly synchronized with a data property.
+ * Such controls are: the different text controls
+ * (synchronizing the "Text" , "Value", "Date", "Time" property),
+ * Checkbox controls, Dropdown listbox controls (synchronizing the
+ * SelectedItems[] property.
+ * For those controls, static convenience methods are offered, to simplify use.
+ */
+public class UnoDataAware extends DataAware
+{
+
+ protected Object unoControl;
+ protected Object unoModel;
+ protected String unoPropName;
+ protected Object[] disableObjects = new Object[0];
+ protected boolean inverse = false;
+
+ 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)
+ {
+ inverse = i;
+ }
+
+ 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)
+ {
+ //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())
+ {
+ StringBuffer sb = new StringBuffer("[");
+ for (int i = 0; i < ((short[]) value).length; i++)
+ {
+ sb.append(((short[]) value)[i]).append(" , ");
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+ else
+ {
+ return value.toString();
+ }
+ }
+
+ /**
+ * Try to get from an arbitrary object a boolean value.
+ * Null returns Boolean.FALSE;
+ * A Boolean object returns itself.
+ * An Array returns true if it not empty.
+ * An Empty String returns Boolean.FALSE.
+ * everything else returns a Boolean.TRUE.
+ * @param value
+ * @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 if (value instanceof Number)
+ {
+ return ((Number) value).intValue() == 0 ? Boolean.TRUE : Boolean.FALSE;
+ }
+ else
+ {
+ return Boolean.TRUE;
+ }
+ }
+
+ public void disableControls(Object[] controls)
+ {
+ disableObjects = controls;
+ }
+
+ 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)
+ {
+ 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)
+ {
+ uda.updateData();
+ if (listener != null)
+ {
+ listener.eventPerformed(te);
+ }
+ }
+
+ 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 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)
+ {
+ 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 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");
+ xcheckBox.addItemListener(itemListener(uda, listener));
+ return uda;
+ }
+
+ static XItemListener itemListener(final DataAware da, final Listener listener)
+ {
+ return new XItemListener()
+ {
+
+ public void itemStateChanged(ItemEvent ie)
+ {
+ da.updateData();
+ if (listener != null)
+ {
+ listener.eventPerformed(ie);
+ }
+ }
+
+ public void disposing(EventObject eo)
+ {
+ }
+ };
+ }
+
+ 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");
+ }
+
+ 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");
+ xListBox.addItemListener(itemListener(uda, listener));
+ return uda;
+ }
+
+ public static Object getModel(Object control)
+ {
+ return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel();
+ }
+
+ public static void setEnabled(Object control, boolean enabled)
+ {
+ setEnabled(control, enabled ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ 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
new file mode 100644
index 000000000000..6a6c5a0c220f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/AbstractErrorHandler.java
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.SystemDialog;
+
+/**
+ * An abstract implementation of ErrorHandler, which
+ * uses a renderer method geMessageFor(Exception, Object, int, int)
+ * (in this class still abstract...)
+ * to render the errors, and displays
+ * error messeges.
+ */
+public abstract class AbstractErrorHandler implements ErrorHandler
+{
+
+ XMultiServiceFactory xmsf;
+ XWindowPeer peer;
+
+ protected AbstractErrorHandler(XMultiServiceFactory xmsf, XWindowPeer peer_)
+ {
+ this.xmsf = xmsf;
+ peer = peer_;
+ }
+
+ /**
+ * Implementation of ErrorHandler:
+ * shows a message box with the rendered error.
+ * @param arg identifies the error. This object is passed to the render method
+ * which returns the right error message.
+ * @return true/false for continue/abort.
+ */
+ 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);
+ 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);
+ }
+ throw new IllegalArgumentException("unknown error type");
+ }
+
+ /**
+ * @deprecated
+ * @param message
+ * @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);
+ }
+
+ /**
+ * display a message
+ * @deprecated
+ * @param xmsf
+ * @param message the message to display
+ * @param errorType an int constant from the ErrorHandler interface.
+ * @return
+ */
+ 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);
+ 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);
+ return b == returnTrueOn;
+ }
+
+ /**
+ * normally ok(1) is the value for true.
+ * but a question dialog may use yes. so i use this method
+ * for each error type to get its type of "true" value.
+ * @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:
+ case ErrorHandler.ERROR_QUESTION_OK:
+
+ return 1;
+
+ case ErrorHandler.ERROR_QUESTION_NO:
+ case ErrorHandler.ERROR_QUESTION_YES:
+
+ return 2;
+
+ 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:
+ return VclWindowPeerAttribute.OK;
+ case ErrorHandler.ERROR_PROCESS_FATAL:
+ return VclWindowPeerAttribute.OK;
+ case ErrorHandler.ERROR_NORMAL_ABORT:
+ return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_CANCEL;
+ case ErrorHandler.ERROR_NORMAL_IGNORE:
+ return VclWindowPeerAttribute.OK_CANCEL + VclWindowPeerAttribute.DEF_OK;
+ 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:
+ return VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO;
+ case ErrorHandler.ERROR_QUESTION_YES:
+ return VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_YES;
+ case ErrorHandler.ERROR_WARNING:
+ return VclWindowPeerAttribute.OK;
+ case ErrorHandler.ERROR_MESSAGE:
+ return VclWindowPeerAttribute.OK;
+ }
+ throw new IllegalArgumentException("unkonown error type");
+ }
+
+ /**
+ * @deprecated
+ * @param errorType
+ * @return the uno service name for each error type
+ */
+ private static String getServiceNameFor(int errorType)
+ {
+ switch (errorType)
+ {
+ case ErrorHandler.ERROR_FATAL:
+ return "errorbox";
+ case ErrorHandler.ERROR_PROCESS_FATAL:
+ return "errorbox";
+ case ErrorHandler.ERROR_NORMAL_ABORT:
+ return "errorbox";
+ case ErrorHandler.ERROR_NORMAL_IGNORE:
+ return "warningbox";
+ case ErrorHandler.ERROR_QUESTION_CANCEL:
+ return "querybox";
+ 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:
+ return "warningbox";
+ case ErrorHandler.ERROR_MESSAGE:
+ return "infobox";
+ }
+ throw new IllegalArgumentException("unkonown error type");
+ }
+
+ /**
+ * renders the error
+ * @param ex the exception
+ * @param arg a free argument
+ * @param ix a free argument
+ * @param type the error type (from the int constants
+ * in ErrorHandler interface)
+ * @return a Strings which will be displayed in the message box,
+ * 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
new file mode 100644
index 000000000000..70c40fbc6072
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 javax.swing.DefaultListModel;
+
+import com.sun.star.awt.Size;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.ConfigSet;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.ui.ImageList;
+import com.sun.star.wizards.web.data.CGImage;
+import com.sun.star.wizards.web.data.CGSettings;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class BackgroundsDialog extends ImageListDialog
+{
+
+ private FileAccess fileAccess;
+ private SystemDialog sd;
+ private CGSettings settings;
+
+ /**
+ * @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
+ });
+
+ sd = SystemDialog.createOpenDialog(xmsf);
+ sd.addFilter(resources.resImages, "*.jpg;*.jpeg;*.jpe;*.gif", true);
+ sd.addFilter(resources.resAllFiles, "*.*", false);
+
+ settings = (CGSettings) set_.root;
+
+ fileAccess = new FileAccess(xmsf);
+ il.setListModel(new Model(set_));
+ 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
+ * image to the list and to the web wizard configuration,
+ * 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)
+ {
+ settings.cp_DefaultSession.cp_InDirectory = FileAccess.getParentDir(filename[0]);
+ int i = add(filename[0]);
+ il.setSelected(i);
+ il.display(i);
+ }
+ }
+
+ /**
+ * adds the given image to the image list (to the model)
+ * and to the web wizard configuration.
+ * @param s
+ * @return
+ */
+ 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++)
+ {
+ 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);
+ int i = Configuration.getChildrenNames(configView).length + 1;
+ Object o = Configuration.addConfigNode(configView, "" + i);
+ Configuration.set(s, "Href", o);
+ Configuration.commit(configView);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ return il.getListModel().getSize() - 1;
+
+ }
+
+ /**
+ * an ImageList Imagerenderer implemtation.
+ * The image URL is the object given from the list model.
+ * the image name, got from the "render" method is
+ * the filename portion of the url.
+ * @author rpiterman
+ *
+ */
+ private class BGRenderer implements ImageList.IImageRenderer
+ {
+
+ 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));
+ }
+ }
+
+ /**
+ * This is a list model for the image list of the
+ * backgrounds dialog.
+ * It takes the Backgrounds config set as an argument,
+ * and "parses" it to a list of files:
+ * It goes through each image in the set, and checks it:
+ * if it is a directory it lists all image files in this directory.
+ * 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();
+ }
+ }
+
+ /**
+ * when instanciating the model, it checks if each image
+ * exists. If it doesnot, it will be removed from
+ * the configuration.
+ * 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();
+ }
+ }
+
+ /**
+ * if the given url is a directory
+ * adds the images in the given directory,
+ * 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);
+ }
+ }
+
+ /**
+ * 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]);
+ }
+ }
+
+ /**
+ * adds the given image url to the list.
+ * if and only if it ends with jpg, jpeg or gif
+ * (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);
+ }
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/web/CallWizard.java b/wizards/com/sun/star/wizards/web/CallWizard.java
new file mode 100644
index 000000000000..f0318e5f2e18
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/CallWizard.java
@@ -0,0 +1,312 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.beans.XPropertyAccess;
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.task.XJob;
+import com.sun.star.task.XJobExecutor;
+import com.sun.star.uno.Type;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.Resource;
+
+/**
+ * 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 (<CODE>__writeRegistryServiceInfo</CODE>).
+ *
+ * @author rpiterman
+ * @version $Revision: 1.10.52.1 $
+ */
+public class CallWizard
+{
+
+ /**
+ * Gives a factory for creating the service. This method is called by the
+ * <code>JavaLoader</code>
+ *
+ * <p></p>
+ *
+ * @param stringImplementationName The implementation name of the component.
+ * @param xMSF The service manager, who gives access to every known service.
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single registry key accessible.
+ *
+ * @return Returns a <code>XSingleServiceFactory</code> for creating the component.
+ *
+ * @see com.sun.star.comp.loader.JavaLoader#
+ */
+ public static XSingleServiceFactory __getServiceFactory(String stringImplementationName, XMultiServiceFactory xMSF, XRegistryKey xregistrykey)
+ {
+ XSingleServiceFactory xsingleservicefactory = null;
+
+ if (stringImplementationName.equals(WizardImplementation.class.getName()))
+ {
+ xsingleservicefactory = FactoryHelper.getServiceFactory(WizardImplementation.class, WizardImplementation.__serviceName, xMSF, xregistrykey);
+ }
+
+ return xsingleservicefactory;
+ }
+
+ /**
+ * Writes the service information into the given registry key. This method is called
+ * by the <code>JavaLoader</code>.
+ *
+ * @param xregistrykey Makes structural information (except regarding tree
+ * structures) of a single registry key accessible.
+ *
+ * @return returns true if the operation succeeded
+ *
+ * @see com.sun.star.comp.loader.JavaLoader#
+ */
+ public static boolean __writeRegistryServiceInfo(XRegistryKey xregistrykey)
+ {
+ return FactoryHelper.writeRegistryServiceInfo(WizardImplementation.class.getName(), WizardImplementation.__serviceName, xregistrykey);
+ }
+
+ /**
+ * 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
+ {
+
+ /**
+ * The constructor of the inner class has a XMultiServiceFactory parameter.
+ *
+ * @param xmultiservicefactoryInitialization A special service factory could be
+ * introduced while initializing.
+ */
+ public WizardImplementation(XMultiServiceFactory xmultiservicefactoryInitialization)
+ {
+ xmultiservicefactory = xmultiservicefactoryInitialization;
+
+ 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)
+ {
+ WebWizard ww = null;
+ try
+ {
+ webWizard = new WebWizard(xmultiservicefactory);
+ ww = webWizard;
+ webWizard.show();
+ webWizard = null;
+ }
+ catch (Exception ex)
+ {
+ webWizard = null;
+ ex.printStackTrace();
+ Resource.showCommonResourceError(xmultiservicefactory);
+ }
+ finally
+ {
+ webWizard = null;
+ try
+ {
+ if (ww != null)
+ {
+ ww.cleanup();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+ }
+ 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.
+ */
+ private XMultiServiceFactory xmultiservicefactory;
+
+ /**
+ * This method is a member of the interface for initializing an object directly
+ * after its creation.
+ *
+ * @param object This array of arbitrary objects will be passed to the component
+ * after its creation.
+ *
+ * @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
+ {
+ //wizardStarted = false;
+ }
+
+ /**
+ * 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];
+ stringSupportedServiceNames[0] = __serviceName;
+
+ return (stringSupportedServiceNames);
+ }
+
+ /**
+ * This method returns true, if the given service will be supported by the
+ * component.
+ *
+ * @param stringService Service name.
+ *
+ * @return True, if the given service name will be supported.
+ */
+ public boolean supportsService(String stringService)
+ {
+ boolean booleanSupportsService = false;
+
+ 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. to realise hashing functionality
+ * when the object is introspected. Two objects that return the same ID also
+ * have to return the same set of types in getTypes(). If an unique
+ * implementation Id cannot be provided this method has to return an empty
+ * sequence. Important: If the object aggregates other objects the ID has to be
+ * unique for the whole combination of objects.
+ *
+ * @return Array of bytes, in order to distinguish between two sets.
+ */
+ public byte[] getImplementationId()
+ {
+ byte[] byteReturn =
+ {
+ };
+
+ try
+ {
+ byteReturn = ("" + 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 (WizardImplementation.class.getName());
+ }
+
+ /**
+ * Provides a sequence of all types (usually interface types) provided by the
+ * object.
+ *
+ * @return Sequence of all types (usually interface types) provided by the
+ * service.
+ */
+ 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)
+ {
+ System.err.println(exception);
+ }
+
+ return (typeReturn);
+ }
+ }
+
+ public static void main(String[] s)
+ {
+
+ String ConnectStr =
+ "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager";
+ try
+ {
+ XMultiServiceFactory xmsf = Desktop.connect(ConnectStr);
+ CallWizard.WizardImplementation ww = new CallWizard.WizardImplementation(xmsf);
+ ww.trigger("start");
+
+ }
+ 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
new file mode 100644
index 000000000000..f330532a3058
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/ErrorHandler.java
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.awt.VclWindowPeerAttribute;
+
+/**
+ * @author rpiterman
+ *
+ * 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);
+}
diff --git a/wizards/com/sun/star/wizards/web/ExtensionVerifier.java b/wizards/com/sun/star/wizards/web/ExtensionVerifier.java
new file mode 100644
index 000000000000..8bc036131b70
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/ExtensionVerifier.java
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.wizards.common.UCB;
+
+/**
+ * @author rpiterman
+ * Verifies all String that do not end with
+ * the given extension.
+ * This is used to exclude from a copy all the
+ * xsl files, so I copy from a layout directory
+ * all the files that do *not* end with xsl.
+ *
+ */
+public class ExtensionVerifier implements UCB.Verifier
+{
+
+ private String extension;
+
+ public ExtensionVerifier(String extension_)
+ {
+ extension = "." + extension_;
+ }
+
+ /**
+ * @return true if the given object is
+ * a String which does not end with the
+ * given extension.
+ */
+ public boolean verify(Object object)
+ {
+ if (object instanceof String)
+ {
+ 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
new file mode 100644
index 000000000000..1cc68ed8491f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/FTPDialog.java
@@ -0,0 +1,751 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.List;
+import java.util.Vector;
+
+import com.sun.star.awt.PushButtonType;
+import com.sun.star.awt.XButton;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.ucb.AuthenticationRequest;
+import com.sun.star.ucb.InteractiveAugmentedIOException;
+import com.sun.star.ucb.InteractiveNetworkConnectException;
+import com.sun.star.ucb.InteractiveNetworkResolveNameException;
+import com.sun.star.ucb.OpenCommandArgument2;
+import com.sun.star.ucb.OpenMode;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.common.UCB;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.UnoDialog2;
+import com.sun.star.wizards.ui.event.DataAware;
+import com.sun.star.wizards.ui.event.UnoDataAware;
+import com.sun.star.wizards.web.data.CGPublish;
+import com.sun.star.wizards.web.data.CGSettings;
+
+/**
+ * This is the FTP Dialog. <br/>
+ * The Dialog enables the user:
+ * (*) entering FTP server and user information.
+ * (*) testing the connection.
+ * (*) choosing a directory on the server.
+ * If a connection was established succesfully, the user may
+ * press OK, which will change
+ * the CGPublish object propertiers according the user's input.
+ * If no connection was established. the OK and Choose-Dir button are disabled.
+ * See the method "disconnect()" which disables them.
+ *
+ * I use here the DataAware concept to automatically update
+ * 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
+{
+
+ /**
+ * 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;
+ /**
+ * A Constant used for the setLabel(int) method to change the
+ * status-display. (connection established)
+ */
+ private final static int STATUS_OK = 1;
+ /**
+ * A Constant used for the setLabel(int) method to change the
+ * status-display.
+ */
+ private final static int STATUS_USER_PWD_WRONG = 2;
+ /**
+ * A Constant used for the setLabel(int) method to change the
+ * status-display.
+ */
+ private final static int STATUS_SERVER_NOT_FOUND = 3;
+ /**
+ * A Constant used for the setLabel(int) method to change the
+ * status-display.
+ */
+ private final static int STATUS_NO_RIGHTS = 4;
+ /**
+ * A Constant used for the setLabel(int) method to change the
+ * status-display.
+ */
+ private final static int STATUS_HOST_UNREACHABLE = 5;
+ /**
+ * A Constant used for the setLabel(int) method to change the
+ * status-display.
+ */
+ private final static int STATUS_CONNECTING = 6;
+ /**
+ * The icon url for error
+ */
+ private final static String ICON_ERROR = "ftperror.gif";
+ /**
+ * The icon url for ok (connection ok)
+ */
+ private final static String ICON_OK = "ftpconnected.gif";
+ /**
+ * The icon url for unknown - this is the status when
+ * the user first opens the dialog
+ */
+ 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.
+ //Fixed Line
+ private XControl ln1;
+ private XFixedText lblFTPAddress;
+ private XTextComponent txtHost;
+ private XFixedText lblUsername;
+ private XTextComponent txtUsername;
+ private XFixedText lblPassword;
+ private XTextComponent txtPassword;
+ //Fixed Line
+ private XControl ln2;
+ private XButton btnTestConnection;
+ private XControl imgStatus;
+ private XFixedText lblStatus;
+ //Fixed Line
+ private XControl ln3;
+ private XTextComponent txtDir;
+ private XButton btnDir;
+ private XButton btnOK;
+ private XButton btnCancel;
+ private XButton btnHelp;
+ //Font Descriptors as Class members.
+
+ //Resources Object
+ private FTPDialogResources resources;
+ private List dataAware = new Vector();
+ public String username = "";
+ public String password = "";
+ /**
+ * The ftp host name
+ */
+ public String host = "";
+ /**
+ * The ftp directory.
+ */
+ private String dir = "";
+ /**
+ * the ftp publish object which contains the
+ * data for this dialog.
+ */
+ private CGPublish publish;
+ private UCB ucb;
+ /**
+ * used for the status images url.
+ */
+ private String imagesDirectory;
+
+ /**
+ * constructor.
+ * constructs the UI.
+ * @param xmsf
+ * @param p the publishert object that contains the data
+ * for this dialog
+ * @throws Exception
+ */
+ public FTPDialog(XMultiServiceFactory xmsf, CGPublish p) throws Exception
+ {
+ super(xmsf);
+ publish = p;
+
+
+ imagesDirectory = FileAccess.connectURLs(((CGSettings) (publish.root)).soTemplateDir, "wizard/bitmap/");
+
+ //Load Resources
+ resources = new FTPDialogResources(xmsf);
+ ucb = new UCB(xmsf);
+
+ //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)
+ });
+
+ //add controls to dialog
+ build();
+ //make the hostname, username and password textfield data-aware.
+ configure();
+ //make sure we display a disconnected status.
+ disconnect();
+ }
+
+ /**
+ * 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"
+ };
+
+ ln1 = insertFixedLine("ln1",
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ 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
+ });
+
+ 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
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+
+ 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)
+ });
+ 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
+ });
+
+ 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
+ });
+
+ 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
+ });
+
+ 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
+ });
+
+ }
+
+ /**
+ * Make hostname, username and password text fields data aware.
+ */
+ 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));
+ }
+
+ /**
+ * Shows the dialog.
+ * If the user clicks ok, changes the given CGPublish properties to the
+ * user input.
+ * @param parent a dialog to center this dialog to.
+ * @return 0 for cancel, 1 for ok.
+ * @throws Exception - well, if something goes wrong...
+ */
+ 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;
+ dir = extractDir(publish.cp_URL);
+ setLabel(STATUS_UNKONWN);
+
+ enableTestButton();
+ updateUI();
+ short result = executeDialog(parent);
+ //change the CGPublish properties
+ if (result == 1)
+ {
+ publish.cp_URL = "ftp://" + host() + getDir();
+ publish.cp_Username = username;
+ publish.password = password;
+ }
+
+ return result;
+ }
+
+ /**
+ * updates the hostname, username, password and
+ * directory text fields.
+ * is called uppon initialization.
+ */
+ private void updateUI()
+ {
+ DataAware.updateUI(dataAware);
+ setDir(dir);
+ }
+
+ /**
+ * extract the hostname out of the url used by the
+ * publisher. This url does not include the username:password string.
+ * @param ftpUrl
+ * @return
+ */
+ 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);
+ }
+ }
+
+ /**
+ * used to get data from the CGPublish object.
+ * @param ftpUrl
+ * @return the directory portion of the ftp-url
+ */
+ 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);
+ }
+ }
+
+ /**
+ * enables/disables the "test" button
+ * 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()
+ {
+ 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(""));
+ }
+
+ /**
+ * @return the ftp url with username and password,
+ * but without the directory portion.
+ */
+ public String getAcountUrl()
+ {
+ return "ftp://" + username + ":" + password + "@" + host();
+ }
+
+ /**
+ * return the host name without the "ftp://"
+ * @return
+ */
+ private String host()
+ {
+ return host(host);
+ }
+
+ 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()
+ {
+ return getAcountUrl() + dir;
+ }
+
+ /**
+ * First I try to connect to the full url, including directory.
+ * If an InteractiveAugmentedIOException accures, I try again,
+ * this time without the dir spec. If this works, I change the dir
+ * to "/", if not I say to the user its his problem...
+ *
+ */
+ public void connect()
+ {
+ setEnabled(btnTestConnection, false);
+ setLabel(STATUS_CONNECTING);
+ boolean success = false;
+ try
+ {
+ connect(getFullUrl());
+ success = true;
+ }
+ catch (InteractiveAugmentedIOException iaioex)
+ {
+ try
+ {
+ connect(getAcountUrl());
+ setDir("/");
+ success = true;
+ }
+ catch (Exception ex)
+ {
+ setLabel(STATUS_NO_RIGHTS);
+ }
+ }
+ catch (InteractiveNetworkResolveNameException inrne)
+ {
+ setLabel(STATUS_SERVER_NOT_FOUND);
+ }
+ catch (AuthenticationRequest ar)
+ {
+ setLabel(STATUS_USER_PWD_WRONG);
+ }
+ catch (InteractiveNetworkConnectException incx)
+ {
+ setLabel(STATUS_HOST_UNREACHABLE);
+ }
+ catch (Exception ex)
+ {
+ setLabel(-1);
+ ex.printStackTrace();
+ }
+
+
+ if (success)
+ {
+ setLabel(STATUS_OK);
+ setEnabled(btnDir, true);
+ setEnabled(btnOK, true);
+ }
+
+ setEnabled(btnTestConnection, true);
+
+ }
+
+ /**
+ * To try the conenction I do some actions that
+ * seem logical to me: <br/>
+ * I get a ucb content.
+ * I list the files in this content.
+ * I call the ucb "open" command.
+ * I get the "Title" property of this content.
+ * @param acountUrl
+ * @throws Exception
+ */
+ private void connect(String acountUrl) throws Exception
+ {
+ Object content = ucb.getContent(acountUrl);
+
+ //list files in the content.
+ List l = ucb.listFiles(acountUrl, null);
+
+ //open the content
+ OpenCommandArgument2 aArg = new OpenCommandArgument2();
+ aArg.Mode = OpenMode.FOLDERS; // FOLDER, DOCUMENTS -> simple filter
+ aArg.Priority = 32768; // Ignored by most implementations
+
+ ucb.executeCommand(content, "open", aArg);
+
+ //get the title property of the content.
+ Object obj = ucb.getContentProperty(content, "Title", String.class);
+
+ }
+
+ /**
+ * changes the ftp subdirectory, in both
+ * the UI and the data.
+ * @param s the directory.
+ */
+ public void setDir(String s)
+ {
+ dir = s;
+ Helper.setUnoPropertyValue(getModel(txtDir), "Text", dir);
+ }
+
+ /**
+ * @return the ftp subdirecrtory.
+ */
+ public String getDir()
+ {
+ return dir;
+ }
+
+ /**
+ * changes the status label to disconnected status, and
+ * disables the ok and choose-dir buttons.
+ * This method is called also when the hostname, username
+ * and passwordtext fields change.
+ */
+ public void disconnect()
+ {
+ enableTestButton();
+ setEnabled(btnOK, false);
+ setEnabled(btnDir, false);
+ setLabel(STATUS_UNKONWN);
+ }
+
+ /**
+ * used for debuging.
+ * @param args
+ */
+ public static void main(String args[])
+ {
+ String ConnectStr = "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager";
+ try
+ {
+ XMultiServiceFactory xLocMSF = Desktop.connect(ConnectStr);
+ CGPublish p = new CGPublish();
+ p.cp_URL = "ftp://tv-1/Folder";
+ p.cp_Username = "ronftp";
+ p.password = "ronftp";
+
+ FTPDialog dialog = new FTPDialog(xLocMSF, p);
+ dialog.execute(null);
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace();
+ }
+ }
+
+ /**
+ * changes the status label and icon, according to the
+ * given status
+ * @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)
+ {
+ //not connected yet
+ case STATUS_UNKONWN:
+ setLabel(resources.resFTPDisconnected, ICON_UNKNOWN);
+ break;
+ //connected!
+ case STATUS_OK:
+ setLabel(resources.resFTPConnected, ICON_OK);
+ break;
+ case STATUS_USER_PWD_WRONG:
+ setLabel(resources.resFTPUserPwdWrong, ICON_ERROR);
+ break;
+ //problem resolving server name
+ case STATUS_SERVER_NOT_FOUND:
+ setLabel(resources.resFTPServerNotFound, ICON_ERROR);
+ break;
+ //rights problem
+ case STATUS_NO_RIGHTS:
+ setLabel(resources.resFTPRights, ICON_ERROR);
+ break;
+ //host unreachable (firewall?)
+ case STATUS_HOST_UNREACHABLE:
+ setLabel(resources.resFTPHostUnreachable, ICON_ERROR);
+ break;
+ case STATUS_CONNECTING:
+ setLabel(resources.resConnecting, ICON_CONNECTING);
+ break;
+ default:
+ setLabel(resources.resFTPUnknownError, ICON_ERROR);
+ }
+ }
+
+ /**
+ * changes the text of the status label and
+ * (TODO) the status image.
+ * @param label
+ * @param color
+ */
+ 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)
+ {
+ String t = imagesDirectory + s;
+ //System.out.println(t);
+ return t;
+
+ }
+
+ /**
+ * called when the user clicks
+ * the choose-dir button. ("...")
+ * Opens the pickFolder dialog.
+ * checks if the returned folder is an ftp folder.
+ * sets the textbox and the data to the new selected dir.
+ */
+ public void chooseDirectory()
+ {
+ SystemDialog sd = SystemDialog.createOfficeFolderDialog(xMSF);
+ String newUrl = sd.callFolderDialog(resources.resFTPDirectory, "", getFullUrl());
+ 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);
+ }
+ }
+ }
+
+ /**
+ * 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)
+ {
+ 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
new file mode 100644
index 000000000000..b9a5fe7548d6
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/FTPDialogResources.java
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.wizards.common.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;
+ 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);
+
+ /**
+ * 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);
+
+ restxtDir_value = "/";
+
+ }
+}
diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.java b/wizards/com/sun/star/wizards/web/IconsDialog.java
new file mode 100644
index 000000000000..6228180a75f4
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/IconsDialog.java
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 javax.swing.ListModel;
+
+import com.sun.star.awt.Size;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.ConfigSet;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.ui.ImageList;
+import com.sun.star.wizards.web.data.CGIconSet;
+
+/**
+ * @author rpiterman
+ * The dialog class for choosing an icon set.
+ * This class simulates a model, though it does not functions really as one,
+ * since it does not cast events.
+ * It also implements the ImageList.ImageRenderer interface, to handle
+ * its own objects.
+ */
+public class IconsDialog extends ImageListDialog implements ImageList.IImageRenderer, ListModel
+{
+
+ private ConfigSet set;
+ String htmlexpDirectory;
+ /**
+ * this icons filename prefixes are used to display the icons.
+ */
+ private String[] icons = new String[]
+ {
+ "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
+ {
+ 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);
+ }
+ il.setListModel(this);
+ il.setRenderer(this);
+ il.setRows(4);
+ il.setCols(8);
+ il.setImageSize(new Size(20, 20));
+ il.setShowButtons(false);
+ il.setRowSelect(true);
+ il.scaleImages = Boolean.FALSE;
+
+ showDeselectButton = true;
+ showOtherButton = false;
+
+ build();
+ }
+
+ public String getIconset()
+ {
+ if (getSelected() == null)
+ {
+ return null;
+ }
+ else
+ {
+ 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);
+ }
+
+ /**
+ * dummy
+ */
+ public synchronized void addListDataListener(javax.swing.event.ListDataListener listener)
+ {
+ }
+
+ /**
+ * dummy
+ */
+ public synchronized void removeListDataListener(javax.swing.event.ListDataListener listener)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.ListModel#getSize()
+ */
+ public int getSize()
+ {
+ return set.getSize() * icons.length;
+ }
+ /* (non-Javadoc)
+ * @see javax.swing.ListModel#getElementAt(int)
+ */
+
+ 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();
+ int iset = getIconsetNum(i);
+ int icon = getIconNum(i);
+ String[] sRetUrls = new String[2];
+ sRetUrls[0] = htmlexpDirectory + "/htmlexpo/" +
+ getIconsetPref(iset) +
+ icons[icon] +
+ getIconsetPostfix(iset);
+ sRetUrls[1] = sRetUrls[0];
+ //System.out.println(s);
+ return sRetUrls;
+ }
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.common.Renderer#render(java.lang.Object)
+ */
+
+ public String render(Object object)
+ {
+ if (object == null)
+ {
+ return "";
+ }
+ int i = ((Number) object).intValue();
+ int iset = getIconsetNum(i);
+ return getIconset(iset).cp_Name;
+ }
+
+ private int getIconsetNum(int i)
+ {
+ return i / icons.length;
+ }
+
+ private int getIconNum(int i)
+ {
+ return i % icons.length;
+ }
+
+ private String getIconsetPref(int iconset)
+ {
+ return getIconset(iconset).cp_FNPrefix;
+ }
+
+ private String getIconsetPostfix(int iconset)
+ {
+ return getIconset(iconset).cp_FNPostfix;
+ }
+
+ 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
new file mode 100644
index 000000000000..976d61222e72
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/ImageListDialog.java
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.awt.FontDescriptor;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XButton;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.IRenderer;
+import com.sun.star.wizards.ui.ImageList;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.UnoDialog2;
+import com.sun.star.wizards.ui.ImageList.Counter;
+
+/**
+ * This class is a general implementation for a
+ * dialog which displays a choice of images.
+ * The model and the renderer are
+ * still abstract in this class.
+ * To use the class one should extend it,
+ * in the constructor then set the imageList
+ * properties (member name il) like image size, grid size,
+ * model renderer aso, and then call "build".
+ * This class uses a counter renderer which
+ * gets an expression which contains %START %END %TOTAL and replaces
+ * them with the actual numbers.
+ * <BR/>
+ * two buttons: "other" and "none" which are there
+ * to enable choosing images that are not in the list and
+ * "no image" respectivley, are optional, with default to true,
+ * so dialogs which do not need those, should set the corresponding
+ * members showDeselectButton and/or showOtherButton to false.
+ * <br/>
+ * the consturctor should recieve, among others, an Array of String resources - see
+ * constructor documentation for details.
+ *
+ * @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;
+
+ 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
+ });
+ }
+
+ 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
+ });
+ }
+
+ 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 "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();
+ }
+
+ /**
+ * 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 IRenderer
+ {
+
+ 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)
+ {
+ template = aTemplate;
+ }
+
+ 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
new file mode 100644
index 000000000000..f1814f9e4cb6
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/LogTaskListener.java
@@ -0,0 +1,103 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.web;
+
+import java.io.PrintStream;
+
+import com.sun.star.wizards.ui.event.TaskEvent;
+import com.sun.star.wizards.ui.event.TaskListener;
+
+/**
+ * used for debugging.
+ * @author rpiterman
+ */
+public class LogTaskListener implements TaskListener, ErrorHandler
+{
+
+ private PrintStream out;
+
+ public LogTaskListener(PrintStream os)
+ {
+ out = os;
+ }
+
+ 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.");
+
+ }
+
+ /* (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.");
+
+ }
+
+ /* (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());
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent)
+ */
+ 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)
+ {
+ System.out.println("" + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage());
+ ex.printStackTrace();
+ return true;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/web/MANIFEST.MF b/wizards/com/sun/star/wizards/web/MANIFEST.MF
new file mode 100644
index 000000000000..1a7a0e51b83a
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/MANIFEST.MF
@@ -0,0 +1,2 @@
+RegistrationClassName: com.sun.star.wizards.web.CallWizard
+UNO-Type-Path:
diff --git a/wizards/com/sun/star/wizards/web/Process.java b/wizards/com/sun/star/wizards/web/Process.java
new file mode 100644
index 000000000000..d1ae8e23763e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/Process.java
@@ -0,0 +1,844 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Document;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.ConfigSet;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.UCB;
+import com.sun.star.wizards.ui.event.Task;
+import com.sun.star.wizards.web.data.CGContent;
+import com.sun.star.wizards.web.data.CGDocument;
+import com.sun.star.wizards.web.data.CGExporter;
+import com.sun.star.wizards.web.data.CGLayout;
+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
+ * and generate a site. </br>
+ * it does the following: <br/>
+ * 1. create a temporary directory.<br/>
+ * 2. export documents to the temporary directory.<br/>
+ * 3. generate the TOC page, includes copying images from the
+ * web wizard work directory and other layout files.<br/>
+ * 4. publish, or copy, from the temporary directory to
+ * different destinations.<br/>
+ * 5. delete the temporary directory.<br/>
+ * <br/>
+ * to follow up the status/errors it uses a TaskListener object,
+ * and an ErrorHandler. <br/>
+ * in practice, the TaskListener is the status dialog,
+ * and the Errorhandler does the interaction with the user,
+ * if something goes wrong.<br/>
+ * Note that this class takes it in count that
+ * the given session object is prepared for it -
+ * all preparations are done in WWD_Events.finishWizard methods.
+ * <br/>
+ * <br/>
+ *
+ * note on error handling: <br/>
+ * on "catch" clauses I tries to decide whether the
+ * exception is fatal or not. For fatal exception an error message
+ * is displayed (or rather: the errorHandler is being called...)
+ * and a false is returned.
+ * In less-fatal errors, the errorHandler "should decide" which means,
+ * 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
+{
+
+ 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
+ {
+ this.xmsf = xmsf;
+ this.settings = settings;
+ fileAccess = new FileAccess(xmsf);
+ errorHandler = er;
+
+ ucb = new UCB(xmsf);
+
+ int taskSteps = getTaskSteps();
+ myTask = new Task(TASK, TASK_PREPARE, taskSteps);
+
+ }
+
+ /**
+ * @return to how many destinations should the
+ * generated site be published.
+ */
+ 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)
+ {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ /**
+ * @return the number of task steps that this
+ * session should have
+ */
+ private int getTaskSteps()
+ {
+ int docs = settings.cp_DefaultSession.cp_Content.cp_Documents.getSize();
+ int xsl = 0;
+ try
+ {
+ xsl = settings.cp_DefaultSession.getLayout().getTemplates(xmsf).size();
+ }
+ 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_FINISHUP;
+ return taskSteps;
+ }
+
+ /**
+ * does the job
+ */
+ public void runProcess()
+ {
+ myTask.start();
+ 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);
+
+ }
+ finally
+ {
+ //cleanup must be called.
+ result = result & cleanup(myTask);
+ }
+ }
+ catch (Exception ex)
+ {
+ result = false;
+ }
+
+ if (!result)
+ {
+ myTask.fail(); //this is a bug protection.
+ }
+ while (myTask.getStatus() < myTask.getMax())
+ {
+ myTask.advance(true);
+ }
+ }
+
+ /**
+ * creates a temporary directory.
+ * @param task
+ * @return true should continue
+ */
+ private boolean createTempDir(Task task)
+ {
+
+ tempDir = fileAccess.createNewDir(getSOTempDir(xmsf), "wwiztemp");
+ if (tempDir == null)
+ {
+ error(null, null, ERROR_MKDIR, ErrorHandler.ERROR_PROCESS_FATAL);
+ return false;
+ }
+ else
+ {
+ task.advance(true);
+ return true;
+ }
+ }
+
+ /**
+ * @param xmsf
+ * @return the staroffice /openoffice temporary directory
+ */
+ static String getSOTempDir(XMultiServiceFactory xmsf)
+ {
+ try
+ {
+ String s = FileAccess.getOfficePath(xmsf, "Temp", "", "");
+ return s;
+ }
+ catch (Exception e)
+ {
+ }
+ return null;
+ }
+
+ // CLEANUP
+ /**
+ * delete the temporary directory
+ * @return true should continue
+ */
+ private boolean cleanup(Task task)
+ {
+
+ task.setSubtaskName(TASK_FINISH);
+ boolean b = fileAccess.delete(tempDir);
+ if (!b)
+ {
+ error(null, null, ERROR_CLEANUP, ErrorHandler.ERROR_WARNING);
+ }
+ task.advance(b);
+ return b;
+ }
+
+// /**
+// * deletes the given directory
+// * @param dir the directory to delete
+// * @return true if should continue
+// */
+// private boolean cleanup(String dir) {
+//
+// boolean success = true;
+//
+// if (dir != null && fileAccess.exists(dir,false)) {
+//
+// String[] files = fileAccess.listFiles(dir,true);
+//
+// for (int i = 0; i < files.length; i++) {
+// if (fileAccess.isDirectory(files[i]))
+// success = success && cleanup(files[i]);
+// else
+// success = success && fileAccess.delete(files[i]);
+//
+// }
+// }
+// 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
+ {
+
+ //1. .css
+ String sourceDir = FileAccess.connectURLs(settings.workPath, "styles");
+ String filename = settings.cp_DefaultSession.getStyle().cp_CssHref;
+ 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(""))
+ {
+ sourceDir = FileAccess.getParentDir(background);
+ filename = background.substring(sourceDir.length());
+ copy.copy(sourceDir, filename, targetDir + "/images", "background.gif");
+ }
+
+ task.advance(true);
+ }
+
+ /**
+ * Copy "static" files (which are always the same,
+ * thus not user-input-dependant) to a target directory.
+ * Note that this method is static since it is
+ * also used when displaying a "preview"
+ * @param copy
+ * @param settings
+ * @param targetDir
+ * @throws Exception
+ */
+ public static void copyStaticImages(UCB copy, CGSettings settings, String targetDir)
+ throws Exception
+ {
+ 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)
+ {
+ task.setSubtaskName(TASK_PUBLISH_PREPARE);
+ ConfigSet set = settings.cp_DefaultSession.cp_Publishing;
+ try
+ {
+
+ copyMedia(ucb, settings, dir, task);
+ copyStaticImages(ucb, settings, dir);
+ task.advance(true);
+ }
+ catch (Exception ex)
+ {
+ //error in copying media
+ error(ex, "", ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL);
+ return false;
+ }
+
+ boolean result = true;
+
+ for (int i = 0; i < set.getSize(); i++)
+ {
+
+ CGPublish p = (CGPublish) set.getElementAt(i);
+
+ if (p.cp_Publish)
+ {
+
+ 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))
+ {
+ return false;
+ }
+
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * publish the given directory to the
+ * given target CGPublish.
+ * @param dir the dir to copy from
+ * @param publish the object that specifies the target
+ * @param copy ucb encapsulation
+ * @param task task tracking
+ * @return true if should continue
+ */
+ private boolean publish(String dir, CGPublish publish, UCB copy, Task task)
+ {
+ try
+ {
+ //copy.deleteDirContent(publish.url);
+ task.advance(true);
+ copy.copy(dir, publish.url);
+ task.advance(true);
+ return true;
+ }
+ catch (Exception e)
+ {
+ task.advance(false);
+ 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)
+ {
+ boolean result = false;
+ task.setSubtaskName(TASK_GENERATE_PREPARE);
+
+
+ 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);
+
+ }
+ 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
+ {
+
+ task.setSubtaskName(TASK_GENERATE_COPY);
+
+ copyLayoutFiles(ucb, fileAccess, settings, layout, targetDir);
+
+ task.advance(true);
+
+ result = true;
+ }
+ catch (Exception ex)
+ {
+ task.advance(false);
+ return error(ex, null, ERROR_GENERATE_COPY, ErrorHandler.ERROR_NORMAL_ABORT);
+ }
+
+
+
+ return result;
+
+ }
+
+ /**
+ * copies layout files which are not .xsl files
+ * to the target directory.
+ * @param ucb UCB encapsulatzion object
+ * @param fileAccess filaAccess encapsulation object
+ * @param settings web wizard settings
+ * @param layout the layout object
+ * @param targetDir the target directory to copy to
+ * @throws Exception
+ */
+ public static void copyLayoutFiles(UCB ucb, FileAccess fileAccess, CGSettings settings, CGLayout layout, String targetDir)
+ throws Exception
+ {
+ String filesPath = fileAccess.getURL(
+ FileAccess.connectURLs(settings.workPath, "layouts/"), layout.cp_FSName);
+ ucb.copy(filesPath, targetDir, new ExtensionVerifier("xsl"));
+
+ }
+
+ /**
+ * generates the TOC page for the given layout.
+ * This method might generate more than one file, depending
+ * on how many .xsl files are in the
+ * directory specifies by the given layout object.
+ * @param xmsf
+ * @param layout specifies the layout to use.
+ * @param doc the DOM representation of the web wizard session
+ * @param fileAccess encapsulation of FileAccess
+ * @param targetPath target directory
+ * @param task
+ * @throws Exception
+ */
+ public static void generate(
+ 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);
+
+ /*
+ * each template generates a page.
+ */
+ for (Iterator i = templates.keySet().iterator(); i.hasNext();)
+ {
+
+ String key = "";
+
+ key = (String) i.next();
+
+ Transformer transformer = ((Templates) templates.get(key)).newTransformer();
+
+ doc.normalize();
+ task.advance(true);
+
+ /*
+ * 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));
+ File f = new File(fn);
+ FileOutputStream oStream = new FileOutputStream(f);
+ // Due to a problem occuring when using Xalan-Java 2.6.0 and
+ // Java 1.5.0, wrap f in a FileOutputStream here (otherwise, the
+ // StreamResult's getSystemId would return a "file:/..." URL while
+ // the Xalan code expects a "file:///..." URL):
+ transformer.transform(
+ 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.
+ * I left it that way, because it may be used in the future.
+ * @param task
+ * @return
+ */
+ private boolean export(Task task)
+ {
+
+ return export(settings.cp_DefaultSession.cp_Content, tempDir, task);
+
+ }
+
+ /**
+ * This method could actually, with light modification, use recursion.
+ * In the present situation, where we only use a "flat" list of
+ * documents, instead of the original plan to use a tree,
+ * the recursion is not implemented.
+ * @param content the content ( directory-like, contains documents)
+ * @param dir (target directory for exporting this content.
+ * @param task
+ * @return true if should continue
+ */
+ private boolean export(CGContent content, String dir, Task task)
+ {
+ int toPerform = 1;
+ String contentDir = dir;
+
+ try
+ {
+
+ task.setSubtaskName(TASK_EXPORT_PREPARE);
+
+ /* 1. create a content directory.
+ * each content (at the moment there is only one :-( )
+ * is created in its own directory.
+ * faileure here is fatal.
+ */
+ 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);
+ 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
+ {
+ 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))
+ {
+ return false;
+ }
+ }
+ catch (SecurityException sx)
+ {
+ // nonfatal
+ if (!error(sx, item, ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE))
+ {
+ return false;
+ }
+ result = false;
+ }
+ }
+ }
+ catch (IOException iox)
+ {
+ //nonfatal
+ return error(iox, content, ERROR_EXPORT_IO, ErrorHandler.ERROR_NORMAL_IGNORE);
+
+ }
+ catch (SecurityException se)
+ {
+ //nonfatal
+ return error(se, content, ERROR_EXPORT_SECURITY, ErrorHandler.ERROR_NORMAL_IGNORE);
+ }
+ failTask(task, toPerform);
+ return true;
+
+ }
+
+ /**
+ * exports a single document
+ * @param doc the document to export
+ * @param dir the target directory
+ * @param task task tracking
+ * @return true if should continue
+ */
+ 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;
+ }
+ //get the exporter specified for this document
+ }
+ CGExporter exporter = (CGExporter) settings.cp_Exporters.getElement(doc.cp_Exporter);
+
+
+ try
+ {
+
+ /*
+ * here I calculate the destination filename.
+ * I take the original filename (docFilename), substract the extension, (docExt) -> (fn)
+ * and find an available filename which starts with
+ * this filename, but with the new extension. (destExt)
+ */
+ 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
+
+ /*
+ * the copyExporter does not change
+ * the extension of the target...
+ */
+ 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 two files with the same name
+ * need to be exported ? So here
+ * i get a new filename, so I do not
+ * overwrite files...
+ */
+ String file = fileAccess.getNewFile(dir, fn, destExt);
+
+
+ /* set filename with extension.
+ * this will be used by the exporter,
+ * and to generate the TOC.
+ */
+ doc.urlFilename = FileAccess.getFilename(file);
+
+ task.advance(true);
+
+ try
+ {
+ //export
+ getExporter(exporter).export(doc, file, xmsf, task);
+ task.advance(true);
+ }
+ /*
+ * getExporter(..) throws
+ * IllegalAccessException, InstantiationException, ClassNotFoundException
+ * export() throws Exception
+ */
+ catch (Exception ex)
+ {
+ //nonfatal
+ if (!error(ex, doc, ERROR_EXPORT, ErrorHandler.ERROR_NORMAL_IGNORE))
+ {
+ return false;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ //nonfatal
+ if (!error(ex, doc, ERROR_EXPORT_MKDIR, ErrorHandler.ERROR_NORMAL_ABORT))
+ {
+ return false;
+ }
+ }
+
+ return true;
+
+ }
+
+ /**
+ * submit an error.
+ * @param ex the exception
+ * @param arg1 error argument
+ * @param arg2 error argument 2
+ * @param errType error type
+ * @return the interaction result
+ */
+ private boolean error(Exception ex, Object arg1, int arg2, int errType)
+ {
+ result = false;
+ 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)
+ {
+ while (count-- > 0)
+ {
+ task.advance(false);
+ }
+ }
+
+ /**
+ * creates an instance of the exporter class
+ * as specified by the
+ * exporter object.
+ * @param export specifies the exporter to be created
+ * @return the Exporter instance
+ * @throws ClassNotFoundException
+ * @throws IllegalAccessException
+ * @throws InstantiationException
+ */
+ private Exporter createExporter(CGExporter export)
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException
+ {
+ Exporter e = (Exporter) Class.forName(export.cp_ExporterClass).newInstance();
+ e.init(export);
+ return e;
+ }
+
+ /**
+ * searches the an exporter for the given CGExporter object
+ * in the cache.
+ * If its not there, creates it, stores it in the cache and
+ * returns it.
+ * @param export specifies the needed exporter.
+ * @return an Exporter instance
+ * @throws ClassNotFoundException thrown when using Class.forName(string)
+ * @throws IllegalAccessException thrown when using Class.forName(string)
+ * @throws InstantiationException thrown when using Class.forName(string)
+ */
+ private Exporter getExporter(CGExporter export)
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException
+ {
+ Exporter exp = (Exporter) exporters.get(export);
+ if (exp == null)
+ {
+ exp = createExporter(export);
+ exporters.put(export, exp);
+ }
+ return exp;
+ }
+
+ /**
+ * @return tru if everything went smooth, false
+ * if error(s) accured.
+ */
+ 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
new file mode 100644
index 000000000000..96106986515c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/ProcessErrorHandler.java
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.awt.XWindowPeer;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.web.data.CGDocument;
+import com.sun.star.wizards.web.data.CGPublish;
+
+/**
+ * @author rpiterman
+ * used to interact error accuring when generating the
+ * web-site to the user.
+ * This class renders the different errors,
+ * replaceing some strings from the resources with
+ * content of the given arguments, depending on the error
+ * that accured.
+ */
+public class ProcessErrorHandler extends AbstractErrorHandler
+ implements WebWizardConst,
+ ProcessErrors
+{
+
+ 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)
+ {
+ super(xmsf, peer);
+ resources = res;
+ }
+
+ protected String getMessageFor(Exception ex, Object obj, int ix, int errType)
+ {
+
+ switch (ix)
+ {
+
+ case ERROR_MKDIR:
+ return JavaTools.replaceSubString(resources.resErrDocExport, ((CGDocument) obj).localFilename, FILENAME);
+ case ERROR_EXPORT_MKDIR:
+ return JavaTools.replaceSubString(resources.resErrMkDir, ((CGDocument) obj).localFilename, FILENAME);
+ case ERROR_DOC_VALIDATE:
+ return JavaTools.replaceSubString(resources.resErrDocInfo, ((CGDocument) obj).localFilename, FILENAME);
+ case ERROR_EXPORT_IO:
+ return JavaTools.replaceSubString(resources.resErrExportIO, ((CGDocument) obj).localFilename, FILENAME);
+ case ERROR_EXPORT_SECURITY:
+ return JavaTools.replaceSubString(resources.resErrSecurity, ((CGDocument) obj).localFilename, FILENAME);
+ case ERROR_GENERATE_XSLT:
+ return resources.resErrTOC;
+ case ERROR_GENERATE_COPY:
+ return resources.resErrTOCMedia;
+ case ERROR_PUBLISH:
+ return JavaTools.replaceSubString(resources.resErrPublish, ((CGPublish) obj).cp_URL, URL);
+ case ERROR_EXPORT:
+ case ERROR_PUBLISH_MEDIA:
+ return resources.resErrPublishMedia;
+ case ERROR_CLEANUP:
+ return resources.resErrUnexpected;
+
+ 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
new file mode 100644
index 000000000000..ca6da968654f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/ProcessErrors.java
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+/**
+ * @author rpiterman
+ * Error IDs for errors that can accure
+ * in the interaction with the Process class.
+ */
+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
new file mode 100644
index 000000000000..3fa3726f2e8f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/ProcessStatusRenderer.java
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 java.util.Hashtable;
+import java.util.Map;
+
+import com.sun.star.wizards.common.IRenderer;
+
+/**
+ * @author rpiterman
+ * recieves status calls from the status dialog which
+ * apears when the user clicks "create".
+ * allocates strings from the resources to
+ * display the current task status.
+ * (renders the state to resource strings)
+ */
+public class ProcessStatusRenderer implements IRenderer, 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);
+ //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(TASK_PUBLISH_PREPARE, res.resTaskPublishPrepare);
+ strings.put(TASK_FINISH, res.resTaskFinish);
+ }
+
+ 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
new file mode 100644
index 000000000000..ab1e7a0b6bc7
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/StatusDialog.java
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.awt.XButton;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XProgressBar;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.IRenderer;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.UnoDialog2;
+import com.sun.star.wizards.ui.event.MethodInvocation;
+import com.sun.star.wizards.ui.event.Task;
+import com.sun.star.wizards.ui.event.TaskEvent;
+import com.sun.star.wizards.ui.event.TaskListener;
+
+/**
+ * @author rpiterman
+ * A Class which displays a Status Dialog with status bars.
+ * This can display an X number of bars, to enable the
+ * status display of more complex tasks.
+ *
+ */
+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 IRenderer renderer;
+ private boolean enableBreak = false;
+ private boolean closeOnFinish = true;
+ private MethodInvocation finishedMethod;
+ private UnoDialog parent;
+ private boolean finished;
+
+ /**
+ * Note on the argument resource:
+ * This should be a String array containing the followin strings, in the
+ * 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)
+ {
+ 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?
+ // 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)
+ });
+
+ 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)
+ });
+ 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)
+ });
+ 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)
+ });
+ }
+
+// xWindow.addWindowListener((XWindowListener)guiEventListener);
+// guiEventListener.add("StatusDialog" ,EVENT_WINDOW_SHOWN, "performRunnable",this);
+
+ }
+
+ private void initProgressBar(Task t)
+ {
+ progressBar.setRange(0, t.getMax());
+ progressBar.setValue(0);
+ }
+
+ private void setStatus(int status)
+ {
+ if (finished)
+ {
+ return;
+ }
+ progressBar.setValue(status);
+ xReschedule.reschedule();
+ }
+
+ public void setLabel(String s)
+ {
+// lblTaskName.setText(s);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lblTaskName), "Label", s);
+ xReschedule.reschedule();
+ }
+
+ /**
+ * 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));
+ }
+
+ /**
+ * initialize the status bar according
+ * to the given event.
+ */
+ public void taskStarted(TaskEvent te)
+ {
+ finished = false;
+ initProgressBar(te.getTask());
+ }
+
+ /**
+ * closes the dialog.
+ */
+ public void taskFinished(TaskEvent te)
+ {
+ finished = true;
+ if (closeOnFinish)
+ {
+// xDialog.endExecute();
+ parent.xWindow.setEnable(true);
+ try
+ {
+ xWindow.setVisible(false);
+ xComponent.dispose();
+ //System.out.println("disposed");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ else
+ {
+ Helper.setUnoPropertyValue(getModel(btnCancel), "Label", res[2]);
+ }
+ }
+
+ /**
+ * changes the status display
+ */
+ public void taskStatusChanged(TaskEvent te)
+ {
+ setMax(te.getTask().getMax());
+ setStatus(te.getTask().getStatus());
+ }
+
+ /**
+ * changes the displayed text.
+ * A renderer is used to render
+ * the task's subtask name to a resource string.
+ */
+ public void subtaskNameChanged(TaskEvent te)
+ {
+ if (renderer != null)
+ {
+ setLabel(renderer.render(te.getTask().getSubtaskName()));
+ }
+ }
+
+ /**
+ * displays the status dialog
+ * @param parent the parent dialog
+ * @param r what to do
+ */
+ public void execute(final UnoDialog parent_, final Task task, String title)
+ {
+ try
+ {
+ this.parent = parent_;
+ Helper.setUnoPropertyValue(this.xDialogModel, "Title", title);
+ try
+ {
+ //TODO change this to another execute dialog method.
+ task.addTaskListener(StatusDialog.this);
+ setMax(10);
+ setStatus(0);
+ setLabel(task.getSubtaskName());
+ parent.xWindow.setEnable(false);
+ setVisible(parent);
+ if (finishedMethod != null)
+ {
+ finishedMethod.invoke();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * not supported !
+ */
+ public void performCancel()
+ {//TODO - implement a thread thing here...
+ xWindow.setVisible(false);
+ }
+
+ /**
+ * @return the subTask renderer object
+ */
+ public IRenderer getRenderer()
+ {
+ return renderer;
+ }
+
+ /**
+ * @param renderer
+ */
+ public void setRenderer(IRenderer renderer)
+ {
+ this.renderer = renderer;
+ }
+
+ /**
+ * sets a method to be invoced when the
+ *
+ */
+ 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
new file mode 100644
index 000000000000..93507929d84b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/StylePreview.java
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.web.data.CGStyle;
+
+/**
+ * @author rpiterman
+ * the style preview, which is a OOo Document Preview in
+ * an Image Control.
+ * This class copies the files needed for this
+ * preview from the web wizard work directory
+ * to a given temporary directory, and updates them
+ * on request, according to the current style/background selection
+ * of the user.
+ */
+public class StylePreview
+{
+
+ private FileAccess fileAccess;
+ /**
+ * the destination html url.
+ */
+ public String htmlFilename;
+ /**
+ * the destination css url
+ */
+ private String cssFilename;
+ /**
+ * destination directory
+ */
+ public String tempDir;
+ /**
+ * destination background file url
+ */
+ private String backgroundFilename;
+ /**
+ * web wizard work directory
+ */
+ 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
+ {
+ 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");
+
+ wwRoot = wwRoot_;
+
+ fileAccess.copy(FileAccess.connectURLs(wwRoot, "preview.html"), htmlFilename);
+ }
+
+ /**
+ * copies the given style and background files to the temporary
+ * directory.
+ * @param style
+ * @param background
+ * @throws Exception
+ */
+ public void refresh(CGStyle style, String background) throws Exception
+ {
+
+ String css = FileAccess.connectURLs(wwRoot, "styles/" + style.cp_CssHref);
+
+ if (background == null || background.equals(""))
+ {
+ //delete the background image
+ if (fileAccess.exists(backgroundFilename, false))
+ {
+ fileAccess.delete(backgroundFilename);
+ }
+ }
+ else
+ {
+ // a solaris bug workaround
+ // TODO
+ //copy the background image to the temp directory.
+ fileAccess.copy(background, backgroundFilename);
+ }
+ //copy the actual css to the temp directory
+ fileAccess.copy(css, cssFilename);
+ }
+
+ public void cleanup()
+ {
+ try
+ {
+ removeTempDir();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * creates a temporary directory.
+ * @param xmsf
+ * @return the url of the new directory.
+ * @throws Exception
+ */
+ private String createTempDir(XMultiServiceFactory xmsf) throws Exception
+ {
+ String tempPath = FileAccess.getOfficePath(xmsf, "Temp", "", "");
+ String s = fileAccess.createNewDir(tempPath, "wwiz");
+ fileAccess.createNewDir(s, "images");
+ return s;
+ }
+
+ /**
+ * deletes/removes the temporary directroy.
+ * @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
new file mode 100644
index 000000000000..1fb70a11d4b5
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/TOCPreview.java
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 org.w3c.dom.Document;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XFrame;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.util.URL;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.UCB;
+import com.sun.star.wizards.ui.event.Task;
+import com.sun.star.wizards.web.data.CGLayout;
+import com.sun.star.wizards.web.data.CGSettings;
+
+/**
+ * @author rpiterman
+ * This class both copies necessary files to
+ * a temporary directory, generates a temporary TOC page,
+ * and opens the generated html document in a web browser,
+ * by default "index.html" (unchangeable).
+ * <br/>
+ * Since the files are both static and dynamic (some are always the same,
+ * while other change according to user choices)
+ * I divide this tasks to two: all necessary
+ * static files, which should not regularily update are copied upon
+ * instanciation.
+ * The TOC is generated in refresh(...);
+ */
+public class TOCPreview
+{
+
+ private String tempDir = null;
+ private XMultiServiceFactory xmsf;
+ private FileAccess fileAccess;
+ private WebWizardDialogResources resources;
+ private URL openHyperlink;
+ private XDispatch xDispatch;
+ private PropertyValue[] loadArgs;
+ private UCB ucb;
+ private XFrame xFrame;
+
+ /**
+ * @param xmsf_
+ * @param settings web wizard settings
+ * @param res resources
+ * @param tempDir_ destination
+ * @throws Exception
+ */
+ public TOCPreview(XMultiServiceFactory xmsf_, CGSettings settings, WebWizardDialogResources res, String tempDir_, XFrame _xFrame)
+ throws Exception
+ {
+ xFrame = _xFrame;
+ xmsf = xmsf_;
+ resources = res;
+ fileAccess = new FileAccess(xmsf);
+ tempDir = tempDir_;
+ 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);
+ }
+
+ /**
+ * generates a TOC, copies the layout-specific files, and
+ * calles a browser to show "index.html".
+ * @param settings
+ * @throws Exception
+ */
+ public void refresh(CGSettings settings)
+ throws Exception
+ {
+ 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);
+ xDispatch.dispatch(openHyperlink, loadArgs); //Dispatch.dispatch(openHyperlink, loadArgs);
+ }
+
+ private PropertyValue[] loadArgs(String url)
+ {
+ PropertyValue pv = new PropertyValue();
+ pv.Name = "URL";
+ pv.Value = url;
+ 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
new file mode 100644
index 000000000000..e3927f188460
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.java
@@ -0,0 +1,1305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 javax.swing.ListModel;
+
+import com.sun.star.awt.KeyEvent;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XKeyListener;
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XCloseable;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.ui.UnoDialog;
+import com.sun.star.wizards.ui.event.DataAware;
+import com.sun.star.wizards.ui.event.ListModelBinder;
+import com.sun.star.wizards.ui.event.Task;
+import com.sun.star.wizards.web.data.CGDocument;
+import com.sun.star.wizards.web.data.CGPublish;
+import com.sun.star.wizards.web.data.CGSession;
+import com.sun.star.wizards.web.data.CGSessionName;
+
+/**
+ * This class implements the ui-events of the
+ * web wizard.
+ * it is therfore sorted to steps.
+ * not much application-logic here - just plain
+ * methods which react to events.
+ * The only exception are the finish methods with the save
+ * session methods.
+ */
+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)
+ * If a session is loaded, this will be the name of the loaded session.
+ */
+ protected String currentSession = "";
+
+ /**
+ * He - my constructor !
+ * I add a window listener, which, when
+ * the window closes, deltes the temp directory.
+ */
+ public WWD_Events(XMultiServiceFactory xmsf) throws Exception
+ {
+ super(xmsf);
+ Create c = new Create();
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkFTP);
+ xWindow.addKeyListener(c);
+ xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkLocalDir);
+ xWindow.addKeyListener(c);
+ xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkZip);
+ xWindow.addKeyListener(c);
+ }
+
+ /* *********************************************************
+ * *******************************************************
+ * EVENT and UI METHODS
+ * *******************************************************
+ * *********************************************************/
+ 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))
+ {
+ String sessionToLoad = "";
+ short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems");
+ if (s.length == 0 || s[0] == 0)
+ {
+ sessionToLoad = "";
+ }
+ else
+ {
+ sessionToLoad = ((CGSessionName) settings.cp_SavedSessions.getElementAt(s[0])).cp_Name;
+ }
+ if (!sessionToLoad.equals(currentSession))
+ {
+ loadSession(sessionToLoad);
+ }
+ }
+ if (newStep == 5)
+ {
+ }
+ }
+
+ /* *********************************
+ * STEP 1
+ */
+ /**
+ * Called from the Uno event dispatcher when the
+ * user selects a saved session.
+ */
+ public void sessionSelected()
+ {
+ short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems");
+ setEnabled(btnDelSession, s.length > 0 && s[0] > 0);
+ }
+
+ /**
+ * Ha ! the session should be loaded :-)
+ */
+ public void loadSession(final String sessionToLoad)
+ {
+ try
+ {
+ final StatusDialog sd = getStatusDialog();
+
+ final Task task = new Task("LoadDocs", "", 10);
+
+ sd.execute(this, task, resources.resLoadingSession);
+ task.start();
+
+ setSelectedDoc(EMPTY_SHORT_ARRAY);
+ Helper.setUnoPropertyValue(getModel(lstDocuments), "SelectedItems", EMPTY_SHORT_ARRAY);
+ Helper.setUnoPropertyValue(getModel(lstDocuments), "StringItemList", EMPTY_STRING_ARRAY);
+
+ Object view = null;
+
+ 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);
+ }
+
+ 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(""))
+ {
+ setSaveSessionName(session);
+ }
+ mount(session, task, false, sd.xControl);
+
+ checkSteps();
+ currentSession = sessionToLoad;
+
+ while (task.getStatus() <= task.getMax())
+ {
+ task.advance(false);
+ }
+ task.removeTaskListener(sd);
+ }
+ catch (Exception ex)
+ {
+ unexpectedError(ex);
+ }
+
+ try
+ {
+ refreshStylePreview();
+ updateIconsetText();
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * hmm. the user clicked the delete button.
+ */
+ 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
+ {
+ String name = (String) settings.cp_SavedSessions.getKey(selected[0]);
+ // first delete the session from the registry/configuration.
+
+ Configuration.removeNode(xMSF, CONFIG_PATH + "/SavedSessions", name);
+
+ // then delete the session from the java-set (settings.cp_SavedSessions)
+ settings.cp_SavedSessions.remove(selected[0]);
+ settings.savedSessions.remove(selected[0] - 1);
+
+ 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...
+ }
+ if (nextSelected[0] == 0)
+ {
+ Helper.setUnoPropertyValue(getModel(btnDelSession), "Enabled", Boolean.FALSE); // select...
+ }
+ Helper.setUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems", nextSelected);
+
+ //ListModelBinder.fillComboBox(cbSaveSettings, settings.savedSessions.items(), null);
+
+
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ unexpectedError(ex);
+ }
+ }
+ }
+
+ /* ********************************
+ * 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()
+ {
+ return selectedDoc;
+ }
+ private static String[] EMPTY_STRING_ARRAY = new String[0];
+
+ /* public void loadSessionSelected() {
+ UIHelper.setEnabled(btnLoadSession,true);
+ UIHelper.setEnabled(btnDelSession,true);
+ }
+ */
+ /**
+ * when the user clicks another document
+ * in the listbox, this method is called,
+ * and couses the display in
+ * the textboxes title,description, author and export format
+ * to change
+ */
+ 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
+
+ selectedDoc = s;
+
+ mount(doc, docAware);
+ 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()
+ {
+
+ final String[] files = getDocAddDialog().callOpenDialog(true, settings.cp_DefaultSession.cp_InDirectory);
+ if (files == null)
+ {
+ return;
+ }
+ final Task task = new Task("", "", files.length * 5);
+
+ /*
+ * If more than a certain number
+ * of documents have been added,
+ * open the status 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);
+ oLoadDocs.loadDocuments();
+ task.removeTaskListener(sd);
+ }
+ /*
+ * When adding a single document, do not use a
+ * status dialog...
+ */
+ else
+ {
+ LoadDocs oLoadDocs = new LoadDocs(this.xControl, files, task);
+ oLoadDocs.loadDocuments();
+ }
+
+ }
+
+ /**
+ * The user clicked delete.
+ */
+ 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...
+ }
+ if (selectedDoc[0] == -1)
+ {
+ 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()
+ {
+ 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);
+ docListDA.updateUI();
+ disableDocUpDown();
+ }
+
+ /**
+ * doc down
+ */
+ 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);
+ docListDA.updateUI();
+ disableDocUpDown();
+ }
+
+ /* ******************************
+ * 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);
+ if (i == 1) //ok
+ {
+ setBackground(bgDialog.getSelected());
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ finally
+ {
+ setEnabled(btnBackgrounds, true);
+ }
+ }
+
+ /**
+ * invoked when the BackgorundsDialog is "OKed".
+ */
+ 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());
+ }
+
+ 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);
+ }
+ }
+
+ /**
+ * 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)
+ {
+ if (url == null)
+ {
+ return null;
+ }
+ CGPublish p = getPublisher(publisher);
+ p.cp_URL = url;
+ p.cp_Publish = true;
+ updatePublishUI(number);
+ p.overwriteApproved = true;
+ return p;
+ }
+
+ /**
+ * updates the ui of a certain publisher
+ * (the text box url)
+ * @param number
+ */
+ private void updatePublishUI(int number)
+ {
+ ((DataAware) pubAware.get(number)).updateUI();
+ ((DataAware) pubAware.get(number + 1)).updateUI();
+ checkPublish();
+ }
+
+ /**
+ * The user clicks the local "..." button.
+ *
+ */
+ public void setPublishLocalDir()
+ {
+ String dir = showFolderDialog("Local destination directory", "", settings.cp_DefaultSession.cp_OutDirectory);
+ //if ok was pressed...
+ setPublishUrl(LOCAL_PUBLISHER, dir, 0);
+
+ }
+
+ /**
+ * The user clicks the "Configure" FTP button.
+ *
+ */
+ public void setFTPPublish()
+ {
+ if (showFTPDialog(getPublisher(FTP_PUBLISHER)))
+ {
+ getPublisher(FTP_PUBLISHER).cp_Publish = true;
+ updatePublishUI(2);
+ }
+ }
+
+ /**
+ * show the ftp dialog
+ * @param pub
+ * @return true if OK was pressed, otherwise false.
+ */
+ private boolean showFTPDialog(CGPublish pub)
+ {
+ try
+ {
+ return getFTPDialog(pub).execute(this) == 1;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return false;
+ }
+ }
+
+ /**
+ * the user clicks the zip "..." button.
+ * Choose a zip file...
+ */
+ 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
+ {
+ if (docPreview == null)
+ {
+ docPreview = new TOCPreview(xMSF, settings, resources, stylePreview.tempDir, myFrame);
+ }
+ docPreview.refresh(settings);
+ }
+ catch (Exception ex)
+ {
+ unexpectedError(ex);
+ }
+ }
+
+ /* **********************
+ * FINISH
+ */
+ /**
+ * This method checks if the given target's path, added the pathExtension argument,
+ * exists, and asks the user what to do about it.
+ * If the user says its all fine, then the target will
+ * be replaced.
+ * @return true if "create" should continue. false if "create" should abort.
+ */
+ private boolean publishTargetApproved()
+ {
+ boolean result = true;
+ // 1. check local publish target
+
+ CGPublish p = getPublisher(LOCAL_PUBLISHER);
+
+ // should publish ?
+ if (p.cp_Publish)
+ {
+ String path = getFileAccess().getPath(p.url, null);
+ // target exists?
+ if (getFileAccess().exists(p.url, false))
+ {
+ //if its a directory
+ 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(
+ xMSF, xControl.getPeer(), message,
+ ErrorHandler.MESSAGE_WARNING, ErrorHandler.BUTTONS_YES_NO,
+ ErrorHandler.DEF_NO, ErrorHandler.RESULT_YES);
+
+ if (!result)
+ {
+ return result;
+ }
+ }
+ }
+ 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);
+ return false;
+ }
+
+ // try to write to the path...
+ }
+ else
+ {
+ // the local target directory does not exist.
+ String message = JavaTools.replaceSubString(resources.resLocalTargetCreate,
+ path, "%FILENAME");
+ try
+ {
+ result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
+ ErrorHandler.ERROR_QUESTION_YES);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ if (!result)
+ {
+ return result;
+ // try to create the directory...
+ }
+ try
+ {
+ getFileAccess().fileAccess.createFolder(p.cp_URL);
+ }
+ catch (Exception ex)
+ {
+ message = JavaTools.replaceSubString(resources.resLocalTargetCouldNotCreate,
+ path, "%FILENAME");
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
+ ErrorHandler.ERROR_PROCESS_FATAL);
+ return false;
+ }
+ }
+ }
+
+ // 2. Check ZIP
+ // should publish ?
+ p = getPublisher(ZIP_PUBLISHER);
+
+ if (p.cp_Publish)
+ {
+
+ String path = getFileAccess().getPath(p.cp_URL, null);
+ // target exists?
+ if (getFileAccess().exists(p.cp_URL, false))
+ {
+ //if its a directory
+ 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)
+ {
+ String message = JavaTools.replaceSubString(resources.resZipTargetExists,
+ path, "%FILENAME");
+ result = AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
+ ErrorHandler.ERROR_QUESTION_YES);
+ if (!result)
+ {
+ return false;
+ }
+ }
+ }
+ }
+ }
+
+ // 3. check FTP
+ p = getPublisher(FTP_PUBLISHER);
+
+ // should publish ?
+ if (p.cp_Publish)
+ {
+
+ String path = getFileAccess().getPath(p.cp_URL, null);
+
+ // target exists?
+ if (getFileAccess().exists(p.url, false))
+ {
+ //if its a directory
+ 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,
+ path, "%FILENAME");
+ 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)
+ String message = JavaTools.replaceSubString(resources.resFTPTargetExistsAsfile,
+ path, "%FILENAME");
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
+ ErrorHandler.ERROR_PROCESS_FATAL);
+ return false;
+ }
+
+ // try to write to the path...
+ }
+ 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
+ {
+ getFileAccess().fileAccess.createFolder(p.url);
+ }
+ catch (Exception ex)
+ {
+ message = JavaTools.replaceSubString(resources.resFTPTargetCouldNotCreate,
+ path, "%FILENAME");
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(), message,
+ ErrorHandler.ERROR_PROCESS_FATAL);
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /*
+ * return false if "create" should be aborted. true if everything is fine.
+ */
+ private boolean saveSession()
+ {
+ try
+ {
+ Object node = null;
+ String name = getSessionSaveName();
+
+ //set documents index field.
+ ListModel docs = settings.cp_DefaultSession.cp_Content.cp_Documents;
+
+ for (int i = 0; i < docs.getSize(); 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
+ {
+ 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
+ }
+ }
+ Configuration.removeNode(conf, name);
+
+ }
+ catch (NoSuchElementException nsex)
+ {
+ }
+
+ settings.cp_DefaultSession.cp_Index = 0;
+ node = Configuration.addConfigNode(conf, name);
+ settings.cp_DefaultSession.cp_Name = name;
+ settings.cp_DefaultSession.writeConfiguration(node, CONFIG_READ_PARAM);
+ settings.cp_SavedSessions.reindexSet(conf, name, "Index");
+ Configuration.commit(conf);
+
+ // now I reload the sessions to actualize the list/combo boxes load/save sessions.
+ settings.cp_SavedSessions.clear();
+
+ Object confView = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/SavedSessions", false);
+ settings.cp_SavedSessions.readConfiguration(confView, CONFIG_READ_PARAM);
+
+ settings.cp_LastSavedSession = name;
+ currentSession = name;
+ // now save the name of the last saved session...
+
+ settings.cp_LastSavedSession = name;
+
+ // TODO add the <none> session...
+ prepareSessionLists();
+ 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)
+ {
+ ex.printStackTrace();
+ return false;
+ }
+ }
+
+ private String targetStringFor(String publisher)
+ {
+ CGPublish p = getPublisher(publisher);
+ if (p.cp_Publish)
+ {
+ return "\n" + getFileAccess().getPath(p.cp_URL, null);
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+ /**
+ * this method will be called when the Status Dialog
+ * is hidden.
+ * It checks if the "Process" was successfull, and if so,
+ * it closes the wizard dialog.
+ */
+ 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");
+
+ 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);
+ }
+ }
+
+ public void cancel()
+ {
+ xDialog.endExecute();
+ }
+ private Process process;
+ private boolean exitOnCreate = true;
+
+ /**
+ * the user clicks the finish/create button.
+ */
+ public boolean finishWizard()
+ {
+ finishWizard(true);
+ return true;
+ }
+
+ /**
+ * finish the wizard
+ * @param exitOnCreate_ should the wizard close after
+ * a successfull create.
+ * Default is true,
+ * I have a hidden feature which enables false here
+ */
+ public void finishWizard(boolean exitOnCreate_)
+ {
+
+ exitOnCreate = exitOnCreate_;
+
+ /**
+ * First I check if ftp password was set, if not - the ftp dialog pops up...
+ * This may happen when a session is loaded, since the
+ * session saves the ftp url and username, but not the password.
+ */
+ 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))
+ {
+ updatePublishUI(2);
+ //now continue...
+ finishWizard2();
+ }
+ }
+ else
+ {
+ finishWizard2();
+ }
+ }
+
+ /**
+ * this method is only called
+ * if ftp-password was eather set, or
+ * the user entered one in the FTP Dialog which
+ * popped up when clicking "Create".
+ *
+ */
+ private void finishWizard2()
+ {
+
+ CGPublish p = getPublisher(LOCAL_PUBLISHER);
+ p.url = p.cp_URL;
+
+ /*
+ * zip publisher is using another url form...
+ */
+ p = getPublisher(ZIP_PUBLISHER);
+ //replace the '%' with '%25'
+ String url1 = JavaTools.replaceSubString(p.cp_URL, "%25", "%");
+ //replace all '/' with '%2F'
+ url1 = JavaTools.replaceSubString(url1, "%2F", "/");
+
+ p.url = "vnd.sun.star.pkg://" + url1 + "/";
+
+ /*
+ * and now ftp...
+ */
+ p = getPublisher(FTP_PUBLISHER);
+ p.url = FTPDialog.getFullURL(p);
+
+
+ /* first we check the publishing targets. If they exist we warn and ask
+ * 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 canceled by user
+ if (!saveSession())
+ {
+ return;
+ }
+ }
+ else
+ {
+ settings.cp_LastSavedSession = "";
+ }
+ try
+ {
+ Object conf = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH, true);
+ Configuration.set(
+ settings.cp_LastSavedSession,
+ "LastSavedSession", conf);
+ Configuration.commit(conf);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ /*
+ * again, if proxies are on, I disable ftp before the creation process
+ * starts.
+ */
+ if (proxies)
+ {
+ p.cp_Publish = false;
+
+ /*
+ * There is currently a bug, which crashes office when
+ * 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))
+ {
+ getFileAccess().delete(p.cp_URL);
+ }
+ try
+ {
+
+ 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,
+ process.runProcess();
+ finishWizardFinished();
+ process.myTask.removeTaskListener(pd);
+
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ }
+
+ /**
+ * implements a hidden feature for "finishing" without
+ * closing the wizard.
+ * press "&%" quite fast when the focus is on one
+ * of the last steps' checkboxes.
+ * @author rp143992
+ */
+ 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 == '&')
+ {
+ time = System.currentTimeMillis();
+ }
+ else if (ke.KeyChar == '%' && ((System.currentTimeMillis() - time) < 300))
+ {
+ Boolean b = (Boolean) getControlProperty("btnWizardFinish", "Enabled");
+ if (b.booleanValue())
+ {
+ finishWizard(false);
+ }
+ }
+ }
+
+ public void keyReleased(KeyEvent arg0)
+ {
+ }
+
+ public void disposing(EventObject arg0)
+ {
+ }
+ }
+
+ /**
+ * is called on the WindowHidden event,
+ * deletes the temporary directory.
+ */
+ public void cleanup()
+ {
+
+
+ try
+ {
+ dpStylePreview.dispose();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ stylePreview.cleanup();
+
+ try
+ {
+ if (bgDialog != null)
+ {
+ bgDialog.xComponent.dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ try
+ {
+ if (iconsDialog != null)
+ {
+ iconsDialog.xComponent.dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ try
+ {
+ if (ftpDialog != null)
+ {
+ ftpDialog.xComponent.dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ try
+ {
+ xComponent.dispose();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ 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();
+ }
+
+ }
+
+ public class LoadDocs
+ {
+
+ private XControl xC;
+ String[] files;
+ Task task;
+
+ public LoadDocs(XControl xC_, String[] files_, Task task_)
+ {
+ xC = xC_;
+ files = files_;
+ task = task_;
+ }
+
+ public void loadDocuments()
+ {
+ //LogTaskListener lts = new LogTaskListener();
+ //task.addTaskListener(lts);
+
+// task.start();
+
+ // where the documents are added to in the list (offset)
+ int offset = (getSelectedDoc().length > 0 ? selectedDoc[0] + 1 : getDocsCount());
+
+ /* if the user chose one file, the list starts at 0,
+ * if he chose more than one, the first entry is a directory name,
+ * all the others are filenames.
+ */
+ int start = (files.length > 1 ? 1 : 0);
+ /*
+ * Number of documents failed to validate.
+ */
+ int failed = 0;
+
+ // store the directory
+ settings.cp_DefaultSession.cp_InDirectory = start == 1 ? files[0] : FileAccess.getParentDir(files[0]);
+
+ /*
+ * 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++)
+ {
+ CGDocument doc = new CGDocument();
+ doc.setRoot(settings);
+
+ doc.cp_URL = (start == 0) ? files[i] : FileAccess.connectURLs(files[0], files[i]);
+
+ /* so - i check each document and if it is ok I add it.
+ * The failed variable is used only to calculate the place to add -
+ * 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
+ });
+ }
+ // update the ui...
+ docListDA.updateUI();
+ // this enables/disables the next steps.
+ // when no documents in the list, all next steps are disabled
+ checkSteps();
+ /* a small insurance that the status dialog will
+ * really close...
+ */
+ 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
new file mode 100644
index 000000000000..d4e273f4889b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/WWD_General.java
@@ -0,0 +1,392 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.awt.XWindowPeer;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.util.XStringSubstitution;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.ui.event.ListModelBinder;
+import com.sun.star.wizards.web.data.CGDocument;
+import com.sun.star.wizards.web.data.CGFilter;
+import com.sun.star.wizards.web.data.CGPublish;
+import com.sun.star.wizards.web.data.CGSettings;
+
+/**
+ * @author rpiterman
+ * 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
+{
+
+ private FileAccess fileAccess;
+ 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;
+
+ protected StatusDialog getStatusDialog()
+ {
+
+ 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)
+ {
+ e.printStackTrace();
+ }
+
+ return statusDialog;
+ }
+
+ /**
+ * @param xmsf
+ */
+ public WWD_General(XMultiServiceFactory xmsf)
+ {
+ super(xmsf);
+ xStringSubstitution = SystemDialog.createStringSubstitution(xmsf);
+ }
+
+ /*
+ * File Dialog methods
+ */
+ 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);
+ //}
+ return docAddDialog;
+ }
+
+ protected SystemDialog getZipDialog()
+ {
+ if (zipDialog == null)
+ {
+ zipDialog = SystemDialog.createStoreDialog(xMSF);
+ zipDialog.addFilter(resources.resZipFiles, "*.zip", true);
+ }
+ return zipDialog;
+ }
+
+ protected FTPDialog getFTPDialog(CGPublish pub)
+ {
+ if (ftpDialog == null)
+ {
+ try
+ {
+ ftpDialog = new FTPDialog(xMSF, pub);
+ ftpDialog.createWindowPeer(xControl.getPeer());
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ return ftpDialog;
+ }
+
+ protected String showFolderDialog(String title, String description, String dir)
+ {
+ if (folderDialog == null)
+ {
+ folderDialog = SystemDialog.createFolderDialog(xMSF);
+ }
+ return folderDialog.callFolderDialog(title, description, dir);
+ }
+
+ protected FileAccess getFileAccess()
+ {
+ if (fileAccess == null)
+ {
+ try
+ {
+ fileAccess = new FileAccess(xMSF);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ return fileAccess;
+ }
+
+ /**
+ * returns the document specified
+ * by the given short array.
+ * @param s
+ * @return
+ */
+ 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]);
+ }
+ }
+
+ /**
+ * how many documents are in the list?
+ * @return the number of documents in the docs list.
+ */
+ 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);
+ }
+
+ /**
+ * returns a publisher object for the given name
+ * @param name one of the WebWizardConst constants : FTP
+ * @return
+ */
+ 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);
+ }
+
+ /**
+ * @return the name to save the session (step 7)
+ */
+ 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()
+ {
+ /* first I check the document list.
+ * If it is empty, then step3 and on are disabled.
+ */
+ if (checkDocList())
+ {
+ checkPublish();
+ }
+ }
+
+ /**
+ * enables/disables the steps 3 to 7)
+ * @param enabled true = enabled, false = disabled.
+ */
+ private void enableSteps(boolean enabled)
+ {
+
+ if (!enabled && !isStepEnabled(3))
+ {
+ return;
+ /*
+ * disbale steps 3-7
+ */
+ }
+ 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);
+ }
+ }
+
+ /**
+ * Checks if the documents list is
+ * empty. If it is, disables the steps 3-7, and the
+ * create button.
+ * @return
+ */
+ protected boolean checkDocList()
+ {
+ if (settings.cp_DefaultSession.cp_Content.cp_Documents.getSize() == 0)
+ {
+ enableSteps(false);
+ return false;
+ }
+ else
+ {
+ enableSteps(true);
+ return true;
+ }
+ }
+
+ /**
+ * check if the save-settings input is ok.
+ * (eather the checkbox is unmarked, or,
+ * if it is marked, a session name exists.
+ *
+ */
+ public boolean checkSaveSession()
+ {
+ return (!isSaveSession() ||
+ !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)
+ {
+ CGPublish p = getPublisher(s);
+ 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 false;
+ }
+ }
+
+ /**
+ *
+ * @return false either if publishing input is wrong or there
+ * are no publishing targets chosen. returns true when at least
+ * one target is chosen, *and* all
+ * 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();
+ }
+ catch (IllegalArgumentException ex)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * This method checks if the publishing
+ * input is ok, and enables and disables
+ * the 'create' button.
+ * public because it is called from
+ * an event listener object.
+ */
+ public void checkPublish()
+ {
+ enableFinishButton(checkPublish_());
+ }
+
+ /**
+ * shows a message box "Unexpected Error... " :-)
+ * @param ex
+ */
+ protected void unexpectedError(Exception ex)
+ {
+ ex.printStackTrace();
+ XWindowPeer peer = xControl.getPeer();
+ AbstractErrorHandler.showMessage(xMSF, peer, resources.resErrUnexpected, ErrorHandler.ERROR_PROCESS_FATAL);
+ }
+
+ /**
+ * substitutes path variables with the corresponding values.
+ * @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);
+ }
+ 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
new file mode 100644
index 000000000000..818781cd0bf3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.java
@@ -0,0 +1,984 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.awt.ItemEvent;
+//import com.sun.star.awt.XItemListener;
+import java.io.FileNotFoundException;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Vector;
+
+import com.sun.star.awt.VclWindowPeerAttribute;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XItemListener;
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.ConfigSet;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.SystemDialog;
+import com.sun.star.wizards.document.OfficeDocument;
+import com.sun.star.wizards.ui.DocumentPreview;
+import com.sun.star.wizards.ui.event.DataAware;
+import com.sun.star.wizards.ui.event.ListModelBinder;
+import com.sun.star.wizards.ui.event.RadioDataAware;
+import com.sun.star.wizards.ui.event.SimpleDataAware;
+import com.sun.star.wizards.ui.event.Task;
+import com.sun.star.wizards.ui.event.UnoDataAware;
+import com.sun.star.wizards.web.data.CGContent;
+import com.sun.star.wizards.web.data.CGDocument;
+import com.sun.star.wizards.web.data.CGIconSet;
+import com.sun.star.wizards.web.data.CGPublish;
+import com.sun.star.wizards.web.data.CGSession;
+import com.sun.star.wizards.web.data.CGSessionName;
+import com.sun.star.wizards.web.data.CGSettings;
+import com.sun.star.wizards.web.data.CGStyle;
+
+/**
+ * Web Wizard Dialog implementation : Startup.
+ * This class contains the startup implementation and session mounting methods.<p/>
+ * <h2> Data Aware Concept </h2>
+ * <p> I use DataAware objects, which synchronize
+ * UI and Data. A DataAware object a kind of interface
+ * between a Value and a UI element.
+ * </P>
+ * <p>
+ * A Value is either a JavaBean property with
+ * a Getter and a Setter or a public class Memeber.
+ * </P>
+ * When the UI Control changes, the Value changes correspondingly.
+ * This depends on settings a Listener which calls the updateData()
+ * method od the DataAware object.
+ * When the Value changes, the UI Control changes respopndingly.
+ * This also depends on settings a Listener which calls the updateUI()
+ * method of the DataAware object.
+ * </P>
+ * <P>
+ * here I use only UI Listeners, and keep calling
+ * the updateUI() method whenever I change the Value.
+ * </P>
+ * To contain the Data, I use the Configuration Data Objects
+ * which read themselfs out of the Configuration. they are all located under
+ * the data package.
+ * <p/>
+ * Different groups of DataAware objects are grouped into vectors.
+ * Each group (all elements of a vector) uses the same DataObject,
+ * so when I change the underlying dataObject, I change the whole vector's DataObject,
+ * thus actualizing UI.<br/>
+ * This is what happends when a session loads: I Load the session into
+ * a tree of DataObjects, and change the DataAware's DataObject. <br/>
+ * One could also look at this as a kind of "View-Model" relationship.
+ * The controls are the View, The DataObjects are the Model, containing the
+ * Data rad directly from the configuration, and the DataAware objects
+ * are the controller inbetween.
+ *
+ * @author rpiterman
+ *
+ */
+public abstract class WWD_Startup extends WWD_General
+{
+
+ SimpleDataAware sda = null;
+ /**
+ * This is currently not used.
+ * It should have been a Listener which invoces
+ * an Update to the Preview-Document, only
+ * We did not implement the live-preview document,
+ * so this became obsolete.
+ */
+ protected DataAware.Listener refresh;
+ /**
+ * Is called whenever a field is changed which
+ * could affect the "create" button enable state,
+ * 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
+ * as DataObject (or Model).
+ */
+ protected List docAware = new Vector();
+ /**
+ * The Vector containing DataAware objects
+ * which relay on the session's generalInfo
+ * Object (CGSession.cp_GeneralInfo) as
+ * DataObject (or model).
+ */
+ protected List genAware = new Vector();
+ /**
+ * The vector containing DataAware objectscm25npd ..
+ * which relay on the session's Design Object
+ * (CGSession.cp_Design) as DataObject
+ * (or model).
+ *
+ */
+ protected List designAware = new Vector();
+ /**
+ * A Vector containig the DataAware objects
+ * which relay on Publishing Objects.
+ * Differently from other Vectors, each
+ * DataAware object in this Vector relays
+ * on a <b>different</b> CGPublish object,
+ * So they are handled with more care.
+ */
+ protected List pubAware = new Vector(3);
+ /**
+ * The DataAware object which handles
+ * the documents-list events.
+ * This will call the set/getDocument() method
+ * implemented in WWD_General.
+ */
+ protected UnoDataAware docListDA;
+ /**
+ * DataAware object which synchronizes the session
+ * 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
+ * in the Dialog
+ */
+ protected DocumentPreview dpStylePreview;
+ /**
+ * An Object that implements the
+ * File-copy and refresh of the
+ * 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.
+ * In order to save it correctly when saving the session
+ * 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
+ * instance used for that purpose.
+ */
+ protected XFrame myFrame;
+
+
+ /* ******************************************
+ * ****************************************
+ * General Methods
+ * ****************************************
+ * ****************************************** */
+
+ /*
+ * GENERAL Initialization methods
+ */
+ /**
+ * He - my constructor !
+ * I call/do here in this order: <br/>
+ * Check if ftp http proxy is set, and warn user he can not use
+ * ftp if it is.<br/>
+ * draw NaviBar and steps 1 to 7, incl. Step X,
+ * which is the Layouts ImageList on step 3.<br/>
+ * load the settings from the configuration. <br/>
+ * set the default save session name to the first
+ * available one (sessionX or something like that). <br/>
+ * set the Layouts ImageList ListModel, and call
+ * its "create()" method. <br/>
+ * check the content (documents) specified in the default session.<br/>
+ * fill the list boxes (saved sessions, styles, combobox save session). <br/>
+ * make data aware. <br/>
+ * updateUI (refreshes the display to crrespond to the data in
+ * the default session.)<br/>
+ * fill the documents listbox. <br/>
+ * if proxies are set, disable the ftp controls in step 7.
+ */
+ 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");
+ this.drawNaviBar();
+ this.buildStep1();
+ this.buildStep2();
+ this.buildStep3();
+
+ this.buildStep4();
+ this.buildStep5();
+ this.buildStep6();
+ this.buildStep7(proxies, exclamationURL);
+ buildStepX();
+
+ this.xMSF = xMSF;
+ XDesktop xDesktop = Desktop.getDesktop(xMSF);
+ myFrame = OfficeDocument.createNewFrame(xMSF, this);
+ Object doc = OfficeDocument.createNewDocument(myFrame, "swriter", false, true);
+
+ loadSettings(doc);
+ setSaveSessionName(settings.cp_DefaultSession);
+
+ ilLayouts.setListModel(settings.cp_Layouts);
+ ilLayouts.create(this);
+
+ checkContent(settings.cp_DefaultSession.cp_Content, new Task("", "", 99999), this.xControl);
+
+ //saved sessions, styles, combobox save session.
+ // also set the chosen saved session...
+ fillLists();
+ makeDataAware();
+ // change the display to correspond to the current session.
+ updateUI();
+ // fill the documents listbox.
+ mount(settings.cp_DefaultSession.cp_Content);
+
+
+ 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);
+ //System.out.println("WWD:Startup:getOOProxies:" + i);
+ switch (i)
+ {
+ case 0: //no proxies
+ return false;
+ case 2: //http proxies
+ return true;
+ 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)
+ {
+ 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++)
+ {
+ 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)
+ {
+ if (i1 > i2)
+ {
+ return i1;
+ }
+ else
+ {
+ return i2;
+ }
+ }
+
+ /**
+ * fills the road map, and sets the necessary properties,
+ * 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
+ });
+
+ setRoadmapInteractive(true);
+ setRoadmapComplete(true);
+ setCurrentRoadmapItemID((short) 1);
+ setMaxStep(7);
+ enableFinishButton(false);
+
+ }
+
+ /**
+ * This method goes through all
+ * the DataAware vectors and objects and
+ * calls their updateUI() method.
+ * In response, the UI is synchronized to
+ * the state of the corresponding data objects.
+ *
+ */
+ private void updateUI()
+ {
+ DataAware.updateUI(designAware);
+ DataAware.updateUI(genAware);
+ DataAware.updateUI(pubAware);
+ sessionNameDA.updateUI();
+ checkPublish();
+ }
+
+ private XFrame getFrame(Object model)
+ {
+ XModel xmodel = (XModel) UnoRuntime.queryInterface(XModel.class, model);
+ return xmodel.getCurrentController().getFrame();
+ }
+
+ /**
+ * create the peer, add roadmap,
+ * add roadmap items, add style-preview,
+ * disable the steps 3 to 7 if no documents are
+ * on the list, and... show the dialog!
+ */
+ public void show()
+ {
+ try
+ {
+
+
+ /* myFrame.initialize(docWindow);
+ * */
+
+ //desktopFrame = Desktop.findAFrame(xMSF, myFrame, desktopFrame);
+
+ //XWindow xContainerWindow = myFrame.getContainerWindow();
+
+ XWindow xContainerWindow = myFrame.getComponentWindow();
+ XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
+
+ createWindowPeer(xWindowPeer);
+
+ addRoadmap();
+ addRoadMapItems();
+ addStylePreview();
+ checkSteps();
+
+ executeDialog(myFrame);
+ removeTerminateListener();
+
+ }
+ catch (java.lang.Exception jexception)
+ {
+ jexception.printStackTrace(System.out);
+ }
+ }
+
+ /**
+ * initializes the style preview.
+ */
+ 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)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Loads the web wizard settings from the registry.
+ */
+ private void loadSettings(Object document)
+ {
+ try
+ {
+ // instanciate
+ String[] settingsResources = new String[]
+ {
+ resources.resPages,
+ resources.resSlides,
+ resources.resCreatedTemplate,
+ resources.resUpdatedTemplate,
+ resources.resSizeTemplate
+ };
+
+ settings = new CGSettings(xMSF, settingsResources, document);
+
+ // get configuration view
+ Object confRoot = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH, false);
+ // read
+ settings.readConfiguration(confRoot, CONFIG_READ_PARAM);
+
+ ConfigSet set = settings.cp_DefaultSession.cp_Publishing;
+
+ // 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);
+ p.cp_URL = substitute(p.cp_URL);
+ }
+
+ // initialize the settings.
+ settings.configure(xMSF);
+
+ // set resource needed for web page.
+
+ // sort the styles alphabetically
+ settings.cp_Styles.sort(new StylesComparator());
+
+ prepareSessionLists();
+
+ if (proxies)
+ {
+ __ftp = getPublisher(FTP_PUBLISHER).cp_Publish;
+ getPublisher(FTP_PUBLISHER).cp_Publish = false;
+
+ }
+
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ 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
+ }
+ CGSessionName sn = new CGSessionName();
+ sn.cp_Name = resources.resSessionNameNone;
+ settings.cp_SavedSessions.add(0, sn);
+ }
+
+ /**
+ * fills the saved session list, the styles list,
+ * and save session combo box.
+ * Also set the selected "load" session to the last session
+ * which was saved.
+ */
+ private void fillLists()
+ {
+ // fill the saved session list.
+ ListModelBinder.fillList(lstLoadSettings, settings.cp_SavedSessions.items(), null);
+
+ // set the selected session to load. (step 1)
+ selectSession();
+
+ // fill the styles list.
+ ListModelBinder.fillList(lstStyles, settings.cp_Styles.items(), null);
+
+ // fill the save session combobox (step 7)
+ ListModelBinder.fillComboBox(cbSaveSettings, settings.savedSessions.items(), null);
+
+
+ }
+
+ protected void selectSession()
+ {
+ int selectedSession = 0;
+ if (settings.cp_LastSavedSession != null && !settings.cp_LastSavedSession.equals(""))
+ {
+
+ 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
+ });
+
+ }
+
+ public class SimpleDataawareUpdater implements XItemListener
+ {
+ /* (non-Javadoc)
+ * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject)
+ */
+
+ public void disposing(EventObject arg0)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ public void itemStateChanged(com.sun.star.awt.ItemEvent itemEvent)
+ {
+ sda.updateData();
+ //TODO xf uncomment
+ //refresh.eventPerformed(ie);
+ }
+ }
+
+ /**
+ * attaches to each ui-data-control (like checkbox, groupbox or
+ * textbox, no buttons though), a DataObject's JavaBean Property,
+ * or class member.
+ */
+ 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.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_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));
+ ilLayouts.addItemListener(new SimpleDataawareUpdater());
+ designAware.add(sda);
+
+ //page 4 : layout 2
+ designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayDescription", chbDocDesc, refresh, true));
+ designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayAuthor", chbDocAuthor, refresh, true));
+ designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayCreateDate", chkDocCreated, refresh, true));
+ designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayUpdateDate", chkDocChanged, refresh, true));
+ designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayFilename", chkDocFilename, refresh, true));
+ designAware.add(UnoDataAware.attachCheckBox(design, "cp_DisplayFileFormat", chkDocFormat, refresh, true));
+ 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));
+
+
+ //page 5 : Style
+ /*
+ * note : on style change, i do not call here refresh ,but rather on
+ * a special method which will perform some display, background and Iconsets changes.
+ */
+ designAware.add(UnoDataAware.attachListBox(settings.cp_DefaultSession.cp_Design, "Style", lstStyles, null, false));
+
+ //page 6 : site general props
+ genAware.add(UnoDataAware.attachEditControl(settings.cp_DefaultSession.cp_GeneralInfo, "cp_Title", txtSiteTitle, refresh, true));
+ genAware.add(UnoDataAware.attachEditControl(settings.cp_DefaultSession.cp_GeneralInfo, "cp_Description", txtSiteDesc, refresh, true));
+
+ genAware.add(UnoDataAware.attachDateControl(settings.cp_DefaultSession.cp_GeneralInfo, "CreationDate", dateSiteCreated, refresh, false));
+ genAware.add(UnoDataAware.attachDateControl(settings.cp_DefaultSession.cp_GeneralInfo, "UpdateDate", dateSiteUpdate, refresh, false));
+ genAware.add(UnoDataAware.attachEditControl(settings.cp_DefaultSession.cp_GeneralInfo, "cp_Email", txtEmail, refresh, true));
+ genAware.add(UnoDataAware.attachEditControl(settings.cp_DefaultSession.cp_GeneralInfo, "cp_Copyright", txtCopyright, refresh, true));
+
+ //page 7 : publishing
+
+ pubAware(LOCAL_PUBLISHER, chkLocalDir, txtLocalDir, 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);
+ }
+
+ /**
+ * A help method to attach a Checkbox and a TextBox to
+ * a CGPublish object properties/class members,
+ * @param publish
+ * @param checkbox
+ * @param textbox
+ */
+ 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
+ });
+ pubAware.add(uda);
+ pubAware.add(
+ isLabel ? UnoDataAware.attachLabel(p, "URL", textbox, checkPublish, false)
+ : UnoDataAware.attachEditControl(p, "URL", textbox, checkPublish, false));
+
+ }
+
+ /*
+ * Session load methods
+ * (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/>
+ * Checks the documents (validate), fills the
+ * documents listbox, and changes the
+ * DataAware data objects to the
+ * new session's objects.<br/>
+ * Task advances 4 times in the mount method,
+ * and ??? times for each document in the session.
+ *
+ */
+ 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.
+ */
+ checkContent(session.cp_Content, task, xC);
+
+ settings.cp_DefaultSession = session;
+
+ mount(session.cp_Content);
+
+ task.advance(true);
+
+ mount(session.cp_Design, designAware);
+ mount(session.cp_GeneralInfo, genAware);
+
+ task.advance(true);
+
+ mount(session.cp_Publishing.getElement(LOCAL_PUBLISHER), 0);
+ mount(session.cp_Publishing.getElement(FTP_PUBLISHER), 1);
+ mount(session.cp_Publishing.getElement(ZIP_PUBLISHER), 2);
+
+ task.advance(true);
+
+ sessionNameDA.setDataObject(session, true);
+ Helper.setUnoPropertyValue(getModel(chkSaveSettings), "State", new Short((short) 1));
+ docListDA.updateUI();
+
+ task.advance(true);
+
+ if (refreshStyle)
+ {
+ refreshStylePreview();
+ updateIconsetText();
+ }
+
+ //updateUI();
+ }
+
+ /**
+ * used to mount the publishing objects. This is somehow cryptic -
+ * there are 6 DataAware objects, 2 for each Publishing Object (CGPublish).
+ * All 6 reside on one Vector (pubAware).
+ * Since, otherwise than other DataAware objects, different
+ * Objects on the same Vector need different DataObjectBinding,
+ * I use this method...
+ * @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)
+ {
+ ((DataAware) pubAware.get(i * 2)).setDataObject(data, true);
+ ((DataAware) pubAware.get(i * 2 + 1)).setDataObject(data, true);
+ }
+
+ /**
+ * Fills the documents listbox.
+ * @param root the CGContent object
+ * that contains the documents (a ListModel)
+ */
+ private void mount(CGContent root)
+ {
+ ListModelBinder.fillList(lstDocuments, root.cp_Documents.items(), null);
+ docsBinder.setListModel(root.cp_Documents);
+ disableDocUpDown();
+
+ }
+
+ /**
+ * changes the DataAwares Objects' (in
+ * the gioen list) DataObject to the
+ * @param data
+ * @param list
+ */
+ protected void mount(Object data, List list)
+ {
+ for (int i = 0; i < list.size(); i++)
+ {
+ ((DataAware) list.get(i)).setDataObject(data, true);
+ }
+ }
+
+ /**
+ * Checks if the document specified by the given CGDocument
+ * object (cp_URL) exists. Calls also the validate(...) method
+ * of this document.
+ * If the document does not exist, it asks the user whether
+ * to specify a new URL, or forget about this document.
+ * @param doc the document to check.
+ * @param task while loading a session, a status is
+ * 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
+ {
+ doc.validate(xMSF, task);
+ return true;
+ }
+ 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);
+
+ if (relocate == 2)
+ {
+ String[] file = getDocAddDialog().callOpenDialog(false, FileAccess.getParentDir(doc.cp_URL));
+ if (file == null)
+ {
+ return false;
+ }
+ else
+ {
+ doc.cp_URL = file[0];
+ return checkDocument(doc, task, xC);
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+ catch (IllegalArgumentException iaex)
+ {
+ //file is a directory
+ AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),
+ JavaTools.replaceSubString(resources.resErrIsDirectory,
+ getFileAccess().getPath(doc.cp_URL, ""),
+ "%FILENAME"),
+ ErrorHandler.ERROR_PROCESS_FATAL);
+ return false;
+ }
+ 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);
+ return false;
+ }
+
+ }
+
+ /**
+ * Checks the documents contained in this content.
+ * @param content
+ * @param task
+ */
+ 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
+ {
+ content.cp_Documents.remove(i--);
+ /*for (Iterator i = content.cp_Contents.childrenMap.values().iterator(); i.hasNext();)
+ checkContent((CGContent)i.next(),task);*/
+ }
+ }
+ }
+
+ /**
+ * A Listener which is called whenever
+ * a Publish checkbox/textbox state changes, and
+ * changes the "create" button enable state accordingly.
+ * @author rpiterman
+ */
+ private class CheckPublish implements DataAware.Listener
+ {
+
+ public void eventPerformed(Object event)
+ {
+ checkPublish();
+ }
+ }
+
+ /**
+ * Disables/enables the docUpDown buttons (step 2)
+ * according to the currently selected document
+ * (no doc selected - both disbaled, last doc selected,
+ * down disabled and so on...)
+ *
+ */
+ 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)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ 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);
+ }
+
+ 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);
+ if (is == null)
+ {
+ iconsetName = resources.resIconsetNone;
+ }
+ else
+ {
+ iconsetName = is.cp_Name;
+ }
+ }
+
+ Helper.setUnoPropertyValue(getModel(txtIconset), "Label", iconsetName);
+ }
+
+ /**
+ * refreshes the style preview.
+ * I also call here "updateBackgroundtext", because always
+ * when the background is changed, this method
+ * has to be called, so I am walking on the safe side here...
+ */
+ public void refreshStylePreview()
+ {
+ try
+ {
+ updateBackgroundText();
+ stylePreview.refresh(settings.cp_DefaultSession.getStyle(), settings.cp_DefaultSession.cp_Design.cp_BackgroundImage);
+ dpStylePreview.reload(xMSF);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ 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)
+ {
+ // TODO Auto-generated method stub
+ 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.");
+ }
+ }
+ }
+}
diff --git a/wizards/com/sun/star/wizards/web/WWHID.java b/wizards/com/sun/star/wizards/web/WWHID.java
new file mode 100644
index 000000000000..6d9a4882fcb9
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/WWHID.java
@@ -0,0 +1,186 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sun.star.wizards.web;
+
+/**
+ * @author rp143992
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+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 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;
+// 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;
+}
diff --git a/wizards/com/sun/star/wizards/web/WebWizard.java b/wizards/com/sun/star/wizards/web/WebWizard.java
new file mode 100644
index 000000000000..87ea5217b11e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/WebWizard.java
@@ -0,0 +1,72 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Desktop;
+
+/**
+ * The last class in the WebWizard Dialog class hirarchy.
+ * Has no functionality, is just nice to have it instanciated.
+ * @author rpiterman
+ */
+public class WebWizard extends WWD_Events
+{
+
+ /**
+ * @param xmsf
+ */
+ public WebWizard(XMultiServiceFactory xmsf) throws Exception
+ {
+ super(xmsf);
+ }
+
+ public static void main(String args[])
+ {
+
+ String ConnectStr =
+ "uno:socket,host=localhost,port=8100;urp,negotiate=0,forcesynchronous=1;StarOffice.ServiceManager";
+ try
+ {
+ XMultiServiceFactory xmsf = Desktop.connect(ConnectStr);
+ WebWizard ww = new WebWizard(xmsf);
+ ww.show();
+ ww.cleanup();
+
+ }
+ 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
new file mode 100644
index 000000000000..7ef17f134458
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/WebWizardConst.java
@@ -0,0 +1,73 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+}
+ \ 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
new file mode 100644
index 000000000000..736639972c44
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.java
@@ -0,0 +1,930 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.awt.FontDescriptor;
+import com.sun.star.awt.Size;
+import com.sun.star.awt.XButton;
+import com.sun.star.awt.XCheckBox;
+import com.sun.star.awt.XComboBox;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XDateField;
+import com.sun.star.awt.XFixedText;
+import com.sun.star.awt.XListBox;
+import com.sun.star.awt.XRadioButton;
+import com.sun.star.awt.XTextComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Helper;
+import com.sun.star.wizards.ui.ImageList;
+import com.sun.star.wizards.ui.UIConsts;
+import com.sun.star.wizards.ui.WizardDialog;
+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) 14), "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) 14), "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) 14), "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) 14), "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.IImageRenderer
+ {
+
+ 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
new file mode 100644
index 000000000000..c4a4f0cf58cd
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/WebWizardDialogResources.java
@@ -0,0 +1,349 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.wizards.common.Configuration;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.common.Resource;
+import com.sun.star.wizards.document.OfficeDocument;
+
+public class WebWizardDialogResources
+{
+
+ String resSessionName;
+ String resSizeTemplate;
+ String resSpecifyNewFileLocation;
+ String resCreatedTemplate;
+ String resUpdatedTemplate;
+ String resSlides;
+ String resDelSessionConfirm;
+ String resErrIsDirectory;
+ String resErrDocValidate;
+ String resStep1;
+ String resStep2;
+ String resStep3;
+ String resStep4;
+ String resStep5;
+ String resStep6;
+ String resStep7;
+ String resDefaultArchiveFilename;
+ String resValidatingDocuments;
+ String resErrUnexpected;
+ String resLoadingSession;
+ String resErrExportIO;
+ String resErrPublishMedia;
+ String resErrPublish;
+ String resErrUnknown;
+ //String resErrDocClose;
+ String resErrSecurity;
+ String resErrMkDir;
+ //String resErrDocOpen;
+ String resErrDocExport;
+ String resErrDocInfo;
+ String resErrTOCMedia;
+ String resErrTOC;
+ final static String UNIT_NAME = "dbwizres";
+ final static String MODULE_NAME = "dbw";
+ 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;
+ String reslbIntroTitle_value;
+ String reslblContentTitle_value;
+ String reslnDocsInfo_value;
+ String reslblDocTitle_value;
+ String reslblDocInfo_value;
+ String reslblDocAuthor_value;
+ String reslblDocExportFormat_value;
+ String reslblTitleGeneralPage_value;
+ String reslblSiteTitle_value;
+ String reslblSiteDesc_value;
+ String reslblSiteCreated_value;
+ String reslblEmail_value;
+ String reslblCopyright_value;
+ String reslblSiteUpdated_value;
+ String resbtnPreview_value;
+ String reslblTitlePublish_value;
+ String reslblCreateSite_value;
+ String reschkLocalDir_value;
+ String resbtnLocalDir_value;
+ String reschkFTP_value;
+ String resbtnFTP_value;
+ String reschkZip_value;
+ String resbtnZip_value;
+ String reschkSaveSettings_value;
+ String reslblSaveSettings_value;
+ String reslblLoadSettings_value;
+ String reslblSiteContent_value;
+ String resbtnAddDoc_value;
+ String resbtnRemoveDoc_value;
+ String reslblLayoutTitle_value;
+ String reslblStyleTitle_value;
+ String reslblStyle_value;
+ String reslblLayouts_value;
+ String reschbDocDesc_value;
+ String reschbDocAuthor_value;
+ String reschkDocCreated_value;
+ String reschkDocChanged_value;
+ String reschkDocFilename_value;
+ String reschkDocFormat_value;
+ String reschkDocFormatIcon_value;
+ String reschkDocPages_value;
+ String reschkDocSize_value;
+ String resFixedLine1_value;
+ String reslblLayout2Title_value;
+ String reslblDisplay_value;
+ String reslblOptimizeFor_value;
+ 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 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;
+ String resTaskGenerateCopy;
+ String resTaskGeneratePrepare;
+ String resTaskGenerateXsl;
+ String resTaskPrepare;
+ String resTaskPublishPrepare;
+ String resTaskPublishLocal;
+ 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;
+ String resLocalTargetCouldNotCreate;
+ String resLocalTargetCreate;
+ 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);
+ //
+ 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);
+ //
+ 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);
+ //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);
+
+ 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);
+
+ 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
new file mode 100644
index 000000000000..2ae2c70ce69c
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGArgument.java
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+import com.sun.star.wizards.common.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
new file mode 100644
index 000000000000..9bf32f26ff48
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGContent.java
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+import com.sun.star.wizards.common.*;
+
+import org.w3c.dom.*;
+
+public class CGContent extends ConfigSetItem implements XMLProvider
+{
+
+ 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 CGContent()
+ {
+ /*cp_Documents = new ConfigSet(CGDocument.class) {
+ protected DefaultListModel createChildrenList() {
+ 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
+ });
+
+ 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
new file mode 100644
index 000000000000..00c1ea10b949
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGDesign.java
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.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]);
+
+ }
+ 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 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);
+ }
+}
+
diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.java b/wizards/com/sun/star/wizards/web/data/CGDocument.java
new file mode 100644
index 000000000000..177355612675
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGDocument.java
@@ -0,0 +1,453 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import org.w3c.dom.Node;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.document.MacroExecMode;
+import com.sun.star.document.UpdateDocMode;
+import com.sun.star.document.XDocumentProperties;
+import com.sun.star.document.XDocumentPropertiesSupplier;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.DateTime;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.common.XMLHelper;
+import com.sun.star.wizards.common.XMLProvider;
+import com.sun.star.wizards.document.OfficeDocument;
+import com.sun.star.wizards.ui.event.Task;
+
+/**
+ * About the member fields Title, Decription and Author:
+ * There is an ambiguicy in handling these fields.
+ * On the one hand, the user can set those fields to a custom value,
+ * relevant only for the web-wizard.
+ * On the other-hand, the web-wizard can read those fields automatically
+ * from SO documents.
+ * In order to avoid conflict by saving, I use two fields: "cp_title", which
+ * should be read from the configuratin (saved session), and "title" which is
+ * the value read from the document.
+ * The *cp_title* "overrides" *title*, if exists. if not, *title* is used.
+ * The same is valid for *description* and *author*.
+ * @author rpiterman
+ */
+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;
+ /**
+ * 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;
+ /**
+ * The contents subdirectory name in which the document is in.
+ * This subdirectory will be created in the content's "docs"
+ * subdirectory.
+ */
+ public String dirName;
+ /**
+ * contains an identifier of the type of this document.
+ */
+ public String appType;
+ public PropertyValue[] mediaDescriptor;
+ /**
+ * Is this document an original SO Document (different versions).
+ */
+ public boolean isSODocument;
+ /**
+ * can this document be opend through SO?
+ */
+ public boolean isSOOpenable;
+ /**
+ * This flag is set to true after the validate method is called.
+ */
+ public boolean valid = false;
+ public String targetTypeName;
+
+ public CGDocument()
+ {
+ }
+
+ 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);
+ }
+
+ /**
+ * the task will advance 5 times during validate.
+ * @param xmsf
+ * @param task
+ * @throws Exception
+ */
+ public void validate(XMultiServiceFactory xmsf, Task task)
+ throws FileNotFoundException,
+ IllegalArgumentException,
+ Exception
+ {
+
+ 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);
+
+ task.advance(true); //1
+
+ //System.out.println(Properties.getPropertyValue(mediaDescriptor,"UIName"));
+
+ analyzeFileType(mediaDescriptor);
+
+ task.advance(true); //2
+
+ 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
+ */
+
+ XDocumentProperties xProps = null;
+
+ task.advance(true); //3
+
+ if (isSOOpenable)
+ { // for documents which are openable through SO, use DocumentProperties 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);
+ xProps = ((XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, component)).getDocumentProperties();
+ }
+
+ task.advance(true); //4
+
+ //now use the object to read some document properties.
+ if (xProps != null)
+ {
+ title = xProps.getTitle();
+ description = xProps.getDescription();
+ author = xProps.getAuthor();
+ createDate = xProps.getCreationDate();
+ updateDate = xProps.getModificationDate();
+ }
+ else
+ { //get some information from OS.
+ title = localFilename;
+ updateDate = getSettings().getFileAccess(xmsf).getLastModified(cp_URL);
+ }
+
+ task.advance(true); //5
+
+ 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_Exporter == null || cp_Exporter.equals(""))
+ {
+ 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 members.
+ */
+ private void analyzeFileType(PropertyValue[] mediaDesc)
+ {
+
+ if (mediaDesc == null)
+ {
+ }
+
+ String media = (mediaDesc == null)
+ ? "" : (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;
+
+// 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"));
+
+ }
+
+ /**
+ * @param media is the media description string returned by an UNO TypeDetection object.
+ * @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;
+ }
+ }
+ 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)
+ {
+ 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
+ });
+ }
+
+ private String updateDate()
+ {
+ if (this.updateDate == null)
+ {
+ return "";
+ }
+ return getSettings().formatter.formatCreated(this.updateDate);
+ }
+
+ private String createDate()
+ {
+ if (this.createDate == null)
+ {
+ return "";
+ }
+ return getSettings().formatter.formatCreated(this.createDate);
+ }
+
+ private String sizeKB()
+ {
+ if (sizeBytes == -1)
+ {
+ return "";
+ }
+ else
+ {
+ return getSettings().formatter.formatFileSize(sizeBytes);
+ }
+ }
+
+ 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:
+ return "";
+ case PAGE_TYPE_PAGE:
+ return getSettings().resources[CGSettings.RESOURCE_PAGES_TEMPLATE];
+ case PAGE_TYPE_SLIDE:
+ return getSettings().resources[CGSettings.RESOURCE_SLIDES_TEMPLATE];
+ default:
+ return "";
+ }
+ }
+
+ private String getTargetTypeName(CGExporter exp)
+ {
+ return (exp.targetTypeName.equals(""))
+ ? (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(String appType)
+ {
+ //System.out.println("Getting Icon for: " + appType);
+ return appType + ".gif";
+ }
+
+ /**
+ * This method is used by the DataAware model
+ * and returns the index of the exporter of
+ * this document, <b>in the list of the
+ * exporters available for this type of document</b>
+ * @return
+ */
+ public short[] getExporter()
+ {
+ return new short[]
+ {
+ getExporterIndex()
+ };
+ }
+
+ /**
+ * @see getExporter()
+ */
+ public void setExporter(short[] exporter_)
+ {
+ Object exp = getSettings().getExporters(appType)[exporter_[0]];
+ cp_Exporter = (String) getSettings().cp_Exporters.getKey(exp);
+ }
+
+ /**
+ * @see getExporter()
+ * @return
+ */
+ 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;
+ }
+ }
+ return -1;
+ }
+
+ 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
new file mode 100644
index 000000000000..c23073fbed01
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGExporter.java
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.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()
+ {
+ return cp_Name;
+ }
+
+ 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
new file mode 100644
index 000000000000..dc4f41df746b
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGFilter.java
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+public class CGFilter extends ConfigSetItem
+{
+
+ public String cp_Name;
+ //public boolean cp_Readonly;
+ 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
new file mode 100644
index 000000000000..c12d4c92f535
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGGeneralInfo.java
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.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 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 Integer getCreationDate()
+ {
+ if (cp_CreationDate == 0)
+ {
+ cp_CreationDate = currentDate();
+ }
+ return new Integer(cp_CreationDate);
+ }
+
+ public Integer getUpdateDate()
+ {
+ if (cp_UpdateDate == 0)
+ {
+ cp_UpdateDate = currentDate();
+ }
+ return new Integer(cp_UpdateDate);
+ }
+
+ public void setCreationDate(Integer i)
+ {
+ //System.out.println(i);
+ cp_CreationDate = i.intValue();
+ }
+
+ public void setUpdateDate(Integer i)
+ {
+ cp_UpdateDate = i.intValue();
+ }
+
+ 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
new file mode 100644
index 000000000000..197c6c3e44b5
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGIconSet.java
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+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
new file mode 100644
index 000000000000..e6d459bf48d5
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGImage.java
@@ -0,0 +1,45 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+
+/**
+ *
+ * @author rpiterman
+ */
+public class CGImage extends ConfigGroup
+{
+
+ 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
new file mode 100644
index 000000000000..9d9557c1615a
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGLayout.java
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+import com.sun.star.wizards.ui.UIConsts;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.xml.transform.*;
+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 String cp_Name;
+ public String cp_FSName;
+ private Map templates;
+
+ private void createTemplates(XMultiServiceFactory xmsf) throws Exception
+ {
+
+ templates = new Hashtable(3);
+
+ TransformerFactory tf = TransformerFactory.newInstance();
+
+ String workPath = getSettings().workPath;
+ FileAccess fa = new FileAccess(xmsf);
+ String stylesheetPath = fa.getURL(getSettings().workPath, "layouts/" + cp_FSName);
+
+ String[] files = fa.listFiles(stylesheetPath, false);
+
+ 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])));
+ }
+ }
+ }
+
+ 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)
+ };
+ }
+
+ public Map getTemplates(XMultiServiceFactory xmsf) throws Exception
+ {
+
+ // TODO uncomment...
+ // if (templates==null)
+ 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
new file mode 100644
index 000000000000..1a3746a3873d
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGPublish.java
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+import com.sun.star.wizards.common.ConfigGroup;
+
+/**
+ *
+ * A Class which describes the publishing arguments
+ * in a session.
+ * Each session can contain different publishers, which are configured
+ * through such a CGPublish object.
+ */
+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)
+ * This one will be edited to result the "url"
+ * field, which is the true url, ucb uses to publish.
+ * 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
+ */
+ public boolean overwriteApproved;
+
+ /**
+ * here I get an URL from user input, and parse it to
+ * a UCB url...
+ * @param url
+ */
+ public void setURL(String path)
+ {
+ try
+ {
+ this.cp_URL = ((CGSettings) this.root).getFileAccess().getURL(path);
+ overwriteApproved = false;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public String getURL()
+ {
+ try
+ {
+ return ((CGSettings) this.root).getFileAccess().getPath(cp_URL, null);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ return "";
+ }
+ }
+
+ private String ftpURL()
+ {
+ return "ftp://" + cp_Username +
+ ((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
new file mode 100644
index 000000000000..3acd570b7878
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGSession.java
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+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 CGGeneralInfo cp_GeneralInfo = new CGGeneralInfo();
+ public ConfigSet cp_Publishing = new ConfigSet(CGPublish.class);
+ public CGStyle style; // !!!
+ public boolean valid = false;
+
+ public Node createDOM(Node parent)
+ {
+ Node root = XMLHelper.addElement(parent, "session",
+ new String[]
+ {
+ "name", "screen-size"
+ },
+ new String[]
+ {
+ cp_Name, getScreenSize()
+ });
+
+ //cp_Design.createDOM(root);
+ cp_GeneralInfo.createDOM(root);
+ //cp_Publishing.createDOM(root);
+ cp_Content.createDOM(root);
+
+ 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";
+ }
+ }
+
+ 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 void setLayout(short[] layout)
+ {
+ //dummy
+ }
+
+ public Node createDOM()
+ throws ParserConfigurationException
+ {
+
+ DocumentBuilderFactory factory =
+ 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
new file mode 100644
index 000000000000..77cde79a8ca2
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGSessionName.java
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+public class CGSessionName extends ConfigSetItem
+{
+
+ public String cp_Name;
+
+ 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
new file mode 100644
index 000000000000..ecc538b9fa83
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGSettings.java
@@ -0,0 +1,212 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.Hashtable;
+import java.util.Map;
+import java.util.Vector;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.i18n.NumberFormatIndex;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.DateTime;
+import com.sun.star.wizards.common.*;
+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;
+ 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)
+ {
+ xmsf = xmsf_;
+ try
+ {
+ soTemplateDir = FileAccess.getOfficePath(xmsf, "Config", "", "");
+ soGalleryDir = FileAccess.getOfficePath(xmsf, "Gallery", "share", "");
+ root = this;
+ formatter = new Formatter(xmsf, document);
+ resources = resources_;
+ }
+ 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);
+ if (exps == null)
+ {
+ exportersMap.put(mime, exps = createExporters(mime));
+ }
+ return exps;
+ }
+
+ 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
+ {
+ v.add(exporters[i]);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+ return (CGExporter[]) v.toArray(EMPTY_ARRAY_1);
+ }
+
+ /**
+ * call after read.
+ * @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);
+ calcExportersTargetTypeNames(xmsf);
+ }
+
+ private void calcExportersTargetTypeNames(XMultiServiceFactory xmsf) throws Exception
+ {
+ Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
+ XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
+ for (int i = 0; i < cp_Exporters.getSize(); i++)
+ {
+ calcExporterTargetTypeName(xNameAccess, (CGExporter) cp_Exporters.getElementAt(i));
+ }
+ }
+
+ private void calcExporterTargetTypeName(XNameAccess xNameAccess, CGExporter exporter)
+ throws NoSuchElementException,
+ WrappedTargetException
+ {
+ if (!exporter.cp_TargetType.equals(""))
+ {
+ exporter.targetTypeName =
+ (String) Properties.getPropertyValue(
+ (PropertyValue[]) xNameAccess.getByName(exporter.cp_TargetType),
+ "UIName");
+ }
+ }
+ FileAccess fileAccess;
+
+ FileAccess getFileAccess() throws Exception
+ {
+ return getFileAccess(xmsf);
+ }
+
+ FileAccess getFileAccess(XMultiServiceFactory xmsf) throws Exception
+ {
+ if (fileAccess == null)
+ {
+ fileAccess = new FileAccess(xmsf);
+ }
+ return fileAccess;
+ }
+
+ public class Formatter
+ {
+
+ private long docNullTime;
+ private int dateFormat, numberFormat;
+ private DateUtils dateUtils;
+
+ 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);
+ }
+
+ 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 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
new file mode 100644
index 000000000000..e6258d8c5fe1
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/CGStyle.java
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.data;
+
+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 toString()
+ {
+ return cp_Name;
+ }
+
+ public String getBackgroundUrl()
+ {
+ if (cp_BackgroundImage == null || cp_BackgroundImage.equals(""))
+ {
+ return null;
+ }
+ else
+ {
+ 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
new file mode 100644
index 000000000000..06c11a06178e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/ConfigSetItem.java
@@ -0,0 +1,55 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.*;
+
+/**
+ *
+ * @author rpiterman
+ */
+public class ConfigSetItem extends ConfigGroup implements Indexable
+{
+
+ public int cp_Index = -1;
+
+ public int getIndex()
+ {
+ return cp_Index;
+ }
+
+ 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
new file mode 100644
index 000000000000..d6998ac74814
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/TypeDetection.java
@@ -0,0 +1,79 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+{
+
+ /**
+ * a document which will open in writer.
+ */
+ public final static String WRITER_DOC = "writer";
+ /**
+ * a document which will open in calc.
+ */
+ public final static String CALC_DOC = "calc";
+ /**
+ * a document which will open in impress.
+ */
+ public final static String IMPRESS_DOC = "impress";
+ /**
+ * a document which will open in draw.
+ */
+ public final static String DRAW_DOC = "draw";
+ /**
+ * an HTML document
+ */
+ public final static String HTML_DOC = "html";
+ /**
+ * a GIF or an JPG file.
+ */
+ public final static String WEB_GRAPHICS = "graphics";
+ /**
+ * a PDF document.
+ */
+ public final static String PDF_DOC = "pdf";
+ /**
+ * a Sound file (mp3/wav ect.)
+ */
+ 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";
+}
diff --git a/wizards/com/sun/star/wizards/web/data/makefile.mk b/wizards/com/sun/star/wizards/web/data/makefile.mk
new file mode 100644
index 000000000000..1bfc02cf8351
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/data/makefile.mk
@@ -0,0 +1,74 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = web_data
+PACKAGE = com$/sun$/star$/wizards$/web$/data
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar jut.jar java_uno.jar java_uno_accessbridge commonwizards.jar
+
+.IF "$(SYSTEM_SAXON)" == "YES"
+EXTRAJARFILES = $(SAXON_JAR)
+.ELSE
+JARFILES += saxon9.jar
+.ENDIF
+
+#JARCLASSDIRS = com$/sun$/star$/wizards$/web
+#JARTARGET = $(TARGET).jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ CGArgument.java \
+ CGContent.java \
+ CGDesign.java \
+ CGDocument.java \
+ CGExporter.java \
+ CGFilter.java \
+ CGGeneralInfo.java \
+ CGIconSet.java \
+ CGImage.java \
+ CGLayout.java \
+ CGPublish.java \
+ CGSession.java \
+ CGSessionName.java \
+ CGSettings.java \
+ CGStyle.java \
+ ConfigSetItem.java \
+ TypeDetection.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java
new file mode 100644
index 000000000000..97b1109add01
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java
@@ -0,0 +1,192 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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;
+import com.sun.star.document.MacroExecMode;
+import com.sun.star.document.UpdateDocMode;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XStorable;
+import com.sun.star.io.IOException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XCloseable;
+import com.sun.star.wizards.common.Desktop;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.document.OfficeDocument;
+import com.sun.star.wizards.text.TextDocument;
+import com.sun.star.wizards.web.data.CGArgument;
+import com.sun.star.wizards.web.data.CGDocument;
+import com.sun.star.wizards.web.data.CGExporter;
+import com.sun.star.wizards.web.data.TypeDetection;
+
+/**
+ *
+ * @author rpiterman
+ */
+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);
+
+ 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
+ {
+
+ storeToURL(officeDocument, new Properties(), targetUrl, filterName, filterData);
+ }
+
+ protected void storeToURL(Object officeDocument, String targetUrl, String filterName)
+ throws IOException
+ {
+
+ 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 Object openDocument(CGDocument doc, XMultiServiceFactory xmsf)
+ throws com.sun.star.io.IOException
+ {
+ Object document = null;
+ //open the document.
+ 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)
+ {
+ }
+ //try to get the number of pages in the document;
+ try
+ {
+ pageCount(doc, document);
+ }
+ catch (Exception ex)
+ {
+ //Here i do nothing since pages is not *so* important.
+ }
+ return document;
+ }
+
+ 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);
+ xc.close(false);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ 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_)
+ {
+ exporter = exporter_;
+ }
+
+ protected FileAccess getFileAccess(XMultiServiceFactory xmsf)
+ {
+ if (fileAccess == null)
+ {
+ try
+ {
+ fileAccess = new FileAccess(xmsf);
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ return fileAccess;
+ }
+
+ 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
new file mode 100644
index 000000000000..de13a8c31bbe
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/export/ConfiguredExporter.java
@@ -0,0 +1,98 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.web.export;
+
+import java.util.Iterator;
+
+import com.sun.star.wizards.web.data.CGArgument;
+import com.sun.star.wizards.web.data.CGExporter;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+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)
+ {
+ super.init(exporter);
+ for (Iterator i = exporter.cp_Arguments.keys().iterator(); i.hasNext();)
+ {
+ Object key = i.next();
+ if (!key.equals("Filter"))
+ {
+ Object value = exporter.cp_Arguments.getElement(key);
+ props.put(key, cast(((CGArgument) value).cp_Value));
+ }
+ }
+ }
+
+ 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;
+ }
+ return null;
+ }
+}
+
diff --git a/wizards/com/sun/star/wizards/web/export/CopyExporter.java b/wizards/com/sun/star/wizards/web/export/CopyExporter.java
new file mode 100644
index 000000000000..f620e3b106d3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/export/CopyExporter.java
@@ -0,0 +1,88 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.web.export;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.ui.event.Task;
+import com.sun.star.wizards.web.data.CGDocument;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+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
+ {
+ task.advance(true);
+
+
+ /*
+ * this will open the document, and calculate the pages/slides number
+ * in it.
+ */
+ if (exporter.cp_PageType > 0)
+ {
+ closeDocument(openDocument(source, xmsf), xmsf);
+ }
+
+ task.advance(true);
+
+ String newTarget = FileAccess.connectURLs(
+ FileAccess.getParentDir(target), source.urlFilename);
+
+ boolean b = getFileAccess(xmsf).copy(source.cp_URL, newTarget);
+
+ task.advance(true);
+
+ calcFileSize(source, newTarget, xmsf);
+
+ return b;
+
+ }
+ 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
new file mode 100644
index 000000000000..90f145cf1241
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/export/Exporter.java
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.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
+{
+
+ /**
+ * This method exports a document with a specified filter.<br/>
+ * The method is responsible for exporting the given source document
+ * to the given target directory.
+ * The exporter *must* also set the given CGDocument sizeBytes field to the
+ * size of the converted document, *if* the target document is
+ * of a binary format.
+ * always use source.urlFilename as destination filename.
+ * @param source is a CGDocument object.
+ * @param target contains the URL of a directory to which the
+ * file should be exported to.
+ * @param xmsf this is a basic multiServiceFactory.
+ * @param task - a task monitoring object. This should advance
+ * (call task.advacne(true) ) 3 times, while exporting.
+ *
+ */
+ 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
new file mode 100644
index 000000000000..8ff666d5ec87
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/export/FilterExporter.java
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.export;
+
+import com.sun.star.io.IOException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.wizards.common.Properties;
+import com.sun.star.wizards.ui.event.Task;
+import com.sun.star.wizards.web.data.CGDocument;
+import com.sun.star.wizards.web.data.CGExporter;
+
+/**
+ * @author rpiterman
+ *
+ * An exporter which is configured with a filter name, and
+ * uses the specified filter to export documents.
+ */
+public class FilterExporter extends AbstractExporter
+{
+
+ protected String filterName;
+ protected Properties props = new Properties();
+
+ /* (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
+ {
+
+ boolean result = true;
+ Object document = null;
+
+ try
+ {
+ document = openDocument(source, xmsf);
+ task.advance(true);
+ storeToURL(document, target, filterName, props.getProperties());
+ task.advance(true);
+
+ }
+ catch (IOException iox)
+ {
+ iox.printStackTrace(System.out);
+ result = false;
+ throw iox;
+ }
+ finally
+ {
+ closeDocument(document, xmsf);
+ calcFileSize(source, target, xmsf);
+ task.advance(true);
+ }
+ return result;
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.web.export.Exporter#init(com.sun.star.wizards.web.data.CGExporter)
+ */
+ public void init(CGExporter exporter_)
+ {
+ super.init(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
new file mode 100644
index 000000000000..07a79e15040e
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.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.CGDocument;
+import com.sun.star.wizards.web.data.CGSession;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+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
+ {
+
+ /* here set some filter specific properties.
+ * other properties, which are not dependant on
+ * user input are set through the exporter
+ * configuration.
+ */
+
+ 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("Width", getImageWidth(session));
+
+ /*
+ * props.put("BackColor",...);
+ * props.put("TextColor",...);
+ * props.put("LinkColor",...);
+ * props.put("VLinkColor",...);
+ * props.put("ALinkColor",...);
+ */
+ props.put("UseButtonSet", new Integer(session.cp_Design.cp_IconSet));
+
+
+ //now export
+ return super.export(source, targetDirectory, xmsf, task);
+
+ }
+
+ private String getHomepageURL(CGSession session)
+ {
+ return "../" +
+ (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;
+ }
+ return MEDIUM_IMAGE;
+ }
+
+ private CGSession getSession(CGDocument doc)
+ {
+ return doc.getSettings().cp_DefaultSession;
+ }
+}
diff --git a/wizards/com/sun/star/wizards/web/export/makefile.mk b/wizards/com/sun/star/wizards/web/export/makefile.mk
new file mode 100644
index 000000000000..46cd65044e81
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/export/makefile.mk
@@ -0,0 +1,63 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = web_export
+PACKAGE = com$/sun$/star$/wizards$/web$/export
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar java_uno.jar java_uno_accessbridge commonwizards.jar
+
+.IF "$(SYSTEM_SAXON)" == "YES"
+EXTRAJARFILES = $(SAXON_JAR)
+.ELSE
+JARFILES += saxon9.jar
+.ENDIF
+
+#JARCLASSDIRS = com$/sun$/star$/wizards$/web
+#JARTARGET = $(TARGET).jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ AbstractExporter.java \
+ ConfiguredExporter.java \
+ CopyExporter.java \
+ Exporter.java \
+ FilterExporter.java \
+ ImpressHTMLExporter.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/web/makefile.mk b/wizards/com/sun/star/wizards/web/makefile.mk
new file mode 100644
index 000000000000..9cc97e1b88ab
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..$/..
+PRJNAME = wizards
+TARGET = web
+PACKAGE = com$/sun$/star$/wizards$/web
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/util$/makefile.pmk
+JARFILES= unoil.jar jurt.jar ridl.jar juh.jar jut.jar java_uno.jar java_uno_accessbridge commonwizards.jar
+
+.IF "$(SYSTEM_SAXON)" == "YES"
+EXTRAJARFILES = $(SAXON_JAR)
+.ELSE
+JARFILES += saxon9.jar
+.ENDIF
+
+CUSTOMMANIFESTFILE= MANIFEST.MF
+
+JARCLASSDIRS = com$/sun$/star$/wizards$/web
+JARTARGET = web.jar
+JARCLASSPATH = \
+ commonwizards.jar saxon9.jar
+
+# --- Files --------------------------------------------------------
+
+JAVAFILES= \
+ AbstractErrorHandler.java \
+ BackgroundsDialog.java \
+ CallWizard.java \
+ ErrorHandler.java \
+ ExtensionVerifier.java \
+ FTPDialog.java \
+ FTPDialogResources.java \
+ IconsDialog.java \
+ ImageListDialog.java \
+ LogTaskListener.java \
+ Process.java \
+ ProcessErrorHandler.java \
+ ProcessErrors.java \
+ ProcessStatusRenderer.java \
+ StatusDialog.java \
+ StylePreview.java \
+ TOCPreview.java \
+ WebWizard.java \
+ WebWizardConst.java \
+ WebWizardDialog.java \
+ WebWizardDialogResources.java \
+ WWD_Events.java \
+ WWD_General.java \
+ WWD_Startup.java \
+ WWHID.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/com/sun/star/wizards/web/status/ErrorLog.java b/wizards/com/sun/star/wizards/web/status/ErrorLog.java
new file mode 100644
index 000000000000..d039fa5c64a3
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/status/ErrorLog.java
@@ -0,0 +1,69 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.web.status;
+
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+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 class Err
+ {
+
+ public Exception exception;
+ public Object argument;
+ public String string;
+
+ 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
new file mode 100644
index 000000000000..4d967e24f3df
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/status/ErrorReporter.java
@@ -0,0 +1,46 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.web.status;
+
+/**
+ * @author rpiterman
+ *
+ * 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);
+}
diff --git a/wizards/com/sun/star/wizards/web/status/LogTaskListener.java b/wizards/com/sun/star/wizards/web/status/LogTaskListener.java
new file mode 100644
index 000000000000..d4109da3406f
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/status/LogTaskListener.java
@@ -0,0 +1,87 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.web.status;
+
+import java.io.PrintStream;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class LogTaskListener implements TaskListener
+{
+
+ private PrintStream out;
+
+ 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.");
+
+ }
+
+ /* (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.");
+
+ }
+
+ /* (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());
+ }
+
+ /* (non-Javadoc)
+ * @see com.sun.star.wizards.web.status.TaskListener#subtaskNameChanged(com.sun.star.wizards.web.status.TaskEvent)
+ */
+ 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
new file mode 100644
index 000000000000..0fb0bf494286
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/status/Task.java
@@ -0,0 +1,196 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.web.status;
+
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * @author rpiterman
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+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_)
+ {
+ taskName = taskName_;
+ subtaskName = subtaskName_;
+ max = max_;
+ }
+
+ public void start()
+ {
+ fireTaskStarted();
+ }
+
+ public int getMax()
+ {
+ return max;
+ }
+
+ public void setMax(int max_)
+ {
+ max = max_;
+ fireTaskStatusChanged();
+ }
+
+ public void advance(boolean success_)
+ {
+ if (success_)
+ {
+ successfull++;
+ }
+ else
+ {
+ failed++;
+ }
+ fireTaskStatusChanged();
+ if (failed + successfull == max)
+ {
+ fireTaskFinished();
+ }
+ }
+
+ public void advance(boolean success_, String nextSubtaskName)
+ {
+ advance(success_);
+ setSubtaskName(nextSubtaskName);
+ }
+
+ public int getStatus()
+ {
+ return successfull + failed;
+ }
+
+ public void addTaskListener(TaskListener tl)
+ {
+ listeners.add(tl);
+ }
+
+ public void removeTaskListener(TaskListener tl)
+ {
+ listeners.remove(tl);
+ }
+
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+
+ /**
+ * @return
+ */
+ public String getSubtaskName()
+ {
+ return subtaskName;
+ }
+
+ /**
+ * @return
+ */
+ public String getTaskName()
+ {
+ return taskName;
+ }
+
+ /**
+ * @param string
+ */
+ public void setSubtaskName(String string)
+ {
+ subtaskName = string;
+ fireSubtaskNameChanged();
+ }
+
+ /**
+ * @return
+ */
+ public int getFailed()
+ {
+ return failed;
+ }
+
+ /**
+ * @return
+ */
+ 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
new file mode 100644
index 000000000000..dd1d06c1938a
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/status/TaskEvent.java
@@ -0,0 +1,71 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.web.status;
+
+import java.util.EventObject;
+
+/**
+ * @author rpiterman
+ *
+ * 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 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;
+
+ /**
+ * general constructor-
+ * @param source
+ * @param type_
+ * @param max_
+ * @param success_
+ * @param failed_
+ */
+ public TaskEvent(Task source, int type_)
+ {
+ super(source);
+ type = type_;
+ }
+
+ 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
new file mode 100644
index 000000000000..63745bf83a62
--- /dev/null
+++ b/wizards/com/sun/star/wizards/web/status/TaskListener.java
@@ -0,0 +1,58 @@
+/*
+ ************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sun.star.wizards.web.status;
+
+import java.util.EventListener;
+
+/**
+ * @author rpiterman
+ *
+ * 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 void taskStarted(TaskEvent te);
+
+ public void taskFinished(TaskEvent te);
+
+ /**
+ * is called when the status of the task has advanced.
+ * @param te
+ */
+ public void taskStatusChanged(TaskEvent te);
+
+ public void subtaskNameChanged(TaskEvent te);
+}
diff --git a/wizards/prj/build.lst b/wizards/prj/build.lst
new file mode 100644
index 000000000000..c4d635a921a8
--- /dev/null
+++ b/wizards/prj/build.lst
@@ -0,0 +1,28 @@
+wz wizards : l10n rsc javaunohelper unoil NULL
+wz wizards\util nmake - all wz_util NULL
+wz wizards\source\config nmake - all wz_config NULL
+wz wizards\source\configshare nmake - all wz_configshare NULL
+wz wizards\source\imagelists nmake - all wz_imglists NULL
+wz wizards\source\euro nmake - all wz_eurowiz NULL
+wz wizards\source\formwizard nmake - all wz_reswiz NULL
+wz wizards\source\gimmicks nmake - all wz_gimmickswz NULL
+wz wizards\source\importwizard nmake - all wz_importwiz NULL
+wz wizards\source\schedule nmake - all wz_schedulewiz NULL
+wz wizards\source\template nmake - all wz_templatewiz NULL
+wz wizards\source\tools nmake - all wz_toolswiz NULL
+wz wizards\source\depot nmake - all wz_depot NULL
+wz wizards\source\tutorials nmake - all wz_tutorials NULL
+wz wizards\source\standard nmake - all wz_standard NULL
+wz wizards\com\sun\star\wizards nmake - all wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\query nmake - all wz_querywiz wz_formwiz wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\report nmake - all wz_reportwiz wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\reportbuilder\layout nmake - all wz_rptlayoutwiz wz_reportwiz NULL
+wz wizards\com\sun\star\wizards\reportbuilder nmake - all wz_rptbldwiz wz_rptlayoutwiz NULL
+wz wizards\com\sun\star\wizards\table nmake - all wz_tablewiz wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\form nmake - all wz_formwiz wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\letter nmake - all wz_letterwiz wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\fax nmake - all wz_faxwiz wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\agenda nmake - all wz_agendawiz wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\web\data nmake - all wz_webdata wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\web\export nmake - all wz_webexport wz_webdata wz_commonwiz NULL
+wz wizards\com\sun\star\wizards\web nmake - all wz_webwiz wz_webexport NULL
diff --git a/wizards/prj/d.lst b/wizards/prj/d.lst
new file mode 100644
index 000000000000..4d1ad83d1c42
--- /dev/null
+++ b/wizards/prj/d.lst
@@ -0,0 +1,15 @@
+mkdir: %COMMON_DEST%\bin%_EXT%\hid
+mkdir: %_DEST%\pck%_EXT%
+..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
+..\%__SRC%\bin\*.zip %_DEST%\pck%_EXT%\*.zip
+ ..\%__SRC%\bin\wzi*.res %_DEST%\bin%_EXT%\wzi*.res
+..\%__SRC%\bin\dbw*.res %_DEST%\bin%_EXT%\dbw*.res
+..\%__SRC%\bin\tpl*.res %_DEST%\bin%_EXT%\tpl*.res
+..\%__SRC%\bin\imp*.res %_DEST%\bin%_EXT%\imp*.res
+..\%__SRC%\bin\wwz*.res %_DEST%\bin%_EXT%\wwz*.res
+..\%__SRC%\bin\eur*.res %_DEST%\bin%_EXT%\eur*.res
+..\%__SRC%\bin\cal*.res %_DEST%\bin%_EXT%\cal*.res
+..\%__SRC%\bin\com*.res %_DEST%\bin%_EXT%\com*.res
+REM ..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
+
+..\%__SRC%\class\*.jar %_DEST%\bin%_EXT%\*.jar
diff --git a/wizards/source/config/delzip b/wizards/source/config/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/config/delzip
diff --git a/wizards/source/config/dialog.xlc b/wizards/source/config/dialog.xlc
new file mode 100644
index 000000000000..34064e83e5e7
--- /dev/null
+++ b/wizards/source/config/dialog.xlc
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd">
+<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <library:library library:name="Standard" library:link="false"/>
+</library:libraries>
diff --git a/wizards/source/config/makefile.mk b/wizards/source/config/makefile.mk
new file mode 100644
index 000000000000..42ec8d468782
--- /dev/null
+++ b/wizards/source/config/makefile.mk
@@ -0,0 +1,52 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+
+
+PRJNAME=wizards
+TARGET=configall
+
+.INCLUDE : settings.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+
+
+ZIP1TARGET = $(CONFIG_ALL_TARGET)
+
+ZIP1LIST = * -x makefile.*
+
+
+
+
+.INCLUDE : target.mk
+
+
+
+
+
diff --git a/wizards/source/config/script.xlc b/wizards/source/config/script.xlc
new file mode 100644
index 000000000000..34064e83e5e7
--- /dev/null
+++ b/wizards/source/config/script.xlc
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd">
+<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <library:library library:name="Standard" library:link="false"/>
+</library:libraries>
diff --git a/wizards/source/configshare/delzip b/wizards/source/configshare/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/configshare/delzip
diff --git a/wizards/source/configshare/dialog.xlc b/wizards/source/configshare/dialog.xlc
new file mode 100644
index 000000000000..b63ebd6d71d2
--- /dev/null
+++ b/wizards/source/configshare/dialog.xlc
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd">
+<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <library:library library:name="FormWizard" xlink:href="$(INST)/share/basic/FormWizard/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Template" xlink:href="$(INST)/share/basic/Template/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Tools" xlink:href="$(INST)/share/basic/Tools/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Schedule" xlink:href="$(INST)/share/basic/Schedule/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Gimmicks" xlink:href="$(INST)/share/basic/Gimmicks/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="ImportWizard" xlink:href="$(INST)/share/basic/ImportWizard/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Euro" xlink:href="$(INST)/share/basic/Euro/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Depot" xlink:href="$(INST)/share/basic/Depot/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="ScriptBindingLibrary" xlink:href="$(INST)/share/basic/ScriptBindingLibrary/dialog.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+</library:libraries> \ No newline at end of file
diff --git a/wizards/source/configshare/makefile.mk b/wizards/source/configshare/makefile.mk
new file mode 100644
index 000000000000..c86f66fb8a76
--- /dev/null
+++ b/wizards/source/configshare/makefile.mk
@@ -0,0 +1,52 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+
+
+PRJNAME=wizards
+TARGET=configshare
+
+.INCLUDE : settings.mk
+
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+
+
+ZIP1TARGET = $(CONFIG_SHARE_TARGET)
+
+ZIP1LIST = * -x makefile.*
+
+
+
+
+.INCLUDE : target.mk
+
+
+
+
+
diff --git a/wizards/source/configshare/script.xlc b/wizards/source/configshare/script.xlc
new file mode 100644
index 000000000000..aaf1b0d9303e
--- /dev/null
+++ b/wizards/source/configshare/script.xlc
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd">
+<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <library:library library:name="FormWizard" xlink:href="$(INST)/share/basic/FormWizard/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Template" xlink:href="$(INST)/share/basic/Template/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Tools" xlink:href="$(INST)/share/basic/Tools/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Schedule" xlink:href="$(INST)/share/basic/Schedule/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Gimmicks" xlink:href="$(INST)/share/basic/Gimmicks/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="ImportWizard" xlink:href="$(INST)/share/basic/ImportWizard/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Euro" xlink:href="$(INST)/share/basic/Euro/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="Depot" xlink:href="$(INST)/share/basic/Depot/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+ <library:library library:name="ScriptBindingLibrary" xlink:href="$(INST)/share/basic/ScriptBindingLibrary/script.xlb/" xlink:type="simple" library:link="true" library:readonly="false"/>
+</library:libraries> \ No newline at end of file
diff --git a/wizards/source/depot/CommonLang.xba b/wizards/source/depot/CommonLang.xba
new file mode 100644
index 000000000000..a1cb283dab14
--- /dev/null
+++ b/wizards/source/depot/CommonLang.xba
@@ -0,0 +1,351 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="CommonLang" script:language="StarBasic">REM ***** BASIC *****
+
+
+&apos; Column A has the index 1
+Public Const SBCOLUMNNAME1 = 3 &apos; Stock names, sheet 1
+Public Const SBCOLUMNID1 = 4 &apos; Stock ID, sheet 1
+Public Const SBCOLUMNQUANTITY1 = 5 &apos; Stock quantity sheet 1
+Public Const SBCOLUMNRATE1 = 7 &apos; Price for stocks, sheet 1
+Public Const SBCOLUMNNAME2 = 3 &apos; Stock names, sheet 2
+Public Const SBCOLUMNDATE2 = 4 &apos; Transaction dates, sheet 2
+Public Const SBCOLUMNQUANTITY2 = 5 &apos; Transaction quantity, sheet 2
+Public Const SBCOLUMNRATE2 = 6 &apos; Price for stocks, sheet 2
+Public Const SBCOLUMNPROVPERCENT2 = 7 &apos; Provision in %, sheet 2
+Public Const SBCOLUMNPROVMIN2 = 8 &apos; Minimum provision, sheet 2
+Public Const SBCOLUMNPROVFIX2 = 9 &apos; Fixed provision, sheet 2
+Public Const SBCOLUMNPROCEEDS2 = 12 &apos; Profit, sheet 2
+Public Const SBCOLUMNQTYSOLD2 = 14 &apos; Quantity sold, sheet 2
+Public Const SBCOLUMNQTYREST2 = 15 &apos; Quantity not sold yet, sheet 2
+Public Const SBCOLUMNPRCREST2 = 16 &apos; Proportional proce for quantity not sold yet, sheet 2
+Public Const SBCOLUMNREALPROC2 = 17 &apos; Realized proceeds, sheet 2
+Public Const SBCOLUMNDIVIDEND2 = 18 &apos; Dividend paid, sheet 2
+Public Const SBCOLUMNREALPROFIT2 = 19 &apos; Realized profit, sheet 2
+Public Const SBROWFIRSTTRANSACT2 = 8 &apos; First data row, sheet 2
+Public Const SBROWHEADER1 = 6 &apos; Headline, sheet 1
+Public Const SBMSGOK = 0
+Public Const SBMSGYESNO = 4
+Public Const SBMSGSTOP = 16
+Public Const SBMSGQUESTION = 32
+Public Const SBMSGDEFAULTBTN2 = 256
+Public Const SBHASID = 1 &apos; 0 = no ID, 1 = stocks have an ID
+Public Const SBDIALOGSELL = 1 &apos; Step for main dialog
+Public Const SBDIALOGBUY = 2 &apos; Step for main dialog
+Public Const SBBINARY = 0
+Public TransactMode as Integer
+Public Const LIFO = -1
+Public Const FIFO = 1
+
+Public Const HANDLEDIVIDEND = 1
+Public Const HANDLESPLIT = 2
+
+Global oDocument as Object
+Global oDocFormats() as Object
+Global oController as Object
+Global oFirstSheet as Object
+Global oBankSheet as Object
+Global oMovementSheet as Object
+Global sDocLanguage as String
+Global sDocCountry as String
+Global oSheets as Object
+Global oDocLocale as New com.sun.star.lang.Locale
+Global bEnableMarket as Boolean
+Global bEnableInternet as Boolean
+Global oMarketModel as Object
+Global oInternetModel as Object
+
+Global sCurCurrency$, sCurExtension$, sCurChartSource$, sCurStockIDLabel$, sCurSeparator$
+
+Public oNumberFormatter as Object
+Public bDebugmode as Boolean
+Global GlobListindex as Integer
+Public blabla() as String
+Public SplitDate as Date
+Public oChartSheet as Object
+Public oBackgroundSheet as Object
+Public Const SBDATECOLUMN = 3
+Public Const SBVALUECOLUMN = 4
+Public Const SBSTARTROW = 25
+Public Const SBCHARTPERIOD = 14
+Public Const SBINTERVAL = &quot;d&quot;
+Public sColumnHeader as String
+Public StartDate as Date
+Public EndDate as Date
+Public iCurRow as Integer
+Public iMaxRow as Integer
+Public iStartDay as Integer
+Public iStartMonth as Integer
+Public iStartYear as Integer
+Public iEndDay as Integer
+Public iEndMonth as Integer
+Public iEndYear as Integer
+Public oStatusLine as Object
+Public Today as Date
+Public sInterval as String
+Public ShortMonths(11,1)
+Public iStep as Integer
+Public sDepotCurrency as String
+Public iValueCol as Integer
+
+Public DlgReference as Object
+Public DlgTransaction as Object
+Public DlgStockRates as Object
+Public DlgStartUp as Object
+Public TransactModel as Object
+Public StockRatesModel as Object
+Public StartUpModel as Object
+Public StockRatesTitle(1 To 3)
+Public TransactTitle(1 To 2)
+Public NullList()
+Public sStartupWelcome$, sStartupChooseMarket$, sStartupHint$
+
+Public sMarket(7,10) as String
+Public sCountryMarket(7,10) as String
+
+Public cDlgCaption1$, cDlgCaption2$
+Public sMsgError$, sMsgNoName$, sMsgNoQuantity$, sMsgNoDividend$, sMsgNoExchangeRate$
+Public sMsgNoValidExchangeDate$, sMsgWrongExchangeDate$, sMsgSellTooMuch$, sMsgConfirm$
+Public sMsgFreeStock$, sMsgTotalLoss$, sMsgEndDatebeforeNow$, sMsgStartDatebeforeEndDate$
+
+Public sOk$, sCancel$
+Public sMsgAuthorization$, sMsgDeleteAll$
+Public SellMethod$
+Public cSplit$
+Global HistoryChartSource as String
+Public DateCellStyle as String
+Public CurrCellStyle as String
+Public sStartDate$, sEndDate$, sHistory$
+Public sInsertStockname$
+Public sProductname$, sTitle$
+Public sInsertStocks$, sStockname$, sNoInternetUpdate$, sMarketplace$, sNoInternetDataAvailable$
+Public sCheckInternetSettings as String
+
+Sub LoadLanguage()
+ LoadDepotDialogs()
+ Select Case sDocLanguage
+ Case &quot;de&quot;
+ LoadGermanLanguage()
+ Case &quot;en&quot;
+ LoadEnglishLanguage()
+ Case &quot;fr&quot;
+ LoadFrenchLanguage()
+ Case &quot;it&quot;
+ LoadItalianLanguage()
+ Case &quot;es&quot;
+ LoadSpanishLanguage()
+ Case &quot;sv&quot;
+ LoadSwedishLanguage()
+ Case &quot;ja&quot;
+ LoadJapaneseLanguage()
+ Case &quot;ko&quot;
+ LoadKoreanLanguage()
+ Case &quot;zh&quot;
+ If sDocCountry = &quot;CN&quot; Then
+ LoadChineseSimpleLanguage()
+ Else
+ LoadChineseTradLanguage()
+ End If
+ End Select
+ InitializeStartUpModel()
+End Sub
+
+Sub CompleteMarketList()
+Dim EuroIndex as Integer
+Dim LocCountry as String
+Dim LocLanguage as String
+Dim sLangList() as String
+Dim sCountryList() as String
+Dim sExtensionList() as String
+Dim MaxIndex as Integer
+Dim bIsLocale as Boolean
+
+ GlobListIndex = -1
+ For n = 0 To 5
+ LocLanguage = sMarket(n,6)
+ LocCountry = sMarket(n,7)
+ If Instr(1,LocLanguage,&quot;;&quot;,SBBINARY) = 0 Then
+ bIsLocale = CheckDocLocale(LocLanguage, LocCountry)
+ Else
+ EuroIndex = 0
+ sLangList() = ArrayoutofString(LocLanguage, &quot;;&quot;, MaxIndex)
+ sCountryList() = ArrayoutofString(LocCountry, &quot;;&quot;, MaxIndex)
+ sExtensionList() = ArrayoutofString(sMarket(n,8), &quot;;&quot;, MaxIndex)
+ For m = 0 To MaxIndex
+ bIsLocale = CheckDocLocale(sLangList(m), sCountryList(m))
+ If bIsLocale Then
+ EuroIndex = m
+ Exit For
+ End If
+ Next m
+ sMarket(n,6) = sLangList(EuroIndex)
+ sMarket(n,7) = sCountryList(EuroIndex)
+ sMarket(n,8) = sExtensionList(EuroIndex)
+ End If
+ If bIsLocale Then
+ GlobListIndex = n
+ Exit For
+ End If
+ Next n
+End Sub
+
+Sub LocalizedCurrencies()
+ If GlobListIndex = -1 Then
+ sCountryMarket(0,0) = &quot;Euro&quot;
+ sCountryMarket(0,1) = chr(8364)
+ sCountryMarket(0,2) = &quot;Paris&quot;
+ sCountryMarket(0,3) = &quot;http://fr.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.PA&amp;f=s4l1t1c1ghov&amp;e=.csv&quot;
+ sCountryMarket(0,5) = &quot;Code&quot;
+ sCountryMarket(0,6) = &quot;fr&quot;
+ sCountryMarket(0,7) = &quot;FR&quot;
+ sCountryMarket(0,8) = &quot;40C&quot;
+ sCountryMarket(0,9) = &quot;59/9&quot;
+ sCountryMarket(0,10) = &quot;1&quot;
+
+ sCountryMarket(1,0) = &quot;Euro&quot;
+ sCountryMarket(1,1) = chr(8364)
+ sCountryMarket(1,2) = &quot;Milano&quot;
+ sCountryMarket(1,3) = &quot;http://it.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.MI&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sCountryMarket(1,5) = &quot;Codice&quot;
+ sCountryMarket(1,6) = &quot;it&quot;
+ sCountryMarket(1,7) = &quot;IT&quot;
+ sCountryMarket(1,8) = &quot;410&quot;
+ sCountryMarket(1,9) = &quot;44&quot;
+ sCountryMarket(1,10) = &quot;1&quot;
+
+ sCountryMarket(2,0) = &quot;Euro&quot;
+ sCountryMarket(2,1) = chr(8364)
+ sCountryMarket(2,2) = &quot;Madrid&quot;
+ sCountryMarket(2,3) = &quot;http://es.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;m=MC&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sCountryMarket(2,5) = &quot;Simbolo&quot;
+ sCountryMarket(2,6) = &quot;es&quot;
+ sCountryMarket(2,7) = &quot;ES&quot;
+ sCountryMarket(2,8) = &quot;40A&quot;
+ sCountryMarket(2,9) = &quot;44&quot;
+ sCountryMarket(2,10) = &quot;1&quot;
+
+ sCountryMarket(3,0) = &quot;Dansk krone&quot;
+ sCountryMarket(3,1) = &quot;kr&quot;
+ sCountryMarket(3,2) = &quot;København&quot;
+ sCountryMarket(3,3) = &quot;http://dk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID.CO&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sCountryMarket(3,5) = &quot;Aktiesymbol&quot;
+ sCountryMarket(3,6) = &quot;da&quot;
+ sCountryMarket(3,7) = &quot;DK&quot;
+ sCountryMarket(3,8) = &quot;406&quot;
+ sCountryMarket(3,9) = &quot;44&quot;
+ sCountryMarket(3,10) = &quot;1&quot;
+
+ sCountryMarket(4,0) = &quot;Svensk krona&quot;
+ sCountryMarket(4,1) = &quot;kr&quot;
+ sCountryMarket(4,2) = &quot;Stockholm&quot;
+ sCountryMarket(4,3) = &quot;http://se.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;f=sl1d1t1c1ohgv&amp;e=.c&quot;
+ sCountryMarket(4,5) = &quot;Kod&quot;
+ sCountryMarket(4,6) = &quot;sv&quot;
+ sCountryMarket(4,7) = &quot;SE&quot;
+ sCountryMarket(4,8) = &quot;41D&quot;
+ sCountryMarket(4,9) = &quot;44&quot;
+ sCountryMarket(4,10) = &quot;1&quot;
+
+ &apos; Taiwan Dollar
+ sCountryMarket(5,0) = &quot;新臺幣&quot;
+ sCountryMarket(5,1) = &quot;¥&quot;
+ sCountryMarket(5,2) = &quot;代號&quot;
+ sCountryMarket(5,3) = &quot;http://tw.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.TW&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sCountryMarket(5,5) = &quot;代號&quot;
+ sCountryMarket(5,6) = &quot;zh&quot;
+ sCountryMarket(5,7) = &quot;TW&quot;
+ sCountryMarket(5,8) = &quot;404&quot;
+ sCountryMarket(5,9) = &quot;44&quot;
+ sCountryMarket(5,10) = &quot;1&quot;
+
+ &apos; Chinese Yuan
+ sCountryMarket(6,0) = &quot;人民币&quot;
+ sCountryMarket(6,1) = &quot;¥&quot;
+ sCountryMarket(6,2) = &quot;代号&quot;
+ sCountryMarket(6,3) = &quot;http://cn.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.SS&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sCountryMarket(6,5) = &quot;代号&quot;
+ sCountryMarket(6,6) = &quot;zh&quot;
+ sCountryMarket(6,7) = &quot;CN&quot;
+ sCountryMarket(6,8) = &quot;804&quot;
+ sCountryMarket(6,9) = &quot;44&quot;
+ sCountryMarket(6,10) = &quot;1&quot;
+
+ &apos; korean Won
+ sCountryMarket(7,0) = &quot;한국 원화&quot;
+ sCountryMarket(7,1) = &quot;₩&quot;
+ sCountryMarket(7,2) = &quot;서울&quot;
+ sCountryMarket(7,3) = &quot;http://kr.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.KS&amp;f=snl1d1t1c1ohgv&amp;e=.csv&quot;
+ sCountryMarket(7,5) = &quot;종목 코드&quot;
+ sCountryMarket(7,6) = &quot;ko&quot;
+ sCountryMarket(7,7) = &quot;KR&quot;
+ sCountryMarket(7,8) = &quot;412&quot;
+ sCountryMarket(7,9) = &quot;44&quot;
+ sCountryMarket(7,10) = &quot;2&quot;
+
+
+&apos; sCountryMarket(5,0) = &quot;Российский рубль&quot;
+&apos; sCountryMarket(5,1) = &quot;р.&quot;
+&apos; sCountryMarket(5,2) = &quot;&quot;
+&apos; sCountryMarket(5,3) = &quot;&quot;
+&apos; sCountryMarket(5,5) = &quot;&quot;
+&apos; sCountryMarket(5,6) = &quot;ru&quot;
+&apos; sCountryMarket(5,7) = &quot;RU&quot;
+&apos; sCountryMarket(5,8) = &quot;-419&quot;
+&apos; sCountryMarket(5,9) = &quot;&quot;
+&apos;
+&apos; sCountryMarket(6,0) = &quot;Złoty polski&quot;
+&apos; sCountryMarket(6,1) = &quot;zł&quot;
+&apos; sCountryMarket(6,2) = &quot;&quot;
+&apos; sCountryMarket(6,3) = &quot;&quot;
+&apos; sCountryMarket(6,5) = &quot;&quot; &apos;Still Todo!!
+&apos; sCountryMarket(6,6) = &quot;pl&quot;
+&apos; sCountryMarket(6,7) = &quot;PL&quot;
+&apos; sCountryMarket(6,8) = &quot;-415&quot;
+&apos; sCountryMarket(6,9) = &quot;&quot;
+&apos;
+&apos; sCountryMarket(7,0) = &quot;Türkische Lira&quot;
+&apos; sCountryMarket(7,1) = &quot;TL&quot;
+&apos; sCountryMarket(7,2) = &quot;&quot;
+&apos; sCountryMarket(7,3) = &quot;&quot;
+&apos; sCountryMarket(7,5) = &quot;&quot; &apos;Still Todo!!
+&apos; sCountryMarket(7,6) = &quot;tr&quot;
+&apos; sCountryMarket(7,7) = &quot;TR&quot;
+&apos; sCountryMarket(7,8) = &quot;-41F&quot;
+&apos; sCountryMarket(7,9) = &quot;&quot;
+
+ Dim n as Integer
+ Dim m as Integer
+&apos; Dim sCountryMarket(6,9) as String
+
+ For n = 0 To Ubound(sCountryMarket(),1)
+ If sDocLanguage = sCountryMarket(n,6) and sDocCountry = sCountryMarket(n,7) Then
+ GlobListIndex = 6
+ For m = 0 To 10
+ sMarket(6,m) = sCountryMarket(n,m)
+ Next m
+ Exit For
+ End If
+ Next n
+ End If
+End Sub
+
+Sub LoadDepotDialogs()
+ DlgTransaction = LoadDialog(&quot;Depot&quot;, &quot;Dialog2&quot;)
+ DlgStockRates = LoadDialog(&quot;Depot&quot;, &quot;Dialog3&quot;)
+ DlgStartUp = LoadDialog(&quot;Depot&quot;, &quot;Dialog4&quot;)
+ TransactModel = DlgTransaction.Model
+ StockRatesModel = DlgStockRates.Model
+ StartUpModel = DlgStartUp.Model
+End Sub
+
+
+Sub InitializeStartUpModel()
+ With StartUpModel
+ .lblWelcome.Label = sStartupWelcome &amp; Chr(13) &amp; chr(13) &amp; sStartUpChooseMarket
+ sStartUpHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ .lblHint.Label = sStartupHint
+&apos; .cmdGoOn.Enabled = Ubound(StartUpModel.lstMarkets.SelectedItems()) &lt;&gt; -1
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Currency.xba b/wizards/source/depot/Currency.xba
new file mode 100644
index 000000000000..c432fecc2661
--- /dev/null
+++ b/wizards/source/depot/Currency.xba
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Currency" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+
+Dim bDoUnLoad as Boolean
+
+
+Sub Startup()
+Dim i as Integer
+Dim a as Integer
+Dim ListString as String
+Dim MarketListBoxControl as Object
+ Initialize(False)
+ MarketListBoxControl = DlgStartUp.GetControl(&quot;lstMarkets&quot;)
+ a = 0
+ For i = 0 To Ubound(sMarket(),1)
+ ListString = sMarket(i,0)
+ If sMarket(i,0) &lt;&gt; &quot;&quot; Then
+ If sMarket(i,3) = &quot;&quot; Then
+ ListString = ListString &amp; &quot; (&quot; &amp; sNoInternetUpdate &amp; &quot;)&quot;
+ Else
+ ListString = ListString &amp; &quot; (&quot; &amp; sMarketplace &amp; &quot; &quot; &amp; sMarket(i,2) &amp; &quot;)&quot;
+ End If
+ MarketListBoxControl.AddItem(ListString, a)
+ a = a + 1
+ End If
+ Next i
+ MarketListBoxControl.SelectItemPos(GlobListIndex, True)
+ DlgStartUp.Title = sDepotCurrency
+ DlgStartUp.Model.cmdGoOn.DefaultButton = True
+ DlgStartUp.GetControl(&quot;lstMarkets&quot;).SetFocus()
+ DlgStartUp.Execute()
+ DlgStartUp.Dispose()
+End Sub
+
+
+Sub EnableGoOnButton()
+ StartUpModel.cmdGoOn.Enabled = True
+ StartUpModel.cmdGoOn.DefaultButton = True
+End Sub
+
+
+Sub CloseStartUpDialog()
+ DlgStartUp.EndExecute()
+&apos; oDocument.Dispose()
+End Sub
+
+
+Sub DisposeDocument()
+ If bDoUnload Then
+ oDocument.Dispose()
+ End If
+End Sub
+
+
+Sub ChooseMarket(Optional aEvent)
+Dim Index as Integer
+Dim bIsDocLanguage as Boolean
+Dim bIsDocCountry as Boolean
+ oInternetModel = GetControlModel(oDocument.Sheets(0), &quot;CmdInternet&quot;)
+ If Not IsMissing(aEvent) Then
+ Index = StartupModel.lstMarkets.SelectedItems(0)
+ oInternetModel.Tag = Index
+ Else
+ Index = oInternetModel.Tag
+ End If
+ oMarketModel = GetControlModel(oDocument.Sheets(0), &quot;CmdHistory&quot;)
+ sCurCurrency = sMarket(Index,1)
+ If Index = 0 Then
+ HistoryChartSource = sMarket(Index,4)
+ End If
+ sCurStockIDLabel = sMarket(Index,5)
+ sCurExtension = sMarket(Index,8)
+ iValueCol = Val(sMarket(Index,10)
+ If Instr(sCurExtension,&quot;;&quot;) &lt;&gt; 0 Then
+ &apos; Take the german extension as the stock place is Frankfurt
+ sCurExtension = &quot;407&quot;
+ End If
+ sCurChartSource = sMarket(Index,3)
+ bIsDocLanguage = Instr(1, sMarket(Index,6), sDocLanguage, SBBINARY) &lt;&gt; 0
+ bIsDocCountry = Instr(1, sMarket(Index,7), sDocCountry, SBBINARY) &lt;&gt; 0 OR SDocCountry = &quot;&quot;
+ sCurSeparator = sMarket(Index,9)
+ TransactModel.txtRate.CurrencySymbol = sCurCurrency
+ TransactModel.txtFix.CurrencySymbol = sCurCurrency
+ TransactModel.txtMinimum.CurrencySymbol = sCurCurrency
+ bEnableMarket = Index = 0
+ bEnableInternet = sCurChartSource &lt;&gt; &quot;&quot;
+ oMarketModel.Enabled = bEnableMarket
+ oInternetModel.Enabled = bEnableInternet
+ If Not IsMissing(aEvent) Then
+ ConvertStylesCurrencies()
+ bDoUnload = False
+ DlgStartUp.EndExecute()
+ End If
+End Sub
+
+
+Sub ConvertStylesCurrencies()
+Dim m as integer
+Dim aStyleFormat as Object
+Dim StyleName as String
+Dim bAddToList as Boolean
+Dim oStyle as Object
+Dim oStyles as Object
+ UnprotectSheets(oSheets)
+ oFirstSheet.GetCellByPosition(SBCOLUMNID1, SBROWHEADER1).SetString(sCurStockIDLabel)
+ oStyles = oDocument.StyleFamilies.GetbyIndex(0)
+ For m = 0 To oStyles.count-1
+ oStyle = oStyles.GetbyIndex(m)
+ StyleName = oStyle.Name
+ bAddToList = CheckFormatType(oStyle)
+ If bAddToList Then
+ SwitchNumberFormat(ostyle, oDocFormats, sCurCurrency, sCurExtension)
+ End If
+ Next m
+ ProtectSheets(oSheets)
+End Sub
+
+
+Sub SwitchNumberFormat(oObject as Object, oFormats as object, sNewSymbol as String, sNewExtension as String)
+Dim nFormatLanguage as Integer
+Dim nFormatDecimals as Integer
+Dim nFormatLeading as Integer
+Dim bFormatLeading as Integer
+Dim bFormatNegRed as Integer
+Dim bFormatThousands as Integer
+Dim aNewStr as String
+Dim iNumberFormat as Long
+Dim sSimpleStr as String
+Dim nSimpleKey as Long
+Dim aFormat()
+Dim oLocale as New com.sun.star.lang.Locale
+ &apos; Numberformat with the new Symbol as Base for new Format
+ sSimpleStr = &quot;0 [$&quot; &amp; sNewSymbol &amp; &quot;-&quot; &amp; sNewExtension &amp; &quot;]&quot;
+ nSimpleKey = Numberformat(oFormats, sSimpleStr, oDocLocale)
+ On Local Error Resume Next
+ iNumberFormat = oObject.NumberFormat
+ If Err &lt;&gt; 0 Then
+ Msgbox &quot;Error Reading the Number Format&quot;
+ Resume CLERROR
+ End If
+
+ On Local Error GoTo NOKEY
+ aFormat() = oFormats.getByKey(iNumberFormat)
+ On Local Error GoTo 0
+ &apos; set new currency format with according settings
+ nFormatDecimals = aFormat.Decimals
+ nFormatLeading = aFormat.LeadingZeros
+ bFormatNegRed = aFormat.NegativeRed
+ bFormatThousands = aFormat.ThousandsSeparator
+ oLocale = aFormat.Locale
+ aNewStr = oFormats.generateFormat(nSimpleKey, oLocale, bFormatThousands, bFormatNegRed, nFormatDecimals, nFormatLeading)
+ oObject.NumberFormat = Numberformat(oFormats, aNewStr, oLocale)
+ NOKEY:
+ If Err &lt;&gt; 0 Then
+ Resume CLERROR
+ End If
+ CLERROR:
+End Sub
+
+
+Function Numberformat( oFormats as Object, aFormatStr as String, oLocale as Variant )
+Dim nRetkey
+ nRetKey = oFormats.queryKey(aFormatStr, oLocale, True)
+ If nRetKey = -1 Then
+ nRetKey = oFormats.addNew( aFormatStr, oLocale )
+ If nRetKey = -1 Then nRetKey = 0
+ End If
+ Numberformat = nRetKey
+End Function
+
+
+Function CheckFormatType(oStyle as Object)
+Dim oFormatofObject as Object
+ oFormatofObject = oDocFormats.getByKey(oStyle.NumberFormat)
+ CheckFormatType = INT(oFormatOfObject.Type) AND com.sun.star.util.NumberFormat.CURRENCY
+End Function</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Depot.xba b/wizards/source/depot/Depot.xba
new file mode 100644
index 000000000000..358f3eaea3d7
--- /dev/null
+++ b/wizards/source/depot/Depot.xba
@@ -0,0 +1,500 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Depot" script:language="StarBasic">Option Explicit
+
+
+Sub Initialize(Optional bChooseMarketPlace as Boolean)
+Dim bEnableHistory as Boolean
+ GlobalScope.BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+&apos; oMarketModel = GetControlModel(oDocument.Sheets(0), &quot;CmdHistory&quot;)
+&apos; bEnableHistory = oMarketModel.Enabled
+ ToggleWindow(False)
+ Today = Date()
+ bDebugmode = False
+ oDocument = ThisComponent
+ oController = oDocument.GetCurrentController
+ oSheets = oDocument.Sheets
+ oFirstSheet = oSheets(0)
+ oMovementSheet = oSheets(1)
+ oBankSheet = oSheets(2)
+ oDocFormats = oDocument.NumberFormats
+ oNumberFormatter = CreateUnoService(&quot;com.sun.star.util.NumberFormatter&quot;)
+ oNumberFormatter.AttachNumberFormatsSupplier(oDocument)
+ oDocLocale = oDocument.CharLocale
+ sDocLanguage = oDocLocale.Language
+ sDocCountry = oDocLocale.Country
+ LoadLanguage()
+ ToggleWindow(True)
+&apos; oMarketModel.Enabled = bEnableHistory
+ If Not IsMissing(bChooseMarketPlace) Then
+ If bChoosemarketPlace Then
+ ChooseMarket()
+ End If
+ Else
+ ChooseMarket()
+ End If
+ If Not IsMissing(bChooseMarketPlace) Then
+ If bChooseMarketPlace Then
+ oMarketModel.Enabled = bEnableMarket
+ oInternetModel.Enabled = bEnableInternet
+ End If
+ End If
+End Sub
+
+
+Sub Buy()
+ Initialize(True)
+ FillListbox(DlgTransaction.GetControl(&quot;lstBuyStocks&quot;), TransactTitle(SBDIALOGBUY), False)
+ SetupTransactionControls(SBDIALOGBUY)
+ EnableTransactionControls(False)
+ DlgTransaction.Execute()
+End Sub
+
+
+Sub Sell()
+ Initialize(True)
+ If FillListbox(DlgTransaction.GetControl(&quot;lstSellStocks&quot;), TransactTitle(SBDIALOGSELL), True) Then
+ SetupTransactionControls(SBDIALOGSELL)
+ EnableTransactionControls(False)
+ DlgTransaction.Execute()
+ End If
+End Sub
+
+
+Sub Reset()
+Dim TransactionCount as Integer
+Dim StockCount, iStartRow, i as Integer
+Dim oRows, oRange as Object
+Dim StockName as String
+ Initialize(True)
+ &apos; Delete transactions and reset overview
+ If MsgBox(sMsgDeleteAll, SBMSGYESNO+SBMSGQUESTION+SBMSGDEFAULTBTN2, sMsgAuthorization) = 6 Then
+ &apos; Assumption: If and only if there is an overview, then there are transactions, too
+ UnprotectSheets(oSheets)
+ StockCount = GetStocksCount(iStartRow)
+
+ For i = 1 To StockCount
+ StockName = oFirstSheet.GetCellbyPosition(SBCOLUMNNAME1, iStartRow + i).String
+ If oSheets.HasbyName(StockName) Then
+ oSheets.RemoveByName(StockName)
+ End If
+ Next
+ oDocument.AddActionLock
+ RemoveStockRows(oFirstSheet, iStartRow + 1, StockCount)
+ TransactionCount = GetTransactionCount(iStartRow)
+ RemoveStockRows(oMovementSheet, iStartRow + 2, TransactionCount)
+ ProtectSheets(oSheets)
+ oDocument.RemoveActionLock
+ End If
+End Sub
+
+
+Sub TransactionOk
+Dim Sold as Long
+Dim RestQuantity, Value, PartialValue, Profit
+Dim iNewRow as Integer, iRow as Integer
+Dim iStockRow as Long, iRestQuantity as Long
+Dim oNameCell as Object
+Dim CellStockName as String, SelStockName as String
+Dim CurRate as Double
+Dim TransactDate as Date
+Dim LocStockName as String
+ &apos; Check for rate entered
+ If TransactModel.txtRate.Value = 0 Then
+ If TransactModel.Step = SBDIALOGBUY Then
+ If MsgBox(sMsgFreeStock, SBMSGYESNO+SBMSGQUESTION, sMsgConfirm)=7 Then
+ Exit Sub
+ End If
+ Else
+ If MsgBox(sMsgTotalLoss, SBMSGYESNO+SBMSGQUESTION, sMsgConfirm)=7 Then
+ Exit Sub
+ End If
+ End If
+ End If
+ CurRate = TransactModel.txtRate.Value
+ TransactDate = CDateFromISO(TransactModel.txtDate.Date)
+ DlgTransaction.EndExecute()
+ UnprotectSheets(oSheets)
+
+ iNewRow = DuplicateRow(oMovementSheet, &quot;HiddenRow3&quot;)
+
+ If TransactModel.Step = SBDIALOGBUY Then
+ CellStockName = TransactModel.lstBuyStocks.Text
+ If Instr(1,CellStockName,&quot;$&quot;) &lt;&gt; 0 Then
+ CellStockName = &quot;&apos;&quot; &amp; CellStockName &amp; &quot;&apos;&quot;
+ End If
+ oMovementSheet.GetCellByPosition(SBCOLUMNNAME2, iNewRow).String = CellStockName
+ oMovementSheet.GetCellByPosition(SBCOLUMNQUANTITY2, iNewRow).Value = TransactModel.txtQuantity.Value
+ Else
+ CellStockName = DlgTransaction.GetControl(&quot;lstSellStocks&quot;).GetSelectedItem()
+ oMovementSheet.GetCellByPosition(SBCOLUMNNAME2, iNewRow).String = CellStockName
+ oMovementSheet.GetCellByPosition(SBCOLUMNQUANTITY2, iNewRow).Value = -TransactModel.txtQuantity.Value
+ End If
+
+ oMovementSheet.GetCellByPosition(SBCOLUMNDATE2, iNewRow).Value = CDateFromISO(TransactModel.txtDate.Date)
+ oMovementSheet.GetCellByPosition(SBCOLUMNRATE2, iNewRow).Value = TransactModel.txtRate.Value
+ oMovementSheet.GetCellByPosition(SBCOLUMNPROVPERCENT2, iNewRow).Value = TransactModel.txtCommission.EffectiveValue
+ oMovementSheet.GetCellByPosition(SBCOLUMNPROVMIN2, iNewRow).Value = TransactModel.txtMinimum.Value
+ oMovementSheet.GetCellByPosition(SBCOLUMNPROVFIX2, iNewRow).Value = TransactModel.txtFix.Value
+
+ &apos; Buy stocks: Update overview for new stocks
+ If TransactModel.Step = SBDIALOGBUY Then
+ iStockRow = GetStockRowIndex(CellStockName)
+ If iStockRow = -1 Then
+ iNewRow = DuplicateRow(oFirstSheet, &quot;HiddenRow2&quot;)
+ oFirstSheet.GetCellByPosition(SBCOLUMNNAME1, iNewRow).String = CellStockName
+ oFirstSheet.GetCellByPosition(SBCOLUMNID1, iNewRow).String = TransactModel.txtStockID.Text
+ iStockRow = GetStockRowIndex(CellStockName)
+ End If
+ &apos; Sell stocks: Get transaction value, then update Transaction sheet
+ ElseIf TransactModel.Step = SBDIALOGSELL Then
+ Profit = oMovementSheet.GetCellByPosition(SBCOLUMNPROCEEDS2, iNewRow).Value
+ Value = Profit
+ Sold = TransactModel.txtQuantity.Value
+ SelStockName = DlgTransaction.GetControl(&quot;lstSellStocks&quot;).GetSelectedItem()
+ &apos; Go to first name
+ If TransactMode = FIFO Then
+ iRow = SBROWFIRSTTRANSACT2
+ Else
+ iRow = iNewRow-1
+ End If
+
+ &apos; Check that no transaction after split date exists else cancel split
+ Do While Sold &gt; 0
+ oNameCell = oMovementSheet.GetCellByPosition(SBCOLUMNNAME2, iRow)
+ CellStockName = oNameCell.String
+ If CellStockName = SelStockName Then
+ &apos; Update transactions: Note quantity sold
+ RestQuantity = oMovementSheet.GetCellByPosition(SBCOLUMNQTYREST2, iRow).Value
+ &apos; If there still is a rest left ...
+ If RestQuantity &gt; 0 Then
+ If RestQuantity &lt; Sold Then
+ &apos; Recalculate profit of new transaction
+ Profit = Profit - oMovementSheet.GetCellByPosition(SBCOLUMNPRCREST2, iRow).Value
+ AddValueToCellContent(SBCOLUMNQTYSOLD2, iRow, RestQuantity)
+ PartialValue = RestQuantity / Sold * Value
+ AddValueToCellContent(SBCOLUMNREALPROC2, iRow, PartialValue)
+ Sold = Sold - RestQuantity
+ Value = Value - PartialValue
+ Else
+ &apos; Recalculate profit of neTransactModel.lstBuyStocks.Textw transaction
+ PartialValue = oMovementSheet.GetCellByPosition(SBCOLUMNPRCREST2, iRow).Value
+ Profit = Profit - PartialValue/RestQuantity * Sold
+ &apos; Update sold shares cell
+ AddValueToCellContent(SBCOLUMNQTYSOLD2, iRow, Sold)
+ &apos; Update sales turnover cell
+ AddValueToCellContent(SBCOLUMNREALPROC2, iRow, Value)
+ &apos; Update variables for rest of transaction
+ Sold = 0
+ Value = 0
+ End If
+ End If
+ End If
+ iRow = iRow + TransactMode
+ Loop
+ oMovementSheet.GetCellByPosition(SBCOLUMNREALPROFIT2,iNewRow).Value = Profit
+ iStockRow = GetStockRowIndex(SelStockName)
+ iRestQuantity = oFirstSheet.GetCellbyPosition(SBCOLUMNQUANTITY1, iStockRow).Value
+&apos; If iRestQuantity = 0 Then
+&apos; If oSheets.HasbyName(SelStockName) Then
+&apos; oSheets.RemoveByName(SelStockName)
+&apos; End If
+&apos; Else
+
+&apos; End If
+ End If
+ InsertCurrentValue(CurRate, iStockRow,TransactDate)
+ ProtectSheets(oSheets)
+End Sub
+
+
+Sub SelectStockname(aEvent as Object)
+Dim iCurRow as Integer
+Dim CurStockName as String
+ With TransactModel
+ &apos; Find row with stock name
+ If TransactModel.Step = SBDIALOGBUY Then
+ CurStockName = .lstBuyStocks.Text
+ iCurRow = GetStockRowIndex(CurStockName)
+ .txtQuantity.ValueMax = 10000000
+ Else
+ Dim ListBoxList() as String
+ ListBoxList() = GetSelectedListboxItems(aEvent.Source.getModel())
+ CurStockName = ListBoxList(0)
+&apos; CurStockName = DlgTransaction.GetControl(aEvent.Source.getModel.Name).GetSelectedItem()
+ iCurRow = GetStockRowIndex(CurStockName)
+ Dim fdouble as Double
+ fdouble = oFirstSheet.GetCellByPosition(SBCOLUMNQUANTITY1, iCurRow).Value
+ .txtQuantity.Value = fdouble
+ .txtQuantity.ValueMax = oFirstSheet.GetCellByPosition(SBCOLUMNQUANTITY1, iCurRow).Value
+ .txtRate.Value = oFirstSheet.GetCellbyPosition(SBCOLUMNRATE1, iCurRow).Value
+ End If
+ .txtStockID.Enabled = .Step = SBDIALOGBUY
+ .lblStockID.Enabled = .Step = SBDIALOGBUY
+ &apos; Default settings for quantity and rate
+ .txtStockID.Text = GetStockID(CurStockName, iCurRow)
+ End With
+ EnableTransactionControls(CurStockName &lt;&gt; &quot;&quot;)
+ TransactModel.cmdGoOn.DefaultButton = True
+End Sub
+
+
+
+Sub HandleStocks(Mode as Integer, oDialog as Object)
+Dim DividendPerShare, DividendTotal, RestQuantity, OldValue
+Dim SelStockName, CellStockName as String
+Dim oNameCell as Object, oDateCell as Object
+Dim iRow as Integer
+Dim oDividendCell as Object
+Dim Amount
+Dim OldNumber, NewNumber as Integer
+Dim NoteText as String
+Dim TotalStocksCount as Long
+Dim oModel as Object
+ oDocument.AddActionLock
+ oDialog.EndExecute()
+ oModel = oDialog.Model
+ SelStockName = DlgStockRates.GetControl(&quot;lstStockNames&quot;).GetSelectedItem()
+ Select Case Mode
+ Case HANDLEDIVIDEND
+ Dim bTakeTotal as Boolean
+ &apos; Update transactions: Enter dividend paid for all Buy transactions not sold completely
+ bTakeTotal = oModel.optTotal.State = 1
+ If bTakeTotal Then
+ DividendTotal = oModel.txtDividend.Value
+ iRow = GetStockRowIndex(SelStockName)
+ TotalStocksCount = oFirstSheet.GetCellByPosition(SBCOLUMNQUANTITY1,iRow).Value
+ DividendPerShare = DividendTotal/TotalStocksCount
+ Else
+ DividendPerShare = oModel.txtDividend.Value
+ End If
+
+ Case HANDLESPLIT
+ &apos; Store entered values in variables
+ OldNumber = oModel.txtOldRate.Value
+ NewNumber = oModel.txtNewRate.Value
+ SplitDate = CDateFromISO(oModel.txtDate.Date)
+ iRow = SBROWFIRSTTRANSACT2
+ NoteText = cSplit &amp; SplitDate &amp; &quot;, &quot; &amp; oModel.txtOldRate.Value &amp; oModel.lblColon.Label &amp; oModel.txtNewRate.Value
+ Do
+ oNameCell = oMovementSheet.GetCellByPosition(SBCOLUMNNAME2, iRow)
+ CellStockName = oNameCell.String
+ If CellStockName = SelStockName Then
+ oDateCell = oMovementSheet.GetCellByPosition(SBCOLUMNDATE2, iRow)
+ If oDateCell.Value &gt;= SplitDate Then
+ MsgBox sMsgWrongExchangeDate, SBMSGOK + SBMSGSTOP, sMsgError
+ Exit Sub
+ End If
+ End If
+ iRow = iRow + 1
+ Loop Until CellStockName = &quot;&quot;
+ End Select
+ iRow = SBROWFIRSTTRANSACT2
+ UnprotectSheets(oSheets)
+ Do
+ oNameCell = oMovementSheet.GetCellByPosition(SBCOLUMNNAME2, iRow)
+ CellStockName = oNameCell.String
+ If CellStockName = SelStockName Then
+ Select Case Mode
+ Case HANDLEDIVIDEND
+ RestQuantity = oMovementSheet.GetCellByPosition(SBCOLUMNQTYREST2, iRow).Value
+ If RestQuantity &gt; 0 Then
+ oDividendCell = oMovementSheet.GetCellByPosition(SBCOLUMNDIVIDEND2, iRow)
+ OldValue = oDividendCell.Value
+ oDividendCell.Value = OldValue + RestQuantity * DividendPerShare
+ End If
+ Case HANDLESPLIT
+ oDateCell = oMovementSheet.GetCellByPosition(SBCOLUMNDATE2, iRow)
+ SplitCellValue(oMovementSheet, NewNumber, OldNumber, SBCOLUMNQUANTITY2, iRow, NoteText)
+ SplitCellValue(oMovementSheet, OldNumber, NewNumber, SBCOLUMNRATE2, iRow, &quot;&quot;)
+ SplitCellValue(oMovementSheet, NewNumber, OldNumber, SBCOLUMNQTYSOLD2, iRow, &quot;&quot;)
+ End Select
+ End If
+ iRow = iRow + 1
+ Loop Until CellStockName = &quot;&quot;
+ If Mode = HANDLESPLIT Then
+ CalculateChartafterSplit(SelStockName, NewNumber, OldNumber, NoteText, SplitDate)
+ End If
+ oDocument.CalculateAll()
+ ProtectSheets(oSheets)
+ oDocument.RemoveActionLock
+End Sub
+
+
+Sub CancelStockRate()
+ DlgStockRates.EndExecute()
+End Sub
+
+
+Sub CancelTransaction()
+ DlgTransaction.EndExecute()
+End Sub
+
+
+Sub CommitStockRate()
+Dim CurStep as Integer
+ CurStep = StockRatesModel.Step
+ Select Case CurStep
+ Case 1
+ &apos; Check for quantity entered
+ If StockRatesModel.txtDividend.Value = 0 Then
+ MsgBox sMsgNoDividend, SBMSGSTOP+SBMSGSTOP, sMsgError
+ Exit Sub
+ End If
+ HandleStocks(HANDLEDIVIDEND, DlgStockRates)
+ Case 2
+ HandleStocks(HANDLESPLIT, DlgStockRates)
+ Case 3
+ InsertCompanyHistory()
+ End Select
+End Sub
+
+
+Sub EnableTransactionControls(bEnable as Boolean)
+ With TransactModel
+ .lblQuantity.Enabled = bEnable
+ .txtQuantity.Enabled = bEnable
+ .lblRate.Enabled = bEnable
+ .txtRate.Enabled = bEnable
+ .lblDate.Enabled = bEnable
+ .txtDate.Enabled = bEnable
+ .lblCommission.Enabled = bEnable
+ .txtCommission.Enabled = bEnable
+ .lblMinimum.Enabled = bEnable
+ .txtMinimum.Enabled = bEnable
+ .lblFix.Enabled = bEnable
+ .txtFix.Enabled = bEnable
+ If TransactModel.Step = SBDIALOGSELL Then
+ .cmdGoOn.Enabled = Ubound(TransactModel.lstSellStocks.SelectedItems()) &gt; -1
+ DlgTransaction.GetControl(&quot;lstSellStocks&quot;).SetFocus()
+ Else
+ .cmdGoOn.Enabled = TransactModel.lstBuyStocks.Text &lt;&gt; &quot;&quot;
+ DlgTransaction.GetControl(&quot;lstBuyStocks&quot;).SetFocus()
+ End If
+ If bEnable Then
+ TransactModel.cmdGoOn.DefaultButton = True
+ End If
+ End With
+End Sub
+
+
+Sub SetupTransactionControls(CurStep as Integer)
+ DlgReference = DlgTransaction
+ With TransactModel
+ .txtDate.Date = CDateToISO(Date())
+ .txtDate.DateMax = CDateToISO(Date())
+ .txtStockID.Enabled = False
+ .lblStockID.Enabled = False
+ .lblStockID.Label = sCurStockIDLabel
+ .txtRate.CurrencySymbol = sCurCurrency
+ .txtFix.CurrencySymbol = sCurCurrency
+ .Step = CurStep
+ End With
+ DlgTransaction.Title = TransactTitle(CurStep)
+ CellValuetoControl(oBankSheet, TransactModel.txtCommission, &quot;ProvisionPercent&quot;)
+ CellValuetoControl(oBankSheet, TransactModel.txtMinimum, &quot;ProvisionMinimum&quot;)
+ CellValuetoControl(oBankSheet, TransactModel.txtFix, &quot;ProvisionFix&quot;)
+End Sub
+
+
+Sub AddShortCuttoControl()
+Dim SelCompany as String
+Dim iRow, SelIndex as Integer
+ SelIndex = DlgTransaction.GetControl(&quot;lstBuyStocks&quot;).GetSelectedItemPos()
+ If SelIndex &lt;&gt; -1 Then
+ SelCompany = TransactModel.lstBuyStocks.StringItemList(SelIndex)
+ iRow = GetStockRowIndex(SelCompany)
+ If iRow &lt;&gt; -1 Then
+ TransactModel.txtStockID.Text = oFirstSheet.GetCellByPosition(SBCOLUMNID1,iRow).String
+ TransactModel.txtRate.Value = oFirstSheet.GetCellByPosition(SBCOLUMNRATE1,iRow).Value
+ Else
+ TransactModel.txtStockID.Text = &quot;&quot;
+ TransactModel.txtRate.Value = 0
+ End If
+ Else
+ TransactModel.txtStockID.Text = &quot;&quot;
+ TransactModel.txtRate.Value = 0
+ End If
+End Sub
+
+
+Sub OpenStockRatePage(aEvent)
+Dim CurStep as Integer
+ Initialize(True)
+ CurStep = aEvent.Source.Model.Tag
+ If FillListbox(DlgStockRates.GetControl(&quot;lstStockNames&quot;), StockRatesTitle(CurStep), True) Then
+ StockRatesModel.Step = CurStep
+ ToggleStockRateControls(False, CurStep)
+ InitializeStockRatesControls(CurStep)
+ DlgStockRates.Execute()
+ End If
+End Sub
+
+
+Sub SelectStockNameForRates()
+Dim StockName as String
+ StockName = DlgStockRates.GetControl(&quot;lstStockNames&quot;).GetSelectedItem()
+ If StockName &lt;&gt; &quot;&quot; Then
+ StockRatesModel.txtStockID.Text = GetStockID(StockName)
+ ToggleStockRateControls(True, StockRatesModel.Step)
+ End If
+ StockRatesModel.cmdGoOn.DefaultButton = True
+End Sub
+
+
+Sub ToggleStockRateControls(bDoEnable as Boolean, CurStep as Integer)
+ With StockRatesModel
+ .lblStockID.Enabled = False
+ .txtStockID.Enabled = False
+ .cmdGoOn.Enabled = Ubound(StockRatesModel.lstStockNames.SelectedItems()) &lt;&gt; -1
+ Select Case CurStep
+ Case 1
+ .optPerShare.Enabled = bDoEnable
+ .optTotal.Enabled = bDoEnable
+ .lblDividend.Enabled = bDoEnable
+ .txtDividend.Enabled = bDoEnable
+ Case 2
+ .lblExchangeRate.Enabled = bDoEnable
+ .lblDate.Enabled = bDoEnable
+ .lblColon.Enabled = bDoEnable
+ .txtOldRate.Enabled = bDoEnable
+ .txtNewRate.Enabled = bDoEnable
+ .txtDate.Enabled = bDoEnable
+ Case 3
+ .lblStartDate.Enabled = bDoEnable
+ .lblEndDate.Enabled = bDoEnable
+ .txtStartDate.Enabled = bDoEnable
+ .txtEndDate.Enabled = bDoEnable
+ .hlnInterval.Enabled = bDoEnable
+ .optDaily.Enabled = bDoEnable
+ .optWeekly.Enabled = bDoEnable
+ End Select
+ End With
+End Sub
+
+
+Sub InitializeStockRatesControls(CurStep as Integer)
+ DlgReference = DlgStockRates
+ DlgStockRates.Title = StockRatesTitle(CurStep)
+ With StockRatesModel
+ .txtStockID.Text = &quot;&quot;
+ .lblStockID.Label = sCurStockIDLabel
+ Select Case CurStep
+ Case 1
+ .txtDividend.Value = 0
+ .optPerShare.State = 1
+ .txtDividend.CurrencySymbol = sCurCurrency
+ Case 2
+ .txtOldRate.Value = 1
+ .txtNewRate.Value = 1
+ .txtDate.Date = CDateToISO(Date())
+ Case 3
+ .txtStartDate.DateMax = CDateToISO(CDate(Date())-1)
+ .txtEndDate.DateMax = CDateToISO(CDate(Date())-1)
+ .txtStartDate.Date = CDateToISO(CDate(Date())-8)
+ .txtEndDate.Date = CDateToISO(CDate(Date())-1)
+ .optDaily.State = 1
+ End Select
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Dialog2.xdl b/wizards/source/depot/Dialog2.xdl
new file mode 100644
index 000000000000..a46fe9f5b383
--- /dev/null
+++ b/wizards/source/depot/Dialog2.xdl
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Dialog2" dlg:tab-index="0" dlg:left="91" dlg:top="24" dlg:width="220" dlg:height="128" dlg:page="1" dlg:help-url="HID:34520" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="lblStockNames" dlg:tab-index="0" dlg:left="6" dlg:top="6" dlg:width="102" dlg:height="8" dlg:value="lblStockNames"/>
+ <dlg:menulist dlg:id="lstSellStocks" dlg:tab-index="1" dlg:left="6" dlg:top="17" dlg:width="102" dlg:height="12" dlg:page="1" dlg:help-url="HID:34530" dlg:spin="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Depot.Depot.SelectStockname?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:combobox dlg:id="lstBuyStocks" dlg:tab-index="2" dlg:left="6" dlg:top="17" dlg:width="102" dlg:height="12" dlg:page="2" dlg:help-url="HID:34531" dlg:spin="true">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Depot.Depot.SelectStockname?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:combobox>
+ <dlg:text dlg:id="lblStockID" dlg:tab-index="3" dlg:left="150" dlg:top="6" dlg:width="66" dlg:height="8" dlg:value="lblStockID"/>
+ <dlg:textfield dlg:id="txtStockID" dlg:tab-index="4" dlg:left="150" dlg:top="17" dlg:width="40" dlg:height="12" dlg:help-url="HID:34521"/>
+ <dlg:text dlg:id="lblQuantity" dlg:tab-index="5" dlg:left="6" dlg:top="36" dlg:width="57" dlg:height="8" dlg:value="lblQuantity"/>
+ <dlg:numericfield dlg:id="txtQuantity" dlg:tab-index="6" dlg:left="6" dlg:top="47" dlg:width="46" dlg:height="12" dlg:help-url="HID:34522" dlg:decimal-accuracy="0" dlg:value-min="1"/>
+ <dlg:currencyfield dlg:id="txtRate" dlg:tab-index="7" dlg:left="68" dlg:top="47" dlg:width="40" dlg:height="12" dlg:help-url="HID:34523" dlg:value-min="0"/>
+ <dlg:datefield dlg:id="txtDate" dlg:tab-index="8" dlg:left="150" dlg:top="47" dlg:width="50" dlg:height="12" dlg:tag="Dialog2" dlg:help-url="HID:34524" dlg:strict-format="true" dlg:spin="true">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Depot.tools.CheckInputDate?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:datefield>
+ <dlg:text dlg:id="lblRate" dlg:tab-index="9" dlg:left="68" dlg:top="36" dlg:width="77" dlg:height="8" dlg:value="lblRate"/>
+ <dlg:text dlg:id="lblDate" dlg:tab-index="10" dlg:left="150" dlg:top="37" dlg:width="66" dlg:height="8" dlg:value="lblDate"/>
+ <dlg:formattedfield dlg:id="txtCommission" dlg:tab-index="11" dlg:left="6" dlg:top="90" dlg:width="40" dlg:height="12" dlg:help-url="HID:34525" dlg:format-code="0,00%" dlg:format-locale="de;DE"/>
+ <dlg:text dlg:id="lblCommission" dlg:tab-index="12" dlg:left="6" dlg:top="79" dlg:width="60" dlg:height="8" dlg:value="lblCommission"/>
+ <dlg:currencyfield dlg:id="txtFix" dlg:tab-index="13" dlg:left="68" dlg:top="90" dlg:width="40" dlg:height="12" dlg:help-url="HID:34526" dlg:value-min="0"/>
+ <dlg:currencyfield dlg:id="txtMinimum" dlg:tab-index="14" dlg:left="150" dlg:top="90" dlg:width="40" dlg:height="12" dlg:help-url="HID:34527" dlg:value-min="0"/>
+ <dlg:text dlg:id="lblFix" dlg:tab-index="15" dlg:left="68" dlg:top="79" dlg:width="71" dlg:height="8" dlg:value="lblFix"/>
+ <dlg:text dlg:id="lblMinimum" dlg:tab-index="16" dlg:left="150" dlg:top="79" dlg:width="66" dlg:height="8" dlg:value="lblMinimum"/>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="17" dlg:left="58" dlg:top="109" dlg:width="50" dlg:height="14" dlg:help-url="HID:34528" dlg:value="cmdCancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Depot.Depot.CancelTransaction?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdGoOn" dlg:tab-index="18" dlg:left="111" dlg:top="109" dlg:width="50" dlg:height="14" dlg:help-url="HID:34529" dlg:value="cmdGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Depot.Depot.TransactionOk?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:fixedline dlg:id="hlnCommission" dlg:tab-index="19" dlg:left="6" dlg:top="66" dlg:width="210" dlg:height="8" dlg:value="hlnCommission"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/depot/Dialog3.xdl b/wizards/source/depot/Dialog3.xdl
new file mode 100644
index 000000000000..4c6cabd20f96
--- /dev/null
+++ b/wizards/source/depot/Dialog3.xdl
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Dialog3" dlg:left="161" dlg:top="81" dlg:width="176" dlg:height="119" dlg:page="3" dlg:help-url="HID:34532" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="lblStockNames" dlg:tab-index="0" dlg:left="6" dlg:top="6" dlg:width="98" dlg:height="8" dlg:value="lblStockNames"/>
+ <dlg:menulist dlg:id="lstStockNames" dlg:tab-index="1" dlg:left="5" dlg:top="17" dlg:width="102" dlg:height="12" dlg:help-url="HID:34533" dlg:spin="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Depot.Depot.SelectStockNameForRates?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:textfield dlg:id="txtStockID" dlg:tab-index="2" dlg:left="120" dlg:top="17" dlg:width="50" dlg:height="12" dlg:help-url="HID:34534"/>
+ <dlg:datefield dlg:id="txtStartDate" dlg:tab-index="3" dlg:left="63" dlg:top="37" dlg:width="50" dlg:height="12" dlg:page="3" dlg:help-url="HID:34543" dlg:spin="true">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Depot.tools.CheckInputDate?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:datefield>
+ <dlg:datefield dlg:id="txtEndDate" dlg:tab-index="4" dlg:left="63" dlg:top="53" dlg:width="50" dlg:height="12" dlg:page="3" dlg:help-url="HID:34544" dlg:spin="true">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Depot.tools.CheckInputDate?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:datefield>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optDaily" dlg:tab-index="5" dlg:left="12" dlg:top="83" dlg:width="75" dlg:height="10" dlg:page="3" dlg:help-url="HID:34545" dlg:value="optDaily"/>
+ <dlg:radio dlg:id="optWeekly" dlg:tab-index="6" dlg:left="101" dlg:top="83" dlg:width="69" dlg:height="10" dlg:page="3" dlg:help-url="HID:34546" dlg:value="optWeekly"/>
+ </dlg:radiogroup>
+ <dlg:datefield dlg:id="txtDate" dlg:tab-index="7" dlg:left="71" dlg:top="73" dlg:width="50" dlg:height="12" dlg:page="2" dlg:help-url="HID:34542" dlg:spin="true">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Depot.tools.CheckInputDate?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:datefield>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optPerShare" dlg:tab-index="8" dlg:left="6" dlg:top="37" dlg:width="69" dlg:height="10" dlg:page="1" dlg:help-url="HID:34537" dlg:value="optPerShare"/>
+ <dlg:radio dlg:id="optTotal" dlg:tab-index="9" dlg:left="6" dlg:top="51" dlg:width="69" dlg:height="10" dlg:page="1" dlg:help-url="HID:34538" dlg:value="optTotal"/>
+ </dlg:radiogroup>
+ <dlg:currencyfield dlg:id="txtDividend" dlg:tab-index="10" dlg:left="6" dlg:top="80" dlg:width="50" dlg:height="12" dlg:page="1" dlg:help-url="HID:34539" dlg:value-min="0" dlg:spin="true"/>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="11" dlg:left="41" dlg:top="98" dlg:width="50" dlg:height="14" dlg:help-url="HID:34535" dlg:value="cmdCancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Depot.Depot.CancelStockRate?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdGoOn" dlg:tab-index="12" dlg:left="94" dlg:top="98" dlg:width="50" dlg:height="14" dlg:help-url="HID:34536" dlg:value="cmdGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Depot.Depot.CommitStockRate?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:text dlg:id="lblStockID" dlg:tab-index="13" dlg:left="120" dlg:top="6" dlg:width="50" dlg:height="8" dlg:value="lblStockID"/>
+ <dlg:text dlg:id="lblDividend" dlg:tab-index="14" dlg:left="6" dlg:top="68" dlg:width="73" dlg:height="8" dlg:page="1" dlg:value="lblDividend"/>
+ <dlg:text dlg:id="lblExchangeRate" dlg:tab-index="15" dlg:left="6" dlg:top="39" dlg:width="92" dlg:height="8" dlg:page="2" dlg:value="lblExchangeRate"/>
+ <dlg:text dlg:id="lblColon" dlg:tab-index="16" dlg:left="40" dlg:top="55" dlg:width="5" dlg:height="8" dlg:page="2" dlg:value=" :"/>
+ <dlg:text dlg:id="lblDate" dlg:tab-index="17" dlg:left="5" dlg:top="75" dlg:width="66" dlg:height="8" dlg:page="2" dlg:value="lblDate"/>
+ <dlg:fixedline dlg:id="hlnInterval" dlg:tab-index="18" dlg:left="6" dlg:top="72" dlg:width="164" dlg:height="8" dlg:page="3" dlg:value="hlnInterval"/>
+ <dlg:text dlg:id="lblStartDate" dlg:tab-index="19" dlg:left="6" dlg:top="39" dlg:width="53" dlg:height="8" dlg:page="3" dlg:value="lblStartDate"/>
+ <dlg:text dlg:id="lblEndDate" dlg:tab-index="20" dlg:left="6" dlg:top="55" dlg:width="53" dlg:height="8" dlg:page="3" dlg:value="lblEndDate"/>
+ <dlg:numericfield dlg:id="txtOldRate" dlg:tab-index="21" dlg:left="6" dlg:top="53" dlg:width="30" dlg:height="12" dlg:page="2" dlg:help-url="HID:34540" dlg:decimal-accuracy="0" dlg:value-min="1" dlg:spin="true"/>
+ <dlg:numericfield dlg:id="txtNewRate" dlg:tab-index="22" dlg:left="50" dlg:top="53" dlg:width="30" dlg:height="12" dlg:page="2" dlg:help-url="HID:34541" dlg:decimal-accuracy="0" dlg:value-min="1" dlg:spin="true"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/depot/Dialog4.xdl b/wizards/source/depot/Dialog4.xdl
new file mode 100644
index 000000000000..4f71be0da5cb
--- /dev/null
+++ b/wizards/source/depot/Dialog4.xdl
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Dialog4" dlg:left="161" dlg:top="81" dlg:width="160" dlg:height="120" dlg:page="1" dlg:help-url="HID:34547" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="lblWelcome" dlg:tab-index="0" dlg:left="6" dlg:top="6" dlg:width="148" dlg:height="49" dlg:value="lblWelcome" dlg:multiline="true"/>
+ <dlg:text dlg:id="lblHint" dlg:tab-index="1" dlg:left="6" dlg:top="73" dlg:width="148" dlg:height="26" dlg:value="lblHint" dlg:multiline="true"/>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="2" dlg:left="28" dlg:top="100" dlg:width="50" dlg:height="14" dlg:help-url="HID:34549" dlg:value="cmdCancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Depot.Currency.CloseStartUpDialog?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdGoOn" dlg:tab-index="3" dlg:left="84" dlg:top="100" dlg:width="52" dlg:height="14" dlg:help-url="HID:34550" dlg:value="cmdGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Depot.Currency.ChooseMarket?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:menulist dlg:id="lstMarkets" dlg:tab-index="4" dlg:left="6" dlg:top="57" dlg:width="148" dlg:height="12" dlg:help-url="HID:34548" dlg:spin="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Depot.Currency.EnableGoOnButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/depot/Internet.xba b/wizards/source/depot/Internet.xba
new file mode 100644
index 000000000000..f8b646d54133
--- /dev/null
+++ b/wizards/source/depot/Internet.xba
@@ -0,0 +1,339 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Internet" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+Public sNewSheetName as String
+
+Function CheckHistoryControls()
+Dim bLocGoOn as Boolean
+Dim Firstdate as Date
+Dim LastDate as Date
+ LastDate = CDateFromISO(StockRatesModel.txtEndDate.Date)
+ FirstDate = CDateFromISO(StockRatesModel.txtStartDate.Date)
+ bLocGoOn = FirstDate &lt;&gt; 0 And LastDate &lt;&gt; 0
+ If bLocGoOn Then
+ If FirstDate &gt;= LastDate Then
+ Msgbox(sMsgStartDatebeforeEndDate,16, sProductname)
+ bLocGoOn = False
+ End If
+ End If
+ CheckHistoryControls = bLocGoon
+End Function
+
+
+Sub InsertCompanyHistory()
+Dim StockName as String
+Dim CurRow as Integer
+Dim sMsgInternetError as String
+Dim CurRate as Double
+Dim oCell as Object
+Dim sStockID as String
+Dim ChartSource as String
+ If CheckHistoryControls() Then
+ StartDate = CDateFromISO(StockRatesModel.txtStartDate.Date)
+ EndDate = CDateFromISO(StockRatesModel.txtEndDate.Date)
+ DlgStockRates.EndExecute()
+ If StockRatesModel.optDaily.State = 1 Then
+ sInterval = &quot;d&quot;
+ iStep = 1
+ ElseIf StockRatesModel.optWeekly.State = 1 Then
+ sInterval = &quot;w&quot;
+ iStep = 7
+ StartDate = StartDate - WeekDay(StartDate) + 2
+ EndDate = EndDate - WeekDay(EndDate) + 2
+ End If
+ iEndDay = Day(EndDate)
+ iEndMonth = Month(EndDate)
+ iEndYear = Year(EndDate)
+ iStartDay = Day(StartDate)
+ iStartMonth = Month(StartDate)
+ iStartYear = Year(StartDate)
+&apos; oDocument.AddActionLock()
+ UnprotectSheets(oSheets)
+ InitializeStatusline(&quot;&quot;, 10, 1)
+ oBackGroundSheet = oSheets.GetbyName(&quot;Background&quot;)
+ StockName = DlgStockRates.GetControl(&quot;lstStockNames&quot;).GetSelectedItem()
+ CurRow = GetStockRowIndex(Stockname)
+ sStockID = oFirstSheet.GetCellByPosition(SBCOLUMNID1, CurRow).String
+ ChartSource = ReplaceString(HistoryChartSource, sStockID, &quot;&lt;StockID&gt;&quot;)
+ ChartSource = ReplaceString(ChartSource, iStartDay, &quot;&lt;StartDay&gt;&quot;)
+ ChartSource = ReplaceString(ChartSource, cStr(iStartMonth-1), &quot;&lt;StartMonth&gt;&quot;)
+ ChartSource = ReplaceString(ChartSource, iStartYear, &quot;&lt;StartYear&gt;&quot;)
+ ChartSource = ReplaceString(ChartSource, iEndDay, &quot;&lt;EndDay&gt;&quot;)
+ ChartSource = ReplaceString(ChartSource, cStr(iEndMonth-1), &quot;&lt;EndMonth&gt;&quot;)
+ ChartSource = ReplaceString(ChartSource, iEndYear, &quot;&lt;EndYear&gt;&quot;)
+ ChartSource = ReplaceString(ChartSource, sInterval, &quot;&lt;interval&gt;&quot;)
+ oStatusLine.SetValue(2)
+ If GetCurrentRate(ChartSource, CurRate, 1) Then
+ oStatusLine.SetValue(8)
+ UpdateValue(StockName, Today, CurRate)
+ oStatusLine.SetValue(9)
+ UpdateChart(StockName)
+ oStatusLine.SetValue(10)
+ Else
+ sMsgInternetError = Stockname &amp; &quot;: &quot; &amp; sNoInternetDataAvailable &amp; chr(13) &amp; sCheckInternetSettings
+ Msgbox(sMsgInternetError, 16, sProductname)
+ End If
+ ProtectSheets(oSheets)
+ oStatusLine.End
+ If oSheets.HasbyName(sNewSheetName) Then
+ oController.ActiveSheet = oSheets.GetByName(sNewSheetName)
+ End If
+&apos; oDocument.RemoveActionLock()
+ End If
+End Sub
+
+
+
+Sub InternetUpdate()
+Dim i as Integer
+Dim StocksCount as Integer
+Dim iStartRow as Integer
+Dim sUrl as String
+Dim StockName as String
+Dim CurRate as Double
+Dim oCell as Object
+Dim sMsgInternetError as String
+Dim sStockID as String
+Dim ChartSource as String
+&apos; oDocument.AddActionLock()
+ Initialize(True)
+ UnprotectSheets(oSheets)
+ StocksCount = GetStocksCount(iStartRow)
+ InitializeStatusline(&quot;&quot;, StocksCount + 1, 1)
+ Today = CDate(Date)
+ For i = iStartRow + 1 To iStartRow + StocksCount
+ StockName = oFirstSheet.GetCellbyPosition(SBCOLUMNNAME1, i).String
+ sStockID = oFirstSheet.GetCellByPosition(SBCOLUMNID1, i).String
+ ChartSource = ReplaceString(sCurChartSource, sStockID, &quot;&lt;StockID&gt;&quot;)
+ If GetCurrentRate(ChartSource, CurRate, 0) Then
+ InsertCurrentValue(CurRate, i, Now)
+ Else
+ sMsgInternetError = Stockname &amp; &quot;: &quot; &amp; sNoInternetDataAvailable &amp; chr(13) &amp; sCheckInternetSettings
+ Msgbox(sMsgInternetError, 16, sProductname)
+ End If
+ oStatusline.SetValue(i - iStartRow + 1)
+ Next
+ ProtectSheets(oSheets)
+ oStatusLine.End
+&apos; oDocument.RemoveActionLock
+End Sub
+
+
+
+Function GetCurrentRate(sUrl as String, fValue As Double, iValueRow as Integer) as Boolean
+Dim sFilter As String
+Dim sOptions As String
+Dim oLinkSheet As Object
+Dim sDate as String
+ If oSheets.hasByName(&quot;Link&quot;) Then
+ oLinkSheet = oSheets.getByName(&quot;Link&quot;)
+ Else
+ oLinkSheet = oDocument.createInstance(&quot;com.sun.star.sheet.Spreadsheet&quot;)
+ oSheets.insertByName(&quot;Link&quot;, oLinkSheet)
+ oLinkSheet.IsVisible = False
+ End If
+
+ sFilter = &quot;Text - txt - csv (StarCalc)&quot;
+ sOptions = sCurSeparator &amp; &quot;,34,SYSTEM,1,1/10/2/10/3/10/4/10/5/10/6/10/7/10/8/10/9/10&quot;
+
+ oLinkSheet.LinkMode = com.sun.star.sheet.SheetLinkMode.NONE
+ oLinkSheet.link(sUrl, &quot;&quot;, sFilter, sOptions, 1 )
+ fValue = oLinkSheet.getCellByPosition(iValueCol, iValueRow).Value
+ If fValue = 0 Then
+ Dim sValue as String
+ sValue = oLinkSheet.getCellByPosition(1, iValueRow).String
+ sValue = ReplaceString(sValue, &quot;.&quot;,&quot;,&quot;)
+ fValue = Val(sValue)
+ End If
+ GetCurrentRate = fValue &lt;&gt; 0
+End Function
+
+
+
+Sub UpdateValue(ByVal sName As String, fDate As Double, fValue As Double )
+Dim oSheet As Object
+Dim iColumn As Long
+Dim iRow As Long
+Dim i as Integer
+Dim oCell As Object
+Dim LastDate as Date
+Dim bLeaveLoop as Boolean
+Dim RemoveCount as Integer
+Dim iLastRow as Integer
+Dim iLastLinkRow as Integer
+Dim dDate as Date
+Dim CurDate as Date
+Dim oLinkSheet as Object
+Dim StartIndex as Integer
+Dim iCellValue as Long
+ &apos; Insert Sheet with Company - Chart
+ sName = CheckNewSheetname(oSheets, sName)
+ If NOT oSheets.hasByName(sName) Then
+ oSheets.CopybyName(&quot;Background&quot;, sName, oSheets.Count)
+ oSheet = oSheets.getByName(sName)
+ iCurRow = SBSTARTROW
+ iMaxRow = iCurRow
+ oCell = oSheet.getCellByPosition(SBDATECOLUMN, iCurRow)
+ oCell.Value = fDate
+ End If
+ sNewSheetName = sName
+ oLinkSheet = oSheets.GetByName(&quot;Link&quot;)
+ oSheet = oSheets.getByName(sName)
+ iLastRow = GetLastUsedRow(oSheet)- 2
+ iLastLinkRow = GetLastUsedRow(oLinkSheet)
+ iCurRow = iLastRow
+ bLeaveLoop = False
+ RemoveCount = 0
+ &apos; Delete all Cells in Date Area
+ Do
+ oCell = oSheet.GetCellbyPosition(SBDATECOLUMN,iCurRow)
+ If oCell.CellStyle = sColumnHeader Then
+ bLeaveLoop = True
+ StartIndex = iCurRow
+ iCurRow = iCurRow + 1
+ Else
+ RemoveCount = RemoveCount + 1
+ iCurRow = iCurRow - 1
+ End If
+ Loop Until bLeaveLoop
+ If RemoveCount &gt; 1 Then
+ oSheet.Rows.RemoveByIndex(iCurRow, RemoveCount-1)
+ End If
+ For i = 1 To iLastLinkRow
+ oCell = oSheet.GetCellbyPosition(SBDATECOLUMN,iCurRow)
+ iCellValue = oLinkSheet.GetCellByPosition(0,i).Value
+ If iCellValue &gt; 0 Then
+ oCell.SetValue(oLinkSheet.GetCellByPosition(0,i).Value)
+ Else
+ oCell.SetValue(StringToDate(oLinkSheet.GetCellByPosition(0,i).String)
+ End If
+ oCell = oSheet.GetCellbyPosition(SBVALUECOLUMN,iCurRow)
+ oCell.SetValue(oLinkSheet.GetCellByPosition(4,i).Value)
+ If i &lt; iLastLinkRow Then
+ iCurRow = iCurRow + 1
+ oSheet.Rows.InsertByIndex(iCurRow,1)
+ End If
+ Next i
+ iMaxRow = iCurRow
+End Sub
+
+
+Function StringToDate(DateString as String) as Date
+Dim ShortMonths(11)
+Dim DateList() as String
+Dim MaxIndex as Integer
+Dim i as Integer
+ ShortMonths(0) = &quot;Jan&quot;
+ ShortMonths(1) = &quot;Feb&quot;
+ ShortMonths(2) = &quot;Mar&quot;
+ ShortMonths(3) = &quot;Apr&quot;
+ ShortMonths(4) = &quot;May&quot;
+ ShortMonths(5) = &quot;Jun&quot;
+ ShortMonths(6) = &quot;Jul&quot;
+ ShortMonths(7) = &quot;Aug&quot;
+ ShortMonths(8) = &quot;Sep&quot;
+ ShortMonths(9) = &quot;Oct&quot;
+ ShortMonths(10) = &quot;Nov&quot;
+ ShortMonths(11) = &quot;Dec&quot;
+ For i = 0 To 11
+ DateString = ReplaceString(DateString,CStr(i+1),ShortMonths(i))
+ Next i
+ DateString = ReplaceString(DateString, &quot;.&quot;, &quot;-&quot;)
+ StringToDate = CDate(DateString)
+End Function
+
+
+Sub UpdateChart(sName As String)
+Dim oSheet As Object
+Dim oCell As Object, oCursor As Object
+Dim oChartRange As Object
+Dim oEmbeddedChart As Object, oCharts As Object
+Dim oChart As Object, oDiagram As Object
+Dim oYAxis As Object, oXAxis As Object
+Dim fMin As Double, fMax As Double
+Dim nDateFormat As Long
+Dim aPos As Variant
+Dim aSize As Variant
+Dim oContainerChart as Object
+Dim mRangeAddresses(0) as New com.sun.star.table.CellRangeAddress
+ mRangeAddresses(0).Sheet = GetSheetIndex(oSheets, sNewSheetName)
+ mRangeAddresses(0).StartColumn = SBDATECOLUMN
+ mRangeAddresses(0).StartRow = SBSTARTROW-1
+ mRangeAddresses(0).EndColumn = SBVALUECOLUMN
+ mRangeAddresses(0).EndRow = iMaxRow
+
+ oSheet = oDocument.Sheets.getByName(sNewSheetName)
+ oCharts = oSheet.Charts
+
+ If Not oCharts.hasElements Then
+ oSheet.GetCellbyPosition(2,2).SetString(sName)
+ oChartRange = oSheet.getCellRangeByPosition(SBDATECOLUMN,6,5,SBSTARTROW-3)
+ aPos = oChartRange.Position
+ aSize = oChartRange.Size
+
+ Dim oRectangleShape As New com.sun.star.awt.Rectangle
+ oRectangleShape.X = aPos.X
+ oRectangleShape.Y = aPos.Y
+ oRectangleShape.Width = aSize.Width
+ oRectangleShape.Height = aSize.Height
+ oCharts.addNewByName(sName, oRectangleShape, mRangeAddresses(), True, False)
+ oContainerChart = oCharts.getByName(sName)
+ oChart = oContainerChart.EmbeddedObject
+ oChart.Title.String = &quot;&quot;
+ oChart.HasLegend = False
+ oChart.diagram = oChart.createInstance(&quot;com.sun.star.chart.XYDiagram&quot;)
+ oDiagram = oChart.Diagram
+ oDiagram.DataRowSource = com.sun.star.chart.ChartDataRowSource.COLUMNS
+ oChart.Area.LineStyle = com.sun.star.drawing.LineStyle.SOLID
+ oXAxis = oDiagram.XAxis
+ oXAxis.TextBreak = False
+ nDateFormat = oXAxis.NumberFormats.getStandardFormat(com.sun.star.util.NumberFormat.DATE, oDocLocale)
+
+ oYAxis = oDiagram.getYAxis()
+ oYAxis.AutoOrigin = True
+ Else
+ oChart = oCharts(0)
+ oChart.Ranges = mRangeAddresses()
+ oChart.HasRowHeaders = False
+ oEmbeddedChart = oChart.EmbeddedObject
+ oDiagram = oEmbeddedChart.Diagram
+ oXAxis = oDiagram.XAxis
+ End If
+ oXAxis.AutoStepMain = False
+ oXAxis.AutoStepHelp = False
+ oXAxis.StepMain = iStep
+ oXAxis.StepHelp = iStep
+ fMin = oSheet.getCellByPosition(SBDATECOLUMN,SBSTARTROW).Value
+ fMax = oSheet.getCellByPosition(SBDATECOLUMN,iMaxRow).Value
+ oXAxis.Min = fMin
+ oXAxis.Max = fMax
+ oXAxis.AutoMin = False
+ oXAxis.AutoMax = False
+End Sub
+
+
+Sub CalculateChartafterSplit(SheetName, NewNumber, OldNumber, NoteText, SplitDate)
+Dim oSheet as Object
+Dim i as Integer
+Dim oValueCell as Object
+Dim oDateCell as Object
+Dim bLeaveLoop as Boolean
+ If oSheets.HasbyName(SheetName) Then
+ oSheet = oSheets.GetbyName(SheetName)
+ i = 0
+ bLeaveLoop = False
+ Do
+ oValueCell = oSheet.GetCellbyPosition(SBVALUECOLUMN, SBSTARTROW + i)
+ If oValueCell.CellStyle = CurrCellStyle Then
+ SplitCellValue(oSheet, OldNumber, NewNumber, SBVALUECOLUMN, SBSTARTROW + i, &quot;&quot;)
+ i = i + 1
+ Else
+ bLeaveLoop = True
+ End If
+ Loop Until bLeaveLoop
+ oDateCell = oSheet.GetCellbyPosition(SBDATECOLUMN, SBSTARTROW + i-1)
+ oDateCell.Annotation.SetString(NoteText)
+ End If
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_de.xba b/wizards/source/depot/Lang_de.xba
new file mode 100644
index 000000000000..1fe55bcca0b6
--- /dev/null
+++ b/wizards/source/depot/Lang_de.xba
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_de" script:language="StarBasic">Option Explicit
+
+Sub LoadGermanLanguage()
+
+ sProductname = GetProductname
+ sOK = &quot;~OK&quot;
+ sCancel = &quot;Abbrechen&quot;
+ sColumnHeader = &quot;Spaltenkopf&quot;
+ sInsertStockName = &quot;Bitte fügen Sie zunächst einige Aktien in Ihr Depot ein!&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt;: Aktienverwaltung&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;Eingabefehler&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;Bitte geben Sie eine Stückzahl größer als 0 ein&quot;
+ sMsgNoDividend = &quot;Bitte geben Sie eine Dividende je Stück oder eine Gesamtdividende ein&quot;
+ sMsgNoExchangeRate = &quot;Bitte geben Sie eine korrekte Umtauschrate ein (alte Aktien -&gt; neue Aktien).&quot;
+ sMsgNoValidExchangeDate = &quot;Bitte geben Sie ein gültiges Datum für den Aktiensplitt ein.&quot;
+ sMsgWrongExchangeDate = &quot;Splitt nicht möglich, da bereits Transaktionen nach dem Splitt-Datum existieren.&quot;
+ sMsgSellTooMuch = &quot;So viele Aktien können Sie nicht verkaufen. Maximum: &quot;
+ sMsgConfirm = &quot;Bestätigung erforderlich&quot;
+ sMsgFreeStock = &quot;Beabsichtigen Sie die Eingabe von Gratisaktien?&quot;
+ sMsgTotalLoss = &quot;Beabsichtigen Sie die Eingabe eines Totalverlustes?&quot;
+ sMsgAuthorization = &quot;Sicherheitsabfrage&quot;
+ sMsgDeleteAll = &quot;Wollen Sie alle Bewegungen löschen und die Depotübersicht rücksetzen?&quot;
+ cSplit = &quot;Aktiensplitt am &quot;
+ sHistory = &quot;Historie&quot;
+ TransactTitle(1) = &quot;Aktien verkaufen&quot;
+ TransactTitle(2) = &quot;Aktien kaufen&quot;
+ StockRatesTitle(1) = &quot;Dividendenzahlung&quot;
+ StockRatesTitle(2) = &quot;Aktiensplitt&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;Depotwährung&quot;
+ sStockName = &quot;Aktienname&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;Ergebnis Datum&quot;
+ CurrCellStyle = &quot;Ergebnis Euro mit Dezimalen&quot;
+ sStartDate = &quot;Startdatum:&quot;
+ sEndDate = &quot;Enddatum:&quot;
+ sStartUpWelcome = &quot;Diese Vorlage ermöglicht Ihnen eine effiziente Verwaltung Ihres Aktiendepots&quot;
+ sStartUpChooseMarket = &quot;Wählen Sie zunächst Ihre Referenz-Währung und damit den Börsenplatz für das Internet Update aus!&quot;
+ sStartUpHint = &quot;Leider steht Ihnen die &lt;History&gt;- Funktion nur für den amerikanischen Markt zur Verfügung!&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;ohne Internet Update&quot;
+ sMarketPlace = &quot;Börsenplatz:&quot;
+ sNoInternetDataAvailable = &quot;Internet-Kurse konnten nicht empfangen werden!&quot;
+ sCheckInternetSettings = &quot;Mögliche Ursachen sind: &lt;BR&gt; Ihre Internet Einstellungen müssen überprüft werden.&lt;BR&gt; Sie haben eine falsche Kennung (z.B. Symbol, WKN) für die Aktie eingegeben.&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;Das Enddatum muss vor dem heutigen Tag liegen!&quot;
+ sMsgStartDatebeforeEndDate = &quot;Das Startdatum muss vor dem Enddatum liegen!&quot;
+
+ sMarket(0,0) = &quot;Amerikanischer Dollar&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;New York&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;Symbol&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;Euro&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;Frankfurt&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;WKN&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;Englisches Pfund&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;London&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;Symbol&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;Japanischer Yen&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;Tokyo&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;Code&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;Hongkong Dollar&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;Hongkong&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.HK&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;Nummer&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;Australischer Dollar&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;Sydney&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;Symbol&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;Menge&quot;
+ .lblRate.Label = &quot;Kurs&quot;
+ .lblDate.Label = &quot;Transaktionsdatum&quot;
+ .hlnCommission.Label = &quot;Sonstige Ausgaben&quot;
+ .lblCommission.Label = &quot;Provision&quot;
+ .lblMinimum.Label = &quot;Mindestprovision&quot;
+ .lblFix.Label = &quot;Festbetrag/Spesen&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;Dividende/Aktie&quot;
+ .optTotal.Label = &quot;Dividende gesamt&quot;
+ .lblDividend.Label = &quot;Betrag&quot;
+ .lblExchangeRate.Label = &quot;Umtauschrate (alt-&gt;neu)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;Umtauschdatum:&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;~Täglich&quot;
+ .optWeekly.Label = &quot;~Wöchentlich&quot;
+ .hlnInterval.Label = &quot;Zeitraum&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_en.xba b/wizards/source/depot/Lang_en.xba
new file mode 100644
index 000000000000..347c5c2544b0
--- /dev/null
+++ b/wizards/source/depot/Lang_en.xba
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_en" script:language="StarBasic">Option Explicit
+
+Sub LoadEnglishLanguage()
+
+ sProductname = GetProductname
+ sOK = &quot;~OK&quot;
+ sCancel = &quot;Cancel&quot;
+ sColumnHeader = &quot;Column Header&quot;
+ sInsertStockName = &quot;Please enter shares in your portfolio.&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt;: Stocks Manager&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;Input Error&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;Please enter a quantity larger than 0&quot;
+ sMsgNoDividend = &quot;Please enter the dividend per share or the total dividend&quot;
+ sMsgNoExchangeRate = &quot;Please enter the correct exchange rate (old shares -&gt; new shares)&quot;
+ sMsgNoValidExchangeDate = &quot;Please enter a valid date for the split.&quot;
+ sMsgWrongExchangeDate = &quot;Splitting not possible, as transactions already exist after the split date.&quot;
+ sMsgSellTooMuch = &quot;You cannot sell that many shares. Maximum: &quot;
+ sMsgConfirm = &quot;Confirmation Required&quot;
+ sMsgFreeStock = &quot;Do you intend to enter free shares?&quot;
+ sMsgTotalLoss = &quot;Do you intend to enter a total loss?&quot;
+ sMsgAuthorization = &quot;Security Query&quot;
+ sMsgDeleteAll = &quot;Do you want to delete all movements and reset the portfolio overview?&quot;
+ cSplit = &quot;Stock split on &quot;
+ sHistory = &quot;History&quot;
+ TransactTitle(1) = &quot;StarOffice Stocks Manager: Selling Shares&quot;
+ TransactTitle(2) = &quot;StarOffice Stocks Manager: Buying Shares&quot;
+ StockRatesTitle(1) = &quot;StarOffice Stocks Manager: Dividend Payment&quot;
+ StockRatesTitle(2) = &quot;Stock Split&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;Portfolio Currency&quot;
+ sStockName = &quot;Name of Stock&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;Result Date&quot;
+ CurrCellStyle = &quot;1&quot;
+ sStartDate = &quot;Start date:&quot;
+ sEndDate = &quot;End date:&quot;
+ sStartUpWelcome = &quot;This template enables you to manage your stock portfolio efficiently.&quot;
+ sStartUpChooseMarket = &quot;First, select your reference currency and thus the stock exchange for the Internet update.&quot;
+ sStartUpHint = &quot;Unfortunately, the only &lt;History&gt; function available to you is that for the American market.&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;without Internet update&quot;
+ sMarketPlace = &quot;Stock exchange:&quot;
+ sNoInternetDataAvailable = &quot;No prices could be received from the Internet!&quot;
+ sCheckInternetSettings = &quot;Possible causes could be: &lt;BR&gt;Your Internet settings have to be modified. &lt;BR&gt;The Symbol (e.g. Code, Ticker Symbol) entered for the stock was incorrect.&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;The end date has to be before today&apos;s date.&quot;
+ sMsgStartDatebeforeEndDate = &quot;The start date has to be before the end date.&quot;
+
+ sMarket(0,0) = &quot;American Dollar&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;New York&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;Symbol&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;Euro&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;Frankfurt&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;Ticker Symbol&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;British Pound&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;London&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;Symbol&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;Japanese Yen&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;Tokyo&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;Code&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;Hong Kong Dollar&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;Hong Kong&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;Number&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;Australian Dollar&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;Sydney&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;Symbol&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;Quantity&quot;
+ .lblRate.Label = &quot;Price&quot;
+ .lblDate.Label = &quot;Transaction Date&quot;
+ .hlnCommission.Label = &quot;Other expenditures&quot;
+ .lblCommission.Label = &quot;Commission&quot;
+ .lblMinimum.Label = &quot;Min. Commission&quot;
+ .lblFix.Label = &quot;Fixed Costs/Charges&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;Dividends/Stocks&quot;
+ .optTotal.Label = &quot;Total Dividends&quot;
+ .lblDividend.Label = &quot;Amount&quot;
+ .lblExchangeRate.Label = &quot;Exchange Rate (old-&gt;new)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;Exchange Date:&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;~Daily&quot;
+ .optWeekly.Label = &quot;~Weekly&quot;
+ .hlnInterval.Label = &quot;Time period&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_es.xba b/wizards/source/depot/Lang_es.xba
new file mode 100644
index 000000000000..e12bf4b2551d
--- /dev/null
+++ b/wizards/source/depot/Lang_es.xba
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_es" script:language="StarBasic">Option Explicit
+
+Sub LoadSpanishLanguage()
+
+ sProductname = GetProductname
+ sOK = &quot;~Aceptar&quot;
+ sCancel = &quot;Cancelar&quot;
+ sColumnHeader = &quot;Título de columna&quot;
+ sInsertStockName = &quot;Introduzca primero algunas acciones en su depósito.&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt;: Administración de acciones&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;Error de entrada&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;Indique una cantidad mayor que 0&quot;
+ sMsgNoDividend = &quot;Indique un dividendo por unidad o un dividendo total&quot;
+ sMsgNoExchangeRate = &quot;Indique aquí un cambio correcto (acción vieja -&gt; nueva acción)&quot;
+ sMsgNoValidExchangeDate = &quot;Indique una fecha correcta para el fraccionamiento de la acción.&quot;
+ sMsgWrongExchangeDate = &quot;El fraccionamiento no es posible porque existen transacciones después de la fecha de fraccionamiento.&quot;
+ sMsgSellTooMuch = &quot;No puede vender tantas acciones. Como máximo: &quot;
+ sMsgConfirm = &quot;Confirmación necesaria&quot;
+ sMsgFreeStock = &quot;¿Tiene previsto considerar acciones gratis?&quot;
+ sMsgTotalLoss = &quot;¿Tiene previsto introducir una pérdida total?&quot;
+ sMsgAuthorization = &quot;Pregunta de seguridad&quot;
+ sMsgDeleteAll = &quot;¿Desea borrar todos los movimientos y reiniciar el balance de depósito?&quot;
+ cSplit = &quot;Fraccionamiento el &quot;
+ sHistory = &quot;Historia&quot;
+ TransactTitle(1) = &quot;Vender acciones&quot;
+ TransactTitle(2) = &quot;Comprar acciones&quot;
+ StockRatesTitle(1) = &quot;Pago de dividendos&quot;
+ StockRatesTitle(2) = &quot;Fraccionamiento&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;Moneda del depósito&quot;
+ sStockName = &quot;Nombre de la acción&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;Resultado Fecha&quot;
+ CurrCellStyle = &quot;1&quot;
+ sStartDate = &quot;Fecha de inicio:&quot;
+ sEndDate = &quot;Fecha final:&quot;
+ sStartUpWelcome = &quot;Esta plantilla le permite administrar eficientemente su depósito de acciones&quot;
+ sStartUpChooseMarket = &quot;Seleccione primero la moneda de referencia y la plaza bursátil para la actualización a través de Internet.&quot;
+ sStartUpHint = &quot;La función &lt;History&gt; está disponible únicamente para el mercado americano.&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;Sin actualización por Internet&quot;
+ sMarketPlace = &quot;Plaza bursátil:&quot;
+ sNoInternetDataAvailable = &quot;No se pudieron recibir las cotizaciones por Internet.&quot;
+ sCheckInternetSettings = &quot;Causas posibles: &lt;BR&gt; Debe comprobar la configuración de Internet.&lt;BR&gt; Ha indicado un código incorrecto (p.ej. número, símbolo, etc.) para la acción.&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;La fecha final debe ser anterior a la fecha de hoy.&quot;
+ sMsgStartDatebeforeEndDate = &quot;La fecha inicial debe ser anterior a la fecha final.&quot;
+
+ sMarket(0,0) = &quot;Dólar estadounidense&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;Nueva York&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;Símbolo&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;Euro&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;Frankfurt&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;Código&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;Libra esterlina&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;Londres&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;Símbolo&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;Yen japonés&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;Tokio&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;Código&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;Dólar hongkonés&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;Hong Kong&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.HK&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;Número&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;Dólar australiano&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;Sidney&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;Símbolo&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;Cantidad&quot;
+ .lblRate.Label = &quot;Cotización&quot;
+ .lblDate.Label = &quot;Fecha de operación&quot;
+ .hlnCommission.Label = &quot;Otros gastos&quot;
+ .lblCommission.Label = &quot;Provisión&quot;
+ .lblMinimum.Label = &quot;Provisión mínima&quot;
+ .lblFix.Label = &quot;Cantidad fija/comisión&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;Dividendos/Acción&quot;
+ .optTotal.Label = &quot;Dividendos totales&quot;
+ .lblDividend.Label = &quot;Importe&quot;
+ .lblExchangeRate.Label = &quot;Cambio (vieja-&gt;nueva)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;Fecha de cambio:&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;~Diario&quot;
+ .optWeekly.Label = &quot;~Semanal&quot;
+ .hlnInterval.Label = &quot;Periodo&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_fr.xba b/wizards/source/depot/Lang_fr.xba
new file mode 100644
index 000000000000..372b974402fd
--- /dev/null
+++ b/wizards/source/depot/Lang_fr.xba
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_fr" script:language="StarBasic">Option Explicit
+
+Sub LoadFrenchLanguage()
+
+ sProductname = GetProductname
+ sOK = &quot;~OK&quot;
+ sCancel = &quot;Annuler&quot;
+ sColumnHeader = &quot;En-tête de colonne&quot;
+ sInsertStockName = &quot;Saisissez quelques actions dans votre portefeuille !&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt; : Gestion d&apos;actions&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;Erreur de saisie&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;Saisissez une quantité supérieure à 0 !&quot;
+ sMsgNoDividend = &quot;Vous devez saisir le montant des dividendes perçus (soit les dividendes par action, soit la somme totale perçue).&quot;
+ sMsgNoExchangeRate = &quot;Saisissez un taux correct de conversion (anciennes actions -&gt; nouvelles actions).&quot;
+ sMsgNoValidExchangeDate = &quot;Saisissez une date correcte pour le split d&apos;action.&quot;
+ sMsgWrongExchangeDate = &quot;Split impossible car il y a déjà eu des transactions après la date du split !&quot;
+ sMsgSellTooMuch = &quot;Impossible de vendre autant d&apos;actions ! Maximum : &quot;
+ sMsgConfirm = &quot;Confirmation requise&quot;
+ sMsgFreeStock = &quot;S&apos;agit-il d&apos;actions gratuites ?&quot;
+ sMsgTotalLoss = &quot;Prévoyez-vous une perte totale ?&quot;
+ sMsgAuthorization = &quot;Requête de sécurité&quot;
+ sMsgDeleteAll = &quot;Voulez-vous supprimer tous les mouvements et remettre le portefeuille d&apos;actions à zéro ?&quot;
+ cSplit = &quot;Split d&apos;action le &quot;
+ sHistory = &quot;Historique&quot;
+ TransactTitle(1) = &quot;Vente d&apos;actions&quot;
+ TransactTitle(2) = &quot;Achat d&apos;actions&quot;
+ StockRatesTitle(1) = &quot;Versement des dividendes&quot;
+ StockRatesTitle(2) = &quot;Split d&apos;action&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;Monnaie du portefeuille&quot;
+ sStockName = &quot;Nom de l&apos;action&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;Résultat date&quot;
+ CurrCellStyle = &quot;1&quot;
+ sStartDate = &quot;Date de début :&quot;
+ sEndDate = &quot;Date de fin :&quot;
+ sStartUpWelcome = &quot;Utilisez ce modèle pour une gestion efficiente de votre portefeuille d&apos;actions !&quot;
+ sStartUpChooseMarket = &quot;Commencez par choisir une monnaie de référence et ainsi la place boursière pour la mise à jour Internet !&quot;
+ sStartUpHint = &quot;La fonction &lt;History&gt; n&apos;est cependant disponible que pour le marché américain.&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;Sans mise à jour Internet&quot;
+ sMarketPlace = &quot;Place boursière :&quot;
+ sNoInternetDataAvailable = &quot;Réception des cours Internet impossible !&quot;
+ sCheckInternetSettings = &quot;Causes possibles : &lt;BR&gt; Problème de paramétrage Internet : vérifiez les paramètres !&lt;BR&gt; Vous avez saisi un identificateur (par ex. symbole ou code) incorrect pour l&apos;action.&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;La date spécifiée pour la fin doit précéder celle de ce jour !&quot;
+ sMsgStartDatebeforeEndDate = &quot;La date spécifiée pour le début doit succéder à celle de ce jour !&quot;
+
+ sMarket(0,0) = &quot;Dollar Américain&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;New York&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;Symbole&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;Euro&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;Francfort&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;Code&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;Livre Sterling&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;Londres&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;Symbole&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;Yen Japonais&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;Tokyo&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;Code&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;Dollar de Hong Kong&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;Hong Kong&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;Numéro&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;Dollar Australien&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;Sydney&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;Symbole&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;Quantité&quot;
+ .lblRate.Label = &quot;Cours&quot;
+ .lblDate.Label = &quot;Date de transaction&quot;
+ .hlnCommission.Label = &quot;Dépenses diverses&quot;
+ .lblCommission.Label = &quot;Commission&quot;
+ .lblMinimum.Label = &quot;Commission minimale&quot;
+ .lblFix.Label = &quot;Montant fixe/frais&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;Dividende/action&quot;
+ .optTotal.Label = &quot;Dividende total&quot;
+ .lblDividend.Label = &quot;Montant&quot;
+ .lblExchangeRate.Label = &quot;Taux de conversion (ancien-&gt;nouveau)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;Date de la conversion:&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;~Quotidien&quot;
+ .optWeekly.Label = &quot;~Hebdomadaire&quot;
+ .hlnInterval.Label = &quot;Période&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_it.xba b/wizards/source/depot/Lang_it.xba
new file mode 100644
index 000000000000..2450bed82a88
--- /dev/null
+++ b/wizards/source/depot/Lang_it.xba
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_it" script:language="StarBasic">Option Explicit
+
+Sub LoadItalianLanguage()
+
+ sProductname = GetProductname
+ sOK = &quot;~OK&quot;
+ sCancel = &quot;Annulla&quot;
+ sColumnHeader = &quot;Intestazione colonna&quot;
+ sInsertStockName = &quot;Inserite un nome di azioni&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt;: Gestione delle azioni&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;Errore dati immessi&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;Inserite il numero delle azioni&quot;
+ sMsgNoDividend = &quot;Inserite un dividendo a unità oppure un dividendo totale&quot;
+ sMsgNoExchangeRate = &quot;Indicate un corretto tasso di cambio (vecchie azioni -&gt; nuove azioni).&quot;
+ sMsgNoValidExchangeDate = &quot;Indicate la data di frazionamento delle azioni.&quot;
+ sMsgWrongExchangeDate = &quot;Il frazionamento non è possibile perché sono ancora in atto transazioni dopo la data indicata.&quot;
+ sMsgSellTooMuch = &quot;Non potete vendere così tante azioni. Massimo: &quot;
+ sMsgConfirm = &quot;È necessaria una conferma&quot;
+ sMsgFreeStock = &quot;Confermate la digitazione di azioni gratuite?&quot;
+ sMsgTotalLoss = &quot;Confermate la digitazione di perdita totale?&quot;
+ sMsgAuthorization = &quot;Domanda di sicurezza&quot;
+ sMsgDeleteAll = &quot;Eliminare tutti i movimenti e ripristinare la panoramica dei depositi?&quot;
+ cSplit = &quot;Frazionamento delle azioni il: &quot;
+ sHistory = &quot;Cronologia&quot;
+ TransactTitle(1) = &quot;Vendita di azioni&quot;
+ TransactTitle(2) = &quot;Acquisto di azioni&quot;
+ StockRatesTitle(1) = &quot;Pagamento dei dividendi&quot;
+ StockRatesTitle(2) = &quot;Frazionamento azioni&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;Valuta deposito&quot;
+ sStockName = &quot;Nome delle azioni&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;Risultato data&quot;
+ CurrCellStyle = &quot;1&quot;
+ sStartDate = &quot;Data d&apos;inizio:&quot;
+ sEndDate = &quot;Data finale:&quot;
+ sStartUpWelcome = &quot;Questo modello vi permette una gestione efficace delle vostre azioni.&quot;
+ sStartUpChooseMarket = &quot;Selezionate la valuta di riferimento e la Borsa per il collegamento Internet.&quot;
+ sStartUpHint = &quot;La funzione &lt;History&gt; è disponibile solo per il mercato americano.&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;Senza aggiornamento Internet&quot;
+ sMarketPlace = &quot;Borsa:&quot;
+ sNoInternetDataAvailable = &quot;Impossibile ricevere le quotazioni Internet&quot;
+ sCheckInternetSettings = &quot;Possibili cause: &lt;BR&gt; le impostazioni Internet devono essere modificate.&lt;BR&gt; Avete indicato un indice (ad es. simbolo o codice) errato per le azioni.&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;La data finale dev&apos;essere anteriore alla data odierna.&quot;
+ sMsgStartDatebeforeEndDate = &quot;La data d&apos;inizio deve precedere la data finale.&quot;
+
+ sMarket(0,0) = &quot;Dollaro USA&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;New York&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;Simbolo&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;Euro&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;Francoforte&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;Numero identificazione titoli&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;Sterlina inglese&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;Londra&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;Simbolo&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;Yen&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;Tokyo&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;Codice&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;Dollaro Hong Kong&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;Hong Kong&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;Numero&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;Dollaro australiano&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;Sydney&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;Simbolo&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;Quantità&quot;
+ .lblRate.Label = &quot;Quotazione&quot;
+ .lblDate.Label = &quot;Data della transazione&quot;
+ .hlnCommission.Label = &quot;Spese extra&quot;
+ .lblCommission.Label = &quot;Commissioni&quot;
+ .lblMinimum.Label = &quot;Commissione minima&quot;
+ .lblFix.Label = &quot;Importo fisso/Spese&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;Dividendo/Azione&quot;
+ .optTotal.Label = &quot;Dividendo totale&quot;
+ .lblDividend.Label = &quot;Importo&quot;
+ .lblExchangeRate.Label = &quot;Tasso di cambio (vecchio-&gt;nuovo)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;Data di cambio:&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;~Giornaliero&quot;
+ .optWeekly.Label = &quot;~Settimanale&quot;
+ .hlnInterval.Label = &quot;Durata&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_ja.xba b/wizards/source/depot/Lang_ja.xba
new file mode 100644
index 000000000000..4b4a53de3607
--- /dev/null
+++ b/wizards/source/depot/Lang_ja.xba
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_ja" script:language="StarBasic">Option Explicit
+
+Sub LoadJapaneseLanguage()
+
+ sProductname = GetProductname
+ sOK = &quot;~OK&quot;
+ sCancel = &quot;キャンセル&quot;
+ sColumnHeader = &quot;列番号&quot;
+ sInsertStockName = &quot;最初に株の銘柄を入力してください。&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt;: 株管理&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;入力フィールド&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;0 より大きな額を入力してください。&quot;
+ sMsgNoDividend = &quot;1株当たりの配当金額または総配当金額を入力してください。&quot;
+ sMsgNoExchangeRate = &quot;交換比率(旧株-&gt;新株)を入力してください。&quot;
+ sMsgNoValidExchangeDate = &quot;株式分割日を入力してください。&quot;
+ sMsgWrongExchangeDate = &quot;分割日以降に取引がすでに存在するので、分割できません。&quot;
+ sMsgSellTooMuch = &quot;売却できる株式数を超えています。最大値: &quot;
+ sMsgConfirm = &quot;ご確認ください&quot;
+ sMsgFreeStock = &quot;無料株式を入力しますか?&quot;
+ sMsgTotalLoss = &quot;全損の入力を行いますか?&quot;
+ sMsgAuthorization = &quot;確認ダイアログ&quot;
+ sMsgDeleteAll = &quot;すべての移動を取り消し、ポートフォリオの概要をリセットしますか?&quot;
+ cSplit = &quot;株式分割日 &quot;
+ sHistory = &quot;履歴&quot;
+ TransactTitle(1) = &quot;株を買う&quot;
+ TransactTitle(2) = &quot;株を買う&quot;
+ StockRatesTitle(1) = &quot;配当額&quot;
+ StockRatesTitle(2) = &quot;株式分割&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;ポートフォリオの通貨&quot;
+ sStockName = &quot;株式名&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;結果(日付)&quot;
+ CurrCellStyle = &quot;1&quot;
+ sStartDate = &quot;開始日:&quot;
+ sEndDate = &quot;終了日:&quot;
+ sStartUpWelcome = &quot;このテンプレートを使えば、株式のポートフォリオをより効率的に管理できます。&quot;
+ sStartUpChooseMarket = &quot;まず、インターネットにより情報を更新する基準通貨と、対応する証券取引所を選択します。&quot;
+ sStartUpHint = &quot;残念ながら、&lt;History&gt; 機能を使用できるのは米国市場に限られています。&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;インターネットによる情報の更新を行いません&quot;
+ sMarketPlace = &quot;証券取引所:&quot;
+ sNoInternetDataAvailable = &quot;インターネットから株価情報を受信できない場合があります!&quot;
+ sCheckInternetSettings = &quot;考えられる原因は次のとおりです。&lt;BR&gt;インターネット設定の変更が必要です。&lt;BR&gt;入力した株式のが間違っています。&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;終了日は、今日の日付より前であることが必要です。&quot;
+ sMsgStartDatebeforeEndDate = &quot;開始日は、終了日より前であることが必要です。&quot;
+
+ sMarket(0,0) = &quot;米ドル&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;ニューヨーク&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;シンボル&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;ユーロ&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;フランクフルト&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;銘柄コード&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;英ポンド&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;ロンドン&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;シンボル&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;日本円&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;東京&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;コード&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;香港ドル&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;香港&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.HK&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;番号&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;オーストリア・ドル&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;シドニー&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;シンボル&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;株数&quot;
+ .lblRate.Label = &quot;価格&quot;
+ .lblDate.Label = &quot;取引日&quot;
+ .hlnCommission.Label = &quot;その他の経費n&quot;
+ .lblCommission.Label = &quot;手数料&quot;
+ .lblMinimum.Label = &quot;最低手数料&quot;
+ .lblFix.Label = &quot;固定費/諸経費&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;配当金/株式数&quot;
+ .optTotal.Label = &quot;配当金の総額&quot;
+ .lblDividend.Label = &quot;金額&quot;
+ .lblExchangeRate.Label = &quot;交換比率(旧株-&gt;新株)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;交換日:&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;~毎日&quot;
+ .optWeekly.Label = &quot;~毎週&quot;
+ .hlnInterval.Label = &quot;期間&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_ko.xba b/wizards/source/depot/Lang_ko.xba
new file mode 100644
index 000000000000..1b701dcbab67
--- /dev/null
+++ b/wizards/source/depot/Lang_ko.xba
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_ko" script:language="StarBasic">Option Explicit
+
+Sub LoadKoreanLanguage()
+
+ sProductname = GetProductname
+ sOK = &quot;~확인&quot;
+ sCancel = &quot;취소&quot;
+ sColumnHeader = &quot;열 머리글&quot;
+ sInsertStockName = &quot;주식 종목을 삽입해주십시오.&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt;: 주식 매수&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;입력 오류&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;0 이하의 매수를 입력해주십시오.&quot;
+ sMsgNoDividend = &quot;한 주당 배당분 또는 총배당분을 입력해주십시오.&quot;
+ sMsgNoExchangeRate = &quot;정확한 환율을 입력해주십시오 (구주를 신주로 소급 시).&quot;
+ sMsgNoValidExchangeDate = &quot;유효한 배당 결제일을 입력해주십시오.&quot;
+ sMsgWrongExchangeDate = &quot;배당 기준일이 경과하여 배당할 수 없습니다.&quot;
+ sMsgSellTooMuch = &quot;이렇게 많은 주식을 팔 수 없습니다. 최대 매도수: &quot;
+ sMsgConfirm = &quot;확인 필요&quot;
+ sMsgFreeStock = &quot;공짜 주식을 입력하시겠습니까?&quot;
+ sMsgTotalLoss = &quot;주가 폭락세를 입력하시겠습니까?&quot;
+ sMsgAuthorization = &quot;안정성 조회&quot;
+ sMsgDeleteAll = &quot;모든 주가 움직임을 삭제하고 계좌 현황을 원래대로 하시겠습니까?&quot;
+ cSplit = &quot;주식 배당일 &quot;
+ sHistory = &quot;내역&quot;
+ TransactTitle(1) = &quot;주식 관리: 주식 매도&quot;
+ TransactTitle(2) = &quot;주식 관리: 주식 매수&quot;
+ StockRatesTitle(1) = &quot;주식 관리: 배당금 지불&quot;
+ StockRatesTitle(2) = &quot;주식 관리: 주식 배분&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;주식 계좌 통화&quot;
+ sStockName = &quot;주식 종목명&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;결과, 날짜&quot;
+ CurrCellStyle = &quot;1&quot;
+ sStartDate = &quot;매매일:&quot;
+ sEndDate = &quot;만기일:&quot;
+ sStartUpWelcome = &quot;이 템플릿을 사용하여 주식 투자 관리를 효율적으로 할 수 있습니다.&quot;
+ sStartUpChooseMarket = &quot;인터넷 업데이트를 위해 우선 관련 통화와 증권 장소를 선택하십시오.&quot;
+ sStartUpHint = &quot;&lt;내역&gt; 기능은 미국 시장용으로만 사용할 수 있습니다.&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;인터넷 업데이트 없음&quot;
+ sMarketPlace = &quot;증권 장소:&quot;
+ sNoInternetDataAvailable = &quot;인터넷 시세는 받을 수 없었습니다.&quot;
+ sCheckInternetSettings = &quot;원인: &lt;BR&gt; 인터넷 설정을 점검해야만 합니다.&lt;BR&gt; 옳지 않은 암호&lt;예를 들어 잘못된 문자 또는 종목 코드&gt;를 입력했습니다.&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;만기일은 오늘 날짜 전에 기입되어야 합니다.&quot;
+ sMsgStartDatebeforeEndDate = &quot;매매일은 만기일 전에 기입되어야 합니다.&quot;
+
+ sMarket(0,0) = &quot;미국 달러&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;뉴욕&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;기호&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;유로&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;프랑크푸르트&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;WKN&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;영국 파운드&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;런던&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;기호&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;엔화&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;도쿄&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;코드&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;홍콩 달러&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;홍콩&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.HK&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;번호&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;호주 달러&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;시드니&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;기호&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;수량&quot;
+ .lblRate.Label = &quot;시세&quot;
+ .lblDate.Label = &quot;배당 결산일&quot;
+ .hlnCommission.Label = &quot;기타 지출&quot;
+ .lblCommission.Label = &quot;수수료&quot;
+ .lblMinimum.Label = &quot;최저 수수료&quot;
+ .lblFix.Label = &quot;약정 금액/기타 경비&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;배당분/주&quot;
+ .optTotal.Label = &quot;배당분 합계&quot;
+ .lblDividend.Label = &quot;금액&quot;
+ .lblExchangeRate.Label = &quot;환율(구주-&gt;신주)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;환율일자&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;~매일&quot;
+ .optWeekly.Label = &quot;~매주&quot;
+ .hlnInterval.Label = &quot;기간&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_sv.xba b/wizards/source/depot/Lang_sv.xba
new file mode 100644
index 000000000000..bbfe930b60ca
--- /dev/null
+++ b/wizards/source/depot/Lang_sv.xba
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_sv" script:language="StarBasic">Option Explicit
+
+Sub LoadSwedishLanguage()
+ sProductname = GetProductname
+ sOK = &quot;~OK&quot;
+ sCancel = &quot;Avbryt&quot;
+ sColumnHeader = &quot;Kolumnhuvud&quot;
+ sInsertStockName = &quot;Infoga först några aktier i Din portfölj!&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt;: Aktieförvaltning&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;Inmatningsfel&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;Var vänlig och mata in ett större antal än 0&quot;
+ sMsgNoDividend = &quot;Var vänlig och mata in utdelning per styck eller den totala utdelningen&quot;
+ sMsgNoExchangeRate = &quot;Var vänlig och mata in en korrekt omräkningskurs (gamla aktier -&gt; nya aktier).&quot;
+ sMsgNoValidExchangeDate = &quot;Var vänlig och mata in ett giltigt datum för aktiesplitten.&quot;
+ sMsgWrongExchangeDate = &quot;Split är inte möjlig eftersom det redan finns transaktioner efter splitdatum.&quot;
+ sMsgSellTooMuch = &quot;Så många aktier kan Du inte sälja. Maximum: &quot;
+ sMsgConfirm = &quot;Bekräftelse krävs&quot;
+ sMsgFreeStock = &quot;Avser Du att mata in gratisaktier?&quot;
+ sMsgTotalLoss = &quot;Avser Du att mata in en totalförlust?&quot;
+ sMsgAuthorization = &quot;Säkerhetskontroll&quot;
+ sMsgDeleteAll = &quot;Vill Du ta bort alla rörelser och återställa portföljöversikten?&quot;
+ cSplit = &quot;Aktiesplit den &quot;
+ sHistory = &quot;Historik&quot;
+ TransactTitle(1) = &quot;Sälja aktier&quot;
+ TransactTitle(2) = &quot;Köpa aktier&quot;
+ StockRatesTitle(1) = &quot;Aktieutdelning&quot;
+ StockRatesTitle(2) = &quot;Aktiesplit&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;Portföljvaluta&quot;
+ sStockName = &quot;Aktienamn&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;Resultat datum&quot;
+ CurrCellStyle = &quot;1&quot;
+ sStartDate = &quot;Startdatum:&quot;
+ sEndDate = &quot;Slutdatum:&quot;
+ sStartUpWelcome = &quot;Med hjälp av den här mallen kan Du förvalta Din aktieportfölj effektivt&quot;
+ sStartUpChooseMarket = &quot;Välj först Din referensvaluta och därigenom börs för Internet-uppdateringen!&quot;
+ sStartUpHint = &quot;Tyvärr är &lt;History&gt;-funktionen bara tillgänglig för den amerikanska marknaden!&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;utan Internet-uppdatering&quot;
+ sMarketPlace = &quot;Börs:&quot;
+ sNoInternetDataAvailable = &quot;Det gick inte att ta emot Internet-kurser!&quot;
+ sCheckInternetSettings = &quot;Detta kan bero på att: &lt;BR&gt; Dina Internet-inställningar måste ändras.&lt;BR&gt; Du har angivit ett felaktigt ID (t.ex. symbol, värdepappersnr.) för aktien.&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;Slutdatum måste ligga före idag!&quot;
+ sMsgStartDatebeforeEndDate = &quot;Startdatum måste ligga före slutdatum!&quot;
+
+ sMarket(0,0) = &quot;Amerikansk dollar&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;New York&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;Symbol&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;Euro&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;Frankfurt&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;Värdepappersnr&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;Engelskt pund&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;London&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;Symbol&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;Japansk yen&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;Tokyo&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;Kod&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;Hongkongdollar&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;Hongkong&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;Nummer&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;Australisk dollar&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;Sydney&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;Symbol&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;Antal&quot;
+ .lblRate.Label = &quot;Kurs&quot;
+ .lblDate.Label = &quot;Transaktionsdatum&quot;
+ .hlnCommission.Label = &quot;Övriga utgifter&quot;
+ .lblCommission.Label = &quot;Provision&quot;
+ .lblMinimum.Label = &quot;Minimiprovision&quot;
+ .lblFix.Label = &quot;Fast belopp/omkostnader&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;Utdelning per aktie&quot;
+ .optTotal.Label = &quot;Utdelning totalt&quot;
+ .lblDividend.Label = &quot;Belopp&quot;
+ .lblExchangeRate.Label = &quot;Omräkningskurs (gammal-&gt;ny)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;Omräkningsdatum:&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;~Dagligen&quot;
+ .optWeekly.Label = &quot;~Varje vecka&quot;
+ .hlnInterval.Label = &quot;Period&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_tw.xba b/wizards/source/depot/Lang_tw.xba
new file mode 100644
index 000000000000..fbe54a413132
--- /dev/null
+++ b/wizards/source/depot/Lang_tw.xba
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_tw" script:language="StarBasic">Option Explicit
+
+Sub LoadChineseTradLanguage()
+
+ sProductname = GetProductname
+ sOK = &quot;確定&quot;
+ sCancel = &quot;取消&quot;
+ sColumnHeader = &quot;欄標簽&quot;
+ sInsertStockName = &quot;請先填入股票名稱!&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt;: 股票管理&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;輸入無效&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;請輸入大於0的交易股數&quot;
+ sMsgNoDividend = &quot;請輸入每股股息金額或股息總額&quot;
+ sMsgNoExchangeRate = &quot;請鍵入正確的換算比率(舊股票 -&gt; 新股票)。&quot;
+ sMsgNoValidExchangeDate = &quot;請輸入股票分割的日期。&quot;
+ sMsgWrongExchangeDate = &quot;無法分割股票,因為分割日期之後已經買進或賣出股票。&quot;
+ sMsgSellTooMuch = &quot;最多能出售的股票數: &quot;
+ sMsgConfirm = &quot;需要确認&quot;
+ sMsgFreeStock = &quot;需要輸入一個贈送的股票?&quot;
+ sMsgTotalLoss = &quot;要輸入一個全部損失的股票?&quot;
+ sMsgAuthorization = &quot;安全詢問&quot;
+ sMsgDeleteAll = &quot;您要刪除所有的交易資料,重新建立一個股票一覽表?&quot;
+ cSplit = &quot;股票分割的日期 &quot;
+ sHistory = &quot;紀錄&quot;
+ TransactTitle(1) = &quot;出售股票&quot;
+ TransactTitle(2) = &quot;購買股票&quot;
+ StockRatesTitle(1) = &quot;支付股息&quot;
+ StockRatesTitle(2) = &quot;股票分割&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;股票的貨幣&quot;
+ sStockName = &quot;股票名稱&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;結果 日期&quot;
+ CurrCellStyle = &quot;1&quot;
+ sStartDate = &quot;交割日期:&quot;
+ sEndDate = &quot;到期日期:&quot;
+ sStartUpWelcome = &quot;這個樣式用於高效能地管理股票交易。&quot;
+ sStartUpChooseMarket = &quot;請先選一個參照的貨幣和一個可直接從 Internet 更新資料的贈券交易所。&quot;
+ sStartUpHint = &quot;很遺憾,&lt;History&gt;-功能僅適用於美國的交易所。&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;不透過 internet 更新&quot;
+ sMarketPlace = &quot;證券交易所:&quot;
+ sNoInternetDataAvailable = &quot;無法接受 Internet 股票價格!&quot;
+ sCheckInternetSettings = &quot;可能的原因:&lt;BR&gt;Internet 設定不正確,需要重新設定。&lt;BR&gt;輸入了一個錯誤的股票代碼。&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;到期日期必須是在今日之前!&quot;
+ sMsgStartDatebeforeEndDate = &quot;交割日期必須是在到期日期之前!&quot;
+
+ sMarket(0,0) = &quot;美元&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;紐約&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;股票符號&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;歐元&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;法蘭克福&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;股代碼&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;英鎊&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;倫敦&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;股票符號&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;日元&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;東京&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;代碼&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;港幣&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;香港&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.HK&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;編號&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;澳元&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;悉尼&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;股票符號&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;數量&quot;
+ .lblRate.Label = &quot;股票價格&quot;
+ .lblDate.Label = &quot;交易日期&quot;
+ .hlnCommission.Label = &quot;其它的支出費用&quot;
+ .lblCommission.Label = &quot;手續費&quot;
+ .lblMinimum.Label = &quot;最低手續費&quot;
+ .lblFix.Label = &quot;固定金額/費用&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;每股股息&quot;
+ .optTotal.Label = &quot;股息總計&quot;
+ .lblDividend.Label = &quot;金額&quot;
+ .lblExchangeRate.Label = &quot;轉換比率(舊股票 -&gt; 新股票)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;轉換日期:&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;每日&quot;
+ .optWeekly.Label = &quot;每週&quot;
+ .hlnInterval.Label = &quot;時間週期&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/Lang_zh.xba b/wizards/source/depot/Lang_zh.xba
new file mode 100644
index 000000000000..94e05bfe5ecd
--- /dev/null
+++ b/wizards/source/depot/Lang_zh.xba
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Lang_zh" script:language="StarBasic">Option Explicit
+
+Sub LoadChineseSimpleLanguage()
+
+ sProductname = GetProductname
+ sOK = &quot;确定&quot;
+ sCancel = &quot;取消&quot;
+ sColumnHeader = &quot;列标题&quot;
+ sInsertStockName = &quot;请首先往您的帐号内输入一些股票名称!&quot;
+ sTitle = &quot;&lt;PRODUCTNAME&gt;:股票管理&quot;
+ sTitle = ReplaceString(sTitle, sProductName, &quot;&lt;PRODUCTNAME&gt;&quot;)
+ sMsgError = &quot;输入错误&quot;
+ sMsgNoName = sInsertStockname
+ sMsgNoQuantity = &quot;请输入大于0的交易股数&quot;
+ sMsgNoDividend = &quot;请输入每股的红利金额或红利总额&quot;
+ sMsgNoExchangeRate = &quot;请输入一个正确的兑换率(旧股-&gt; 新股)。&quot;
+ sMsgNoValidExchangeDate = &quot;请输入拆股生效日期。&quot;
+ sMsgWrongExchangeDate = &quot;因为在拆股生效后已经进行了股票交易,所以无法拆股。&quot;
+ sMsgSellTooMuch = &quot;您最多能出售的股票数为: &quot;
+ sMsgConfirm = &quot;需要确认&quot;
+ sMsgFreeStock = &quot;您想要输入赠送股票?&quot;
+ sMsgTotalLoss = &quot;您想要输入总亏损值?&quot;
+ sMsgAuthorization = &quot;安全查询&quot;
+ sMsgDeleteAll = &quot;您要删除所有的交易信息并重新建立股票帐号一览表吗?&quot;
+ cSplit = &quot;股票拆股日期 &quot;
+ sHistory = &quot;记录&quot;
+ TransactTitle(1) = &quot;出售股票&quot;
+ TransactTitle(2) = &quot;购买股票&quot;
+ StockRatesTitle(1) = &quot;支付红利&quot;
+ StockRatesTitle(2) = &quot;股票拆股&quot;
+ StockRatesTitle(3) = sHistory
+ sDepotCurrency = &quot;股票交易的货币&quot;
+ sStockName = &quot;股票名称&quot;
+ TransactMode = LIFO &apos; Possible values: &quot;FIFO&quot; and &quot;LIFO&quot;
+ DateCellStyle = &quot;结果 日期&quot;
+ CurrCellStyle = &quot;1&quot;
+ sStartDate = &quot;起始日期:&quot;
+ sEndDate = &quot;终止日期:&quot;
+ sStartUpWelcome = &quot;这个样式能够帮助您有效地管理自己的股票帐号&quot;
+ sStartUpChooseMarket = &quot;请首先选择采用的参考货币以及要直接用国际互联网来更新资料的证券交易所!&quot;
+ sStartUpHint = &quot;很遗憾,&lt;History&gt;功能仅可供美国市场使用!&quot;
+ sStartupHint = ReplaceString(sStartUpHint, sHistory, &quot;&lt;History&gt;&quot;)
+ sNoInternetUpdate = &quot;不通过国际互联网更新&quot;
+ sMarketPlace = &quot;交易所:&quot;
+ sNoInternetDataAvailable = &quot;无法获得国际互联网上的行情!&quot;
+ sCheckInternetSettings = &quot;可能的原因是:&lt;BR&gt;您的国际互联网设定不正确,需要重新设定。&lt;BR&gt;输入了一个错误的股票号码。&quot;
+ sCheckInternetSettings = ReplaceString(sCheckInternetSettings, chr(13), &quot;&lt;BR&gt;&quot;)
+
+ sMsgEndDatebeforeNow = &quot;终止日期必须在今天之前!&quot;
+ sMsgStartDatebeforeEndDate = &quot;起始日期必须在终止日期之前!&quot;
+
+ sMarket(0,0) = &quot;美元&quot;
+ sMarket(0,1) = &quot;$&quot;
+ sMarket(0,2) = &quot;纽约&quot;
+ sMarket(0,3) = &quot;http://finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(0,4) = &quot;http://ichart.finance.yahoo.com/table.csv?&quot; &amp;_
+ &quot;s=&lt;StockID&gt;&amp;d=&lt;EndMonth&gt;&amp;e=&lt;EndDay&gt;&amp;f=&lt;Endyear&gt;&amp;g=d&amp;&quot; &amp;_
+ &quot;a=&lt;StartMonth&gt;&amp;b=&lt;StartDay&gt;&amp;c=&lt;Startyear&gt;&amp;ignore=.csv&quot;
+ sMarket(0,5) = &quot;图标&quot;
+ sMarket(0,6) = &quot;en&quot;
+ sMarket(0,7) = &quot;US&quot;
+ sMarket(0,8) = &quot;409&quot;
+ sMarket(0,9) = &quot;44&quot;
+ sMarket(0,10) = &quot;1&quot;
+
+ sMarket(1,0) = &quot;欧元&quot;
+ sMarket(1,1) = chr(8364)
+ sMarket(1,2) = &quot;法兰克福&quot;
+ sMarket(1,3) = &quot;http://de.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.F&amp;f=sl1t1c1ghpv&amp;e=.csv&quot;
+ sMarket(1,5) = &quot;代码&quot;
+ sMarket(1,6) = &quot;de;nl;pt;el&quot;
+ sMarket(1,7) = &quot;DE;NL;PT;GR&quot;
+ sMarket(1,8) = &quot;407;413;816;408&quot;
+ sMarket(1,9) = &quot;59/9&quot;
+ sMarket(1,10) = &quot;1&quot;
+
+ sMarket(2,0) = &quot;英镑&quot;
+ sMarket(2,1) = &quot;£&quot;
+ sMarket(2,2) = &quot;伦敦&quot;
+ sMarket(2,3) = &quot;http://uk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.L&amp;m=*&amp;f=sl1t1c1ghov&amp;e=.csv&quot;
+ sMarket(2,5) = &quot;股票代码&quot;
+ sMarket(2,6) = &quot;en&quot;
+ sMarket(2,7) = &quot;GB&quot;
+ sMarket(2,8) = &quot;809&quot;
+ sMarket(2,9) = &quot;44&quot;
+ sMarket(2,10) = &quot;1&quot;
+
+ sMarket(3,0) = &quot;日元&quot;
+ sMarket(3,1) = &quot;¥&quot;
+ sMarket(3,2) = &quot;东京&quot;
+ sMarket(3,3) = &quot;&quot;
+ sMarket(3,5) = &quot;代码&quot;
+ sMarket(3,6) = &quot;ja&quot;
+ sMarket(3,7) = &quot;JP&quot;
+ sMarket(3,8) = &quot;411&quot;
+ sMarket(3,9) = &quot;&quot;
+ sMarket(3,10) = &quot;&quot;
+
+ sMarket(4,0) = &quot;港币&quot;
+ sMarket(4,1) = &quot;HK$&quot;
+ sMarket(4,2) = &quot;香港&quot;
+ sMarket(4,3) = &quot;http://hk.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;.HK&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(4,5) = &quot;编号&quot;
+ sMarket(4,6) = &quot;zh&quot;
+ sMarket(4,7) = &quot;HK&quot;
+ sMarket(4,8) = &quot;C04&quot;
+ sMarket(4,9) = &quot;44&quot;
+ sMarket(4,10) = &quot;1&quot;
+
+ sMarket(5,0) = &quot;澳元&quot;
+ sMarket(5,1) = &quot;$&quot;
+ sMarket(5,2) = &quot;悉尼&quot;
+ sMarket(5,3) = &quot;http://au.finance.yahoo.com/d/quotes.csv?s=&lt;StockID&gt;&amp;f=sl1d1t1c1ohgv&amp;e=.csv&quot;
+ sMarket(5,5) = &quot;股票代码&quot;
+ sMarket(5,6) = &quot;en&quot;
+ sMarket(5,7) = &quot;AU&quot;
+ sMarket(5,8) = &quot;C09&quot;
+ sMarket(5,9) = &quot;44&quot;
+ sMarket(5,10) = &quot;1&quot;
+
+&apos; ****************************End of the default subset*********************************
+ CompleteMarketList()
+
+ LocalizedCurrencies()
+
+ With TransactModel
+ .lblStockNames.Label = sStockname
+ .lblQuantity.Label = &quot;数量&quot;
+ .lblRate.Label = &quot;股票牌价&quot;
+ .lblDate.Label = &quot;交易日期&quot;
+ .hlnCommission.Label = &quot;其它支出费用&quot;
+ .lblCommission.Label = &quot;手续费&quot;
+ .lblMinimum.Label = &quot;最低手续费&quot;
+ .lblFix.Label = &quot;固定金额/费用&quot;
+ .cmdGoOn.Label = sOK
+ .cmdCancel.Label = sCancel
+ End With
+
+ With StockRatesModel
+ .optPerShare.Label = &quot;每股红利&quot;
+ .optTotal.Label = &quot;红利总计&quot;
+ .lblDividend.Label = &quot;金额&quot;
+ .lblExchangeRate.Label = &quot;兑换率(旧-&gt;新)&quot;
+ .lblColon.Label = &quot;:&quot;
+ .lblDate.Label = &quot;兑换日期:&quot;
+ .lblStockNames.Label = sStockname
+ .lblStartDate.Label = sStartDate
+ .lblEndDate.Label = sEndDate
+ .optDaily.Label = &quot;每天&quot;
+ .optWeekly.Label = &quot;每周&quot;
+ .hlnInterval.Label = &quot;时间周期&quot;
+ .cmdGoOn.Label = sOk
+ .cmdCancel.Label = sCancel
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/depot/delzip b/wizards/source/depot/delzip
new file mode 100644
index 000000000000..636fda90bfcb
--- /dev/null
+++ b/wizards/source/depot/delzip
@@ -0,0 +1 @@
+ECHO is OFF
diff --git a/wizards/source/depot/dialog.xlb b/wizards/source/depot/dialog.xlb
new file mode 100644
index 000000000000..764ea3f35335
--- /dev/null
+++ b/wizards/source/depot/dialog.xlb
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Depot" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="Dialog2"/>
+ <library:element library:name="Dialog3"/>
+ <library:element library:name="Dialog4"/>
+</library:library>
diff --git a/wizards/source/depot/makefile.mk b/wizards/source/depot/makefile.mk
new file mode 100644
index 000000000000..2049b6a173a0
--- /dev/null
+++ b/wizards/source/depot/makefile.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=depotall
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+#
+# testresource.
+#
+# SRS2NAME = depot
+# SRC2FILES= webwizar.src
+# RESLIB2SRSFILES= $(SRS)$/webwizar.srs
+# RESLIB2NAME= wwz
+
+ZIP1TARGET = $(DEPOT_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/depot/script.xlb b/wizards/source/depot/script.xlb
new file mode 100644
index 000000000000..372665b22760
--- /dev/null
+++ b/wizards/source/depot/script.xlb
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Depot" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="Depot"/>
+ <library:element library:name="CommonLang"/>
+ <library:element library:name="Currency"/>
+ <library:element library:name="Internet"/>
+ <library:element library:name="Lang_de"/>
+ <library:element library:name="tools"/>
+ <library:element library:name="Lang_en"/>
+ <library:element library:name="Lang_fr"/>
+ <library:element library:name="Lang_it"/>
+ <library:element library:name="Lang_es"/>
+ <library:element library:name="Lang_sv"/>
+ <library:element library:name="Lang_zh"/>
+ <library:element library:name="Lang_tw"/>
+ <library:element library:name="Lang_ko"/>
+ <library:element library:name="Lang_ja"/>
+</library:library>
diff --git a/wizards/source/depot/tools.xba b/wizards/source/depot/tools.xba
new file mode 100644
index 000000000000..6399805419ee
--- /dev/null
+++ b/wizards/source/depot/tools.xba
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="tools" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+
+Sub RemoveSheet()
+ If oSheets.HasbyName(&quot;Link&quot;) then
+ oSheets.RemovebyName(&quot;Link&quot;)
+ End If
+End Sub
+
+
+Sub InitializeStatusLine(StatusText as String, MaxValue as Integer, FirstValue as Integer)
+ oStatusline = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator()
+ oStatusLine.Start(StatusText, MaxValue)
+ oStatusline.SetValue(FirstValue)
+End Sub
+
+
+Sub MakeRangeVisible(oSheet as Object, RangeName as String, BIsVisible as Boolean)
+Dim oRangeAddress, oColumns as Object
+Dim i, iStartColumn, iEndColumn as Integer
+ oRangeAddress = oSheet.GetCellRangeByName(RangeName).RangeAddress
+ iStartColumn = oRangeAddress.StartColumn
+ iEndColumn = oRangeAddress.EndColumn
+ oColumns = oSheet.Columns
+ For i = iStartColumn To iEndColumn
+ oSheet.Columns(i).IsVisible = bIsVisible
+ Next i
+End Sub
+
+
+Function GetRowIndex(oSheet as Object, RowName as String)
+Dim oRange as Object
+ oRange = oSheet.GetCellRangeByName(RowName)
+ GetRowIndex = oRange.RangeAddress.StartRow
+End Function
+
+
+Function GetTransactionCount(iStartRow as Integer)
+Dim iEndRow as Integer
+ iStartRow = GetRowIndex(oMovementSheet, &quot;ColumnsToHide&quot;)
+ iEndRow = GetRowIndex(oMovementSheet, &quot;HiddenRow3&quot; )
+ GetTransactionCount = iEndRow -iStartRow - 2
+End Function
+
+
+Function GetStocksCount(iStartRow as Integer)
+Dim iEndRow as Integer
+ iStartRow = GetRowIndex(oFirstSheet, &quot;HiddenRow1&quot;)
+ iEndRow = GetRowIndex(oFirstSheet, &quot;HiddenRow2&quot;)
+ GetStocksCount = iEndRow -iStartRow - 1
+End Function
+
+
+Function FillListbox(ListboxControl as Object, MsgTitle as String, bShowMessage) as Boolean
+Dim i, StocksCount as Integer
+Dim iStartRow as Integer
+Dim oCell as Object
+ &apos; Add stock names to empty list box
+ StocksCount = GetStocksCount(iStartRow)
+ If StocksCount &gt; 0 Then
+ ListboxControl.Model.StringItemList() = NullList()
+ For i = 1 To StocksCount
+ oCell = oFirstSheet.GetCellByPosition(SBCOLUMNNAME1,iStartRow + i)
+ ListboxControl.AddItem(oCell.String, i-1)
+ Next
+ FillListbox() = True
+ Else
+ If bShowMessage Then
+ Msgbox(sInsertStockName, 16, MsgTitle)
+ FillListbox() = False
+ End If
+ End If
+End Function
+
+
+Sub CellValuetoControl(oSheet, oControl as Object, CellName as String)
+Dim oCell as Object
+Dim StringValue
+ oCell = GetCellByName(oSheet, CellName)
+ If oControl.PropertySetInfo.HasPropertyByName(&quot;EffectiveValue&quot;) Then
+ oControl.EffectiveValue = oCell.Value
+ Else
+ oControl.Value = oCell.Value
+ End If
+&apos; If oCell.FormulaResultType = 1 Then
+&apos; StringValue = oNumberFormatter.GetInputString(oCell.NumberFormat, oCell.Value)
+&apos; oControl.Text = DeleteStr(StringValue, &quot;%&quot;)
+&apos; Else
+&apos; oControl.Text = oCell.String
+&apos; End If
+End Sub
+
+
+Sub RemoveStockRows(oSheet as Object, iStartRow, RowCount as Integer)
+ If RowCount &gt; 0 Then
+ oSheet.Rows.RemoveByIndex(iStartRow, RowCount)
+ End If
+End Sub
+
+
+Sub AddValueToCellContent(iCellCol, iCellRow as Integer, AddValue)
+Dim oCell as Object
+Dim OldValue
+ oCell = oMovementSheet.GetCellByPosition(iCellCol, iCellRow)
+ OldValue = oCell.Value
+ oCell.Value = OldValue + AddValue
+End Sub
+
+
+Sub CheckInputDate(aEvent as Object)
+Dim oRefDialog as Object
+Dim oRefModel as Object
+Dim oDateModel as Object
+ oDateModel = aEvent.Source.Model
+ oRefModel = DlgReference.GetControl(&quot;cmdGoOn&quot;).Model
+ oRefModel.Enabled = oDateModel.Date &lt;&gt; 0
+End Sub
+
+
+
+&apos; Updates the cell with the CurrentValue after checking if the
+&apos; Newdate is later than the one that is refered to in the annotation
+&apos; of the cell
+Sub InsertCurrentValue(CurValue as Double, iRow as Integer, Newdate as Date)
+Dim oCell as Object
+Dim OldDate as Date
+ oCell = oFirstSheet.GetCellByPosition(SBCOLUMNRATE1, iRow)
+ OldDate = CDate(oCell.Annotation.Text.String)
+ If NewDate &gt;= OldDate Then
+ oCell.SetValue(CurValue)
+ oCell.Annotation.Text.SetString(CStr(NewDate))
+ End If
+End Sub
+
+
+Sub SplitCellValue(oSheet, FirstNumber, SecondNumber, iCol, iRow, NoteText)
+Dim oCell as Object
+Dim OldValue
+ oCell = oSheet.GetCellByPosition(iCol, iRow)
+ OldValue = oCell.Value
+ oCell.Value = OldValue * FirstNumber / SecondNumber
+ If NoteText &lt;&gt; &quot;&quot; Then
+ oCell.Annotation.SetString(NoteText)
+ End If
+End Sub
+
+
+Function GetStockRowIndex(ByVal Stockname) as Integer
+Dim i, StocksCount as Integer
+Dim iStartRow as Integer
+Dim oCell as Object
+ StocksCount = GetStocksCount(iStartRow)
+ For i = 1 To StocksCount
+ oCell = oFirstSheet.GetCellByPosition(SBCOLUMNNAME1,iStartRow + i)
+ If oCell.String = Stockname Then
+ GetStockRowIndex = iStartRow + i
+ Exit Function
+ End If
+ Next
+ GetStockRowIndex = -1
+End Function
+
+
+Function GetStockID(StockName as String, Optional iFirstRow as Integer) as String
+Dim CellStockName as String
+Dim i as Integer
+Dim iCount as Integer
+Dim iLastRow as Integer
+ If IsMissing(iFirstRow) Then
+ iFirstRow = GetRowIndex(oFirstSheet, &quot;HiddenRow1&quot;)
+ End If
+ iCount = GetStocksCount(iFirstRow)
+ iLastRow = iFirstRow + iCount
+ For i = iFirstRow To iLastRow
+ CellStockName = oFirstSheet.GetCellByPosition(SBCOLUMNNAME1, i).String
+ If CellStockname = StockName Then
+ Exit For
+ End If
+ Next i
+ If i &gt; iLastRow Then
+ GetStockID() = &quot;&quot;
+ Else
+ If Not IsMissing(iFirstRow) Then
+ iFirstRow = i
+ End If
+ GetStockID() = oFirstSheet.GetCellByPosition(SBCOLUMNID1, i).String
+ End If
+End Function
+
+
+Function CheckDocLocale(LocLanguage as String, LocCountry as String)
+Dim bIsDocLanguage as Boolean
+Dim bIsDocCountry as Boolean
+ bIsDocLanguage = Instr(1, LocLanguage, sDocLanguage, SBBINARY) &lt;&gt; 0
+ bIsDocCountry = Instr(1, LocCountry, sDocCountry, SBBINARY) &lt;&gt; 0 OR SDocCountry = &quot;&quot;
+ CheckDocLocale = (bIsDocLanguage And bIsDocCountry)
+End Function
+</script:module> \ No newline at end of file
diff --git a/wizards/source/euro/AutoPilotRun.xba b/wizards/source/euro/AutoPilotRun.xba
new file mode 100644
index 000000000000..6c5adb9ea64a
--- /dev/null
+++ b/wizards/source/euro/AutoPilotRun.xba
@@ -0,0 +1,409 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="AutoPilotRun" script:language="StarBasic">Option Explicit
+
+Public SourceDir as String
+Public TargetDir as String
+Public TargetStemDir as String
+Public SourceFile as String
+Public TargetFile as String
+Public Source as String
+Public SubstFile as String
+Public SubstDir as String
+Public NoArgs()
+Public FilterList(9) as String
+Public GoOn as Boolean
+Public DoUnprotect as Integer
+Public Password as String
+Public DocIndex as Integer
+Public oPathSettings as Object
+Public oUcb as Object
+Public TotDocCount as Integer
+Public sTotDocCount as String
+Public OpenProperties(1) as New com.sun.star.beans.PropertyValue
+
+
+Sub StartAutoPilot()
+Dim i As Integer
+Dim oFactoryKey as Object
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ BasicLibraries.LoadLibrary(&quot;ImportWizard&quot;)
+ If InitResources(&quot;Euro Converter&quot;, &quot;eur&quot;) Then
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ oLocale = GetStarOfficeLocale()
+ InitializeConverter(oLocale, 2)
+ ToggleGoOnButton()
+ oFactoryKey = GetRegistryKeyContent(&quot;org.openoffice.Setup/Office/Factories&quot;)
+ DialogModel.chkTextDocuments.Enabled = oFactoryKey.hasbyName(&quot;com.sun.star.text.TextDocument&quot;)
+ DialogModel.cmdGoOn.DefaultButton = True
+ DialogModel.lstCurrencies.TabIndex = 12
+ DialogConvert.GetControl(&quot;optWholeDir&quot;).SetFocus()
+ DialogConvert.Execute()
+ DialogConvert.Dispose()
+ End If
+End Sub
+
+
+Sub ConvertDocuments()
+Dim FilesList()
+Dim bDisposable as Boolean
+
+ If Source &lt;&gt; &quot;&quot; And TargetDir &lt;&gt; &quot;&quot; Then
+ If DialogModel.optSingleFile.State = 1 Then
+ SourceFile = Source
+ TotDocCount = 1
+ Else
+ SourceDir = Source
+ TargetStemDir = TargetDir
+ FilterList(0) = &quot;application/x-starcalc&quot;
+ FilterList(1) = &quot;application/vnd.stardivision.calc&quot;
+ FilterList(2) = &quot;application/vnd.sun.xml.calc&quot;
+ FilterList(3) = &quot;application/vnd.oasis.opendocument.spreadsheet&quot;
+ If DialogModel.chkTextDocuments.State = 1 Then
+ ReDim Preserve FilterList(8) as String
+
+ FilterList(4) = &quot;application/x-starwriter&quot;
+ FilterList(5) = &quot;application/vnd.stardivision.writer&quot;
+ FilterList(6) = &quot;application/vnd.stardivision.writer/web&quot;
+ FilterList(7) = &quot;application/vnd.sun.xml.writer&quot;
+ FilterList(8) = &quot;application/vnd.oasis.opendocument.text&quot;
+ End If
+ FilesList() = ReadDirectories(SourceDir, bRecursive, True, False, FilterList())
+ TotDocCount = Ubound(FilesList(),1) + 1
+ End If
+ InitializeProgressPage(DialogModel)
+&apos; ChangeToNextProgressStep()
+ sTotDocCount = CStr(TotDocCount)
+ OpenProperties(0).Name = &quot;Hidden&quot;
+ OpenProperties(0).Value = True
+ OpenProperties(1).Name = &quot;AsTemplate&quot;
+ OpenProperties(1).Value = False
+ For DocIndex = 0 To TotDocCount - 1
+ If InitializeDocument(FilesList(), bDisposable) Then
+ If StoreDocument() Then
+ ConvertDocument()
+ oDocument.Store
+ End If
+ If bDisposable Then
+ oDocument.Dispose()
+ End If
+ End If
+ Next DocIndex
+ DialogModel.cmdBack.Enabled = True
+ DialogModel.cmdGoOn.Enabled = True
+ DialogModel.cmdGoOn.Label = sReady
+ DialogModel.cmdCancel.Label = sEnd
+ End If
+End Sub
+
+
+Function InitializeDocument(FilesList(), bDisposable as Boolean) as Boolean
+&apos; The Autopilot is started from step No. 2
+Dim sViewPath as String
+Dim bIsReadOnly as Boolean
+Dim sExtension as String
+ On Local Error Goto NEXTFILE
+ If Not bCancelTask Then
+ If DialogModel.optWholeDir.State = 1 Then
+ SourceFile = FilesList(DocIndex,0)
+ TargetFile = ReplaceString(SourceFile,TargetStemDir,SourceDir)
+ TargetDir = DirectorynameoutofPath(TargetFile, &quot;/&quot;)
+ Else
+ SourceFile = Source
+ TargetFile = TargetDir &amp; &quot;/&quot; &amp; FileNameoutofPath(SourceFile, &quot;/&quot;)
+ End If
+ If CreateFolder(TargetDir) Then
+ sExtension = GetFileNameExtension(SourceFile, &quot;/&quot;)
+ oDocument = OpenDocument(SourceFile, OpenProperties(), bDisposable)
+ If (oDocument.IsReadOnly) AND (UCase(SourceFile) = UCase(TargetFile)) Then
+ bIsReadOnly = True
+ Msgbox(sMsgDOCISREADONLY, 16, GetProductName())
+ Else
+ bIsReadOnly = False
+ RetrieveDocumentObjects()
+ sViewPath = CutPathView(SourceFile, 60)
+ DialogModel.lblCurDocument.Label = Str(DocIndex+1) &amp; &quot;/&quot; &amp; sTotDocCount &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
+ End If
+ InitializeDocument() = Not bIsReadOnly
+ Else
+ InitializeDocument() = False
+ End If
+ Else
+ InitializeDocument() = False
+ End If
+NEXTFILE:
+ If Err &lt;&gt; 0 Then
+ InitializeDocument() = False
+ Resume LETSGO
+LETSGO:
+ End If
+End Function
+
+
+Sub ChangeToNextProgressStep()
+ DialogModel.lblCurProgress.FontWeight = com.sun.star.awt.FontWeight.NORMAL
+ DialogConvert.GetControl(&quot;lblCurProgress&quot;).Visible = True
+End Sub
+
+
+Function StoreDocument() as Boolean
+Dim sCurFileExists as String
+Dim iOverWrite as Integer
+ If (TargetFile &lt;&gt; &quot;&quot;) And (Not bCancelTask) Then
+ On Local Error Goto NOSAVING
+ If oUcb.Exists(TargetFile) Then
+ sCurFileExists = ReplaceString(sMsgFileExists, ConvertFromUrl(TargetFile), &quot;&lt;1&gt;&quot;)
+ sCurFileExists = ReplaceString(sCurFileExists, chr(13), &quot;&lt;CR&gt;&quot;)
+ iOverWrite = Msgbox (sCurFileExists, 32 + 3, sMsgDLGTITLE)
+ Select Case iOverWrite
+ Case 1 &apos; OK
+ Case 2 &apos; Abort
+ bCancelTask = True
+ StoreDocument() = False
+ Exit Function
+ Case 7 &apos; No
+ StoreDocument() = False
+ Exit Function
+ End Select
+ End If
+ If TargetFile &lt;&gt; SourceFile Then
+ oDocument.StoreAsUrl(TargetFile,NoArgs)
+ Else
+ oDocument.Store
+ End If
+ StoreDocument() = True
+ NOSAVING:
+ If Err &lt;&gt; 0 Then
+ StoreDocument() = False
+ Resume CLERROR
+ End If
+ CLERROR:
+ End If
+End Function
+
+
+Sub SwapExtent()
+ DialogModel.chkRecursive.Enabled = DialogModel.optWholeDir.State = 1
+ If DialogModel.optWholeDir.State = 1 Then
+ DialogModel.lblSource.Label = sSOURCEDIR
+ If Not IsNull(SubstFile) Then
+ SubstFile = DialogModel.txtSource.Text
+ DialogModel.txtSource.Text = SubstDir
+ End If
+ Else
+ DialogModel.LblSource.Label = sSOURCEFILE
+ If Not IsNull(SubstDir) Then
+ SubstDir = DialogModel.txtSource.Text
+ DialogModel.txtSource.Text = SubstFile
+ End If
+ End If
+ ToggleGoOnButton()
+End Sub
+
+
+Function InitializeThirdStep() as Boolean
+Dim TextBoxText as String
+ Source = AssignFileName(DialogModel.txtSource.Text, DialogModel.lblSource.Label, True)
+ If CheckTextBoxPath(DialogModel.txtTarget, True, True, sMsgDLGTITLE, True) Then
+ TargetDir = AssignFileName(DialogModel.txtTarget.Text, DialogModel.lblTarget.Label, False)
+ Else
+ TargetDir = &quot;&quot;
+ End If
+ If Source &lt;&gt; &quot;&quot; And TargetDir &lt;&gt; &quot;&quot; Then
+ bRecursive = DialogModel.chkRecursive.State = 1
+ bDoUnprotect = DialogModel.chkProtect.State = 1
+ DialogModel.lblRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD
+ DialogModel.lblRetrieval.Label = sPrgsRETRIEVAL
+ DialogModel.lblCurProgress.Label = sPrgsCONVERTING
+ If DialogModel.optWholeDir.State = 1 Then
+ TextBoxText = sSOURCEDIR &amp; &quot; &quot; &amp; ConvertFromUrl(Source) &amp; chr(13)
+ If DialogModel.chkRecursive.State = 1 Then
+ TextBoxText = TextBoxText &amp; DeleteStr(sInclusiveSubDir,&quot;~&quot;) &amp; chr(13)
+ End If
+ Else
+ TextBoxText = sSOURCEFILE &amp; &quot; &quot; &amp; ConvertFromUrl(Source) &amp; chr(13)
+ End If
+ TextBoxText = TextBoxText &amp; sTARGETDIR &amp; &quot; &quot; &amp; ConvertFromUrl(TargetDir) &amp; chr(13)
+ If DialogModel.chkProtect.State = 1 Then
+ TextBoxText = TextboxText &amp; sPrgsUNPROTECT
+ End If
+ DialogModel.txtConfig.Text = TextBoxText
+ ToggleProgressStep()
+ DialogModel.cmdGoOn.Enabled = False
+ InitializeThirdStep() = True
+ Else
+ InitializeThirdStep() = False
+ End If
+End Function
+
+
+Sub ToggleProgressStep(Optional aEvent as Object)
+Dim bMakeVisible as Boolean
+Dim LocStep as Integer
+ &apos; If the Sub is call by the &apos;cmdBack&apos; Button then set the &apos;bMakeVisible&apos; variable accordingly
+ bMakeVisible = IsMissing(aEvent)
+ If bMakeVisible Then
+ DialogModel.Step = 3
+ Else
+ DialogModel.Step = 2
+ End If
+ DialogConvert.GetControl(&quot;lblCurrencies&quot;).Visible = Not bMakeVisible
+ DialogConvert.GetControl(&quot;lstCurrencies&quot;).Visible = Not bMakeVisible
+ DialogConvert.GetControl(&quot;cmdBack&quot;).Visible = bMakeVisible
+ DialogConvert.GetControl(&quot;cmdGoOn&quot;).Visible = bMakeVisible
+ DialogModel.imgPreview.ImageUrl = BitmapDir &amp; &quot;euro_&quot; &amp; DialogModel.Step &amp; &quot;.bmp&quot;
+End Sub
+
+
+Sub EnableStep2DialogControls(OnValue as Boolean)
+ With DialogModel
+ .hlnExtent.Enabled = OnValue
+ .optWholeDir.Enabled = OnValue
+ .optSingleFile.Enabled = OnValue
+ .chkProtect.Enabled = OnValue
+ .cmdCallSourceDialog.Enabled = OnValue
+ .cmdCallTargetDialog.Enabled = OnValue
+ .lblSource.Enabled = OnValue
+ .lblTarget.Enabled = OnValue
+ .txtSource.Enabled = OnValue
+ .txtTarget.Enabled = OnValue
+ .imgPreview.Enabled = OnValue
+ .lstCurrencies.Enabled = OnValue
+ .lblCurrencies.Enabled = OnValue
+ If OnValue Then
+ ToggleGoOnButton()
+ .chkRecursive.Enabled = .optWholeDir.State = 1
+ Else
+ .cmdGoOn.Enabled = False
+ .chkRecursive.Enabled = False
+ End If
+ End With
+End Sub
+
+
+Sub InitializeProgressPage()
+ DialogConvert.GetControl(&quot;lblRetrieval&quot;).Visible = False
+ DialogConvert.GetControl(&quot;lblCurProgress&quot;).Visible = False
+ DialogModel.lblRetrieval.FontWeight = com.sun.star.awt.FontWeight.NORMAL
+ DialogModel.lblCurProgress.FontWeight = com.sun.star.awt.FontWeight.BOLD
+ DialogConvert.GetControl(&quot;lblRetrieval&quot;).Visible = True
+ DialogConvert.GetControl(&quot;lblCurProgress&quot;).Visible = True
+End Sub
+
+
+Function AssignFileName(sPath as String, ByVal HeaderString, bCheckFileType as Boolean) as String
+Dim bIsValid as Boolean
+Dim sLocMimeType as String
+Dim sNoDirMessage as String
+ HeaderString = DeleteStr(HeaderString, &quot;:&quot;)
+ sPath = ConvertToUrl(Trim(sPath))
+ bIsValid = oUcb.Exists(sPath)
+ If bIsValid Then
+ If DialogModel.optSingleFile.State = 1 Then
+ If bCheckFileType Then
+ sLocMimeType = GetRealFileContent(sPath)
+ If DialogModel.chkTextDocuments.State = 1 Then
+ If (Instr(1, sLocMimeType, &quot;text&quot;) = 0) And (Instr(1, sLocMimeType, &quot;calc&quot;) = 0) Then
+ Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
+ bIsValid = False
+ End If
+ Else
+ If (Instr(1, sLocMimeType, &quot;spreadsheet&quot;) = 0) And (Instr(1, sLocMimeType, &quot;calc&quot;)) = 0 Then
+ Msgbox(sMsgFileInvalid, 48, sMsgDLGTITLE)
+ bIsValid = False
+ End If
+ End If
+ End If
+ Else
+ If Not oUcb.IsFolder(sPath) Then
+ sNoDirMessage = ReplaceString(sMsgNODIRECTORY,sPath,&quot;&lt;1&gt;&quot;)
+ Msgbox(sNoDirMessage,48, sMsgDLGTITLE)
+ bIsValid = False
+ Else
+ sPath = RTrimStr(sPath,&quot;/&quot;)
+ sPath = sPath &amp; &quot;/&quot;
+ End If
+ End if
+ Else
+ Msgbox(HeaderString &amp; &quot; &apos;&quot; &amp; ConvertFromUrl(sPath) &amp; &quot;&apos; &quot; &amp; sMsgNOTTHERE,48, sMsgDLGTITLE)
+ End If
+ If bIsValid Then
+ AssignFileName() = sPath
+ Else
+ AssignFilename() = &quot;&quot;
+ End If
+End Function
+
+
+Sub ToggleGoOnButton()
+Dim bDoEnable as Boolean
+Dim sLocMimeType as String
+Dim sPath as String
+ bDoEnable = Ubound(DialogModel.lstCurrencies.SelectedItems()) &gt; -1
+ If bDoEnable Then
+ &apos; Check if Source is set correctly
+ sPath = ConvertToUrl(Trim(DialogModel.txtSource.Text))
+ bDoEnable = oUcb.Exists(sPath)
+ End If
+ DialogModel.cmdGoOn.Enabled = bDoEnable
+End Sub
+
+
+Sub CallFolderPicker()
+ GetFolderName(DialogModel.txtTarget)
+ ToggleGoOnButton()
+End Sub
+
+
+Sub CallFilePicker()
+ If DialogModel.optSingleFile.State = 1 Then
+ Dim oMasterKey as Object
+ Dim oTypes() as Object
+ Dim oUIKey() as Object
+
+ oMasterKey = GetRegistryKeyContent(&quot;org.openoffice.TypeDetection.Types&quot;)
+ oTypes() = oMasterKey.Types
+ oUIKey = GetRegistryKeyContent(&quot;org.openoffice.Office.UI/FilterClassification/LocalFilters&quot;)
+ If DialogModel.chkTextDocuments.State = 1 Then
+ Dim FilterNames(11,1) as String
+ FilterNames(6,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer&quot;).UIName
+ FilterNames(6,1) = &quot;*.sxw&quot;
+ FilterNames(7,0) = oTypes.GetByName(&quot;writer_StarOffice_XML_Writer_Template&quot;).UIName
+ FilterNames(7,1) = &quot;*.stw&quot;
+ FilterNames(8,0) = oUIKey.Classes.GetByName(&quot;sw3to5&quot;).DisplayName
+ FilterNames(8,1) = &quot;*.sdw&quot;
+ FilterNames(9,0) = oUIKey.Classes.GetByName(&quot;sw3to5templ&quot;).DisplayName
+ Filternames(9,1) = &quot;*.vor&quot;
+ FilterNames(10,0) = oTypes.GetByName(&quot;writer8&quot;).UIName
+ FilterNames(10,1) = &quot;*.odt&quot;
+ FilterNames(11,0) = oTypes.GetByName(&quot;writer8_template&quot;).UIName
+ FilterNames(11,1) = &quot;*.ott&quot;
+ Else
+ ReDim FilterNames(5,1) as String
+ End If
+ FilterNames(0,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc&quot;).UIName
+ Filternames(0,1) = &quot;*.sxc&quot;
+ FilterNames(1,0) = oTypes.GetByName(&quot;calc_StarOffice_XML_Calc_Template&quot;).UIName
+ Filternames(1,1) = &quot;*.stc&quot;
+ FilterNames(2,0) = oUIKey.Classes.GetByName(&quot;sc345&quot;).DisplayName
+ FilterNames(2,1) = &quot;*.sdc&quot;
+ FilterNames(3,0) = oUIKey.Classes.GetByName(&quot;sc345templ&quot;).DisplayName
+ Filternames(3,1) = &quot;*.vor&quot;
+ FilterNames(4,0) = oTypes.GetByName(&quot;calc8&quot;).UIName
+ Filternames(4,1) = &quot;*.ods&quot;
+ FilterNames(5,0) = oTypes.GetByName(&quot;calc8_template&quot;).UIName
+ Filternames(5,1) = &quot;*.ots&quot;
+ GetFileName(DialogModel.txtSource, Filternames())
+ Else
+ GetFolderName(DialogModel.txtSource)
+ End If
+ ToggleGoOnButton()
+End Sub
+
+
+Sub PreviousStep()
+ DialogModel.Step = 2
+ DialogModel.cmdGoOn.Label = sGOON
+ DialogModel.cmdCancel.Label = sCANCEL
+End Sub
+</script:module>
diff --git a/wizards/source/euro/Common.xba b/wizards/source/euro/Common.xba
new file mode 100644
index 000000000000..42a5c643dd22
--- /dev/null
+++ b/wizards/source/euro/Common.xba
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Common" script:language="StarBasic"> REM ***** BASIC *****
+Public DialogModel as Object
+Public DialogConvert as Object
+Public DialogPassword as Object
+Public PasswordModel as Object
+
+Sub RetrieveDocumentObjects()
+ CurMimeType = Tools.GetDocumentType(oDocument)
+ If Instr(1, CurMimeType, &quot;calc&quot;) &lt;&gt; 0 Then
+ oSheets = oDocument.Sheets
+ oSheet = oDocument.Sheets.GetbyIndex(0)
+ oAddressRanges = oDocument.createInstance(&quot;com.sun.star.sheet.SheetCellRanges&quot;)
+ End If
+ &apos; Retrieve the indices for the cellformatations
+ oFormats = oDocument.NumberFormats
+End Sub
+
+
+Sub CancelTask()
+&apos; If Not DocDisposed Then
+&apos; ReprotectSheets()
+&apos; End If
+ If DialogModel.Step = 3 And (Not bCancelTask) Then
+ If Msgbox(sMsgCancelConversion, 36, sMsgCancelTitle) = 6 Then
+ bCancelTask = True
+ DialogConvert.EndExecute
+ Else
+ bCancelTask = False
+ End If
+ Else
+ DialogConvert.EndExecute()
+ End If
+End Sub
+
+
+Function ConvertDocument()
+ GoOn = True
+&apos; DocDisposed = True
+ InitializeProgressbar()
+ If Instr(1, CurMimeType, &quot;calc&quot;) &lt;&gt; 0 Then
+ bDocHasProtectedSheets = CheckSheetProtection(oSheets)
+ If bDocHasProtectedSheets Then
+ bDocHasProtectedSheets = UnprotectSheetsWithPassword(oSheets, bDoUnProtect)
+ End If
+ If Not bDocHasProtectedSheets Then
+ If Not bRangeListDefined Then
+ TotCellCount = 0
+ CreateRangeEnumeration(True)
+ Else
+ IncreaseStatusvalue(SBRelGet/3)
+ End If
+ RangeIndex = Ubound(RangeList())
+ If RangeIndex &gt; -1 Then
+ ConvertThehardWay(RangeList(), True, False)
+ MakeStyleEnumeration(True)
+ oDocument.calculateAll()
+ End If
+ ReprotectSheets()
+ bRangeListDefined = False
+ End If
+ Else
+ DialogModel.ProgressBar.ProgressValue = 10 &apos; oStatusline.SetValue(10)
+ ConvertTextFields()
+ DialogModel.ProgressBar.ProgressValue = 80 &apos; oStatusline.SetValue(80)
+ ConvertWriterTables()
+ End If
+ EndStatusLine()
+ On Local Error Goto 0
+End Function
+
+
+Sub SwitchNumberFormat(oObject as Object, oFormats as object)
+Dim nFormatLanguage as Integer
+Dim nFormatDecimals as Integer
+Dim nFormatLeading as Integer
+Dim bFormatLeading as Integer
+Dim bFormatNegRed as Integer
+Dim bFormatThousands as Integer
+Dim i as Integer
+Dim aNewStr as String
+Dim iNumberFormat as Long
+Dim AddToList as Boolean
+Dim sOldCurrSymbol as String
+ On Local Error Resume Next
+ iNumberFormat = oObject.NumberFormat
+ On Local Error GoTo NOKEY
+ aFormat() = oFormats.getByKey(iNumberFormat)
+ On Local Error GoTo 0
+ sOldCurrSymbol = aFormat.CurrencySymbol
+ If sOldCurrSymbol = CurrValue(CurrIndex,5) Then
+ aSimpleStr = &quot;0 [$EUR]&quot;
+ Else
+ aSimpleStr = &quot;0 [$&quot; &amp; sEuroSign &amp; aFormat.CurrencyExtension &amp; &quot;]&quot;
+ End If
+
+ nSimpleKey = Numberformat(oFormats, aSimpleStr, oLocale)
+ &apos; set new Currency format with according settings
+ nFormatDecimals = 2
+ nFormatLeading = aFormat.LeadingZeros
+ bFormatNegRed = aFormat.NegativeRed
+ bFormatThousands = aFormat.ThousandsSeparator
+ aNewStr = oFormats.generateFormat( nSimpleKey, aFormat.Locale, bFormatThousands, bFormatNegRed, nFormatDecimals, nFormatLeading)
+ oObject.NumberFormat = Numberformat(oFormats, aNewStr, aFormat.Locale)
+ NOKEY:
+ If Err &lt;&gt; 0 Then
+ Resume CLERROR
+ End If
+ CLERROR:
+End Sub
+
+
+Function Numberformat( oFormats as Object, aFormatStr as String, oLocale as Object)
+Dim nRetkey
+Dim l as String
+Dim c as String
+ nRetKey = oFormats.queryKey( aFormatStr, oLocale, True )
+ If nRetKey = -1 Then
+ l = oLocale.Language
+ c = oLocale.Country
+ nRetKey = oFormats.addNew( aFormatStr, oLocale )
+ If nRetKey = -1 Then nRetKey = 0
+ End If
+ Numberformat = nRetKey
+End Function
+
+
+Function CheckFormatType( FormatObject as object)
+Dim i as Integer
+Dim LocCurrIndex as Integer
+Dim nFormatFormatString as String
+Dim FormatLangID as Integer
+Dim sFormatCurrExt as String
+Dim oFormatofObject() as Object
+
+ &apos; Retrieve the Format of the Object
+ On Local Error GoTo NOKEY
+ oFormatofObject = oFormats.getByKey(FormatObject.NumberFormat)
+ On Local Error GoTo 0
+ If NOT INT(oFormatofObject.Type) AND com.sun.star.util.NumberFormat.CURRENCY Then
+ CheckFormatType = False
+ Exit Function
+ End If
+ If FieldinArray(CurrSymbolList(),2,oFormatofObject.CurrencySymbol) Then
+ &apos; If the Currencysymbol of the object ist the one needed, then check the Currency extension
+ sFormatCurrExt = oFormatofObject.CurrencyExtension
+
+ If FieldInList(CurExtension(),2,sFormatCurrExt) Then
+ &apos; The Currency - extension also fits
+ CheckFormatType = True
+ Else
+ &apos; The Currency - symbol is Euro-conforming (like &apos;DEM&apos;), so there is no Currency-Extension
+ CheckFormatType = oFormatofObject.CurrencySymbol = CurrsymbolList(2)
+ End If
+ Else
+ &apos; The Currency Symbol of the object is not the desired one
+ If oFormatofObject.CurrencySymbol = &quot;&quot; Then
+ &apos; Format is &quot;automatic&quot;
+ CheckFormatType = CheckLocale(oFormatofObject.Locale)
+ Else
+ CheckFormatType = False
+ End If
+ End If
+
+ NOKEY:
+ If Err &lt;&gt; 0 Then
+ CheckFormatType = False
+ Resume CLERROR
+ End If
+ CLERROR:
+End Function
+
+
+Sub StartConversion()
+ GoOn = True
+ Select Case DialogModel.Step
+ Case 1
+ If DialogModel.chkComplete.State = 1 Then
+ ConvertWholeDocument()
+ Else
+ ConvertRangesorStylesofDocument()
+ End If
+ Case 2
+ bCancelTask = False
+ If InitializeThirdStep() Then
+ ConvertDocuments()
+ bCancelTask = True
+ End If
+ Case 3
+ DialogConvert.EndExecute()
+ End Select
+End Sub
+
+
+Sub IncreaseStatusValue(AddStatusValue as Integer)
+ StatusValue = Int(StatusValue + AddStatusValue)
+ If DialogModel.Step = 3 Then
+ DialogModel.ProgressBar.ProgressValue = StatusValue
+ Else
+ oStatusline.SetValue(StatusValue)
+ End If
+End Sub
+
+
+Sub SelectCurrency()
+Dim AddtoList as Boolean
+Dim NullList()
+Dim OldCurrIndex as Integer
+ bRangeListDefined = False
+ OldCurrIndex = CurrIndex
+ CurrIndex = DialogModel.lstCurrencies.SelectedItems(0)
+ If OldCurrIndex &lt;&gt; CurrIndex Then
+ InitializeCurrencyValues(CurrIndex)
+ CurExtension(0) = LangIDValue(CurrIndex,0,2)
+ CurExtension(1) = LangIDValue(CurrIndex,1,2)
+ CurExtension(2) = LangIDValue(CurrIndex,2,2)
+ If DialogModel.Step = 1 Then
+ EnableStep1DialogControls(False,False, False)
+ If DialogModel.optCellTemplates.State = 1 Then
+ EnableStep1DialogControls(False, False, False)
+ CreateStyleEnumeration()
+ ElseIf ((DialogModel.optSheetRanges.State = 1) OR (DialogModel.optDocRanges.State = 1)) AND (DialogModel.Step = 1) Then
+ CreateRangeEnumeration(False)
+ If Ubound(RangeList()) = -1 Then
+ DialogModel.lstSelection.StringItemList() = NullList()
+ End If
+ ElseIf DialogModel.optSelRange.State= 1 Then
+ &apos;Preselected Range
+ End If
+ EnableStep1DialogControls(True, True, True)
+ ElseIf DialogModel.Step = 2 Then
+ EnableStep2DialogControls(True)
+ End If
+ End If
+End Sub
+
+
+Sub FillUpCurrencyListbox()
+Dim i as Integer
+Dim MaxIndex as Integer
+ MaxIndex = Ubound(CurrValue(),1)
+ Dim LocList(MaxIndex) as String
+ For i = 0 To MaxIndex
+ LocList(i) = CurrValue(i,0)
+ Next i
+ DialogModel.lstCurrencies.StringItemList() = LocList()
+ If CurrIndex &gt; -1 Then
+ SelectListboxItem(DialogModel.lstCurrencies, CurrIndex)
+ End If
+End Sub
+
+
+Sub InitializeProgressbar()
+ CurCellCount = 0
+ If Not IsNull(oStatusLine) Then
+ oStatusline.Start(sStsPROGRESS, 100)
+ Else
+ DialogModel.ProgressBar.ProgressValue = 0
+ End If
+ StatusValue = 0
+End Sub
+
+
+Sub EndStatusLine()
+ If Not IsNull(oStatusLine) Then
+ oStatusline.End
+ Else
+ DialogModel.ProgressBar.ProgressValue = 100
+ End If
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/euro/ConvertRun.xba b/wizards/source/euro/ConvertRun.xba
new file mode 100644
index 000000000000..a15c88412228
--- /dev/null
+++ b/wizards/source/euro/ConvertRun.xba
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ConvertRun" script:language="StarBasic">Option Explicit
+
+Public oPreSelRange as Object
+
+Sub Main()
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ If InitResources(&quot;Euro Converter&quot;, &quot;eur&quot;) Then
+ bDoUnProtect = False
+ bPreSelected = True
+ oDocument = ThisComponent
+ RetrieveDocumentObjects() &apos; Statusline, SheetsCollection etc.
+ InitializeConverter(oDocument.CharLocale, 1)
+ GetPreSelectedRange()
+ If GoOn Then
+ DialogModel.lstCurrencies.TabIndex = 2
+ DialogConvert.GetControl(&quot;chkComplete&quot;).SetFocus()
+ DialogConvert.Execute
+ End If
+ DialogConvert.Dispose
+ End If
+End Sub
+
+
+Sub SelectListItem()
+Dim Listbox as Object
+Dim oListSheet as Object
+Dim CurStyleName as String
+Dim oCursheet as Object
+Dim oTempRanges as Object
+Dim sCurSheetName as String
+Dim RangeName as String
+Dim oSheetRanges as Object
+Dim ListIndex as Integer
+Dim a as Integer
+Dim i as Integer
+Dim n as Integer
+Dim m as Integer
+Dim MaxIndex as Integer
+ Listbox = DialogModel.lstSelection
+ If Ubound(Listbox.SelectedItems()) &gt; -1 Then
+ EnableStep1DialogControls(False, False, False)
+ oSelRanges = oDocument.createInstance(&quot;com.sun.star.sheet.SheetCellRanges&quot;)
+
+ &apos; Is the sheet the basis, then the sheetobject has to be created
+ If DialogModel.optDocRanges.State = 1 Then
+ &apos; Document is the basis for the conversion
+ ListIndex = Listbox.SelectedItems(0)
+ oCurSheet = RetrieveSheetoutofRangeName(Listbox.StringItemList(ListIndex))
+ oDocument.CurrentController.SetActiveSheet(oCurSheet)
+ Else
+ oCurSheet = oDocument.CurrentController.ActiveSheet
+ End If
+ sCurSheetName = oCurSheet.Name
+ If DialogModel.optCellTemplates.State = 1 Then
+ Dim CurIndex as Integer
+ For i = 0 To Ubound(Listbox.SelectedItems())
+ CurIndex = Listbox.SelectedItems(i)
+ CurStylename = Listbox.StringItemList(CurIndex)
+ oSheetRanges = oCursheet.CellFormatRanges.createEnumeration
+ While oSheetRanges.hasMoreElements
+ oRange = oSheetRanges.NextElement
+ If oRange.getPropertyState(&quot;NumberFormat&quot;) = 1 Then
+ If oRange.CellStyle = CurStyleName Then
+ oSelRanges.InsertbyName(&quot;&quot;,oRange)
+ End If
+ End If
+ Wend
+ Next i
+ Else
+ &apos; Hard Formatation is selected
+ a = -1
+ For n = 0 To Ubound(Listbox.SelectedItems())
+ m = Listbox.SelectedItems(n)
+ RangeName = Listbox.StringItemList(m)
+ oListSheet = RetrieveSheetoutofRangeName(RangeName)
+ a = a + 1
+ MaxIndex = Ubound(SelRangeList())
+ If a &gt; MaxIndex Then
+ Redim Preserve SelRangeList(MaxIndex + SBRANGEUBOUND)
+ End If
+ SelRangeList(a) = RangeName
+ If oListSheet.Name = sCurSheetName Then
+ oRange = RetrieveRangeoutofRangeName(RangeName)
+ oSelRanges.InsertbyName(&quot;&quot;,oRange)
+ End If
+ Next n
+ End If
+ If a &gt; -1 Then
+ ReDim Preserve SelRangeList(a)
+ Else
+ ReDim SelRangeList()
+ End If
+ oDocument.CurrentController.Select(oSelRanges)
+ EnableStep1DialogControls(True, True, True)
+ End If
+End Sub
+
+
+&apos; Procedure that is called by an event
+Sub RetrieveEnableValue()
+Dim EnableValue as Boolean
+ EnableValue = Not DialogModel.lstSelection.Enabled
+ EnableStep1DialogControls(True, EnableValue, True)
+End Sub
+
+
+Sub EnableStep1DialogControls(bCurrEnabled as Boolean, bFrameEnabled as Boolean, bButtonsEnabled as Boolean)
+Dim bCurrIsSelected as Boolean
+Dim bObjectIsSelected as Boolean
+Dim bConvertWholeDoc as Boolean
+Dim bDoEnableFrame as Boolean
+ bConvertWholeDoc = DialogModel.chkComplete.State = 1
+ bDoEnableFrame = bFrameEnabled And (NOT bConvertWholeDoc)
+
+ &apos; Controls around the Selection Listbox
+ With DialogModel
+ .lblCurrencies.Enabled = bCurrEnabled
+ .lstCurrencies.Enabled = bCurrEnabled
+ .lstSelection.Enabled = bDoEnableFrame
+ .lblSelection.Enabled = bDoEnableFrame
+ .hlnSelection.Enabled = bDoEnableFrame
+ .optCellTemplates.Enabled = bDoEnableFrame
+ .optSheetRanges.Enabled = bDoEnableFrame
+ .optDocRanges.Enabled = bDoEnableFrame
+ .optSelRange.Enabled = bDoEnableFrame
+ End With
+ &apos; The CheckBox has the Value &apos;1&apos; when the Controls in the Frame are disabled
+ If bButtonsEnabled Then
+ bCurrIsSelected = Ubound(DialogModel.lstCurrencies.SelectedItems()) &lt;&gt; -1
+ &apos; Enable GoOnButton only when Currency is selected
+ DialogModel.cmdGoOn.Enabled = bCurrIsSelected
+ DialogModel.chkComplete.Enabled = bCurrIsSelected
+ If bDoEnableFrame AND DialogModel.cmdGoOn.Enabled Then
+ &apos; If FrameControls are enabled, check if Listbox is Empty
+ bObjectIsSelected = Ubound(DialogModel.lstSelection.SelectedItems()) &lt;&gt; -1
+ DialogModel.cmdGoOn.Enabled = bObjectIsSelected
+ End If
+ Else
+ DialogModel.cmdGoOn.Enabled = False
+ DialogModel.chkComplete.Enabled = False
+ End If
+End Sub
+
+
+Sub ConvertRangesOrStylesOfDocument()
+Dim i as Integer
+Dim ItemName as String
+Dim SelList() as String
+Dim oSheetRanges as Object
+
+ bDocHasProtectedSheets = CheckSheetProtection(oSheets)
+ If bDocHasProtectedSheets Then
+ bDocHasProtectedSheets = UnprotectSheetsWithPassWord(oSheets, bDoUnProtect)
+ DialogModel.cmdGoOn.Enabled = False
+ End If
+ If Not bDocHasProtectedSheets Then
+ EnableStep1DialogControls(False, False, False)
+ InitializeProgressBar()
+ If DialogModel.optSelRange.State = 1 Then
+ SelectListItem()
+ End If
+ SelList() = DialogConvert.GetControl(&quot;lstSelection&quot;).SelectedItems()
+ If DialogModel.optCellTemplates.State = 1 Then
+ &apos; Option &apos;Soft&apos; Formatation is selected
+ AssignRangestoStyle(DialogModel.lstSelection.StringItemList(), SelList())
+ ConverttheSoftWay(SelList(), True)
+ ElseIf DialogModel.optSelRange.State = 1 Then
+ oSheetRanges = oPreSelRange.CellFormatRanges.createEnumeration
+ While oSheetRanges.hasMoreElements
+ oRange = oSheetRanges.NextElement
+ If CheckFormatType(oRange) Then
+ ConvertCellCurrencies(oRange)
+ SwitchNumberFormat(oRange, oFormats, sEuroSign)
+ End If
+ Wend
+ Else
+ ConverttheHardWay(SelList(), False, True)
+ End If
+ oStatusline.End
+ EnableStep1DialogControls(True, False, True)
+ DialogModel.cmdGoOn.Enabled = True
+ oDocument.CurrentController.Select(oSelRanges)
+ End If
+End Sub
+
+
+Sub ConvertWholeDocument()
+Dim s as Integer
+ DialogModel.cmdGoOn.Enabled = False
+ DialogModel.chkComplete.Enabled = False
+ GoOn = ConvertDocument()
+ EmptyListbox(DialogModel.lstSelection())
+ EnableStep1DialogControls(True, True, True)
+End Sub
+
+
+&apos; Everything previously selected will be deselected
+Sub EmptySelection()
+Dim RangeName as String
+Dim i as Integer
+Dim MaxIndex as Integer
+Dim EmptySelRangeList() as String
+
+ If Not IsNull(oSelRanges) Then
+ If oSelRanges.HasElements Then
+ EmptySelRangeList() = ArrayOutofString(oSelRanges.RangeAddressesasString, &quot;;&quot;, MaxIndex)
+ For i = 0 To MaxIndex
+ oSelRanges.RemovebyName(EmptySelRangeList(i))
+ Next i
+ End If
+ oDocument.CurrentController.Select(oSelRanges)
+ Else
+ oSelRanges = oDocument.createInstance(&quot;com.sun.star.sheet.SheetCellRanges&quot;)
+ End If
+End Sub
+
+
+Function AddSelectedRangeToSelRangesEnum() as Object
+Dim oLocRange as Object
+ osheet = oDocument.CurrentController.GetActiveSheet
+ oSelRanges = oDocument.createInstance(&quot;com.sun.star.sheet.SheetCellRanges&quot;)
+ &apos; Check if a Currency-Range has been selected
+ oLocRange = oDocument.CurrentController.Selection
+ bPreSelected = oLocRange.SupportsService(&quot;com.sun.star.sheet.SheetCellRange&quot;)
+ If bPreSelected Then
+ oSelRanges.InsertbyName(&quot;&quot;,oLocRange)
+ AddSelectedRangeToSelRangesEnum() = oLocRange
+ End If
+End Function
+
+
+Sub GetPreSelectedRange()
+Dim i as Integer
+Dim OldCurrSymbolList(2) as String
+Dim OldCurrIndex as Integer
+Dim OldCurExtension(2) as String
+ oPreSelRange = AddSelectedRangeToSelRangesEnum()
+
+ DialogModel.chkComplete.State = Abs(Not(bPreSelected))
+ If bPreSelected Then
+ DialogModel.optSelRange.State = 1
+ AddRangeToListbox(oPreSelRange)
+ Else
+ DialogModel.optCellTemplates.State = 1
+ CreateStyleEnumeration()
+ End If
+ EnableStep1DialogControls(True, bPreSelected, True)
+ DialogModel.optSelRange.Enabled = bPreSelected
+End Sub
+
+
+Sub AddRangeToListbox(oLocRange as Object)
+ EmptyListBox(DialogModel.lstSelection)
+ PreName = RetrieveRangeNamefromAddress(oLocRange)
+ AddSingleItemToListbox(DialogModel.lstSelection, Prename)&apos;, 0)
+ SelectListboxItem(DialogModel.lstCurrencies, CurrIndex)
+ TotCellCount = CountRangeCells(oLocRange)
+End Sub
+
+
+Sub CheckRangeSelection(Optional oEvent)
+ EmptySelection()
+ AddRangeToListbox(oPreSelRange)
+ oPreSelRange = AddSelectedRangeToSelRangesEnum()
+End Sub
+
+
+&apos; Checks if a Field (LocField) is already defined in an Array
+&apos; Returns &apos;True&apos; or &apos;False&apos;
+Function FieldinList(LocList(), MaxIndex as integer, ByVal LocField ) As Boolean
+Dim i as integer
+ LocField = Ucase(LocField)
+ For i = Lbound(LocList()) to MaxIndex
+ If Ucase(LocList(i)) = LocField then
+ FieldInList = True
+ Exit Function
+ End if
+ Next
+ FieldInList = False
+End Function
+
+
+Function CheckLocale(oLocale) as Boolean
+Dim i as Integer
+Dim LocCountry as String
+Dim LocLanguage as String
+ LocCountry = oLocale.Country
+ LocLanguage = oLocale.Language
+ For i = 0 To 1
+ If LocLanguage = LangIDValue(CurrIndex,i,0) AND LocCountry = LangIDValue(CurrIndex,i,1) Then
+ CheckLocale = True
+ Exit Function
+ End If
+ Next i
+ CheckLocale = False
+End Function
+
+
+Sub SetOptionValuestoNull()
+ With DialogModel
+ .optCellTemplates.State = 0
+ .optSheetRanges.State = 0
+ .optDocRanges.State = 0
+ .optSelRange.State = 0
+ End With
+End Sub
+
+
+
+Sub SetStatusLineText(sStsREPROTECT as String)
+ If Not IsNull(oStatusLine) Then
+ oStatusline.SetText(sStsREPROTECT)
+ End If
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/euro/DlgConvert.xdl b/wizards/source/euro/DlgConvert.xdl
new file mode 100644
index 000000000000..43bfeea34d9a
--- /dev/null
+++ b/wizards/source/euro/DlgConvert.xdl
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="DialogConvert" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:page="2" dlg:help-url="HID:34660" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="lblCurrencies" dlg:tab-index="1" dlg:left="170" dlg:top="39" dlg:width="89" dlg:height="8" dlg:value="lblCurrencies"/>
+ <dlg:checkbox dlg:id="chkComplete" dlg:tab-index="0" dlg:left="12" dlg:top="43" dlg:width="129" dlg:height="10" dlg:page="1" dlg:help-url="HID:34661" dlg:value="chkComplete" dlg:checked="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Euro.ConvertRun.RetrieveEnableValue?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:menulist dlg:id="lstCurrencies" dlg:tab-index="2" dlg:left="170" dlg:top="51" dlg:width="90" dlg:height="12" dlg:help-url="HID:34669" dlg:spin="true" dlg:linecount="12">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Euro.Common.SelectCurrency?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optCellTemplates" dlg:tab-index="3" dlg:left="12" dlg:top="96" dlg:width="129" dlg:height="10" dlg:page="1" dlg:help-url="HID:34662" dlg:value="optCellTemplates">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.Soft.CreateStyleEnumeration?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optSheetRanges" dlg:tab-index="4" dlg:left="12" dlg:top="110" dlg:width="130" dlg:height="10" dlg:page="1" dlg:help-url="HID:34663" dlg:value="optSheetRanges">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.Hard.CreateRangeList?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optDocRanges" dlg:tab-index="5" dlg:left="12" dlg:top="124" dlg:width="130" dlg:height="10" dlg:page="1" dlg:help-url="HID:34664" dlg:value="optDocRanges">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.Hard.CreateRangeList?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optSelRange" dlg:tab-index="6" dlg:left="12" dlg:top="138" dlg:width="130" dlg:height="10" dlg:page="1" dlg:help-url="HID:34665" dlg:value="optSelRange">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.ConvertRun.CheckRangeSelection?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:text dlg:id="lblSelection" dlg:tab-index="7" dlg:left="170" dlg:top="84" dlg:width="73" dlg:height="8" dlg:page="1" dlg:value="lblSelection"/>
+ <dlg:menulist dlg:id="lstSelection" dlg:tab-index="8" dlg:left="170" dlg:top="96" dlg:width="90" dlg:height="52" dlg:page="1" dlg:help-url="HID:34666" dlg:multiselection="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Euro.ConvertRun.SelectListItem?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optSingleFile" dlg:tab-index="9" dlg:left="12" dlg:top="51" dlg:width="146" dlg:height="10" dlg:page="2" dlg:help-url="HID:34667" dlg:value="optSingleFile">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.AutoPilotRun.SwapExtent?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optWholeDir" dlg:tab-index="10" dlg:left="12" dlg:top="65" dlg:width="146" dlg:height="10" dlg:page="2" dlg:help-url="HID:34668" dlg:value="optWholeDir" dlg:checked="true">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.AutoPilotRun.SwapExtent?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:textfield dlg:id="txtConfig" dlg:tab-index="11" dlg:left="6" dlg:top="50" dlg:width="258" dlg:height="55" dlg:page="3" dlg:vscroll="true" dlg:multiline="true" dlg:readonly="true"/>
+ <dlg:textfield dlg:id="txtSource" dlg:tab-index="12" dlg:left="80" dlg:top="82" dlg:width="165" dlg:height="12" dlg:page="2" dlg:help-url="HID:34670">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Euro.AutoPilotRun.ToggleGoOnButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:textfield>
+ <dlg:button dlg:id="cmdCallSourceDialog" dlg:tab-index="13" dlg:left="249" dlg:top="81" dlg:width="15" dlg:height="14" dlg:page="2" dlg:help-url="HID:34677" dlg:value="...">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.AutoPilotRun.CallFilePicker?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:checkbox dlg:id="chkRecursive" dlg:tab-index="14" dlg:left="12" dlg:top="98" dlg:width="252" dlg:height="10" dlg:page="2" dlg:help-url="HID:34671" dlg:value="chkRecursive" dlg:checked="false"/>
+ <dlg:checkbox dlg:id="chkTextDocuments" dlg:tab-index="15" dlg:left="12" dlg:top="112" dlg:width="251" dlg:height="10" dlg:page="2" dlg:help-url="HID:34680" dlg:value="chkTextDocuments" dlg:checked="false"/>
+ <dlg:checkbox dlg:id="chkProtect" dlg:tab-index="16" dlg:left="12" dlg:top="126" dlg:width="251" dlg:height="10" dlg:page="2" dlg:help-url="HID:34679" dlg:value="chkProtect" dlg:checked="false"/>
+ <dlg:textfield dlg:id="txtTarget" dlg:tab-index="17" dlg:left="80" dlg:top="143" dlg:width="165" dlg:height="12" dlg:page="2" dlg:help-url="HID:34672"/>
+ <dlg:button dlg:id="cmdCallTargetDialog" dlg:tab-index="18" dlg:left="249" dlg:top="142" dlg:width="15" dlg:height="14" dlg:page="2" dlg:help-url="HID:34678" dlg:value="...">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.AutoPilotRun.CallFolderPicker?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:progressmeter dlg:id="ProgressBar" dlg:tab-index="19" dlg:left="85" dlg:top="152" dlg:width="179" dlg:height="10" dlg:page="3"/>
+ <dlg:text dlg:id="lblHint" dlg:tab-index="20" dlg:left="6" dlg:top="166" dlg:width="258" dlg:height="20" dlg:value="lblHint" dlg:multiline="true"/>
+ <dlg:text dlg:id="lblTarget" dlg:tab-index="21" dlg:left="6" dlg:top="145" dlg:width="73" dlg:height="8" dlg:page="2" dlg:value="lblTarget"/>
+ <dlg:text dlg:id="lblSource" dlg:tab-index="22" dlg:left="6" dlg:top="84" dlg:width="73" dlg:height="8" dlg:page="2" dlg:value="lblSource"/>
+ <dlg:text dlg:id="lblCurProgress" dlg:tab-index="23" dlg:left="16" dlg:top="130" dlg:width="208" dlg:height="8" dlg:page="3"/>
+ <dlg:text dlg:id="lblRetrieval" dlg:tab-index="24" dlg:left="9" dlg:top="119" dlg:width="216" dlg:height="8" dlg:page="3" dlg:value="lblRetrieval"/>
+ <dlg:text dlg:id="lblConfig" dlg:tab-index="25" dlg:left="6" dlg:top="39" dlg:width="94" dlg:height="8" dlg:page="3" dlg:value="lblConfig"/>
+ <dlg:text dlg:id="lblCurDocument" dlg:tab-index="26" dlg:left="16" dlg:top="141" dlg:width="208" dlg:height="8" dlg:page="3"/>
+ <dlg:img dlg:id="imgPreview" dlg:tab-index="27" dlg:left="6" dlg:top="6" dlg:width="258" dlg:height="26" dlg:src="file:///D:/office630np/share/template/german/wizard/bitmap/euro_2.bmp"/>
+ <dlg:fixedline dlg:id="hlnSelection" dlg:tab-index="28" dlg:left="7" dlg:top="72" dlg:width="258" dlg:height="8" dlg:page="1" dlg:value="hlnSelection"/>
+ <dlg:fixedline dlg:id="hlnExtent" dlg:tab-index="29" dlg:left="6" dlg:top="39" dlg:width="156" dlg:height="8" dlg:page="2" dlg:value="hlnExtent"/>
+ <dlg:fixedline dlg:id="hlnProgress" dlg:tab-index="30" dlg:left="6" dlg:top="108" dlg:width="258" dlg:height="8" dlg:page="3" dlg:value="hlnProgress"/>
+ <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="31" dlg:left="6" dlg:top="152" dlg:width="258" dlg:height="9" dlg:page="1"/>
+ <dlg:text dlg:id="lblProgress" dlg:tab-index="32" dlg:left="6" dlg:top="153" dlg:width="79" dlg:height="8" dlg:page="3" dlg:value="lblProgress"/>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="33" dlg:left="6" dlg:top="190" dlg:width="53" dlg:height="14" dlg:help-url="HID:34673" dlg:value="cmdCancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.Common.CancelTask?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdHelp" dlg:tab-index="34" dlg:left="63" dlg:top="190" dlg:width="53" dlg:height="14" dlg:value="cmdHelp" dlg:button-type="help"/>
+ <dlg:button dlg:id="cmdBack" dlg:tab-index="35" dlg:left="155" dlg:top="190" dlg:width="53" dlg:height="14" dlg:help-url="HID:34675" dlg:value="cmdBack">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.AutoPilotRun.PreviousStep?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdGoOn" dlg:tab-index="36" dlg:left="211" dlg:top="190" dlg:width="53" dlg:height="14" dlg:help-url="HID:34676" dlg:value="cmdGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.Common.StartConversion?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/euro/DlgPassword.xdl b/wizards/source/euro/DlgPassword.xdl
new file mode 100644
index 000000000000..def861d97ebe
--- /dev/null
+++ b/wizards/source/euro/DlgPassword.xdl
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="DlgPassword" dlg:left="77" dlg:top="93" dlg:width="310" dlg:height="65" dlg:closeable="true" dlg:moveable="true" dlg:title="DlgPassword">
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="cmdGoOn" dlg:tab-index="0" dlg:left="251" dlg:top="6" dlg:width="53" dlg:height="14" dlg:help-url="HID:34690" dlg:value="cmdGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.Protect.ReadPassword?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="1" dlg:left="251" dlg:top="24" dlg:width="53" dlg:height="14" dlg:help-url="HID:34691" dlg:value="cmdCancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Euro.Protect.RejectPassword?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdHelp" dlg:tab-index="2" dlg:left="251" dlg:top="45" dlg:width="53" dlg:height="14" dlg:tag="34692" dlg:value="cmdHelp" dlg:button-type="help"/>
+ <dlg:textfield dlg:id="txtPassword" dlg:tab-index="3" dlg:left="11" dlg:top="18" dlg:width="232" dlg:height="12" dlg:help-url="HID:34693" dlg:echochar="*"/>
+ <dlg:fixedline dlg:id="hlnPassword" dlg:tab-index="4" dlg:left="6" dlg:top="6" dlg:width="238" dlg:height="8" dlg:value="hlnPassword"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/euro/Hard.xba b/wizards/source/euro/Hard.xba
new file mode 100644
index 000000000000..c500946bd9d5
--- /dev/null
+++ b/wizards/source/euro/Hard.xba
@@ -0,0 +1,229 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Hard" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+
+
+Sub CreateRangeList()
+Dim MaxIndex as Integer
+ MaxIndex = -1
+ EnableStep1DialogControls(False, False, False)
+ EmptySelection()
+ DialogModel.lblSelection.Label = sCURRRANGES
+ EmptyListbox(DialogModel.lstSelection)
+ oDocument.CurrentController.Select(oSelRanges)
+ If (DialogModel.optSheetRanges.State = 1) AND (DialogModel.chkComplete.State &lt;&gt; 1) Then
+ &apos; Conversion on a sheet?
+ SetStatusLineText(sStsRELRANGES)
+ osheet = oDocument.CurrentController.GetActiveSheet
+ oRanges = osheet.CellFormatRanges.createEnumeration()
+ MaxIndex = AddSheetRanges(oRanges, MaxIndex, oSheet, False)
+ If MaxIndex &gt; -1 Then
+ ReDim Preserve RangeList(MaxIndex)
+ End If
+ Else
+ CreateRangeEnumeration(False)
+ bRangeListDefined = True
+ End If
+ EnableStep1DialogControls(True, True, True)
+ SetStatusLineText(&quot;&quot;)
+End Sub
+
+
+Sub CreateRangeEnumeration(bAutopilot as Boolean)
+Dim i as Integer
+Dim MaxIndex as integer
+Dim sStatustext as String
+ MaxIndex = -1
+ If Not bRangeListDefined Then
+ &apos; Cellranges are not yet defined
+ oSheets = oDocument.Sheets
+ For i = 0 To oSheets.Count-1
+ oSheet = oSheets.GetbyIndex(i)
+ If bAutopilot Then
+ IncreaseStatusValue(SBRELGET/osheets.Count)
+ Else
+ sStatustext = ReplaceString(sStsRELSHEETRANGES,Str(i+1),&quot;%1Number%1&quot;)
+ sStatustext = ReplaceString(sStatusText,oSheets.Count,&quot;%2TotPageCount%2&quot;)
+ SetStatusLineText(sStatusText)
+ End If
+ oRanges = osheet.CellFormatRanges.createEnumeration
+ MaxIndex = AddSheetRanges(oRanges, MaxIndex, oSheet, bAutopilot)
+ Next i
+ Else
+ If Not bAutoPilot Then
+ SetStatusLineText(sStsRELRANGES)
+ &apos; cellranges already defined
+ For i = 0 To Ubound(RangeList())
+ If RangeList(i) &lt;&gt; &quot;&quot; Then
+ AddSingleItemToListBox(DialogModel.lstSelection, RangeList(i))
+ End If
+ Next
+ End If
+ End If
+ If MaxIndex &gt; -1 Then
+ ReDim Preserve RangeList(MaxIndex)
+ Else
+ ReDim RangeList()
+ End If
+ Rangeindex = MaxIndex
+End Sub
+
+
+Function AddSheetRanges(oRanges as Object, r as Integer, oSheet as Object, bAutopilot)
+Dim RangeName as String
+Dim AddtoList as Boolean
+Dim iCurStep as Integer
+Dim MaxIndex as Integer
+ iCurStep = DialogModel.Step
+ While oRanges.hasMoreElements
+ oRange = oRanges.NextElement
+ AddToList = CheckFormatType(oRange)
+ If AddToList Then
+ RangeName = RetrieveRangeNamefromAddress(oRange)
+ TotCellCount = TotCellCount + CountRangeCells(oRange)
+ If Not bAutoPilot Then
+ AddSingleItemToListbox(DialogModel.lstSelection, RangeName)
+ End If
+ &apos; The Ranges are only passed to an Array when the whole Document is the basis
+ &apos; Redimension the RangeList Array if necessary
+ MaxIndex = Ubound(RangeList())
+ r = r + 1
+ If r &gt; MaxIndex Then
+ MaxIndex = MaxIndex + SBRANGEUBOUND
+ ReDim Preserve RangeList(MaxIndex)
+ End If
+ RangeList(r) = RangeName
+ End If
+ Wend
+ AddSheetRanges = r
+End Function
+
+
+&apos; adds a section to the collection
+Sub SelectRange()
+Dim i as Integer
+Dim RangeName as String
+Dim SelItem as String
+Dim CurRange as String
+Dim SheetRangeName as String
+Dim DescriptionList() as String
+Dim MaxRangeIndex as Integer
+Dim StatusValue as Integer
+ StatusValue = 0
+ MaxRangeIndex = Ubound(SelRangeList())
+ CurSheetName = oSheet.Name
+ For i = 0 To MaxRangeIndex
+ SelItem = SelRangeList(i)
+ &apos; Is the Range already included in the collection?
+ oRange = RetrieveRangeoutOfRangename(SelItem)
+ TotCellCount = TotCellCount + CountRangeCells(oRange)
+ DescriptionList() = ArrayOutofString(SelItem,&quot;.&quot;,1)
+ SheetRangeName = DeleteStr(DescriptionList(0),&quot;&apos;&quot;)
+ If SheetRangeName = CurSheetName Then
+ oSelRanges.InsertbyName(&quot;&quot;,oRange)
+ End If
+ IncreaseStatusValue(SBRELGET/MaxRangeIndex)
+ Next i
+End Sub
+
+
+Sub ConvertThehardWay(ListboxList(), SwitchFormat as Boolean, bRemove as Boolean)
+Dim i as Integer
+Dim AddCells as Long
+Dim OldStatusValue as Single
+Dim RangeName as String
+Dim LastIndex as Integer
+Dim oSelListbox as Object
+
+ oSelListbox = DialogConvert.GetControl(&quot;lstSelection&quot;)
+ Lastindex = Ubound(ListboxList())
+ If TotCellCount &gt; 0 Then
+ OldStatusValue = StatusValue
+ &apos; hard format
+ For i = 0 To LastIndex
+ RangeName = ListboxList(i)
+ oRange = RetrieveRangeoutofRangeName(RangeName)
+ ConvertCellCurrencies(oRange)
+ If bRemove Then
+ If oSelRanges.HasbyName(RangeName) Then
+ oSelRanges.RemovebyName(RangeName)
+ oDocument.CurrentController.Select(oSelRanges)
+ End If
+ End If
+ If SwitchFormat Then
+ If oRange.getPropertyState(&quot;NumberFormat&quot;) &lt;&gt; 1 Then
+ &apos; Range is hard formatted
+ SwitchNumberFormat(oRange, oFormats, sEuroSign)
+ End If
+ Else
+ SwitchNumberFormat(oRange, oFormats, sEuroSign)
+ End If
+ AddCells = CountRangeCells(oRange)
+ CurCellCount = AddCells
+ IncreaseStatusValue((CurCellCount/TotCellCount)*(100-OldStatusValue))
+ If bRemove Then
+ RemoveListBoxItemByName(oSelListbox.Model,Rangename)
+ End If
+ Next
+ End If
+End Sub
+
+
+Sub ConvertCellCurrencies(oRange as Object)
+Dim oValues as Object
+Dim oCells as Object
+Dim oCell as Object
+ oValues = oRange.queryContentCells(com.sun.star.sheet.CellFlags.VALUE)
+ If (oValues.Count &gt; 0) Then
+ oCells = oValues.Cells.createEnumeration
+ While oCells.hasMoreElements
+ oCell = oCells.nextElement
+ ModifyObjectValuewithCurrFactor(oCell)
+ Wend
+ End If
+End Sub
+
+
+Sub ModifyObjectValuewithCurrFactor(oDocObject as Object)
+Dim oDocObjectValue as double
+ oDocObjectValue = oDocObject.Value
+ oDocObject.Value = Round(oDocObjectValue/CurrFactor, 2)
+End Sub
+
+
+Function CheckIfRangeisCurrency(FormatObject as Object)
+Dim oFormatofObject() as Object
+ &apos; Retrieve the Format of the Object
+ On Local Error GoTo NOKEY
+ oFormatofObject() = oFormats.getByKey(FormatObject.NumberFormat)
+ On Local Error GoTo 0
+ CheckIfRangeIsCurrency = INT(oFormatofObject.Type) AND com.sun.star.util.NumberFormat.CURRENCY
+ Exit Function
+NOKEY:
+ CheckIfRangeisCurrency = False
+ Resume CLERROR
+ CLERROR:
+End Function
+
+
+Function CountColumnsForRow(IndexArray() as String, Row as Integer)
+Dim i as Integer
+Dim NoNulls as Boolean
+ For i = 1 To Ubound(IndexArray,2)
+ If IndexArray(Row,i)= &quot;&quot; Then
+ NoNulls = False
+ Exit For
+ End If
+ Next
+ CountColumnsForRow = i
+End Function
+
+
+Function CountRangeCells(oRange as Object) As Long
+Dim oRangeAddress as Object
+Dim LocCellCount as Long
+ oRangeAddress = oRange.RangeAddress
+ LocCellCount = (oRangeAddress.EndColumn - oRangeAddress.StartColumn + 1) * (oRangeAddress.EndRow - oRangeAddress.StartRow + 1)
+ CountRangeCells = LocCellCount
+End Function</script:module> \ No newline at end of file
diff --git a/wizards/source/euro/Init.xba b/wizards/source/euro/Init.xba
new file mode 100644
index 000000000000..45fdafdbafe5
--- /dev/null
+++ b/wizards/source/euro/Init.xba
@@ -0,0 +1,604 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Init" script:language="StarBasic">Option Explicit
+REM ***** BASIC *****
+
+
+
+Public Const SBRANGEUBOUND = 20
+Public StyleRangeAssignmentList(SBRANGEUBOUND)as String
+Public SelRangeList(SBRANGEUBOUND) as String
+Public RangeList(SBRANGEUBOUND) as String
+Public UnprotectList() as String
+Public FilterNames(2,1) as String
+Public bDoUnProtect as Boolean
+Public bCancelTask as Boolean
+
+Public sREADY as String
+Public sPROTECT as String
+Public sCONTINUE as String
+
+Public sSELTEMPL as String
+Public sSELCELL as String
+Public sCURRRANGES as String
+Public sTEMPLATES as String
+
+Public sSOURCEFILE as String
+Public sSOURCEDIR as String
+Public sTARGETDIR as String
+
+Public sStsPROGRESS as String
+Public sStsCELLPROGRSS as String
+Public sStsRELRANGES as String
+Public sStsRELSHEETRANGES as String
+Public sStsREPROTECT as String
+
+Public sMsgSELDIR as String
+Public sMsgSELFILE as String
+Public sMsgTARGETDIR as String
+Public sMsgNOTTHERE as String
+Public sMsgDLGTITLE as String
+Public sMsgUNPROTECT as String
+Public sMsgPWPROTECT as String
+Public sMsgWRONGPW as String
+Public sMsgSHEETPROTECTED as String
+Public sMsgWARNING as String
+Public sMsgSHEETSNOPROTECT as String
+Public sMsgSHEETNOPROTECT as String
+Public sMsgCHOOSECURRENCY as String
+Public sMsgPASSWORD as String
+Public sMsgOK as String
+Public sMsgCANCEL as String
+Public sMsgFileInvalid as String
+Public sMsgNODIRECTORY as String
+Public sMsgDOCISREADONLY as String
+Public sMsgFileExists as String
+Public sMsgCancelConversion as String
+Public sMsgCancelTitle as String
+Public sCurrPORTUGUESE as String
+Public sCurrDUTCH as String
+Public sCurrFRENCH as String
+Public sCurrSPANISH as String
+Public sCurrITALIAN as String
+Public sCurrGERMAN as String
+Public sCurrBELGIAN as String
+Public sCurrIRISH as String
+Public sCurrLUXEMBOURG as String
+Public sCurrAUSTRIAN as String
+Public sCurrFINNISH as String
+Public sCurrGREEK as String
+Public sCurrSLOVENIAN as String
+Public sCurrCYPRIOT as String
+Public sCurrMALTESE as String
+Public sCurrSLOVAK as String
+Public sCurrUNKNOWN as String
+Public sCurrSYSUNKNOWN as String
+
+Public sPrgsRETRIEVAL as String
+Public sPrgsCONVERTING as String
+Public sPrgsUNPROTECT as String
+Public sInclusiveSubDir as String
+
+Public Const SBCOUNTRYCOUNT = 15
+Public CurMimeType as String
+Public CurCellCount as Long
+Public oSheets as Object
+Public oStyles as Object
+Public oStyle as Object
+Public oFormats as Object
+Public aSimpleStr as String
+Public nSimpleKey as Long
+Public aFormat() as Variant
+Public oRanges as Object
+Public oRange as Object
+Public nLanguage as integer
+Public nFormatLanguage as integer
+Public aCellFormat as Variant
+Public oDocument as Object
+Public StartCol, StartRow, EndCol, EndRow as String
+Public oSheet as Object
+Public IntStartCol, IntStartRow, IntEndCol, IntEndRow as integer
+Public oSelRanges as Object
+Public nFormatType as Integer
+Public sFormatCurrency as String
+Public sFormatLanguage as String
+Public CurSheetName as String
+Public oStatusLine as Object
+Public Const SBRELGET = 50
+Public StatusValue as Single
+Public TotCellCount as Long
+Public StyleIndex as Integer
+Public RangeIndex as Integer
+Public CurrIndex as Integer
+Public ActLangNumber(1) as Integer
+Public CurExtension(2) as String
+Public Currfactor as Double
+Public CurrSymbolList(2) as String
+Public CurrLanguage as String
+Public CurrValue(15,5)
+Public LangIDValue(15,2,2) as String
+Public PreName as String
+Public Separator as String
+Public BitmapDir as String
+Public TypeIndex as Integer, CSIndex as Integer, LangIndex as Integer, FSIndex as Integer
+Public oLocale as New com.sun.star.lang.Locale
+Public sEuroSign as String
+Public oPointer as Object
+Public sDocType as String
+Public bPreSelected as Boolean
+Public bRecursive as Boolean
+Public bCancelProtection as Boolean
+Public CurrRoundMode as Boolean
+Public bRangeListDefined as Boolean
+Public bDocHasProtectedSheets as Boolean
+Public sGOON as String
+Public sHELP as String
+Public sCANCEL as String
+Dim sEnd as String
+
+Sub InitializeResources()
+Dim LocWorkPath as String
+ With DialogModel
+ &apos; Strings that are also needed by the Password Dialog
+ sGoOn = GetResText(1003)
+ sHelp = GetResText(1001)
+ sCANCEL = GetResText(1418)
+ sEnd = GetResText(1000)
+ sPROTECT = GetResText(1005)
+ sCONTINUE = GetResText(1007)
+ sSELTEMPL = GetResText(1106)
+ sSELCELL = GetResText(1107)
+ sCURRRANGES = GetResText(1108)
+ sTEMPLATES = GetResText(1109)
+ sStsPROGRESS = GetResText(1300)
+ sStsCELLPROGRSS = GetResText(1301)
+ sStsRELSHEETRANGES = GetResText(1302)
+ sStsRELRANGES = GetResText(1303)
+ sStsREPROTECT = GetResText(1304)
+ sREADY = GetResText(1400)
+ sMsgSELDIR = GetResText(1401)
+ sMsgSELFILE = GetResText(1402)
+ sMsgTARGETDIR = GetResText(1403)
+ sMsgNOTTHERE = GetResText(1404)
+ sMsgDLGTITLE = GetResText(1405)
+ sMsgUNPROTECT = GetResText(1406)
+ sMsgPWPROTECT = GetResText(1407)
+ sMsgWRONGPW = GetResText(1408)
+ sMsgSHEETPROTECTED = GetResText(1409)
+ sMsgWARNING = GetResText(1410)
+ sMsgSHEETSNOPROTECT = GetResText(1411)
+ sMsgSHEETNOPROTECT = GetResText(1412)
+ sMsgCHOOSECURRENCY = GetResText(1415)
+ sMsgPASSWORD = GetResText(1416)
+ sMsgOK = GetResText(1417)
+ sMsgCANCEL = GetResText(1418)
+ sMsgFILEINVALID = GetResText(1419)
+ sMsgFILEINVALID = ReplaceString(sMsgFILEINVALID,&quot;%PRODUCTNAME&quot;, GetProductname())
+ SMsgNODIRECTORY = GetResText(1420)
+ sMsgDOCISREADONLY = GetResText(1421)
+ sMsgFileExists = GetResText(1422)
+ sMsgCancelConversion = GetResText(1423)
+ sMsgCancelTitle = GetResText(1424)
+ sCurrPORTUGUESE = GetResText(1500)
+ sCurrDUTCH = GetResText(1501)
+ sCurrFRENCH = GetResText(1502)
+ sCurrSPANISH = GetResText(1503)
+ sCurrITALIAN = GetResText(1504)
+ sCurrGERMAN = GetResText(1505)
+ sCurrBELGIAN = GetResText(1506)
+ sCurrIRISH = GetResText(1507)
+ sCurrLUXEMBOURG = GetResText(1508)
+ sCurrAUSTRIAN = GetResText(1509)
+ sCurrFINNISH = GetResText(1510)
+ sCurrGREEK = GetResText(1511)
+ sCurrSLOVENIAN = GetResText(1512)
+ sCurrCYPRIOT = GetResText(1513)
+ sCurrMALTESE = GetResText(1514)
+ sCurrSLOVAK = GetResText(1515)
+ sCurrUNKNOWN = GetResText(1516)
+ sCurrSYSUNKNOWN = GetResText(1517)
+ .cmdCancel.Label = sCANCEL
+ .cmdHelp.Label = sHELP
+ .cmdBack.Label = GetResText(1002)
+ .cmdGoOn.Label = sGOON
+ .lblHint.Label = GetResText(1004)
+ .lblCurrencies.Label = GetResText(1006)
+ .cmdBack.Enabled = False
+ If .Step = 1 Then
+ .chkComplete.Label = GetResText(1100)
+ .hlnSelection.Label = GetResText(1101)
+ .optCellTemplates.Label = GetResText(1102)
+ .optSheetRanges.Label = GetResText(1103)
+ .optDocRanges.Label = GetResText(1104)
+ .optSelRange.Label = GetResText(1105)
+ sCURRRANGES = GetResText(1108)
+ .lblSelection.Label = sCURRRANGES
+ Else
+ .lblProgress.Label = sStsPROGRESS
+ .hlnExtent.Label = GetResText(1200)
+ .optSingleFile.Label = GetResText(1201)
+ .optWholeDir.Label = GetResText(1202)
+ .chkProtect.Label = GetResText(1207)
+ .chkTextDocuments.Label = GetResText(1210)
+
+ sSOURCEFILE = GetResText(1203)
+ sSOURCEDIR = GetResText(1204)
+ .lblSource.Label = sSOURCEDIR
+ sInclusiveSubDir = GetResText(1205)
+ .chkRecursive.Label = sInclusiveSubDir
+ sTARGETDIR = GetResText(1206)
+ .lblTarget.Label = STARGETDIR
+
+ LocWorkPath = GetPathSettings(&quot;Work&quot;)
+ If Not oUcb.Exists(LocWorkPath) Then
+ ShowNoOfficePathError()
+ Stop
+ End If
+
+ .txtSource.Text = ConvertfromUrl(LocWorkPath)
+
+ SubstDir = .txtSource.Text
+ .txtTarget.Text = .txtSource.Text
+ .hlnProgress.Label = GetResText(1600)
+ .lblConfig.Label = GetResText(1603)
+ sPrgsRETRIEVAL = GetResText(1601)
+ sPrgsCONVERTING = GetResText(1602)
+ sPrgsUNPROTECT = GetResText(1604)
+ End If
+ End With
+End Sub
+
+Sub InitializeLanguages()
+ sEuroSign = chr(8364)
+
+&apos; CURRENCIES_PORTUGUESE
+ LangIDValue(0,0,0) = &quot;pt&quot;
+ LangIDValue(0,0,1) = &quot;&quot;
+ LangIDValue(0,0,2) = &quot;-816&quot;
+
+&apos; CURRENCIES_DUTCH
+ LangIDValue(1,0,0) = &quot;nl&quot;
+ LangIDValue(1,0,1) = &quot;&quot;
+ LangIDValue(1,0,2) = &quot;-413&quot;
+
+&apos; CURRENCIES_FRENCH
+ LangIDValue(2,0,0) = &quot;fr&quot;
+ LangIDValue(2,0,1) = &quot;&quot;
+ LangIDValue(2,0,2) = &quot;-40C&quot;
+
+&apos; CURRENCIES_SPANISH
+ LangIDValue(3,0,0) = &quot;es&quot;
+ LangIDValue(3,0,1) = &quot;&quot;
+ LangIDValue(3,0,2) = &quot;-40A&quot;
+
+ &apos;Spanish modern
+ LangIDValue(3,1,0) = &quot;es&quot;
+ LangIDValue(3,1,1) = &quot;&quot;
+ LangIDValue(3,1,2) = &quot;-C0A&quot;
+
+ &apos;Spanish katalanic
+ LangIDValue(3,2,0) = &quot;es&quot;
+ LangIDValue(3,2,1) = &quot;&quot;
+ LangIDValue(3,2,2) = &quot;-403&quot;
+
+&apos; CURRENCIES_ITALIAN
+ LangIDValue(4,0,0) = &quot;it&quot;
+ LangIDValue(4,0,1) = &quot;&quot;
+ LangIDValue(4,0,2) = &quot;-410&quot;
+
+&apos; CURRENCIES_GERMAN
+ LangIDValue(5,0,0) = &quot;de&quot;
+ LangIDValue(5,0,1) = &quot;DE&quot;
+ LangIDValue(5,0,2) = &quot;-407&quot;
+
+&apos; CURRENCIES_BELGIAN
+ LangIDValue(6,0,0) = &quot;fr&quot;
+ LangIDValue(6,0,1) = &quot;BE&quot;
+ LangIDValue(6,0,2) = &quot;-80C&quot;
+
+ LangIDValue(6,1,0) = &quot;nl&quot;
+ LangIDValue(6,1,1) = &quot;BE&quot;
+ LangIDValue(6,1,2) = &quot;-813&quot;
+
+&apos; CURRENCIES_IRISH
+ LangIDValue(7,0,0) = &quot;en&quot;
+ LangIDValue(7,0,1) = &quot;IE&quot;
+ LangIDValue(7,0,2) = &quot;-1809&quot;
+
+ LangIDValue(7,1,0) = &quot;ga&quot;
+ LangIDValue(7,1,1) = &quot;IE&quot;
+ LangIDValue(7,1,2) = &quot;-83C&quot;
+
+&apos; CURRENCIES_LUXEMBOURG
+ LangIDValue(8,0,0) = &quot;fr&quot;
+ LangIDValue(8,0,1) = &quot;LU&quot;
+ LangIDValue(8,0,2) = &quot;-140C&quot;
+
+ LangIDValue(8,1,0) = &quot;de&quot;
+ LangIDValue(8,1,1) = &quot;LU&quot;
+ LangIDValue(8,1,2) = &quot;-1007&quot;
+
+&apos; CURRENCIES_AUSTRIAN
+ LangIDValue(9,0,0) = &quot;de&quot;
+ LangIDValue(9,0,1) = &quot;AT&quot;
+ LangIDValue(9,0,2) = &quot;-C07&quot;
+
+&apos; CURRENCIES_FINNISH
+ LangIDValue(10,0,0) = &quot;fi&quot;
+ LangIDValue(10,0,1) = &quot;FI&quot;
+ LangIDValue(10,0,2) = &quot;-40B&quot;
+
+ LangIDValue(10,1,0) = &quot;sv&quot;
+ LangIDValue(10,1,1) = &quot;FI&quot;
+ LangIDValue(10,1,2) = &quot;-81D&quot;
+
+&apos; CURRENCIES_GREEK
+ LangIDValue(11,0,0) = &quot;el&quot;
+ LangIDValue(11,0,1) = &quot;GR&quot;
+ LangIDValue(11,0,2) = &quot;-408&quot;
+
+&apos; CURRENCIES_SLOVENIAN
+ LangIDValue(12,0,0) = &quot;sl&quot;
+ LangIDValue(12,0,1) = &quot;SI&quot;
+ LangIDValue(12,0,2) = &quot;-424&quot;
+
+&apos; CURRENCIES_CYPRIOT
+ LangIDValue(13,0,0) = &quot;el&quot;
+ LangIDValue(13,0,1) = &quot;CY&quot;
+ LangIDValue(13,0,2) = &quot;-408&quot;
+
+&apos; CURRENCIES_MALTESE
+ LangIDValue(14,0,0) = &quot;mt&quot;
+ LangIDValue(14,0,1) = &quot;MT&quot;
+ LangIDValue(14,0,2) = &quot;-43A&quot;
+
+&apos; CURRENCIES_SLOVAK
+ LangIDValue(15,0,0) = &quot;sk&quot;
+ LangIDValue(15,0,1) = &quot;SK&quot;
+ LangIDValue(15,0,2) = &quot;-41B&quot;
+
+End Sub
+
+
+
+Sub InitializeCurrencies()
+Dim i as Integer
+ GoOn = True
+
+ CurrValue(0,0) = sCurrPORTUGUESE
+ &apos; real conversion rate
+ CurrValue(0,1) = 200.482
+ &apos; rounded conversion rate
+ CurrValue(0,2) = 200
+ CurrValue(0,3) = &quot;Esc.&quot;
+ CurrValue(0,4) = &quot;Esc.&quot;
+ CurrValue(0,5) = &quot;PTE&quot;
+
+ CurrValue(1,0) = sCurrDUTCH
+ &apos; real conversion rate
+ CurrValue(1,1) = 2.20371
+ &apos; rounded conversion rate
+ CurrValue(1,2) = 2
+ CurrValue(1,3) = &quot;F&quot;
+ CurrValue(1,4) = &quot;fl&quot;
+ CurrValue(1,5) = &quot;NLG&quot;
+
+ CurrValue(2,0) = sCurrFRENCH
+ &apos; real conversion rate
+ CurrValue(2,1) = 6.55957
+ &apos; rounded conversion rate
+ CurrValue(2,2) = 7
+ CurrValue(2,3) = &quot;F&quot;
+ CurrValue(2,4) = &quot;F&quot;
+ CurrValue(2,5) = &quot;FRF&quot;
+
+ CurrValue(3,0) = sCurrSPANISH
+ &apos; real conversion rate
+ CurrValue(3,1) = 166.386
+ &apos; rounded conversion rate
+ CurrValue(3,2) = 170
+ CurrValue(3,3) = &quot;Pts&quot;
+ CurrValue(3,4) = &quot;Pts&quot;
+ CurrValue(3,5) = &quot;ESP&quot;
+
+ CurrValue(4,0) = sCurrITALIAN
+ &apos; real conversion rate
+ CurrValue(4,1) = 1936.27
+ &apos; rounded conversion rate
+ CurrValue(4,2) = 2000
+ CurrValue(4,3) = &quot;L.&quot;
+ CurrValue(4,4) = &quot;L.&quot;
+ CurrValue(4,5) = &quot;ITL&quot;
+
+ CurrValue(5,0) = sCurrGERMAN
+ &apos; real conversion rate
+ CurrValue(5,1) = 1.95583
+ &apos; rounded conversion rate
+ CurrValue(5,2) = 2
+ CurrValue(5,3) = &quot;DM&quot;
+ CurrValue(5,4) = &quot;DM&quot;
+ CurrValue(5,5) = &quot;DEM&quot;
+
+ CurrValue(6,0) = sCurrBELGIAN
+ &apos; real conversion rate
+ CurrValue(6,1) = 40.3399
+ &apos; rounded conversion rate
+ CurrValue(6,2) = 40
+ CurrValue(6,3) = &quot;FB&quot;
+ CurrValue(6,4) = &quot;BF&quot;
+ CurrValue(6,5) = &quot;BEF&quot;
+
+ CurrValue(7,0) = sCurrIRISH
+ &apos; real conversion rate
+ CurrValue(7,1) = 0.787564
+ &apos; rounded conversion rate
+ CurrValue(7,2) = 0.8
+ CurrValue(7,3) = &quot;IR£&quot;
+ CurrValue(7,4) = &quot;£&quot;
+ CurrValue(7,5) = &quot;IEP&quot;
+
+ CurrValue(8,0) = sCurrLUXEMBOURG
+ &apos; real conversion rate
+ CurrValue(8,1) = 40.3399
+ &apos; rounded conversion rate
+ CurrValue(8,2) = 40
+ CurrValue(8,3) = &quot;F&quot;
+ CurrValue(8,4) = &quot;F&quot;
+ CurrValue(8,5) = &quot;LUF&quot;
+
+ CurrValue(9,0) = sCurrAUSTRIAN
+ &apos; real conversion rate
+ CurrValue(9,1) = 13.7603
+ &apos; rounded conversion rate
+ CurrValue(9,2) = 15
+ CurrValue(9,3) = &quot;öS&quot;
+ CurrValue(9,4) = &quot;S&quot;
+ CurrValue(9,5) = &quot;ATS&quot;
+
+ CurrValue(10,0) = sCurrFINNISH
+ &apos; real conversion rate
+ CurrValue(10,1) = 5.94573
+ &apos; rounded conversion rate
+ CurrValue(10,2) = 6
+ CurrValue(10,3) = &quot;mk&quot;
+ CurrValue(10,4) = &quot;mk&quot;
+ CurrValue(10,5) = &quot;FIM&quot;
+
+ CurrValue(11,0) = sCurrGREEK
+ &apos; real conversion rate
+ CurrValue(11,1) = 340.750
+ &apos; rounded conversion rate
+ CurrValue(11,2) = 400
+ CurrValue(11,3) = chr(916) &amp; chr(961) &amp; chr(967)
+ CurrValue(11,4) = chr(916) &amp; chr(961) &amp; chr(967)
+ CurrValue(11,5) = &quot;GRD&quot;
+
+ CurrValue(12,0) = sCurrSLOVENIAN
+ &apos; real conversion rate
+ CurrValue(12,1) = 239.64
+ &apos; rounded conversion rate
+ CurrValue(12,2) = 240
+ CurrValue(12,3) = &quot;SIT&quot;
+ CurrValue(12,4) = &quot;SIT&quot;
+ CurrValue(12,5) = &quot;SIT&quot;
+
+ CurrValue(13,0) = sCurrCYPRIOT
+ &apos; real conversion rate
+ CurrValue(13,1) = 0.585274
+ &apos; rounded conversion rate
+ CurrValue(13,2) = 0.6
+ CurrValue(13,3) = &quot;£C&quot;
+ CurrValue(13,4) = &quot;£&quot;
+ CurrValue(13,5) = &quot;CYP&quot;
+
+ CurrValue(14,0) = sCurrMALTESE
+ &apos; real conversion rate
+ CurrValue(14,1) = 0.429300
+ &apos; rounded conversion rate
+ CurrValue(14,2) = 0.4
+ CurrValue(14,3) = chr(8356)
+ CurrValue(14,4) = &quot;Lm&quot;
+ CurrValue(14,5) = &quot;MTL&quot;
+
+ CurrValue(15,0) = sCurrSLOVAK
+ &apos; real conversion rate
+ CurrValue(15,1) = 30.1260
+ &apos; rounded conversion rate
+ CurrValue(15,2) = 30
+ CurrValue(15,3) = &quot;Sk&quot;
+ CurrValue(15,4) = &quot;Sk&quot;
+ CurrValue(15,5) = &quot;SKK&quot;
+
+ i = -1
+ CurrSymbolList(0) = &quot;&quot;
+ CurrSymbolList(1) = &quot;&quot;
+ InitializeCurrencyValues(CurrIndex)
+End Sub
+
+
+Sub InitializeControls()
+ If CurrIndex = -1 Then
+ If DialogModel.Step = 1 Then
+ EnableStep1DialogControls(True, False, False)
+ ElseIf DialogModel.Step = 2 Then
+ EnableStep2DialogControls(True)
+ End If
+ End If
+End Sub
+
+
+Sub InitializeConverter(oLocale, iDialogPage as Integer)
+Dim Isthere as Boolean
+ bCancelProtection = False
+ bRangeListDefined = False
+ PWIndex = -1
+ If iDialogPage = 1 Then
+ ToggleWindow(False)
+ sDocType = Tools.GetDocumentType(ThisComponent)
+ If sDocType = &quot;sCalc&quot; Then
+ bDocHasProtectedSheets = CheckSheetProtection(oSheets)
+ End If
+ oStatusline = ThisComponent.GetCurrentController.GetFrame.CreateStatusIndicator()
+ End If
+ DialogConvert = LoadDialog(&quot;Euro&quot;, &quot;DlgConvert&quot;)
+ DialogModel = DialogConvert.Model
+ DialogPassword = LoadDialog(&quot;Euro&quot;, &quot;DlgPassword&quot;)
+ PasswordModel = DialogPassword.Model
+ DialogModel.Step = iDialogPage
+ InitializeResources()
+ InitializeLanguages()
+ InitializeLocales(oLocale)
+ InitializeCurrencies()
+ InitializeControls()
+ BitmapDir = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/bitmap&quot;)
+ If BitmapDir = &quot;&quot; Then
+ Stop
+ End If
+ FillUpCurrencyListbox()
+ DialogModel.imgPreview.ImageUrl = BitmapDir &amp; &quot;euro_&quot; &amp; DialogModel.Step &amp; &quot;.bmp&quot;
+ DialogConvert.Title = sMsgDLGTITLE
+ DialogModel.cmdGoOn.DefaultButton = True
+ If iDialogPage = 1 Then
+ ToggleWindow(True)
+ End If
+End Sub
+
+
+Sub InitializeCurrencyValues(CurrIndex)
+ If CurrIndex &lt;&gt; -1 Then
+ CurrLanguage = CurrValue(CurrIndex,0)
+ CurrFactor = CurrValue(CurrIndex,1)
+ CurrSymbolList(0) = CurrValue(CurrIndex,3)
+ CurrSymbolList(1) = CurrValue(CurrIndex,4)
+ CurrSymbolList(2) = CurrValue(CurrIndex,5)
+ End If
+End Sub
+
+
+Function InitializeLocales(oLocale) as Boolean
+Dim i as Integer, n as Integer, m as Integer
+Dim sLanguage as String, sCountry as String
+Dim bTakeThisLocale as Boolean
+ sLanguage = oLocale.Language
+ sCountry = oLocale.Country
+ For n = 0 To SBCOUNTRYCOUNT - 1
+ For m = 0 TO 1
+ If DialogModel.Step = 2 Then
+ bTakeThisLocale = LangIDValue(n,m,0) = sLanguage
+ Else
+ bTakeThisLocale = LangIDValue(n,m,0) = sLanguage
+ End If
+ If bTakeThisLocale Then
+ CurrIndex = n
+ For i = 0 To 2
+ CurExtension(i) = LangIDValue(CurrIndex,i,2)
+ Next i
+ InitializeLocales = True
+ Exit Function
+ End If
+ Next m
+ Next n
+ CurrIndex = -1
+ InitializeLocales = False
+End Function
+</script:module>
diff --git a/wizards/source/euro/Protect.xba b/wizards/source/euro/Protect.xba
new file mode 100644
index 000000000000..8a852e9c3e5c
--- /dev/null
+++ b/wizards/source/euro/Protect.xba
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Protect" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+
+Public PWIndex as Integer
+
+
+Function UnprotectSheetsWithPassWord(oSheets as Object, bDoUnProtect as Boolean)
+Dim i as Integer
+Dim MaxIndex as Integer
+Dim iMsgResult as Integer
+ PWIndex = -1
+ If bDocHasProtectedSheets Then
+ If Not bDoUnprotect Then
+ &apos; At First query if sheets shall generally be unprotected
+ iMsgResult = Msgbox(sMsgUNPROTECT,36,sMsgDLGTITLE)
+ bDoUnProtect = iMsgResult = 6
+ End If
+ If bDoUnProtect Then
+ MaxIndex = oSheets.Count-1
+ For i = 0 To MaxIndex
+ bDocHasProtectedSheets = Not UnprotectSheet(oSheets(i))
+ If bDocHasProtectedSheets Then
+ ReprotectSheets()
+ Exit For
+ End If
+ Next i
+ If PWIndex = -1 Then
+ ReDim UnProtectList() as String
+ Else
+ ReDim Preserve UnProtectList(PWIndex) as String
+ End If
+ Else
+ Msgbox (sMsgSHEETSNOPROTECT, 64, sMsgDLGTITLE)
+ End If
+ End If
+ UnProtectSheetsWithPassword = bDocHasProtectedSheets
+End Function
+
+
+Function UnprotectSheet(oListSheet as Object)
+Dim ListSheetName as String
+Dim sStatustext as String
+Dim i as Integer
+Dim bOneSheetIsUnprotected as Boolean
+ i = -1
+ ListSheetName = oListSheet.Name
+ If oListSheet.IsProtected Then
+ oListSheet.Unprotect(&quot;&quot;)
+ If oListSheet.IsProtected Then
+ &apos; Sheet is protected by a Password
+ bOneSheetIsUnProtected = UnprotectSheetWithDialog(oListSheet, ListSheetName)
+ UnProtectSheet() = bOneSheetIsUnProtected
+ Else
+ &apos; The Sheet could be unprotected without a password
+ AddSheettoUnprotectionlist(ListSheetName,&quot;&quot;)
+ UnprotectSheet() = True
+ End If
+ Else
+ UnprotectSheet() = True
+ End If
+End Function
+
+
+Function UnprotectSheetWithDialog(oListSheet as Object, ListSheetName as String) as Boolean
+Dim PWIsCorrect as Boolean
+Dim QueryText as String
+ oDocument.CurrentController.SetActiveSheet(oListSheet)
+ QueryText = ReplaceString(sMsgPWPROTECT,&quot;&apos;&quot; &amp; ListSheetName &amp; &quot;&apos;&quot;, &quot;%1TableName%1&quot;)
+ &apos;&quot;Please insert the password to unprotect the sheet &apos;&quot; &amp; ListSheetName&apos;&quot;
+ Do
+ ExecutePasswordDialog(QueryText)
+ If bCancelProtection Then
+ bCancelProtection = False
+ Msgbox (sMsgSHEETSNOPROTECT, 64, sMsgDLGTITLE)
+ UnprotectSheetWithDialog() = False
+ exit Function
+ End If
+ oListSheet.Unprotect(Password)
+ If oListSheet.IsProtected Then
+ PWIsCorrect = False
+ Msgbox (sMsgWRONGPW, 64, sMsgDLGTITLE)
+ Else
+ &apos; Sheet could be unprotected
+ AddSheettoUnprotectionlist(ListSheetName,Password)
+ PWIsCorrect = True
+ End If
+ Loop Until PWIsCorrect
+ UnprotectSheetWithDialog() = True
+End Function
+
+
+Sub ExecutePasswordDialog(QueryText as String)
+ With PasswordModel
+ .Title = QueryText
+ .hlnPassword.Label = sMsgPASSWORD
+ .cmdCancel.Label = sMsgCANCEL
+ .cmdHelp.Label = sHELP
+ .cmdGoOn.Label = sMsgOK
+ .cmdGoOn.DefaultButton = True
+ End With
+ DialogPassword.Execute
+End Sub
+
+Sub ReadPassword()
+ Password = PasswordModel.txtPassword.Text
+ DialogPassword.EndExecute
+End Sub
+
+
+Sub RejectPassword()
+ bCancelProtection = True
+ DialogPassword.EndExecute
+End Sub
+
+
+&apos; Reprotects the previousliy protected sheets
+&apos; The passwordinformation is stored in the List &apos;UnProtectList()&apos;
+Sub ReprotectSheets()
+Dim i as Integer
+Dim oProtectSheet as Object
+Dim ProtectList() as String
+Dim SheetName as String
+Dim SheetPassword as String
+ If PWIndex &gt; -1 Then
+ SetStatusLineText(sStsREPROTECT)
+ For i = 0 To PWIndex
+ ProtectList() = ArrayOutOfString(UnProtectList(i),&quot;;&quot;)
+ SheetName = ProtectList(0)
+ If Ubound(ProtectList()) &gt; 0 Then
+ SheetPassWord = ProtectList(1)
+ Else
+ SheetPassword = &quot;&quot;
+ End If
+ oProtectSheet = oSheets.GetbyName(SheetName)
+ If Not oProtectSheet.IsProtected Then
+ oProtectSheet.Protect(SheetPassWord)
+ End If
+ Next i
+ SetStatusLineText(&quot;&quot;)
+ End If
+ PWIndex = -1
+ ReDim UnProtectList()
+End Sub
+
+
+&apos; Add a Sheet to the list of sheets that finally have to be
+&apos; unprotected
+Sub AddSheettoUnprotectionlist(ListSheetName as String, Password as String)
+Dim MaxIndex as Integer
+ MaxIndex = Ubound(UnProtectList())
+ PWIndex = PWIndex + 1
+ If PWIndex &gt; MaxIndex Then
+ ReDim Preserve UnprotectList(MaxIndex + SBRANGEUBOUND)
+ End If
+ UnprotectList(PWIndex) = ListSheetName &amp; &quot;;&quot; &amp; Password
+End Sub
+
+
+Function CheckSheetProtection(oSheets as Object) as Boolean
+Dim MaxIndex as Integer
+Dim i as Integer
+Dim bProtectedSheets as Boolean
+ bProtectedSheets = False
+ MaxIndex = oSheets.Count-1
+ For i = 0 To MaxIndex
+ bProtectedSheets = oSheets(i).IsProtected
+ If bProtectedSheets Then
+ CheckSheetProtection() = True
+ Exit Function
+ End If
+ Next i
+ CheckSheetProtection() = False
+End Function</script:module> \ No newline at end of file
diff --git a/wizards/source/euro/Soft.xba b/wizards/source/euro/Soft.xba
new file mode 100644
index 000000000000..b4088e931156
--- /dev/null
+++ b/wizards/source/euro/Soft.xba
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Soft" script:language="StarBasic">Option Explicit
+REM ***** BASIC *****
+
+
+Sub CreateStyleEnumeration()
+ EmptySelection()
+ EmptyListbox(DialogModel.lstSelection)
+ CurSheetName = oDocument.CurrentController.GetActiveSheet.Name
+ MakeStyleEnumeration(False)
+ DialogModel.lblSelection.Label = sTEMPLATES
+End Sub
+
+
+Sub MakeStyleEnumeration(bAddToListbox as Boolean)
+Dim m as integer
+Dim aStyleFormat as Object
+Dim Stylename as String
+ StyleIndex = -1
+ oStyles = oDocument.StyleFamilies.GetbyIndex(0)
+ For m = 0 To oStyles.count-1
+ oStyle = oStyles.GetbyIndex(m)
+ StyleName = oStyle.Name
+ If CheckFormatType(oStyle) Then
+ If Not bAddToListBox Then
+ AddSingleItemToListbox(DialogModel.lstSelection, Stylename)
+ Else
+ SwitchNumberFormat(ostyle, oFormats, sEuroSign)
+ End If
+ StyleIndex = StyleIndex + 1
+ If StyleIndex &gt; Ubound(StyleRangeAssignMentList()) Then
+ Redim Preserve StyleRangeAssignmentList(StyleIndex)
+ End If
+ StyleRangeAssignmentList(StyleIndex) = &quot;&lt;STYLENAME&gt;&quot; &amp; Stylename &amp; &quot;&lt;/STYLENAME&gt;&quot; &amp; _
+ &quot;&lt;DEFINED&gt;FALSE&lt;/DEFINED&gt;&quot; &amp; &quot;&lt;RANGES&gt;&lt;/RANGES&gt;&quot; &amp;_
+ &quot;&lt;CELLCOUNT&gt;0&lt;/CELLCOUNT&gt;&quot; &amp;_
+ &quot;&lt;SELECTED&gt;FALSE&lt;/SELECTED&gt;&quot;
+ End If
+ Next m
+ If StyleIndex &gt; -1 Then
+ Redim Preserve StyleRangeAssignmentList(StyleIndex)
+ Else
+ ReDim StyleRangeAssignmentList()
+ End If
+End Sub
+
+
+Sub AssignRangestoStyle(StyleList(), SelList())
+Dim i as Integer
+Dim n as integer
+Dim LastIndex as Integer
+Dim CurStyleName as String
+Dim AssignString as String
+ LastIndex = Ubound(StyleList())
+ StatusValue = 0
+ SetStatusLineText(sStsRELRANGES)
+ For i = 0 To LastIndex
+ CurStyleName = StyleList(i)
+ n = PartStringInArray(StyleRangeAssignmentList(), CurStyleName, 0)
+ AssignString = StyleRangeAssignmentlist(n)
+ If IndexInArray(CurStyleName, SelList()) &lt;&gt; -1 Then
+ &apos; Style is selected
+ If FindPartString(AssignString, &quot;&lt;DEFINED&gt;&quot;, &quot;&lt;/DEFINED&gt;&quot;, 1) = &quot;FALSE&quot; Then
+ AssignString = ReplaceString(AssignString, &quot;&lt;SELECTED&gt;TRUE&lt;/SELECTED&gt;&quot;, &quot;&lt;SELECTED&gt;FALSE&lt;/SELECTED&gt;&quot;)
+ AssignCellFormatRanges(n, AssignString, CurStyleName)
+ End If
+ Else
+ &apos; Style is not selected
+ If FindPartString(AssignString, &quot;&lt;SELECTED&gt;&quot;, &quot;&lt;/SELECTED&gt;&quot;, 1) = &quot;FALSE&quot; Then
+ DeselectStyle(CurStyleName, n)
+ End If
+ End If
+ IncreaseStatusvalue(SBRELGET/(LastIndex+1))
+ Next i
+End Sub
+
+
+Sub AssignCellFormatRanges(n as Integer, AssignString as String, CurStyleName as String)
+Dim oRanges() as Object
+Dim oRange as Object
+Dim oRangeAddress
+Dim oSheet as Object
+Dim StyleCellCount as Long
+Dim i as Integer
+Dim MaxIndex as Integer
+Dim RangeString as String
+Dim SheetName as String
+Dim RangeName as String
+Dim CellCountString as String
+ StyleCellCount = 0
+ RangeString = &quot;&lt;RANGES&gt;&quot;
+ MaxIndex = oSheets.Count-1
+ For i = 0 To MaxIndex
+ oSheet = oSheets(i)
+ SheetName = oSheet.Name
+ oRanges = osheet.CellFormatRanges.CreateEnumeration
+ While oRanges.hasMoreElements
+ oRange = oRanges.NextElement
+ If oRange.getPropertyState(&quot;NumberFormat&quot;) = 1 Then
+ If oRange.CellStyle = CurStyleName Then
+ oRangeAddress = oRange.RangeAddress
+ RangeName = RetrieveRangeNamefromAddress(oRange)
+ RangeString = RangeString &amp; RangeName &amp; &quot;,&quot;
+ StyleCellCount = StyleCellCount + CountRangeCells(oRange)
+ End If
+ End If
+ Wend
+ Next i
+ If StyleCellCount &gt; 0 Then
+ TotCellCount = TotCellCount + StyleCellCount
+ RangeString = RTrimStr(RangeString,&quot;,&quot;)
+ RangeString = RangeString &amp; &quot;&lt;/RANGES&gt;&quot;
+ CellCountString = &quot;&lt;CELLCOUNT&gt;&quot; &amp; StyleCellCount &amp; &quot;&lt;/CELLCOUNT&quot;
+ AssignString = ReplaceString(AssignString, RangeString,&quot;&lt;RANGES&gt;&lt;/RANGES&gt;&quot;)
+ AssignString = ReplaceString(AssignString, CellCountString,&quot;&lt;CELLCOUNT&gt;0&lt;/CELLCOUNT&gt;&quot;)
+ End If
+ AssignString = ReplaceString(AssignString, &quot;&lt;DEFINED&gt;TRUE&lt;/DEFINED&gt;&quot;, &quot;&lt;DEFINED&gt;FALSE&lt;/DEFINED&gt;&quot;)
+ StyleRangeAssignmentList(n) = AssignString
+End Sub
+
+
+&apos; deletes a styletemplate from the Collection that selects the ranges
+Sub DeselectStyle(DeSelStyleName as String, n as Integer)
+Dim i as Integer
+Dim RangeName as String
+Dim SelectString as String
+Dim AssignString as String
+Dim StyleRangeList() as String
+Dim MaxIndex as Integer
+ SelectString =&quot;&lt;SELECTED&gt;FALSE&lt;/SELECTED&gt;&quot;
+ AssignString = StyleRangeAssignmentList(n)
+ RangeString = FindPartString(AssignString,&quot;&lt;RANGES&gt;&quot;,&quot;&lt;/RANGES&gt;&quot;,1)
+ StyleRangeList() = ArrayoutofString(RangeString,&quot;,&quot;)
+ MaxIndex = Ubound(StyleRangeList())
+ For i = 0 To MaxIndex
+ RangeName = StyleRangeList(i)
+ If oSelRanges.HasbyName(RangeName) Then
+ oSelRanges.RemovebyName(RangeName)
+ End If
+ Next i
+ AssignString = ReplaceString(AssignString, &quot;&lt;SELECTED&gt;FALSE&lt;/SELECTED&gt;&quot;, &quot;&lt;SELECTED&gt;TRUE&lt;/SELECTED&gt;&quot;)
+ StyleRangeAssignmentList(n) = AssignString
+End Sub
+
+
+Function RetrieveRangeNamefromAddress(oRange as Object) as String
+Dim Rangename as String
+Dim oAddressRanges as Object
+ oAddressRanges = oDocument.createInstance(&quot;com.sun.star.sheet.SheetCellRanges&quot;)
+ oAddressRanges.InsertbyName(&quot;&quot;,oRange)
+ Rangename = oAddressRanges.RangeAddressesasString
+&apos; Msgbox &quot;Adresse: &quot; &amp; oRangeAddress.StartColumn &amp; &quot; ; &quot; &amp; oRangeAddress.EndColumn &amp; &quot; ; &quot; &amp; oRangeAddress.StartRow &amp; &quot; ; &quot; &amp; oRangeAddress.EndRow &amp; chr(13) &amp; RangeName
+&apos; oAddressRanges.RemovebyName(RangeName)
+ RetrieveRangeNamefromAddress = Rangename
+End Function
+
+
+&apos; creates a sheet object from an according sectionname
+Function RetrieveSheetoutofRangeName(TableText as String)
+Dim DescriptionList() as String
+Dim SheetName as String
+Dim MaxIndex as integer
+ &apos; find out in which sheet the range is
+ DescriptionList() = ArrayOutofString(TableText,&quot;.&quot;,MaxIndex)
+ SheetName = DescriptionList(0)
+ SheetName = DeleteStr(SheetName,&quot;&apos;&quot;)
+ &apos; set the viewcursor on this sheet
+ RetrieveSheetoutofRangeName = oSheets.GetbyName(SheetName)
+End Function
+
+
+&apos; creates a rangeobject from an according rangename
+Function RetrieveRangeoutofRangeName(TableText as String)
+ oSheet = RetrieveSheetoutofRangeName(TableText)
+ oRange = oSheet.GetCellRangebyName(TableText)
+ RetrieveRangeoutofRangeName = oRange
+End Function
+
+
+Sub ConvertTheSoftWay(StyleList(), bDeSelect as Boolean)
+Dim i as Integer
+Dim l as Integer
+Dim s as Integer
+Dim n as Integer
+Dim CurStyleName as String
+Dim RangeName as String
+Dim OldStatusValue as Integer
+Dim LastIndex as Integer
+Dim oSelListbox as Object
+Dim StyleRangeList() as String
+Dim MaxIndex as Integer
+ oSelListbox = DialogConvert.GetControl(&quot;lstSelection&quot;)
+ LastIndex = Ubound(StyleList())
+ OldStatusValue = StatusValue
+ For i = 0 To LastIndex
+ CurStyleName = StyleList(i)
+ oStyle = oStyles.GetbyName(CurStyleName)
+ StyleRangeList() = GetAssignedRanges(CurStyleName, n)
+ MaxIndex = Ubound(StyleRangeList())
+ For s = 0 To MaxIndex
+ RangeName = StyleRangeList(s)
+ oRange = RetrieveRangeoutofRangeName(RangeName)
+ If oRange.getPropertyState(&quot;NumberFormat&quot;) = 1 Then
+ &apos; Range is hard formatted
+ ConvertCellCurrencies(oRange)
+ CurCellCount = CountRangeCells(oRange)
+ End If
+ IncreaseStatusvalue((CurCellCount/TotCellCount)*(95-OldStatusValue))
+ If bDeSelect Then
+ &apos; Note: On Problems see Bug #73157
+ If oSelRanges.HasbyName(RangeName) Then
+ oSelRanges.RemovebyName(RangeName)
+ oDocument.CurrentController.Select(oSelRanges)
+ End If
+ End If
+ Next s
+ SwitchNumberFormat(ostyle, oFormats, sEuroSign)
+ StyleRangeAssignmentList(n) = &quot;&quot;
+ l = GetItemPos(oSelListBox.Model, CurStyleName)
+ oSelListbox.RemoveItems(l,1)
+ Next
+End Sub
+
+
+Function GetAssignedRanges(CurStyleName as String, n as Integer)
+Dim StyleRangeList() as String
+Dim RangeString as String
+Dim AssignString as String
+ n = PartStringInArray(StyleRangeAssignmentList(), CurStyleName, 0)
+ If n &lt;&gt; -1 Then
+ AssignString = StyleRangeAssignmentList(n)
+ RangeString = FindPartString(AssignString,&quot;&lt;RANGES&gt;&quot;, &quot;&lt;/RANGES&gt;&quot;,1)
+ If RangeString &lt;&gt; &quot;&quot; Then
+ StyleRangeList() = ArrayoutofString(RangeString,&quot;,&quot;)
+ End If
+ End If
+ GetAssignedRanges() = StyleRangeList()
+End Function</script:module> \ No newline at end of file
diff --git a/wizards/source/euro/Writer.xba b/wizards/source/euro/Writer.xba
new file mode 100644
index 000000000000..0d153b7058e2
--- /dev/null
+++ b/wizards/source/euro/Writer.xba
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Writer" script:language="StarBasic">REM ***** BASIC *****
+
+
+Sub ConvertWriterTables()
+Dim CellString as String
+Dim oParagraphs as Object
+Dim oPara as Object
+Dim i as integer
+Dim sCellNames()
+Dim oCell as Object
+ oParagraphs = oDocument.Text.CreateEnumeration
+ While oParagraphs.HasMoreElements
+ oPara = oParagraphs.NextElement
+ If NOT oPara.supportsService(&quot;com.sun.star.text.Paragraph&quot;) Then
+ &apos; Note: As cells might be splitted or merged
+ &apos; you cannot refer to them via their indices
+ sCellNames = oPara.CellNames
+ For i = 0 To Ubound(sCellNames)
+ If sCellNames(i) &lt;&gt; &quot;&quot; Then
+ oCell = oPara.getCellByName(sCellNames(i))
+ If CheckFormatType(oCell) Then
+ SwitchNumberFormat(oCell, oFormats, sEuroSign)
+ ModifyObjectValuewithCurrFactor(oCell)
+ End If
+ End If
+ Next
+ End If
+ Wend
+End Sub
+
+
+Sub ModifyObjectValuewithCurrFactor(oDocObject as Object)
+ oDocObjectValue = oDocObject.Value
+ oDocObject.Value = oDocObjectValue/CurrFactor
+End Sub
+
+
+Sub ConvertTextFields()
+Dim oTextFields as Object
+Dim oTextField as Object
+Dim FieldValue
+Dim oDocObjectValue as double
+Dim InstanceNames(500) as String
+Dim CurInstanceName as String
+Dim MaxIndex as Integer
+ MaxIndex = 0
+ oTextfields = oDocument.getTextfields.CreateEnumeration
+ While oTextFields.hasmoreElements
+ oTextField = oTextFields.NextElement
+ If oTextField.PropertySetInfo.HasPropertybyName(&quot;NumberFormat&quot;) Then
+ If CheckFormatType(oTextField) Then
+ If oTextField.PropertySetInfo.HasPropertybyName(&quot;Value&quot;) Then
+ If Not oTextField.SupportsService(&quot;com.sun.star.text.TextField.GetExpression&quot;) Then
+ oTextField.Content = CStr(Round(oTextField.Value/CurrFactor,2))
+ End If
+ ElseIf oTextField.TextFieldMaster.PropertySetInfo.HasPropertyByName(&quot;Value&quot;) Then
+ CurInstanceName = oTextField.TextFieldMaster.InstanceName
+ If Not FieldinArray(InstanceNames(), MaxIndex, CurInstanceName) Then
+ oTextField.TextFieldMaster.Content = CStr(Round(oTextField.TextFieldMaster.Value/CurrFactor,2))
+ InstanceNames(MaxIndex) = CurInstanceName
+ MaxIndex = MaxIndex + 1
+ End If
+ End If
+ SwitchNumberFormat(oTextField, oFormats, sEuroSign)
+ End If
+ End If
+ Wend
+ oDocument.GetTextFields.refresh()
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/euro/delzip b/wizards/source/euro/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/euro/delzip
diff --git a/wizards/source/euro/dialog.xlb b/wizards/source/euro/dialog.xlb
new file mode 100644
index 000000000000..c461ce54f0cd
--- /dev/null
+++ b/wizards/source/euro/dialog.xlb
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Euro" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="DlgConvert"/>
+ <library:element library:name="DlgPassword"/>
+</library:library>
diff --git a/wizards/source/euro/euro.src b/wizards/source/euro/euro.src
new file mode 100644
index 000000000000..257632f8bbb4
--- /dev/null
+++ b/wizards/source/euro/euro.src
@@ -0,0 +1,476 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#define STEP_ZERO 1000
+#define STEP_CONVERTER 1100
+#define STEP_AUTOPILOT 1200
+#define STATUSLINE 1300
+#define MESSAGES 1400
+#define CURRENCIES 1500
+#define STEP_LASTPAGE 1600
+// --------------------------------------------------------------------
+String STEP_ZERO
+{
+Text [ en-US ] = "~Cancel";
+};
+
+String STEP_ZERO + 1
+{
+Text [ en-US ] = "~Help";
+};
+
+String STEP_ZERO + 2
+{
+Text [ en-US ] = "<<~Back";
+};
+
+String STEP_ZERO + 3
+{
+Text [ en-US ] = "~Convert";
+};
+
+String STEP_ZERO + 4
+{
+Text [ en-US ] = "Note: Currency amounts from external links and currency conversion factors in formulas cannot be converted.";
+};
+
+String STEP_ZERO + 5
+{
+Text [ en-US ] = "First, unprotect all sheets.";
+};
+
+String STEP_ZERO + 6
+{
+Text [ en-US ] = "Currencies:";
+};
+
+
+String STEP_ZERO + 7
+{
+Text [ en-US ] = "C~ontinue>>";
+};
+
+
+String STEP_ZERO + 8
+{
+Text [ en-US ] = "C~lose";
+};
+
+String STEP_CONVERTER
+{
+Text [ en-US ] = "~Entire document";
+};
+
+String STEP_CONVERTER + 1
+{
+Text [ en-US ] = "Selection";
+};
+
+String STEP_CONVERTER + 2
+{
+Text [ en-US ] = "Cell S~tyles";
+};
+
+String STEP_CONVERTER + 3
+{
+Text [ en-US ] = "Currency cells in the current ~sheet";
+};
+
+String STEP_CONVERTER + 4
+{
+Text [ en-US ] = "Currency cells in the entire ~document";
+};
+
+String STEP_CONVERTER + 5
+{
+Text [ en-US ] = "~Selected range";
+};
+
+String STEP_CONVERTER + 6
+{
+Text [ en-US ] = "Select Cell Styles";
+};
+
+String STEP_CONVERTER + 7
+{
+Text [ en-US ] = "Select currency cells";
+};
+
+String STEP_CONVERTER + 8
+{
+Text [ en-US ] = "Currency ranges:";
+};
+
+String STEP_CONVERTER + 9
+{
+Text [ en-US ] = "Templates:";
+};
+
+
+String STEP_AUTOPILOT
+{
+Text [ en-US ] = "Extent";
+};
+
+String STEP_AUTOPILOT + 1
+{
+Text [ en-US ] = "~Single %PRODUCTNAME Calc document";
+};
+
+String STEP_AUTOPILOT + 2
+{
+Text [ en-US ] = "Complete ~directory";
+};
+
+String STEP_AUTOPILOT + 3
+{
+Text [ en-US ] = "Source Document:";
+};
+
+String STEP_AUTOPILOT + 4
+{
+Text [ en-US ] = "Source directory:";
+};
+
+String STEP_AUTOPILOT + 5
+{
+Text [ en-US ] = "~Including subfolders";
+};
+
+String STEP_AUTOPILOT + 6
+{
+Text [ en-US ] = "Target directory:";
+};
+
+
+String STEP_AUTOPILOT + 7
+{
+Text [ en-US ] = "Temporarily unprotect sheet without query";
+};
+
+
+String STEP_AUTOPILOT + 10
+{
+Text [ en-US ] = "Also convert fields and tables in text documents";
+};
+
+
+String STATUSLINE
+{
+Text [ en-US ] = "Conversion status: ";
+};
+
+String STATUSLINE + 1
+{
+Text [ en-US ] = "Conversion status of the cell templates:";
+};
+
+String STATUSLINE + 2
+{
+Text [ en-US ] = "Registration of the relevant ranges: Sheet %1Number%1 of %2TotPageCount%2";
+};
+
+
+String STATUSLINE + 3
+{
+Text [ en-US ] = "Entry of the ranges to be converted...";
+};
+
+
+
+String STATUSLINE + 4
+{
+Text [ en-US ] = "Sheet protection for each sheet will be restored...";
+};
+
+
+String STATUSLINE + 5
+{
+Text [ en-US ] = "Conversion of the currency units in the cell templates...";
+};
+
+
+
+String MESSAGES
+{
+Text [ en-US ] = "~Finish";
+};
+
+String MESSAGES + 1
+{
+Text [ en-US ] = "Select directory";
+};
+
+String MESSAGES + 2
+{
+Text [ en-US ] = "Select file";
+};
+
+String MESSAGES + 3
+{
+Text [ en-US ] = "Select target directory";
+};
+
+String MESSAGES + 4
+{
+Text [ en-US ] = "non-existant";
+};
+
+
+String MESSAGES + 5
+{
+Text [ en-US ] = "Euro Converter";
+};
+
+
+
+String MESSAGES + 6
+{
+Text [ en-US ] = "Should protected spreadsheets be temporarily unprotected?";
+};
+
+
+String MESSAGES + 7
+{
+Text [ en-US ] = "Enter the password to unprotect the table %1TableName%1";
+};
+
+
+String MESSAGES + 8
+{
+Text [ en-US ] = "Wrong Password!";
+};
+
+
+String MESSAGES + 9
+{
+Text [ en-US ] = "Protected Sheet";
+};
+
+
+String MESSAGES + 10
+{
+Text [ en-US ] = "Warning!";
+};
+
+
+String MESSAGES + 11
+{
+Text [ en-US ] = "Protection for the sheets will not be removed.";
+};
+
+
+String MESSAGES + 12
+{
+Text [ en-US ] = "Sheet cannot be unprotected";
+};
+
+
+String MESSAGES + 13
+{
+Text [ en-US ] = "The Wizard cannot edit this document as cell formats cannot be modified in documents containing protected spreadsheets.";
+};
+
+
+
+String MESSAGES + 14
+{
+Text [ en-US ] = "Please note that the Euro Converter will, otherwise, not be able to edit this document!";
+};
+
+
+
+String MESSAGES + 15
+{
+Text [ en-US ] = "Please choose a currency to be converted first!";
+};
+
+String MESSAGES + 16
+{
+Text [ en-US ] = "Password:";
+};
+
+String MESSAGES + 17
+{
+Text [ en-US ] = "OK";
+};
+
+String MESSAGES + 18
+{
+Text [ en-US ] = "Cancel";
+};
+
+
+ String MESSAGES + 19
+{
+Text [ en-US ] = "Please select a %PRODUCTNAME Calc document for editing!";
+};
+
+
+String MESSAGES + 20
+{
+Text [ en-US ] = "'<1>' is not a directory!";
+};
+
+
+String MESSAGES + 21
+{
+Text [ en-US ] = "Document is read-only!";
+};
+
+
+String MESSAGES + 22
+{
+ Text [ en-US ] = "The '<1>' file already exists.<CR>Do you want to overwrite it?";
+};
+
+
+String MESSAGES + 23
+{
+ Text [ en-US ] = "Do you really want to terminate conversion at this point?";
+};
+
+String MESSAGES + 24
+{
+ Text [ en-US ] = "Cancel Wizard";
+};
+
+ String CURRENCIES
+{
+Text [ en-US ] = "Portuguese Escudo";
+};
+
+String CURRENCIES + 1
+{
+Text [ en-US ] = "Dutch Guilder";
+};
+
+String CURRENCIES + 2
+{
+Text [ en-US ] = "French Franc";
+};
+
+String CURRENCIES + 3
+{
+Text [ en-US ] = "Spanish Peseta";
+};
+
+String CURRENCIES + 4
+{
+Text [ en-US ] = "Italian Lira";
+};
+
+String CURRENCIES + 5
+{
+Text [ en-US ] = "German Mark";
+};
+
+String CURRENCIES + 6
+{
+Text [ en-US ] = "Belgian Franc";
+};
+
+String CURRENCIES + 7
+{
+Text [ en-US ] = "Irish Punt";
+};
+
+String CURRENCIES + 8
+{
+Text [ en-US ] = "Luxembourg Franc";
+};
+
+String CURRENCIES + 9
+{
+Text [ en-US ] = "Austrian Schilling";
+};
+
+String CURRENCIES + 10
+{
+Text [ en-US ] = "Finnish Mark";
+};
+
+String CURRENCIES + 11
+{
+Text [ en-US ] = "Greek Drachma";
+};
+
+String CURRENCIES + 12
+{
+Text [ en-US ] = "Slovenian Tolar";
+};
+
+String CURRENCIES + 13
+{
+Text [ en-US ] = "Cypriot Pound";
+};
+
+String CURRENCIES + 14
+{
+Text [ en-US ] = "Maltese Lira";
+};
+
+String CURRENCIES + 15
+{
+Text [ en-US ] = "Slovak Koruna";
+};
+
+String CURRENCIES + 16
+{
+Text [ en-US ] = "The currency set for the document is not a European currency!";
+};
+
+String CURRENCIES + 17
+{
+Text [ en-US ] = "The language set for your operating system is not a language of the European Monetary Union.";
+};
+
+String STEP_LASTPAGE
+{
+Text [ en-US ] = "Progress";
+};
+
+
+String STEP_LASTPAGE + 1
+{
+Text [ en-US ] = "Retrieving the relevant documents...";
+};
+
+String STEP_LASTPAGE + 2
+{
+Text [ en-US ] = "Converting the documents...";
+};
+
+String STEP_LASTPAGE + 3
+{
+Text [ en-US ] = "Settings:";
+};
+
+String STEP_LASTPAGE + 4
+{
+Text [ en-US ] = "Sheet is always unprotected";
+};
diff --git a/wizards/source/euro/makefile.mk b/wizards/source/euro/makefile.mk
new file mode 100644
index 000000000000..f4b4c22306f5
--- /dev/null
+++ b/wizards/source/euro/makefile.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=euro
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+#
+# testresource.
+#
+SRS2NAME = euro
+SRC2FILES= euro.src
+RESLIB2SRSFILES= $(SRS)$/euro.srs
+RESLIB2NAME= eur
+
+ZIP1TARGET = $(EURO_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/wizards/source/euro/script.xlb b/wizards/source/euro/script.xlb
new file mode 100644
index 000000000000..1bc4927c2a5a
--- /dev/null
+++ b/wizards/source/euro/script.xlb
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Euro" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="ConvertRun"/>
+ <library:element library:name="AutoPilotRun"/>
+ <library:element library:name="Hard"/>
+ <library:element library:name="Soft"/>
+ <library:element library:name="Init"/>
+ <library:element library:name="Common"/>
+ <library:element library:name="Writer"/>
+ <library:element library:name="Protect"/>
+</library:library>
diff --git a/wizards/source/formwizard/DBMeta.xba b/wizards/source/formwizard/DBMeta.xba
new file mode 100644
index 000000000000..2d8dc2838f5c
--- /dev/null
+++ b/wizards/source/formwizard/DBMeta.xba
@@ -0,0 +1,330 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DBMeta" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+
+
+Public iCommandTypes() as Integer
+Public CurCommandType as Integer
+Public oDataSource as Object
+Public bEnableBinaryOptionGroup as Boolean
+&apos;Public bSelectContent as Boolean
+
+
+Function GetDatabaseNames(baddFirstListItem as Boolean)
+Dim sDatabaseList()
+ If oDBContext.HasElements Then
+ Dim LocDBList() as String
+ Dim MaxIndex as Integer
+ Dim i as Integer
+ LocDBList = oDBContext.ElementNames()
+ MaxIndex = Ubound(LocDBList())
+ If baddfirstListItem Then
+ ReDim Preserve sDatabaseList(MaxIndex + 1)
+ sDatabaseList(0) = sSelectDatasource
+ a = 1
+ Else
+ ReDim Preserve sDatabaseList(MaxIndex)
+ a = 0
+ End If
+ For i = 0 To MaxIndex
+ sDatabaseList(a) = oDBContext.ElementNames(i)
+ a = a + 1
+ Next i
+ End If
+ GetDatabaseNames() = sDatabaseList()
+End Function
+
+
+Sub GetSelectedDBMetaData(sDBName as String)
+Dim OldsDBname as String
+Dim DBIndex as Integer
+Dim LocList() as String
+&apos; If bStartUp Then
+&apos; bStartUp = false
+&apos; Exit Sub
+&apos; End Sub
+ ToggleDatabasePage(False)
+ With DialogModel
+ If GetConnection(sDBName) Then
+ If GetDBMetaData() Then
+ LocList() = AddListToList(Array(sSelectDBTable), TableNames())
+ .lstTables.StringItemList() = AddListToList(LocList(), QueryNames())
+&apos; bSelectContent = True
+ .lstTables.SelectedItems() = Array(0)
+ iCommandTypes() = CreateCommandTypeList()
+ EmptyFieldsListboxes()
+ End If
+ End If
+ bEnableBinaryOptionGroup = False
+ .lstTables.Enabled = True
+ .lblTables.Enabled = True
+&apos; Else
+&apos; DialogModel.lstTables.StringItemList = Array(sSelectDBTable)
+&apos; EmptyFieldsListboxes()
+&apos; End If
+ ToggleDatabasePage(True)
+ End With
+End Sub
+
+
+Function GetConnection(sDBName as String)
+Dim oInteractionHandler as Object
+Dim bExitLoop as Boolean
+Dim bGetConnection as Boolean
+Dim iMsg as Integer
+Dim Nulllist()
+ If Not IsNull(oDBConnection) Then
+ oDBConnection.Dispose()
+ End If
+ oDataSource = oDBContext.GetByName(sDBName)
+&apos; If Not oDBContext.hasbyName(sDBName) Then
+&apos; GetConnection() = False
+&apos; Exit Function
+&apos; End If
+ If Not oDataSource.IsPasswordRequired Then
+ oDBConnection = oDBContext.GetByName(sDBName).GetConnection(&quot;&quot;,&quot;&quot;)
+ GetConnection() = True
+ Else
+ oInteractionHandler = createUnoService(&quot;com.sun.star.task.InteractionHandler&quot;)
+ oDataSource = oDBContext.GetByName(sDBName)
+ On Local Error Goto NOCONNECTION
+ Do
+ bExitLoop = True
+ oDBConnection = oDataSource.ConnectWithCompletion(oInteractionHandler)
+ NOCONNECTION:
+ bGetConnection = Err = 0
+ If bGetConnection Then
+ bGetConnection = Not IsNull(oDBConnection)
+ If Not bGetConnection Then
+ Exit Do
+ End If
+ End If
+ If Not bGetConnection Then
+ iMsg = Msgbox (sMsgNoConnection,32 + 2, sMsgWizardName)
+ bExitLoop = iMsg = SBCANCEL
+ Resume CLERROR
+ CLERROR:
+ End If
+ Loop Until bExitLoop
+ On Local Error Goto 0
+ If Not bGetConnection Then
+ DialogModel.lstTables.StringItemList() = Array(sSelectDBTable)
+ DialogModel.lstFields.StringItemList() = NullList()
+ DialogModel.lstSelFields.StringItemList() = NullList()
+ End If
+ GetConnection() = bGetConnection
+ End If
+End Function
+
+
+Function GetDBMetaData()
+ If oDBContext.HasElements Then
+ Tablenames() = oDBConnection.Tables.ElementNames()
+ Querynames() = oDBConnection.Queries.ElementNames()
+ GetDBMetaData = True
+ Else
+ MsgBox(sMsgErrNoDatabase, 64, sMsgWizardName)
+ GetDBMetaData = False
+ End If
+End Function
+
+
+Sub GetTableMetaData()
+Dim iType as Long
+Dim m as Integer
+Dim Found as Boolean
+Dim i as Integer
+Dim sFieldName as String
+Dim n as Integer
+Dim WidthIndex as Integer
+Dim oField as Object
+ MaxIndex = Ubound(DialogModel.lstSelFields.StringItemList())
+ Dim ColumnMap(MaxIndex)as Integer
+ FieldNames() = DialogModel.lstSelFields.StringItemList()
+ &apos; Build a structure which maps the position of a selected field (within the selection) to the the column position within
+ &apos; the table. So we ensure that the controls are placed in the same order the according fields are selected.
+ For i = 0 To Ubound(FieldNames())
+ sFieldName = FieldNames(i)
+ Found = False
+ n = 0
+ While (n&lt; MaxIndex And (Not Found))
+ If (FieldNames(n) = sFieldName) Then
+ Found = True
+ ColumnMap(n) = i
+ End If
+ n = n + 1
+ Wend
+ Next i
+ For n = 0 to MaxIndex
+ sFieldname = FieldNames(n)
+ oField = oColumns.GetByName(sFieldName)
+ iType = oField.Type
+ FieldMetaValues(n,0) = oField.Type
+ FieldMetaValues(n,1) = AssignFieldLength(oField.Precision)
+ FieldMetaValues(n,2) = GetValueoutofList(iType, WidthList(),1, WidthIndex)
+ FieldMetaValues(n,3) = WidthList(WidthIndex,3)
+ FieldMetaValues(n,4) = oField.FormatKey
+ FieldMetaValues(n,5) = oField.DefaultValue
+ FieldMetaValues(n,6) = oField.IsCurrency
+ FieldMetaValues(n,7) = oField.Scale
+&apos; If oField.Description &lt;&gt; &quot;&quot; Then
+&apos;&apos; Todo: What&apos;s wrong with this line?
+&apos; Msgbox oField.Helptext
+&apos; End If
+ FieldMetaValues(n,8) = oField.Description
+ Next
+ ReDim oDBShapeList(MaxIndex) as Object
+ ReDim oTCShapeList(MaxIndex) as Object
+ ReDim oDBModelList(MaxIndex) as Object
+ ReDim oGroupShapeList(MaxIndex) as Object
+End Sub
+
+
+Function GetSpecificFieldNames() as Integer
+Dim n as Integer
+Dim m as Integer
+Dim s as Integer
+Dim iType as Integer
+Dim oField as Object
+Dim MaxIndex as Integer
+Dim EmptyList()
+ If Ubound(DialogModel.lstTables.StringItemList()) &gt; -1 Then
+ FieldNames() = oColumns.GetElementNames()
+ MaxIndex = Ubound(FieldNames())
+ If MaxIndex &lt;&gt; -1 Then
+ Dim ResultFieldNames(MaxIndex)
+ ReDim ImgFieldNames(MaxIndex)
+ m = 0
+ For n = 0 To MaxIndex
+ oField = oColumns.GetByName(FieldNames(n))
+ iType = oField.Type
+ If GetIndexInMultiArray(WidthList(), iType, 0) &lt;&gt; -1 Then
+ ResultFieldNames(m) = FieldNames(n)
+ m = m + 1
+ End If
+ If GetIndexInMultiArray(ImgWidthList(), iType, 0) &lt;&gt; -1 Then
+ ImgFieldNames(s) = FieldNames(n)
+ s = s + 1
+ End If
+ Next n
+ If s &lt;&gt; 0 Then
+ Redim Preserve ImgFieldNames(s-1)
+ bEnableBinaryOptionGroup = True
+ Else
+ bEnableBinaryOptionGroup = False
+ End If
+ If (DialogModel.optBinariesasGraphics.State = 1) And (s &lt;&gt; 0) Then
+ ResultFieldNames() = AddListToList(ResultFieldNames(), ImgFieldNames())
+ Else
+ Redim Preserve ResultFieldNames(m-1)
+ End If
+ FieldNames() = ResultFieldNames()
+ DialogModel.lstFields.StringItemList = FieldNames()
+ InitializeListboxProcedures(DialogModel, DialogModel.lstFields, DialogModel.lstSelFields)
+ End If
+ GetSpecificFieldNames = MaxIndex
+ Else
+ GetSpecificFieldNames = -1
+ End If
+End Function
+
+
+Sub CreateDBForm()
+ If oDrawPage.Forms.Count = 0 Then
+ oDBForm = oDocument.CreateInstance(&quot;com.sun.star.form.component.Form&quot;)
+ oDrawpage.Forms.InsertByIndex (0, oDBForm)
+ Else
+ oDBForm = oDrawPage.Forms.GetByIndex(0)
+ End If
+ oDBForm.Name = &quot;Standard&quot;
+ oDBForm.DataSourceName = sDBName
+ oDBForm.Command = TableName
+ oDBForm.CommandType = CurCommandType
+End Sub
+
+
+Sub AddOrRemoveBinaryFieldsToWidthList()
+Dim LocWidthList()
+Dim MaxIndex as Integer
+Dim OldMaxIndex as Integer
+Dim s as Integer
+Dim n as Integer
+Dim m as Integer
+ If Not bDebug Then
+ On Local Error GoTo WIZARDERROR
+ End If
+ If DialogModel.optBinariesasGraphics.State = 1 Then
+ OldMaxIndex = Ubound(WidthList(),1)
+ If OldMaxIndex = 15 Then
+ MaxIndex = Ubound(WidthList(),1) + Ubound(ImgWidthList(),1) + 1
+ ReDim Preserve WidthList(MaxIndex,4)
+ s = 0
+ For n = OldMaxIndex + 1 To MaxIndex
+ For m = 0 To 3
+ WidthList(n,m) = ImgWidthList(s,m)
+ Next m
+ s = s + 1
+ Next n
+ MergeList(DialogModel.lstFields, ImgFieldNames())
+ End If
+ Else
+ ReDim Preserve WidthList(15, 4)
+ RemoveListItems(DialogModel.lstFields(), DialogModel.lstSelFields(), ImgFieldNames())
+ End If
+ DialogModel.lstSelFields.Tag = True
+WIZARDERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(sMsgErrMsg, 16, GetProductName())
+ Resume LOCERROR
+ LOCERROR:
+ End If
+End Sub
+
+
+Function CreateCommandTypeList()
+Dim MaxTableIndex as Integer
+Dim MaxQueryIndex as Integer
+Dim MaxIndex as Integer
+Dim i as Integer
+Dim a as Integer
+ MaxTableIndex = Ubound(TableNames()
+ MaxQueryIndex = Ubound(QueryNames()
+ MaxIndex = MaxTableIndex + MaxQueryIndex + 1
+ If MaxIndex &gt; -1 Then
+ Dim LocCommandTypes(MaxIndex) as Integer
+ For i = 0 To MaxTableIndex
+ LocCommandTypes(i) = com.sun.star.sdb.CommandType.TABLE
+ Next i
+ a = i
+ For i = 0 To MaxQueryIndex
+ LocCommandTypes(a) = com.sun.star.sdb.CommandType.QUERY
+ a = a + 1
+ Next i
+ End If
+ CreateCommandTypeList() = LocCommandTypes()
+End Function
+
+
+Sub GetCurrentMetaValues(Index as Integer)
+ CurFieldType = FieldMetaValues(Index,0)
+ CurFieldLength = FieldMetaValues(Index,1)
+ CurControlType = FieldMetaValues(Index,2)
+ CurControlName = FieldMetaValues(Index,3)
+ CurFormatKey = FieldMetaValues(Index,4)
+ CurDefaultValue = FieldMetaValues(Index,5)
+ CurIsCurrency = FieldMetaValues(Index,6)
+ CurScale = FieldMetaValues(Index,7)
+ CurHelpText = FieldMetaValues(Index,8)
+ CurFieldName = FieldNames(Index)
+End Sub
+
+
+Function AssignFieldLength(FieldLength as Long) as Integer
+ If FieldLength &gt;= 65535 Then
+ AssignFieldLength() = -1
+ Else
+ AssignFieldLength() = FieldLength
+ End If
+End Function
+</script:module> \ No newline at end of file
diff --git a/wizards/source/formwizard/DlgFormDB.xdl b/wizards/source/formwizard/DlgFormDB.xdl
new file mode 100644
index 000000000000..ade138e06b9a
--- /dev/null
+++ b/wizards/source/formwizard/DlgFormDB.xdl
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="DlgFormDB" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:page="1" dlg:help-url="HID:34400" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="lblSelFields" dlg:tab-index="10" dlg:left="154" dlg:top="70" dlg:width="110" dlg:height="8" dlg:page="1" dlg:value="lblSelFields"/>
+ <dlg:menulist dlg:id="lstTables" dlg:tab-index="3" dlg:left="6" dlg:top="51" dlg:width="110" dlg:height="12" dlg:page="1" dlg:help-url="HID:34411" dlg:spin="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:FormWizard.FormWizard.FormGetFields?language=Basic&amp;location=application" script:language="Script"/>
+ <script:event script:event-name="on-mousedown" script:macro-name="vnd.sun.star.script:FormWizard.FormWizard.DeleteFirstTableListBoxEntry?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:img dlg:id="imgTheme" dlg:tab-index="1" dlg:left="6" dlg:top="6" dlg:width="258" dlg:height="26" dlg:scale-image="false"/>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="33" dlg:left="6" dlg:top="190" dlg:width="53" dlg:height="14" dlg:help-url="HID:34401" dlg:value="cmdCancel" dlg:button-type="cancel"/>
+ <dlg:button dlg:id="cmdHelp" dlg:tab-index="34" dlg:left="63" dlg:top="190" dlg:width="53" dlg:height="14" dlg:tag="34400" dlg:value="cmdHelp" dlg:button-type="help"/>
+ <dlg:button dlg:id="cmdBack" dlg:tab-index="35" dlg:left="155" dlg:top="190" dlg:width="53" dlg:height="14" dlg:help-url="HID:34402" dlg:value="cmdBack">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.FormWizard.PreviousStep?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdGoOn" dlg:tab-index="36" dlg:left="211" dlg:top="190" dlg:width="53" dlg:height="14" dlg:help-url="HID:34403" dlg:value="cmdGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.FormWizard.NextStep?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:text dlg:id="lblTables" dlg:tab-index="2" dlg:left="6" dlg:top="40" dlg:width="72" dlg:height="8" dlg:page="1" dlg:value="lblTables"/>
+ <dlg:text dlg:id="lblFields" dlg:tab-index="4" dlg:left="6" dlg:top="70" dlg:width="109" dlg:height="8" dlg:page="1" dlg:value="lblFields"/>
+ <dlg:button dlg:id="cmdMoveSelected" dlg:tab-index="6" dlg:left="122" dlg:top="84" dlg:width="25" dlg:height="14" dlg:page="1" dlg:help-url="HID:34422" dlg:value="-&gt;">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tools.Listbox.FormMoveSelected?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdMoveAll" dlg:tab-index="7" dlg:left="122" dlg:top="101" dlg:width="25" dlg:height="14" dlg:page="1" dlg:help-url="HID:34423" dlg:value="=&gt;&gt;">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tools.Listbox.FormMoveAll?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdRemoveSelected" dlg:tab-index="8" dlg:left="122" dlg:top="118" dlg:width="25" dlg:height="14" dlg:page="1" dlg:help-url="HID:34424" dlg:value="&lt;-">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tools.Listbox.FormRemoveSelected?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdRemoveAll" dlg:tab-index="9" dlg:left="122" dlg:top="135" dlg:width="25" dlg:height="14" dlg:page="1" dlg:help-url="HID:34425" dlg:value="&lt;&lt;=">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tools.Listbox.FormRemoveAll?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optIgnoreBinaries" dlg:tab-index="14" dlg:left="122" dlg:top="169" dlg:width="104" dlg:height="10" dlg:page="1" dlg:help-url="HID:34427" dlg:value="optIgnoreBinaries" dlg:checked="true">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.DBMeta.AddOrRemoveBinaryFieldsToWidthList?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optBinariesasGraphics" dlg:tab-index="13" dlg:left="12" dlg:top="169" dlg:width="104" dlg:height="10" dlg:page="1" dlg:help-url="HID:34426" dlg:value="optBinariesasGraphics">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.DBMeta.AddOrRemoveBinaryFieldsToWidthList?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:menulist dlg:id="lstFields" dlg:tab-index="5" dlg:left="6" dlg:top="81" dlg:width="110" dlg:height="70" dlg:page="1" dlg:help-url="HID:34420" dlg:multiselection="true">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tools.Listbox.FormMoveSelected?language=Basic&amp;location=application" script:language="Script"/>
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Tools.Listbox.FormSetMoveRights?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:menulist dlg:id="lstSelFields" dlg:tab-index="11" dlg:left="154" dlg:top="81" dlg:width="110" dlg:height="70" dlg:page="1" dlg:help-url="HID:34421" dlg:multiselection="true">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tools.Listbox.FormRemoveSelected?language=Basic&amp;location=application" script:language="Script"/>
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Tools.Listbox.FormSetMoveRights?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:text dlg:id="lblStyles" dlg:tab-index="25" dlg:left="150" dlg:top="39" dlg:width="114" dlg:height="8" dlg:page="2" dlg:value="lblStyles"/>
+ <dlg:button dlg:id="cmdArrange1" dlg:tab-index="16" dlg:left="12" dlg:top="50" dlg:width="23" dlg:height="25" dlg:page="2" dlg:tag="1" dlg:help-url="HID:34431">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeArrangemode?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdArrange2" dlg:tab-index="17" dlg:left="39" dlg:top="50" dlg:width="23" dlg:height="25" dlg:page="2" dlg:tag="2" dlg:help-url="HID:34432">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeArrangemode?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdArrange3" dlg:tab-index="18" dlg:left="66" dlg:top="50" dlg:width="23" dlg:height="25" dlg:page="2" dlg:tag="3" dlg:help-url="HID:34433">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeArrangemode?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdArrange4" dlg:tab-index="19" dlg:left="93" dlg:top="50" dlg:width="23" dlg:height="25" dlg:page="2" dlg:tag="4" dlg:help-url="HID:34434">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeArrangemode?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdArrange5" dlg:tab-index="20" dlg:left="120" dlg:top="50" dlg:width="23" dlg:height="25" dlg:page="2" dlg:tag="5" dlg:help-url="HID:34435">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeArrangemode?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:menulist dlg:id="lstStyles" dlg:tab-index="26" dlg:left="150" dlg:top="50" dlg:width="114" dlg:height="86" dlg:page="2" dlg:help-url="HID:34443">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:FormWizard.tools.ImportStyles?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optBorder0" dlg:tab-index="22" dlg:left="12" dlg:top="95" dlg:width="131" dlg:height="10" dlg:page="2" dlg:help-url="HID:34438" dlg:value="optBorder0">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeBorderLayouts?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optBorder1" dlg:tab-index="23" dlg:left="12" dlg:top="109" dlg:width="131" dlg:height="10" dlg:page="2" dlg:help-url="HID:34439" dlg:value="optBorder1">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeBorderLayouts?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optBorder2" dlg:tab-index="24" dlg:left="12" dlg:top="123" dlg:width="131" dlg:height="10" dlg:page="2" dlg:help-url="HID:34440" dlg:value="optBorder2">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeBorderLayouts?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:fixedline dlg:id="hlnBinaries" dlg:tab-index="12" dlg:left="6" dlg:top="158" dlg:width="258" dlg:height="8" dlg:page="1" dlg:value="hlnBinaries"/>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optTiled" dlg:tab-index="31" dlg:left="156" dlg:top="154" dlg:width="81" dlg:height="10" dlg:page="2" dlg:tag="11" dlg:help-url="HID:34444" dlg:value="optTiled" dlg:checked="true">
+ <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.script:WebWizard.Common.SetBackGraphicStyle?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optArea" dlg:tab-index="32" dlg:left="156" dlg:top="168" dlg:width="81" dlg:height="10" dlg:page="2" dlg:tag="10" dlg:help-url="HID:34445" dlg:value="optArea">
+ <script:event script:event-name="on-mouseup" script:macro-name="vnd.sun.star.script:WebWizard.Common.SetBackGraphicStyle?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:fixedline dlg:id="hlnBackground" dlg:tab-index="30" dlg:left="150" dlg:top="143" dlg:width="114" dlg:height="8" dlg:page="2" dlg:value="hlnBackground"/>
+ <dlg:fixedline dlg:id="hlnAlign" dlg:tab-index="27" dlg:left="6" dlg:top="143" dlg:width="137" dlg:height="8" dlg:page="2" dlg:value="hlnAlign"/>
+ <dlg:fixedline dlg:id="hlnBorderLayout" dlg:tab-index="21" dlg:left="6" dlg:top="83" dlg:width="137" dlg:height="8" dlg:page="2" dlg:value="hlnBorderLayout"/>
+ <dlg:fixedline dlg:id="hlnArrangements" dlg:tab-index="15" dlg:left="6" dlg:top="39" dlg:width="137" dlg:height="8" dlg:page="2" dlg:value="hlnArrangements"/>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optAlign0" dlg:tab-index="28" dlg:left="12" dlg:top="154" dlg:width="131" dlg:height="10" dlg:page="2" dlg:help-url="HID:34441" dlg:value="optAlign0">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeLabelAlignments?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optAlign2" dlg:tab-index="29" dlg:left="12" dlg:top="168" dlg:width="131" dlg:height="10" dlg:page="2" dlg:help-url="HID:34442" dlg:value="optAlign2">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:FormWizard.Layouter.ChangeLabelAlignments?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="0" dlg:left="6" dlg:top="180" dlg:width="258" dlg:height="6"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/formwizard/FormWizard.xba b/wizards/source/formwizard/FormWizard.xba
new file mode 100644
index 000000000000..99103d9335bc
--- /dev/null
+++ b/wizards/source/formwizard/FormWizard.xba
@@ -0,0 +1,427 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="FormWizard" script:language="StarBasic">Option Explicit
+
+Public DocumentName as String
+Public FormPath as String
+Public WizardPath as String
+Public WebWizardPath as String
+Public WorkPath as String
+Public TempPath as String
+Public TexturePath as String
+Public sQueryName as String
+Public oDBConnection as Object
+Public bWithBackGraphic as Boolean
+Public bNeedFieldRefresh as Boolean
+Public oDBForm as Object
+Public oColumns() as Object
+Public sDatabaseList() as String
+Public TableNames() as String
+Public QueryNames() as String
+Public FieldNames() as String
+Public ImgFieldNames() as String
+Public oDBContext as Object
+Public oUcb as Object
+Public oDocInfo as Object
+Public WidthList(15,3)
+Public ImgWidthList(3,3)
+Public sDBName as String
+Public Tablename as String
+Public Const SBSIZETEXT = &quot;The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.&quot;
+Public bDisposeDoc as Boolean
+Public bDebug as Boolean
+&apos;Public bStartUp as Boolean
+Public bConnectionIsovergiven as Boolean
+Public FormName As String
+Public sFormUrl as String
+Public oFormDocuments
+
+
+&apos; The macro can be called in 4 possible scenarios:
+&apos; Scenario 1. No parameters at given
+&apos; Scenario 2: Only Datasourcename is given, but no connection and no Content
+&apos; Scenario 3: a data source and a connection are given
+&apos; Scenario 4: all parameters (data source name, connection, object type and object) are given
+
+Sub Main()
+Dim oLocDBContext as Object
+Dim oLocConnection as Object
+
+&apos; Scenario 1. No parameters at given
+ MainWithDefault()
+
+&apos; Scenario 2: Only Datasourcename is given, but no connection and no Content
+&apos; MainWithDefault(&quot;Bibliography&quot;)
+
+&apos; Scenario 3: a data source and a connection are given
+&apos; oLocDBContext = CreateUnoService(&quot;com.sun.star.sdb.DatabaseContext&quot;)
+&apos; oLocConnection = oLocDBContext.GetByName(&quot;Bibliography&quot;).GetConnection(&quot;&quot;,&quot;&quot;)
+&apos; MainWithDefault(&quot;Bibliography&quot;, oLocConnection)
+
+&apos; Scenario 4: all parameters (data source name, connection, object type and object) are given
+&apos; oLocDBContext = CreateUnoService(&quot;com.sun.star.sdb.DatabaseContext&quot;)
+&apos; oLocConnection = oLocDBContext.GetByName(&quot;Bibliography&quot;).GetConnection(&quot;&quot;,&quot;&quot;)
+&apos; MainWithDefault(&quot;Bibliography&quot;, oLocConnection, com.sun.star.sdb.CommandType.TABLE, &quot;biblio&quot;)
+End Sub
+
+
+Sub MainWithDefault(Optional DatasourceName as String, Optional oConnection as Object, Optional CommandType as Integer, Optional sContent as String)
+Dim i as Integer
+Dim SelCount as Integer
+Dim RetValue as Integer
+Dim SelList(0) as Integer
+Dim LocList() as String
+ SelList(0) = 0
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ BasicLibraries.LoadLibrary(&quot;WebWizard&quot;)
+ bDebug = False
+ If Not bDebug Then
+ On Local Error GoTo WIZARDERROR
+ End If
+ OpenFormDocument()
+ CurArrangement = 0
+ bControlsareCreated = False
+ bEnableBinaryOptionGroup = False
+ bDisposeDoc = True
+ MaxIndex = -1
+ If Not InitResources(&quot;Formwizard&quot;,&quot;dbw&quot;) Then
+ Exit Sub
+ End If
+ oDBContext = CreateUnoService(&quot;com.sun.star.sdb.DatabaseContext&quot;)
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ If GetFormWizardPaths() = False Then
+ Exit Sub
+ End If
+ oDocument.GetCurrentController().Frame.ComponentWindow.Enable = False
+ oProgressBar.Value = 10
+ LoadLanguage()
+ oProgressBar.Value = 20
+ InitializeWidthList()
+ oProgressBar.Value = 30
+ Styles() = getListBoxArrays(oUcb, &quot;/stl&quot;)
+ CurIndex = GetCurIndex(DialogModel, Styles(), 2)
+ oProgressBar.Value = 40
+ ConfigurePageStyle()
+ oProgressBar.Value = 50
+ InitializeLabelValues()
+ bNeedFieldRefresh = True
+ SetDialogLanguage()
+&apos; bStartUp = true
+ With DialogModel
+ .cmdBack.Enabled = False
+ .cmdGoOn.Enabled = False
+ .lblTables.Enabled = False
+ .lstSelFields.Tag = False
+ .Step = 1
+ End With
+ oProgressBar.Value = 60
+ bConnectionIsovergiven = Not IsMissing(oConnection)
+ If Not IsMissing(DataSourceName) Then
+ sDBName = DataSourceName
+ If Not IsMissing(oConnection) Then
+ &apos; Scenario 3: a data source and a connection are given
+ Set oDBConnection = oConnection
+ oDataSource = oDBContext.GetByName(DataSourceName)
+ DialogModel.lstTables.Enabled = True
+ DialogModel.lblTables.Enabled = True
+ If GetDBMetaData() Then
+ LocList() = AddListToList(TableNames(), QueryNames())
+ iCommandTypes = CreateCommandTypeList()
+ If Not IsMissing(sContent) Then
+ &apos; Scenario 4: all parameters (data source name, connection, object type and object) are given
+ DialogModel.lstTables.StringItemList() = LocList()
+ iCommandTypes() = CreateCommandTypeList()
+ SelCount = CountItemsInArray(DialogModel.lstTables.StringItemList(), sContent)
+ If SelCount = 1 Then
+ DlgFormDB.GetControl(&quot;lstTables&quot;).SelectItem(sContent, True)
+ Else
+ If CommandType = com.sun.star.sdb.CommandType.QUERY Then
+ SelIndex = IndexInArray(sContent, QueryNames()
+ DlgFormDB.GetControl(&quot;lstTables&quot;).SelectItemPos(SelIndex, True)
+ ElseIf CommandType = com.sun.star.sdb.CommandType.TABLE Then
+ SelIndex = IndexInArray(sContent, TableNames()
+ DlgFormDB.GetControl(&quot;lstTables&quot;).SelectItemPos(Ubound(QueryNames()+1 + SelIndex, True)
+ End If
+ End If
+ CurCommandType = CommandType
+ FillUpFieldsListbox(False)
+ Else
+ LocList() = AddListToList(Array(sSelectDBTable), LocList())
+ DialogModel.lstTables.StringItemList() = LocList()
+&apos; bSelectContent = True
+ DialogModel.lstTables.SelectedItems() = Array(0)
+
+ End If
+ End If
+ Else
+ &apos; Scenario 2: Only Datasourcename is given, but no connection and no Content
+ GetSelectedDBMetaData(sDBName)
+ End If
+ Else
+ &apos; Scenario 1: No parameters are given
+ ToggleListboxControls(DialogModel, False)
+ End If
+ oProgressBar.Value = 80
+ bWithBackGraphic = LoadNewStyles(oDocument, DialogModel, CurIndex, Styles(CurIndex, 8), Styles(), TexturePath)
+ DlgFormDB.Title = WizardTitle(1)
+ DialogModel.lstStyles.StringItemList() = ArrayfromMultiArray(Styles, 1)
+ DialogModel.lstStyles.SelectedItems() = SelList()
+ ControlCaptionsToStandardLayout()
+ oDocument.GetCurrentController().Frame.ComponentWindow.Enable = True
+ oProgressBar.Value = 90
+ DialogModel.imgTheme.ImageURL = FormPath &amp; &quot;FormWizard_1.bmp&quot;
+ DialogModel.imgTheme.BackGroundColor = RGB(0,60,126)
+ ToggleDatabasePage(True)
+ oProgressBar.Value = 100
+ DlgFormDB.GetControl(&quot;lstTables&quot;).SetFocus()
+ oProgressbar.End
+ RetValue = DlgFormDB.Execute()
+ DlgFormDB.Dispose()
+ If bDisposeDoc Then
+ Dim aPropertyValues(2) as new com.sun.star.beans.PropertyValue
+ oFormDocuments = oDataSource.getFormDocuments()
+ DlgFormDB.Dispose()
+ oDocument.dispose()
+ Dim bLinkExists as Boolean
+ i = 1
+ Dim FormBaseName as String
+ FormBaseName = FormName
+ Do
+ bLinkExists = oFormDocuments.HasbyHierarchicalName(FormName)
+ If bLinkExists Then
+ i = i + 1
+ FormName = FormBaseName &amp; &quot;_&quot; &amp; i
+ End If
+ Loop Until Not bLinkExists
+ aPropertyValues(0).Name = &quot;Name&quot;
+ aPropertyValues(0).Value = FormName
+ aPropertyValues(1).Name = &quot;Parent&quot;
+ aPropertyValues(1).Value = oFormDocuments()
+ aPropertyValues(2).Name = &quot;URL&quot;
+ aPropertyValues(2).Value = sFormUrl
+ Dim oDBDocument
+ oDBDocument = oFormDocuments.createInstanceWithArguments(&quot;com.sun.star.sdb.DocumentDefinition&quot;, aPropertyValues())
+ oFormDocuments.insertbyName(FormName, oDBDocument)
+ ElseIf RetValue = 0 Then
+ RemoveNirwanaShapes()
+ End If
+ If ((Not IsNull(oDBConnection)) And (Not bConnectionIsovergiven)) Then
+ oDBConnection.Dispose()
+ End If
+WIZARDERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(sMsgErrMsg, 16, GetProductName())
+ Resume LOCERROR
+ LOCERROR:
+ End If
+End Sub
+
+
+Sub FormGetFields()
+Dim i as Integer
+&apos; If bSelectContent Then
+&apos; bSelectContent = False
+&apos; Exit Sub
+&apos; End If
+ DeleteFirstListBoxEntry(&quot;lstTables&quot;, sSelectDBTable)
+ ToggleDatabasePage(False)
+ FillUpFieldsListbox(True)
+ ToggleDatabasePage(True)
+End Sub
+
+
+Sub FillUpFieldsListbox(bGetCommandType as Boolean)
+Dim SelIndex as Integer
+Dim QueryIndex as Integer
+ If Not bDebug Then
+ On Local Error GoTo NOFIELDS
+ End If
+ SelIndex = DlgFormDB.GetControl(&quot;lstTables&quot;).getSelectedItemPos() &apos;.SelectedItems())
+ If SelIndex &gt; -1 Then
+ If bGetCommandType Then
+ CurCommandType = iCommandTypes(SelIndex)
+ End If
+ If CurCommandType = com.sun.star.sdb.CommandType.QUERY Then
+ QueryIndex = SelIndex - Ubound(Tablenames()) - 1
+ Tablename = QueryNames(QueryIndex)
+ oColumns = oDBConnection.Queries.GetByName(TableName).Columns
+ Else
+ Tablename = Tablenames(SelIndex)
+ oColumns = oDBConnection.Tables.GetByName(Tablename).Columns
+ End If
+ If GetSpecificFieldNames() &lt;&gt; -1 Then
+ ToggleListboxControls(DialogModel, True)
+ Exit Sub
+ End If
+ End If
+ EmptyFieldsListboxes()
+NOFIELDS:
+ If Err &lt;&gt; 0 Then
+ MsgBox sMsgErrCouldNotOpenObject, 16, sMsgWizardName
+ End If
+End Sub
+
+
+Sub PreviousStep()
+ If Not bDebug Then
+ On Local Error GoTo WIZARDERROR
+ End If
+ With DialogModel
+ .Step = 1
+ .cmdBack.Enabled = False
+ .cmdGoOn.Enabled = True
+ .lstSelFields.Tag = Not bControlsareCreated
+ .cmdGoOn.Label = sGoOn
+ .imgTheme.ImageUrl = FormPath &amp; &quot;FormWizard_1.bmp&quot;
+ End With
+ FormSetMoveRights()
+WIZARDERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(sMsgErrMsg, 16, GetProductName())
+ Resume LOCERROR
+ LOCERROR:
+ End If
+End Sub
+
+
+Sub NextStep()
+ If Not bDebug Then
+ On Local Error GoTo WIZARDERROR
+ End If
+ Select Case DialogModel.Step
+ Case 1
+ bControlsAreCreated = Not (cBool(DialogModel.lstSelFields.Tag))
+ If Not bControlsAreCreated Then
+ GetTableMetaData()
+ CreateDBForm()
+ RemoveShapes()
+ InitializeLayoutSettings()
+ oDBForm.Load
+ End If
+ DialogModel.cmdGoOn.Label = sReady
+ DialogModel.cmdBack.Enabled = True
+ DialogModel.Step = 2
+ bDisposeDoc = False
+ Case 2
+ StoreForm()
+ DlgFormDB.EndExecute()
+ exit Sub
+ End Select
+ DialogModel.imgTheme.ImageUrl = FormPath &amp; &quot;FormWizard_&quot; &amp; DialogModel.Step &amp; &quot;.bmp&quot;
+ DlgFormDB.Title = WizardTitle(DialogModel.Step)
+WIZARDERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(sMsgErrMsg, 16, GetProductName())
+ Resume LOCERROR
+ LOCERROR:
+ End If
+End Sub
+
+
+Sub InitializeLayoutSettings()
+ SwitchArrangementButtons(cTabled)
+ SwitchAlignMode(SBALIGNLEFT)
+ SwitchBorderMode(SB3DBORDER)
+ ToggleBorderGroup(bControlsAreCreated)
+ ToggleAlignGroup(bControlsAreCreated)
+ ArrangeControls()
+ If OldAlignMode &lt;&gt; 0 Then
+ DlgFormDB.GetControl(&quot;optAlign2&quot;).Model.State = 0
+ End If
+End Sub
+
+
+Sub ToggleDatabasePage(bDoEnable as Boolean)
+ With DialogModel
+ .cmdBack.Enabled = False
+ .cmdHelp.Enabled = bDoEnable
+ .cmdGoOn.Enabled = Ubound(DialogModel.lstSelFields.StringItemList()) &lt;&gt; -1
+ .hlnBinaries.Enabled = ((bDoEnable = True) And (bEnableBinaryOptionGroup = True))
+ .optIgnoreBinaries.Enabled = ((bDoEnable = True) And (bEnableBinaryOptionGroup = True))
+ .optBinariesasGraphics.Enabled = ((bDoEnable = True) And (bEnableBinaryOptionGroup = True))
+ End With
+End Sub
+
+
+&apos; This Sub is called from the Procedure &quot;StoreDocument&quot; in the &quot;Tools&quot; Library
+Sub CommitLastDocumentChanges(sTargetPath as String)
+Dim i as Integer
+Dim sBookmarkName as String
+Dim oDBBookmarks as Object
+Dim bLinkExists as Boolean
+Dim sBaseBookmarkName as String
+ sBookmarkName = GetFileNamewithoutExtension(FileNameoutofPath(sTargetPath))
+ sBaseBookmarkName = sBookmarkName
+ oDBBookmarks = oDataSource.GetBookmarks()
+ i = 1
+ Do
+ bLinkExists = oDBBookmarks.HasbyName(sBookmarkName)
+ If bLinkExists Then
+ i = i + 1
+ sBookmarkName = sBaseBookmarkName &amp; &quot;_&quot; &amp; i
+ Else
+ oDBBookmarks.insertByName(sBookmarkName, sTargetPath)
+ End If
+ Loop Until Not bLinkExists
+ bDisposeDoc = False
+ GroupShapesTogether()
+ ToggleDesignMode(oDocument)
+ oDBForm.Reload()
+End Sub
+
+
+Sub StoreFormInDatabase()
+ Dim NoArgs() as new com.sun.star.beans.PropertyValue
+ FormName = &quot;Form_&quot; &amp; sDBName &amp; &quot;_&quot; &amp; TableName &amp; &quot;.sxw&quot;
+ sFormUrl = TempPath &amp; &quot;/&quot; &amp; FormName
+ oDocument.StoreAsUrl(sFormUrl, NoArgs())
+ bdisposeDoc = true
+ DlgFormDB.Endexecute()
+End Sub
+
+
+
+Sub StoreForm()
+Dim sTargetPath as String
+Dim TypeNames(0,2) as String
+Dim oMasterKey as Object
+Dim oTypes() as Object
+ oMasterKey = GetRegistryKeyContent(&quot;org.openoffice.TypeDetection.Types/&quot;)
+ oTypes() = oMasterKey.Types
+ TypeNames(0,0) = GetFilterName(&quot;StarOffice XML (Writer)&quot;)
+ TypeNames(0,1) = &quot;*.sxw&quot;
+ TypeNames(0,2) = &quot;&quot;
+ StoreFormInDatabase()
+&apos; sTargetPath = StoreDocument(oDocument, TypeNames(), &quot;Form_&quot; &amp; sDBName &amp; &quot;_&quot; &amp; TableName &amp; &quot;.sxw&quot;, WorkPath, 1)
+End Sub
+
+
+
+Sub EmptyFieldsListboxes()
+Dim NullList() as String
+ ToggleListboxControls(DialogModel, False)
+ DialogModel.lstFields.StringItemList() = NullList()
+ DialogModel.lstSelFields.StringItemList() = NullList()
+ bEnableBinaryOptionGroup = False
+End Sub
+
+
+Sub DeleteFirstTableListBoxEntry()
+ DeleteFirstListBoxEntry(&quot;lstTables&quot;, sSelectDBTable)
+End Sub
+
+Sub DeleteFirstListboxEntry(ListBoxName as String, DelEntryName as String)
+Dim oListbox as Object
+Dim sFirstItem as String
+dim iSelPos as Integer
+ oListBox = DlgFormDB.getControl(ListBoxName)
+ sFirstItem = oListBox.getItem(0)
+ If sFirstItem = DelEntryName Then
+ iSelPos = oListBox.getSelectedItemPos()
+ oListBox.removeItems(0, 1)
+ If iSelPos &gt; 0 Then
+ oListBox.selectItemPos(iSelPos-1, True)
+ End If
+ End If
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/formwizard/Language.xba b/wizards/source/formwizard/Language.xba
new file mode 100644
index 000000000000..5a2dcb1c67fe
--- /dev/null
+++ b/wizards/source/formwizard/Language.xba
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
+
+
+Global Const RID_COMMON = 1000
+Global Const RID_FORM = 2200
+
+Public Const SBCANCEL = 2
+Public Const SBREPEAT = 4
+Public LabelDiffHeight as Long
+Public BasicLabelDiffHeight as Long
+
+Public WizardTitle(1 To 3) as String
+Public DlgFormDB as Object
+Public DialogModel as Object
+
+Dim sMsgWizardName as String
+Dim sMsgErrMsg as String
+Dim sMsgErrNoDatabase as String
+Dim sMsgErrNoTableInDatabase as String
+Dim sMsgErrTitleSuggestedExist as String
+Dim sMsgErrTitleSyntaxError as String
+Dim sMsgErrTitleAsTableExist as String
+Dim sMsgProgressText as String
+Dim sMsgCreatedForm as String
+Dim sMsgErrCouldNotOpenObject as String
+Dim sMsgErrNameToLong as String
+Dim sTimeAppendix as String
+Dim sDateAppendix as String
+Public sGoOn as String
+Public sReady as String
+Public sMsgNoConnection as String
+Public sWriterFilterName as String
+Public XPixelFactor as Long
+Public YPixelFactor as Long
+Public sSelectDatasource as String
+Public sSelectDBTable as String
+
+
+
+Sub LoadLanguage ()
+ sMsgWizardName = GetResText(RID_FORM + 0)
+ sMsgErrMsg = GetResText(RID_COMMON + 6)
+ sMsgErrNoDatabase = GetResText(RID_COMMON + 8)
+ sMsgErrNoTableInDatabase = GetResText(RID_COMMON + 9)
+ sMsgErrTitleSuggestedExist = GetResText(RID_COMMON + 10)
+ sMsgErrTitleAsTableExist = GetResText(RID_COMMON + 10)
+ sMsgErrTitleSyntaxError = GetResText(RID_COMMON + 11)
+ sMsgNoConnection = GetResText(RID_COMMON + 14
+ sMsgProgressText = GetResText(RID_FORM + 2)
+ sMsgCreatedForm = GetResText(RID_FORM + 26)
+ sMsgErrNameToLong = GetResText (RID_FORM + 27)
+ sMsgErrCouldNotOpenObject = GetResText (RID_COMMON + 13)
+
+ &apos; Internal Logic
+ sDateAppendix = GetResText(RID_FORM + 4)
+ sTimeAppendix = GetResText(RID_FORM + 5)
+
+ sReady = GetResText(RID_COMMON + 0)
+End Sub
+
+
+Sub SetDialogLanguage ()
+Dim i as Integer
+Dim ButtonHelpText as String
+Dim CmdButton as Object
+Dim IDArray as Variant
+Dim FNameAddOn as String
+Dim slblSelFields as String
+Dim slblFields as String
+
+ DlgFormDB = LoadDialog(&quot;FormWizard&quot;, &quot;DlgFormDB&quot;)
+ DialogModel = DlgFormDB.Model
+
+ With DialogModel
+ .cmdCancel.Label = GetResText(RID_COMMON + 1)
+ .cmdBack.Label = GetResText(RID_COMMON + 2)
+ .cmdHelp.Label = GetResText(RID_COMMON + 20)
+ sGoOn = GetResText(RID_COMMON + 3)
+ .cmdGoOn.Label = sGoOn
+ .lblTables.Label = GetResText(RID_FORM + 6)
+
+ slblFields = GetResText(RID_FORM + 12)
+ slblSelFields = GetResText(RID_FORM + 13)
+ .lblFields.Label = slblFields
+ .lblSelFields.Label = slblSelFields
+
+ .lblStyles.Label = GetResText(RID_FORM + 21)
+ .hlnBorderLayout.Label = GetResText(RID_FORM + 28)
+ .hlnAlign.Label = GetResText(RID_FORM + 32)
+ .hlnArrangements.Label = GetResText(RID_FORM + 35)
+
+ WizardTitle(1) = sMsgWizardName &amp; &quot; - &quot; &amp; GetResText(RID_FORM + 45)
+ WizardTitle(2) = sMsgWizardName &amp; &quot; - &quot; &amp; GetResText(RID_FORM + 46)
+ WizardTitle(3) = sMsgWizardName &amp; &quot; - &quot; &amp; GetResText(RID_FORM + 47)
+
+ .hlnBinaries.Label = GetResText(RID_FORM + 50)
+ .optIgnoreBinaries.Label = GetResText(RID_FORM + 51)
+ .optBinariesasGraphics.Label = GetResText(RID_FORM + 52)
+
+ .hlnBackground.Label = GetResText(RID_FORM + 55)
+ .optTiled.Label = GetResText(RID_FORM + 56)
+ .optArea.Label = GetResText(RID_FORM + 57)
+
+ .optBorder0.Label = GetResText(RID_FORM + 29)
+ .optBorder1.Label = GetResText(RID_FORM + 30)
+ .optBorder2.Label = GetResText(RID_FORM + 31)
+ .optBorder1.State = 1
+
+ .optAlign0.Label = GetResText(RID_FORM + 33)
+ .optAlign2.Label = GetResText(RID_FORM + 34)
+ .optAlign0.State = 1
+
+ FNameAddOn = &quot;&quot;
+ If isHighContrast(DlgFormDB.getPeer) Then FNameAddOn = &quot;_hc&quot;
+
+ IDArray = Array(36, 37, 40, 38, 39)
+ For i = 1 To 5
+ ButtonHelpText = GetResText(RID_FORM + IDArray(i-1)
+ cmdButton = DlgFormDB.getControl(&quot;cmdArrange&quot; &amp; i)
+ cmdButton.Model.ImageURL = FormPath &amp; &quot;Arrange_&quot; &amp; i &amp; FNameAddOn &amp; &quot;.gif&quot;
+ cmdButton.Model.HelpText = ButtonHelpText
+ cmdButton.getPeer().setProperty(&quot;AccessibleName&quot;, ButtonHelpText)
+ Next i
+&apos; .cmdArrange1.ImageURL = FormPath &amp; &quot;Arrange_1&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
+&apos; .cmdArrange1.HelpText = GetResText(RID_FORM + 36)
+&apos;
+&apos; .cmdArrange2.ImageURL = FormPath &amp; &quot;Arrange_2&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
+&apos; .cmdArrange2.HelpText = GetResText(RID_FORM + 37)
+&apos;
+&apos; .cmdArrange3.ImageURL = FormPath &amp; &quot;Arrange_3&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
+&apos; .cmdArrange3.HelpText = GetResText(RID_FORM + 40)
+&apos;
+&apos; .cmdArrange4.ImageURL = FormPath &amp; &quot;Arrange_4&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
+&apos; .cmdArrange4.HelpText = GetResText(RID_FORM + 38)
+&apos;
+&apos; .cmdArrange5.ImageURL = FormPath &amp; &quot;Arrange_5&quot; &amp; FNameAddOn &amp; &quot;.gif&quot;
+&apos; .cmdArrange5.HelpText = GetResText(RID_FORM + 39)
+ sWriterFilterName = GetResText(RID_FORM + 70)
+ End With
+ DlgFormDB.GetControl(&quot;cmdMoveSelected&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(RID_COMMON + 39)
+ DlgFormDB.GetControl(&quot;cmdRemoveSelected&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(RID_COMMON + 40)
+ DlgFormDB.GetControl(&quot;cmdMoveAll&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(RID_COMMON + 41)
+ DlgFormDB.GetControl(&quot;cmdRemoveAll&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, GetResText(RID_COMMON + 42)
+ DlgFormDB.getControl(&quot;lstFields&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, DeleteStr(slblFields, &quot;~&quot;))
+ DlgFormDB.getControl(&quot;lstSelFields&quot;).getPeer().setProperty(&quot;AccessibleName&quot;, DeleteStr(slblSelFields, &quot;~&quot;))
+
+ sSelectDatasource = GetResText(RID_COMMON + 37)
+ sSelectDBTable = GetResText(RID_COMMON + 38)
+End Sub
+
+
+
+Sub InitializeWidthList()
+
+ If Ubound(WidthList(),1) &gt; 16 Then
+ ReDim WidthList(16,4)
+ End If
+
+ WidthList(0,0) = com.sun.star.sdbc.DataType.BIT &apos; = -7;
+ WidthList(0,1) = cCheckbox
+ WidthList(0,2) = False
+ WidthList(0,3) = &quot;CheckBox&quot;
+
+ WidthList(1,0) = com.sun.star.sdbc.DataType.TINYINT &apos; = -6;
+ WidthList(1,1) = cNumericBox
+ WidthList(1,2) = False
+ WidthList(1,3) = &quot;FormattedField&quot;
+
+ WidthList(2,0) = com.sun.star.sdbc.DataType.SMALLINT &apos; = 5;
+ WidthList(2,1) = cNumericBox
+ WidthList(2,2) = False
+ WidthList(2,3) = &quot;FormattedField&quot;
+
+ WidthList(3,0) = com.sun.star.sdbc.DataType.INTEGER &apos; = 4;
+ WidthList(3,1) = cNumericBox
+ WidthList(3,2) = False
+ WidthList(3,3) = &quot;FormattedField&quot;
+
+ WidthList(4,0) = com.sun.star.sdbc.DataType.BIGINT &apos; = -5;
+ WidthList(4,1) = cNumericBox
+ WidthList(4,2) = False
+ WidthList(4,3) = &quot;FormattedField&quot;
+
+ WidthList(5,0) = com.sun.star.sdbc.DataType.FLOAT &apos; = 6;
+ WidthList(5,1) = cNumericBox
+ WidthList(5,2) = False
+ WidthList(5,3) = &quot;FormattedField&quot;
+
+ WidthList(6,0) = com.sun.star.sdbc.DataType.REAL &apos; = 7;
+ WidthList(6,1) = cNumericBox
+ WidthList(6,2) = False
+ WidthList(6,3) = &quot;FormattedField&quot;
+
+ WidthList(7,0) = com.sun.star.sdbc.DataType.DOUBLE &apos; = 8;
+ WidthList(7,1) = cNumericBox
+ WidthList(7,2) = False
+ WidthList(7,3) = &quot;FormattedField&quot;
+
+ WidthList(8,0) = com.sun.star.sdbc.DataType.NUMERIC &apos; = 2;
+ WidthList(8,1) = cNumericBox
+ WidthList(8,2) = False
+ WidthList(8,3) = &quot;FormattedField&quot;
+
+ WidthList(9,0) = com.sun.star.sdbc.DataType.DECIMAL &apos; = 3; (including decimal places)
+ WidthList(9,1) = cNumericBox
+ WidthList(9,2) = False
+ WidthList(9,3) = &quot;FormattedField&quot;
+
+ WidthList(10,0) = com.sun.star.sdbc.DataType.CHAR &apos; = 1;
+ WidthList(10,1) = cTextBox
+ WidthList(10,2) = False
+ WidthList(10,3) = &quot;TextField&quot;
+
+ WidthList(11,0) = com.sun.star.sdbc.DataType.VARCHAR &apos; = 12;
+ WidthList(11,1) = cTextBox
+ WidthList(11,2) = True
+ WidthList(11,3) = &quot;TextField&quot;
+
+ WidthList(12,0) = com.sun.star.sdbc.DataType.LONGVARCHAR &apos; = -1;
+ WidthList(12,1) = cTextBox
+ WidthList(12,2) = True
+ WidthList(12,3) = &quot;TextField&quot;
+
+ WidthList(13,0) = com.sun.star.sdbc.DataType.DATE &apos; = 91;
+ WidthList(13,1) = cDateBox
+ WidthList(13,2) = False
+ WidthList(13,3) = &quot;DateField&quot;
+
+ WidthList(14,0) = com.sun.star.sdbc.DataType.TIME &apos; = 92;
+ WidthList(14,1) = cTimeBox
+ WidthList(14,2) = False
+ WidthList(14,3) = &quot;TimeField&quot;
+
+ WidthList(15,0) = com.sun.star.sdbc.DataType.TIMESTAMP &apos; = 93;
+ WidthList(15,1) = cDateBox
+ WidthList(15,2) = False
+ WidthList(15,3) = &quot;DateField&quot;
+
+ WidthList(16,0) = com.sun.star.sdbc.DataType.BOOLEAN &apos; = 16;
+ WidthList(16,1) = cCheckbox
+ WidthList(16,2) = False
+ WidthList(16,3) = &quot;CheckBox&quot;
+
+ ImgWidthList(0,0) = com.sun.star.sdbc.DataType.BINARY &apos; = -2;
+ ImgWidthList(0,1) = cImageControl
+ ImgWidthList(0,2) = False
+ ImgWidthList(0,3) = &quot;ImageControl&quot;
+
+ ImgWidthList(1,0) = com.sun.star.sdbc.DataType.VARBINARY &apos; = -3;
+ ImgWidthList(1,1) = cImageControl
+ ImgWidthList(1,2) = False
+ ImgWidthList(1,3) = &quot;ImageControl&quot;
+
+ ImgWidthList(2,0) = com.sun.star.sdbc.DataType.LONGVARBINARY &apos; = -4;
+ ImgWidthList(2,1) = cImageControl
+ ImgWidthList(2,2) = False
+ ImgWidthList(2,3) = &quot;ImageControl&quot;
+
+ ImgWidthList(3,0) = com.sun.star.sdbc.DataType.BLOB &apos; = 2004;
+ ImgWidthList(3,1) = cImageControl
+ ImgWidthList(3,2) = False
+ ImgWidthList(3,3) = &quot;ImageControl&quot;
+
+&apos; Note: the following Fieldtypes are ignored
+&apos;ExcludeList(0) = com.sun.star.sdbc.DataType.SQLNULL
+&apos;ExcludeList(1) = com.sun.star.sdbc.DataType.OTHER
+&apos;ExcludeList(2) = com.sun.star.sdbc.DataType.OBJECT
+&apos;ExcludeList(3) = com.sun.star.sdbc.DataType.DISTINCT
+&apos;ExcludeList(4) = com.sun.star.sdbc.DataType.STRUCT
+&apos;ExcludeList(5) = com.sun.star.sdbc.DataType.ARRAY
+&apos;ExcludeList(6) = com.sun.star.sdbc.DataType.CLOB
+&apos;ExcludeList(7) = com.sun.star.sdbc.DataType.REF
+
+ oModelService(cLabel) = &quot;com.sun.star.form.component.FixedText&quot;
+ oModelService(cTextBox) = &quot;com.sun.star.form.component.TextField&quot;
+ oModelService(cCheckBox) = &quot;com.sun.star.form.component.CheckBox&quot;
+ oModelService(cDateBox) = &quot;com.sun.star.form.component.DateField&quot;
+ oModelService(cTimeBox) = &quot;com.sun.star.form.component.TimeField&quot;
+ oModelService(cNumericBox) = &quot;com.sun.star.form.component.FormattedField&quot;
+ oModelService(cGridControl) = &quot;com.sun.star.form.component.GridControl&quot;
+ oModelService(cImageControl) = &quot;com.sun.star.form.component.DatabaseImageControl&quot;
+End Sub
+</script:module>
diff --git a/wizards/source/formwizard/Layouter.xba b/wizards/source/formwizard/Layouter.xba
new file mode 100644
index 000000000000..ae10314bbda3
--- /dev/null
+++ b/wizards/source/formwizard/Layouter.xba
@@ -0,0 +1,380 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Layouter" script:language="StarBasic">Option Explicit
+
+Public oProgressbar as Object
+Public ProgressValue as Integer
+Public oDocument as Object
+Public oController as Object
+Public oForm as Object
+Public oDrawPage as Object
+Public oPageStyle as Object
+
+Public nMaxColRightX as Long
+Public nMaxTCWidth as Long
+Public nMaxRowRightX as Long
+Public nMaxRowY as Long
+Public nSecMaxRowY as Long
+Public MaxIndex as Integer
+Public CurIndex as Integer
+
+Public Const cVertDistance = 200
+Public Const cHoriDistance = 300
+
+Public nPageWidth as Long
+Public nPageHeight as Long
+Public nFormWidth as Long
+Public nFormHeight as Long
+Public nMaxHoriPos as Long
+Public nMaxVertPos as Long
+
+Public CONST SBALIGNLEFT = 0
+Public CONST SBALIGNRIGHT = 2
+
+Public Const SBNOBORDER = 0
+Public Const SB3DBORDER = 1
+Public Const SBSIMPLEBORDER = 2
+
+Public CurArrangement as Integer
+Public CurBorderType as Integer
+Public CurAlignmode as Integer
+
+Public OldAlignMode as Integer
+Public OldBorderType as Integer
+Public OldArrangement as Integer
+
+Public Const cColumnarLeft = 1
+Public Const cColumnarTop = 2
+Public Const cTabled = 3
+Public Const cLeftJustified = 4
+Public Const cTopJustified = 5
+
+Public Const cXOffset = 1000
+Public Const cYOffset = 700
+&apos; This is the viewed space that we lose because of the symbol bars
+Public Const cSymbolMargin = 2000
+Public Const MaxFieldIndex = 200
+
+Public Const cControlCollectionCount = 9
+Public Const cLabel = 1
+Public Const cTextBox = 2
+Public Const cCheckBox = 3
+Public Const cDateBox = 4
+Public Const cTimeBox = 5
+Public Const cNumericBox = 6
+Public Const cCurrencyBox = 7
+Public Const cGridControl = 8
+Public Const cImageControl = 9
+
+Public Styles(100, 8) as String
+
+Public CurControlType as Integer
+Public CurFieldlength as Double
+Public CurFieldType as Integer
+Public CurFieldName as String
+Public CurControlName as String
+Public CurFormatKey as Long
+Public CurDefaultValue
+Public CurIsCurrency as Boolean
+Public CurScale as Integer
+Public CurHelpText as String
+
+Public FieldMetaValues(MaxFieldIndex, 8)
+&apos; Description of this List:
+&apos; CurFieldType = FieldMetaValues(Index,0)
+&apos; CurFieldLength = FieldMetaValues(Index,1)
+&apos; CurControlType = FieldMetaValues(Index,2) (ControlType eg. cLabel, cTextbox usw.)
+&apos; CurControlName = FieldMetaValues(Index,3)
+&apos; CurFormatKey = FieldMetaValues(Index,4)
+&apos; CurDefaultValue = FieldMetaValues(Index,5)
+&apos; CurIsCurrency = FieldMetaValues(Index,6)
+&apos; CurScale = FieldMetaValues(Index,7)
+&apos; CurHelpText = FieldMetaValues(Index,8)
+
+Public FieldNames(MaxFieldIndex) as string
+Public oModelService(cControlCollectionCount) as String
+Public oGridModel as Object
+
+
+Function InsertControl(oContainer as Object, oControlObject as object, aPoint as Object, aSize as Object)
+Dim oShape as object
+ oShape = oDocument.CreateInstance (&quot;com.sun.star.drawing.ControlShape&quot;)
+ oShape.Size = aSize
+ oShape.Position = aPoint
+ oShape.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
+ oShape.control = oControlObject
+ oContainer.Add(oShape)
+ InsertControl() = oShape
+End Function
+
+
+Function ArrangeControls()
+Dim oShape as Object
+Dim i as Integer
+ oProgressbar = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator
+ oProgressbar.Start(&quot;&quot;, MaxIndex)
+ If oDBForm.HasbyName(&quot;Grid1&quot;) Then
+ RemoveShapes()
+ End If
+ ToggleLayoutPage(False)
+ Select Case CurArrangement
+ Case cTabled
+ PositionGridControl(MaxIndex)
+ Case Else
+ PositionControls(MaxIndex)
+ End Select
+ ToggleLayoutPage(True)
+ oProgressbar.End
+End Function
+
+
+Sub OpenFormDocument()
+Dim NoArgs() as new com.sun.star.beans.PropertyValue
+Dim oViewSettings as Object
+ oDocument = CreateNewDocument(&quot;swriter&quot;)
+ oProgressbar = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator()
+ oProgressbar.Start(&quot;&quot;, 100)
+ oDocument.ApplyFormDesignMode = False
+ oController = oDocument.GetCurrentController
+ oViewSettings = oDocument.CurrentController.ViewSettings
+ oViewSettings.ShowTableBoundaries = False
+ oViewSettings.ShowOnlineLayout = True
+ oDrawPage = oDocument.DrawPage
+ oPageStyle = oDocument.StyleFamilies.GetByName(&quot;PageStyles&quot;).GetByName(&quot;Standard&quot;)
+End Sub
+
+
+Sub InitializeLabelValues()
+Dim oLabelModel as Object
+Dim oTBModel as Object
+Dim oLabelShape as Object
+Dim oTBShape as Object
+Dim aTBSize As New com.sun.star.awt.Size
+Dim aLabelSize As New com.sun.star.awt.Size
+Dim aPoint As New com.sun.star.awt.Point
+Dim aSize As New com.sun.star.awt.Size
+Dim oLocControl as Object
+Dim oLocPeer as Object
+ oLabelModel = CreateUnoService(&quot;com.sun.star.form.component.FixedText&quot;)
+ oTBModel = CreateUnoService(&quot;com.sun.star.form.component.TextField&quot;)
+
+ Set oLabelShape = InsertControl(oDrawPage, oLabelModel, aPoint, aLabelSize)
+ Set oTBShape = InsertControl(oDrawPage, oTBModel, aPoint, aSize)
+
+ oLocPeer = oController.GetControl(oLabelModel).Peer
+ XPixelFactor = 100000/oLocPeer.GetInfo.PixelPerMeterX
+ YPixelFactor = 100000/oLocPeer.GetInfo.PixelPerMeterY
+ aLabelSize = GetPeerSize(oLabelModel, oLocControl, &quot;The quick brown fox...&quot;)
+ nTCHeight = (aLabelSize.Height+1) * YPixelFactor
+ aTBSize = GetPeerSize(oTBModel, oLocControl, &quot;The quick brown fox...&quot;)
+ nDBRefHeight = (aTBSize.Height+1) * YPixelFactor
+ BasicLabelDiffHeight = Clng((nDBRefHeight - nTCHeight)/2)
+ oDrawPage.Remove(oLabelShape)
+ oDrawPage.Remove(oTBShape)
+End Sub
+
+
+Sub ConfigurePageStyle()
+Dim aPageSize As New com.sun.star.awt.Size
+Dim aSize As New com.sun.star.awt.Size
+ oPageStyle.IsLandscape = True
+ aPageSize = oPageStyle.Size
+ nPageWidth = aPageSize.Width
+ nPageHeight = aPageSize.Height
+ aSize.Width = nPageHeight
+ aSize.Height = nPageWidth
+ oPageStyle.Size = aSize
+ nPageWidth = nPageHeight
+ nPageHeight = oPageStyle.Size.Height
+ nFormWidth = nPageWidth - oPageStyle.RightMargin - oPageStyle.LeftMargin - 2 * cXOffset
+ nFormHeight = nPageHeight - oPageStyle.TopMargin - oPageStyle.BottomMargin - 2 * cYOffset - cSymbolMargin
+End Sub
+
+
+&apos; Modify the Borders of the Controls
+Sub ChangeBorderLayouts(oEvent as Object)
+Dim oModel as Object
+Dim i as Integer
+Dim oCurModel as Object
+Dim sLocText as String
+Dim oGroupShape as Object
+Dim s as Integer
+ If Not bDebug Then
+ On Local Error GoTo WIZARDERROR
+ End If
+ oModel = oEvent.Source.Model
+ SwitchBorderMode(Val(Right(oModel.Name,1)))
+ ToggleLayoutPage(False)
+ If CurArrangement = cTabled Then
+ oGridModel.Border = CurBorderType
+ Else
+ If OldBorderType &lt;&gt; CurBorderType Then
+ For i = 0 To MaxIndex
+ If oDBShapeList(i).SupportsService(&quot;com.sun.star.drawing.GroupShape&quot;) Then
+ oGroupShape = oDBShapeList(i)
+ For s = 0 To oGroupShape.Count-1
+ oGroupShape(s).Control.Border = CurBorderType
+ Next s
+ Else
+ If oDBModelList(i).PropertySetInfo.HasPropertyByName(&quot;Border&quot;) Then
+ oDBModelList(i).Border = CurBorderType
+ End If
+ End If
+ Next i
+ End If
+ End If
+ ToggleLayoutPage(True)
+WIZARDERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(sMsgErrMsg, 16, GetProductName())
+ Resume LOCERROR
+ LOCERROR:
+ DlgFormDB.Dispose()
+ End If
+End Sub
+
+
+Sub ChangeLabelAlignments(oEvent as Object)
+Dim i as Integer
+Dim oSize as New com.sun.star.awt.Size
+Dim oModel as Object
+ If Not bDebug Then
+ On Local Error GoTo WIZARDERROR
+ End If
+ oModel = oEvent.Source.Model
+ SwitchAlignMode(Val(Right(oModel.Name,1)))
+ ToggleLayoutPage(False)
+ If OldAlignMode &lt;&gt; CurAlignMode Then
+ For i = 0 To MaxIndex
+ oTCShapeList(i).GetControl.Align = CurAlignmode
+ Next i
+ End If
+ If CurAlignmode = com.sun.star.awt.TextAlign.RIGHT Then
+ For i = 0 To Ubound(oTCShapeList())
+ oSize = oTCShapeList(i).Size
+ oSize.Width = oDBShapeList(i).Position.X - oTCShapeList(i).Position.X - cHoriDistance
+ oTCShapeList(i).Size = oSize
+ Next i
+ End If
+
+WIZARDERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(sMsgErrMsg, 16, GetProductName())
+ Resume LOCERROR
+ LOCERROR:
+ End If
+ ToggleLayoutPage(True)
+End Sub
+
+
+Sub ChangeArrangemode(oEvent as Object)
+Dim oModel as Object
+ If Not bDebug Then
+ On Local Error GoTo WIZARDERROR
+ End If
+ oModel = oEvent.Source.Model
+ SwitchArrangementButtons(Val(Right(oModel.Name,1)))
+ oModel.State = 1
+ DlgFormDB.GetControl(&quot;cmdArrange&quot; &amp; OldArrangement).Model.State = 0
+ If CurArrangement &lt;&gt; OldArrangement Then
+ ArrangeControls()
+ Select Case CurArrangement
+ Case cTabled
+ ToggleBorderGroup(False)
+ ToggleAlignGroup(False)
+ Case Else &apos; cColumnarTop,cLeftJustified, cTopJustified
+ ToggleAlignGroup(CurArrangement = cColumnarLeft)
+ If CurArrangement = cColumnarTop Then
+ If CurAlignMode = com.sun.star.awt.TextAlign.RIGHT Then
+ DialogModel.optAlign0.State = 1
+ CurAlignMode = com.sun.star.awt.TextAlign.LEFT
+ OldAlignMode = com.sun.star.awt.TextAlign.RIGHT
+ End If
+ End If
+ ControlCaptionstoStandardLayout()
+ oDBForm.Load
+ End Select
+ End If
+WIZARDERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(sMsgErrMsg, 16, GetProductName())
+ Resume LOCERROR
+ LOCERROR:
+ End If
+End Sub
+
+
+Sub ToggleBorderGroup(bDoEnable as Boolean)
+ With DialogModel
+ .hlnBorderLayout.Enabled = bDoEnable
+ .optBorder0.Enabled = bDoEnable &apos; 0: No border
+ .optBorder1.Enabled = bDoEnable &apos; 1: 3D border
+ .optBorder2.Enabled = bDoEnable &apos; 2: simple border
+ End With
+End Sub
+
+
+Sub ToggleAlignGroup(ByVal bDoEnable as Boolean)
+ With DialogModel
+ If bDoEnable Then
+ bDoEnable = CurArrangement = cColumnarLeft
+ End If
+ .hlnAlign.Enabled = bDoEnable
+ .optAlign0.Enabled = bDoEnable
+ .optAlign2.Enabled = bDoEnable
+ End With
+End Sub
+
+
+Sub ToggleLayoutPage(bDoEnable as Boolean, Optional FocusControlName as String)
+ DialogModel.Enabled = bDoEnable
+ If bDoEnable Then
+ If Not bDebug Then
+ oDocument.UnlockControllers()
+ End If
+ ToggleOptionButtons(DialogModel,(bWithBackGraphic = True))
+ ToggleAlignGroup(bDoEnable)
+ ToggleBorderGroup(bDoEnable)
+ Else
+ If Not bDebug Then
+ oDocument.LockControllers()
+ End If
+ End If
+ If Not IsMissing(FocusControlName) Then
+ DlgFormDB.GetControl(FocusControlName).SetFocus()
+ End If
+End Sub
+
+
+Sub DestroyControlShapes(oDrawPage as Object)
+Dim i as Integer
+Dim oShape as Object
+ For i = oDrawPage.Count-1 To 0 Step -1
+ oShape = oDrawPage.GetByIndex(i)
+ If oShape.ShapeType = &quot;com.sun.star.drawing.ControlShape&quot; Then
+ oShape.Dispose()
+ End If
+ Next i
+End Sub
+
+
+Sub SwitchArrangementButtons(ByVal LocArrangement as Integer)
+ OldArrangement = CurArrangement
+ CurArrangement = LocArrangement
+ If OldArrangement &lt;&gt; 0 Then
+ DlgFormDB.GetControl(&quot;cmdArrange&quot; &amp; OldArrangement).Model.State = 0
+ End If
+ DlgFormDB.GetControl(&quot;cmdArrange&quot; &amp; CurArrangement).Model.State = 1
+End Sub
+
+
+Sub SwitchBorderMode(ByVal LocBorderType as Integer)
+ OldBorderType = CurBorderType
+ CurBorderType = LocBorderType
+End Sub
+
+
+Sub SwitchAlignMode(ByVal LocAlignMode as Integer)
+ OldAlignMode = CurAlignMode
+ CurAlignMode = LocAlignMode
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/formwizard/dbwizres.src b/wizards/source/formwizard/dbwizres.src
new file mode 100644
index 000000000000..c04d77b9fcdd
--- /dev/null
+++ b/wizards/source/formwizard/dbwizres.src
@@ -0,0 +1,3518 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/// common
+
+#define RID_COMMON_START 500
+#define RID_DB_COMMON_START 1000
+
+// db wizards
+
+#define RID_DB_FORM_WIZARD_START 2200
+#define RID_DB_QUERY_WIZARD_START 2300
+#define RID_DB_REPORT_WIZARD_START 2400
+#define RID_DB_TABLE_WIZARD_START 2500
+
+
+#define RID_LETTERWIZARDDIALOG_START 3000
+#define RID_LETTERWIZARDGREETING_START 3080
+#define RID_LETTERWIZARDSALUTATION_START 3090
+#define RID_LETTERWIZARDROADMAP_START 3100
+#define RID_LETTERWIZARDLANGUAGE_START 3110
+
+
+#define RID_FAXWIZARDDIALOG_START 3200
+#define RID_FAXWIZARDCOMMUNICATION_START 3270
+#define RID_FAXWIZARDGREETING_START 3280
+#define RID_FAXWIZARDSALUTATION_START 3290
+#define RID_FAXWIZARDROADMAP_START 3300
+
+// web wizard
+
+#define RID_WEBWIZARDDIALOG_START 4000
+#define RID_WEBWIZARDDIALOG_FTP 4200
+
+// agenda wizard
+
+#define RID_AGENDAWIZARDDIALOG_START 5000
+
+
+
+// ============================================================================
+
+String RID_COMMON_START + 0
+{
+ Text [ en-US ] = "The directory '%1' could not be created.<BR>There may not be enough space left on your hard disk.";
+};
+
+String RID_COMMON_START + 1
+{
+ Text [ en-US] = "The text document could not be created.<BR>Please check if the module 'PRODUCTNAME Writer' is installed.";
+};
+
+String RID_COMMON_START + 2
+{
+ Text [ en-US] = "The spreadsheet could not be created.<BR>Please check if the module 'PRODUCTNAME Calc' is installed.";
+};
+
+String RID_COMMON_START + 3
+{
+ Text [ en-US] = "The presentation could not be created.<BR>Please check if the module 'PRODUCTNAME Impress' is installed.";
+};
+
+String RID_COMMON_START + 4
+{
+ Text [ en-US] = "The drawing could not be created.<BR>Please check if the module 'PRODUCTNAME Draw' is installed.";
+};
+
+String RID_COMMON_START + 5
+{
+ Text [ en-US] = "The formula could not be created.<BR>Please check if the module 'PRODUCTNAME Math' is installed.";
+};
+
+String RID_COMMON_START + 6
+{
+ Text [ en-US] = "The files required could not be found.<BR>Please start the %PRODUCTNAME Setup and choose 'Repair'.";
+};
+
+String RID_COMMON_START + 7
+{
+ Text [ en-US] = "The file '<PATH>' already exists.<BR><BR>Would you like to overwrite the existing file?";
+};
+
+String RID_COMMON_START + 8
+{
+ Text [ en-US] = "Yes";
+};
+
+String RID_COMMON_START + 9
+{
+ Text [ en-US] = "Yes to All";
+};
+
+String RID_COMMON_START + 10
+{
+ Text [ en-US] = "No";
+};
+
+String RID_COMMON_START + 11
+{
+ Text [ en-US] = "Cancel";
+};
+
+String RID_COMMON_START + 12
+{
+ Text [ en-US] = "~Finish";
+};
+
+String RID_COMMON_START + 13
+{
+ Text [ en-US] = "< ~Back";
+};
+
+String RID_COMMON_START + 14
+{
+ Text [ en-US] = "~Next >";
+};
+
+String RID_COMMON_START + 15
+{
+ Text [ en-US ] = "~Help";
+};
+
+String RID_COMMON_START + 16
+{
+ Text [ en-US] = "Steps";
+};
+
+String RID_COMMON_START + 17
+{
+ Text [ en-US] = "Close";
+};
+
+String RID_COMMON_START + 18
+{
+ Text [ en-US] = "OK";
+};
+
+String RID_COMMON_START + 19
+{
+ Text [ en-US] = "The file already exists. Do you want to overwrite it?";
+};
+
+String RID_COMMON_START + 20
+{
+ Text [ en-US] = "Template created via <wizard_name> on <current_date>.";
+};
+
+String RID_COMMON_START + 21
+{
+ Text [ en-US] = "The wizard could not be run, because important files were not found.\nUnder 'Tools - Options - %PRODUCTNAME - Paths' click the 'Default' button to reset the paths to the original default settings.\nThen run the wizard again.";
+};
+
+
+// end of common section ======================================================
+
+
+String RID_DB_COMMON_START + 0
+{
+ Text [ en-US] = "C~reate";
+};
+String RID_DB_COMMON_START + 1
+{
+ Text [ en-US] = "~Cancel";
+};
+
+String RID_DB_COMMON_START + 2
+{
+ Text [ en-US] = "<< ~Back";
+};
+
+String RID_DB_COMMON_START + 3
+{
+ Text [ en-US] = "~Next >>";
+};
+String RID_DB_COMMON_START + 4
+{
+ Text [ en-US] = "~Database";
+};
+String RID_DB_COMMON_START + 5
+{
+ Text [ en-US] = "~Table name";
+};
+
+String RID_DB_COMMON_START + 6
+{
+ Text [ en-US] = "An error occurred while running the wizard. The wizard will be terminated.";
+};
+
+
+String RID_DB_COMMON_START + 14
+{
+ Text [ en-US ] = "No connection to the database could be established.";
+};
+
+String RID_DB_COMMON_START + 20
+{
+ Text [ en-US ] = "~Help";
+};
+
+String RID_DB_COMMON_START + 21
+{
+ Text [ en-US ] = "~Stop";
+};
+
+
+String RID_DB_COMMON_START + 30
+{
+ Text[ en-US ] = "The document could not be saved.";
+};
+
+
+String RID_DB_COMMON_START + 33
+{
+ Text[ en-US ] = "Exiting the wizard";
+};
+
+String RID_DB_COMMON_START + 34
+{
+ Text[ en-US ] = "Connecting to data source...";
+};
+
+String RID_DB_COMMON_START + 35
+{
+ Text[ en-US ] = "The connection to the data source could not be established.";
+};
+
+
+String RID_DB_COMMON_START + 36
+{
+ Text[ en-US ] = "The file path entered is not valid.";
+};
+
+
+String RID_DB_COMMON_START + 37
+{
+ Text[ en-US ] = "Please select a data source";
+};
+
+String RID_DB_COMMON_START + 38
+{
+ Text[ en-US ] = "Please select a table or query";
+};
+
+String RID_DB_COMMON_START + 39
+{
+ Text[ en-US ] = "Add field";
+};
+
+String RID_DB_COMMON_START + 40
+{
+ Text[ en-US ] = "Remove field";
+};
+
+String RID_DB_COMMON_START + 41
+{
+ Text[ en-US ] = "Add all fields";
+};
+
+String RID_DB_COMMON_START + 42
+{
+ Text[ en-US ] = "Remove all fields";
+};
+
+String RID_DB_COMMON_START + 43
+{
+ Text[ en-US ] = "Move field up";
+};
+
+String RID_DB_COMMON_START + 44
+{
+ Text[ en-US ] = "Move field down";
+};
+
+String RID_DB_COMMON_START + 45
+{
+ Text [ en-US] = "The field names from '%NAME' could not be retrieved.";
+};
+
+
+
+// ============================================================================
+// Form Wizard
+// ============================================================================
+
+String RID_DB_FORM_WIZARD_START + 0
+{
+ Text [ en-US ] = "Form Wizard";
+};
+
+String RID_DB_FORM_WIZARD_START + 1
+{
+ Text [ en-US ] = "Fields in ~the form";
+};
+
+String RID_DB_FORM_WIZARD_START + 2
+{
+ Text [ en-US ] = "Binary fields are always listed and selectable from the left list.\nIf possible, they are interpreted as images.";
+};
+
+String RID_DB_FORM_WIZARD_START + 3
+{
+ Text [ en-US ] = "A subform is a form that is inserted in another form.\nUse subforms to show data from tables or queries with a one-to-many relationship.";
+};
+
+String RID_DB_FORM_WIZARD_START + 4
+{
+ Text [ en-US ] = "~Add Subform";
+};
+
+String RID_DB_FORM_WIZARD_START + 5
+{
+ Text [ en-US ] = "~Subform based on existing relation";
+};
+
+String RID_DB_FORM_WIZARD_START + 6
+{
+ Text [ en-US ] = "Tables or queries";
+};
+
+String RID_DB_FORM_WIZARD_START + 7
+{
+ Text [ en-US ] = "Subform based on ~manual selection of fields";
+};
+
+String RID_DB_FORM_WIZARD_START + 8
+{
+ Text [ en-US ] = "~Which relation do you want to add?";
+};
+
+String RID_DB_FORM_WIZARD_START + 9
+{
+ Text [ en-US ] = "Fields in the ~subform";
+};
+
+String RID_DB_FORM_WIZARD_START + 12
+{
+ Text [ en-US ] = "~Available fields";
+};
+
+String RID_DB_FORM_WIZARD_START + 13
+{
+ Text [ en-US ] = "Fields in form";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 19
+{
+ Text [ en-US ] = "The join '<FIELDNAME1>' and '<FIELDNAME2>' has been selected twice.\nBut joins may only be used once.";
+};
+
+String RID_DB_FORM_WIZARD_START + 20
+{
+ Text [ en-US ] = "~First joined subform field";
+};
+
+String RID_DB_FORM_WIZARD_START + 21
+{
+ Text [ en-US ] = "~Second joined subform field";
+};
+
+String RID_DB_FORM_WIZARD_START + 22
+{
+ Text [ en-US ] = "~Third joined subform field";
+};
+
+String RID_DB_FORM_WIZARD_START + 23
+{
+ Text [ en-US ] = "~Fourth joined subform field";
+};
+
+String RID_DB_FORM_WIZARD_START + 24
+{
+ Text [ en-US ] = "F~irst joined main form field";
+};
+
+String RID_DB_FORM_WIZARD_START + 25
+{
+ Text [ en-US ] = "S~econd joined main form field";
+};
+
+String RID_DB_FORM_WIZARD_START + 26
+{
+ Text [ en-US ] = "T~hird joined main form field";
+};
+
+String RID_DB_FORM_WIZARD_START + 27
+{
+ Text [ en-US ] = "F~ourth joined main form field";
+};
+
+
+
+String RID_DB_FORM_WIZARD_START + 28
+{
+ Text [ en-US ] = "Field border";
+};
+
+String RID_DB_FORM_WIZARD_START + 29
+{
+ Text [ en-US ] = "No border";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 30
+{
+ Text [ en-US ] = "3D look";
+};
+
+String RID_DB_FORM_WIZARD_START + 31
+{
+ Text [ en-US ] = "Flat";
+};
+
+String RID_DB_FORM_WIZARD_START + 32
+{
+ Text [ en-US ] = "Label placement";
+};
+
+String RID_DB_FORM_WIZARD_START + 33
+{
+ Text [ en-US ] = "Align left";
+};
+
+String RID_DB_FORM_WIZARD_START + 34
+{
+ Text [ en-US ] = "Align right";
+};
+
+String RID_DB_FORM_WIZARD_START + 35
+{
+ Text [ en-US ] = "Arrangement of DB fields";
+};
+
+String RID_DB_FORM_WIZARD_START + 36
+{
+ Text [ en-US ] = "Columnar - Labels Left";
+};
+
+String RID_DB_FORM_WIZARD_START + 37
+{
+ Text [ en-US ] = "Columnar - Labels on Top";
+};
+
+String RID_DB_FORM_WIZARD_START + 38
+{
+ Text [ en-US ] = "In Blocks - Labels Left";
+};
+
+String RID_DB_FORM_WIZARD_START + 39
+{
+ Text [ en-US ] = "In Blocks - Labels Above";
+};
+
+String RID_DB_FORM_WIZARD_START + 40
+{
+ Text [ en-US ] = "As Data Sheet";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 41
+{
+ Text [ en-US ] = "Arrangement of the main form";
+};
+
+String RID_DB_FORM_WIZARD_START + 42
+{
+ Text [ en-US ] = "Arrangement of the subform";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 44
+{
+ Text [ en-US ] = "The form is to be ~used for entering new data only.";
+};
+
+String RID_DB_FORM_WIZARD_START + 45
+{
+ Text [ en-US ] = "Existing data will not be displayed ";
+};
+
+String RID_DB_FORM_WIZARD_START + 46
+{
+ Text [ en-US ] = "T~he form is to display all data";
+};
+
+String RID_DB_FORM_WIZARD_START + 47
+{
+ Text [ en-US ] = "Do not allow ~modification of existing data";
+};
+
+String RID_DB_FORM_WIZARD_START + 48
+{
+ Text [ en-US ] = "Do not allow ~deletion of existing data";
+};
+
+String RID_DB_FORM_WIZARD_START + 49
+{
+ Text [ en-US ] = "Do not allow ~addition of new data";
+};
+
+
+
+String RID_DB_FORM_WIZARD_START + 50
+{
+ Text [ en-US ] = "Name of ~the form";
+};
+
+
+
+String RID_DB_FORM_WIZARD_START + 51
+{
+ Text [ en-US ] = "How do you want to proceed after creating the form?";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 52
+{
+ Text [ en-US ] = "~Work with the form";
+};
+
+String RID_DB_FORM_WIZARD_START + 53
+{
+ Text [ en-US ] = "~Modify the form";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 55
+{
+ Text [ en-US ] = "~Page Styles";
+};
+
+
+
+String RID_DB_FORM_WIZARD_START + 80
+{
+ Text [ en-US ] = "Field selection";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 81
+{
+ Text [ en-US ] = "Set up a subform";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 82
+{
+ Text [ en-US ] = "Add subform fields";
+};
+
+String RID_DB_FORM_WIZARD_START + 83
+{
+ Text [ en-US ] = "Get joined fields";
+};
+
+String RID_DB_FORM_WIZARD_START + 84
+{
+ Text [ en-US ] = "Arrange controls";
+};
+
+String RID_DB_FORM_WIZARD_START + 85
+{
+ Text [ en-US ] = "Set data entry";
+};
+
+String RID_DB_FORM_WIZARD_START + 86
+{
+ Text [ en-US ] = "Apply styles";
+};
+
+String RID_DB_FORM_WIZARD_START + 87
+{
+ Text [ en-US ] = "Set name";
+};
+
+String RID_DB_FORM_WIZARD_START + 88
+{
+ Text [ en-US ] = "(Date)";
+};
+
+String RID_DB_FORM_WIZARD_START + 89
+{
+ Text [ en-US ] = "(Time)";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 90
+{
+ Text [ en-US ] = "Select the fields of your form";
+};
+
+
+String RID_DB_FORM_WIZARD_START + 91
+{
+ Text [ en-US ] = "Decide if you want to set up a subform";
+};
+
+String RID_DB_FORM_WIZARD_START + 92
+{
+ Text [ en-US ] = "Select the fields of your subform";
+};
+
+String RID_DB_FORM_WIZARD_START + 93
+{
+ Text [ en-US ] = "Select the joins between your forms";
+};
+
+String RID_DB_FORM_WIZARD_START + 94
+{
+ Text [ en-US ] = "Arrange the controls on your form";
+};
+
+String RID_DB_FORM_WIZARD_START + 95
+{
+ Text [ en-US ] = "Select the data entry mode";
+};
+
+String RID_DB_FORM_WIZARD_START + 96
+{
+ Text [ en-US ] = "Apply the style of your form";
+};
+
+String RID_DB_FORM_WIZARD_START + 97
+{
+ Text [ en-US ] = "Set the name of the form";
+};
+
+String RID_DB_FORM_WIZARD_START + 98
+{
+ Text [ en-US ] = "A form with the name '%FORMNAME' already exists.\nChoose another name.";
+};
+
+
+// ============================================================================
+
+String RID_DB_QUERY_WIZARD_START + 0
+{
+ Text [ en-US ] = "Query Wizard";
+};
+
+String RID_DB_QUERY_WIZARD_START + 1
+{
+ Text [ en-US] = "Query";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 2
+{
+ Text [ en-US] = "Query Wizard";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 3
+{
+ Text [ en-US] = "~Tables";
+};
+
+String RID_DB_QUERY_WIZARD_START + 4
+{
+ Text [ en-US] = "A~vailable fields";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 5
+{
+ Text [ en-US] = "Name ~of the query";
+};
+
+String RID_DB_QUERY_WIZARD_START + 6
+{
+ Text [ en-US] = "Display ~Query";
+};
+
+String RID_DB_QUERY_WIZARD_START + 7
+{
+ Text [ en-US] = "~Modify Query";
+};
+
+String RID_DB_QUERY_WIZARD_START + 8
+{
+ Text [ en-US] = "~How do you want to proceed after creating the query?";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 9
+{
+ Text [ en-US] = "Match ~all of the following";
+};
+
+String RID_DB_QUERY_WIZARD_START + 10
+{
+ Text [ en-US] = "~Match any of the following";
+};
+
+String RID_DB_QUERY_WIZARD_START + 11
+{
+ Text [ en-US] = "~Detailed query (Shows all records of the query.)";
+};
+
+String RID_DB_QUERY_WIZARD_START + 12
+{
+ Text [ en-US] = "~Summary query (Shows only results of aggregate functions.)";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 16
+{
+ Text [ en-US] = "Aggregate functions";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 17
+{
+ Text [ en-US] = "Fields";
+};
+
+String RID_DB_QUERY_WIZARD_START + 18
+{
+ Text [ en-US] = "~Group by";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 19
+{
+ Text [ en-US] = "Field";
+};
+
+String RID_DB_QUERY_WIZARD_START + 20
+{
+ Text [ en-US] = "Alias";
+};
+
+String RID_DB_QUERY_WIZARD_START + 21
+{
+ Text [ en-US] = "Table: ";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 22
+{
+ Text [ en-US] = "Query: ";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 24
+{
+ Text [ en-US] = "Condition";
+};
+
+String RID_DB_QUERY_WIZARD_START + 25
+{
+ Text [ en-US] = "Value";
+};
+
+// --------------------------------------
+// don't change anything to the next 10 values
+// they are list elements and need to be as follows
+String RID_DB_QUERY_WIZARD_START + 26
+{
+ Text [ en-US] = "is equal to";
+};
+
+String RID_DB_QUERY_WIZARD_START + 27
+{
+ Text [ en-US] = "is not equal to";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 28
+{
+ Text [ en-US] = "is smaller than";
+};
+
+String RID_DB_QUERY_WIZARD_START + 29
+{
+ Text [ en-US] = "is greater than";
+};
+
+String RID_DB_QUERY_WIZARD_START + 30
+{
+ Text [ en-US] = "is equal or less than ";
+};
+
+String RID_DB_QUERY_WIZARD_START + 31
+{
+ Text [ en-US] = "is equal or greater than";
+};
+
+String RID_DB_QUERY_WIZARD_START + 32
+{
+ Text [ en-US] = "like";
+};
+
+String RID_DB_QUERY_WIZARD_START + 33
+{
+ Text [ en-US] = "not like";
+};
+
+String RID_DB_QUERY_WIZARD_START + 34
+{
+ Text [ en-US] = "is null";
+};
+
+String RID_DB_QUERY_WIZARD_START + 35
+{
+ Text [ en-US] = "is not null";
+};
+// --------------------------------------
+
+String RID_DB_QUERY_WIZARD_START + 36
+{
+ Text [ en-US] = "true";
+};
+
+String RID_DB_QUERY_WIZARD_START + 37
+{
+ Text [ en-US] = "false";
+};
+
+String RID_DB_QUERY_WIZARD_START + 38
+{
+ Text [ en-US] = "and";
+};
+
+String RID_DB_QUERY_WIZARD_START + 39
+{
+ Text [ en-US] = "or";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 40
+{
+ Text [ en-US] = "get the sum of";
+};
+
+String RID_DB_QUERY_WIZARD_START + 41
+{
+ Text [ en-US] = "get the average of";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 42
+{
+ Text [ en-US] = "get the minimum of";
+};
+
+String RID_DB_QUERY_WIZARD_START + 43
+{
+ Text [ en-US] = "get the maximum of";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 44
+{
+ Text [ en-US] = "get the sum of <FIELD>";
+};
+
+String RID_DB_QUERY_WIZARD_START + 45
+{
+ Text [ en-US] = "get the average of <FIELD>";
+};
+
+String RID_DB_QUERY_WIZARD_START + 46
+{
+ Text [ en-US] = "get the minimum of <FIELD>";
+};
+
+String RID_DB_QUERY_WIZARD_START + 47
+{
+ Text [ en-US] = "get the maximum of <FIELD>";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 48
+{
+ Text [ en-US] = "(none)";
+};
+
+String RID_DB_QUERY_WIZARD_START + 50
+{
+ Text [ en-US] = "Fie~lds in the Query: ";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 51
+{
+ Text [ en-US] = "Sorting order: ";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 52
+{
+ Text [ en-US] = "No sorting fields were assigned.";
+ };
+
+
+String RID_DB_QUERY_WIZARD_START + 53
+{
+ Text [ en-US] = "Search conditions: ";
+ };
+
+String RID_DB_QUERY_WIZARD_START + 54
+{
+ Text [ en-US] = "No conditions were assigned.";
+ };
+
+
+String RID_DB_QUERY_WIZARD_START + 55
+{
+ Text [ en-US] = "Aggregate functions: ";
+ };
+
+
+String RID_DB_QUERY_WIZARD_START + 56
+{
+ Text [ en-US] = "No aggregate functions were assigned.";
+ };
+
+
+String RID_DB_QUERY_WIZARD_START + 57
+{
+ Text [ en-US] = "Grouped by: ";
+};
+
+String RID_DB_QUERY_WIZARD_START + 58
+{
+ Text [ en-US] = "No Groups were assigned.";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 59
+{
+ Text [ en-US ] = "Grouping conditions: ";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 60
+{
+ Text [ en-US] = "No grouping conditions were assigned.";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 70
+{
+ Text [ en-US] = "Select the fields (columns) for your query";
+};
+
+String RID_DB_QUERY_WIZARD_START + 71
+{
+ Text [ en-US] = "Select the sorting order";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 72
+{
+ Text [ en-US] = "Select the search conditions";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 73
+{
+ Text [ en-US] = "Select the type of query";
+};
+
+String RID_DB_QUERY_WIZARD_START + 74
+{
+ Text [ en-US] = "Select the groups";
+};
+
+String RID_DB_QUERY_WIZARD_START + 75
+{
+ Text [ en-US] = "Select the grouping conditions";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 76
+{
+ Text [ en-US] = "Assign aliases if desired";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 77
+{
+ Text [ en-US] = "Check the overview and decide how to proceed";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 80
+{
+ Text [ en-US] = "Field selection";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 81
+{
+ Text [ en-US] = "Sorting order";
+};
+
+String RID_DB_QUERY_WIZARD_START + 82
+{
+ Text [ en-US] = "Search conditions";
+};
+
+String RID_DB_QUERY_WIZARD_START + 83
+{
+ Text [ en-US] = "Detail or summary";
+};
+
+String RID_DB_QUERY_WIZARD_START + 84
+{
+ Text [ en-US] = "Grouping";
+};
+
+String RID_DB_QUERY_WIZARD_START + 85
+{
+ Text [ en-US] = "Grouping conditions";
+};
+
+String RID_DB_QUERY_WIZARD_START + 86
+{
+ Text [ en-US] = "Aliases";
+};
+
+String RID_DB_QUERY_WIZARD_START + 87
+{
+ Text [ en-US] = "Overview";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 88
+{
+ Text [ en-US] = "A field that has not been assigned an aggregate function must be used in a group.";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 89
+{
+ Text [ en-US] = "The condition '<FIELDNAME> <LOGICOPERATOR> <VALUE>' was chosen twice. Each condition can only be chosen once";
+};
+
+String RID_DB_QUERY_WIZARD_START + 90
+{
+ Text [ en-US] = "The aggregate function <FUNCTION> has been assigned twice to the fieldname '<NUMERICFIELD>'.";
+};
+
+String RID_DB_QUERY_WIZARD_START + 91
+{
+ Text [ en-US] = ", ";
+};
+
+String RID_DB_QUERY_WIZARD_START + 92
+{
+ Text [ en-US] = "<FIELDTITLE> (<FIELDNAME>)";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 93
+{
+ Text [ en-US] = "<FIELDNAME> (<SORTMODE>)";
+};
+
+String RID_DB_QUERY_WIZARD_START + 94
+{
+ Text [ en-US] = "<FIELDNAME> <LOGICOPERATOR> <VALUE>";
+};
+
+String RID_DB_QUERY_WIZARD_START + 95
+{
+ Text [ en-US] = "<CALCULATEDFUNCTION> <FIELDNAME>";
+};
+
+
+String RID_DB_QUERY_WIZARD_START + 96
+{
+ Text [ en-US] = "<FIELDNAME> <LOGICOPERATOR> <VALUE>";
+};
+
+
+
+
+// ============================================================================
+
+String RID_DB_REPORT_WIZARD_START + 0
+{
+ Text [ en-US ] = "Report Wizard";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 3
+{
+ Text [ en-US ] = "~Table";
+};
+
+String RID_DB_REPORT_WIZARD_START + 4
+{
+ Text [ en-US ] = "Colu~mns";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 7
+{
+ Text [ en-US ] = "Report_";
+};
+
+String RID_DB_REPORT_WIZARD_START + 8
+{
+ Text [ en-US ] = "- undefined -";
+};
+
+String RID_DB_REPORT_WIZARD_START + 9
+{
+ Text [ en-US ] = "~Fields in report";
+};
+
+
+
+String RID_DB_REPORT_WIZARD_START + 11
+{
+ Text [ en-US ] = "Grouping";
+};
+
+String RID_DB_REPORT_WIZARD_START + 12
+{
+ Text [ en-US ] = "Sort options";
+};
+
+String RID_DB_REPORT_WIZARD_START + 13
+{
+ Text [ en-US ] = "Choose layout";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 14
+{
+ Text [ en-US ] = "Create report";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 15
+{
+ Text [ en-US ] = "Layout of data";
+};
+
+String RID_DB_REPORT_WIZARD_START + 16
+{
+ Text [ en-US ] = "Layout of headers and footers";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 19
+{
+ Text [ en-US ] = "Fields";
+};
+
+String RID_DB_REPORT_WIZARD_START + 20
+{
+ Text [ en-US ] = "~Sort by";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 21
+{
+ Text [ en-US ] = "T~hen by";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 22
+{
+ Text [ en-US ] = "Orientation";
+};
+
+String RID_DB_REPORT_WIZARD_START + 23
+{
+ Text [ en-US ] = "Portrait";
+};
+
+String RID_DB_REPORT_WIZARD_START + 24
+{
+ Text [ en-US ] = "Landscape";
+};
+
+
+
+String RID_DB_REPORT_WIZARD_START + 28
+{
+ Text [ en-US ] = "Which fields do you want to have in your report?";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 29
+{
+ Text [ en-US ] = "Do you want to add grouping levels?";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 30
+{
+ Text [ en-US ] = "According to which fields do you want to sort the data?";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 31
+{
+ Text [ en-US ] = "How do you want your report to look?";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 32
+{
+ Text [ en-US ] = "Decide how you want to proceed";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 33
+{
+ Text [ en-US ] = "Title of report";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 34
+{
+ Text [ en-US ] = "Display report";
+};
+
+String RID_DB_REPORT_WIZARD_START + 35
+{
+ Text [ en-US ] = "Create report";
+};
+
+String RID_DB_REPORT_WIZARD_START + 36
+{
+ Text [ en-US ] = "Ascending";
+};
+
+String RID_DB_REPORT_WIZARD_START + 37
+{
+ Text [ en-US ] = "Descending";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 40
+{
+ Text [ en-US ] = "~Dynamic report";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 41
+{
+ Text [ en-US ] = "~Create report now";
+};
+
+String RID_DB_REPORT_WIZARD_START + 42
+{
+ Text [ en-US ] = "~Modify report layout";
+};
+
+String RID_DB_REPORT_WIZARD_START + 43
+{
+ Text [ en-US ] = "Static report";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 44
+{
+ Text [ en-US ] = "Save as";
+};
+
+
+
+String RID_DB_REPORT_WIZARD_START + 50
+{
+ Text [ en-US ] = "Groupings";
+};
+
+String RID_DB_REPORT_WIZARD_START + 51
+{
+ Text [ en-US ] = "Then b~y";
+};
+
+String RID_DB_REPORT_WIZARD_START + 52
+{
+ Text [ en-US ] = "~Then by";
+};
+
+String RID_DB_REPORT_WIZARD_START + 53
+{
+ Text [ en-US ] = "Asc~ending";
+};
+
+String RID_DB_REPORT_WIZARD_START + 54
+{
+ Text [ en-US ] = "Ascend~ing";
+};
+
+String RID_DB_REPORT_WIZARD_START + 55
+{
+ Text [ en-US ] = "Ascendin~g";
+};
+
+String RID_DB_REPORT_WIZARD_START + 56
+{
+ Text [ en-US ] = "De~scending";
+};
+
+String RID_DB_REPORT_WIZARD_START + 57
+{
+ Text [ en-US ] = "Des~cending";
+};
+
+String RID_DB_REPORT_WIZARD_START + 58
+{
+ Text [ en-US ] = "De~scending";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 60
+{
+ Text [ en-US ] = "Binary fields cannot be displayed in the report.";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 61
+{
+ Text [ en-US ] = "The table '<TABLENAME>' does not exist.";
+};
+
+String RID_DB_REPORT_WIZARD_START + 62
+{
+ Text [ en-US ] = "Creating Report...";
+};
+
+String RID_DB_REPORT_WIZARD_START + 63
+{
+ Text [ en-US ] = "Number of records inserted: <COUNT>";
+};
+
+String RID_DB_REPORT_WIZARD_START + 64
+{
+ Text [ en-US ] = "The form '<REPORTFORM>' does not exist.";
+};
+
+String RID_DB_REPORT_WIZARD_START + 65
+{
+ Text [ en-US ] = "The query with the statement <BR>'<STATEMENT>' <BR> could not be run. <BR> Check your data source.";
+};
+
+String RID_DB_REPORT_WIZARD_START + 66
+{
+ Text [ en-US ] = "The following hidden control in the form '<REPORTFORM>' could not be read: '<CONTROLNAME>'.";
+};
+
+String RID_DB_REPORT_WIZARD_START + 67
+{
+ Text [ en-US ] = "Importing data...";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 68
+{
+ Text [ en-US ] = "Labeling fields";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 69
+{
+ Text [ en-US ] = "How do you want to label the fields?";
+};
+
+String RID_DB_REPORT_WIZARD_START + 70
+{
+ Text [ en-US ] = "Label";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 71
+{
+ Text [ en-US ] = "Field";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 72
+{
+ Text [ en-US ] = "An error occurred in the wizard.<BR>The template '%PATH' could be erroneous.<BR>Either the required sections or tables do not exist or exist under the wrong name.<BR>See the Help for more detailed information.<BR>Please select another template.";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 73
+{
+ Text [ en-US ] = "There is an invalid user field in a table.";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 74
+{
+ Text [ en-US ] = "The sort criterium '<FIELDNAME>' was chosen twice. Each criterium can only be chosen once.";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 75
+{
+ Text [ en-US ] = "Note: The dummy text will be replaced by data from the database when the report is created.";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 76
+{
+ Text [ en-US ] = "A report '%REPORTNAME' already exists in the database. Please assign another name.";
+};
+
+
+String RID_DB_REPORT_WIZARD_START + 78
+{
+ Text [ en-US ] = "How do you want to proceed after creating the report?";
+};
+
+String RID_DB_REPORT_WIZARD_START + 79
+{
+ Text [ en-US ] = "What kind of report do you want to create?";
+};
+
+String RID_DB_REPORT_WIZARD_START + 80
+{
+ Text [ en-US ] = "Tabular";
+};
+String RID_DB_REPORT_WIZARD_START + 81
+{
+ Text [ en-US ] = "Columnar, single-column";
+};
+String RID_DB_REPORT_WIZARD_START + 82
+{
+ Text [ en-US ] = "Columnar, two columns";
+};
+String RID_DB_REPORT_WIZARD_START + 83
+{
+ Text [ en-US ] = "Columnar, three columns";
+};
+String RID_DB_REPORT_WIZARD_START + 84
+{
+ Text [ en-US ] = "In blocks, labels left";
+};
+String RID_DB_REPORT_WIZARD_START + 85
+{
+ Text [ en-US ] = "In blocks, labels above";
+};
+String RID_DB_REPORT_WIZARD_START + 86
+{
+ Text [ en-US ] = "Title:";
+};
+String RID_DB_REPORT_WIZARD_START + 87
+{
+ Text [ en-US ] = "Author:";
+};
+String RID_DB_REPORT_WIZARD_START + 88
+{
+ Text [ en-US ] = "Date:";
+};
+String RID_DB_REPORT_WIZARD_START + 89
+{
+ Text [ en-US ] = "Page #page# of #count#";
+ Text [ x-comment ] = "Please don't translate the words #page# and #count#, these are placeholders.";
+};
+String RID_DB_REPORT_WIZARD_START + 90
+{
+ Text [ en-US ] = "Page number:";
+};
+String RID_DB_REPORT_WIZARD_START + 91
+{
+ Text [ en-US ] = "Page count:";
+};
+String RID_DB_REPORT_WIZARD_START + 92
+{
+ Text [ en-US ] = "No valid report template was found.";
+};
+
+// ============================================================================
+
+String RID_DB_TABLE_WIZARD_START + 1
+{
+ Text [ en-US] = "Table Wizard";
+};
+
+String RID_DB_TABLE_WIZARD_START + 2
+{
+ Text [ en-US] = "Select fields";
+};
+
+String RID_DB_TABLE_WIZARD_START + 3
+{
+ Text [ en-US] = "Set types and formats";
+};
+
+String RID_DB_TABLE_WIZARD_START + 4
+{
+ Text [ en-US] = "Set primary key";
+};
+
+String RID_DB_TABLE_WIZARD_START + 5
+{
+ Text [ en-US] = "Create table";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 8
+{
+ Text [ en-US] = "Select fields for your table";
+};
+
+String RID_DB_TABLE_WIZARD_START + 9
+{
+ Text [ en-US] = "Set field types and formats";
+};
+
+String RID_DB_TABLE_WIZARD_START + 10
+{
+ Text [ en-US] = "Set primary key";
+};
+
+String RID_DB_TABLE_WIZARD_START + 11
+{
+ Text [ en-US] = "Create table";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 14
+{
+ Text [ en-US] = "This wizard helps you to create a table for your database. After selecting a table category and a sample table, choose the fields you want to include in your table. You can include fields from more than one sample table.";
+};
+
+String RID_DB_TABLE_WIZARD_START + 15
+{
+ Text [ en-US] = "Ca~tegory";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 16
+{
+ Text [ en-US] = "B~usiness";
+};
+
+String RID_DB_TABLE_WIZARD_START + 17
+{
+ Text [ en-US] = "P~ersonal";
+};
+
+String RID_DB_TABLE_WIZARD_START + 18
+{
+ Text [ en-US] = "~Sample tables";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 19
+{
+ Text [ en-US] = "A~vailable fields";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 20
+{
+ Text [ en-US] = "Field information";
+};
+
+String RID_DB_TABLE_WIZARD_START + 21
+{
+ Text [ en-US] = "+";
+};
+
+String RID_DB_TABLE_WIZARD_START + 22
+{
+ Text [ en-US] = "-";
+};
+
+String RID_DB_TABLE_WIZARD_START + 23
+{
+ Text [ en-US] = "Field name";
+};
+
+String RID_DB_TABLE_WIZARD_START + 24
+{
+ Text [ en-US] = "Field type";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 25
+{
+ Text [ en-US] = "~Selected fields";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 26
+{
+ Text [ en-US] = "A primary key uniquely identifies each record in a database table. Primary keys ease the linking of information in separate tables, and it is recommended that you have a primary key in every table. Without a primary key, it will not be possible to enter data into this table.";
+};
+
+String RID_DB_TABLE_WIZARD_START + 27
+{
+ Text [ en-US] = "~Create a primary key";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 28
+{
+ Text [ en-US] = "~Automatically add a primary key";
+};
+
+String RID_DB_TABLE_WIZARD_START + 29
+{
+ Text [ en-US] = "~Use an existing field as a primary key";
+};
+
+String RID_DB_TABLE_WIZARD_START + 30
+{
+ Text [ en-US] = "Define p~rimary key as a combination of several fields ";
+};
+
+String RID_DB_TABLE_WIZARD_START + 31
+{
+ Text [ en-US] = "F~ieldname";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 32
+{
+ Text [ en-US] = "~Primary key fields";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 33
+{
+ Text [ en-US] = "Auto ~value";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 34
+{
+ Text [ en-US] = "What do you want to name your table?";
+};
+
+String RID_DB_TABLE_WIZARD_START + 35
+{
+ Text [ en-US] = "Congratulations. You have entered all the information needed to create your table.";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 36
+{
+ Text [ en-US] = "What do you want to do next?";
+};
+
+String RID_DB_TABLE_WIZARD_START + 37
+{
+ Text [ en-US] = "Modify the table design";
+};
+
+String RID_DB_TABLE_WIZARD_START + 38
+{
+ Text [ en-US] = "Insert data immediately";
+};
+
+String RID_DB_TABLE_WIZARD_START + 39
+{
+ Text [ en-US] = "C~reate a form based on this table";
+};
+
+String RID_DB_TABLE_WIZARD_START + 40
+{
+ Text [ en-US] = "The table you have created could not be opened.";
+};
+
+String RID_DB_TABLE_WIZARD_START + 41
+{
+ Text [ en-US] = "The table name '%TABLENAME' contains a character ('%SPECIALCHAR') that might not be supported by the database.";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 42
+{
+ Text [ en-US] = "The field name '%FIELDNAME' contains a special character ('%SPECIALCHAR') that might not be supported by the database.";
+};
+
+
+String RID_DB_TABLE_WIZARD_START + 43
+{
+ Text [ en-US] = "Field";
+};
+
+String RID_DB_TABLE_WIZARD_START + 44
+{
+ Text [ en-US] = "MyTable";
+};
+
+String RID_DB_TABLE_WIZARD_START + 45
+{
+ Text [ en-US] = "Add a Field";
+};
+
+String RID_DB_TABLE_WIZARD_START + 46
+{
+ Text [ en-US] = "Remove the selected Field";
+};
+
+String RID_DB_TABLE_WIZARD_START + 47
+{
+ Text [ en-US] = "The field cannot be inserted because this would exceed the maximum number of %COUNT possible fields in the database table";
+};
+
+String RID_DB_TABLE_WIZARD_START + 48
+{
+ Text [ en-US] = "The name '%TABLENAME' already exists.\nPlease enter another name.";
+};
+
+String RID_DB_TABLE_WIZARD_START + 49
+{
+ Text [ en-US] = "Catalog of the table";
+};
+
+String RID_DB_TABLE_WIZARD_START + 50
+{
+ Text [ en-US] = "Schema of the table";
+};
+
+String RID_DB_TABLE_WIZARD_START + 51
+{
+ Text [ en-US] = "The field '%FIELDNAME' already exists.";
+};
+
+
+
+// ============================================================================
+// ============================ ======================
+// ====================== LETTER WIZARD RESOURCES ================
+// ============================ ======================
+// ============================================================================
+
+
+String RID_LETTERWIZARDDIALOG_START + 1
+{
+ Text [ en-US] = "Letter Wizard";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 2
+{
+ Text [ en-US] = "Label9";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 3
+{
+ Text [ en-US] = "~Business letter";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 4
+{
+ Text [ en-US] = "~Formal personal letter";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 5
+{
+ Text [ en-US] = "~Personal letter";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 6
+{
+ Text [ en-US] = "~Use letterhead paper with pre-printed elements";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 7
+{
+ Text [ en-US] = "~Logo";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 8
+{
+ Text [ en-US] = "Return address";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 9
+{
+ Text [ en-US] = "~Include footer";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 10
+{
+ Text [ en-US] = "~Return address in envelope window";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 11
+{
+ Text [ en-US] = "~Logo";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 12
+{
+ Text [ en-US] = "~Return address in envelope window";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 13
+{
+ Text [ en-US] = "Letter Signs";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 14
+{
+ Text [ en-US] = "S~ubject line";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 15
+{
+ Text [ en-US] = "Salu~tation";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 16
+{
+ Text [ en-US] = "Fold ~marks";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 17
+{
+ Text [ en-US] = "~Complimentary close";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 18
+{
+ Text [ en-US] = "~Footer";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 19
+{
+ Text [ en-US] = "~Use user data for return address";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 20
+{
+ Text [ en-US] = "~New sender address:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 21
+{
+ Text [ en-US] = "Use placeholders for ~recipient's address";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 22
+{
+ Text [ en-US] = "Use address database for ~mail merge";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 23
+{
+ Text [ en-US] = "Include ~only on second and following pages";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 24
+{
+ Text [ en-US] = "~Include page number";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 25
+{
+ Text [ en-US] = "Letter Template";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 26
+{
+ Text [ en-US] = "Create a ~letter from this template";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 27
+{
+ Text [ en-US] = "Make ~manual changes to this letter template";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 28
+{
+ Text [ en-US] = "Page design";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 29
+{
+ Text [ en-US] = "Page design";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 30
+{
+ Text [ en-US] = "Page design";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 31
+{
+ Text [ en-US] = "This wizard helps you to create a letter template. You can then use the template as the basis for writing letters as often as desired.";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 32
+{
+ Text [ en-US] = "~Height:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 33
+{
+ Text [ en-US] = "~Width:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 34
+{
+ Text [ en-US] = "S~pacing to left margin:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 35
+{
+ Text [ en-US] = "Spacing ~to top margin:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 36
+{
+ Text [ en-US] = "Height:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 37
+{
+ Text [ en-US] = "Width:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 38
+{
+ Text [ en-US] = "S~pacing to left margin:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 39
+{
+ Text [ en-US] = "Spacing ~to top margin:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 40
+{
+ Text [ en-US] = "Height:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 41
+{
+ Text [ en-US] = "Use a typical letter format for this country:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 42
+{
+ Text [ en-US] = "Sender's address";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 43
+{
+ Text [ en-US] = "Name:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 44
+{
+ Text [ en-US] = "Street:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 45
+{
+ Text [ en-US] = "ZIP code/State/City:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 46
+{
+ Text [ en-US] = "Recipient's address";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 47
+{
+ Text [ en-US] = "Footer";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 48
+{
+ Text [ en-US] = "This wizard creates a letter template which enables you to create multiple letters with the same layout and settings.";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 49
+{
+ Text [ en-US] = "To create another new letter out of the template just navigate to the template location and double-click it.";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 50
+{
+ Text [ en-US] = "Template name:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 51
+{
+ Text [ en-US] = "Location and file name:";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 52
+{
+ Text [ en-US] = "How do you want to proceed?";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 53
+{
+ Text [ en-US] = "Please choose the type of letter and page design";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 54
+{
+ Text [ en-US] = "Select the items to be printed";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 55
+{
+ Text [ en-US] = "Specify items already on your letterhead paper";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 56
+{
+ Text [ en-US] = "Specify the sender and recipient information";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 57
+{
+ Text [ en-US] = "Fill in the information you would like in the footer";
+};
+
+String RID_LETTERWIZARDDIALOG_START + 58
+{
+ Text [ en-US] = "Please specify last settings";
+};
+
+//====================== Letter Wizard Greeting Start
+String RID_LETTERWIZARDSALUTATION_START + 1
+{
+ Text [ en-US] = "To Whom it May Concern";
+};
+
+String RID_LETTERWIZARDSALUTATION_START + 2
+{
+ Text [ en-US] = "Dear Sir or Madam";
+};
+
+String RID_LETTERWIZARDSALUTATION_START + 3
+{
+ Text [ en-US] = "Hello";
+};
+
+//====================== Letter Wizard Greeting Start
+String RID_LETTERWIZARDGREETING_START + 1
+{
+ Text [ en-US] = "Sincerely";
+};
+
+String RID_LETTERWIZARDGREETING_START + 2
+{
+ Text [ en-US] = "Best regards";
+};
+
+String RID_LETTERWIZARDGREETING_START + 3
+{
+ Text [ en-US] = "Cheers";
+};
+
+
+//====================== Letter Wizard Roadmap Start
+String RID_LETTERWIZARDROADMAP_START + 1
+{
+ Text [ en-US] = "Page design";
+};
+
+String RID_LETTERWIZARDROADMAP_START + 2
+{
+ Text [ en-US] = "Letterhead layout";
+};
+
+String RID_LETTERWIZARDROADMAP_START + 3
+{
+ Text [ en-US] = "Printed items";
+};
+
+String RID_LETTERWIZARDROADMAP_START + 4
+{
+ Text [ en-US] = "Recipient and sender";
+};
+
+String RID_LETTERWIZARDROADMAP_START + 5
+{
+ Text [ en-US] = "Footer";
+};
+
+String RID_LETTERWIZARDROADMAP_START + 6
+{
+ Text [ en-US] = "Name and location";
+};
+
+
+// ============================================================================
+// ============================ ======================
+// ====================== FAX WIZARD RESOURCES ================
+// ============================ ======================
+// ============================================================================
+
+
+String RID_FAXWIZARDDIALOG_START + 1
+{
+ Text [ en-US] = "Fax Wizard";
+};
+
+String RID_FAXWIZARDDIALOG_START + 2
+{
+ Text [ en-US] = "Label9";
+};
+
+String RID_FAXWIZARDDIALOG_START + 3
+{
+ Text [ en-US] = "~Business Fax";
+};
+
+String RID_FAXWIZARDDIALOG_START + 4
+{
+ Text [ en-US] = "~Personal Fax";
+};
+
+String RID_FAXWIZARDDIALOG_START + 5
+{
+ Text [ en-US] = "~Logo";
+};
+
+String RID_FAXWIZARDDIALOG_START + 6
+{
+ Text [ en-US] = "S~ubject line";
+};
+
+String RID_FAXWIZARDDIALOG_START + 7
+{
+ Text [ en-US] = "S~alutation";
+};
+
+String RID_FAXWIZARDDIALOG_START + 8
+{
+ Text [ en-US] = "~Complimentary close";
+};
+
+String RID_FAXWIZARDDIALOG_START + 9
+{
+ Text [ en-US] = "~Footer";
+};
+
+String RID_FAXWIZARDDIALOG_START + 10
+{
+ Text [ en-US] = "~Use user data for return address";
+};
+
+String RID_FAXWIZARDDIALOG_START + 11
+{
+ Text [ en-US] = "~New return address";
+};
+
+String RID_FAXWIZARDDIALOG_START + 12
+{
+ Text [ en-US] = "My Fax Template";
+};
+
+String RID_FAXWIZARDDIALOG_START + 13
+{
+ Text [ en-US] = "Create a ~fax from this template";
+};
+
+String RID_FAXWIZARDDIALOG_START + 14
+{
+ Text [ en-US] = "Make ~manual changes to this fax template";
+};
+
+String RID_FAXWIZARDDIALOG_START + 15
+{
+ Text [ en-US] = "Page design";
+};
+
+String RID_FAXWIZARDDIALOG_START + 16
+{
+ Text [ en-US] = "Page design";
+};
+
+String RID_FAXWIZARDDIALOG_START + 17
+{
+ Text [ en-US] = "This wizard helps you to create a fax template. The template can then be used to create a fax whenever needed.";
+};
+
+String RID_FAXWIZARDDIALOG_START + 18
+{
+ Text [ en-US] = "Return address";
+};
+
+String RID_FAXWIZARDDIALOG_START + 19
+{
+ Text [ en-US] = "Name:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 20
+{
+ Text [ en-US] = "Street:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 21
+{
+ Text [ en-US] = "ZIP code/State/City:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 22
+{
+ Text [ en-US] = "Footer";
+};
+
+String RID_FAXWIZARDDIALOG_START + 23
+{
+ Text [ en-US] = "This wizard creates a fax template which enables you to create multiple faxes with the same layout and settings.";
+};
+
+String RID_FAXWIZARDDIALOG_START + 24
+{
+ Text [ en-US] = "To create another new fax out of the template, go to the location where you saved the template and double-click the file.";
+};
+
+String RID_FAXWIZARDDIALOG_START + 25
+{
+ Text [ en-US] = "Template Name:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 26
+{
+ Text [ en-US] = "Location and file name:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 27
+{
+ Text [ en-US] = "What do you want to do next?";
+};
+
+String RID_FAXWIZARDDIALOG_START + 28
+{
+ Text [ en-US] = "Choose the type of fax and a page design";
+};
+
+String RID_FAXWIZARDDIALOG_START + 29
+{
+ Text [ en-US] = "Select items to include in the fax template";
+};
+
+String RID_FAXWIZARDDIALOG_START + 30
+{
+ Text [ en-US] = "Specify sender and recipient information";
+};
+
+String RID_FAXWIZARDDIALOG_START + 31
+{
+ Text [ en-US] = "Enter text for the footer";
+};
+
+String RID_FAXWIZARDDIALOG_START + 32
+{
+ Text [ en-US] = "Choose a name and save the template";
+};
+
+String RID_FAXWIZARDDIALOG_START + 33
+{
+ Text [ en-US] = "Include ~only on second and following pages";
+};
+
+String RID_FAXWIZARDDIALOG_START + 34
+{
+ Text [ en-US] = "~Include page number";
+};
+
+String RID_FAXWIZARDDIALOG_START + 35
+{
+ Text [ en-US] = "~Date";
+};
+
+String RID_FAXWIZARDDIALOG_START + 36
+{
+ Text [ en-US] = "~Type of message";
+};
+
+String RID_FAXWIZARDDIALOG_START + 37
+{
+ Text [ en-US] = "Fax Number:";
+};
+
+String RID_FAXWIZARDDIALOG_START + 38
+{
+ Text [ en-US] = "Use placeholders for ~recipient's address";
+};
+
+String RID_FAXWIZARDDIALOG_START + 39
+{
+ Text [ en-US] = "Use address database for ~mail merge";
+};
+
+String RID_FAXWIZARDDIALOG_START + 40
+{
+ Text [ en-US] = "~New return address";
+};
+
+//====================== Fax Wizard Communication Start
+String RID_FAXWIZARDCOMMUNICATION_START + 1
+{
+ Text [ en-US] = "Important Information!";
+};
+
+String RID_FAXWIZARDCOMMUNICATION_START + 2
+{
+ Text [ en-US] = "For your information";
+};
+
+String RID_FAXWIZARDCOMMUNICATION_START + 3
+{
+ Text [ en-US] = "News!";
+};
+
+//====================== Fax Wizard Salutation Start
+String RID_FAXWIZARDSALUTATION_START + 1
+{
+ Text [ en-US] = "To whom it may concern,";
+};
+
+String RID_FAXWIZARDSALUTATION_START + 2
+{
+ Text [ en-US] = "Dear Sir or Madam,";
+};
+
+String RID_FAXWIZARDSALUTATION_START + 3
+{
+ Text [ en-US] = "Hello,";
+};
+
+String RID_FAXWIZARDSALUTATION_START + 4
+{
+ Text [ en-US] = "Hi,";
+};
+
+
+//====================== Fax Wizard Greeting Start
+String RID_FAXWIZARDGREETING_START + 1
+{
+ Text [ en-US] = "Sincerely";
+};
+
+String RID_FAXWIZARDGREETING_START + 2
+{
+ Text [ en-US] = "Yours faithfully";
+};
+
+String RID_FAXWIZARDGREETING_START + 3
+{
+ Text [ en-US] = "Regards";
+};
+
+String RID_FAXWIZARDGREETING_START + 4
+{
+ Text [ en-US] = "Love";
+};
+
+
+//====================== Fax Wizard Roadmap Start
+String RID_FAXWIZARDROADMAP_START + 1
+{
+ Text [ en-US] = "Page design";
+};
+
+String RID_FAXWIZARDROADMAP_START + 2
+{
+ Text [ en-US] = "Items to include";
+};
+
+String RID_FAXWIZARDROADMAP_START + 3
+{
+ Text [ en-US] = "Sender and Recipient";
+};
+
+String RID_FAXWIZARDROADMAP_START + 4
+{
+ Text [ en-US] = "Footer";
+};
+
+String RID_FAXWIZARDROADMAP_START + 5
+{
+ Text [ en-US] = "Name and location";
+};
+
+
+
+
+// ============================================================================
+// ============================ ======================
+// ====================== WEB WIZARD RESOURCES ================
+// ============================ ======================
+// ============================================================================
+
+
+String RID_WEBWIZARDDIALOG_START +1
+{
+ Text [ en-US ] = "Web Wizard";
+};
+
+String RID_WEBWIZARDDIALOG_START +2
+{
+ Text [ en-US ] = "This Web Wizard is to aid you in publishing documents on the Internet.\n\nIt will convert the documents so that they can be viewed by a web browser. In addition, it will generate a Table of Contents page with links for easy access to the documents. The Web Wizard will also allow you to customize the design and layout of your web site.\n\nYou will be able to keep the documents you have published on the web up-to-date and add or remove documents at any time.";
+};
+
+String RID_WEBWIZARDDIALOG_START +4
+{
+ Text [ en-US ] = "~Delete";
+};
+
+String RID_WEBWIZARDDIALOG_START +5
+{
+ Text [ en-US ] = "Introduction";
+};
+
+String RID_WEBWIZARDDIALOG_START +6
+{
+ Text [ en-US ] = "Select the documents you want to publish";
+};
+
+String RID_WEBWIZARDDIALOG_START +8
+{
+ Text [ en-US ] = "Document information ";
+};
+
+String RID_WEBWIZARDDIALOG_START +9
+{
+ Text [ en-US ] = "~Title:";
+};
+
+String RID_WEBWIZARDDIALOG_START +10
+{
+ Text [ en-US ] = "~Summary: ";
+};
+
+String RID_WEBWIZARDDIALOG_START +11
+{
+ Text [ en-US ] = "Au~thor:";
+};
+
+String RID_WEBWIZARDDIALOG_START +12
+{
+ Text [ en-US ] = "~Export to file format:";
+};
+
+String RID_WEBWIZARDDIALOG_START +13
+{
+ Text [ en-US ] = "Enter general information for your web site";
+};
+
+String RID_WEBWIZARDDIALOG_START +14
+{
+ Text [ en-US ] = "Title:";
+};
+
+String RID_WEBWIZARDDIALOG_START +16
+{
+ Text [ en-US ] = "Description:";
+};
+
+String RID_WEBWIZARDDIALOG_START +18
+{
+ Text [ en-US ] = "Created:";
+};
+
+String RID_WEBWIZARDDIALOG_START +20
+{
+ Text [ en-US ] = "E-mail:";
+};
+
+String RID_WEBWIZARDDIALOG_START +21
+{
+ Text [ en-US ] = "Copyright notice:";
+};
+
+String RID_WEBWIZARDDIALOG_START +22
+{
+ Text [ en-US ] = "Modified:";
+};
+
+
+String RID_WEBWIZARDDIALOG_START +24
+{
+ Text [ en-US ] = "~Preview";
+};
+
+String RID_WEBWIZARDDIALOG_START +25
+{
+ Text [ en-US ] = "Where do you want to publish your web site?";
+};
+
+String RID_WEBWIZARDDIALOG_START +26
+{
+ Text [ en-US ] = "Publish the new web site:";
+};
+
+String RID_WEBWIZARDDIALOG_START +27
+{
+ Text [ en-US ] = "To a ~local folder";
+};
+
+String RID_WEBWIZARDDIALOG_START +28
+{
+ Text [ en-US ] = "...";
+};
+
+String RID_WEBWIZARDDIALOG_START +29
+{
+ Text [ en-US ] = "To a ~web server via FTP";
+};
+
+String RID_WEBWIZARDDIALOG_START +31
+{
+ Text [ en-US ] = "~Configure...";
+};
+
+String RID_WEBWIZARDDIALOG_START +32
+{
+ Text [ en-US ] = "To a ZIP ~archive";
+};
+
+String RID_WEBWIZARDDIALOG_START +33
+{
+ Text [ en-US ] = "...";
+};
+
+String RID_WEBWIZARDDIALOG_START +34
+{
+ Text [ en-US ] = "~Save settings (recommended)";
+};
+
+String RID_WEBWIZARDDIALOG_START +35
+{
+ Text [ en-US ] = "Save ~as:";
+};
+
+String RID_WEBWIZARDDIALOG_START +36
+{
+ Text [ en-US ] = "~Choose settings for the Web Wizard";
+};
+
+String RID_WEBWIZARDDIALOG_START +37
+{
+ Text [ en-US ] = "Web site content ";
+};
+
+String RID_WEBWIZARDDIALOG_START +38
+{
+ Text [ en-US ] = "~Add...";
+};
+
+String RID_WEBWIZARDDIALOG_START +39
+{
+ Text [ en-US ] = "Remo~ve";
+};
+
+String RID_WEBWIZARDDIALOG_START +40
+{
+ Text [ en-US ] = "Choose a layout for the table of contents of your web site";
+};
+
+String RID_WEBWIZARDDIALOG_START +41
+{
+ Text [ en-US ] = "Select a style for the table of contents page";
+};
+
+String RID_WEBWIZARDDIALOG_START +42
+{
+ Text [ en-US ] = "~Style:";
+};
+
+String RID_WEBWIZARDDIALOG_START +48
+{
+ Text [ en-US ] = "~Layouts: ";
+};
+
+String RID_WEBWIZARDDIALOG_START +50
+{
+ Text [ en-US ] = "~Description";
+};
+
+String RID_WEBWIZARDDIALOG_START +51
+{
+ Text [ en-US ] = "~Author";
+};
+
+String RID_WEBWIZARDDIALOG_START +52
+{
+ Text [ en-US ] = "Cr~eation date";
+};
+
+String RID_WEBWIZARDDIALOG_START +53
+{
+ Text [ en-US ] = "~Last change date";
+};
+
+String RID_WEBWIZARDDIALOG_START +54
+{
+ Text [ en-US ] = "~File name";
+};
+
+String RID_WEBWIZARDDIALOG_START +55
+{
+ Text [ en-US ] = "File forma~t";
+};
+
+String RID_WEBWIZARDDIALOG_START +56
+{
+ Text [ en-US ] = "File format ~icon";
+};
+
+String RID_WEBWIZARDDIALOG_START +57
+{
+ Text [ en-US ] = "Number ~of pages";
+};
+
+String RID_WEBWIZARDDIALOG_START +58
+{
+ Text [ en-US ] = "~Size in KB";
+};
+
+String RID_WEBWIZARDDIALOG_START +59
+{
+ Text [ en-US ] = "Click 'Preview' to see a preview in your browser:";
+};
+
+String RID_WEBWIZARDDIALOG_START +60
+{
+ Text [ en-US ] = "Customize the selected layout";
+};
+
+String RID_WEBWIZARDDIALOG_START +61
+{
+ Text [ en-US ] = "Include the following information for each document in the table of contents:";
+};
+
+String RID_WEBWIZARDDIALOG_START +62
+{
+ Text [ en-US ] = "Optimize the layout for screen resolution:";
+};
+
+String RID_WEBWIZARDDIALOG_START +64
+{
+ Text [ en-US ] = "~640x480";
+};
+
+String RID_WEBWIZARDDIALOG_START +65
+{
+ Text [ en-US ] = "~800x600";
+};
+
+String RID_WEBWIZARDDIALOG_START +66
+{
+ Text [ en-US ] = "~1024x768";
+};
+
+String RID_WEBWIZARDDIALOG_START +70
+{
+ Text [ en-US ] = "Generating Your Web Site";
+};
+
+String RID_WEBWIZARDDIALOG_START +71
+{
+ Text [ en-US ] = "%START - %END/%TOTAL";
+};
+
+String RID_WEBWIZARDDIALOG_START +72
+{
+ Text [ en-US ] = "myWebsite";
+};
+
+String RID_WEBWIZARDDIALOG_START +73
+{
+ Text [ en-US ] = "FTP target '%FILENAME' is a file.";
+};
+
+
+String RID_WEBWIZARDDIALOG_START +74
+{
+ Text [ en-US ] = "The local target '%FILENAME' is a file.";
+};
+
+String RID_WEBWIZARDDIALOG_START +75
+{
+ Text [ en-US ] = "The ZIP target '%FILENAME' already exists. Do you want to overwrite the existing target? ";
+};
+
+String RID_WEBWIZARDDIALOG_START +76
+{
+ Text [ en-US ] = "The FTP target directory '%FILENAME' is not empty. Some files might be overwritten. Do you want to continue?";
+};
+
+String RID_WEBWIZARDDIALOG_START +77
+{
+ Text [ en-US ] = "The local target directory '%FILENAME' is not empty. Some files might be overwritten. Do you want to continue?";
+};
+
+String RID_WEBWIZARDDIALOG_START +78
+{
+ Text [ en-US ] = "Settings already exist under the given name. Do you want to overwrite the existing settings? ";
+};
+
+String RID_WEBWIZARDDIALOG_START +79
+{
+ Text [ en-US ] = "Exporting documents...";
+};
+
+String RID_WEBWIZARDDIALOG_START +80
+{
+ Text [ en-US ] = "Preparing export...";
+};
+
+String RID_WEBWIZARDDIALOG_START +81
+{
+ Text [ en-US ] = "Copying layout files...";
+};
+
+String RID_WEBWIZARDDIALOG_START +82
+{
+ Text [ en-US ] = "Preparing table of contents generation...";
+};
+
+String RID_WEBWIZARDDIALOG_START +83
+{
+ Text [ en-US ] = "Generating table of contents...";
+};
+
+String RID_WEBWIZARDDIALOG_START +84
+{
+ Text [ en-US ] = "Initializing...";
+};
+
+String RID_WEBWIZARDDIALOG_START +86
+{
+ Text [ en-US ] = "Preparing to publish...";
+};
+
+String RID_WEBWIZARDDIALOG_START +87
+{
+ Text [ en-US ] = "Publishing to local directory...";
+};
+
+String RID_WEBWIZARDDIALOG_START +88
+{
+ Text [ en-US ] = "Publishing to FTP destination...";
+};
+
+String RID_WEBWIZARDDIALOG_START +89
+{
+ Text [ en-US ] = "Publishing to a ZIP archive...";
+};
+
+String RID_WEBWIZARDDIALOG_START + 90
+{
+ Text [ en-US ] = "Finishing...";
+};
+
+String RID_WEBWIZARDDIALOG_START + 94
+{
+ Text [ en-US ] = "Graphic files";
+};
+
+String RID_WEBWIZARDDIALOG_START + 95
+{
+ Text [ en-US ] = "All files";
+};
+
+String RID_WEBWIZARDDIALOG_START + 96
+{
+ Text [ en-US ] = "~ZIP archive files";
+};
+
+String RID_WEBWIZARDDIALOG_START + 98
+{
+ Text [ en-US ] = "Background images";
+};
+
+String RID_WEBWIZARDDIALOG_START + 99
+{
+ Text [ en-US ] = "Choose a background image: ";
+};
+
+String RID_WEBWIZARDDIALOG_START + 100
+{
+ Text [ en-US ] = "Icon sets";
+};
+
+String RID_WEBWIZARDDIALOG_START + 101
+{
+ Text [ en-US ] = "Choose an icon set:";
+};
+
+String RID_WEBWIZARDDIALOG_START +102
+{
+ Text [ en-US ] = "Other...";
+};
+
+String RID_WEBWIZARDDIALOG_START +103
+{
+ Text [ en-US ] = "None";
+};
+
+String RID_WEBWIZARDDIALOG_START +104
+{
+ Text [ en-US ] = "Your web site was created successfully into: %FILENAME";
+};
+
+String RID_WEBWIZARDDIALOG_START +105
+{
+ Text [ en-US ] = "One or more errors occurred when generating the web site.";
+};
+
+String RID_WEBWIZARDDIALOG_START +106
+{
+ Text [ en-US ] = "An error occurred while generating the table of contents page(s). ";
+};
+
+String RID_WEBWIZARDDIALOG_START +107
+{
+ Text [ en-US ] = "An error occurred while copying the layout files. ";
+};
+
+String RID_WEBWIZARDDIALOG_START +108
+{
+ Text [ en-US ] = "An error occurred while gathering document information for '%FILENAME'. ";
+};
+
+String RID_WEBWIZARDDIALOG_START +109
+{
+ Text [ en-US ] = "An error occurred while exporting the document '%FILENAME'.";
+};
+
+String RID_WEBWIZARDDIALOG_START +110
+{
+ Text [ en-US ] = "An error occurred while creating a directory for exporting '%FILENAME'.";
+};
+
+String RID_WEBWIZARDDIALOG_START +111
+{
+ Text [ en-US ] = "A security error occurred while exporting the document '%FILENAME'.";
+};
+
+String RID_WEBWIZARDDIALOG_START +112
+{
+ Text [ en-US ] = "An input/output error occurred while exporting the document '%FILENAME'.";
+};
+
+String RID_WEBWIZARDDIALOG_START +113
+{
+ Text [ en-US ] = "An error occurred while copying media files to the temporary directory.";
+};
+
+String RID_WEBWIZARDDIALOG_START +114
+{
+ Text [ en-US ] = "The web site could not be copied to the following destination: %URL";
+};
+
+String RID_WEBWIZARDDIALOG_START +115
+{
+ Text [ en-US ] = "An unexpected error occurred: %ERROR";
+};
+
+String RID_WEBWIZARDDIALOG_START +116
+{
+ Text [ en-US ] = "An unexpected error occurred while validating the file: '%FILENAME'";
+};
+
+String RID_WEBWIZARDDIALOG_START +117
+{
+ Text [ en-US ] = "%FILENAME' is a folder.";
+};
+
+String RID_WEBWIZARDDIALOG_START +118
+{
+ Text [ en-US ] = "Loading Web Wizard Settings...";
+};
+
+String RID_WEBWIZARDDIALOG_START +119
+{
+ Text [ en-US ] = "An unexpected error occurred.";
+};
+
+String RID_WEBWIZARDDIALOG_START +120
+{
+ Text [ en-US ] = "Validating documents...";
+};
+
+String RID_WEBWIZARDDIALOG_START +121
+{
+ Text [ en-US ] = "My Archive";
+};
+
+String RID_WEBWIZARDDIALOG_START +122
+{
+ Text [ en-US ] = "Introduction ";
+};
+
+String RID_WEBWIZARDDIALOG_START +123
+{
+ Text [ en-US ] = "Documents ";
+};
+
+String RID_WEBWIZARDDIALOG_START +124
+{
+ Text [ en-US ] = "Main layout";
+};
+
+String RID_WEBWIZARDDIALOG_START +125
+{
+ Text [ en-US ] = "Layout details";
+};
+
+String RID_WEBWIZARDDIALOG_START +126
+{
+ Text [ en-US ] = "Style";
+};
+
+String RID_WEBWIZARDDIALOG_START +127
+{
+ Text [ en-US ] = "Web site information";
+};
+
+String RID_WEBWIZARDDIALOG_START +128
+{
+ Text [ en-US ] = "Preview";
+};
+
+String RID_WEBWIZARDDIALOG_START +130
+{
+ Text [ en-US ] = "The selected settings will be deleted.\n\nDo you really want to delete these settings? ";
+};
+
+String RID_WEBWIZARDDIALOG_START +131
+{
+ Text [ en-US ] = "%NUMBER pages";
+};
+
+String RID_WEBWIZARDDIALOG_START +132
+{
+ Text [ en-US ] = "%NUMBER slides";
+};
+
+String RID_WEBWIZARDDIALOG_START +133
+{
+ Text [ en-US ] = "Created: %DATE";
+};
+
+String RID_WEBWIZARDDIALOG_START +134
+{
+ Text [ en-US ] = "Last modified: %DATE";
+};
+
+String RID_WEBWIZARDDIALOG_START +135
+{
+ Text [ en-US ] = "Web Wizard Settings";
+};
+
+String RID_WEBWIZARDDIALOG_START +136
+{
+ Text [ en-US ] = "Background image:";
+};
+
+String RID_WEBWIZARDDIALOG_START +137
+{
+ Text [ en-US ] = "Icon set:";
+};
+
+String RID_WEBWIZARDDIALOG_START +138
+{
+ Text [ en-US ] = "The icon set is used for presentations in HTML format.";
+};
+
+String RID_WEBWIZARDDIALOG_START +139
+{
+ Text [ en-US ] = "HTML Metadata";
+};
+
+String RID_WEBWIZARDDIALOG_START +140
+{
+ Text [ en-US ] = "Choose...";
+};
+
+String RID_WEBWIZARDDIALOG_START +141
+{
+ Text [ en-US ] = "Choose...";
+};
+
+String RID_WEBWIZARDDIALOG_START +142
+{
+ Text [ en-US ] = "<default>";
+};
+
+String RID_WEBWIZARDDIALOG_START +143
+{
+ Text [ en-US ] = "Publishing via FTP Proxy is not supported.";
+};
+
+String RID_WEBWIZARDDIALOG_START +144
+{
+ Text [ en-US ] = "<no background image>";
+};
+
+String RID_WEBWIZARDDIALOG_START +145
+{
+ Text [ en-US ] = "<no icon set>";
+};
+
+String RID_WEBWIZARDDIALOG_START +146
+{
+ Text [ en-US ] = "The FTP directory '%FILENAME' could not be created.";
+};
+
+String RID_WEBWIZARDDIALOG_START +147
+{
+ Text [ en-US ] = "The FTP directory '%FILENAME' does not exist. \nCreate the directory now?";
+};
+
+String RID_WEBWIZARDDIALOG_START +148
+{
+ Text [ en-US ] = "The Zip file '%FILENAME' cannot be created: a directory of the same name already exists.";
+};
+
+String RID_WEBWIZARDDIALOG_START +149
+{
+ Text [ en-US ] = "The local directory '%FILENAME' cannot be created. \nPlease check your write-access.";
+};
+
+String RID_WEBWIZARDDIALOG_START +150
+{
+ Text [ en-US ] = "The local directory '%FILENAME' does not exist. \nCreate the directory now?";
+};
+
+String RID_WEBWIZARDDIALOG_START +151
+{
+ Text [ en-US ] = "Size: %NUMBERKB";
+};
+
+
+String RID_WEBWIZARDDIALOG_START +152
+{
+ Text [ en-US ] = "File not found. Would you like to specify a new file location?";
+};
+
+
+
+// ============================================================================
+// ================= WEB WIZARD FTP DIALOG RESOURCES =============
+// ============================================================================
+
+
+
+
+String RID_WEBWIZARDDIALOG_FTP +0
+{
+ Text [ en-US ] = "FTP Connection";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +1
+{
+ Text [ en-US ] = "~User name:";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +2
+{
+ Text [ en-US ] = "~Password:";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +3
+{
+ Text [ en-US ] = "Connect";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +4
+{
+ Text [ en-US ] = "1. Enter FTP connection information.";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +5
+{
+ Text [ en-US ] = "~Server name or IP address:";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +6
+{
+ Text [ en-US ] = "2. Connect to the server.";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +7
+{
+ Text [ en-US ] = "3. ~Choose a remote directory (optional).";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +8
+{
+ Text [ en-US ] = "...";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +9
+{
+ Text [ en-US ] = "Connection status is unknown";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +10
+{
+ Text [ en-US ] = "Connection was established successfully";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +11
+{
+ Text [ en-US ] = "Username or password is wrong";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +12
+{
+ Text [ en-US ] = "Could not resolve server name";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +13
+{
+ Text [ en-US ] = "You do not have sufficient user rights";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +14
+{
+ Text [ en-US ] = "Cannot connect to server";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +15
+{
+ Text [ en-US ] = "Unexpected error";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +16
+{
+ Text [ en-US ] = "FTP publishing directory";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +17
+{
+ Text [ en-US ] = "This is not an FTP folder";
+};
+
+String RID_WEBWIZARDDIALOG_FTP +18
+{
+ Text [ en-US ] = "Connecting...";
+};
+
+
+// ============================================================================
+// ============================ ======================
+// ====================== AGENDA WIZARD RESOURCES ================
+// ============================ ======================
+// ============================================================================
+
+String RID_AGENDAWIZARDDIALOG_START +1
+{
+ Text [en-US ] = "Agenda Wizard";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +2
+{
+ Text [en-US ] = "Make ~manual changes to this agenda template";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +3
+{
+ Text [en-US ] = "Template name:";
+};
+
+String RID_AGENDAWIZARDDIALOG_START + 4
+{
+ Text [en-US ] = "Location and file name:";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +5
+{
+ Text [en-US ] = "What do you want to do next?";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +6
+{
+ Text [en-US ] = "Please choose the page design for the agenda";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +7
+{
+ Text [en-US ] = "Please select the headings you wish to include in your agenda template";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +8
+{
+ Text [en-US ] = "Please enter general information for the event";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +9
+{
+ Text [en-US ] = "Please specify items for the agenda";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +10
+{
+ Text [en-US ] = "Please select the names you wish to include in your agenda template";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +11
+{
+ Text [en-US ] = "Choose a name and save the template";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +12
+{
+ Text [en-US ] = "Include form for recording minutes";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +13
+{
+ Text [en-US ] = "This wizard helps you to create an agenda template. The template can then be used to create an agenda whenever needed.";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +14
+{
+ Text [en-US ] = "Time:";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +15
+{
+ Text [en-US ] = "Name:";
+};
+
+String RID_AGENDAWIZARDDIALOG_START + 16
+{
+ Text [en-US ] = "Location:";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +17
+{
+ Text [en-US ] = "Placeholders will be used in empty fields. You can replace placeholders with text later.";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +18
+{
+ Text [en-US ] = "...";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +19
+{
+ Text [en-US ] = "Create an ~agenda from this template";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +20
+{
+ Text [en-US ] = "To create a new agenda out of the template, go to the location where you saved the template and double-click the file.";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +21
+{
+ Text [en-US ] = "Agenda item";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +22
+{
+ Text [en-US ] = "Responsible";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +23
+{
+ Text [en-US ] = "Duration";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +24
+{
+ Text [en-US ] = "Meeting called by";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +25
+{
+ Text [en-US ] = "Chairperson";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +26
+{
+ Text [en-US ] = "Minute keeper";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +27
+{
+ Text [en-US ] = "Moderator";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +28
+{
+ Text [en-US ] = "Attendees";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +29
+{
+ Text [en-US ] = "Observers";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +30
+{
+ Text [en-US ] = "Facility personnel";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +31
+{
+ Text [en-US ] = "The agenda template will include placeholders for the names of the selected people. When creating an agenda from the template, you can replace these placeholder with the appropriate names.";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +32
+{
+ Text [en-US ] = "Type of meeting";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +33
+{
+ Text [en-US ] = "Please read";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +34
+{
+ Text [en-US ] = "Please bring";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +35
+{
+ Text [en-US ] = "Notes";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +36
+{
+ Text [en-US ] = "The agenda template will include placeholders for the selected items.";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +38
+{
+ Text [en-US ] = "Date:";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +39
+{
+ Text [en-US ] = "This wizard creates an agenda template which enables you to create multiple agendas with the same layout and settings.";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +40
+{
+ Text [en-US ] = "Page design:";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +41
+{
+ Text [en-US ] = "myAgendaTemplate.stw";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +42
+{
+ Text [en-US ] = "My Agenda Template";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +43
+{
+ Text [en-US ] = "An unexpected error occurred while saving the agenda template.";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +44
+{
+ Text [en-US ] = "Name";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +45
+{
+ Text [en-US ] = "Date";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +46
+{
+ Text [en-US ] = "Time";
+};
+
+String RID_AGENDAWIZARDDIALOG_START + 47
+{
+ Text [en-US ] = "Location";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +48
+{
+ Text [en-US ] = "Click to replace this text";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +50
+{
+ Text [en-US ] = "Page design";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +51
+{
+ Text [en-US ] = "General information";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +52
+{
+ Text [en-US ] = "Headings to include";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +53
+{
+ Text [en-US ] = "Names";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +54
+{
+ Text [en-US ] = "Agenda items";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +55
+{
+ Text [en-US ] = "Name and location";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +56
+{
+ Text [en-US ] = "An unexpected error occurred while opening the agenda template.";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +57
+{
+ Text [en-US ] = "Type of meeting";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +58
+{
+ Text [en-US ] = "Please bring";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +59
+{
+ Text [en-US ] = "Please read";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +60
+{
+ Text [en-US ] = "Notes";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +61
+{
+ Text [en-US ] = "Meeting called by";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +62
+{
+ Text [en-US ] = "Chairperson";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +63
+{
+ Text [en-US ] = "Attendees";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +64
+{
+ Text [en-US ] = "Minute keeper";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +65
+{
+ Text [en-US ] = "Moderator";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +66
+{
+ Text [en-US ] = "Observers";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +67
+{
+ Text [en-US ] = "Facility personnel";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +68
+{
+ Text [en-US ] = "Insert";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +69
+{
+ Text [en-US ] = "Remove";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +70
+{
+ Text [en-US ] = "Move up";
+};
+
+String RID_AGENDAWIZARDDIALOG_START +71
+{
+ Text [en-US ] = "Move down";
+};
+
diff --git a/wizards/source/formwizard/delzip b/wizards/source/formwizard/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/formwizard/delzip
diff --git a/wizards/source/formwizard/develop.xba b/wizards/source/formwizard/develop.xba
new file mode 100644
index 000000000000..a12d1af37461
--- /dev/null
+++ b/wizards/source/formwizard/develop.xba
@@ -0,0 +1,533 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="develop" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+
+Public oDBShapeList() as Object
+Public oTCShapeList() as Object
+Public oDBModelList() as Object
+Public oGroupShapeList() as Object
+
+Public oGridShape as Object
+Public a as Integer
+Public StartA as Integer
+Public bIsFirstRun as Boolean
+Public bIsVeryFirstRun as Boolean
+Public bControlsareCreated as Boolean
+Public nDBRefHeight as Long
+Public nXTCPos&amp;, nYTCPos&amp;, nXDBPos&amp;, nYDBPos&amp;, nTCHeight&amp;, nTCWidth&amp;, nDBHeight&amp;, nDBWidth&amp;
+
+Dim iReduceWidth as Integer
+
+Function PositionControls(Maxindex as Integer)
+Dim oTCModel as Object
+Dim oDBModel as Object
+Dim i as Integer
+ InitializePosSizes()
+ bIsFirstRun = True
+ bIsVeryFirstRun = True
+ a = 0
+ StartA = 0
+ nMaxRowY = 0
+ nSecMaxRowY = 0
+ If CurArrangement = cLeftJustified Or cTopJustified Then
+ DialogModel.optAlign0.State = 1
+ End If
+ For i = 0 To MaxIndex
+ GetCurrentMetaValues(i)
+ oTCModel = InsertTextControl(i)
+ If CurFieldType = com.sun.star.sdbc.DataType.TIMESTAMP Then
+ InsertTimeStampShape(i)
+ Else
+ InsertDBControl(i)
+ bIsVeryFirstRun = False
+ oDBModelList(i).LabelControl = oTCModel
+ End If
+ GetLabelDiffHeight(i+1)
+ ResetPosSizes(i)
+ oProgressbar.Value = i
+ Next i
+ ControlCaptionstoStandardLayout()
+ bControlsareCreated = True
+End Function
+
+
+Sub ResetPosSizes(LastIndex as Integer)
+ Select Case CurArrangement
+ Case cColumnarLeft
+ nYDBPos = nYDBPos + nDBHeight + cVertDistance
+ If (nYDBPos &gt; cYOffset + nFormHeight) Or (LastIndex = MaxIndex) Then
+ RepositionColumnarLeftControls(LastIndex)
+ nXTCPos = nMaxColRightX + 2 * cHoriDistance
+ nXDBPos = nXTCPos + cHoriDistance + nMaxTCWidth
+ nYDBPos = cYOffset
+ bIsFirstRun = True
+ StartA = LastIndex + 1
+ a = 0
+ Else
+ a = a + 1
+ End If
+ nYTCPos = nYDBPos + LABELDIFFHEIGHT
+ Case cColumnarTop
+ nYTCPos = nYDBPos + nDBHeight + cVertDistance
+ If nYTCPos &gt; cYOffset + nFormHeight Then
+ nXDBPos = nMaxColRightX + cHoriDistance
+ nXTCPos = nXDBPos
+ nYDBPos = cYOffset + nTCHeight + cVertDistance
+ nYTCPos = cYOffset
+ bIsFirstRun = True
+ StartA = LastIndex + 1
+ a = 0
+ Else
+ a = a + 1
+ End If
+ Case cLeftJustified,cTopJustified
+ If nMaxColRightX &gt; cXOffset + nFormWidth Then
+ Dim nOldYTCPos as Long
+ nOldYTCPos = nYTCPos
+ CheckJustifiedPosition()
+ Else
+ nXTCPos = nMaxColRightX + CHoriDistance
+ If CurArrangement = cLeftJustified Then
+ nYTCPos = nYDBPos + LabelDiffHeight
+ End If
+ End If
+ a = a + 1
+ End Select
+End Sub
+
+
+Sub RepositionColumnarLeftControls(LastIndex as Integer)
+Dim aSize As New com.sun.star.awt.Size
+Dim aPoint As New com.sun.star.awt.Point
+Dim i as Integer
+ aSize = GetSize(nMaxTCWidth, nTCHeight)
+ bIsFirstRun = True
+ For i = StartA To LastIndex
+ If i = StartA Then
+ nXTCPos = oTCShapeList(i).Position.X
+ nXDBPos = nXTCPos + nMaxTCWidth + cHoriDistance
+ End If
+ ResetDBShape(oDBShapeList(i), nXDBPos)
+ CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
+ Next i
+End Sub
+
+
+Sub ResetDBShape(oLocDBShape as Object, iXPos as Long)
+Dim aSize As New com.sun.star.awt.Size
+Dim aPoint As New com.sun.star.awt.Point
+ nYDBPos = oLocDBShape.Position.Y
+ nDBWidth = oLocDBShape.Size.Width
+ nDBHeight = oLocDBShape.Size.Height
+ aPoint = GetPoint(iXPos,nYDBPos)
+ oLocDBShape.SetPosition(aPoint)
+End Sub
+
+
+Sub InitializePosSizes()
+ nXTCPos = cXOffset
+ nTCWidth = 2000
+ nDBWidth = 2000
+ nDBHeight = nDBRefHeight
+ iReduceWidth = 0
+ Select Case CurArrangement
+ Case cColumnarLeft, cLeftJustified
+ GetLabelDiffHeight(0)
+ nYTCPos = cYOffset + LABELDIFFHEIGHT
+ nXDBPos = cXOffset + 3050
+ nYDBPos = cYOffset
+ Case cColumnarTop, cTopJustified
+ nXDBPos = cXOffset
+ nYTCPos = cYOffset
+ End Select
+End Sub
+
+
+Function InsertTextControl(i as Integer) as Object
+Dim oShape as Object
+Dim oModel as Object
+Dim aPoint as New com.sun.star.awt.Point
+Dim aSize As New com.sun.star.awt.Size
+ If bControlsareCreated Then
+ Set oShape = oTCShapeList(i)
+ Set oModel = oShape.GetControl
+ If CurArrangement = cLeftJustified Then
+ nTCWidth = GetPreferredWidth(oModel, True, CurFieldname)
+ Else
+ nTCWidth = oShape.Size.Width
+ End If
+ oShape.Position = GetPoint(nXTCPos, nYTCPos)
+ If CurArrangement = cColumnarTop Then
+ oModel.Align = com.sun.star.awt.TextAlign.LEFT
+ End If
+ Else
+ oModel = CreateUnoService(oModelService(cLabel))
+ aPoint = GetPoint(nXTCPos, nYTCPos)
+ aSize = GetSize(nTCWidth,nTCHeight)
+ Set oShape = InsertControl(oDrawPage, oModel, aPoint, aSize)
+ Set oTCShapeList(i)= oShape
+ If bIsVeryFirstRun Then
+ If CurArrangement = cColumnarTop Then
+ nYDBPos = nYTCPos + nTCHeight
+ End If
+ End If
+ nTCWidth = GetPreferredWidth(oModel, True, CurFieldName)
+ End If
+ If CurArrangement = cColumnarLeft Then
+ &apos; Note This If Sequence must be called before retrieving the outer Points
+ If bIsFirstRun Then
+ nMaxTCWidth = nTCWidth
+ bIsFirstRun = False
+ ElseIf nTCWidth &gt; nMaxTCWidth Then
+ nMaxTCWidth = nTCWidth
+ End If
+ End If
+ CheckOuterPoints(oShape.Position.X, nTCWidth, nYTCPos, nTCHeight, False)
+ Select Case CurArrangement
+ Case cLeftJustified
+ nXDBPos = nMaxColRightX
+ Case cColumnarTop,cTopJustified
+ oModel.Align = com.sun.star.awt.TextAlign.LEFT
+ nXDBPos = nXTCPos
+ nYDBPos = nYTCPos + nTCHeight
+ If CurFieldLength = 20 And nDBWidth &gt; 2 * nTCWidth Then
+ iReduceWidth = iReduceWidth + 1
+ End If
+ End Select
+ oShape.SetSize(GetSize(nTCWidth,nTCHeight))
+ If CurHelpText &lt;&gt; &quot;&quot; Then
+ oModel.HelpText = CurHelptext
+ End If
+ InsertTextControl = oModel
+End Function
+
+
+Sub InsertDBControl(i as Integer)
+Dim aPoint as New com.sun.star.awt.Point
+Dim aSize As New com.sun.star.awt.Size
+Dim oControl as Object
+Dim iColRightX as Long
+
+ aPoint = GetPoint(nXDBPos, nYDBPos)
+ If bControlsAreCreated Then
+ oDBShapeList(i).Position = aPoint
+ Else
+ oDBModelList(i) = CreateUnoService(oModelService(CurControlType))
+ oDBShapeList(i) = InsertControl(oDrawPage, oDBModelList(i), aPoint, aSize)
+ SetNumerics(oDBModelList(i), CurFieldType)
+ If CurControlType = cCheckBox Then
+ oDBModelList(i).Label = &quot;&quot;
+ End If
+ oDBModelList(i).DataField = CurFieldName
+ End If
+ nDBHeight = GetDBHeight(oDBModelList(i))
+ nDBWidth = GetPreferredWidth(oDBModelList(i),True)
+ aSize = GetSize(nDBWidth,nDBHeight)
+ oDBShapeList(i).SetSize(aSize)
+ CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
+End Sub
+
+
+Function InsertTimeStampShape(i as Integer) as Object
+Dim oDateModel as Object
+Dim oTimeModel as Object
+Dim oDateShape as Object
+Dim oTimeShape as Object
+Dim oDateTimeShape as Object
+Dim aPoint as New com.sun.star.awt.Point
+Dim aSize as New com.sun.star.awt.Size
+Dim nDateWidth as Long
+Dim nTimeWidth as Long
+Dim oGroupShape as Object
+ aPoint = GetPoint(nXDBPos, nYDBPos)
+ If bControlsAreCreated Then
+ oDBShapeList(i).Position = aPoint
+ nDBWidth = oDBShapeList(i).Size.Width
+ nDBHeight = oDBShapeList(i).Size.Height
+ Else
+ oGroupShape = oDocument.CreateInstance(&quot;com.sun.star.drawing.GroupShape&quot;)
+ oGroupShape.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PARAGRAPH
+ oDrawPage.Add(oGroupShape)
+ CurFieldType = com.sun.star.sdbc.DataType.DATE
+ oDateModel = CreateUnoService(&quot;com.sun.star.form.component.DateField&quot;)
+ oDateModel.DataField = CurFieldName
+ oDateShape = InsertControl(oGroupShape, oDateModel, aPoint, aSize)
+ SetNumerics(oDateModel, CurFieldType)
+ nDBHeight = GetDBHeight(oDateModel)
+ nDateWidth = GetPreferredWidth(oDateModel,True)
+ aSize = GetSize(nDateWidth,nDBHeight)
+ oDateShape.SetSize(aSize)
+
+ CurFieldType = com.sun.star.sdbc.DataType.TIME
+ oTimeModel = CreateUnoService(&quot;com.sun.star.form.component.TimeField&quot;)
+ oTimeModel.DataField = CurFieldName
+ oTimeShape = InsertControl(oGroupShape, oTimeModel, aPoint, aSize)
+ oTimeShape.Position = GetPoint(nXDBPos + 10 + nDateWidth,nYDBPos)
+ nTimeWidth = GetPreferredWidth(oTimeModel)
+ aSize = GetSize(nTimeWidth,nDBHeight)
+ oTimeShape.SetSize(aSize)
+ nDBWidth = nDateWidth + nTimeWidth + 10
+ oGroupShape.Position = aPoint
+ oGroupShape.Size = GetSize(nDBWidth, nDBHeight)
+ Set oDBShapeList(i)= oGroupShape
+ End If
+ CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
+ InsertTimeStampShape() = oDBShapeList(i)
+End Function
+
+
+&apos; Note: on all Controls except for the checkbox the Label has to be set
+&apos; a bit under the DBControl because its Height is also smaller
+Sub GetLabelDiffHeight(Index as Integer)
+ If (CurArrangement = cLeftJustified) Or (CurArrangement = cColumnarLeft) Then
+ If Index &lt;= Ubound(FieldMetaValues()) Then
+ If FieldMetaValues(Index,2) = cCheckBox Then
+ LabelDiffHeight = 0
+ Else
+ LabelDiffHeight = BasicLabelDiffHeight
+ End If
+ End If
+ End If
+End Sub
+
+
+Sub CheckJustifiedPosition()
+Dim nLeftDist as Long
+Dim nRightDist as Long
+Dim oLocDBShape as Object
+Dim oLocTextShape as Object
+Dim nBaseWidth as Long
+ nBaseWidth = nFormWidth + cXOffset
+ nLeftDist = nMaxColRightX - nBaseWidth
+ nRightDist = nBaseWidth - nXTCPos + cHoriDistance
+ If nLeftDist &lt; 0.5 * nRightDist and iReduceWidth &gt; 2 Then
+ &apos; Fieldwidths in the line can be made smaller
+ AdjustLineWidth(StartA, a, nLeftDist, - 1)
+ If CurArrangement = cLeftjustified Then
+ nYDBPos = nMaxRowY + cVertDistance
+ nYTCPos = nYDBPos + LABELDIFFHEIGHT
+ nXTCPos = cXOffset
+ Else
+ nYTCPos = nMaxRowY + cVertDistance
+ nYDBPos = nYTCPos + nTCHeight
+ nXTCPos = cXOffset
+ nXDBPos = cXOffset
+ End If
+ bIsFirstRun = True
+ StartA = a + 1
+ Else
+ Set oLocDBShape = oDBShapeList(a)
+ Set oLocTextShape = oTCShapeList(a)
+ If CurArrangement = cLeftJustified Then
+ If nYDBPos + nDBHeight = nMaxRowY Then
+ &apos; The last Control was the highes in the row
+ nYDBPos = nSecMaxRowY + cVertDistance
+ Else
+ nYDBPos = nMaxRowY + cVertDistance
+ End If
+ nYTCPos = nYDBPos + LABELDIFFHEIGHT
+ nXDBPos = cXOffset + nTCWidth
+ oLocTextShape.Position = GetPoint(cXOffset, nYTCPos)
+ oLocDBShape.Position = GetPoint(nXDBPos, nYDBPos)
+ &apos; PosSizes for the next two Controls
+ nXTCPos = oLocDBShape.Position.X + oLocDBShape.Size.Width + cHoriDistance
+ bIsFirstRun = True
+ CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
+ nXDBPos = nMaxColRightX + cHoriDistance
+ Else &apos; cTopJustified
+ If nYDBPos + nDBHeight = nMaxRowY Then
+ &apos; The last Control was the highest in the row
+ nYTCPos = nSecMaxRowY + cVertDistance
+ Else
+ nYTCPos = nMaxRowY + cVertDistance
+ End If
+ nYDBPos = nYTCPOS + nTCHeight
+ nXDBPos = cXOffset
+ nXTCPos = cXOffset
+ oLocTextShape.Position = GetPoint(cXOffset, nYTCPos)
+ oLocDBShape.Position = GetPoint(cXOffset, nYDBPos)
+ bIsFirstRun = True
+ If nDBWidth &gt; nTCWidth Then
+ CheckOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, True)
+ Else
+ CheckOuterPoints(nXDBPos, nTCWidth, nYDBPos, nDBHeight, True)
+ End If
+ nXTCPos = nMaxColRightX + cHoriDistance
+ nXDBPos = nXTCPos
+ End If
+ AdjustLineWidth(StartA, a-1, nRightDist, 1)
+ StartA = a
+ End If
+ iReduceWidth = 0
+End Sub
+
+
+
+Function GetCorrWidth(StartIndex as Integer, EndIndex as Integer, nDist as Long, Widthfactor as Integer) as Integer
+Dim ShapeCount as Integer
+ If WidthFactor &gt; 0 Then
+ ShapeCount = EndIndex-StartIndex + 1
+ Else
+ ShapeCount = iReduceWidth
+ End If
+ GetCorrWidth() = (nDist)/ShapeCount
+End Function
+
+
+Sub AdjustLineWidth(StartIndex as Integer, EndIndex as Integer, nDist as Long, Widthfactor as Integer)
+Dim i as Integer
+Dim oLocDBShape as Object
+Dim oLocTCShape as Object
+Dim CorrWidth as Integer
+Dim bAdjustPos as Boolean
+Dim iLocTCPosX as Long
+Dim iLocDBPosX as Long
+ CorrWidth = GetCorrWidth(StartIndex, EndIndex, nDist, Widthfactor)
+ bAdjustPos = False
+ iLocTCPosX = cXOffset
+ For i = StartIndex To EndIndex
+ Set oLocDBShape = oDBShapeList(i)
+ Set oLocTCShape = oTCShapeList(i)
+ If bAdjustPos Then
+ oLocTCShape.Position = GetPoint(iLocTCPosX, oLocTCShape.Position.Y)
+ If CurArrangement = cLeftJustified Then
+ iLocDBPosX = oLocTCShape.Position.X + oLocTCShape.Size.Width
+ oLocDBShape.Position = GetPoint(iLocDBPosX, oLocDBShape.Position.Y)
+ Else
+ oLocDBShape.Position = GetPoint(iLocTCPosX, oLocTCShape.Position.Y + nTCHeight)
+ End If
+ Else
+ bAdjustPos = True
+ End If
+ If CDbl(FieldMetaValues(i,1)) &gt; 20 or WidthFactor &gt; 0 Then
+ If (CurArrangement = cTopJustified) And (oLocTCShape.Size.Width &gt; oLocDBShape.Size.Width) Then
+ oLocDBShape.Size = GetSize(oLocTCShape.Size.Width + WidthFactor * CorrWidth, oLocDBShape.Size.Height)
+ Else
+ oLocDBShape.Size = GetSize(oLocDBShape.Size.Width + WidthFactor * CorrWidth, oLocDBShape.Size.Height)
+ End If
+ End If
+ iLocTCPosX = oLocDBShape.Position.X + oLocDBShape.Size.Width + cHoriDistance
+ If CurArrangement = cTopJustified Then
+ If oLocTCShape.Size.Width &gt; oLocDBShape.Size.Width Then
+ iLocTCPosX = oLocDBShape.Position.X + oLocTCShape.Size.Width + cHoriDistance
+ End If
+ End If
+ Next i
+End Sub
+
+
+Sub CheckOuterPoints(nXPos, nWidth, nYPos, nHeight, bIsDBField as Boolean)
+Dim nColRightX as Long
+Dim nRowY as Long
+Dim nOldMaxRowY as Long
+ If CurArrangement = cLeftJustified Or CurArrangement = cTopJustified Then
+ If bIsDBField Then
+ &apos; Only at DBControls you can measure the Value of nMaxRowY
+ If bIsFirstRun Then
+ nMaxRowY = nYPos + nHeight
+ nSecMaxRowY = nMaxRowY
+ Else
+ nRowY = nYPos + nHeight
+ If nRowY &gt;= nMaxRowY Then
+ nOldMaxRowY = nMaxRowY
+ nSecMaxRowY = nOldMaxRowY
+ nMaxRowY = nRowY
+ End If
+ End If
+ End If
+ End If
+ &apos; Find the outer right point
+ If bIsFirstRun Then
+ nMaxColRightX = nXPos + nWidth
+ bIsFirstRun = False
+ Else
+ nColRightX = nXPos + nWidth
+ If nColRightX &gt; nMaxColRightX Then
+ nMaxColRightX = nColRightX
+ End If
+ End If
+End Sub
+
+
+Function PositionGridControl(MaxIndex as Integer)
+Dim oControl as Object
+Dim n as Integer
+Dim oColumn as Object
+Dim aPoint as New com.sun.star.awt.Point
+Dim aSize as New com.sun.star.awt.Size
+ If bControlsareCreated Then
+ ShapesToNirwana()
+ End If
+ oGridModel = CreateUnoService(oModelService(cGridControl))
+ oGridModel.Name = &quot;Grid1&quot;
+ aPoint = GetPoint(cXOffset, cYOffset)
+ aSize = GetSize(nFormWidth, nFormHeight)
+ oDBForm.InsertByName (oGridModel.Name, oGridModel)
+ oGridShape = InsertControl(oDrawPage, oGridModel, aPoint, aSize)
+ For n = 0 to MaxIndex
+ GetCurrentMetaValues(n)
+ If CurFieldType = com.sun.star.sdbc.DataType.TIMESTAMP Then
+ oColumn = SetupGridColumn(oGridModel,&quot;DateField&quot;, False, com.sun.star.sdbc.DataType.DATE, CurFieldName &amp; &quot; &quot; &amp; sDateAppendix)
+ oColumn = SetupGridColumn(oGridModel,&quot;TimeField&quot;, False, com.sun.star.sdbc.DataType.TIME, CurFieldName &amp; &quot; &quot; &amp; sTimeAppendix)
+ Else
+ If CurControlType = cImageControl Then
+ oColumn = SetupGridColumn(oGridModel,&quot;TextField&quot;, True, CurFieldType, CurFieldName)
+ Else
+ oColumn = SetupGridColumn(oGridModel, CurControlName, False, CurFieldType, CurFieldName)
+ End If
+ End If
+ oProgressbar.Value = n
+ next n
+End Function
+
+
+Function SetupGridColumn(oGridModel as Object, ControlName as String, bHidden as Boolean, iLocFieldType as Integer, ColName as String) as Object
+Dim oColumn as Object
+ CurControlName = ControlName
+ oColumn = oGridModel.CreateColumn(CurControlName)
+ oColumn.Name = CalcUniqueContentName(oGridModel, CurControlName)
+ oColumn.Hidden = bHidden
+ SetNumerics(oColumn, iLocFieldType)
+ oColumn.DataField = CurFieldName
+ oColumn.Label = ColName
+ oColumn.Width = 0 &apos; Width of column is adjusted to Columname
+ oGridModel.insertByName(oColumn.Name, oColumn)
+End Function
+
+
+Sub ControlCaptionstoStandardLayout()
+Dim i as Integer
+Dim iBorderType as Integer
+Dim oCurModel as Object
+Dim oStyle as Object
+Dim iStandardColor as Long
+ If CurArrangement &lt;&gt; cTabled Then
+ oStyle = oDocument.StyleFamilies.GetByName(&quot;ParagraphStyles&quot;).GetByName(&quot;Standard&quot;)
+ iStandardColor = oStyle.CharColor
+ For i = 0 To MaxIndex
+ oCurModel = oTCShapeList(i).GetControl
+ If i = 0 Then
+ If oCurModel.TextColor = iStandardColor Then
+ Exit Sub
+ End If
+ End If
+ oCurModel.TextColor = iStandardColor
+ Next i
+ End If
+End Sub
+
+
+Sub GroupShapesTogether()
+Dim i as Integer
+ If CurArrangement &lt;&gt; cTabled Then
+ For i = 0 To MaxIndex
+ oGroupShapeList(i) = CreateUnoService(&quot;com.sun.star.drawing.ShapeCollection&quot;)
+ oGroupShapeList(i).Add(oTCShapeList(i))
+ oGroupShapeList(i).Add(oDBShapeList(i))
+ oDrawPage.Group(oGroupShapeList(i))
+ Next i
+ Else
+ RemoveNirwanaShapes()
+ End If
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/formwizard/dialog.xlb b/wizards/source/formwizard/dialog.xlb
new file mode 100644
index 000000000000..d680f29292e8
--- /dev/null
+++ b/wizards/source/formwizard/dialog.xlb
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="FormWizard" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="DlgFormDB"/>
+</library:library>
diff --git a/wizards/source/formwizard/makefile.mk b/wizards/source/formwizard/makefile.mk
new file mode 100644
index 000000000000..3a5ec422625f
--- /dev/null
+++ b/wizards/source/formwizard/makefile.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=formwizardall
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+#
+# testresource.
+#
+SRS2NAME = dbwizres
+SRC2FILES= dbwizres.src
+RESLIB2SRSFILES= $(SRS)$/dbwizres.srs
+RESLIB2NAME= dbw
+
+ZIP1TARGET = $(FORMWIZARD_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/formwizard/script.xlb b/wizards/source/formwizard/script.xlb
new file mode 100644
index 000000000000..0b79b7f078ba
--- /dev/null
+++ b/wizards/source/formwizard/script.xlb
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="FormWizard" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="FormWizard"/>
+ <library:element library:name="Layouter"/>
+ <library:element library:name="Language"/>
+ <library:element library:name="DBMeta"/>
+ <library:element library:name="tools"/>
+ <library:element library:name="develop"/>
+</library:library>
diff --git a/wizards/source/formwizard/tools.xba b/wizards/source/formwizard/tools.xba
new file mode 100644
index 000000000000..174987e35971
--- /dev/null
+++ b/wizards/source/formwizard/tools.xba
@@ -0,0 +1,349 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="tools" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+Public Const SBMAXTEXTSIZE = 50
+
+
+Function SetProgressValue(iValue as Integer)
+ If iValue = 0 Then
+ oProgressbar.End
+ End If
+ ProgressValue = iValue
+ oProgressbar.Value = iValue
+End Function
+
+
+Function GetPreferredWidth(oModel as Object, bGetMaxWidth as Boolean, Optional LocText)
+Dim aPeerSize as new com.sun.star.awt.Size
+Dim nWidth as Integer
+Dim oControl as Object
+ If Not IsMissing(LocText) Then
+ &apos; Label
+ aPeerSize = GetPeerSize(oModel, oControl, LocText)
+ ElseIf CurControlType = cImageControl Then
+ GetPreferredWidth() = 2000
+ Exit Function
+ Else
+ aPeerSize = GetPeerSize(oModel, oControl)
+ End If
+ nWidth = aPeerSize.Width
+ &apos; We increase the preferred Width a bit so that the control does not become too small
+ &apos; when we change the border from &quot;3D&quot; to &quot;Flat&quot;
+ GetPreferredWidth = (nWidth + 10) * XPixelFactor &apos; PixelTo100thmm(nWidth)
+End Function
+
+
+Function GetPreferredHeight(oModel as Object, Optional LocText)
+Dim aPeerSize as new com.sun.star.awt.Size
+Dim nHeight as Integer
+Dim oControl as Object
+ If Not IsMissing(LocText) Then
+ &apos; Label
+ aPeerSize = GetPeerSize(oModel, oControl, LocText)
+ ElseIf CurControlType = cImageControl Then
+ GetPreferredHeight() = 2000
+ Exit Function
+ Else
+ aPeerSize = GetPeerSize(oModel, oControl)
+ End If
+ nHeight = aPeerSize.Height
+ &apos; We increase the preferred Height a bit so that the control does not become too small
+ &apos; when we change the border from &quot;3D&quot; to &quot;Flat&quot;
+ GetPreferredHeight = (nHeight+1) * YPixelFactor &apos; PixelTo100thmm(nHeight)
+End Function
+
+
+Function GetPeerSize(oModel as Object, oControl as Object, Optional LocText)
+Dim oPeer as Object
+Dim aPeerSize as new com.sun.star.awt.Size
+Dim NullValue
+ oControl = oController.GetControl(oModel)
+ oPeer = oControl.GetPeer()
+ If oControl.Model.PropertySetInfo.HasPropertybyName(&quot;EffectiveMax&quot;) Then
+ If oControl.Model.EffectiveMax = 0 Then
+ &apos; This is relevant for decimal fields
+ oControl.Model.EffectiveValue = 999.9999
+ Else
+ oControl.Model.EffectiveValue = oControl.Model.EffectiveMax
+ End If
+ GetPeerSize() = oPeer.PreferredSize()
+ oControl.Model.EffectiveValue = NullValue
+ ElseIf Not IsMissing(LocText) Then
+ oControl.Text = LocText
+ GetPeerSize() = oPeer.PreferredSize()
+ ElseIf CurFieldType = com.sun.star.sdbc.DataType.BIT Then
+ GetPeerSize() = oPeer.PreferredSize()
+ ElseIf CurFieldType = com.sun.star.sdbc.DataType.BOOLEAN Then
+ GetPeerSize() = oPeer.PreferredSize()
+ ElseIf CurFieldType = com.sun.star.sdbc.DataType.DATE Then
+ oControl.Model.Date = Date
+ GetPeerSize() = oPeer.PreferredSize()
+ oControl.Model.Date = NullValue
+ ElseIf CurFieldType = com.sun.star.sdbc.DataType.TIME Then
+ oControl.Time = Time
+ GetPeerSize() = oPeer.PreferredSize()
+ oControl.Time = NullValue
+ Else
+ If oControl.MaxTextLen &gt; SBMAXTEXTSIZE Then
+ oControl.Text = Mid(SBSIZETEXT,1, SBMAXTEXTSIZE)
+ Else
+ oControl.Text = Mid(SBSIZETEXT,1, oControl.MaxTextLen)
+ End If
+ GetPeerSize() = oPeer.PreferredSize()
+ oControl.Text = &quot;&quot;
+ End If
+End Function
+
+
+Function TwipToCM(BYVAL nValue as long) as String
+ TwipToCM = trim(str(nValue / 567)) + &quot;cm&quot;
+End function
+
+
+Function TwipTo100telMM(BYVAL nValue as long) as long
+ TwipTo100telMM = nValue / 0.567
+End function
+
+
+Function TwipToPixel(BYVAL nValue as long) as long &apos; not an exact calculation
+ TwipToPixel = nValue / 15
+End function
+
+
+Function PixelTo100thMMX(oControl as Object) as long
+ oPeer = oControl.GetPeer()
+ PixelTo100mmX = Clng(Peer.GetInfo.PixelPerMeterX/100000)
+
+&apos; PixelTo100thMM = nValue * 28 &apos; not an exact calculation
+End function
+
+
+Function PixelTo100thMMY(oControl as Object) as long
+ oPeer = oControl.GetPeer()
+ PixelTo100mmX = Clng(Peer.GetInfo.PixelPerMeterY/100000)
+
+&apos; PixelTo100thMM = nValue * 28 &apos; not an exact calculation
+End function
+
+
+Function GetPoint(xPos, YPos) as New com.sun.star.awt.Point
+Dim aPoint as New com.sun.star.awt.Point
+ aPoint.X = xPos
+ aPoint.Y = yPos
+ GetPoint() = aPoint
+End Function
+
+
+Function GetSize(iWidth, iHeight) As New com.sun.star.awt.Size
+Dim aSize As New com.sun.star.awt.Size
+ aSize.Width = iWidth
+ aSize.Height = iHeight
+ GetSize() = aSize
+End Function
+
+
+Sub ImportStyles()
+Dim OldIndex as Integer
+ If Not bDebug Then
+ On Local Error GoTo WIZARDERROR
+ End If
+ OldIndex = CurIndex
+ CurIndex = GetCurIndex(DialogModel.lstStyles, Styles(),8)
+ If CurIndex &lt;&gt; OldIndex Then
+ ToggleLayoutPage(False)
+ Dim sImportPath as String
+ sImportPath = Styles(CurIndex, 8)
+ bWithBackGraphic = LoadNewStyles(oDocument, DialogModel, CurIndex, sImportPath, Styles(), TexturePath)
+ ControlCaptionsToStandardLayout()
+ ToggleLayoutPage(True, &quot;lstStyles&quot;)
+ End If
+WIZARDERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(sMsgErrMsg, 16, GetProductName())
+ Resume LOCERROR
+ LOCERROR:
+ End If
+End Sub
+
+
+
+Function SetNumerics(ByVal oLocObject as Object, iLocFieldType as Integer) as Object
+ If CurControlType = cNumericBox Then
+ oLocObject.TreatAsNumber = True
+ Select Case iLocFieldType
+ Case com.sun.star.sdbc.DataType.BIGINT
+ oLocObject.EffectiveMax = 2147483647 * 2147483647
+ oLocObject.EffectiveMin = -(-2147483648 * -2147483648)
+&apos; oLocObject.DecimalAccuracy = 0
+ Case com.sun.star.sdbc.DataType.INTEGER
+ oLocObject.EffectiveMax = 2147483647
+ oLocObject.EffectiveMin = -2147483648
+ Case com.sun.star.sdbc.DataType.SMALLINT
+ oLocObject.EffectiveMax = 32767
+ oLocObject.EffectiveMin = -32768
+ Case com.sun.star.sdbc.DataType.TINYINT
+ oLocObject.EffectiveMax = 127
+ oLocObject.EffectiveMin = -128
+ Case com.sun.star.sdbc.DataType.FLOAT, com.sun.star.sdbc.DataType.REAL, com.sun.star.sdbc.DataType.DOUBLE, com.sun.star.sdbc.DataType.DECIMAL, com.sun.star.sdbc.DataType.NUMERIC
+&apos;Todo: oLocObject.DecimalAccuracy = ...
+ oLocObject.EffectiveDefault = CurDefaultValue
+&apos; Todo: HelpText???
+ End Select
+ If oLocObject.PropertySetinfo.HasPropertyByName(&quot;Width&quot;)Then &apos; Note: an Access AutoincrementField does not provide this property Width
+ oLocObject.Width = CurFieldLength + CurScale + 1
+ End If
+ If CurIsCurrency Then
+&apos;Todo: How do you set currencies?
+ End If
+ ElseIf CurControlType = cTextBox Then &apos;com.sun.star.sdbc.DataType.CHAR, com.sun.star.sdbc.DataType.VARCHAR, com.sun.star.sdbc.DataType.LONGVARCHAR
+ If CurFieldLength = 0 Then &apos;Or oLocObject.MaxTextLen &gt; SBMAXTEXTSIZE
+ oLocObject.MaxTextLen = SBMAXTEXTSIZE
+ CurFieldLength = SBMAXTEXTSIZE
+ Else
+ oLocObject.MaxTextLen = CurFieldLength
+ End If
+ oLocObject.DefaultText = CurDefaultValue
+ ElseIf CurControlType = cDateBox Then
+&apos; Todo Why does this not work?: oLocObject.DefaultDate = CurDefaultValue
+ ElseIf CurControlType = cTimeBox Then &apos; com.sun.star.sdbc.DataType.DATE, com.sun.star.sdbc.DataType.TIME
+ oLocObject.DefaultTime = CurDefaultValue
+&apos; Todo: Property TimeFormat? frome where?
+ ElseIf CurControlType = cCheckBox Then
+&apos; Todo Why does this not work?: oLocObject.DefautState = CurDefaultValue
+ End If
+ If oLocObject.PropertySetInfo.HasPropertybyName(&quot;FormatKey&quot;) Then
+ On Local Error Resume Next
+ oLocObject.FormatKey = CurFormatKey
+ End If
+End Function
+
+
+&apos; Destroy all Shapes in Nirwana
+Sub RemoveShapes()
+Dim n as Integer
+Dim oControl as Object
+Dim oShape as Object
+ For n = oDrawPage.Count-1 To 0 Step -1
+ oShape = oDrawPage(n)
+ If oShape.Position.Y &gt; -2000 Then
+ oDrawPage.Remove(oShape)
+ End If
+ Next n
+End Sub
+
+
+&apos; Destroy all Shapes in Nirwana
+Sub RemoveNirwanaShapes()
+Dim n as Integer
+Dim oControl as Object
+Dim oShape as Object
+ For n = oDrawPage.Count-1 To 0 Step -1
+ oShape = oDrawPage(n)
+ If oShape.Position.Y &lt; -2000 Then
+ oDrawPage.Remove(oShape)
+ End If
+ Next n
+End Sub
+
+
+
+&apos; Note: as Shapes cannot be removed from the DrawPage without destroying
+&apos; the object we have to park them somewhere beyond the visible area of the page
+Sub ShapesToNirwana()
+Dim n as Integer
+Dim oControl as Object
+ For n = 0 To oDrawPage.Count-1
+ oDrawPage(n).Position = GetPoint(-20, -10000)
+ Next n
+End Sub
+
+
+Function CalcUniqueContentName(BYVAL oContainer as Object, sBaseName as String) as String
+
+Dim nPostfix as Integer
+Dim sReturn as String
+ nPostfix = 2
+ sReturn = sBaseName
+ while (oContainer.hasByName(sReturn))
+ sReturn = sBaseName &amp; nPostfix
+ nPostfix = nPostfix + 1
+ Wend
+ CalcUniqueContentName = sReturn
+End Function
+
+
+Function CountItemsInArray(BigArray(), SearchItem)
+Dim i as Integer
+Dim MaxIndex as Integer
+Dim ResCount as Integer
+ ResCount = 0
+ MaxIndex = Ubound(BigArray())
+ For i = 0 To MaxIndex
+ If SearchItem = BigArray(i) Then
+ ResCount = ResCount + 1
+ End If
+ Next i
+ CountItemsInArray() = ResCount
+End Function
+
+
+Function GetDBHeight(oDBModel as Object)
+ If CurControlType = cImageControl Then
+ nDBHeight = 2000
+ Else
+ If CurFieldType = com.sun.star.sdbc.DataType.LONGVARCHAR Then
+ oDBModel.MultiLine = True
+ nDBHeight = nDBRefHeight * 4
+ Else
+ nDBHeight = nDBRefHeight
+ End If
+ End If
+ GetDBHeight() = nDBHeight
+End Function
+
+
+Function GetFormWizardPaths() as Boolean
+ FormPath = GetOfficeSubPath(&quot;Template&quot;,&quot;wizard/bitmap&quot;)
+ If FormPath &lt;&gt; &quot;&quot; Then
+ WebWizardPath = GetOfficeSubPath(&quot;Template&quot;,&quot;wizard/web&quot;)
+ If WebWizardPath &lt;&gt; &quot;&quot; Then
+ WizardPath = GetOfficeSubPath(&quot;Template&quot;,&quot;wizard/&quot;)
+ If Wizardpath &lt;&gt; &quot;&quot; Then
+ TexturePath = GetOfficeSubPath(&quot;Gallery&quot;, &quot;www-back/&quot;)
+ If TexturePath &lt;&gt; &quot;&quot; Then
+ WorkPath = GetPathSettings(&quot;Work&quot;)
+ If WorkPath &lt;&gt; &quot;&quot; Then
+ TempPath = GetPathSettings(&quot;Temp&quot;)
+ If TempPath &lt;&gt; &quot;&quot; Then
+ GetFormWizardPaths = True
+ Exit Function
+ End If
+ End If
+ End If
+ End If
+ End If
+ End If
+ DisposeDocument(oDocument)
+ GetFormWizardPaths() = False
+End Function
+
+
+Function GetFilterName(sApplicationKey as String) as String
+Dim oArgs()
+Dim oFactory
+Dim i as Integer
+Dim Maxindex as Integer
+Dim UIName as String
+ oFactory = createUnoService(&quot;com.sun.star.document.FilterFactory&quot;)
+ oArgs() = oFactory.getByName(sApplicationKey)
+ MaxIndex = Ubound(oArgs())
+ For i = 0 to MaxIndex
+ If (oArgs(i).Name=&quot;UIName&quot;) Then
+ UIName = oArgs(i).Value
+ Exit For
+ End If
+ next i
+ GetFilterName() = UIName
+End Function
+</script:module>
diff --git a/wizards/source/gimmicks/AutoText.xba b/wizards/source/gimmicks/AutoText.xba
new file mode 100644
index 000000000000..5d3cc18e5e13
--- /dev/null
+++ b/wizards/source/gimmicks/AutoText.xba
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="AutoText" script:language="StarBasic">&apos; BASIC
+Option Explicit
+Dim oDocument as Object
+Dim sDocumentTitle as String
+
+
+Sub Main()
+Dim oTable as Object
+Dim oRows as Object
+Dim oDocuText as Object
+Dim oAutoTextCursor as Object
+Dim oAutoTextContainer as Object
+Dim oAutogroup as Object
+Dim oAutoText as Object
+Dim oCharStyles as Object
+Dim oContentStyle as Object
+Dim oHeaderStyle as Object
+Dim oGroupTitleStyle as Object
+Dim n, m, iAutoCount as Integer
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ sDocumentTitle = &quot;Installed AutoTexts&quot;
+
+ &apos; Open a new empty document
+ oDocument = CreateNewDocument(&quot;swriter&quot;)
+ If Not IsNull(oDocument) Then
+ oDocument.DocumentProperties.Title = sDocumentTitle
+ oDocuText = oDocument.Text
+
+ &apos; Create The Character-templates
+ oCharStyles = oDocument.StyleFamilies.GetByName(&quot;CharacterStyles&quot;)
+
+ &apos; The Characterstyle for the Header that describes the Title of Autotextgroups
+ oGroupTitleStyle = oDocument.createInstance(&quot;com.sun.star.style.CharacterStyle&quot;)
+ oCharStyles.InsertbyName(&quot;AutoTextGroupTitle&quot;, oGroupTitleStyle)
+
+ oGroupTitleStyle.CharWeight = com.sun.star.awt.FontWeight.BOLD
+ oGroupTitleStyle.CharHeight = 14
+
+ &apos; The Characterstyle for the Header that describes the Title of Autotextgroups
+ oHeaderStyle = oDocument.createInstance(&quot;com.sun.star.style.CharacterStyle&quot;)
+ oCharStyles.InsertbyName(&quot;AutoTextHeading&quot;, oHeaderStyle)
+ oHeaderStyle.CharWeight = com.sun.star.awt.FontWeight.BOLD
+
+ &apos; &quot;Ordinary&quot; Table Content
+ oContentStyle = oDocument.createInstance(&quot;com.sun.star.style.CharacterStyle&quot;)
+ oCharStyles.InsertbyName(&quot;TableContent&quot;, oContentStyle)
+
+ oAutoTextContainer = CreateUnoService(&quot;com.sun.star.text.AutoTextContainer&quot;)
+
+ oAutoTextCursor = oDocuText.CreateTextCursor()
+
+ oAutoTextCursor.CharStyleName = &quot;AutoTextGroupTitle&quot;
+ &apos; Link the Title with the following table
+ oAutoTextCursor.ParaKeepTogether = True
+
+ For n = 0 To oAutoTextContainer.Count - 1
+ oAutoGroup = oAutoTextContainer.GetByIndex(n)
+
+ oAutoTextCursor.SetString(oAutoGroup.Title)
+ oAutoTextCursor.CollapseToEnd()
+ oDocuText.insertControlCharacter(oAutoTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
+ oTable = oDocument.CreateInstance(&quot;com.sun.star.text.TextTable&quot;)
+ &apos; Divide the table if necessary
+ oTable.Split = True
+&apos; oTable.KeepTogether = False
+ oTable.RepeatHeadLine = True
+ oAutoTextCursor.Text.InsertTextContent(oAutoTextCursor,oTable,False)
+ InsertStringToCell(&quot;AutoText Name&quot;,oTable.GetCellbyPosition(0,0), &quot;AutoTextHeading&quot;)
+ InsertStringToCell(&quot;AutoText Shortcut&quot;,oTable.GetCellbyPosition(1,0), &quot;AutoTextHeading&quot;)
+ &apos; Insert one row at the bottom of the table
+ oRows = oTable.Rows
+ iAutoCount = oAutoGroup.Count
+ For m = 0 To iAutoCount-1
+ &apos; Insert the name and the title of all Autotexts
+ oAutoText = oAutoGroup.GetByIndex(m)
+ InsertStringToCell(oAutoGroup.Titles(m), oTable.GetCellbyPosition(0, m + 1), &quot;TableContent&quot;)
+ InsertStringToCell(oAutoGroup.ElementNames(m), oTable.GetCellbyPosition(1, m + 1), &quot;TableContent&quot;)
+ If m &lt; iAutoCount-1 Then
+ oRows.InsertbyIndex(m + 2,1)
+ End If
+ Next m
+ oDocuText.insertControlCharacter(oAutoTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
+ oAutoTextCursor.CollapseToEnd()
+ Next n
+ End If
+End Sub
+
+
+Sub InsertStringToCell(sCellString as String, oCell as Object, sCellStyle as String)
+Dim oCellCursor as Object
+ oCellCursor = oCell.CreateTextCursor()
+ oCellCursor.CharStyleName = sCellStyle
+ oCell.Text.insertString(oCellCursor,sCellString,False)
+ oDocument.CurrentController.Select(oCellCursor)
+End Sub</script:module>
diff --git a/wizards/source/gimmicks/ChangeAllChars.xba b/wizards/source/gimmicks/ChangeAllChars.xba
new file mode 100644
index 000000000000..aa0abaa1cca8
--- /dev/null
+++ b/wizards/source/gimmicks/ChangeAllChars.xba
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ChangeAllChars" script:language="StarBasic">&apos; This macro replaces all characters in a writer-documet through &quot;x&quot; or &quot;X&quot; signs.
+&apos; It works on the currently activated document.
+Private const UPPERREPLACECHAR = &quot;X&quot;
+Private const LOWERREPLACECHAR = &quot;x&quot;
+
+Private MSGBOXTITLE
+Private NOTSAVEDTEXT
+Private WARNING
+
+Sub ChangeAllChars &apos; Change all chars in the active document
+Dim oSheets, oPages as Object
+Dim i as Integer
+Const MBYES = 6
+Const MBABORT = 2
+Const MBNO = 7
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ MSGBOXTITLE = &quot;Change All Characters to an &apos;&quot; &amp; UPPERREPLACECHAR &amp; &quot;&apos;&quot;
+ NOTSAVEDTEXT = &quot;This document has already been modified: All characters will be changed to an &quot; &amp; UPPERREPLACECHAR &amp; &quot;&apos;. Should the document be saved now?&quot;
+ WARNING = &quot;This macro changes all characters and numbers to an &apos;&quot; &amp; UPPERREPLACECHAR &amp; &quot;&apos; in this document.&quot;
+
+ On Local Error GoTo NODOCUMENT
+ oDocument = StarDesktop.ActiveFrame.Controller.Model
+ NODOCUMENT:
+ If Err &lt;&gt; 0 Then
+ Msgbox(WARNING &amp; chr(13) &amp; &quot;First, activate a Writer document.&quot; , 16, GetProductName())
+ Exit Sub
+ End If
+ On Local Error Goto 0
+
+ sDocType = GetDocumentType(oDocument)
+
+ If oDocument.IsModified And oDocument.Url &lt;&gt; &quot;&quot; Then
+ Status = MsgBox(NOTSAVEDTEXT, 3+32, MSGBOXTITLE)
+ Select Case Status
+ Case MBYES
+ oDocument.Store
+ Case MBABORT, MBNO
+ End
+ End Select
+ Else
+ Status = MsgBox(WARNING, 3+32, MSGBOXTITLE)
+ If Status = MBNO Or Status = MBABORT Then &apos; No, Abort
+ End
+ End If
+ End If
+
+ Select Case sDocType
+ Case &quot;swriter&quot;
+ ReplaceAllStrings(oDocument)
+
+ Case Else
+ Msgbox(&quot;This macro only works with Writer documents.&quot;, 16, GetProductName())
+ End Select
+End Sub
+
+
+Sub ReplaceAllStrings(oContainer as Object)
+ ReplaceStrings(oContainer, &quot;[a-z]&quot;, LOWERREPLACECHAR)
+ ReplaceStrings(oContainer, &quot;[à-þ]&quot;, LOWERREPLACECHAR)
+ ReplaceStrings(oContainer, &quot;[A-Z]&quot;, UPPERREPLACECHAR)
+ ReplaceStrings(oContainer, &quot;[À-ß]&quot;, UPPERREPLACECHAR)
+ ReplaceStrings(oContainer, &quot;[0-9]&quot;, UPPERREPLACECHAR)
+End Sub
+
+
+Sub ReplaceStrings(oContainer as Object, sSearchString, sReplaceString as String)
+ oReplaceDesc = oContainer.createReplaceDescriptor()
+ oReplaceDesc.SearchCaseSensitive = True
+ oReplaceDesc.SearchRegularExpression = True
+ oReplaceDesc.Searchstring = sSearchString
+ oReplaceDesc.ReplaceString = sReplaceString
+ oReplCount = oContainer.ReplaceAll(oReplaceDesc)
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/gimmicks/GetTexts.xba b/wizards/source/gimmicks/GetTexts.xba
new file mode 100644
index 000000000000..c98e7d51f580
--- /dev/null
+++ b/wizards/source/gimmicks/GetTexts.xba
@@ -0,0 +1,522 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="GetTexts" script:language="StarBasic">Option Explicit
+&apos; Macro-Description:
+&apos; This Macro extracts the Strings out of the currently activated document und inserts them into a logdocument
+&apos; The aim of the macro is to provide the programmer an insight into the StarOffice API
+&apos; It focusses on how document-Objects are accessed.
+&apos; Therefor not only texts of the document-body are retrieved but also Texts of general
+&apos; document Objects like, Annotations, charts and general Document Information
+
+Public oLogDocument, oLogText, oLogCursor, oLogHeaderStyle, oLogBodyTextStyle as Object
+Public oDocument as Object
+Public LogArray(1000) as String
+Public LogIndex as Integer
+Public oLocHeaderStyle as Object
+
+Sub Main
+Dim sDocType as String
+Dim oHyperCursor as Object
+Dim oCharStyles as Object
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ On Local Error GoTo NODOCUMENT
+ oDocument = StarDesktop.ActiveFrame.Controller.Model
+ sDocType = GetDocumentType(oDocument)
+ NODOCUMENT:
+ If Err &lt;&gt; 0 Then
+ Msgbox(&quot;This macro extracts all data from the active Writer, Calc or Draw document.&quot; &amp; chr(13) &amp;_
+ &quot;To start this macro you have to activate a document first.&quot; , 16, GetProductName)
+ Exit Sub
+ End If
+ On Local Error Goto 0
+
+ &apos; Open a new document where all the texts are inserted
+ oLogDocument = CreateNewDocument(&quot;swriter&quot;)
+ If Not IsNull(oLogDocument) Then
+ oLogText = oLogDocument.Text
+
+ &apos; create and define the character styles of the Log-document
+ oCharStyles = oLogDocument.StyleFamilies.GetByName(&quot;CharacterStyles&quot;)
+ oLogHeaderStyle = oLogDocument.createInstance(&quot;com.sun.star.style.CharacterStyle&quot;)
+ oCharStyles.InsertbyName(&quot;Log Header&quot;, oLogHeaderStyle)
+
+ oLogHeaderStyle.charWeight = com.sun.star.awt.FontWeight.BOLD
+ oLogBodyTextStyle = oLogDocument.createInstance(&quot;com.sun.star.style.CharacterStyle&quot;)
+ oCharStyles.InsertbyName(&quot;Log Body&quot;, oLogBodyTextStyle)
+
+ &apos; Insert the title of the activated document as a hyperlink
+ oHyperCursor = oLogText.createTextCursor()
+ oHyperCursor.CharWeight = com.sun.star.awt.FontWeight.BOLD
+ oHyperCursor.gotoStart(False)
+ oHyperCursor.HyperLinkURL = oDocument.URL
+ oHyperCursor.HyperLinkTarget = oDocument.URL
+ If oDocument.DocumentProperties.Title &lt;&gt; &quot;&quot; Then
+ oHyperCursor.HyperlinkName = oDocument.DocumentProperties.Title
+ End If
+ oLogText.insertString(oHyperCursor, oDocument.DocumentProperties.Title, False)
+ oLogText.insertControlCharacter(oHyperCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
+
+ oLogCursor = oLogText.createTextCursor()
+ oLogCursor.GotoEnd(False)
+ &apos; &quot;Switch off&quot; the Hyperlink - Properties
+ oLogCursor.SetPropertyToDefault(&quot;HyperLinkURL&quot;)
+ oLogCursor.SetPropertyToDefault(&quot;HyperLinkTarget&quot;)
+ oLogCursor.SetPropertyToDefault(&quot;HyperLinkName&quot;)
+ LogIndex = 0
+
+ &apos; Get the Properties of the document
+ GetDocumentProps()
+
+ Select Case sDocType
+ Case &quot;swriter&quot;
+ GetWriterStrings()
+ Case &quot;scalc&quot;
+ GetCalcStrings()
+ Case &quot;sdraw&quot;, &quot;simpress&quot;
+ GetDrawStrings()
+ Case Else
+ Msgbox(&quot;This macro only works with a Writer, Calc or Draw/Impress document.&quot;, 16, GetProductName())
+ End Select
+ End If
+End Sub
+
+
+&apos; ***********************************************Calc-Documents**************************************************
+
+Sub GetCalcStrings()
+Dim i, n as integer
+Dim oSheet as Object
+Dim SheetName as String
+Dim oSheets as Object
+ &apos; Create a sequence of all sheets within the document
+ oSheets = oDocument.Sheets
+
+ For i = 0 to osheets.Count - 1
+ oSheet = osheets.GetbyIndex(i)
+ SheetName = oSheet.Name
+ MakeLogHeadLine(&quot;Sheet No. &quot; &amp; i &amp; &quot;(&quot; &amp; SheetName &amp; &quot;)&quot; )
+
+ &apos; Check the &quot;body&quot; of the sheet
+ GetCellTexts(oSheet)
+
+ If oSheet.IsScenario then
+ MakeLogHeadLine(&quot;Scenario Comments from &quot; &amp; SheetName &amp; &quot;&apos;&quot;)
+ WriteStringtoLogFile(osheet.ScenarioComment)
+ End if
+
+ GetAnnotations(oSheet, &quot;Annotations from &apos;&quot; &amp; SheetName &amp; &quot;&apos;&quot;)
+
+ GetChartStrings(oSheet, &quot;Charts from &apos;&quot; &amp; SheetName &amp; &quot;&apos;&quot;)
+
+ GetControlStrings(oSheet.DrawPage, &quot;Controls from &apos;&quot; &amp; SheetName &amp; &quot;&apos;&quot;)
+ Next
+
+ &apos; Pictures
+ GetCalcGraphicNames()
+
+ GetNamedRanges()
+End Sub
+
+
+Sub GetCellTexts(oSheet as Object)
+Dim BigRange, BigEnum, oCell as Object
+ BigRange = oDocument.CreateInstance(&quot;com.sun.star.sheet.SheetCellRanges&quot;)
+ BigRange.InsertbyName(&quot;&quot;,oSheet)
+ BigEnum = BigRange.GetCells.CreateEnumeration
+ While BigEnum.hasmoreElements
+ oCell = BigEnum.NextElement
+ If oCell.String &lt;&gt; &quot;&quot; And Val(oCell.String) = 0then
+ WriteStringtoLogFile(oCell.String)
+ End If
+ Wend
+End Sub
+
+
+Sub GetAnnotations(oSheet as Object, HeaderLine as String)
+Dim oNotes as Object
+Dim n as Integer
+ oNotes = oSheet.getAnnotations
+ If oNotes.hasElements() then
+ MakeLogHeadLine(HeaderLine)
+ For n = 0 to oNotes.Count-1
+ WriteStringtoLogFile(oNotes.GetbyIndex(n).String)
+ Next
+ End if
+End Sub
+
+
+Sub GetNamedRanges()
+Dim i as integer
+ MakeLogHeadLine(&quot;Named Ranges&quot;)
+ For i = 0 To oDocument.NamedRanges.Count - 1
+ WriteStringtoLogFile(oDocument.NamedRanges.GetbyIndex(i).Name)
+ Next
+End Sub
+
+
+Sub GetCalcGraphicNames()
+Dim n,m as integer
+ MakeLogHeadLine(&quot;Graphics&quot;)
+ For n = 0 To oDocument.Drawpages.count-1
+ For m = 0 To oDocument.Drawpages.GetbyIndex(n).Count - 1
+ WriteStringtoLogFile(oDocument.DrawPages.GetbyIndex(n).GetbyIndex(m).Text.String)
+ Next m
+ Next n
+End Sub
+
+
+&apos; ***********************************************Writer-Documents**************************************************
+
+Sub GetParagraphTexts(oParaObject as Object, HeadLine as String)
+Dim ParaEnum as Object
+Dim oPara as Object
+Dim oTextPortEnum as Object
+Dim oTextPortion as Object
+Dim i as integer
+Dim oCellNames()
+Dim oCell as Object
+
+ MakeLogHeadLine(HeadLine)
+ ParaEnum = oParaObject.Text.CreateEnumeration
+
+ While ParaEnum.HasMoreElements
+ oPara = ParaEnum.NextElement
+
+ &apos; Note: The Enumeration ParaEnum lists all tables and Paragraphs.
+ &apos; Therefor we have to find out what kind of object &quot;oPara&quot; actually is
+ If oPara.supportsService(&quot;com.sun.star.text.Paragraph&quot;) Then
+ &apos; &quot;oPara&quot; is a Paragraph
+ oTextPortEnum = oPara.createEnumeration
+ While oTextPortEnum.hasmoreElements
+ oTextPortion = oTextPortEnum.nextElement()
+ WriteStringToLogFile(oTextPortion.String)
+ Wend
+ Else
+ &apos; &quot;oPara&quot; is a table
+ oCellNames = oPara.CellNames
+ For i = 0 To Ubound(oCellNames())
+ If oCellNames(i) &lt;&gt; &quot;&quot; Then
+ oCell = oPara.getCellByName(oCellNames(i))
+ WriteStringToLogFile(oCell.String)
+ End If
+ Next
+ End If
+ Wend
+End Sub
+
+
+
+Sub GetChartStrings(oSheet as Object, HeaderLine as String)
+Dim i as Integer
+Dim aChartObject as Object
+Dim aChartDiagram as Object
+
+ MakeLogHeadLine(HeaderLine)
+
+ For i = 0 to oSheet.Charts.Count-1
+ aChartObject = oSheet.Charts.GetByIndex(i).EmbeddedObject
+ If aChartObject.HasSubTitle then
+ WriteStringToLogFile(aChartObject.SubTitle.String)
+ End If
+
+ If aChartObject.HasMainTitle then
+ WriteStringToLogFile(aChartObject.Title.String)
+ End If
+
+ aChartDiagram = aChartObject.Diagram
+
+ If aChartDiagram.hasXAxisTitle Then
+ WriteStringToLogFile(aChartDiagram.XAxisTitle)
+ End If
+
+ If aChartDiagram.hasYAxisTitle Then
+ WriteStringToLogFile(aChartDiagram.YAxisTitle)
+ End If
+
+ If aChartDiagram.hasZAxisTitle Then
+ WriteStringToLogFile(aChartDiagram.ZAxisTitle)
+ End If
+ Next i
+End Sub
+
+
+
+Sub GetFrameTexts()
+Dim i as integer
+Dim oTextFrame as object
+Dim oFrameEnum as Object
+Dim oFramePort as Object
+Dim oFrameTextEnum as Object
+Dim oFrameTextPort as Object
+
+ MakeLogHeadLine(&quot;Text Frames&quot;)
+ For i = 0 to oDocument.TextFrames.Count-1
+ oTextFrame = oDocument.TextFrames.GetbyIndex(i)
+ WriteStringToLogFile(oTextFrame.Name)
+
+ &apos; Is the frame bound to the Page
+ If oTextFrame.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE Then
+ GetParagraphTexts(oTextFrame, &quot;Text Frame Contents&quot;)
+ End If
+
+ oFrameEnum = oTextFrame.CreateEnumeration
+ While oFrameEnum.HasMoreElements
+ oFramePort = oFrameEnum.NextElement
+ If oFramePort.supportsService(&quot;com.sun.star.text.Paragraph&quot;) then
+ oFrameTextEnum = oFramePort.createEnumeration
+ While oFrameTextEnum.HasMoreElements
+ oFrameTextPort = oFrameTextEnum.NextElement
+ If oFrameTextPort.SupportsService(&quot;com.sun.star.text.TextFrame&quot;) Then
+ WriteStringtoLogFile(oFrameTextPort.String)
+ End If
+ Wend
+ Else
+ WriteStringtoLogFile(oFramePort.Name)
+ End if
+ Wend
+ Next
+End Sub
+
+
+Sub GetTextFieldStrings()
+Dim aTextField as Object
+Dim i as integer
+Dim CurElement as Object
+ MakeLogHeadLine(&quot;Text Fields&quot;)
+ aTextfield = oDocument.getTextfields.CreateEnumeration
+ While aTextField.hasmoreElements
+ CurElement = aTextField.NextElement
+ If CurElement.PropertySetInfo.hasPropertybyName(&quot;Content&quot;) Then
+ WriteStringtoLogFile(CurElement.Content)
+ ElseIf CurElement.PropertySetInfo.hasPropertybyName(&quot;PlaceHolder&quot;) Then
+ WriteStringtoLogFile(CurElement.PlaceHolder)
+ WriteStringtoLogFile(CurElement.Hint)
+ ElseIf Curelement.TextFieldMaster.PropertySetInfo.HasPropertybyName(&quot;Content&quot;) then
+ WriteStringtoLogFile(CurElement.TextFieldMaster.Content)
+ End If
+ Wend
+End Sub
+
+
+
+Sub GetLinkedFileNames()
+Dim oDocSections as Object
+Dim LinkedFileName as String
+Dim i as Integer
+ If Right(oDocument.URL,3) = &quot;sgl&quot; Then
+ MakeLogHeadLine(&quot;Sub-documents&quot;)
+ oDocSections = oDocument.TextSections
+ For i = 0 to oDocSections.Count - 1
+ LinkedFileName = oDocSections.GetbyIndex(i).FileLink.FileURL
+ If LinkedFileName &lt;&gt; &quot;&quot; Then
+ WriteStringToLogFile(LinkedFileName)
+ End If
+ Next i
+ End If
+End Sub
+
+
+Sub GetSectionNames()
+Dim i as integer
+Dim oDocSections as Object
+ MakeLogHeadLine(&quot;Sections&quot;)
+ oDocSections = oDocument.TextSections
+ For i = 0 to oDocSections.Count-1
+ WriteStringtoLogFile(oDocSections.GetbyIndex(i).Name)
+ Next
+End Sub
+
+
+Sub GetWriterStrings()
+ GetParagraphTexts(oDocument, &quot;Document Body&quot;)
+ GetGraphicNames()
+ GetStyles()
+ GetControlStrings(oDocument.DrawPage, &quot;Controls&quot;)
+ GetTextFieldStrings()
+ GetSectionNames()
+ GetFrameTexts()
+ GetHyperLinks
+ GetLinkedFileNames()
+End Sub
+
+
+&apos; ***********************************************Draw-Documents**************************************************
+
+Sub GetDrawPageTitles(LocObject as Object)
+Dim n as integer
+Dim oPage as Object
+
+ For n = 0 to LocObject.Count - 1
+ oPage = LocObject.GetbyIndex(n)
+ WriteStringtoLogFile(oPage.Name)
+ &apos; Is the Page a DrawPage and not a MasterPage?
+ If oPage.supportsService(&quot;com.sun.star.drawing.DrawPage&quot;)then
+ &apos; Get the Name of the NotesPage (only relevant for Impress-Documents)
+ If oDocument.supportsService(&quot;com.sun.star.presentation.PresentationDocument&quot;) then
+ WriteStringtoLogFile(oPage.NotesPage.Name)
+ End If
+ End If
+ Next
+End Sub
+
+
+Sub GetPageStrings(oPages as Object)
+Dim m, n, s as Integer
+Dim oPage, oPageElement, oShape as Object
+ For n = 0 to oPages.Count-1
+ oPage = oPages.GetbyIndex(n)
+ If oPage.HasElements then
+ For m = 0 to oPage.Count-1
+ oPageElement = oPage.GetByIndex(m)
+ If HasUnoInterfaces(oPageElement,&quot;com.sun.star.container.XIndexAccess&quot;) Then
+ &apos; The Object &quot;oPageElement&quot; a group of Shapes, that can be accessed by their index
+ For s = 0 To oPageElement.Count - 1
+ WriteStringToLogFile(oPageElement.GetByIndex(s).String)
+ Next s
+ ElseIf HasUnoInterfaces(oPageElement, &quot;com.sun.star.text.XText&quot;) Then
+ WriteStringtoLogFile(oPageElement.String)
+ End If
+ Next
+ End If
+ Next
+End Sub
+
+
+Sub GetDrawStrings()
+Dim oDPages, oMPages as Object
+
+ oDPages = oDocument.DrawPages
+ oMPages = oDocument.Masterpages
+
+ MakeLogHeadLine(&quot;Titles&quot;)
+ GetDrawPageTitles(oDPages)
+ GetDrawPageTitles(oMPages)
+
+ MakeLogHeadLine(&quot;Document Body&quot;)
+ GetPageStrings(oDPages)
+ GetPageStrings(oMPages)
+End Sub
+
+
+&apos; ***********************************************Misc**************************************************
+
+Sub GetDocumentProps()
+Dim oDocuProps as Object
+ MakeLogHeadLine(&quot;Document Properties&quot;)
+ oDocuProps = oDocument.DocumentProperties
+ WriteStringToLogFile(oDocuProps.Title)
+ WriteStringToLogFile(oDocuProps.Description)
+ WriteStringToLogFile(oDocuProps.Subject)
+ WriteStringToLogFile(oDocuProps.Author)
+&apos; WriteStringToLogFile(oDocuProps.UserDefinedProperties.ReplyTo)
+&apos; WriteStringToLogFile(oDocuProps.UserDefinedProperties.Recipient)
+&apos; WriteStringToLogFile(oDocuProps.UserDefinedProperties.References)
+&apos; WriteStringToLogFile(oDocuProps.Keywords)
+End Sub
+
+
+Sub GetHyperlinks()
+Dim i as integer
+Dim oCrsr as Object
+Dim oAllHyperLinks as Object
+Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
+Dim oSearchDesc as Object
+
+ MakeLogHeadLine(&quot;Hyperlinks&quot;)
+ &apos; create a Search-Descriptor
+ oSearchDesc = oDocument.CreateSearchDescriptor
+ oSearchDesc.Valuesearch = False
+
+ &apos; define the Search-attributes
+ srchattributes(0).Name = &quot;HyperLinkURL&quot;
+ srchattributes(0).Value = &quot;&quot;
+ oSearchDesc.SetSearchAttributes(SrchAttributes())
+
+ oAllHyperLinks = oDocument.findAll(oSearchDesc())
+
+ For i = 0 to oAllHyperLinks.Count - 1
+ oFound = oAllHyperLinks(i)
+ oCrsr = oFound.Text.createTextCursorByRange(oFound)
+ WriteStringToLogFile(oCrs.HyperLinkURL) &apos;Url
+ WriteStringToLogFile(oCrs.HyperLinkTarget) &apos;Name
+ WriteStringToLogFile(oCrs.HyperLinkName) &apos;Frame
+ Next i
+End Sub
+
+
+Sub GetGraphicNames()
+Dim i as integer
+Dim oDocGraphics as Object
+ MakeLogHeadLine(&quot;Graphics&quot;)
+ oDocGraphics = oDocument.GraphicObjects
+ For i = 0 to oDocGraphics.count - 1
+ WriteStringtoLogFile(oDocGraphics.GetbyIndex(i).Name)
+ Next
+End Sub
+
+
+Sub GetStyles()
+Dim m,n as integer
+ MakeLogHeadLine(&quot;User-defined Templates&quot;)
+
+ &apos; Check all StyleFamilies(i.e. PageStyles, ParagraphStyles, CharacterStyles, cellStyles)
+ For n = 0 to oDocument.StyleFamilies.Count - 1
+ For m = 0 to oDocument.StyleFamilies.getbyIndex(n).Count-1
+ If oDocument.StyleFamilies.GetbyIndex(n).getbyIndex(m).IsUserDefined then
+ WriteStringtoLogFile(oDocument.StyleFamilies.GetbyIndex(n).getbyIndex(m).Name)
+ End If
+ Next
+ Next
+End Sub
+
+
+Sub GetControlStrings(oDPage as Object, HeaderLine as String)
+Dim aForm as Object
+Dim m,n as integer
+ MakeLogHeadLine(HeaderLine)
+ &apos;SearchFor all possible Controls
+ For n = 0 to oDPage.Forms.Count - 1
+ aForm = oDPage.Forms(n)
+ For m = 0 to aForm.Count-1
+ GetControlContent(aForm.GetbyIndex(m))
+ Next
+ Next
+End Sub
+
+
+Sub GetControlContent(LocControl as Object)
+Dim i as integer
+
+ If LocControl.PropertySetInfo.HasPropertybyName(&quot;Label&quot;) then
+ WriteStringtoLogFile(LocControl.Label)
+
+ ElseIf LocControl.SupportsService(&quot;com.sun.star.form.component.ListBox&quot;) then
+ For i = 0 to Ubound(LocControl.StringItemList())
+ WriteStringtoLogFile(LocControl.StringItemList(i))
+ Next
+ End If
+ If LocControl.PropertySetInfo.HasPropertybyName(&quot;HelpText&quot;) then
+ WriteStringtoLogFile(LocControl.Helptext)
+ End If
+End Sub
+
+&apos; ***********************************************LogDocument**************************************************
+
+Sub WriteStringtoLogFile( sString as String)
+ If (Not FieldInArray(LogArray(),LogIndex,sString))AND (NOT ISNULL(sString)) Then
+ LogArray(LogIndex) = sString
+ LogIndex = LogIndex + 1
+ oLogText.insertString(oLogCursor,sString,False)
+ oLogText.insertControlCharacter(oLogCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
+ End If
+End Sub
+
+
+Sub MakeLogHeadLine(HeadText as String)
+ oLogCursor.CharStyleName = &quot;Log Header&quot;
+ oLogText.insertControlCharacter(oLogCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
+ oLogText.insertString(oLogCursor,HeadText,False)
+ oLogText.insertControlCharacter(oLogCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
+ oLogCursor.CharStyleName = &quot;Log Body&quot;
+End Sub
+</script:module>
diff --git a/wizards/source/gimmicks/ReadDir.xba b/wizards/source/gimmicks/ReadDir.xba
new file mode 100644
index 000000000000..370f8cbc1915
--- /dev/null
+++ b/wizards/source/gimmicks/ReadDir.xba
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ReadDir" script:language="StarBasic">Option Explicit
+Public Const SBPAGEX = 800
+Public Const SBPAGEY = 800
+Public Const SBRELDIST = 1.3
+
+&apos; Names of the second Dimension of the Array iLevelPos
+Public Const SBBASEX = 0
+Public Const SBBASEY = 1
+
+Public Const SBOLDSTARTX = 2
+Public Const SBOLDSTARTY = 3
+
+Public Const SBOLDENDX = 4
+Public Const SBOLDENDY = 5
+
+Public Const SBNEWSTARTX = 6
+Public Const SBNEWSTARTY = 7
+
+Public Const SBNEWENDX = 8
+Public Const SBNEWENDY = 9
+
+Public ConnectLevel As Integer
+Public iLevelPos(1,9) As Long
+Public Source as String
+Public iCurLevel as Integer
+Public nConnectLevel as Integer
+Public nOldWidth, nOldHeight As Long
+Public nOldX, nOldY, nOldLevel As Integer
+Public oOldLeavingLine As Object
+Public oOldArrivingLine As Object
+Public DlgReadDir as Object
+Dim oProgressBar as Object
+Dim oDocument As Object
+Dim oPage As Object
+
+
+Sub Main()
+Dim oStandardTemplate as Object
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ oDocument = CreateNewDocument(&quot;sdraw&quot;)
+ If Not IsNull(oDocument) Then
+ oPage = oDocument.DrawPages(0)
+ oStandardTemplate = oDocument.StyleFamilies.GetByName(&quot;graphics&quot;).GetByName(&quot;standard&quot;)
+ oStandardTemplate.CharHeight = 10
+ oStandardTemplate.TextLeftDistance = 100
+ oStandardTemplate.TextRightDistance = 100
+ oStandardTemplate.TextUpperDistance = 50
+ oStandardTemplate.TextLowerDistance = 50
+ DlgReadDir = LoadDialog(&quot;Gimmicks&quot;,&quot;ReadFolderDlg&quot;)
+ oProgressBar = DlgReadDir.Model.ProgressBar1
+ DlgReadDir.Model.TextField1.Text = ConvertFromUrl(GetPathSettings(&quot;Work&quot;))
+ DlgReadDir.Model.cmdGoOn.DefaultButton = True
+ DlgReadDir.GetControl(&quot;TextField1&quot;).SetFocus()
+ DlgReadDir.Execute
+ End If
+End Sub
+
+
+Sub TreeInfo()
+Dim oCurTextShape As Object
+Dim i as Integer
+Dim bStartUpRun As Boolean
+Dim CurFilename as String
+Dim BaseLevel as Integer
+Dim oController as Object
+Dim MaxFileIndex as Integer
+Dim FileNames() as String
+ ToggleDialogControls(False)
+ oProgressBar.ProgressValueMin = 0
+ oProgressBar.ProgressValueMax = 100
+ bStartUpRun = True
+ nOldHeight = 200
+ nOldY = SBPAGEY
+ nOldX = SBPAGEX
+ nOldWidth = SBPAGEX
+ oController = oDocument.GetCurrentController
+ Source = ConvertToURL(DlgReadDir.Model.TextField1.Text)
+ BaseLevel = CountCharsInString(Source, &quot;/&quot;, 1)
+ oProgressBar.ProgressValue = 5
+ DlgReadDir.Model.Label3.Enabled = True
+ FileNames() = ReadSourceDirectory(Source)
+ DlgReadDir.Model.Label4.Enabled = True
+ DlgReadDir.Model.Label3.Enabled = False
+ oProgressBar.ProgressValue = 12
+ FileNames() = BubbleSortList(FileNames())
+ DlgReadDir.Model.Label5.Enabled = True
+ DlgReadDir.Model.Label4.Enabled = False
+ oProgressBar.ProgressValue = 20
+ MaxFileIndex = Ubound(FileNames(),1)
+ For i = 0 To MaxFileIndex
+ oProgressBar.ProgressValue = 20 + (i/MaxFileIndex * 80)
+ CurFilename = FileNames(i,1)
+ SetNewLevels(FileNames(i,0), BaseLevel)
+ oCurTextShape = CreateTextShape(oPage, CurFilename)
+ CheckPageWidth(oCurTextShape.Size.Width)
+ iLevelPos(iCurLevel,SBBASEY) = oCurTextShape.Position.Y
+ If i = 0 Then
+ AdjustPageHeight(oCurTextShape.Size.Height, MaxFileIndex + 1)
+ End If
+ &apos; The Current TextShape has To be connected with a TextShape one Level higher
+ &apos; except for a TextShape In Level 0:
+ If Not bStartUpRun Then
+ &apos; A leaving Line Is only drawn when level is not 0
+ If iCurLevel&lt;&gt; 0 Then
+ &apos; Determine the Coordinates of the arriving Line
+ iLevelPos(iCurLevel,SBOLDSTARTX) = iLevelPos(nConnectLevel,SBNEWSTARTX)
+ iLevelPos(iCurLevel,SBOLDSTARTY) = oCurTextShape.Position.Y + 0.5 * oCurTextShape.Size.Height
+
+ iLevelPos(iCurLevel,SBOLDENDX) = iLevelPos(iCurLevel,SBBASEX)
+ iLevelPos(iCurLevel,SBOLDENDY) = oCurTextShape.Position.Y + 0.5 * oCurTextShape.Size.Height
+
+ oOldArrivingLine = DrawLine(iCurLevel, SBOLDSTARTX, SBOLDSTARTY, SBOLDENDX, SBOLDENDY, oPage)
+
+ &apos; Determine the End-Coordinates of the last leaving Line
+ iLevelPos(nConnectLevel,SBNEWENDX) = iLevelPos(nConnectLevel,SBNEWSTARTX)
+ iLevelPos(nConnectLevel,SBNEWENDY) = oCurTextShape.Position.Y + 0.5 * oCurTextShape.Size.Height
+ Else
+ &apos; On Level 0 the last Leaving Line&apos;s Endpoint is the upper edge of the TextShape
+ iLevelPos(nConnectLevel,SBNEWENDY) = oCurTextShape.Position.Y
+ iLevelPos(nConnectLevel,SBNEWENDX) = iLevelPos(nConnectLevel,SBNEWSTARTX)
+ End If
+ &apos; Draw the Connectors To the previous TextShapes
+ oOldLeavingLine = DrawLine(nConnectLevel, SBNEWSTARTX, SBNEWSTARTY, SBNEWENDX, SBNEWENDY, oPage)
+ Else
+ &apos; StartingPoint of the leaving Edge
+ bStartUpRun = FALSE
+ End If
+
+ &apos; Determine the beginning Coordinates of the leaving Line
+ iLevelPos(iCurLevel,SBNEWSTARTX) = iLevelPos(iCurLevel,SBBASEX) + 0.5 * oCurTextShape.Size.Width
+ iLevelPos(iCurLevel,SBNEWSTARTY) = iLevelPos(iCurLevel,SBBASEY) + oCurTextShape.Size.Height
+
+ &apos; Save the values For the Next run
+ nOldHeight = oCurTextShape.Size.Height
+ nOldX = oCurTextShape.Position.X
+ nOldWidth = oCurTextShape.Size.Width
+ nOldLevel = iCurLevel
+ Next i
+ ToggleDialogControls(True)
+ DlgReadDir.Model.cmdGoOn.Enabled = False
+End Sub
+
+
+Function CreateTextShape(oPage as Object, Filename as String)
+Dim oTextShape As Object
+Dim aPoint As New com.sun.star.awt.Point
+
+ aPoint.X = CalculateXPoint()
+ aPoint.Y = nOldY + SBRELDIST * nOldHeight
+ nOldY = aPoint.Y
+
+ oTextShape = oDocument.createInstance(&quot;com.sun.star.drawing.TextShape&quot;)
+ oTextShape.LineStyle = 1
+ oTextShape.Position = aPoint
+
+ oPage.add(oTextShape)
+ oTextShape.TextAutoGrowWidth = TRUE
+ oTextShape.TextAutoGrowHeight = TRUE
+ oTextShape.String = FileName
+
+ &apos; Configure Size And Position of the TextShape according to its Scripting
+ aPoint.X = iLevelPos(iCurLevel,SBBASEX)
+ oTextShape.Position = aPoint
+ CreateTextShape() = oTextShape
+End Function
+
+
+Function CalculateXPoint()
+ &apos; The current level Is lower than the Old one
+ If (iCurLevel&lt; nOldLevel) And (iCurLevel&lt;&gt; 0) Then
+ &apos; ClearArray(iLevelPos(),iCurLevel+1)
+ Elseif iCurLevel= 0 Then
+ iLevelPos(iCurLevel,SBBASEX) = SBPAGEX
+ &apos; The current level Is higher than the old one
+ Elseif iCurLevel&gt; nOldLevel Then
+ iLevelPos(iCurLevel,SBBASEX) = iLevelPos(iCurLevel-1,SBBASEX) + nOldWidth + 100
+ End If
+ CalculateXPoint = iLevelPos(iCurLevel,SBBASEX)
+End Function
+
+
+Function DrawLine(nLevel, nStartX, nStartY, nEndX, nEndY As Integer, oPage as Object)
+Dim oConnect As Object
+Dim aPoint As New com.sun.star.awt.Point
+Dim aSize As New com.sun.star.awt.Size
+ aPoint.X = iLevelPos(nLevel,nStartX)
+ aPoint.Y = iLevelPos(nLevel,nStartY)
+ aSize.Width = iLevelPos(nLevel,nEndX) - iLevelPos(nLevel,nStartX)
+ aSize.Height = iLevelPos(nLevel,nEndY) - iLevelPos(nLevel,nStartY)
+ oConnect = oDocument.createInstance(&quot;com.sun.star.drawing.LineShape&quot;)
+ oConnect.Position = aPoint
+ oConnect.Size = aSize
+ oPage.Add(oConnect)
+ DrawLine() = oConnect
+End Function
+
+
+Sub GetSourceDirectory()
+ GetFolderName(DlgReadDir.Model.TextField1)
+End Sub
+
+
+Function ReadSourceDirectory(ByVal Source As String)
+Dim i as Integer
+Dim m as Integer
+Dim n as Integer
+Dim s as integer
+Dim FileName as string
+Dim FileNameList(100,1) as String
+Dim DirList(0) as String
+Dim oUCBobject as Object
+Dim DirContent() as String
+Dim SystemPath as String
+Dim PathSeparator as String
+Dim MaxFileIndex as Integer
+ PathSeparator = GetPathSeparator()
+ oUcbobject = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ m = 0
+ s = 0
+ DirList(0) = Source
+ FileNameList(n,0) = Source
+ SystemPath = ConvertFromUrl(Source)
+ FileNameList(n,1) = FileNameoutofPath(SystemPath, PathSeparator)
+ n = 1
+ Do
+ Source = DirList(m)
+ m = m + 1
+ DirContent() = oUcbObject.GetFolderContents(Source,True)
+ If Ubound(DirContent()) &lt;&gt; -1 Then
+ MaxFileIndex = Ubound(DirContent())
+ For i = 0 to MaxFileIndex
+ FileName = DirContent(i)
+ FileNameList(n,0) = FileName
+ SystemPath = ConvertFromUrl(FileName)
+ FileNameList(n,1) = FileNameOutofPath(SystemPath, PathSeparator)
+ n = n + 1
+ If n &gt; Ubound(FileNameList(),1) Then
+ ReDim Preserve FileNameList(n + 10,1) as String
+ End If
+ If oUcbObject.IsFolder(FileName) Then
+ s = s + 1
+ ReDim Preserve DirList(s) as String
+ DirList(s) = FileName
+ End If
+ Next i
+ End If
+ Loop Until m &gt; Ubound(DirList()
+ ReDim Preserve FileNameList(n-1,1) as String
+ ReadSourceDirectory() = FileNameList()
+End Function
+
+
+Sub CloseDialog
+ DlgReadDir.EndExecute
+End Sub
+
+
+Sub AdjustPageHeight(lShapeHeight, FileCount)
+Dim lNecHeight as Long
+Dim lBorders as Long
+ oDocument.LockControllers
+ lBorders = oPage.BorderTop + oPage.BorderBottom
+ lNecHeight = SBPAGEY + (FileCount * SBRELDIST * lShapeHeight)
+ If lNecHeight &gt; (oPage.Height - lBorders) Then
+ oPage.Height = lNecHeight + lBorders + 500
+ End If
+ oDocument.UnlockControllers
+End Sub
+
+
+Sub SetNewLevels(FileName as String, BaseLevel as Integer)
+ iCurLevel= CountCharsInString(FileName, &quot;/&quot;, 1) - BaseLevel
+ If iCurLevel &lt;&gt; 0 Then
+ nConnectLevel = iCurLevel- 1
+ Else
+ nConnectLevel = iCurLevel
+ End If
+ If iCurLevel &gt; Ubound(iLevelPos(),1) Then
+ ReDim Preserve iLevelPos(iCurLevel,9) as Long
+ End If
+End Sub
+
+
+Sub CheckPageWidth(TextWidth as Long)
+Dim PageWidth as Long
+Dim BaseX as Long
+ PageWidth = oPage.Width
+ BaseX = iLevelPos(iCurLevel,SBBASEX)
+ If BaseX + TextWidth &gt; PageWidth - 1000 Then
+ oPage.Width = 1000 + BaseX + TextWidth
+ End If
+End Sub
+
+
+Sub ToggleDialogControls(bDoEnable as Boolean)
+ With DlgReadDir.Model
+ .cmdGoOn.Enabled = bDoEnable
+ .cmdGetDir.Enabled = bDoEnable
+ .Label1.Enabled = bDoEnable
+ .Label2.Enabled = bDoEnable
+ .TextField1.Enabled = bDoEnable
+ End With
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/gimmicks/ReadFolderDlg.xdl b/wizards/source/gimmicks/ReadFolderDlg.xdl
new file mode 100644
index 000000000000..e49127db2f13
--- /dev/null
+++ b/wizards/source/gimmicks/ReadFolderDlg.xdl
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="ReadFolderDlg" dlg:left="161" dlg:top="81" dlg:width="180" dlg:height="136" dlg:closeable="true" dlg:moveable="true" dlg:title="Read and Design Recursively">
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="cmdGetDir" dlg:tab-index="0" dlg:left="161" dlg:top="49" dlg:width="14" dlg:height="14" dlg:value="...">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.ReadDir.GetSourceDirectory?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:textfield dlg:id="TextField1" dlg:tab-index="1" dlg:left="6" dlg:top="50" dlg:width="147" dlg:height="12"/>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="2" dlg:left="49" dlg:top="115" dlg:width="35" dlg:height="14" dlg:value="~Cancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.ReadDir.CloseDialog?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdGoOn" dlg:tab-index="3" dlg:left="95" dlg:top="115" dlg:width="35" dlg:height="14" dlg:value="~GoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.ReadDir.TreeInfo?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:text dlg:id="Label1" dlg:tab-index="4" dlg:left="6" dlg:top="38" dlg:width="122" dlg:height="8" dlg:value="Top level path"/>
+ <dlg:text dlg:id="Label2" dlg:tab-index="5" dlg:left="6" dlg:top="4" dlg:width="168" dlg:height="26" dlg:value="This macro will create a drawing document and design a complete tree view of all subdirectories from a given path." dlg:multiline="true"/>
+ <dlg:progressmeter dlg:id="ProgressBar1" dlg:tab-index="6" dlg:left="6" dlg:top="101" dlg:width="170" dlg:height="10"/>
+ <dlg:text dlg:id="Label3" dlg:tab-index="7" dlg:disabled="true" dlg:left="6" dlg:top="69" dlg:width="170" dlg:height="8" dlg:value="Getting the files and subdirectories..."/>
+ <dlg:text dlg:id="Label4" dlg:tab-index="8" dlg:disabled="true" dlg:left="6" dlg:top="80" dlg:width="170" dlg:height="8" dlg:value="Sorting the files and subdirectories..."/>
+ <dlg:text dlg:id="Label5" dlg:tab-index="9" dlg:disabled="true" dlg:left="6" dlg:top="91" dlg:width="170" dlg:height="8" dlg:value="Drawing the filestructure..."/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/gimmicks/UserfieldDlg.xdl b/wizards/source/gimmicks/UserfieldDlg.xdl
new file mode 100644
index 000000000000..408f3c8be305
--- /dev/null
+++ b/wizards/source/gimmicks/UserfieldDlg.xdl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="UserfieldDlg" dlg:left="161" dlg:top="57" dlg:width="281" dlg:height="214" dlg:closeable="true" dlg:moveable="true" dlg:title="Modify User Data">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="Label1" dlg:tab-index="0" dlg:left="6" dlg:top="48" dlg:width="57" dlg:height="8" dlg:value="Label1"/>
+ <dlg:text dlg:id="Label2" dlg:tab-index="1" dlg:left="6" dlg:top="64" dlg:width="57" dlg:height="8" dlg:value="Label2"/>
+ <dlg:text dlg:id="Label3" dlg:tab-index="2" dlg:left="6" dlg:top="80" dlg:width="57" dlg:height="8" dlg:value="Label3"/>
+ <dlg:text dlg:id="Label4" dlg:tab-index="3" dlg:left="6" dlg:top="96" dlg:width="57" dlg:height="8" dlg:value="Label4"/>
+ <dlg:text dlg:id="Label5" dlg:tab-index="4" dlg:left="6" dlg:top="112" dlg:width="57" dlg:height="8" dlg:value="Label5"/>
+ <dlg:text dlg:id="Label6" dlg:tab-index="5" dlg:left="6" dlg:top="128" dlg:width="57" dlg:height="8" dlg:value="Label6"/>
+ <dlg:text dlg:id="Label7" dlg:tab-index="6" dlg:left="6" dlg:top="144" dlg:width="57" dlg:height="8" dlg:value="Label7"/>
+ <dlg:text dlg:id="Label8" dlg:tab-index="7" dlg:left="6" dlg:top="160" dlg:width="57" dlg:height="8" dlg:value="Label8"/>
+ <dlg:text dlg:id="Label9" dlg:tab-index="8" dlg:left="6" dlg:top="176" dlg:width="57" dlg:height="8" dlg:value="Label9"/>
+ <dlg:textfield dlg:id="TextField1" dlg:tab-index="9" dlg:left="65" dlg:top="46" dlg:width="193" dlg:height="12"/>
+ <dlg:textfield dlg:id="TextField2" dlg:tab-index="10" dlg:left="65" dlg:top="62" dlg:width="193" dlg:height="12"/>
+ <dlg:textfield dlg:id="TextField3" dlg:tab-index="11" dlg:left="65" dlg:top="78" dlg:width="193" dlg:height="12"/>
+ <dlg:textfield dlg:id="TextField4" dlg:tab-index="12" dlg:left="65" dlg:top="94" dlg:width="193" dlg:height="12"/>
+ <dlg:textfield dlg:id="TextField5" dlg:tab-index="13" dlg:left="65" dlg:top="110" dlg:width="193" dlg:height="12"/>
+ <dlg:textfield dlg:id="TextField6" dlg:tab-index="14" dlg:left="65" dlg:top="126" dlg:width="193" dlg:height="12"/>
+ <dlg:textfield dlg:id="TextField7" dlg:tab-index="15" dlg:left="65" dlg:top="142" dlg:width="193" dlg:height="12"/>
+ <dlg:textfield dlg:id="TextField8" dlg:tab-index="16" dlg:left="65" dlg:top="158" dlg:width="193" dlg:height="12"/>
+ <dlg:textfield dlg:id="TextField9" dlg:tab-index="17" dlg:left="65" dlg:top="174" dlg:width="193" dlg:height="12"/>
+ <dlg:scrollbar dlg:id="ScrollBar1" dlg:tab-index="18" dlg:left="263" dlg:top="46" dlg:width="12" dlg:height="140" dlg:align="vertical">
+ <script:event script:event-name="on-adjustmentvaluechange" script:macro-name="vnd.sun.star.script:Gimmicks.Userfields.ScrollControls?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:scrollbar>
+ <dlg:button dlg:id="cmdQuit" dlg:tab-index="19" dlg:left="6" dlg:top="193" dlg:width="35" dlg:height="14" dlg:help-text="Exit Macro" dlg:value="Exit">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.Userfields.StopMacro?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdSave" dlg:tab-index="20" dlg:left="45" dlg:top="193" dlg:width="35" dlg:height="14" dlg:help-text="Save All Data of All Users to File" dlg:value="~Save">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.Userfields.SaveSettings?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdSelect" dlg:tab-index="21" dlg:left="84" dlg:top="193" dlg:width="35" dlg:height="14" dlg:help-text="Replace the User Data in &lt;PRODUCTNAME&gt; With the User Data Above" dlg:value="Se~lect">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.Userfields.SelectCurrentFields?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdNextUser" dlg:tab-index="22" dlg:left="162" dlg:top="193" dlg:width="35" dlg:height="14" dlg:tag="1" dlg:help-text="Show Data of Next User" dlg:value="Next &gt;&gt;">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.Userfields.StepToRecord?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdPrevUser" dlg:tab-index="23" dlg:left="123" dlg:top="193" dlg:width="35" dlg:height="14" dlg:tag="-1" dlg:help-text="Show Data of Previous User" dlg:value="&lt;&lt;Previous">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.Userfields.StepToRecord?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="CommandButton1" dlg:tab-index="24" dlg:left="201" dlg:top="193" dlg:width="35" dlg:height="14" dlg:help-text="Add Data for New User" dlg:value="~New">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.Userfields.AddRecord?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:text dlg:id="Label10" dlg:tab-index="25" dlg:left="6" dlg:top="6" dlg:width="269" dlg:height="34" dlg:value="This macro lets you easily administrate several user profiles.&#x0a;The user data of several users may be stored in a single file in the directory &lt;ConfigDir&gt;. From there, you can select a particular user whose data is then the current user data in &lt;PRODUCTNAME&gt;." dlg:multiline="true"/>
+ <dlg:button dlg:id="cmdDelete" dlg:tab-index="26" dlg:left="240" dlg:top="193" dlg:width="35" dlg:height="14" dlg:help-text="Delete Data of Current User" dlg:value="Delete">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Gimmicks.Userfields.DeleteCurrentSettings?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/gimmicks/Userfields.xba b/wizards/source/gimmicks/Userfields.xba
new file mode 100644
index 000000000000..391337c6a357
--- /dev/null
+++ b/wizards/source/gimmicks/Userfields.xba
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Userfields" script:language="StarBasic">Option Explicit
+&apos;Todo: Controlling Scrollbar via Keyboard
+
+Public Const SBMAXFIELDINDEX = 14
+
+Public DlgUserFields as Object
+Public oDocument as Object
+Public UserFieldDataType(SBMAXFIELDINDEX,1) as String
+Public ScrollBarValue as Integer
+Public UserFieldFamily(0, SBMAXfIELDINDEX) as String
+Public Const SBTBCOUNT = 9
+Public oUserDataAccess as Object
+Public CurFieldIndex as Integer
+Public FilePath as String
+
+Sub StartChangesUserfields
+Dim SystemPath as String
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ UserFieldDatatype(0,0) = &quot;COMPANY&quot;
+ UserFieldDatatype(0,1) = &quot;o&quot;
+ UserFieldDatatype(1,0) = &quot;FIRSTNAME&quot;
+ UserFieldDatatype(1,1) = &quot;givenname&quot;
+ UserFieldDatatype(2,0) = &quot;LASTNAME&quot;
+ UserFieldDatatype(2,1) = &quot;sn&quot;
+ UserFieldDatatype(3,0) = &quot;INITIALS&quot;
+ UserFieldDatatype(3,1) = &quot;initials&quot;
+ UserFieldDatatype(4,0) = &quot;STREET&quot;
+ UserFieldDatatype(4,1) = &quot;street&quot;
+ UserFieldDatatype(5,0) = &quot;COUNTRY&quot;
+ UserFieldDatatype(5,1) = &quot;c&quot;
+ UserFieldDatatype(6,0) = &quot;ZIP&quot;
+ UserFieldDatatype(6,1) = &quot;postalcode&quot;
+ UserFieldDatatype(7,0) = &quot;CITY&quot;
+ UserFieldDatatype(7,1) = &quot;l&quot;
+ UserFieldDatatype(8,0) = &quot;TITLE&quot;
+ UserFieldDatatype(8,1) = &quot;title&quot;
+ UserFieldDatatype(9,0) = &quot;POSITION&quot;
+ UserFieldDatatype(9,1) = &quot;position&quot;
+ UserFieldDatatype(10,0) = &quot;PHONE_HOME&quot;
+ UserFieldDatatype(10,1) = &quot;homephone&quot;
+ UserFieldDatatype(11,0) = &quot;PHONE_WORK&quot;
+ UserFieldDatatype(11,1) = &quot;telephonenumber&quot;
+ UserFieldDatatype(12,0) = &quot;FAX&quot;
+ UserFieldDatatype(12,1) = &quot;facsimiletelephonenumber&quot;
+ UserFieldDatatype(13,0) = &quot;E-MAIL&quot;
+ UserFieldDatatype(13,1) = &quot;mail&quot;
+ UserFieldDatatype(14,0) = &quot;STATE&quot;
+ UserFieldDatatype(14,1) = &quot;st&quot;
+ FilePath = GetPathSettings(&quot;Config&quot;, False) &amp; &quot;/&quot; &amp; &quot;UserData.dat&quot;
+ DlgUserFields = LoadDialog(&quot;Gimmicks&quot;,&quot;UserfieldDlg&quot;)
+ SystemPath = ConvertFromUrl(FilePath)
+ DlgUserFields.Model.Label10.Label = ReplaceString(DlgUserFields.Model.Label10.Label, &quot;&apos;&quot; &amp; SystemPath &amp; &quot;&apos;&quot;, &quot;&lt;ConfigDir&gt;&quot;)
+ DlgUserFields.Model.Label10.Label = ReplaceString(DlgUserFields.Model.Label10.Label, GetProductName(), &quot;&lt;PRODUCTNAME&gt;&quot;)
+ DlgUserFields.Model.cmdSelect.HelpText = ReplaceString(DlgUserFields.Model.cmdSelect.HelpText, GetProductName(), &quot;&lt;PRODUCTNAME&gt;&quot;)
+ ScrollBarValue = 0
+ oUserDataAccess = GetRegistryKeyContent(&quot;org.openoffice.UserProfile/Data&quot;, True)
+ InitializeUserFamily()
+ FillDialog()
+ DlgUserFields.Execute
+ DlgUserFields.Dispose()
+End Sub
+
+
+Sub FillDialog()
+Dim a as Integer
+ With DlgUserFields
+ For a = 1 To SBTBCount
+ .GetControl(&quot;Label&quot; &amp; a).Model.Label = UserFieldDataType(a-1,0)
+ .GetControl(&quot;TextField&quot; &amp; a).Model.Text = UserFieldFamily(CurFieldIndex, a-1)
+ Next a
+ .Model.ScrollBar1.ScrollValueMax = (SBMAXFIELDINDEX+1) - SBTBCOUNT
+ .Model.ScrollBar1.BlockIncrement = SBTBCOUNT
+ .Model.ScrollBar1.LineIncrement = 1
+ .Model.ScrollBar1.ScrollValue = ScrollBarValue
+ End With
+End Sub
+
+
+Sub ScrollControls()
+ ScrollTextFieldInfo(ScrollBarValue)
+ ScrollBarValue = DlgUserFields.Model.ScrollBar1.ScrollValue
+ If (ScrollBarValue + SBTBCOUNT) &gt;= SBMAXFIELDINDEX + 1 Then
+ ScrollBarValue = (SBMAXFIELDINDEX + 1) - SBTBCOUNT
+ End If
+ FillupTextFields()
+End Sub
+
+
+Sub ScrollTextFieldInfo(ByVal iScrollValue as Integer)
+Dim a as Integer
+Dim CurIndex as Integer
+ For a = 1 To SBTBCOUNT
+ CurIndex = (a-1) + iScrollValue
+ UserFieldFamily(CurFieldIndex,CurIndex) = DlgUserFields.GetControl(&quot;TextField&quot; &amp; a).Model.Text
+ Next a
+End Sub
+
+
+Sub StopMacro()
+ DlgUserFields.EndExecute
+End Sub
+
+
+Sub SaveSettings()
+Dim n as Integer
+Dim m as Integer
+Dim MaxIndex as Integer
+ ScrollTextFieldInfo(DlgUserFields.Model.ScrollBar1.ScrollValue)
+ MaxIndex = Ubound(UserFieldFamily(), 1)
+ Dim FileStrings(MaxIndex) as String
+ For n = 0 To MaxIndex
+ FileStrings(n) = &quot;&quot;
+ For m = 0 To SBMAXFIELDINDEX
+ FileStrings(n) = FileStrings(n) &amp; UserFieldFamily(n,m) &amp; &quot;;&quot;
+ Next m
+ Next n
+ SaveDataToFile(FilePath, FileStrings(), True)
+End Sub
+
+
+Sub ToggleButtons(ByVal Index as Integer)
+Dim i as Integer
+ CurFieldIndex = Index
+ DlgUserFields.Model.cmdNextUser.Enabled = CurFieldIndex &lt;&gt; Ubound(UserFieldFamily(), 1)
+ DlgUserFields.Model.cmdPrevUser.Enabled = CurFieldIndex &lt;&gt; 0
+End Sub
+
+
+Sub InitializeUserFamily()
+Dim FirstIndex as Integer
+Dim UserFieldstrings() as String
+Dim LocStrings() as String
+Dim bFileExists as Boolean
+Dim n as Integer
+Dim m as Integer
+ bFileExists = LoadDataFromFile(GetPathSettings(&quot;Config&quot;, False) &amp; &quot;/&quot; &amp; &quot;UserData.dat&quot;, UserFieldStrings())
+ If bFileExists Then
+ FirstIndex = Ubound(UserFieldStrings())
+ ReDim Preserve UserFieldFamily(FirstIndex, SBMAXFIELDINDEX) as String
+ For n = 0 To FirstIndex
+ LocStrings() = ArrayOutofString(UserFieldStrings(n), &quot;;&quot;)
+ For m = 0 To SBMAXFIELDINDEX
+ UserFieldFamily(n,m) = LocStrings(m)
+ Next m
+ Next n
+ Else
+ ReDim Preserve UserFieldFamily(0,SBMAXFIELDINDEX) as String
+ For m = 0 To SBMAXFIELDINDEX
+ UserFieldFamily(0,m) = oUserDataAccess.GetByName(UserFieldDataType(m,1))
+ Next m
+ End If
+ ToggleButtons(0)
+End Sub
+
+
+Sub AddRecord()
+Dim i as Integer
+Dim MaxIndex as Integer
+ For i = 1 To SBTBCount
+ DlgUserFields.GetControl(&quot;TextField&quot; &amp; i).Model.Text = &quot;&quot;
+ Next i
+ MaxIndex = Ubound(UserFieldFamily(),1)
+ ReDim Preserve UserFieldFamily(MaxIndex + 1, SBMAXFIELDINDEX) as String
+ ToggleButtons(MaxIndex + 1, 1)
+End Sub
+
+
+Sub FillupTextFields()
+Dim a as Integer
+Dim CurIndex as Integer
+ For a = 1 To SBTBCOUNT
+ CurIndex = (a-1) + ScrollBarValue
+ DlgUserFields.GetControl(&quot;Label&quot; &amp; a).Model.Label = UserFieldDataType(CurIndex,0)
+ DlgUserFields.GetControl(&quot;TextField&quot; &amp; a).Model.Text = UserFieldFamily(CurFieldIndex, CurIndex)
+ Next a
+End Sub
+
+
+Sub StepToRecord(aEvent as Object)
+Dim iStep as Integer
+ iStep = CInt(aEvent.Source.Model.Tag)
+ ScrollTextFieldInfo(ScrollBarValue)
+ ToggleButtons(CurFieldIndex + iStep)
+ FillUpTextFields()
+End Sub
+
+
+Sub SelectCurrentFields()
+Dim MaxIndex as Integer
+Dim i as Integer
+ ScrollTextFieldInfo(ScrollBarValue)
+ MaxIndex = Ubound(UserFieldFamily(),2)
+ For i = 0 To MaxIndex
+ oUserDataAccess.ReplaceByName(UserFieldDataType(i,1), UserFieldFamily(CurFieldIndex, i))
+ Next i
+ oUserDataAccess.commitChanges()
+End Sub
+
+
+Sub DeleteCurrentSettings()
+Dim n as Integer
+Dim m as Integer
+Dim MaxIndex as Integer
+ MaxIndex = Ubound(UserFieldFamily(),1)
+ If CurFieldIndex &lt; MaxIndex Then
+ For n = CurFieldIndex To MaxIndex - 1
+ For m = 0 To SBMAXFIELDINDEX
+ UserFieldFamily(n,m) = UserFieldFamily(n + 1,m)
+ Next m
+ Next n
+ Else
+ CurFieldIndex = MaxIndex - 1
+ End If
+ ReDim Preserve UserFieldFamily(MaxIndex-1, SBMAXfIELDINDEX) as String
+ FillupTextFields()
+ ToggleButtons(CurFieldIndex)
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/gimmicks/delzip b/wizards/source/gimmicks/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/gimmicks/delzip
diff --git a/wizards/source/gimmicks/dialog.xlb b/wizards/source/gimmicks/dialog.xlb
new file mode 100644
index 000000000000..22271dacb14b
--- /dev/null
+++ b/wizards/source/gimmicks/dialog.xlb
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Gimmicks" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="UserfieldDlg"/>
+ <library:element library:name="ReadFolderDlg"/>
+</library:library>
diff --git a/wizards/source/gimmicks/makefile.mk b/wizards/source/gimmicks/makefile.mk
new file mode 100644
index 000000000000..de083f52e88d
--- /dev/null
+++ b/wizards/source/gimmicks/makefile.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=gimmicks
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+
+ZIP1TARGET = $(GIMMICKS_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/gimmicks/readdirs.dlg b/wizards/source/gimmicks/readdirs.dlg
new file mode 100644
index 000000000000..20a89426d678
--- /dev/null
+++ b/wizards/source/gimmicks/readdirs.dlg
Binary files differ
diff --git a/wizards/source/gimmicks/script.xlb b/wizards/source/gimmicks/script.xlb
new file mode 100644
index 000000000000..5c820ba43e0c
--- /dev/null
+++ b/wizards/source/gimmicks/script.xlb
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Gimmicks" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="GetTexts"/>
+ <library:element library:name="Userfields"/>
+ <library:element library:name="ChangeAllChars"/>
+ <library:element library:name="AutoText"/>
+ <library:element library:name="ReadDir"/>
+</library:library>
diff --git a/wizards/source/imagelists/imagelists.src b/wizards/source/imagelists/imagelists.src
new file mode 100644
index 000000000000..830c365ca4e4
--- /dev/null
+++ b/wizards/source/imagelists/imagelists.src
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+#define REPORTWIZARD_BASE 1000
+#define FORMWIZARD_BASE 1100
+#define WEBWIZARD_BASE 1200
+
+#define IMG_REPORT_ORIENTATION_PORTRAIT REPORTWIZARD_BASE + 0
+Image IMG_REPORT_ORIENTATION_PORTRAIT
+{
+ ImageBitmap = Bitmap { File = "portrait_32.png"; };
+};
+
+#define IMG_REPORT_ORIENTATION_PORTRAIT_HC REPORTWIZARD_BASE + 1
+Image IMG_REPORT_ORIENTATION_PORTRAIT_HC
+{
+ ImageBitmap = Bitmap { File = "portrait_32_h.png"; };
+};
+
+#define IMG_REPORT_ORIENTATION_LANDSCAPE REPORTWIZARD_BASE + 2
+Image IMG_REPORT_ORIENTATION_LANDSCAPE
+{
+ ImageBitmap = Bitmap { File = "landscape_32.png"; };
+};
+
+#define IMG_REPORT_ORIENTATION_LANDSCAPE_HC REPORTWIZARD_BASE + 3
+Image IMG_REPORT_ORIENTATION_LANDSCAPE_HC
+{
+ ImageBitmap = Bitmap { File = "landscape_32_h.png"; };
+};
+
+#define IMG_FORM_ARRANGELISTSIDE FORMWIZARD_BASE + 0
+Image IMG_FORM_ARRANGELISTSIDE
+{
+ ImageBitmap = Bitmap { File = "formarrangelistside_42.png"; };
+};
+
+#define IMG_FORM_ARRANGELISTSIDE_HC FORMWIZARD_BASE + 1
+Image IMG_FORM_ARRANGELISTSIDE_HC
+{
+ ImageBitmap = Bitmap { File = "formarrangelistside_42_h.png"; };
+};
+
+#define IMG_FORM_ARRANGELISTTOP FORMWIZARD_BASE + 2
+Image IMG_FORM_ARRANGELISTTOP
+{
+ ImageBitmap = Bitmap { File = "formarrangelisttop_42.png"; };
+};
+
+#define IMG_FORM_ARRANGELISTTOP_HC FORMWIZARD_BASE + 3
+Image IMG_FORM_ARRANGELISTTOP_HC
+{
+ ImageBitmap = Bitmap { File = "formarrangelisttop_42_h.png"; };
+};
+
+#define IMG_FORM_ARRANGETABLE FORMWIZARD_BASE + 4
+Image IMG_FORM_ARRANGETABLE
+{
+ ImageBitmap = Bitmap { File = "formarrangetable_42.png"; };
+};
+
+#define IMG_FORM_ARRANGETABLE_HC FORMWIZARD_BASE + 5
+Image IMG_FORM_ARRANGETABLE_HC
+{
+ ImageBitmap = Bitmap { File = "formarrangetable_42_h.png"; };
+};
+
+
+#define IMG_FORM_ARRANGEFREE FORMWIZARD_BASE + 6
+Image IMG_FORM_ARRANGEFREE
+{
+ ImageBitmap = Bitmap { File = "formarrangefree_42.png"; };
+};
+
+#define IMG_FORM_ARRANGEFREE_HC FORMWIZARD_BASE + 7
+Image IMG_FORM_ARRANGEFREE_HC
+{
+ ImageBitmap = Bitmap { File = "formarrangefree_42_h.png"; };
+};
+
+
+#define IMG_WEB_LAYOUT_TABLE3 WEBWIZARD_BASE + 0
+Image IMG_WEB_LAYOUT_TABLE3
+{
+ ImageBitmap = Bitmap { File = "table_3.png"; };
+};
+
+#define IMG_WEB_LAYOUT_TABLE3_HC WEBWIZARD_BASE + 1
+Image IMG_WEB_LAYOUT_TABLE3_HC
+{
+ ImageBitmap = Bitmap { File = "table_3_h.png"; };
+};
+
+
+#define IMG_WEB_LAYOUT_TABLE2 WEBWIZARD_BASE + 2
+Image IMG_WEB_LAYOUT_TABLE2
+{
+ ImageBitmap = Bitmap { File = "table_2.png"; };
+};
+
+
+#define IMG_WEB_LAYOUT_TABLE2_HC WEBWIZARD_BASE + 3
+Image IMG_WEB_LAYOUT_TABLE2_HC
+{
+ ImageBitmap = Bitmap { File = "table_2_h.png"; };
+};
+
+
+#define IMG_WEB_LAYOUT_SIMPLE WEBWIZARD_BASE + 4
+Image IMG_WEB_LAYOUT_SIMPLE
+{
+ ImageBitmap = Bitmap { File = "simple.png"; };
+};
+
+#define IMG_WEB_LAYOUT_SIMPLE_HC WEBWIZARD_BASE + 5
+Image IMG_WEB_LAYOUT_SIMPLE_HC
+{
+ ImageBitmap = Bitmap { File = "simple_h.png"; };
+};
+
+#define IMG_WEB_LAYOUT_DIAGONAL WEBWIZARD_BASE + 6
+Image IMG_WEB_LAYOUT_DIAGONAL
+{
+ ImageBitmap = Bitmap { File = "diagonal.png"; };
+};
+
+#define IMG_WEB_LAYOUT_DIAGONAL_HC WEBWIZARD_BASE + 7
+Image IMG_WEB_LAYOUT_DIAGONAL_HC
+{
+ ImageBitmap = Bitmap { File = "diagonal_h.png"; };
+};
+
+#define IMG_WEB_LAYOUT_ZIGZAG WEBWIZARD_BASE + 8
+Image IMG_WEB_LAYOUT_ZIGZAG
+{
+ ImageBitmap = Bitmap { File = "zigzag.png"; };
+};
+
+#define IMG_WEB_LAYOUT_ZIGZAG_HC WEBWIZARD_BASE + 9
+Image IMG_WEB_LAYOUT_ZIGZAG_HC
+{
+ ImageBitmap = Bitmap { File = "zigzag_h.png"; };
+};
+
+#define IMG_WEB_LAYOUT_FRAMELEFT WEBWIZARD_BASE + 10
+Image IMG_WEB_LAYOUT_FRAMELEFT
+{
+ ImageBitmap = Bitmap { File = "frame_left.png"; };
+};
+
+#define IMG_WEB_LAYOUT_FRAMELEFT_HC WEBWIZARD_BASE + 11
+Image IMG_WEB_LAYOUT_FRAMELEFT_HC
+{
+ ImageBitmap = Bitmap { File = "frame_left_h.png"; };
+};
+
+#define IMG_WEB_LAYOUT_FRAMERIGHT WEBWIZARD_BASE + 12
+Image IMG_WEB_LAYOUT_FRAMERIGHT
+{
+ ImageBitmap = Bitmap { File = "frame_right.png"; };
+};
+
+#define IMG_WEB_LAYOUT_FRAMERIGHT_HC WEBWIZARD_BASE + 13
+Image IMG_WEB_LAYOUT_FRAMERIGHT_HC
+{
+ ImageBitmap = Bitmap { File = "frame_right_h.png"; };
+};
+
+#define IMG_WEB_LAYOUT_FRAMETOP WEBWIZARD_BASE + 14
+Image IMG_WEB_LAYOUT_FRAMETOP
+{
+ ImageBitmap = Bitmap { File = "frame_top.png"; };
+};
+
+#define IMG_WEB_LAYOUT_FRAMETOP_HC WEBWIZARD_BASE + 15
+Image IMG_WEB_LAYOUT_FRAMETOP_HC
+{
+ ImageBitmap = Bitmap { File = "frame_top_h.png"; };
+};
+
+#define IMG_WEB_LAYOUT_FRAMEBOTTOM WEBWIZARD_BASE + 16
+Image IMG_WEB_LAYOUT_FRAMEBOTTOM
+{
+ ImageBitmap = Bitmap { File = "frame_bottom.png"; };
+};
+
+#define IMG_WEB_LAYOUT_FRAMEBOTTOM_HC WEBWIZARD_BASE + 17
+Image IMG_WEB_LAYOUT_FRAMEBOTTOM_HC
+{
+ ImageBitmap = Bitmap { File = "frame_bottom_h.png"; };
+};
+
diff --git a/wizards/source/imagelists/makefile.mk b/wizards/source/imagelists/makefile.mk
new file mode 100644
index 000000000000..163377de392b
--- /dev/null
+++ b/wizards/source/imagelists/makefile.mk
@@ -0,0 +1,50 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=wizards
+TARGET=wzimglst
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+# --- Files -------------------------------------
+# ... resource files ............................
+
+SRS1NAME=$(TARGET)
+SRC1FILES=imagelists.src
+
+RESLIB1SRSFILES= $(SRS)$/wzimglst.srs
+RESLIB1NAME=wzi
+RESLIB1IMAGES=$(PRJ)$/res
+
+# ... object files ............................
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
+
diff --git a/wizards/source/importwizard/API.xba b/wizards/source/importwizard/API.xba
new file mode 100644
index 000000000000..d38ba68d832d
--- /dev/null
+++ b/wizards/source/importwizard/API.xba
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="API" script:language="StarBasic">Declare Function RegOpenKeyEx Lib &quot;advapi32.dll&quot; Alias &quot;RegOpenKeyExA&quot; _
+ (ByVal hKey As Long, _
+ ByVal lpSubKey As String, _
+ ByVal ulOptions As Long, _
+ ByVal samDesired As Long, _
+ phkResult As Long) As Long
+
+Declare Function RegQueryValueExString Lib &quot;advapi32.dll&quot; Alias &quot;RegQueryValueExA&quot; _
+ (ByVal hKey As Long, _
+ ByVal lpValueName As String, _
+ ByVal lpReserved As Long, _
+ lpType As Long, _
+ lpData As String, _
+ lpcbData As Long) As Long
+
+Declare Function RegQueryValueExLong Lib &quot;advapi32.dll&quot; Alias &quot;RegQueryValueExA&quot; _
+ (ByVal hKey As Long, _
+ ByVal lpValueName As String, _
+ ByVal lpReserved As Long, _
+ lpType As Long, _
+ lpData As Long, _
+ lpcbData As Long) As Long
+
+Declare Function RegQueryValueExNULL Lib &quot;advapi32.dll&quot; Alias &quot;RegQueryValueExA&quot; _
+ (ByVal hKey As Long, _
+ ByVal lpValueName As String, _
+ ByVal lpReserved As Long, _
+ lpType As Long, _
+ ByVal lpData As Long, _
+ lpcbData As Long) As Long
+
+Declare Function RegCloseKeyA Lib &quot;advapi32.dll&quot; Alias &quot;RegCloseKey&quot; _
+ (ByVal hKey As Long) As Long
+
+
+Public Const HKEY_CLASSES_ROOT = &amp;H80000000
+Public Const HKEY_CURRENT_USER = &amp;H80000001
+Public Const HKEY_LOCAL_MACHINE = &amp;H80000002
+Public Const HKEY_USERS = &amp;H80000003
+Public Const KEY_ALL_ACCESS = &amp;H3F
+Public Const REG_OPTION_NON_VOLATILE = 0
+Public Const REG_SZ As Long = 1
+Public Const REG_DWORD As Long = 4
+Public Const ERROR_NONE = 0
+Public Const ERROR_BADDB = 1
+Public Const ERROR_BADKEY = 2
+Public Const ERROR_CANTOPEN = 3
+Public Const ERROR_CANTREAD = 4
+Public Const ERROR_CANTWRITE = 5
+Public Const ERROR_OUTOFMEMORY = 6
+Public Const ERROR_INVALID_PARAMETER = 7
+Public Const ERROR_ACCESS_DENIED = 8
+Public Const ERROR_INVALID_PARAMETERS = 87
+Public Const ERROR_NO_MORE_ITEMS = 259
+&apos;Public Const KEY_READ = &amp;H20019
+
+
+Function OpenRegKey(lBaseKey As Long, sKeyName As String) As Variant
+Dim LocKeyValue
+Dim hKey as Long
+Dim lRetValue as Long
+ lRetValue = RegOpenKeyEx(lBaseKey, sKeyName, 0, KEY_ALL_ACCESS, hKey)
+&apos; lRetValue = QueryValue(HKEY_LOCAL_MACHINE, &quot;SOFTWARE\Microsoft\Outlook Express\5.0\Default Settings&quot;, &quot;Revocation Checking&quot;)
+ If hKey &lt;&gt; 0 Then
+ RegCloseKeyA (hKey)
+ End If
+ OpenRegKey() = lRetValue
+End Function
+
+
+Function GetDefaultPath(CurOffice as Integer) As String
+Dim sPath as String
+Dim Index as Integer
+ Select Case Wizardmode
+ Case SBMICROSOFTMODE
+ Index = Applications(CurOffice,SBAPPLKEY)
+ If GetGUIType = 1 Then &apos; Windows
+ sPath = QueryValue(HKEY_LOCAL_MACHINE, sKeyName(Index), sValueName(Index))
+ Else
+ sPath = &quot;&quot;
+ End If
+ If sPath = &quot;&quot; Then
+ sPath = SOWorkPath
+ End If
+ GetDefaultPath = sPath
+ Case SBXMLMODE
+ GetDefaultPath = SOWorkPath
+ End Select
+End Function
+
+
+Function GetTemplateDefaultPath(Index as Integer) As String
+Dim sLocTemplatePath as String
+Dim sLocProgrampath as String
+Dim Progstring as String
+Dim PathList()as String
+Dim Maxindex as Integer
+Dim OldsLocTemplatePath
+Dim sTemplateKeyName as String
+Dim sTemplateValueName as String
+ On Local Error Goto NOVAlIDSYSTEMPATH
+ Select Case WizardMode
+ Case SBMICROSOFTMODE
+ If GetGUIType = 1 Then &apos; Windows
+ &apos; Template directory of Office 97
+ sTemplateKeyName = &quot;Software\Microsoft\Office\8.0\Common\FileNew\LocalTemplates&quot;
+ sTemplateValueName = &quot;&quot;
+ sLocTemplatePath = QueryValue(HKEY_LOCAL_MACHINE, sTemplateKeyName, sTemplateValueName)
+
+ If sLocTemplatePath = &quot;&quot; Then
+ &apos; Retrieve the template directory of Office 2000
+ &apos; Unfortunately there is no existing note about the template directory in
+ &apos; the whole registry.
+
+ &apos; Programdirectory of Office 2000
+ sTemplateKeyName = &quot;Software\Microsoft\Office\9.0\Common\InstallRoot&quot;
+ sTemplateValueName = &quot;Path&quot;
+ sLocProgrampath = QueryValue(HKEY_LOCAL_MACHINE, sTemplateKeyName, sTemplateValueName)
+ If sLocProgrampath &lt;&gt; &quot;&quot; Then
+ If Right(sLocProgrampath, 1) &lt;&gt; &quot;\&quot; Then
+ sLocProgrampath = sLocProgrampath &amp; &quot;\&quot;
+ End If
+ PathList() = ArrayoutofString(sLocProgrampath,&quot;\&quot;,Maxindex)
+ Progstring = &quot;\&quot; &amp; PathList(Maxindex-1) &amp; &quot;\&quot;
+ OldsLocTemplatePath = DeleteStr(sLocProgramPath,Progstring)
+
+ sLocTemplatePath = OldsLocTemplatePath &amp; &quot;\&quot; &amp; &quot;Templates&quot;
+
+ &apos; Does this subdirectory &quot;templates&quot; exist at all
+ If oUcb.Exists(sLocTemplatePath) Then
+ &apos; If Not the main directory of the office is the base
+ sLocTemplatePath = OldsLocTemplatePath
+ End If
+ Else
+ sLocTemplatePath = SOWorkPath
+ End If
+ End If
+ GetTemplateDefaultPath = ConvertToUrl(sLocTemplatePath)
+ Else
+ GetTemplateDefaultPath = SOWorkPath
+ End If
+ Case SBXMLMODE
+ If Index = 3 Then
+ &apos; Helper Application with no templates
+ GetTemplateDefaultPath = SOWorkPath
+ Else
+ GetTemplateDefaultPath = SOTemplatePath
+ End If
+ End Select
+NOVALIDSYSTEMPATH:
+ If Err &lt;&gt; 0 Then
+ GetTemplateDefaultPath() = SOWorkPath
+ Resume ONITGOES
+ ONITGOES:
+ End If
+End Function
+
+
+Function QueryValueEx(ByVal lhKey, ByVal szValueName As String, vValue As String) As Long
+Dim cch As Long
+Dim lrc As Long
+Dim lType As Long
+Dim lValue As Long
+Dim sValue As String
+Dim Empty
+
+ On Error GoTo QueryValueExError
+
+ lrc = RegQueryValueExNULL(lhKey, szValueName, 0&amp;, lType, 0&amp;, cch)
+ If lrc &lt;&gt; ERROR_NONE Then Error 5
+ Select Case lType
+ Case REG_SZ:
+ sValue = String(cch, 0)
+ lrc = RegQueryValueExString(lhKey, szValueName, 0&amp;, lType, sValue, cch)
+ If lrc = ERROR_NONE Then
+ vValue = Left$(sValue, cch)
+ Else
+ vValue = Empty
+ End If
+ Case REG_DWORD:
+ lrc = RegQueryValueExLong(lhKey, szValueName, 0&amp;, lType, lValue, cch)
+ If lrc = ERROR_NONE Then
+ vValue = lValue
+ End If
+ Case Else
+ lrc = -1
+ End Select
+QueryValueExExit:
+ QueryValueEx = lrc
+ Exit Function
+QueryValueExError:
+ Resume QueryValueExExit
+End Function
+
+
+Function QueryValue(BaseKey As Long, sKeyName As String, sValueName As String) As Variant
+Dim lRetVal As Long &apos; Returnvalue API-Call
+Dim hKey As Long &apos; Onen key handle
+Dim vValue As String &apos; Key value
+
+ lRetVal = RegOpenKeyEx(BaseKey, sKeyName, 0, KEY_ALL_ACCESS, hKey)
+ lRetVal = QueryValueEx(hKey, sValueName, vValue)
+ RegCloseKeyA (hKey)
+ QueryValue = vValue
+End Function
+</script:module> \ No newline at end of file
diff --git a/wizards/source/importwizard/DialogModul.xba b/wizards/source/importwizard/DialogModul.xba
new file mode 100644
index 000000000000..d323ba7ed711
--- /dev/null
+++ b/wizards/source/importwizard/DialogModul.xba
@@ -0,0 +1,657 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DialogModul" script:language="StarBasic">Option Explicit
+
+Public Const bDebugWizard = True
+
+Public Const SBFIRSTAPPLCHECKED = 0
+Public Const SBSECONDAPPLCHECKED = 1
+Public Const SBTHIRDAPPLCHECKED = 2
+Public Const SBFOURTHAPPLCHECKED = 3
+Public bFilterTracingAvailable as Boolean
+Public WizardMode as String
+Public Const SBMICROSOFTMODE = &quot;MS&quot;
+Public Const SBXMLMODE = &quot;SO&quot;
+&apos; The absolute maximal Number of possible Applications
+Public Const Twip = 425
+Public Const SBMAXAPPLCOUNT = 4
+Public MaxApplCount as Integer
+Public CurOffice As Integer
+Public SOBitmapPath As String
+Public SOWorkPath As String
+Public SOTemplatePath as String
+Public bCancelTask As Boolean
+Public bDoKeepApplValues as Boolean
+Public iApplSection as Integer
+Public oUcb as Object
+Public PathSeparator as String
+
+Public ApplCount as Integer
+Public sKeyName(SBMAXAPPLCOUNT-1) as String
+Public sValueName(SBMAXAPPLCOUNT-1) as String
+Public sCRLF as String
+Public MSFilterName(5,4) as String
+Public XMLFilterName(7,3) as String &apos;Number of different formats
+Public FilterTracingLogPath(2) as String
+Public bMSApplFilterTracingAvailable(2) as String
+Public bTakeOverTargetName(2) as Boolean
+Public bTakeOverPathName(2) as Boolean
+
+&apos; e.g.:
+&apos; XMLFilterName(x,0) = &quot;sdw&quot; &apos; in documents we take the extensions; in SO-templates the appropriate Filtername
+&apos; XMLFilterName(x,1) = &quot;swriter: StarWriter 5.0&quot; &apos; the filtername of the target-format
+&apos; XMLFilterName(x,2) = &quot;sxw&quot; &apos; the target extension
+
+Public Applications(SBMAXAPPLCOUNT-1,9)
+
+Public Const SBAPPLCONVERT = 0
+Public Const SBDOCCONVERT = 1
+Public Const SBDOCRECURSIVE = 2
+Public Const SBDOCSOURCE = 3
+Public Const SBDOCTARGET = 4
+Public Const SBTEMPLCONVERT = 5
+Public Const SBTEMPLRECURSIVE = 6
+Public Const SBTEMPLSOURCE = 7
+Public Const SBTEMPLTARGET = 8
+Public Const SBAPPLKEY = 9
+Public XMLTemplateList()
+
+&apos; Application-relating Data are stored in this Array
+&apos; according to the following structure:
+&apos; Applications(X,0) = True/False (Application is to be converted)
+&apos; Applications(X,1) = True/False (Documents are to be converted)
+&apos; Applications(X,2) = True/False (Including Subdirectories)
+&apos; Applications(X,3) = &quot;File:///...&quot; (SourceUrl of the documents)
+&apos; Applications(X,4) = &quot;File///:...&quot; (TargetUrl of the documents)
+&apos; Applications(X,5) = True/False (Templates are to be converted)
+&apos; Applications(X,6) = True/False (Including Subdirectories)
+&apos; Applications(X,7) = &quot;File:///...&quot; (SourceUrl of the templates)
+&apos; Applications(X,8) = &quot;File:///...&quot; (TargetUrl of the templates)
+&apos; Applications(X,9) = 0 (Key to the original Index of the Applications)
+
+Public Const SBMAXEXTENSIONLENGTH = 15
+
+
+Sub FillStep_Welcome()
+Dim i as Integer
+&apos; bDoKeepApplValues = False
+ ImportDialogArea.Title = sTitle
+ With ImportDialog
+ .cmdHelp.Label = sHelpButton
+ .cmdCancel.Label = sCancelButton
+ .cmdBack.Label = sBackButton
+ .cmdGoOn.Label = sNextButton
+ .WelcomeTextLabel.Label = sWelcomeTextLabel1
+ .WelcomeTextLabel2.Label = sWelcomeTextLabel2
+ .WelcomeTextLabel3.Label = sWelcomeTextLabel3
+
+ .optMSDocuments.Label = sContainerName(0)
+ .chkMSApplication1.Label = sMsDocumentCheckbox(0)
+ .chkMSApplication2.Label = sMsDocumentCheckbox(1)
+ .chkMSApplication3.Label = sMsDocumentCheckbox(2)
+
+ .optSODocuments.Label = sContainerName(1)
+ .chkSOApplication1.Label = sSODocumentCheckbox(0)
+ .chkSOApplication2.Label = sSODocumentCheckbox(1)
+ .chkSOApplication3.Label = sSODocumentCheckbox(2)
+ .chkSOApplication4.Label = sSODocumentCheckbox(3)
+ .cmdBack.Enabled = False
+ .Step = 1
+
+ If Not oFactoryKey.hasbyName(&quot;com.sun.star.text.TextDocument&quot;) Then
+ .chkLogfile.State = 0
+ .chkLogfile.Enabled = False
+ End If
+ End With
+ CheckModuleInstallation()
+ ToggleNextButton()
+End Sub
+
+
+Sub FillStep_InputPaths(OfficeIndex as Integer, bStartup as Boolean)
+Dim Index as Integer
+Dim oNullObject as Object
+ If bStartup And Not bDoKeepApplValues Then
+ If ImportDialog.optMSDocuments.State = 1 Then
+ SetupMSConfiguration()
+ Else
+ SetupXMLConfiguration()
+ End If
+ FillUpApplicationList()
+ End If
+ CurOffice = OfficeIndex
+ Index = Applications(CurOffice,SBAPPLKEY)
+ InitializePathsforCurrentApplication(Index)
+ With ImportDialog
+ .chkTemplatePath.Label = sTemplateCheckbox(Index)
+ .chkDocumentPath.State = Abs(Applications(CurOffice,SBDOCCONVERT))
+ .chkDocumentSearchSubDir.State = Abs(Applications(CurOffice,SBDOCRECURSIVE))
+ .txtDocumentImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCSOURCE))
+ .txtDocumentExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBDOCTARGET))
+ .hlnDocuments.Label = sProgressMoreDocs
+ If WizardMode = SBXMLMODE Then
+ ImportDialogArea.Title = sTitle &amp; &quot; - &quot; &amp; sSODocumentCheckBox(Index)
+ Else
+ ImportDialogArea.Title = sTitle &amp; &quot; - &quot; &amp; sMSDocumentCheckBox(Index)
+ End If
+ If WizardMode = SBXMLMODE AND Index = 3 Then
+ &apos; Note: SO-Helper Applications are partly treated like templates although they only have documents
+ .hlnTemplates.Label = sProgressMoreDocs
+ .chkTemplatePath.Label = sSOHelperDocuments(0,0)
+ .chkTemplatePath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(0,1))
+ .chkDocumentPath.Label = sSOHelperDocuments(1,0)
+ .chkDocumentPath.Enabled = oFactoryKey.HasByName(sSOHelperDocuments(1,1))
+ Else
+ .chkTemplatePath.Enabled = True
+ .chkDocumentPath.Enabled = True
+ .chkTemplatePath.Label = sTemplateCheckbox(Index)
+ .chkDocumentPath.Label = sDocumentCheckbox(Index)
+ .hlnTemplates.Label = sProgressMoreTemplates
+ End If
+ .chkTemplatePath.State = Abs(Applications(CurOffice,SBTEMPLCONVERT))
+ ToggleInputPaths(oNullObject,&quot;Template&quot;)
+ ToggleInputPaths(oNullObject,&quot;Document&quot;)
+ .chkTemplateSearchSubDir.State = Abs(Applications(CurOffice,SBTEMPLRECURSIVE))
+ .txtTemplateImportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLSOURCE))
+ .txtTemplateExportPath.Text = ConvertFromUrl(Applications(CurOffice,SBTEMPLTARGET))
+ .cmdGoOn.Label = sNextButton
+ .cmdBack.Enabled = True
+ ImportDialog.Step = 2
+ End With
+ ImportDialogArea.GetControl(&quot;chkTemplatePath&quot;).SetFocus()
+ ToggleNextButton()
+End Sub
+
+
+Sub FillUpApplicationList()
+Dim i as Integer
+Dim a as Integer
+Dim BoolValue as Boolean
+ If Not bDoKeepApplValues Then
+ a = 0
+ For i = 1 To ApplCount
+ If ImportDialog.optMSDocuments.State = 1 Then
+ BoolValue = ImportDialogArea.GetControl(&quot;chkMSApplication&quot; &amp; i).Model.State = 1
+ Else
+ BoolValue = ImportDialogArea.GetControl(&quot;chkSOApplication&quot; &amp; i).Model.State = 1
+ End If
+ Applications(a,SBAPPLCONVERT) = BoolValue
+ Applications(a,SBDOCCONVERT) = BoolValue
+ Applications(a,SBDOCRECURSIVE) = BoolValue
+ Applications(a,SBDOCSOURCE) = &quot;&quot; &apos; GetDefaultPath(i)
+ Applications(a,SBDOCTARGET) = &quot;&quot; &apos; SOWorkPath
+ Applications(a,SBTEMPLCONVERT) = BoolValue
+ Applications(a,SBTEMPLRECURSIVE) = BoolValue
+ Applications(a,SBTEMPLSOURCE) = &quot;&quot; &apos; GetTemplateDefaultPath(i)
+ Applications(a,SBTEMPLTARGET) = &quot;&quot; &apos; GetTargetTemplatePath(i)
+ Applications(a,SBAPPLKEY) = i-1
+ If BoolValue Then
+ a = a + 1
+ End If
+ Next i
+ ApplCount = a
+ End If
+End Sub
+
+
+Sub InitializePathsforCurrentApplication(i as Integer)
+ AssignPathToCurrentApplication(SBDOCSOURCE, GetDefaultPath(i))
+ AssignPathToCurrentApplication(SBDOCTARGET, SOWorkPath)
+ AssignPathToCurrentApplication(SBTEMPLSOURCE, GetTemplateDefaultPath(i))
+ AssignPathToCurrentApplication(SBTEMPLTARGET, GetTargetTemplatePath(i))
+End Sub
+
+
+Sub AssignPathToCurrentApplication(Index as Integer, NewPath as String)
+ If Applications(CurOffice,Index) = &quot;&quot; Then
+ If CurOffice &gt; 0 Then
+ Applications(CurOffice,Index) = Applications(CurOffice-1,Index)
+ Else
+ Applications(CurOffice,Index) = NewPath
+ End If
+ End If
+End Sub
+
+
+Sub SaveStep_InputPath()
+ Applications(CurOffice,SBDOCCONVERT) = ImportDialog.chkDocumentPath.State = 1
+ Applications(CurOffice,SBDOCRECURSIVE) = ImportDialog.chkDocumentSearchSubDir.State = 1
+ Applications(CurOffice,SBDOCSOURCE) = ConvertToURL(ImportDialog.txtDocumentImportPath.Text)
+ Applications(CurOffice,SBDOCTARGET) = ConvertToUrl(ImportDialog.txtDocumentExportPath.Text)
+ Applications(CurOffice,SBTEMPLCONVERT) = ImportDialog.chkTemplatePath.State = 1
+ Applications(CurOffice,SBTEMPLRECURSIVE) = ImportDialog.chkTemplateSearchSubDir.State = 1
+ Applications(CurOffice,SBTEMPLSOURCE) = ConvertToURL(ImportDialog.txtTemplateImportPath.Text)
+ Applications(CurOffice,SBTEMPLTARGET) = ConvertToURL(ImportDialog.txtTemplateExportPath.Text)
+End Sub
+
+
+Sub ToggleInputPaths(aEvent as Object, Optional sDocType)
+Dim bDoEnable as Boolean
+Dim sLocDocType as String
+Dim oCheckBox as Object
+ If Not IsNull(aEvent) Then
+ sLocDocType = aEvent.Source.Model.Tag
+ Else
+ sLocDocType = sDocType
+ End If
+ With ImportDialogArea
+ oCheckBox = .GetControl(&quot;chk&quot; &amp; sLocDocType &amp; &quot;Path&quot;).Model
+ bDoEnable = oCheckBox.State = 1 And oCheckBox.Enabled
+ .GetControl(&quot;lbl&quot; &amp; sLocDocType &amp; &quot;Import&quot;).Model.Enabled = bDoEnable
+ .GetControl(&quot;lbl&quot; &amp; sLocDocType &amp; &quot;Export&quot;).Model.Enabled = bDoEnable
+ .GetControl(&quot;txt&quot; &amp; sLocDocType &amp; &quot;ImportPath&quot;).Model.Enabled = bDoEnable
+ .GetControl(&quot;txt&quot; &amp; sLocDocType &amp; &quot;ExportPath&quot;).Model.Enabled = bDoEnable
+ .GetControl(&quot;chk&quot; &amp; sLocDocType &amp; &quot;SearchSubDir&quot;).Model.Enabled = bDoEnable
+ .GetControl(&quot;cmd&quot; &amp; sLocDocType &amp; &quot;Import&quot;).Model.Enabled = bDoEnable
+ .GetControl(&quot;cmd&quot; &amp; sLocDocType &amp; &quot;Export&quot;).Model.Enabled = bDoEnable
+ End With
+ ToggleNextButton()
+End Sub
+
+
+Function MakeSummaryString()
+Dim sTmpText As String
+Dim i as Integer
+Dim Index as Integer
+Dim sAddText as String
+ For i = 0 To ApplCount -1
+ Index = Applications(i,SBAPPLKEY)
+ GetFilterTracingLogPath(i, Index)
+ If Applications(i,SBTEMPLCONVERT) Then
+ &apos; Templates are to be converted
+ sAddText = &quot;&quot;
+ If WizardMode = SBMICROSOFTMODE Then
+ sAddText = sSumMSTemplates(Index) &amp; sCRLF
+ Else
+ sAddText = sSumSOTemplates(Index) &amp; sCRLF
+ End If
+ sTmpText = sTmpText &amp; sAddText &amp; ConvertFromUrl(Applications(i,SBTEMPLSOURCE)) &amp; sCRLF
+ If Applications(i,SBTEMPLRECURSIVE) Then
+ &apos; Including Subdirectories
+ sTmpText = sTmpText &amp; sSumInclusiveSubDir &amp; sCRLF
+ End If
+ sTmpText = sTmpText &amp; sSumSaveDocuments &amp; sCRLF
+ sTmpText = sTmpText &amp; ConvertFromUrl(Applications(i,SBTEMPLTARGET)) &amp; sCRLF
+ sTmpText = sTmpText &amp; sCRLF
+ End If
+
+ If Applications(i,SBDOCCONVERT) Then
+ &apos; Documents are to be converted
+ If WizardMode = SBMICROSOFTMODE Then
+ sAddText = sSumMSDocuments(Index) &amp; sCRLF
+ Else
+ sAddText = sSumSODocuments(Index) &amp; sCRLF
+ End If
+ sTmpText = sTmpText &amp; sAddText &amp; ConvertFromUrl(Applications(i,SBDOCSOURCE)) &amp; sCRLF
+
+ If Applications(i,SBDOCRECURSIVE) Then
+ &apos; Including Subdirectories
+ sTmpText = sTmpText &amp; sSumInclusiveSubDir &amp; sCRLF
+ End If
+
+ sTmpText = sTmpText &amp; sSumSaveDocuments &amp; sCRLF
+ sTmpText = sTmpText &amp; ConvertFromUrl(Applications(i,SBDOCTARGET)) &amp; sCRLF
+ sTmpText = sTmpText &amp; sCRLF
+ End If
+ Next i
+ MakeSummaryString = sTmpText
+End Function
+
+
+Sub FillStep_Summary()
+ ImportDialogArea.Title = sTitle
+ With ImportDialog
+ .SummaryTextbox.Text = MakeSummaryString()
+ .cmdGoOn.Enabled = .SummaryTextbox.Text &lt;&gt; &quot;&quot;
+ .cmdGoOn.Label = sBeginButton
+ .SummaryHeaderLabel.Label = sSummaryHeader
+ .Step = 3
+ End With
+ ImportDialogArea.GetControl(&quot;SummaryHeaderLabel&quot;).SetFocus()
+End Sub
+
+
+Sub FillStep_Progress()
+ With ImportDialog
+ .cmdBack.Enabled = False
+ .cmdGoOn.Enabled = False
+ .hlnProgress.Label = sProgressPage_1
+ .LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.BOLD
+ .LabelRetrieval.Label = sProgressPage_2
+ .LabelCurProgress.Label = sProgressPage_3
+ .LabelCurDocumentRetrieval.Label = &quot;&quot;
+ .LabelCurTemplateRetrieval.Label = &quot;&quot;
+ .LabelCurDocument.Label = &quot;&quot;
+ .Step = 4
+ End With
+ ImportDialogArea.GetControl(&quot;LabelRetrieval&quot;).SetFocus()
+ If ImportDialog.chkLogfile.State = 1 Then
+ ImportDialog.cmdShowLogFile.DefaultButton = True
+ End If
+End Sub
+
+
+Sub GetFilterTracingLogPath(i as Integer, Index as Integer)
+Dim aNodePath(0) as new com.sun.star.beans.PropertyValue
+Dim oMasterKey
+Dim oImportKey
+Dim oWordKey
+Dim oExcelkey
+Dim oPowerpointKey
+Dim oFilterService
+ aNodePath(0).Name = &quot;nodepath&quot;
+ aNodePath(0).Value = &quot;org.openoffice.Office.Tracing&quot;
+ oFilterService = createUnoService(&quot;com.sun.star.util.FilterTracer&quot;)
+ bFilterTracingAvailable = Not IsNull(oFilterService)
+ If bFilterTracingAvailable Then
+ oMasterkey = GetRegistryKeyContent(&quot;org.openoffice.Office.Tracing/&quot;)
+ If oMasterKey.hasbyName(&quot;Import&quot;) Then
+ oImportKey = GetRegistryKeyContent(&quot;org.openoffice.Office.Tracing/Import&quot;)
+ bMSApplFilterTracingAvailable(i) = CheckMSImportAvailability(oImportkey, MSFiltername(Index, 4), FilterTracingLogPath(i), bTakeOverTargetName(i), bTakeOverPathName(i))
+ End If
+ End If
+End Sub
+
+
+Function CheckMSImportAvailability(oImportkey, MSApplName as String, MSLogPath as String, bTakeOverTargetname as String, bTakeOverpathName as String) as Boolean
+Dim bApplIsAvailable as Boolean
+Dim oApplKey
+Dim LocApplName as String
+Dim LocApplPath as String
+ bApplIsAvailable = oImportKey.hasbyName(MSApplName)
+ If bApplIsAvailable Then
+ oApplKey = oImportKey.getByName(MSApplName)
+ bApplIsAvailable = oApplKey.On
+ LocApplName = oApplKey.Name
+ LocApplPath = oApplKey.Path
+ bTakeOverTargetName = (LocApplName = &quot;&quot;)
+ bTakeOverPathName = (LocApplPath = &quot;&quot;)
+ MSLogPath = LocApplPath &amp; &quot;/&quot; &amp; LocApplName &amp; &quot;.log&quot;
+ End If
+ CheckMSImportAvailability() = bApplIsAvailable
+End Function
+
+
+
+Sub SetupMSConfiguration()
+ iApplSection = 0
+ Wizardmode = SBMICROSOFTMODE
+ MaxApplCount = 3
+ ApplCount = 3
+ &apos; chkTemplatePath-Captions
+ GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox())
+ &apos; DocumentCheckbox- Captions
+ GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
+
+ sKeyName(0) = &quot;Software\Microsoft\Office\8.0\Word\Options&quot;
+ sKeyName(1) = &quot;Software\Microsoft\Office\8.0\Excel\Microsoft Excel&quot;
+ sKeyName(2) = &quot;Software\Microsoft\Office\8.0\PowerPoint\Recent Folder List\Default&quot;
+
+ sValueName(0) = &quot;DOC-PATH&quot;
+ sValueName(1) = &quot;DefaultPath&quot;
+ sValueName(2) = &quot;&quot;
+
+&apos; See definition of Filtername-Array about meaning of fields
+ MSFilterName(0,0) = &quot;doc&quot;
+ MSFilterName(0,1) = &quot;writer8&quot;
+ MSFilterName(0,2) = &quot;odt&quot;
+ MSFilterName(0,3) = sMSDocumentCheckBox(0)
+ MSFilterName(0,4) = &quot;Word&quot;
+
+
+ MSFilterName(1,0) = &quot;xls&quot;
+ MSFilterName(1,1) = &quot;calc8&quot;
+ MSFilterName(1,2) = &quot;ods&quot;
+ MSFilterName(1,3) = sMSDocumentCheckBox(1)
+ MSFilterName(1,4) = &quot;Excel&quot;
+
+ MSFilterName(2,0) = &quot;ppt|pps&quot;
+ MSFilterName(2,1) = &quot;impress8|impress8&quot;
+ MSFilterName(2,2) = &quot;odp|odp&quot;
+ MSFilterName(2,3) = sMSDocumentCheckBox(2)
+ MSFilterName(2,4) = &quot;PowerPoint&quot;
+
+ MSFilterName(3,0) = &quot;dot&quot;
+ MSFilterName(3,1) = &quot;writer8_template&quot;
+ MSFilterName(3,2) = &quot;ott&quot;
+ MSFilterName(3,3) = sMSTemplateCheckBox(0)
+ MSFilterName(3,4) = &quot;Word&quot;
+
+ MSFilterName(4,0) = &quot;xlt&quot;
+ MSFilterName(4,1) = &quot;calc8_template&quot;
+ MSFilterName(4,2) = &quot;ots&quot;
+ MSFilterName(4,3) = sMSTemplateCheckBox(1)
+ MSFilterName(4,4) = &quot;Excel&quot;
+
+ MSFilterName(5,0) = &quot;pot&quot;
+ MSFilterName(5,1) = &quot;impress8_template&quot;
+ MSFilterName(5,2) = &quot;otp&quot;
+ MSFilterName(5,3) = sMSTemplateCheckBox(2)
+ MSFilterName(5,4) = &quot;PowerPoint&quot;
+End Sub
+
+
+
+&apos; This is an extract from &quot;http://util.openoffice.org/source/browse/util/sot/source/base/exchange.cxx?rev=1.25&amp;content-type=text/x-cvsweb-markup&quot;
+&apos; about the listed defined mimetypes that are required to define binary StarOffice templates that have for all applications the same extension &quot;.vor&quot;
+
+&apos; 26 SOT_FORMATSTR_ID_STARWRITER_30*/ { &quot;application/x-openoffice-starwriter-30;windows_formatname=\&quot;StarWriter 3.0\&quot;&quot;, &quot;StarWriter 3.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 27 SOT_FORMATSTR_ID_STARWRITER_40*/ { &quot;application/x-openoffice-starwriter-40;windows_formatname=\&quot;StarWriter 4.0\&quot;&quot;, &quot;StarWriter 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 28 SOT_FORMATSTR_ID_STARWRITER_50*/ { &quot;application/x-openoffice-starwriter-50;windows_formatname=\&quot;StarWriter 5.0\&quot;&quot;, &quot;StarWriter 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+
+&apos; 29 SOT_FORMATSTR_ID_STARWRITERWEB_40*/ { &quot;application/x-openoffice-starwriterweb-40;windows_formatname=\&quot;StarWriter/Web 4.0\&quot;&quot;, &quot;StarWriter/Web 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 30 SOT_FORMATSTR_ID_STARWRITERWEB_50*/ { &quot;application/x-openoffice-starwriterweb-50;windows_formatname=\&quot;StarWriter/Web 5.0\&quot;&quot;, &quot;StarWriter/Web 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+
+&apos; 31 SOT_FORMATSTR_ID_STARWRITERGLOB_40*/ { &quot;application/x-openoffice-starwriterglob-40;windows_formatname=\&quot;StarWriter/Global 4.0\&quot;&quot;, &quot;StarWriter/Global 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 32 SOT_FORMATSTR_ID_STARWRITERGLOB_50*/ { &quot;application/x-openoffice-starwriterglob-50;windows_formatname=\&quot;StarWriter/Global 5.0\&quot;&quot;, &quot;StarWriter/Global 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+
+&apos; 33 SOT_FORMATSTR_ID_STARDRAW*/ { &quot;application/x-openoffice-stardraw;windows_formatname=\&quot;StarDrawDocument\&quot;&quot;, &quot;StarDrawDocument&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 34 SOT_FORMATSTR_ID_STARDRAW_40*/ { &quot;application/x-openoffice-stardraw-40;windows_formatname=\&quot;StarDrawDocument 4.0\&quot;&quot;, &quot;StarDrawDocument 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 36 SOT_FORMATSTR_ID_STARDRAW_50*/ { &quot;application/x-openoffice-stardraw-50;windows_formatname=\&quot;StarDraw 5.0\&quot;&quot;, &quot;StarDraw 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+
+&apos; 35 SOT_FORMATSTR_ID_STARIMPRESS_50*/ { &quot;application/x-openoffice-starimpress-50;windows_formatname=\&quot;StarImpress 5.0\&quot;&quot;, &quot;StarImpress 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+
+&apos; 37 SOT_FORMATSTR_ID_STARCALC*/ { &quot;application/x-openoffice-starcalc;windows_formatname=\&quot;StarCalcDocument\&quot;&quot;, &quot;StarCalcDocument&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 38 SOT_FORMATSTR_ID_STARCALC_40*/ { &quot;application/x-openoffice-starcalc-40;windows_formatname=\&quot;StarCalc 4.0\&quot;&quot;, &quot;StarCalc 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 39 SOT_FORMATSTR_ID_STARCALC_50*/ { &quot;application/x-openoffice-starcalc-50;windows_formatname=\&quot;StarCalc 5.0\&quot;&quot;, &quot;StarCalc 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+
+&apos; 40 SOT_FORMATSTR_ID_STARCHART*/ { &quot;application/x-openoffice-starchart;windows_formatname=\&quot;StarChartDocument\&quot;&quot;, &quot;StarChartDocument&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 41 SOT_FORMATSTR_ID_STARCHART_40*/ { &quot;application/x-openoffice-starchart-40;windows_formatname=\&quot;StarChartDocument 4.0\&quot;&quot;, &quot;StarChartDocument 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 42 SOT_FORMATSTR_ID_STARCHART_50*/ { &quot;application/x-openoffice-starchart-50;windows_formatname=\&quot;StarChart 5.0\&quot;&quot;, &quot;StarChart 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+
+&apos; 46 SOT_FORMATSTR_ID_STARMATH*/ { &quot;application/x-openoffice-starmath;windows_formatname=\&quot;StarMath\&quot;&quot;, &quot;StarMath&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 47 SOT_FORMATSTR_ID_STARMATH_40*/ { &quot;application/x-openoffice-starmath-40;windows_formatname=\&quot;StarMathDocument 4.0\&quot;&quot;, &quot;StarMathDocument 4.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+&apos; 48 SOT_FORMATSTR_ID_STARMATH_50*/ { &quot;application/x-openoffice-starmath-50;windows_formatname=\&quot;StarMath 5.0\&quot;&quot;, &quot;StarMath 5.0&quot;, &amp;::getCppuType( (const Sequence&lt; sal_Int8 &gt;*) 0 ) },
+
+
+Sub SetupXMLConfiguration()
+ iApplSection = 1000
+ Wizardmode = SBXMLMODE
+ ApplCount = 4
+ MaxApplCount = 4
+ XMLTemplateList = Array(&quot;vor&quot;, &quot;sti&quot;, &quot;stw&quot; , &quot;stc&quot; , &quot;std&quot;)
+ &apos; chkTemplatePath-Captions
+ GetApplResourceArray(1009 + iApplSection, ApplCount, sTemplateCheckBox())
+ &apos; DocumentCheckbox- Captions
+ GetApplResourceArray(1009 + iApplSection + ApplCount, ApplCount, sDocumentCheckBox())
+
+ XMLFilterName(0,0) = &quot;sdw|sxw&quot;
+ XMLFilterName(0,1) = &quot;writer8|writer8&quot;
+ XMLFilterName(0,2) = &quot;odt|odt&quot;
+ XMLFilterName(0,3) = sDocumentCheckBox(0)
+
+ XMLFilterName(1,0) = &quot;sdc|sxc&quot;
+ XMLFilterName(1,1) = &quot;calc8|calc8&quot;
+ XMLFilterName(1,2) = &quot;ods|ods&quot;
+ XMLFilterName(1,3) = sDocumentCheckBox(1)
+
+ If oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) and oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
+ XMLFilterName(2,0) = &quot;sdd|sda|sxi|sxd&quot;
+ XMLFilterName(2,1) = &quot;impress8|draw8|impress8|draw8&quot;
+ XMLFilterName(2,2) = &quot;odp|odg|odp|odg&quot;
+ Elseif oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) Then
+ XMLFilterName(2,0) = &quot;sda|sxd&quot;
+ XMLFilterName(2,1) = &quot;draw8|draw8&quot;
+ XMLFilterName(2,2) = &quot;odg|odg&quot;
+ Elseif oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
+ XMLFilterName(2,0) = &quot;sdd|sxi&quot;
+ XMLFilterName(2,1) = &quot;impress8|impress8&quot;
+ XMLFilterName(2,2) = &quot;odp|odp&quot;
+ End If
+ XMLFilterName(2,3) = sDocumentCheckBox(2)
+
+
+ XMLFilterName(3,0) = &quot;smf|sxm&quot;
+ XMLFilterName(3,1) = &quot;math8|math8&quot;
+ XMLFilterName(3,2) = &quot;odf|odf&quot;
+ XMLFilterName(3,3) = sDocumentCheckBox(3)
+
+ XMLFilterName(4,0) = &quot;application/x-openoffice-starwriter|application/vnd.stardivision.writer/web|application/vnd.sun.xml.writer|application/vnd.sun.xml.writerweb&quot;
+ XMLFilterName(4,1) = &quot;writer8_template|writerweb8_writer_template|writer8_template|writerweb8_writer_template&quot;
+ XMLFilterName(4,2) = &quot;ott|oth|ott|oth&quot;
+ XMLFilterName(4,3) = sTemplateCheckBox(0)
+
+
+ XMLFilterName(5,0) = &quot;application/x-openoffice-starcalc|application/vnd.sun.xml.calc&quot;
+ XMLFilterName(5,1) = &quot;calc8_template|calc8_template&quot;
+ XMLFilterName(5,2) = &quot;ots|ots&quot;
+ XMLFilterName(5,3) = sTemplateCheckBox(1)
+
+ &apos; due to bug #108942# impress templates of the version 4.0 have to be handled in a special way because their mimetype
+ &apos; falsely points to the draw application.
+ If oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) and oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
+ XMLFilterName(6,0) = &quot;application/x-openoffice-starimpress|application/x-openoffice-stardraw-40|application/x-openoffice-stardraw|application/vnd.sun.xml.impress|application/vnd.sun.xml.draw&quot;
+ XMLFilterName(6,1) = &quot;impress8_template|impress8_template|draw8_template|impress8_template|draw8_template&quot;
+ XMLFilterName(6,2) = &quot;otp|otp|otg|otp|otg&quot;
+ Elseif oFactoryKey.HasByName(&quot;com.sun.star.drawing.DrawingDocument&quot;) Then
+ XMLFilterName(6,0) = &quot;application/x-openoffice-stardraw|application/vnd.sun.xml.draw&quot;
+ XMLFilterName(6,1) = &quot;draw8_template|draw8_template&quot;
+ XMLFilterName(6,2) = &quot;otg|otg&quot;
+ Elseif oFactoryKey.HasByName(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
+ XMLFilterName(6,0) = &quot;application/x-openoffice-starimpress|application/x-openoffice-stardraw-40|application/vnd.sun.xml.impress&quot;
+ XMLFilterName(6,1) = &quot;impress8_template|impress8_template|impress8_template&quot;
+ XMLFilterName(6,2) = &quot;otp|otp|otp&quot;
+ End If
+ XMLFilterName(6,3) = sTemplateCheckBox(2)
+
+ If oFactoryKey.HasByName(&quot;com.sun.star.text.GlobalDocument&quot;) Then
+ XMLFilterName(7,0) = &quot;sgl|sxg&quot;
+ XMLFilterName(7,1) = &quot;writerglobal8|writerglobal8&quot;
+ XMLFilterName(7,2) = &quot;odm|odm&quot;
+ XMLFilterName(7,3) = sTemplateCheckBox(3)
+ End If
+End Sub
+
+
+Function CheckControlPath(oCheckbox as Object, oTextBox as Object, ByVal bDoEnable as Boolean)
+Dim sPath as String
+ If Not bDoEnable Then
+ CheckControlPath = False
+ ElseIf oCheckbox.State = 0 Then
+ CheckControlPath = True
+ Else
+ sPath = ConvertToUrl(Trim(oTextBox.Text)
+ CheckControlPath = oUcb.Exists(sPath)
+ End If
+End Function
+
+
+Function CheckInputPaths() as Boolean
+Dim bChangePage as Boolean
+ bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateImportPath, True, False, sTitle, False)
+ bChangePage = CheckTextBoxPath(ImportDialog.txtTemplateExportPath, bChangePage, True, sTitle, False)
+ bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentImportPath, bChangePage, False, sTitle, False)
+ bChangePage = CheckTextBoxPath(ImportDialog.txtDocumentExportPath, bChangePage, True, sTitle, False)
+ CheckInputPaths = bChangePage
+End Function
+
+
+Function CheckTextBoxPath(oTextBox as Object, ByVal bCheck as Boolean, bCreateNew as Boolean, sTitle as String, bgetResources as Boolean) as Boolean
+Dim iCreate as Integer
+Dim sQueryMessage as String
+Dim sUrlPath as String
+Dim sMessageNoDir as String
+Dim sShowPath as String
+Dim oLocUcb as Object
+ oLocUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ If bGetResources Then
+ If InitResources(&quot;ImportWizard&quot;,&quot;imp&quot;) then
+ sNoDirCreation = GetResText(1050)
+ sMsgDirNotThere = GetResText(1051)
+ sQueryForNewCreation = GetResText(1052)
+ Else
+ CheckTextBoxPath() = False
+ Exit Function
+ End If
+ End If
+ If oTextBox.Enabled Then
+ If bCheck Then
+ sShowPath = oTextBox.Text
+ sUrlPath = ConvertToUrl(sShowPath)
+ If Not oLocUcb.Exists(sUrlPath) Then
+ If Not bCreateNew Then
+ &apos; Sourcedirectories must be existing, Targetdirectories may be created new
+ sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,&quot;%1&quot;)
+ Msgbox(sQueryMessage,16,sTitle)
+ CheckTextBoxPath() = False
+ Exit Function
+ Else
+ sQueryMessage = ReplaceString(sMsgDirNotThere, sShowPath,&quot;%1&quot;)
+ sQueryMessage = sQueryMessage &amp; Chr(13) &amp; sQueryForNewCreation
+ iCreate = Msgbox (sQueryMessage, 36, sTitle)
+ If iCreate = 6 Then
+ On Local Error Goto NOVALIDPATH
+ CreateFolder(sUrlPath)
+ If Not oLocUcb.Exists(sUrlPath) Then
+ Goto NOVALIDPATH
+ End If
+ Else
+ CheckTextBoxPath() = False
+ Exit Function
+ End If
+ End If
+ End If
+ CheckTextBoxPath() = True
+ Else
+ CheckTextBoxPath() = False
+ End If
+ Else
+ CheckTextBoxPath() = True
+ End If
+ Exit Function
+NOVALIDPATH:
+ sMessageNoDir = ReplaceString(sNoDirCreation, sShowPath, &quot;%1&quot;)
+ Msgbox(sMessageNoDir, 16, sTitle)
+ CheckTextBoxPath() = False
+End Function
+
+
+Sub InitializeProgressPage(oDialog as Object)
+ oDialog.LabelRetrieval.FontWeight = com.sun.star.awt.FontWeight.NORMAL
+ oDialog.LabelCurProgress.FontWeight = com.sun.star.awt.FontWeight.BOLD
+End Sub
+
+
+Sub SetProgressDisplay(AbsFound as Integer)
+ ImportDialog.LabelRetrieval.Label = sProgressPage_2 &amp; &quot; &quot; &amp; ReplaceString(sProgressPage_5, Str(AbsFound) &amp; &quot; &quot;, &quot;%1&quot;)
+ ImportDialog.LabelCurDocumentRetrieval.Label = sProgressFound &amp; &quot; &quot; &amp; CStr(AbsDocuFound) &amp; &quot; &quot; &amp; sProgressMoreDocs
+ ImportDialog.LabelCurTemplateRetrieval.Label = sProgressFound &amp; &quot; &quot; &amp; CStr(AbsTemplateFound) &amp; &quot; &quot; &amp; sProgressMoreTemplates
+End Sub
+
+Sub TakoverFolderName(aEvent as Object)
+Dim RefControlName as String
+Dim oRefControl
+ RefControlName = aEvent.Source.Model.Tag
+ oRefControl = ImportDialogArea.GetControl(RefControlName)
+ GetFolderName(oRefControl.Model)
+ ToggleNextButton()
+End Sub
+
+
+Sub FinalizeDialogButtons()
+ ImportDialog.cmdShowLogFile.Enabled = ((Isnull(oLogDocument) = False) And (ImportDialog.chkLogfile.State = 1))
+ ImportDialog.cmdCancel.Enabled = False
+ ImportDialog.cmdGoOn.Label = sCloseButton
+ ImportDialog.cmdGoOn.Enabled = True
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/importwizard/FilesModul.xba b/wizards/source/importwizard/FilesModul.xba
new file mode 100644
index 000000000000..cb999252b24c
--- /dev/null
+++ b/wizards/source/importwizard/FilesModul.xba
@@ -0,0 +1,824 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="FilesModul" script:language="StarBasic">Option Explicit
+
+Public AbsTemplateFound as Integer
+Public AbsDocuFound as Integer
+Public oLogDocument as Object
+Public oLogTable as Object
+Public bLogExists as Boolean
+Public sComment as String
+Public MaxCollectIndex as Integer
+Public bInsertRow as Boolean
+Public sLogUrl as String
+Public sCurPassWord as String
+Public FileCount as Integer
+Public XMLTemplateCount as Integer
+Public PathCollection(7,3) as String
+Public bIsFirstLogTable as Boolean
+Public bFilterTracerIsinsideTable as Boolean
+
+
+Function ReadCollectionPaths(FilesList() as String, sFilterName() as String)
+Dim FilterIndex as Integer
+Dim bRecursive as Boolean
+Dim SearchDir as String
+Dim i as Integer
+Dim n as Integer
+Dim a as Integer
+Dim s as Integer
+Dim t as Integer
+Dim sFileContent() as String
+Dim NewList(0,1) as String
+Dim Index as Integer
+Dim CurFileName as String
+Dim CurExtension as String
+Dim CurFileContent as String
+Dim XMLTemplateContentList() as String
+Dim bIsTemplatePath as Boolean
+Dim MaxIndex as Integer
+Dim NewContentList() as String
+Dim XMLTemplateContentString as String
+Dim ApplIndex as Integer
+Dim bAssignFileName as Boolean
+ bInterruptSearch = False
+ For i = 0 To MaxCollectIndex
+ SearchDir = PathCollection(i,0)
+ bRecursive = PathCollection(i,1)
+ sFileContent() = ArrayoutofString(PathCollection(i,2), &quot;|&quot;)
+ NewList() = ReadDirectories(SearchDir, bRecursive, False, False, sFileContent(), &quot;&quot;)
+ If InterruptProcess Then
+ ReadCollectionPaths() = False
+ Exit Function
+ End If
+ If Ubound(NewList()) &gt; -1 Then
+ bIsTemplatePath = FieldInList(&quot;vor&quot;, sFileContent)
+ If bIsTemplatePath Then
+ XMLTemplateContentString = PathCollection(i,3)
+ XMLTemplateContentList() = ArrayoutofString(XMLTemplateContentString, &quot;|&quot;)
+ If Ubound(XMLTemplateContentList()) &gt; -1 Then
+ MaxIndex = Ubound(NewList())
+ ReDim Preserve NewList(MaxIndex, 1) as String
+ ReDim Preserve NewContentList(MaxIndex) as String
+ a = -1
+ For n = 0 To MaxIndex
+ bAssignFileName = True
+ If InterruptProcess() Then
+ ReadCollectionPaths() = False
+ Exit Function
+ End If
+ CurFileContent = &quot;&quot;
+ CurFileName = NewList(n,0)
+ If (FieldInList(NewList(n,1), XMLTemplateList())) Then
+ CurFileContent = GetRealFileContent(CurFileName)
+ t = SearchArrayforPartString(CurFileContent, XMLTemplateContentList())
+ bAssignFileName = (t &gt; -1)
+ If bAssignFileName Then
+ CurFileContent = XMLTemplateContentList(t)
+ End If
+ NewList(n,1) = CurFileContent
+ End If
+ CurExtension = NewList(n,1)
+ If bAssignFileName Then
+ If a &lt; n Then
+ a = a + 1
+ NewList(a,0) = CurFileName
+ NewList(a,1) = CurExtension
+ If CurFileContent = &quot;&quot; Then
+ CurFileContent = CurExtension
+ End If
+ ApplIndex = GetApplicationIndex(CurFileContent, sFiltername())
+ NewContentList(a) = ApplIndex
+ End If
+ End If
+ Next n
+ If a &lt; MaxIndex And a &gt; -1 Then
+ ReDim Preserve NewList(a, 1) as String
+ End If
+ If a &gt; -1 Then
+ AddListtoFilesList(FilesList(), NewList(), NewContentList())
+ End If
+ End If
+ Else
+ MaxIndex = Ubound(NewList())
+ ReDim Preserve NewContentList(MaxIndex) as String
+ For s = 0 To MaxIndex
+ CurExtension = NewList(s,1)
+ NewContentList(s) = GetApplicationIndex(CurExtension, sFiltername())
+ Next s
+ AddListtoFilesList(FilesList(), NewList(), NewContentList())
+ End If
+ End If
+ Next i
+ ReadCollectionPaths() = Ubound(FilesList()) &gt; -1
+End Function
+
+
+Function GetApplicationIndex(CurFileContent as String, sFilterName() as String) as Integer
+Dim Index as Integer
+Dim i as Integer
+ Index = GetIndexForPartStringinMultiArray(sFilterName(), CurFileContent, 0)
+ If Index &gt;= MaxApplCount Then
+ Index = Index - MaxApplCount
+ End If
+ For i = 0 To MaxApplCount - 1
+ If Applications(i, SBAPPLKEY) = Index Then
+ GetApplicationIndex() = i
+ Exit Function
+ End If
+ Next i
+ GetApplicationIndex() = - 1
+End Function
+
+
+Function InterruptProcess() as Boolean
+ If bCancelTask Or RetValue = 0 Then
+ bConversionIsRunning = False
+ InterruptProcess() = True
+ Exit Function
+ End if
+ InterruptProcess() = False
+End Function
+
+
+Sub AddCollectionPath(ApplIndex as Integer, DocIndex as Integer, RecursiveIndex as Integer, sFiltername() as String, DistIndex as Integer)
+ MaxCollectIndex = MaxCollectIndex + 1
+ PathCollection(MaxCollectIndex, 0) = Applications(ApplIndex, DocIndex)
+ PathCollection(MaxCollectIndex, 1) = Applications(ApplIndex, RecursiveIndex)
+ AddFilterNameToPathItem(ApplIndex, MaxCollectIndex, sFiltername(), DistIndex)
+End Sub
+
+
+Function SetExtension(LocExtension) as String
+ if (Instr(LocExtension, &quot;vnd.sun.xml.impress&quot;)) &gt; 0 then
+ SetExtension() = &quot;vor|sti|std&quot;
+ elseif (Instr(LocExtension, &quot;vnd.sun.xml.writer&quot;)) &gt; 0 then
+ SetExtension() = &quot;vor|stw&quot;
+ elseif (Instr(LocExtension, &quot;vnd.sun.xml.calc&quot;)) &gt; 0 then
+ SetExtension() = &quot;vor|stc&quot;
+ elseif (Instr(LocExtension, &quot;vnd.sun.xml.draw&quot;)) &gt; 0 then
+ SetExtension() = &quot;vor|std|sti&quot;
+ endif
+End Function
+
+Sub AddFilterNameToPathItem(ApplIndex as Integer, CollectIndex as Integer, sFiltername() as String, DistIndex as Integer)
+Dim iKey as Integer
+Dim CurListString as String
+Dim LocExtension as String
+Dim LocContentString as String
+Dim LocXMLTemplateContent as String
+ iKey = Applications(ApplIndex, SBAPPLKEY)
+ CurListString = PathCollection(CollectIndex, 2)
+ LocExtension = sFilterName(iKey +DistIndex, 0)
+ If Len(LocExtension) &gt; SBMAXEXTENSIONLENGTH Then &apos; 7 == Length of two extensions like &apos;sda|sdd
+ LocExtension = SetExtension(LocExtension)
+ LocContentString = sFilterName(iKey +DistIndex, 0)
+ LocContentString = ReplaceString(LocContentString, &quot;|&quot;, &quot;;&quot;)
+ LocXMLTemplateContent = PathCollection(CollectIndex, 3)
+ If LocXMLTemplateContent = &quot;&quot; Then
+ LocXMLTemplateContent = LocContentString
+ Else
+ LocXMLTemplateContent = LocXMLTemplateContent &amp; &quot;|&quot; &amp; LocContentString
+ End If
+ PathCollection(CollectIndex, 3) = LocXMLTemplateContent
+ End If
+ If CurListString = &quot;&quot; Then
+ PathCollection(CollectIndex, 2) = LocExtension
+ Else
+ If Instr(CurListString, LocExtension) = 0 Then
+ PathCollection(CollectIndex, 2) = CurListString &amp; &quot;|&quot; &amp; LocExtension
+ End If
+ End If
+End Sub
+
+
+Sub CheckIfToAddPathToCollection(ApplIndex as Integer, bDoConvertIndex as Integer, DocIndex as Integer, RecursiveIndex as Integer, sFiltername() as String, DistIndex as Integer)
+Dim CollectIndex as Integer
+Dim bCheckDocuType as Boolean
+ bCheckDocuType = Applications(ApplIndex, bDoConvertIndex)
+ If bCheckDocuType Then
+ CollectIndex = GetIndexInMultiArray(PathCollection(), Applications(ApplIndex,DocIndex), 0)
+ If (CollectIndex &gt;-1) Then
+ If Applications(ApplIndex, RecursiveIndex) &lt;&gt; PathCollection(CollectIndex, 1) Then
+ AddCollectionPath(ApplIndex, DocIndex, RecursiveIndex, sFilterName(), DistIndex)
+ Else
+ AddFilterNameToPathItem(ApplIndex, CollectIndex, sFilterName(), DistIndex)
+ End If
+ Else
+ AddCollectionPath(ApplIndex, DocIndex, RecursiveIndex, sFilterName(), DistIndex)
+ End If
+ End If
+End Sub
+
+
+Sub CollectPaths(sFiltername() as String)
+Dim i as Integer
+Dim XMLTemplateContentString as String
+ MaxCollectIndex = -1
+ For i = 0 To ApplCount-1
+ CheckIfToAddPathToCollection(i, SBDOCCONVERT, SBDOCSOURCE, SBDOCRECURSIVE, sFilterName(), 0)
+ Next i
+ XMLTemplateCount = 0
+ XMLTemplateContentString = &quot;&quot;
+ For i = 0 To ApplCount-1
+ If WizardMode = SBXMLMODE Then
+ XMLTemplateCount = XMLTemplateCount + 1
+ End If
+ CheckIfToAddPathToCollection(i, SBTEMPLCONVERT, SBTEMPLSOURCE, SBTEMPLRECURSIVE, sFilterName(), MaxApplCount)
+ Next i
+End Sub
+
+
+Sub ConvertAllDocuments(sFilterName() as String)
+Dim FileProperties(1) as new com.sun.star.beans.PropertyValue
+Dim PWFileProperties(2) as New com.sun.star.beans.PropertyValue
+Dim WriterWebProperties(0) as new com.sun.star.beans.PropertyValue
+Dim OpenProperties(4) as new com.sun.star.beans.PropertyValue
+Dim oInteractionHandler as Object
+Dim InteractionTypes(0) as Long
+Dim FilesList(0,2) as String
+Dim sViewPath as String
+Dim i as Integer
+Dim FilterIndex as Integer
+Dim sSourceUrl as String
+Dim CurFilename as String
+Dim oDocument as Object
+Dim sExtension as String
+Dim OldExtension as String
+Dim CurFound as Integer
+Dim TotFound as Integer
+Dim TargetStemDir as String
+Dim SourceStemDir as String
+Dim TargetDir as String
+Dim sTargetUrl as String
+Dim CurFilterName as String
+Dim ApplIndex as Integer
+Dim Index as Integer
+Dim bIsDocument as Boolean
+Dim bDoSave as Boolean
+Dim sCurFileExists as String
+Dim MaxFileIndex as Integer
+Dim bContainsBasicMacro as Boolean
+Dim bIsPassWordProtected as Boolean
+Dim iOverwrite as Integer
+Dim sMimeTypeorExtension as String
+Dim sPrevMimeTypeorExtension as String
+ bConversionisrunning = True
+ InteractionTypes(0) = com.sun.star.task.PasswordRequestMode.PASSWORD_REENTER
+ oInteractionHandler = createUnoService(&quot;com.sun.star.task.InteractionHandler&quot;)
+ oInteractionHandler.initialize(InteractionTypes())
+ iGeneralOverwrite = SBOVERWRITEUNDEFINED
+ bConversionIsRunning = True
+ bLogExists = false
+ AbsTemplateFound = 0
+ AbsDocuFound = 0
+ CollectPaths(sFiltername())
+ If Not ReadCollectionPaths(FilesList(), sFilterName()) Then
+ TotFound = 0
+ SetProgressDisplay(0)
+ bConversionisrunning = false
+ FinalizeDialogButtons()
+ Exit Sub
+ End If
+ TotFound = Ubound(FilesList()) + 1
+ If FilesList(0,0) = &quot;&quot; Then &apos; Querying the number of fields in a multidimensionl Array is unsecure
+ TotFound = 0 &apos; because it will return the value 0 (and not -1) even when the Array is empty
+ SetProgressDisplay(0)
+ End If
+ BubbleSortList(FilesList(), true)
+ If TotFound &gt; 0 Then
+ CreateLogDocument(OpenProperties())
+ InitializeProgressPage(ImportDialog)
+ OpenProperties(0).Name = &quot;Hidden&quot;
+ OpenProperties(0).Value = True
+ OpenProperties(1).Name = &quot;AsTemplate&quot;
+ OpenProperties(1).Value = False
+ OpenProperties(2).Name = &quot;MacroExecutionMode&quot;
+ OpenProperties(2).Value = com.sun.star.document.MacroExecMode.NEVER_EXECUTE
+ OpenProperties(3).Name = &quot;UpdateDocMode&quot;
+ OpenProperties(3).Value = com.sun.star.document.UpdateDocMode.NO_UPDATE
+ OpenProperties(4).Name = &quot;InteractionHandler&quot;
+ OpenProperties(4).Value = oInteractionHandler
+ MaxFileIndex = Ubound(FilesList(),1)
+ FileCount = 0
+ For i = 0 To MaxFileIndex
+ sComment = &quot;&quot;
+ If InterruptProcess() Then
+ Exit For
+ End If
+ bDoSave = True
+ sSourceUrl = FilesList(i,0)
+ sPrevMimeTypeorExtension = sMimeTypeorExtension
+ sMimeTypeorExtension = FilesList(i,1)
+ CurFiltername = GetFilterName(sMimeTypeorExtension, sFilterName(), sExtension, FilterIndex)
+ ApplIndex = FilesList(i,2)
+ If sMimeTypeorExtension &lt;&gt; sPrevMimeTypeorExtension Then
+ CreateLogTable(ApplIndex, sMimeTypeOrExtension, sFiltername()
+ End If
+ If ApplIndex &gt; Ubound(Applications) or (ApplIndex &lt; 0) Then
+ Msgbox &quot;Applicationindex out of bounds:&quot; &amp; sSourcUrl
+ End If
+ sViewPath = ConvertFromUrl(sSourceUrl) &apos; CutPathView(sSourceUrl, 70)
+ ImportDialog.LabelCurDocument.Label = Str(i+1) &amp; &quot;/&quot; &amp; MaxFileIndex + 1 &amp; &quot; (&quot; &amp; sViewPath &amp; &quot;)&quot;
+ Select Case lcase(sExtension)
+ Case &quot;odt&quot;, &quot;ods&quot;, &quot;odp&quot;, &quot;odg&quot;, &quot;odm&quot;, &quot;odf&quot;
+ SourceStemDir = RTrimStr(Applications(ApplIndex,SBDOCSOURCE), &quot;/&quot;)
+ TargetStemDir = RTrimStr(Applications(ApplIndex,SBDOCTARGET), &quot;/&quot;)
+ Case Else &apos; Templates and Helper-Applications remain
+ SourceStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLSOURCE), &quot;/&quot;)
+ TargetStemDir = RTrimStr(Applications(ApplIndex,SBTEMPLTARGET), &quot;/&quot;)
+ End Select
+ sTargetUrl = ReplaceString(sSourceUrl, TargetStemDir, SourceStemDir)
+ CurFilename = GetFileNameWithoutExtension(sTargetUrl, &quot;/&quot;)
+ OldExtension = GetFileNameExtension(sTargetUrl)
+ sTargetUrl = RTrimStr(sTargetUrl, OldExtension)
+ sTargetUrl = sTargetUrl &amp; sExtension
+ TargetDir = RTrimStr(sTargetUrl, CurFilename &amp; &quot;.&quot; &amp; sExtension)
+ If (oUcb.Exists(sTargetUrl)) Then
+ If (iGeneralOverwrite &lt;&gt; SBOVERWRITEALWAYS) Then
+ If (iGeneralOverwrite = SBOVERWRITEUNDEFINED) Then
+ ShowOverwriteAllDialog(sTargetUrl, sTitle)
+ bDoSave = (iGeneralOverwrite = SBOVERWRITEQUERY) Or (iGeneralOverwrite = SBOVERWRITEALWAYS)
+ Elseif iGeneralOverwrite = SBOVERWRITENEVER Then
+ bDoSave = False
+ ElseIf ((iGeneralOverWrite = SBOVERWRITEQUERY) OR (iGeneralOverwrite = SBOVERWRITECANCEL)) Then
+ &apos; Todo: According to AS there might come a new feature that storeasUrl could possibly rise a UI dialog.
+ &apos; In this case my own UI becomes obsolete
+ sCurFileExists = ReplaceString(sFileExists, ConvertFromUrl(sTargetUrl), &quot;&lt;1&gt;&quot;)
+ sCurFileExists = ReplaceString(sCurFileExists, chr(13), &quot;&lt;CR&gt;&quot;)
+ iOverWrite = Msgbox (sCurFileExists, 32 + 3, sTitle)
+ Select Case iOverWrite
+ Case 1 &apos; OK
+ &apos; In the FileProperty-Bean this is already default
+ bDoSave = True
+ Case 2 &apos; Abort
+ CancelTask(False)
+ bDoSave = False
+ Case 7 &apos; No
+ bDoSave = False
+ End Select
+ End If
+ End If
+ End If
+ If bDoSave Then
+ If Not oUcb.Exists(TargetDir) Then
+ bDoSave = CreateFolder(TargetDir)
+ End If
+ If bDoSave Then
+ oDocument = StarDesktop.LoadComponentFromURL(sSourceUrl, &quot;_default&quot;, 0, OpenProperties())
+ If Not IsNull(oDocument) Then
+ InsertSourceUrlToLogDocument(sSourceUrl, &quot;&quot;)
+ bIsPassWordProtected = CheckPassWordProtection(oDocument)
+ CheckIfMacroExists(oDocument.BasicLibraries, sComment)
+ On Local Error Goto NOSAVING
+ If bIsPassWordProtected Then
+ PWFileProperties(0).Name = &quot;FilterName&quot;
+ PWFileProperties(0).Value = CurFilterName
+ PWFileProperties(1).Name = &quot;Overwrite&quot;
+ PWFileProperties(1).Value = True
+ PWFileProperties(2).Name = &quot;Password&quot;
+ PWFileProperties(2).Value = sCurPassWord
+ oDocument.StoreAsUrl(sTargetUrl, PWFileProperties())
+ Else
+ FileProperties(0).Name = &quot;FilterName&quot;
+ FileProperties(0).Value = CurFilterName
+ FileProperties(1).Name = &quot;Overwrite&quot;
+ FileProperties(1).Value = True
+ oDocument.StoreAsUrl(sTargetUrl,FileProperties())
+ End If
+ &apos; Todo: Make sure that an errorbox pops up when saving fails
+ NOSAVING:
+ If Err &lt;&gt; 0 Then
+ sCurcouldnotsaveDocument = ReplaceString(scouldnotsaveDocument, ConvertFromUrl(sTargetUrl), &quot;&lt;1&gt;&quot;)
+ sComment = ConcatComment(sComment, sCurCouldnotsaveDocument)
+ Resume LETSGO
+ LETSGO:
+ Else
+ FileCount = FileCount + 1
+ End If
+ oDocument.Dispose()
+ InsertTargetUrlToLogDocument(sTargetUrl, sComment, ApplIndex)
+ Else
+ sCurcouldnotopenDocument = ReplaceString(scouldnotopenDocument, ConvertFromUrl(sSourceUrl), &quot;&lt;1&gt;&quot;)
+ sComment = ConcatComment(sComment, sCurCouldnotopenDocument)
+ InsertSourceUrlToLogDocument(sSourceUrl, sComment)
+ End If
+ End If
+ End If
+ Next i
+ End If
+ AddLogStatistics()
+ FinalizeDialogButtons()
+ bConversionIsRunning = False
+ Exit Sub
+RTError:
+ Msgbox sRTErrorDesc, 16, sRTErrorHeader
+End Sub
+
+
+
+Sub AddListtoFilesList(FirstList(), SecList(), NewContentList() as String)
+Dim sLocExtension as String
+Dim FirstStart as Integer
+Dim FirstEnd as Integer
+Dim i as Integer
+Dim s as Integer
+ If FirstList(0,0) = &quot;&quot; Then
+ FirstStart = Ubound(FirstList(),1)
+ Else
+ FirstStart = Ubound(FirstList(),1) + 1
+ End If
+ FirstEnd = FirstStart + Ubound(SecList(),1)
+ ReDim Preserve FirstList(FirstEnd,2)
+ s = 0
+ For i = FirstStart To FirstEnd
+ FirstList(i,0) = SecList(s,0)
+ FirstList(i,1) = SecList(s,1)
+ sLocExtension = lcase(FirstList(i,1))
+ Select Case sLocExtension
+ Case &quot;sdw&quot;, &quot;sdc&quot;, &quot;sda&quot;, &quot;sdd&quot;, &quot;smf&quot;, &quot;sgl&quot;, &quot;doc&quot;, &quot;xls&quot;, &quot;ppt&quot;, &quot;sxi&quot; , &quot;sxw&quot; , &quot;sxd&quot; , &quot;sxg&quot; , &quot;sxm&quot; , &quot;sxc&quot; , &quot;pps&quot;
+ AbsDocuFound = AbsDocuFound + 1
+ Case else
+ AbsTemplateFound = AbsTemplateFound + 1
+ End Select
+ FirstList(i,2) = CStr(NewContentList(s))
+ s = s + 1
+ Next i
+ SetProgressDisplay(Ubound(FirstList()) + 1)
+End Sub
+
+
+
+Function GetTargetTemplatePath(Index as Integer)
+ Select Case WizardMode
+ Case SBMICROSOFTMODE
+ GetTargetTemplatePath() = SOTemplatePath &amp; &quot;/&quot; &amp; sTemplateGroupName
+ Case SBXMLMODE
+ If Index = 3 Then
+ &apos; Helper Application
+ GetTargetTemplatePath = SOWorkPath
+ Else
+ GetTargetTemplatePath = SOTemplatePath
+ End If
+ End Select
+End Function
+
+
+&apos; Retrieves the second value for a next to &apos;SearchString&apos; in
+&apos; a two-dimensional string-Array
+Function GetFilterName(sMimetypeorExtension as String, sFilterName(), sExtension as string, FilterIndex as Integer) as String
+Dim i as Integer
+Dim MaxIndex as Integer
+Dim sLocFilterlist() as String
+ For i = 0 To Ubound(sFiltername(),1)
+ If Instr(1,sFilterName(i,0),sMimeTypeOrExtension) &lt;&gt; 0 Then
+ sLocFilterList() = ArrayoutofString(sFiltername(i,0),&quot;|&quot;, MaxIndex)
+ If MaxIndex = 0 Then
+ sExtension = sFiltername(i,2)
+ GetFilterName = sFilterName(i,1)
+ Else
+ Dim b as Integer
+ Dim sLocExtensionList() as String
+ b = SearchArrayForPartString(sMimetypeOrExtension, sLocFilterList())
+ sLocFilterList() = ArrayoutofString(sFiltername(i,1),&quot;|&quot;, MaxIndex)
+ GetFilterName = sLocFilterList(b)
+ sLocExtensionList() = ArrayoutofString(sFilterName(i,2), &quot;|&quot;, MaxIndex)
+ sExtension = sLocExtensionList(b)
+ End If
+ Exit For
+ End If
+ Next
+ FilterIndex = i
+End Function
+
+
+Function SearchArrayforPartString(SearchString as String, LocList()) as Integer
+Dim i as Integer
+Dim a as Integer
+Dim StringList() as String
+ For i = Lbound(LocList(),1) to Ubound(LocList(),1)
+ StringList() = ArrayoutofString(LocList(i), &quot;|&quot;)
+ For a = 0 To Ubound(StringList())
+ If (Instr(1, SearchString, StringList(a)) &lt;&gt; 0) Then
+ SearchArrayForPartString() = i
+ Exit Function
+ End If
+ Next a
+ Next i
+ SearchArrayForPartString() = -1
+End Function
+
+
+Sub CreateLogTable(ApplIndex as Integer, CurFileContent as String, sFilterName() as String)
+Dim oLogCursor as Object
+Dim oLogRows as Object
+Dim FilterIndex as Integer
+Dim sDocumentType as String
+Dim oTextCursor
+Dim oCell
+ If Not bLogExists Then
+ Exit Sub
+ End If
+ bFilterTracerIsinsideTable = False
+ FilterIndex = GetIndexForPartStringinMultiArray(sFilterName(), CurFileContent, 0)
+ sDocumentType = sFiltername(FilterIndex,3)
+ oLogCursor = oLogDocument.Text.createTextCursor()
+ oLogCursor.GotoEnd(False)
+ If Not bIsFirstLogTable Then
+ oLogDocument.Text.insertControlCharacter(oLogCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
+ Else
+ bisFirstLogTable = False
+ End If
+ oLogCursor.HyperLinkURL = &quot;&quot;
+ oLogCursor.HyperLinkName = &quot;&quot;
+ oLogCursor.HyperLinkTarget = &quot;&quot;
+ oLogCursor.ParaStyleName = &quot;Heading 1&quot;
+ oLogCursor.setString(sDocumentType)
+ If WizardMode = SBMICROSOFTMODE Then
+ If bFilterTracingAvailable Then
+ If bMSApplFilterTracingAvailable(ApplIndex) Then
+ Dim CurFilterTracingPath as String
+ CurFilterTracingPath = FilterTracingLogPath(ApplIndex)
+ bFilterTracerIsinsideTable = (bTakeOverTargetName(ApplIndex) Or bTakeOverPathName(ApplIndex))
+ If Not bFilterTracerIsinsideTable Then
+ oLogCursor.CollapseToEnd()
+ oLogDocument.Text.insertControlCharacter(oLogCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
+ InsertCommandButtonatViewCursor(oLogDocument, oLogCursor, CurFilterTracingPath)
+ End If
+ End If
+ End If
+ End If
+ oLogCursor.CollapsetoEnd()
+ oLogDocument.Text.insertControlCharacter(oLogCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
+ oLogTable = oLogDocument.CreateInstance(&quot;com.sun.star.text.TextTable&quot;)
+ oLogTable.RepeatHeadline = true
+ If bFilterTracerIsinsideTable Then
+ oLogTable.initialize(2,3)
+ End If
+ oLogCursor.Text.InsertTextContent(oLogCursor, oLogTable, True)
+ oTextCursor = oLogTable.GetCellbyPosition(0,0).createTextCursor()
+ oTextCursor.SetString(sSourceDocuments)
+ oTextCursor = oLogTable.GetCellbyPosition(1,0).createTextCursor()
+ oTextCursor.SetString(sTargetDocuments)
+ If bFilterTracerIsinsideTable Then
+ oTextCursor = oLogTable.GetCellbyPosition(2,0).createTextCursor()
+ oTextCursor.SetString(&quot;FilterTracer&quot;)
+ End If
+ bInsertRow = False
+End Sub
+
+
+Function GetSize(iWidth, iHeight) As New com.sun.star.awt.Size
+Dim aSize As New com.sun.star.awt.Size
+ aSize.Width = iWidth
+ aSize.Height = iHeight
+ GetSize() = aSize
+End Function
+
+
+Sub InsertCommandButtonatViewCursor(oLocDocument, oLocCursor, TargetUrl as String, Optional aSize)
+Dim oDocument
+Dim oController
+Dim oCommandButton
+Dim oShape
+Dim oDrawPage
+Dim oCommandControl
+Dim oEvent
+Dim oCell
+ oCommandButton = oLocDocument.createInstance(&quot;com.sun.star.form.component.CommandButton&quot;)
+ oShape = oLocDocument.CreateInstance (&quot;com.sun.star.drawing.ControlShape&quot;)
+ If IsMissing(aSize) Then
+ oShape.Size = GetSize(4000, 600)
+ End If
+ oCommandButton.Label = FileNameoutofPath(Targeturl)
+ oCommandButton.TargetFrame = &quot;_default&quot;
+ oCommandButton.ButtonType = com.sun.star.form.FormButtonType.URL
+ oCommandbutton.DispatchUrlInternal = True
+ oCommandButton.TargetURL = ConverttoUrl(TargetUrl)
+ oShape.Control = oCommandbutton
+ oLocCursor.Text.InsertTextContent(oLocCursor, oShape, True)
+End Sub
+
+
+
+Sub CreateLogDocument(HiddenProperties())
+Dim OpenProperties(0) as new com.sun.star.beans.PropertyValue
+Dim NoArgs()
+Dim i as Integer
+Dim bLogIsThere as Boolean
+ If ImportDialog.chkLogfile.State = 1 Then
+ i = 2
+ OpenProperties(0).Name = &quot;Hidden&quot;
+ OpenProperties(0).Value = True
+ oLogDocument = StarDesktop.LoadComponentFromURL(&quot;private:factory/swriter&quot;, &quot;_default&quot;, 4, OpenProperties())
+ SOWorkPath = RTrimStr(SOWorkPath,&quot;/&quot;)
+ sLogUrl = SOWorkPath &amp; &quot;/Logfile.odt&quot;
+ Do
+ bLogIsThere = oUcb.Exists(sLogUrl)
+ If bLogIsThere Then
+ If i = 2 Then
+ sLogUrl = ReplaceString(sLogUrl, &quot;/Logfile_2.odt&quot;, &quot;/Logfile.odt&quot;)
+ Else
+ sLogUrl = ReplaceString(sLogUrl, &quot;/Logfile_&quot; &amp; cStr(i) &amp; &quot;.odt&quot;, &quot;/Logfile_&quot; &amp; cStr(i-1) &amp; &quot;.odt&quot;)
+ End If
+ i = i + 1
+ End If
+ Loop Until Not bLogIsThere
+ bLogExists = True
+ oLogDocument.StoreAsUrl(sLogUrl, NoArgs())
+ End If
+End Sub
+
+
+Function GetFilterTracingLogPath(sTargetUrl as String, ApplIndex) as String
+Dim TargetFileName as String
+Dim sTargetFolder as String
+Dim CurFilterTracingPath as String
+Dim CurFilterTracingname as String
+Dim CurFilterFolder as String
+ CurFilterTracingPath = FilterTracingLogPath(ApplIndex)
+ If bTakeOverTargetName(ApplIndex) Then
+ TargetFilename = GetFileNameWithoutextension(sTargetUrl, &quot;/&quot;)
+ CurFilterFolder = DirectoryNameoutofPath(FilterTracingLogPath(ApplIndex), &quot;/&quot;)
+ CurFilterTracingpath = CurFilterFolder &amp; &quot;/&quot; &amp; TargetFilename &amp; &quot;.log&quot;
+ End If
+ If bTakeOverPathName(ApplIndex) Then &apos;Replace the Folder in the FilterTracerpath by the Folder of the targetUrl
+ sTargetFolder = DirectoryNameoutofPath(sTargetUrl,&quot;/&quot;)
+ CurFilterTracingPath = sTargetFolder &amp; &quot;/&quot; &amp; FileNameoutofPath(CurFilterTracingPath, &quot;/&quot;)
+ End If
+ GetFilterTracingLogPath() = CurFilterTracingPath
+End Function
+
+
+Sub InsertTargetUrlToLogDocument(sTargetUrl as String, sComment as String, ApplIndex as Integer)
+Dim oCell
+Dim oTextCursor
+Dim CurFilterTracingpath as String
+ If (bLogExists) And (sTargetUrl &lt;&gt; &quot;&quot;) Then
+ If sTargetUrl &lt;&gt; &quot;&quot; Then
+ oCell = oLogTable.GetCellbyPosition(1,oLogTable.Rows.Count-1)
+ InsertCommentToLogCell(sComment, oCell)
+ InsertHyperLinkToLogCell(sTargetUrl, oCell)
+ If bFilterTracerIsinsideTable Then
+ oCell = oLogTable.getCellByPosition(2, oLogTable.Rows.Count-1)
+ oTextCursor = oCell.Text.CreateTextCursor()
+ CurFilterTracingpath = GetFilterTracingLogPath(sTargetUrl, ApplIndex)
+ InsertCommandButtonatViewCursor(oLogDocument, oTextCursor, CurFilterTracingPath)
+ End If
+ oLogDocument.Store()
+ End If
+ End If
+End Sub
+
+
+Sub InsertSourceUrlToLogDocument(SourceUrl as String, sComment) &apos;
+Dim oCell as Object
+ If bLogExists Then
+ If bInsertRow Then
+ oLogTable.Rows.InsertByIndex(oLogTable.Rows.Count,1)
+ Else
+ bInsertRow = True
+ End If
+ oCell = oLogTable.GetCellbyPosition(0,oLogTable.Rows.Count-1)
+ InsertCommentToLogCell(sComment, oCell)
+ InsertHyperLinkToLogCell(SourceUrl, oCell)
+ oLogDocument.Store()
+ End If
+End Sub
+
+
+Sub InsertHyperLinkToLogCell(sUrl as String, oCell as Object)
+Dim oLogCursor as Object
+Dim LocFileName as String
+ oLogCursor = oCell.createTextCursor()
+ oLogCursor.CollapseToStart()
+ oLogCursor.HyperLinkURL = sUrl
+ oLogCursor.HyperLinkName = sUrl
+ oLogCursor.HyperLinkTarget = sUrl
+ LocFileName = FileNameOutOfPath(sUrl)
+ oCell.InsertString(oLogCursor, LocFileName,False)
+End Sub
+
+
+Sub InsertCommentToLogCell(sComment as string, oCell as Object)
+Dim oCommentCursor as Object
+ If sComment &lt;&gt; &quot;&quot; Then
+ oCommentCursor = oCell.createTextCursor()
+ oCell.insertControlCharacter(oCommentCursor, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
+ oCell.insertString(oCommentCursor, sComment, false)
+ End If
+End Sub
+
+
+Sub AddLogStatistics()
+Dim oCell as Object
+Dim oLogCursor as Object
+Dim MaxRowIndex as Integer
+ If bLogExists Then
+ MaxRowIndex = oLogTable.Rows.Count
+ sLogSummary = ReplaceString(sLogSummary, FileCount, &quot;&lt;COUNT&gt;&quot;)
+&apos; oLogTable.Rows.InsertByIndex(MaxRowIndex, 1)
+&apos; oCell = oLogTable.GetCellbyPosition(0, MaxRowIndex)
+&apos; oLogCursor = oCell.createTextCursor()
+&apos; oCell.InsertString(oLogCursor, sLogSummary,False)
+&apos; MergeRange(oLogTable, oCell, 1)
+
+ oLogCursor = oLogDocument.Text.CreateTextCursor
+ oLogCursor.gotoEnd(False)
+ oLogCursor.HyperLinkURL = &quot;&quot;
+ oLogCursor.HyperLinkName = &quot;&quot;
+ oLogCursor.HyperLinkTarget = &quot;&quot;
+ oLogCursor.SetString(sLogSummary)
+ oLogDocument.Store()
+ oLogDocument.Dispose()
+ bLogExists = False
+ End If
+End Sub
+
+
+
+Function CheckIfMacroExists(oBasicLibraries as Object, sComment as String) as Boolean
+Dim ModuleNames() as String
+Dim ModuleName as String
+Dim MaxLibIndex as Integer
+Dim MaxModuleIndex as Integer
+Dim bMacroExists as Boolean
+Dim n as Integer
+Dim m as Integer
+Dim LibName as String
+Dim sBasicCode as String
+Dim oLibrary as Object
+ bMacroExists = False
+ bMacroExists = oBasicLibraries.hasElements
+ If bMacroExists Then
+ MaxLibIndex = Ubound(oBasicLibraries.ElementNames())
+ For n = 0 To MaxLibIndex
+ LibName = oBasicLibraries.ElementNames(n)
+ If oBasicLibraries.isLibraryLoaded(LibName) Then
+ oLibrary = oBasicLibraries.getbyName(LibName)
+ If oLibrary.hasElements() Then
+ MaxModuleIndex = Ubound(oLibrary.ElementNames())
+ For m = 0 To MaxModuleIndex
+ ModuleName = oLibrary.ElementNames(m)
+ sBasicCode = oLibrary.getbyName(ModuleName)
+ If sBasicCode &lt;&gt; &quot;&quot; Then
+ ConcatComment(sComment, sReeditMacro)
+ CheckIfMacroExists() = True
+ Exit Function
+ End If
+ Next m
+ End If
+ End If
+ Next n
+ End If
+ CheckIfMacroExists() = False
+End Function
+
+
+
+Function CheckPassWordProtection(oDocument as Object)
+Dim bIsPassWordProtected as Boolean
+Dim i as Integer
+Dim oArgs()
+Dim MaxIndex as Integer
+Dim sblabla as String
+ bIsPassWordProtected = false
+ oArgs() = oDocument.getArgs()
+ MaxIndex = Ubound(oArgs())
+ For i = 0 To MaxIndex
+ sblabla = oArgs(i).Name
+ If oArgs(i).Name = &quot;Password&quot; Then
+ bIsPassWordProtected = True
+ sCurPassWord = oArgs(i).Value
+ Exit For
+ End If
+ Next i
+ CheckPassWordProtection() = bIsPassWordProtected
+End Function
+
+
+Sub OpenLogDocument()
+
+ bShowLogFile = True
+ ImportDialogArea.endexecute()
+
+End Sub
+
+
+Sub MergeRange(oTable as Object, oCell as Object, MergeCount as Integer)
+Dim oTableCursor as Object
+ oTableCursor = oTable.createCursorByCellName(oCell.CellName)
+ oTableCursor.goRight(MergeCount, True)
+ oTableCursor.mergeRange()
+End Sub
+
+
+Function ConcatComment(sComment as String, AdditionalComment as String)
+ If sComment = &quot;&quot; Then
+ sComment = AdditionalComment
+ Else
+ sComment = sComment &amp; chr(13) + AdditionalComment
+ End If
+ ConcatComment = sComment
+End Function
+</script:module>
diff --git a/wizards/source/importwizard/ImportDialog.xdl b/wizards/source/importwizard/ImportDialog.xdl
new file mode 100644
index 000000000000..082c06bc8970
--- /dev/null
+++ b/wizards/source/importwizard/ImportDialog.xdl
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="ImportDialog" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:page="4" dlg:help-url="HID:34570" dlg:closeable="true" dlg:moveable="true" dlg:title="ImportDialog">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="lblTemplateExport" dlg:tab-index="0" dlg:left="12" dlg:top="94" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblTemplateExport"/>
+ <dlg:textfield dlg:id="txtTemplateImportPath" dlg:tab-index="1" dlg:left="73" dlg:top="76" dlg:width="170" dlg:height="12" dlg:page="2" dlg:help-url="HID:34583">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:textfield>
+ <dlg:textfield dlg:id="txtTemplateExportPath" dlg:tab-index="2" dlg:left="73" dlg:top="92" dlg:width="170" dlg:height="12" dlg:page="2" dlg:help-url="HID:34584"/>
+ <dlg:checkbox dlg:id="chkDocumentPath" dlg:tab-index="3" dlg:left="12" dlg:top="121" dlg:width="240" dlg:height="10" dlg:page="2" dlg:tag="Document" dlg:help-url="HID:34586" dlg:value="chkDocumentPath" dlg:checked="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.ToggleInputPaths?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="chkDocumentSearchSubDir" dlg:tab-index="4" dlg:left="12" dlg:top="134" dlg:width="240" dlg:height="10" dlg:page="2" dlg:help-url="HID:34587" dlg:value="chkDocumentSearchSubDir" dlg:checked="false"/>
+ <dlg:text dlg:id="lblDocumentImport" dlg:tab-index="5" dlg:left="10" dlg:top="151" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblDocumentImport"/>
+ <dlg:text dlg:id="lblDocumentExport" dlg:tab-index="6" dlg:left="10" dlg:top="167" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblDocumentExport"/>
+ <dlg:textfield dlg:id="txtDocumentImportPath" dlg:tab-index="7" dlg:left="73" dlg:top="149" dlg:width="170" dlg:height="12" dlg:page="2" dlg:help-url="HID:34588">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:textfield>
+ <dlg:textfield dlg:id="txtDocumentExportPath" dlg:tab-index="8" dlg:left="73" dlg:top="165" dlg:width="170" dlg:height="12" dlg:page="2" dlg:help-url="HID:34589"/>
+ <dlg:text dlg:id="SummaryHeaderLabel" dlg:tab-index="9" dlg:left="6" dlg:top="37" dlg:width="258" dlg:height="8" dlg:page="3" dlg:value="SummaryHeaderLabel"/>
+ <dlg:textfield dlg:id="SummaryTextbox" dlg:tab-index="10" dlg:left="5" dlg:top="48" dlg:width="259" dlg:height="125" dlg:page="3" dlg:help-url="HID:34595" dlg:vscroll="true" dlg:multiline="true" dlg:readonly="true"/>
+ <dlg:text dlg:id="LabelRetrieval" dlg:tab-index="11" dlg:left="10" dlg:top="67" dlg:width="255" dlg:height="8" dlg:page="4" dlg:value="LabelRetrieval"/>
+ <dlg:text dlg:id="LabelCurTemplateRetrieval" dlg:tab-index="12" dlg:left="15" dlg:top="79" dlg:width="249" dlg:height="8" dlg:page="4" dlg:value="LabelCurTemplateRetrieval"/>
+ <dlg:text dlg:id="LabelCurDocumentRetrieval" dlg:tab-index="13" dlg:left="15" dlg:top="91" dlg:width="249" dlg:height="8" dlg:page="4" dlg:value="LabelCurDocumentRetrieval"/>
+ <dlg:text dlg:id="LabelCurProgress" dlg:tab-index="14" dlg:left="10" dlg:top="106" dlg:width="255" dlg:height="8" dlg:page="4" dlg:value="LabelCurProgress"/>
+ <dlg:text dlg:id="LabelCurDocument" dlg:tab-index="15" dlg:left="15" dlg:top="118" dlg:width="249" dlg:height="20" dlg:page="4" dlg:value="LabelCurDocument" dlg:multiline="true"/>
+ <dlg:img dlg:id="ImportPreview" dlg:tab-index="16" dlg:left="5" dlg:top="6" dlg:width="258" dlg:height="26" dlg:scale-image="false"/>
+ <dlg:button dlg:id="cmdBack" dlg:tab-index="17" dlg:left="155" dlg:top="190" dlg:width="50" dlg:height="14" dlg:help-url="HID:34573" dlg:value="cmdBack">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.Main.PrevStep?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="18" dlg:left="6" dlg:top="190" dlg:width="50" dlg:height="14" dlg:help-url="HID:34572" dlg:value="cmdCancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.Main.CancelTask?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdHelp" dlg:tab-index="19" dlg:left="65" dlg:top="190" dlg:width="50" dlg:height="14" dlg:value="cmdHelp" dlg:button-type="help"/>
+ <dlg:button dlg:id="cmdGoOn" dlg:tab-index="20" dlg:left="214" dlg:top="190" dlg:width="50" dlg:height="14" dlg:help-url="HID:34574" dlg:value="cmdGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.Main.NextStep?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:text dlg:id="WelcomeTextLabel" dlg:tab-index="21" dlg:left="6" dlg:top="38" dlg:width="258" dlg:height="20" dlg:page="1" dlg:value="WelcomeTextLabel" dlg:multiline="true"/>
+ <dlg:text dlg:id="WelcomeTextLabel3" dlg:tab-index="22" dlg:left="6" dlg:top="58" dlg:width="258" dlg:height="12" dlg:page="1" dlg:value="WelcomeTextLabel3"/>
+ <dlg:button dlg:id="cmdTemplateImport" dlg:tab-index="23" dlg:left="248" dlg:top="75" dlg:width="14" dlg:height="14" dlg:page="2" dlg:tag="txtTemplateImportPath" dlg:help-url="HID:34585" dlg:value="...">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.TakoverFolderName?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdTemplateExport" dlg:tab-index="24" dlg:left="248" dlg:top="91" dlg:width="14" dlg:height="14" dlg:page="2" dlg:tag="txtTemplateExportPath" dlg:help-url="HID:34600" dlg:value="...">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.TakoverFolderName?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdDocumentImport" dlg:tab-index="25" dlg:left="248" dlg:top="148" dlg:width="14" dlg:height="14" dlg:page="2" dlg:tag="txtDocumentImportPath" dlg:help-url="HID:34590" dlg:value="...">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.TakoverFolderName?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdDocumentExport" dlg:tab-index="26" dlg:left="248" dlg:top="164" dlg:width="14" dlg:height="14" dlg:page="2" dlg:tag="txtDocumentExportPath" dlg:help-url="HID:34601" dlg:value="...">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.TakoverFolderName?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optSODocuments" dlg:tab-index="27" dlg:left="6" dlg:top="72" dlg:width="258" dlg:height="9" dlg:page="1" dlg:tag="SO" dlg:help-url="HID:34575" dlg:value="optSODocuments" dlg:checked="true">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleCheckboxes?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optMSDocuments" dlg:tab-index="28" dlg:left="6" dlg:top="113" dlg:width="258" dlg:height="9" dlg:page="1" dlg:tag="MS" dlg:help-url="HID:34576" dlg:value="optMSDocuments">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleCheckboxes?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:checkbox dlg:id="chkSOApplication1" dlg:tab-index="29" dlg:left="12" dlg:top="85" dlg:width="141" dlg:height="9" dlg:page="1" dlg:help-url="HID:34596" dlg:value="chkSOApplication1" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="chkSOApplication2" dlg:tab-index="30" dlg:left="155" dlg:top="85" dlg:width="109" dlg:height="9" dlg:page="1" dlg:help-url="HID:34597" dlg:value="chkSOApplication2" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="chkSOApplication3" dlg:tab-index="31" dlg:left="12" dlg:top="98" dlg:width="141" dlg:height="9" dlg:page="1" dlg:help-url="HID:34598" dlg:value="chkSOApplication3" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="chkSOApplication4" dlg:tab-index="32" dlg:left="155" dlg:top="98" dlg:width="109" dlg:height="9" dlg:page="1" dlg:help-url="HID:34599" dlg:value="chkSOApplication4" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="chkMSApplication1" dlg:tab-index="33" dlg:disabled="true" dlg:left="12" dlg:top="126" dlg:width="141" dlg:height="9" dlg:page="1" dlg:help-url="HID:34578" dlg:value="chkMSApplication1" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="chkMSApplication2" dlg:tab-index="34" dlg:disabled="true" dlg:left="155" dlg:top="126" dlg:width="109" dlg:height="9" dlg:page="1" dlg:help-url="HID:34579" dlg:value="chkMSApplication2" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="chkMSApplication3" dlg:tab-index="35" dlg:disabled="true" dlg:left="12" dlg:top="139" dlg:width="141" dlg:height="9" dlg:page="1" dlg:help-url="HID:34580" dlg:value="chkMSApplication3" dlg:checked="false">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.Main.ToggleNextButton?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:text dlg:id="WelcomeTextLabel2" dlg:tab-index="36" dlg:disabled="true" dlg:left="6" dlg:top="152" dlg:width="258" dlg:height="18" dlg:page="1" dlg:value="WelcomeTextLabel2" dlg:multiline="true"/>
+ <dlg:checkbox dlg:id="chkTemplatePath" dlg:tab-index="37" dlg:left="12" dlg:top="48" dlg:width="240" dlg:height="10" dlg:page="2" dlg:tag="Template" dlg:help-url="HID:34581" dlg:value="chkTemplatePath" dlg:checked="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:ImportWizard.DialogModul.ToggleInputPaths?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:checkbox>
+ <dlg:checkbox dlg:id="chkTemplateSearchSubDir" dlg:tab-index="38" dlg:left="12" dlg:top="61" dlg:width="240" dlg:height="10" dlg:page="2" dlg:help-url="HID:34582" dlg:value="chkTemplateSearchSubDir" dlg:checked="false"/>
+ <dlg:text dlg:id="lblTemplateImport" dlg:tab-index="39" dlg:left="12" dlg:top="78" dlg:width="60" dlg:height="8" dlg:page="2" dlg:value="lblTemplateImport"/>
+ <dlg:checkbox dlg:id="chkLogfile" dlg:tab-index="40" dlg:left="6" dlg:top="171" dlg:width="136" dlg:height="9" dlg:page="1" dlg:help-url="HID:34577" dlg:value="chkLogfile" dlg:checked="true"/>
+ <dlg:fixedline dlg:id="hlnTemplates" dlg:tab-index="41" dlg:left="6" dlg:top="37" dlg:width="258" dlg:height="8" dlg:page="2" dlg:value="hlnTemplates"/>
+ <dlg:fixedline dlg:id="hlnDocuments" dlg:tab-index="42" dlg:left="6" dlg:top="110" dlg:width="258" dlg:height="8" dlg:page="2" dlg:value="hlnDocuments"/>
+ <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="43" dlg:left="6" dlg:top="181" dlg:width="258" dlg:height="6"/>
+ <dlg:fixedline dlg:id="hlnProgress" dlg:tab-index="44" dlg:left="6" dlg:top="55" dlg:width="258" dlg:height="8" dlg:page="4" dlg:value="hlnProgress"/>
+ <dlg:button dlg:id="cmdShowLogFile" dlg:tab-index="45" dlg:disabled="true" dlg:left="75" dlg:top="142" dlg:width="120" dlg:height="14" dlg:page="4" dlg:value="cmdShowLogFile">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.FilesModul.OpenLogDocument?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/importwizard/Language.xba b/wizards/source/importwizard/Language.xba
new file mode 100644
index 000000000000..32efcc242e8a
--- /dev/null
+++ b/wizards/source/importwizard/Language.xba
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
+
+Public sMSTemplateCheckbox(2) As String
+Public sMSDocumentCheckbox(2) As String
+Public sSODocumentCheckbox(4) As String
+Public sSOHelperdocuments(1,1) As String
+Public sTemplateCheckbox(SBMAXAPPLCOUNT-1) As String
+Public sDocumentCheckbox(SBMAXAPPLCOUNT-1) As String
+Public sTemplateGroupName As String
+Public sSearchInSubDir as String
+Public sPathErrorTemplates(SBMAXAPPLCOUNT-1) As String
+Public sPathErrorDocument(SBMAXAPPLCOUNT-1) As String
+Public sPathErrorStarDoc(SBMAXAPPLCOUNT-1) As String
+Public sStarDocLabel(SBMAXAPPLCOUNT-1) As String
+Public sImportLabel As String, sExportLabel As String
+Public SOApplicationName(5) As String
+Public sHelpButton As String, sCancelButton As String, sBackButton As String, sNextButton As String
+Public sSumInclusiveSubDir As String, sSumSaveDocuments As String
+Public sSummaryHeader As String
+Public sWelcometextLabel1 As String, sWelcometextLabel2 As String, sWelcometextLabel3 As String
+Public sBeginButton As String, sMsgDirNotThere As String
+Public sQueryForNewCreation As String, sPathError3 As String
+Public sNoDirCreation As String
+Public sProgressMoreDocs As String, sProgressMoreTemplates as String
+Public sFileExists As String, sMorePathsError3 As String
+Public sConvertError1 As String, sConvertError2 As String, sPathDialogMessage As String
+Public sRTErrorDesc As String, sRTErrorHeader As String
+Public sProgressPage_1 As String, sProgressPage_2 As String, sProgressPage_3 as String
+Public sProgressFound as String, sProgresspage_5 as String
+Public sContainerName(1) as String
+Public sReady as String, sTitle as String
+Public sCloseButton as String
+Public sSourceDocuments as String
+Public sTargetDocuments as String
+Public sSumSODocuments(4) as String
+Public sSumSOTemplates(4) as String
+Public sSumMSDocuments(3) as String
+Public sSumMSTemplates(3) as String
+Public ModuleList(3) as String
+Public sLogSummary as String
+Public sReeditMacro as String
+Public sOverwriteallFiles as String
+Public scouldnotopenDocument as String
+Public sCurcouldnotopenDocument as String
+Public scouldnotsaveDocument as String
+Public sCurcouldnotsaveDocument as String
+
+
+Sub LoadLanguage()
+ If InitResources(&quot;ImportWizard&quot;,&quot;imp&quot;) then
+ sHelpButton = GetResText(1000)
+ sCancelButton = GetResText(1001)
+ sBackButton = GetResText(1002)
+ sNextButton = GetResText(1003)
+ sBeginButton = GetResText(1004)
+ sCloseButton = GetResText(1005)
+
+ sWelcometextLabel1 = ReplaceString(GetResText(1006), GetProductName(),&quot;%PRODUCTNAME&quot;)
+ sWelcometextLabel2 = GetResText(1007)
+ sWelcometextLabel3 = GetResText(1008)
+
+ &apos; Microsoft Documents
+ GetApplResourceArray(1009, 3, sMSTemplateCheckBox())
+
+ &apos; DocumentCheckbox- Captions
+ GetApplResourceArray(1012, 3, sMSDocumentCheckBox())
+
+ &apos; DocumentCheckbox- Captions
+ GetApplResourceArray(2013, 5, sSODocumentCheckBox())
+
+ &apos;StarOffice Applicationnames
+
+ sSOHelperDocuments(0,0) = GetResText(2017)
+ sSOHelperDocuments(0,1) = &quot;com.sun.star.text.GlobalDocument&quot;
+ sSOHelperDocuments(1,0) = GetResText(2018)
+ sSOHelperDocuments(1,1) = &quot;com.sun.star.formula.FormulaProperties&quot;
+
+ GetApplResourceArray(2017,2, sSOHelperDocuments())
+
+ sContainerName(0) = GetResText(1030)
+ &apos; Note: for the version 5.2 there was no Productname &quot;StarSuite&quot;
+ sContainerName(1) = &quot;StarOffice&quot;
+
+ sSummaryHeader = GetResText(1031)
+
+ sTemplateGroupName = GetResText(1036)
+
+ sProgressMoreDocs = GetResText(1041)
+ sProgressMoreTemplates = GetResText(1042)
+ sNoDirCreation = GetResText(1050)
+ sMsgDirNotThere = GetResText(1051)
+ sQueryForNewCreation = GetResText(1052)
+ sFileExists = GetResText(1053)
+ sMorePathsError3 = GetResText(1054)
+ sConvertError1 = GetResText(1055)
+ sConvertError2 = GetResText(1056)
+ sRTErrorDesc = GetResText(1057)
+ sRTErrorHeader = GetResText(1058)
+ sOverwriteallFiles = GetResText(1070)
+ sReeditMacro = GetResText(1071)
+ scouldnotsaveDocument = GetResText(1072)
+ scouldnotopenDocument = GetResText(1073)
+ sPathDialogMessage = GetResText(1080)
+ sTitle = GetResText(1081)
+
+ sProgressPage_1 = GetResText(1090)
+ sProgressPage_2 = GetResText(1091)
+ sProgressPage_3 = GetResText(1092)
+ sProgressFound = GetResText(1093)
+ sProgressPage_5 = GetResText(1094)
+ sReady = GetResText(1100)
+ sSourceDocuments = GetResText(2030)
+ sTargetDocuments = GetResText(2031)
+ sLogSummary = GetResText(2034)
+ sSumInclusiveSubDir = GetResText(3000)
+ sSumSaveDocuments = GetResText(3001)
+ &apos;StarOffice Applicationnames
+ GetApplResourceArray(3100, 4, sSumSODocuments())
+ GetApplResourceArray(3110, 4, sSumSOTemplates())
+ GetApplResourceArray(3200, 3, sSumMSDocuments())
+ GetApplResourceArray(3210, 3, sSumMSTemplates())
+ With ImportDialog
+ sImportLabel = GetResText(1033)
+ sExportLabel = GetResText(1034)
+ sSearchInSubDir = GetResText(1022)
+ .chkTemplateSearchSubDir.Label = sSearchInSubDir
+ .lblDocumentImport.Label = sImportLabel
+ .lblDocumentExport.Label = sExportLabel
+ .chkDocumentSearchSubDir.Label = sSearchInSubDir
+ .lblTemplateImport.Label = sImportLabel
+ .lblTemplateExport.Label = sExportLabel
+ .chkLogfile.Label = GetResText(2032)
+ .chkLogfile.Helptext = GetResText(2033)
+ Dim Blabla as String
+ blabla = GetResText(1072)
+ .cmdShowLogFile.Label = GetResText(2035)
+ End With
+ ModuleList(0) = &quot;com.sun.star.text.TextDocument&quot;
+ ModuleList(1) = &quot;com.sun.star.sheet.SpreadsheetDocument&quot;
+ ModuleList(2) = &quot;com.sun.star.drawing.DrawingDocument/com.sun.star.presentation.PresentationDocument&quot;
+ ModuleList(3) = &quot;com.sun.star.formula.FormulaProperties/com.sun.star.text.GlobalDocument&quot;
+ End If
+End Sub
+
+
+Sub GetApplResourceArray(StartResIndex as Integer, Count as Integer, BigArray())
+Dim i as Integer
+Dim a as Integer
+ a = 0
+ For i = StartResIndex To StartResIndex + Count-1
+ BigArray(a) = GetResText(i)
+ a = a + 1
+ Next
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/importwizard/Main.xba b/wizards/source/importwizard/Main.xba
new file mode 100644
index 000000000000..2c25c6abebd0
--- /dev/null
+++ b/wizards/source/importwizard/Main.xba
@@ -0,0 +1,290 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Main" script:language="StarBasic">Option Explicit
+
+&apos; ***** BASIC *****
+Public HeaderPreviews(4) as Object
+Public ImportDialog as Object
+Public ImportDialogArea as Object
+Public oFactoryKey as Object
+Public bShowLogFile as Boolean
+
+&apos; If the ProgressPage ist already on Top The Dialog will be immediately closed when this flag is
+&apos; set to False
+Public bConversionIsRunning as Boolean
+Public RetValue as Integer
+
+Sub Main()
+ Dim NoArgs() as New com.sun.star.beans.PropertyValue
+ bShowLogFile=FALSE
+ If Not bDebugWizard Then
+ On Local Error Goto RTError
+ End If
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ RetValue = 10
+ bIsFirstLogTable = True
+ bConversionIsRunning = False
+ sCRLF = CHR(13) &amp; CHR(10)
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ oFactoryKey = GetRegistryKeyContent(&quot;org.openoffice.Setup/Office/Factories&quot;)
+ If GetImportWizardPaths() = False Then
+ Exit Sub
+ End If
+ bCancelTask = False
+ bDoKeepApplValues = False
+ CurOffice = 0
+ ImportDialogArea = LoadDialog(&quot;ImportWizard&quot;,&quot;ImportDialog&quot;)
+ ImportDialog = ImportDialogArea.Model
+ LoadLanguage()
+ WizardMode = SBXMLMODE
+ MaxApplCount = 4
+ FillStep_Welcome()
+ RepaintHeaderPreview()
+ ImportDialog.ImportPreview.BackGroundColor = RGB(0,60,126)
+ ImportDialog.cmdGoOn.DefaultButton = True
+ ImportDialogArea.GetControl(&quot;optSODocuments&quot;).SetFocus()
+ ToggleCheckboxesWithBoolean(False)
+ RetValue = ImportDialogArea.Execute()
+ If bShowLogFile=TRUE Then
+ OpenDocument(sLogUrl, NoArgs())
+ End if
+ If RetValue = 0 Then
+ CancelTask()
+ End If
+ ImportDialogArea.Dispose()
+ End
+ Exit Sub
+RTError:
+ Msgbox sRTErrorDesc, 16, sRTErrorHeader
+End Sub
+
+
+
+Sub NextStep()
+Dim iCurStep as Integer
+ If Not bDebugWizard Then
+ On Error Goto RTError
+ End If
+ bConversionIsRunning = False
+ iCurStep = ImportDialog.Step
+ Select Case iCurStep
+ Case 1
+ FillStep_InputPaths(0, True)
+ Case 2
+ If CheckInputPaths Then
+ SaveStep_InputPath
+ If CurOffice &lt; ApplCount - 1 Then
+ CurOffice = CurOffice + 1
+ TakeOverPathSettings()
+ FillStep_InputPaths(CurOffice, False)
+ Else
+ FillStep_Summary()
+ End If
+ End If
+ Case 3
+ FillStep_Progress()
+ Select Case WizardMode
+ Case SBMICROSOFTMODE
+ Call ConvertAllDocuments(MSFilterName())
+ CASE SBXMLMODE
+ Call ConvertAllDocuments(XMLFilterName())
+ End Select
+ Case 4
+ CancelTask(True)
+ End Select
+
+ If ((ImportDialog.chkLogfile.State &lt;&gt; 1) OR (iCurStep &lt;&gt; 3)) Then
+ ImportDialog.cmdGoOn.DefaultButton = True
+ End If
+
+ RepaintHeaderPreview()
+ Exit Sub
+RTError:
+ Msgbox sRTErrorDesc, 16, sRTErrorHeader
+End Sub
+
+
+
+Sub PrevStep()
+Dim iCurStep as Integer
+ If Not bDebugWizard Then
+ On Error Goto RTError
+ End If
+ bConversionIsRunning = False
+ iCurStep = ImportDialog.Step
+ Select Case iCurStep
+ Case 4
+ ImportDialog.cmdCancel.Label = sCancelButton
+ FillStep_Summary()
+ Case 3
+ FillStep_InputPaths(Applcount-1, False)
+ Case 2
+ SaveStep_InputPath
+ If CurOffice &gt; 0 Then
+ CurOffice = CurOffice - 1
+ FillStep_InputPaths(CurOffice, False)
+ Else
+ FillStep_Welcome()
+ bDoKeepApplValues = True
+ End If
+ End Select
+ ImportDialog.cmdGoOn.DefaultButton = True
+ RepaintHeaderPreview()
+ Exit Sub
+RTError:
+ Msgbox sRTErrorDesc, 16, sRTErrorHeader
+End Sub
+
+
+
+Sub CancelTask()
+ If bConversionIsRunning Then
+ If Msgbox(sConvertError1, 36, sConvertError2) = 6 Then
+ bCancelTask = True
+ bInterruptSearch = True
+ Else
+ bCancelTask = False
+ ImportDialog.cmdCancel.Enabled = True
+ End If
+ Else
+ ImportDialogArea.EndExecute()
+ End If
+End Sub
+
+
+Sub TemplateDirSearchDialog()
+ CallDirSearchDialog(ImportDialog.TemplateImportPath)
+End Sub
+
+
+Sub RepaintHeaderPreview()
+Dim Bitmap As Object
+Dim CurStep as Integer
+Dim sBitmapPath as String
+Dim LocPrefix as String
+ CurStep = ImportDialog.Step
+ LocPrefix = WizardMode
+ LocPrefix = ReplaceString(LocPrefix,&quot;XML&quot;, &quot;SO&quot;)
+ If CurStep = 2 Then
+ sBitmapPath = SOBitmapPath &amp; LocPrefix &amp; &quot;-Import_&quot; &amp; CurStep &amp; &quot;-&quot; &amp; Applications(CurOffice,SBAPPLKEY) + 1 &amp; &quot;.bmp&quot;
+ Else
+ sBitmapPath = SOBitmapPath &amp; &quot;Import_&quot; &amp; CurStep &amp; &quot;.bmp&quot;
+ End If
+ ImportDialog.ImportPreview.ImageURL = sBitmapPath
+End Sub
+
+
+Sub CheckModuleInstallation()
+Dim i as Integer
+ For i = 1 To MaxApplCount
+ ImportDialogArea.GetControl(&quot;chk&quot; &amp; WizardMode &amp; &quot;Application&quot; &amp; i).Model.Enabled = Abs(CheckInstalledModule(i-1))
+ Next i
+End Sub
+
+
+Function CheckInstalledModule(Index as Integer) as Boolean
+Dim ModuleName as String
+Dim NameList() as String
+Dim MaxIndex as Integer
+Dim i as Integer
+ ModuleName = ModuleList(Index)
+ If Instr(1,ModuleName,&quot;/&quot;) &lt;&gt; 0 Then
+ CheckInstalledModule() = False
+ NameList() = ArrayoutOfString(ModuleName,&quot;/&quot;, MaxIndex)
+ For i = 0 To MaxIndex
+ If oFactoryKey.HasByName(NameList(i)) Then
+ CheckInstalledModule() = True
+ End If
+ Next i
+ Else
+ CheckInstalledModule() = oFactoryKey.HasByName(ModuleName)
+ End If
+End Function
+
+
+Sub ToggleCheckboxes(oEvent as Object)
+Dim bMSEnable as Boolean
+ WizardMode = oEvent.Source.Model.Tag
+ bMSEnable = WizardMode = &quot;MS&quot;
+ ToggleCheckBoxesWithBoolean(bMSEnable)
+End Sub
+
+
+Sub ToggleCheckboxesWithBoolean(bMSEnable as Boolean)
+ If bMSEnable = True Then
+ WizardMode = SBMICROSOFTMODE
+ MaxApplCount = 3
+ Else
+ WizardMode = SBXMLMODE
+ MaxApplCount = 4
+ End If
+ With ImportDialogArea
+ .GetControl(&quot;chkSOApplication1&quot;).Model.Enabled = Not bMSEnable
+ .GetControl(&quot;chkSOApplication2&quot;).Model.Enabled = Not bMSEnable
+ .GetControl(&quot;chkSOApplication3&quot;).Model.Enabled = Not bMSEnable
+ .GetControl(&quot;chkSOApplication4&quot;).Model.Enabled = Not bMSEnable
+ .GetControl(&quot;chkMSApplication1&quot;).Model.Enabled = bMSEnable
+ .GetControl(&quot;chkMSApplication2&quot;).Model.Enabled = bMSEnable
+ .GetControl(&quot;chkMSApplication3&quot;).Model.Enabled = bMSEnable
+ End With
+ CheckModuleInstallation()
+ ImportDialog.WelcomeTextLabel2.Enabled = bMSEnable
+ bDoKeepApplValues = False
+ ToggleNextButton()
+End Sub
+
+
+Sub ToggleNextButton()
+Dim iCurStep as Integer
+Dim bDoEnable as Boolean
+Dim i as Integer
+ iCurStep = ImportDialog.Step
+ Select Case iCurStep
+ Case 1
+ With ImportDialog
+ If .optMSDocuments.State = 1 Then
+ bDoEnable = .chkMSApplication1.State = 1 Or .chkMSApplication2.State = 1 Or .chkMSApplication3.State = 1
+ Else
+ bDoEnable = .chkSOApplication1.State = 1 Or .chkSOApplication2.State = 1 Or .chkSOApplication3.State = 1 Or .chkSOApplication4.State = 1
+ End If
+ End With
+ bDoKeepApplValues = False
+ Case 2
+ bDoEnable = CheckControlPath(ImportDialog.chkTemplatePath, ImportDialog.txtTemplateImportPath, True)
+ bDoEnable = CheckControlPath(ImportDialog.chkDocumentPath, ImportDialog.txtDocumentImportPath, bDoEnable)
+ End Select
+ ImportDialog.cmdGoOn.Enabled = bDoEnable
+End Sub
+
+
+Sub TakeOverPathSettings()
+&apos;Takes over the Pathsettings from the first selected application to the next applications
+ If Applications(CurOffice,SBDOCSOURCE) = &quot;&quot; Then
+ Applications(CurOffice,SBDOCSOURCE) = Applications(0,SBDOCSOURCE)
+ Applications(CurOffice,SBDOCTARGET) = Applications(0,SBDOCTARGET)
+ If WizardMode = SBXMLMODE AND Applications(CurOffice,SBAPPLKEY) = 3 Then
+ Applications(CurOffice,SBTEMPLSOURCE) = Applications(CurOffice,SBDOCSOURCE)
+ Applications(CurOffice,SBTEMPLTARGET) = Applications(CurOffice,SBDOCTARGET)
+ Else
+ Applications(CurOffice,SBTEMPLSOURCE) = Applications(0,SBTEMPLSOURCE)
+ Applications(CurOffice,SBTEMPLTARGET) = Applications(0,SBTEMPLTARGET)
+ End If
+ End If
+End Sub
+
+
+Function GetImportWizardPaths() as Boolean
+ SOBitmapPath = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/bitmap&quot;)
+ If SOBitmapPath &lt;&gt; &quot;&quot; Then
+ SOWorkPath = GetPathSettings(&quot;Work&quot;, False)
+ If SOWorkPath &lt;&gt; &quot;&quot; Then
+ SOTemplatePath = GetPathSettings(&quot;Template_writable&quot;,False,0)
+ If SOTemplatePath &lt;&gt; &quot;&quot; Then
+ GetImportWizardPaths() = True
+ Exit Function
+ End If
+ End If
+ End If
+ GetImportWizardPaths() = False
+End Function
+</script:module> \ No newline at end of file
diff --git a/wizards/source/importwizard/delzip b/wizards/source/importwizard/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/importwizard/delzip
diff --git a/wizards/source/importwizard/dialog.xlb b/wizards/source/importwizard/dialog.xlb
new file mode 100644
index 000000000000..f5cc021d521d
--- /dev/null
+++ b/wizards/source/importwizard/dialog.xlb
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ImportWizard" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="ImportDialog"/>
+</library:library>
diff --git a/wizards/source/importwizard/importwi.src b/wizards/source/importwizard/importwi.src
new file mode 100644
index 000000000000..daddcc284642
--- /dev/null
+++ b/wizards/source/importwizard/importwi.src
@@ -0,0 +1,674 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/#define sHelpButton 1000
+#define sCancelButton 1001
+#define sBackButton 1002
+#define sNextButton 1003
+#define sBeginButton 1004
+#define sCloseButton 1005
+#define sWelcometextLabel1 1006
+#define sWelcometextLabel2 1007
+#define sWelcometextLabel3 1008
+#define sMSTemplateCheckbox_1_ 1009
+#define sMSTemplateCheckbox_2_ 1010
+#define sMSTemplateCheckbox_3_ 1011
+#define sMSDocumentCheckbox_1_ 1012
+#define sMSDocumentCheckbox_2_ 1013
+#define sMSDocumentCheckbox_3_ 1014
+#define sSearchInSubDir 1022
+#define sMSContainerName 1030
+#define sSummaryHeader 1031
+#define sSummaryFrame 1032
+#define sTextImportLabel 1033
+#define sTextExportLabel 1034
+#define sGroupnameDefault 1036
+#define sProgressDesc1 1039
+#define sProgressOneDoc 1040
+#define sProgressMoreDocs 1041
+#define sProgressMoreTemplates 1042
+#define sNoDirCreation 1050
+#define sMsgDirNotThere 1051
+#define sQueryfornewCreation 1052
+#define sFileExists 1053
+#define sMorePathsError3 1054
+#define sConvertError1 1055
+#define sConvertError2 1056
+#define sRTErrorDesc 1057
+#define sRTErrorHeader 1058
+#define sPathErrorTemplates_1_ 1059
+#define sPathErrorTemplates_2_ 1060
+#define sPathErrorTemplates_3_ 1061
+#define sPathErrorDocument_1_ 1062
+#define sPathErrorDocument_2_ 1063
+#define sPathErrorDocument_3_ 1064
+#define sPathErrorStarDoc_1_ 1065
+#define sPathErrorStarDoc_2_ 1066
+#define sPathErrorStarDoc_3_ 1067
+#define sOverwriteallFiles 1070
+#define sreeditMacro 1071
+#define scouldNotsaveDocument 1072
+#define scouldNotopenDocument 1073
+#define sPathDialogMessage 1080
+#define sDialogTitle 1081
+#define sProgressPage1 1090
+#define sProgressPage2 1091
+#define sProgressPage3 1092
+#define sProgressFound 1093
+#define sProgressPage5 1094
+#define sReady 1100
+#define sXMLTemplateCheckbox_1_ 2009
+#define sXMLTemplateCheckbox_2_ 2010
+#define sXMLTemplateCheckbox_3_ 2011
+#define sXMLTemplateCheckbox_4_ 2012
+#define sXMLDocumentCheckbox_1_ 2013
+#define sXMLDocumentCheckbox_2_ 2014
+#define sXMLDocumentCheckbox_3_ 2015
+#define sXMLDocumentCheckbox_4_ 2016
+#define sXMLHelperApplications_1 2017
+#define sXMLHelperApplications_2 2018
+
+#define sSourceDocuments 2030
+#define sTargetDocuments 2031
+#define sCreateLogfile 2032
+#define sLogfileHelpText 2033
+#define sLogfileSummary 2034
+#define sshowLogfile 2035
+
+#define sSumInclusiveSubDir 3000
+#define sSumSaveDokumente 3001
+
+#define sSumSOTextDocuments 3100
+#define sSumSOTableDocuments 3101
+#define sSumSODrawDocuments 3102
+#define sSumSOMathDocuments 3103
+
+#define sSumSOTextTemplates 3110
+#define sSumSOTableTemplates 3111
+#define sSumSODrawTemplates 3112
+#define sSumSOGlobalDocuments 3113
+
+#define sSumMSTextDocuments 3200
+#define sSumMSTableDocuments 3201
+#define sSumMSDrawDocuments 3202
+
+#define sSumMSTextTemplates 3210
+#define sSumMSTableTemplates 3211
+#define sSumMSDrawTemplates 3212
+
+
+// --------------------------------------------------------------------
+String sHelpButton
+{
+ Text [ en-US ] = "~Help";
+};
+
+String sCancelButton
+{
+ Text [ en-US ] = "~Cancel";
+};
+
+String sBackButton
+{
+ Text [ en-US ] = "<< ~Back";
+};
+
+String sNextButton
+{
+ Text [ en-US ] = "Ne~xt >>";
+};
+
+String sBeginButton
+{
+ Text [ en-US ] = "~Convert";
+};
+
+String sCloseButton
+{
+ Text [ en-US ] = "~Close";
+};
+
+String sWelcometextLabel1
+{
+ Text [ en-US ] = "This wizard converts documents in %PRODUCTNAME format and Microsoft Office documents to the new OpenDocument format.";
+};
+
+String sWelcometextLabel2
+{
+ Text [ en-US ] = "Please note that when converting Microsoft documents any attached VBA macros lose their functionality.";
+};
+
+String sWelcometextLabel3
+{
+ Text [ en-US ] = "Select the document type for conversion:";
+};
+
+
+
+String sMSTemplateCheckbox_1_
+{
+ Text [ en-US ] = "Word templates";
+};
+
+String sMSTemplateCheckbox_2_
+{
+ Text [ en-US ] = "Excel templates";
+};
+
+String sMSTemplateCheckbox_3_
+{
+ Text [ en-US ] = "PowerPoint templates";
+};
+
+String sMSDocumentCheckbox_1_
+{
+ Text [ en-US ] = "Word documents";
+};
+
+String sMSDocumentCheckbox_2_
+{
+ Text [ en-US ] = "Excel documents";
+};
+
+String sMSDocumentCheckbox_3_
+{
+ Text [ en-US ] = "PowerPoint documents";
+};
+
+
+String sSearchInSubDir
+{
+ Text [ en-US ] = "Including subdirectories";
+};
+
+
+
+String sMSContainerName
+{
+ Text [ en-US ] = "Microsoft Office";
+};
+
+
+
+String sSummaryHeader
+{
+ Text [ en-US ] = "Summary:";
+};
+
+String sTextImportLabel
+{
+ Text [ en-US ] = "Import from:";
+};
+
+
+String sTextExportLabel
+{
+ Text [ en-US ] = "Save to:";
+};
+
+
+String sGroupnameDefault
+{
+ Text [ en-US ] = "Imported_Templates";
+};
+
+
+String sProgressDesc1
+{
+ Text [ en-US ] = "Progress: ";
+};
+
+String sProgressOneDoc
+{
+ Text [ en-US ] = "Document";
+};
+
+String sProgressMoreDocs
+{
+ Text [ en-US ] = "Documents";
+};
+
+
+String sProgressMoreTemplates
+{
+ Text [ en-US ] = "Templates";
+};
+
+
+String sNoDirCreation
+{
+ Text [ en-US ] = "The '%1' directory cannot be created: ";
+};
+
+
+String sMsgDirNotThere
+{
+ Text [ en-US ] = "The '%1' directory does not exist.";
+};
+
+
+String sQueryfornewCreation
+{
+ Text [ en-US ] = "Do you want to create it now?";
+};
+
+
+String sFileExists
+{
+ Text [ en-US ] = "The '<1>' file already exists.<CR>Do you want to overwrite it?";
+};
+
+String sMorePathsError3
+{
+ Text [ en-US ] = "Directories do not exist";
+};
+
+
+String sOverwriteallFiles
+{
+ Text [ en-US ] = "Do you want to overwrite documents without being asked?";
+};
+
+
+String sreeditMacro
+{
+ Text [ en-US ] = "Document macro has to be revised.";
+};
+
+String scouldNotsaveDocument
+{
+ Text [ en-US ] = "Document '<1>' could not be saved.";
+};
+
+
+String scouldNotopenDocument
+{
+ Text [ en-US ] = "Document '<1>' could not be opened.";
+};
+
+
+
+String sConvertError1
+{
+ Text [ en-US ] = "Do you really want to terminate conversion at this point?";
+};
+
+String sConvertError2
+{
+ Text [ en-US ] = "Cancel Wizard";
+};
+
+String sRTErrorDesc
+{
+ Text [ en-US ] = "An unexpected error has occurred in the wizard.";
+};
+
+String sRTErrorHeader
+{
+ Text [ en-US ] = "Error";
+};
+
+
+String sPathDialogMessage
+{
+ Text [ en-US ] = "Select a directory";
+};
+
+String sDialogTitle
+{
+ Text [ en-US ] = "Document Converter";
+};
+
+String sProgressPage1
+{
+ Text [ en-US ] = "Progress";
+};
+
+String sProgressPage2
+{
+ Text [ en-US ] = "Retrieving the relevant documents:";
+};
+
+String sProgressPage3
+{
+ Text [ en-US ] = "Converting the documents";
+};
+
+
+String sProgressFound
+{
+ Text [ en-US ] = "Found:";
+};
+
+
+String sProgressPage5
+{
+ Text [ en-US ] = "%1 found";
+};
+
+String sReady
+{
+ Text [ en-US ] = "Finished";
+};
+
+
+String sXMLTemplateCheckbox_1_
+{
+ Text [ en-US ] = "Text templates";
+};
+
+String sXMLTemplateCheckbox_2_
+{
+ Text [ en-US ] = "Spreadsheet templates";
+};
+
+String sXMLTemplateCheckbox_3_
+{
+ Text [ en-US ] = "Drawing/presentation templates";
+};
+
+String sXMLTemplateCheckbox_4_
+{
+ Text [ en-US ] = "Master documents";
+};
+
+
+String sXMLDocumentCheckbox_1_
+{
+ Text [ en-US ] = "Text documents";
+};
+
+String sXMLDocumentCheckbox_2_
+{
+ Text [ en-US ] = "Spreadsheets";
+};
+
+String sXMLDocumentCheckbox_3_
+{
+ Text [ en-US ] = "Drawing/presentation documents";
+};
+
+
+String sXMLDocumentCheckbox_4_
+{
+ Text [ en-US ] = "Master documents/formulas";
+};
+
+String sXMLHelperApplications_1
+{
+ Text [ en-US ] = "Master documents";
+};
+
+String sXMLHelperApplications_2
+{
+ Text [ en-US ] = "Formulas";
+};
+
+
+String sSourceDocuments
+{
+ Text [ en-US ] = "Source documents";
+};
+
+
+String sTargetDocuments
+{
+ Text [ en-US ] = "Target documents";
+};
+
+String sCreateLogfile
+{
+ Text [ en-US ] = "Create log file";
+};
+
+
+String sLogfileSummary
+{
+ Text [ en-US ] = "<COUNT> documents converted";
+};
+
+
+
+String sLogfileHelpText
+{
+ Text [ en-US ] = "A log file will be created in your work directory";
+};
+
+
+String sshowLogfile
+{
+ Text [ en-US ] = "Show log file";
+};
+
+
+String sSumInclusiveSubDir
+{
+ Text [ en-US ] = "All subdirectories will be taken into account";
+};
+
+String sSumSaveDokumente
+{
+ Text [ en-US ] = "These will be exported to the following directory:";
+};
+
+
+String sSumSOTextDocuments
+{
+ Text [ en-US ] = "All %PRODUCTNAME text documents contained in the following directory will be imported:";
+};
+
+
+String sSumSOTableDocuments
+{
+ Text [ en-US ] = "All %PRODUCTNAME spreadsheets contained in the following directory will be imported:";
+};
+
+
+String sSumSODrawDocuments
+{
+ Text [ en-US ] = "All %PRODUCTNAME drawing and presentation documents contained in the following directory will be imported:";
+};
+
+
+String sSumSOMathDocuments
+{
+ Text [ en-US ] = "All %PRODUCTNAME formula documents contained in the following directory will be imported:";
+};
+
+
+String sSumSOTextTemplates
+{
+ Text [ en-US ] = "All %PRODUCTNAME text templates contained in the following directory will be imported:";
+};
+
+
+String sSumSOTableTemplates
+{
+ Text [ en-US ] = "All %PRODUCTNAME table templates contained in the following directory will be imported:";
+};
+
+
+String sSumSODrawTemplates
+{
+ Text [ en-US ] = "All %PRODUCTNAME drawing and presentation templates contained in the following directory will be imported:";
+};
+
+String sSumSOGlobalDocuments
+{
+ Text [ en-US ] = "All %PRODUCTNAME master documents contained in the following directory will be imported:";
+};
+
+
+String sSumMSTextDocuments
+{
+ Text [ en-US ] = "All Word documents contained in the following directory will be imported:";
+};
+
+
+String sSumMSTableDocuments
+{
+ Text [ en-US ] = "All Excel documents contained in the following directory will be imported:";
+};
+
+
+String sSumMSDrawDocuments
+{
+ Text [ en-US ] = "All PowerPoint documents contained in the following directory will be imported:";
+};
+
+
+String sSumMSTextTemplates
+{
+ Text [ en-US ] = "All Word templates contained in the following directory will be imported:";
+};
+
+
+String sSumMSTableTemplates
+{
+ Text [ en-US ] = "All Excel templates contained in the following directory will be imported:";
+};
+
+
+String sSumMSDrawTemplates
+{
+ Text [ en-US ] = "All PowerPoint templates contained in the following directory will be imported:";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/wizards/source/importwizard/makefile.mk b/wizards/source/importwizard/makefile.mk
new file mode 100644
index 000000000000..5c7ef4ce916a
--- /dev/null
+++ b/wizards/source/importwizard/makefile.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=importwizardall
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+#
+# testresource.
+#
+SRS2NAME = importwi
+SRC2FILES= importwi.src
+RESLIB2SRSFILES= $(SRS)$/importwi.srs
+RESLIB2NAME= imp
+
+ZIP1TARGET = $(IMPORTWIZARD_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/importwizard/script.xlb b/wizards/source/importwizard/script.xlb
new file mode 100644
index 000000000000..2d10f65cba30
--- /dev/null
+++ b/wizards/source/importwizard/script.xlb
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="ImportWizard" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="Main"/>
+ <library:element library:name="DialogModul"/>
+ <library:element library:name="Language"/>
+ <library:element library:name="FilesModul"/>
+ <library:element library:name="API"/>
+</library:library>
diff --git a/wizards/source/launcher/DicOOo.xba b/wizards/source/launcher/DicOOo.xba
new file mode 100644
index 000000000000..474494e718c9
--- /dev/null
+++ b/wizards/source/launcher/DicOOo.xba
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DicOOo" script:language="StarBasic">Option Explicit
+
+Sub StartDicOOo
+
+Dim ThePath as string
+Dim DefPath as string
+Dim aService as object
+Dim MyDicOOo as string
+dim TheDoc as object
+dim args(1) as new com.sun.star.beans.PropertyValue
+
+on error resume next
+
+&apos; Find path
+aService = CreateUnoService(&quot;com.sun.star.util.PathSubstitution&quot;)
+ThePath =ConvertToURL(aService.substituteVariables(&quot;$(user)&quot;, true))
+ThePath=ThePath &amp; &quot;/wordbook&quot;
+DefPath =ConvertToURL(aService.substituteVariables(&quot;$(prog)&quot;, true))
+DefPath=DefPath &amp; &quot;/../share/dict/ooo&quot;
+
+MyDicOOo=&quot;&quot;
+
+if fileExists(ThePath &amp; &quot;/DicOOo.lst&quot;) then
+ &apos;read DicOOo.lst file in user directory
+ Open ThePath &amp; &quot;/DicOOo.lst&quot; for input as #1
+ line input #1, MyDicOOo
+ close #1
+else
+ if fileExists(DefPath &amp; &quot;/DicOOo.lst&quot;) then
+ &apos;read DicOOo.lst file in share directory
+ Open DefPath &amp; &quot;/DicOOo.lst&quot; for input as #1
+ line input #1, MyDicOOo
+ close #1
+ else
+ &apos;creates default file in user directory
+ Open ThePath &amp; &quot;/DicOOo.lst&quot; for output as #1
+ print #1,convertFromURL(DefPath &amp; &quot;/DicOOo.sxw&quot;)
+ close #1
+ endif
+endif
+
+&apos;security
+if Not fileExists(MyDicOOo) then
+ MyDicOOo= DefPath &amp; &quot;/DicOOo.sxw&quot;
+endif
+
+MyDicOOo=ConvertToURL(MyDicOOo)
+
+&apos;Opens DicOOo main file
+args(0).name=&quot;InteractionHandler&quot;
+args(0).value=&quot;&quot;
+args(1).name=&quot;MacroExecutionMode&quot;
+args(1).value=com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN &apos;4
+TheDoc=StarDesktop.loadComponentFromURL(MyDicOOo,&quot;_blank&quot;,0,args())
+
+End Sub
+</script:module>
diff --git a/wizards/source/launcher/delzip b/wizards/source/launcher/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/launcher/delzip
diff --git a/wizards/source/launcher/dialog.xlb b/wizards/source/launcher/dialog.xlb
new file mode 100644
index 000000000000..a4c6d756ca75
--- /dev/null
+++ b/wizards/source/launcher/dialog.xlb
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Launcher" library:readonly="true" library:passwordprotected="false"/>
diff --git a/wizards/source/launcher/makefile.mk b/wizards/source/launcher/makefile.mk
new file mode 100644
index 000000000000..4bd474242f4b
--- /dev/null
+++ b/wizards/source/launcher/makefile.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=launcher
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+ZIP1TARGET = $(LAUNCHER_ALL_TARGET)
+XBAFILES = DicOOo.xba
+ZIP1LIST = *.xdl $(XBAFILES) *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/launcher/script.xlb b/wizards/source/launcher/script.xlb
new file mode 100644
index 000000000000..55310d9fb286
--- /dev/null
+++ b/wizards/source/launcher/script.xlb
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Launcher" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="DicOOo"/>
+</library:library>
diff --git a/wizards/source/schedule/BankHoliday.xba b/wizards/source/schedule/BankHoliday.xba
new file mode 100644
index 000000000000..e9af180aa32e
--- /dev/null
+++ b/wizards/source/schedule/BankHoliday.xba
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="BankHoliday" script:language="StarBasic">Option Explicit
+
+Sub Main()
+ Call CalAutopilotTable()
+End Sub
+
+
+Function CalEasterTable&amp;(byval Year%)
+Dim B%,C%,D%,E%,F%,G%,H%,I%,K%,L%,M%,N%,O%, nMonth%, nDay%
+ N = Year% mod 19
+ B = int(Year% / 100)
+ C = Year% mod 100
+ D = int(B / 4)
+ E = B mod 4
+ F = int((B + 8) / 25)
+ G = int((B - F + 1) / 3)
+ H =(19 * N + B - D - G + 15) mod 30
+ I = int(C / 4)
+ K = C mod 4
+ L =(32 + 2 * E + 2 * I - H - K) mod 7
+ M = int((N + 11 * H + 22 * L) / 451)
+ O = H + L - 7 * M + 114
+ nDay = O mod 31 + 1
+ nMonth = int(O / 31)
+ CalEasterTable&amp; = DateSerial(Year, nMonth,nDay)
+End Function
+
+
+&apos; Note: the following algorithm is valid only till the Year 2100.
+&apos; but I have no Idea from which date in the paste it is valid
+Function CalOrthodoxEasterTable(ByVal iYear as Integer) as Long
+Dim R1%, R2%, R3%, RA%, R4%, RB%, R5%, RC%
+Dim lDate as Long
+ R1 = iYear mod 19
+ R2 = iYear mod 4
+ R3 = iYear mod 7
+ RA =19 * R1 + 16
+ R4 = RA mod 30
+ RB = 2 * R2 + 4 * R3 + 6 * R4
+ R5 = RB mod 7
+ RC = R4 + R5
+ lDate = DateSerial(iYear, 4,4)
+ CalOrthodoxEasterTable() = lDate + RC
+End Function
+
+
+Sub CalInitGlobalVariablesDate()
+Dim i as Integer
+ For i = 1 To 374
+ CalBankholidayName$(i) = &quot;&quot;
+ CalTypeOfBankHoliday%(i) = cHolidayType_None
+ Next
+End Sub
+
+
+Sub CalInsertBankholiday(byval CurDate as Long, byval EventName as String, ByVal iLevel as Integer)
+Dim iDay
+ iDay =(Month(CurDate)-1)*31 +Day(CurDate)
+
+ If 0 &lt;&gt; CalTypeOfBankHoliday(iDay) Then
+ If iLevel &lt; CalTypeOfBankHoliday(iDay) Then
+ CalTypeOfBankHoliday(iDay) = iLevel
+ End If
+ Else
+ CalTypeOfBankHoliday(iDay) = iLevel
+ End If
+
+ If CalBankHolidayName(iDay) = &quot;&quot; Then
+ CalBankHolidayName(iDay) = EventName
+ Else
+ CalBankHolidayName(iDay) = CalBankHolidayName(iDay) &amp; &quot; / &quot; &amp; EventName
+ End If
+End Sub
+
+Function CalMaxDayInMonth(ByVal iYear as Integer, ByVal iMonth as Integer) as Integer
+&apos; delivers the maximum Day of a month in a certain year
+ Dim TmpDate as Long
+ Dim MaxDay as Long
+
+ MaxDay = 28
+ TmpDate = DateSerial(iYear, iMonth, MaxDay)
+
+ While Month(TmpDate) = iMonth
+ MaxDay = MaxDay + 1
+ TmpDate = TmpDate + 1
+ Wend
+ Maxday = MaxDay - 1
+ CalMaxDayInMonth() = MaxDay
+End Function
+
+
+Function CalGetIntOfShortMonthName(ByVal MonthName as String) as Integer
+Dim i as Integer
+Dim nMonth as Integer
+
+ nMonth = Val(MonthName)
+
+ If (1 &lt;= nMonth And 12 &gt;= nMonth) Then
+ CalGetIntOfShortMonthName = nMonth
+ Exit Function
+ End If
+
+ MonthName = UCase(Trim(Left(MonthName, 3)))
+
+ For i = 0 To 11
+ If (UCase(cCalShortMonthNames(i)) = MonthName) Then
+ CalGetIntOfShortMonthName = i+1
+ Exit Function
+ End If
+ Next
+
+ &apos; Not Found
+ CalGetIntOfShortMonthName = 0
+End Function
+
+
+Sub CalInsertOwnDataInTables(ByVal iSelYear as Integer)
+ &apos; inserts the individual data from the table into the previously unsorted list
+Dim CurEventName as String
+Dim CurEvMonth as Integer
+Dim CurEvDay as Integer
+Dim LastIndex as Integer
+Dim i as Integer
+Dim DateStr as String
+ LastIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
+ For i = 0 To LastIndex
+ If GetSelectedDateUnits(CurEvDay, CurEvMonth, i) &lt;&gt; SBDATEUNDEFINED Then
+ CurEventName = CalGetNameOfEvent(i)
+ CalInsertBankholiday(DateSerial(iSelYear, CurEvMonth, CurEvDay), CurEventName, cHolidayType_Own)
+ End If
+ Next
+End Sub
+
+
+&apos; Finds eg the first,second Monday in a month
+&apos; Note: in This Function the week starts with the Sunday
+Function GetMonthDate(YearInt as Integer, iMonth as Integer, iWeekDay as Integer, iOffset as Integer)
+Dim bFound as Boolean
+Dim lDate as Long
+ &apos; 1st Tue in Nov : Election Day, Half
+ bFound = False
+ lDate = DateSerial(YearInt, iMonth, 1)
+ Do
+ If iWeekDay = WeekDay(lDate) Then
+ bFound = True
+ Else
+ lDate = lDate + 1
+ End If
+ Loop Until bFound
+ GetMonthDate = lDate + iOffset
+End Function
+
+
+&apos; Finds the next weekday after a fixed date
+&apos; e.g. Midsummerfeast in Sweden: next Saturday after 20th June
+Function GetNextWeekDay(iYear as Integer, iMonth as Integer, iDay as Integer, iWeekDay as Integer)
+Dim lDate as Long
+Dim iCurWeekDay as Integer
+ lDate = DateSerial(iYear, iMonth, iDay)
+ iCurWeekDay = WeekDay(lDate)
+ While iCurWeekDay &lt;&gt; iWeekDay
+ lDate = lDate + 1
+ iCurWeekDay = WeekDay(lDate)
+ Wend
+ GetNextWeekDay() = lDate
+End Function
+
+
+Sub AddFollowUpHolidays(ByVal lStartDate as Long, iCount as Integer, HolidayName as String, iType as Integer)
+Dim lDate as Long
+ For lDate = lStartDate + 1 To lStartDate + 4
+ CalInsertBankholiday(lDate, HolidayName, iType)
+ Next lDate
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/CalendarMain.xba b/wizards/source/schedule/CalendarMain.xba
new file mode 100644
index 000000000000..bfe49121dbd3
--- /dev/null
+++ b/wizards/source/schedule/CalendarMain.xba
@@ -0,0 +1,302 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="CalendarMain" script:language="StarBasic">Option Explicit
+
+Const _DEBUG = 0
+
+&apos; CalenderMain
+Public sCurLangLocale as String
+Public sCurCountryLocale as String
+&apos; This flag serves as a query if the individual Data should be saved
+Public bCalOwnDataChanged as Boolean
+
+&apos;BankHoliday Functions
+Public CalBankholidayName$ (1 To 374)
+Public CalTypeOfBankHoliday% (1 To 374)
+
+Public Const cHolidayType_None = 0
+Public Const cHolidayType_Full = 1
+Public Const cHolidayType_Half = 2
+Public Const cHolidayType_Own = 4
+
+Public cCalSubcmdDeleteSelect_DeleteSelEntry$
+Public cCalSubcmdDeleteSelect_DeleteSelEntryTitle$
+Public cCalSubcmdSwitchOwnDataOrGeneral_Back$
+Public cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
+
+&apos;Language
+Public cCalLongMonthNames(11) as String
+Public cCalShortMonthNames(11) as String
+
+Public sBitmapFilename$
+Public sCalendarTitle$, sMonthTitle$, sWizardTitle$, sError$
+Public cCalStyleWorkday$, cCalStyleWeekend$
+
+Public CalChoosenLand as Integer
+
+Public oDocument as Object
+Public oSheets as Object
+Public oSheet as Object
+Public oStatusLine as Object
+Public bCancelTask as Boolean
+Public oNumberFormatter as Object
+
+&apos; BL* means &quot;BundesLand&quot; (for german states only)
+Public CONST CalBLBayern = 1
+Public CONST CalBLBadenWuert = 2
+Public CONST CalBLBerlin = 3
+Public CONST CalBLBremen = 4
+Public CONST CalBLBrandenburg = 5
+Public CONST CalBLHamburg = 6
+Public CONST CalBLHessen = 7
+Public CONST CalBLMeckPomm = 8
+Public CONST CalBLNiedersachsen = 9
+Public CONST CalBLNordrheinWest = 10
+Public CONST CalBLRheinlandPfalz = 11
+Public CONST CalBLSaarland = 12
+Public CONST CalBLSachsen = 13
+Public CONST CalBLSachsenAnhalt = 14
+Public CONST CalBLSchlHolstein = 15
+Public CONST CalBLThueringen = 16
+
+Public DlgCalendar as Object
+Public DlgCalModel as Object
+Public lDateFormat as Long
+Public lDateStandardFormat as Long
+
+
+
+Sub CalAutopilotTable()
+Dim BitmapDir as String
+Dim iThisMonth as Integer
+
+&apos;On Error Goto ErrorHandler
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ bSelectByMouseMove = True
+ oDocument = ThisComponent
+ oStatusline = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator
+ ToggleWindow(False)
+ sCurLangLocale = oDocument.CharLocale.Language
+ sCurCountryLocale = oDocument.CharLocale.Country
+ DlgCalendar = LoadDialog(&quot;Schedule&quot;, &quot;DlgCalendar&quot;)
+ DlgCalModel = DlgCalendar.Model
+ LoadLanguage(sCurLangLocale)
+ CalInitGlobalVariablesDate()
+ BitmapDir = GetOfficeSubPath(&quot;Template&quot;,&quot;wizard/bitmap&quot;)
+ DlgCalModel.imgCountry.ImageURL = BitmapDir &amp; sBitmapFilename
+ CalChoosenLand = -2
+ CalLoadOwnData()
+
+ With DlgCalModel
+ .cmdDelete.Enabled = False
+ .lstMonth.StringItemList() = cCalShortMonthNames()
+ Select Case sCurLangLocale
+ Case cLANGUAGE_JAPANESE
+ .lstOwnData.FontName = &quot;HG MinochoL&quot;
+ .txtEvent.FontName = &quot;HG MinchoL&quot;
+ Case cLANGUAGE_CHINESE
+ If oDocument.CharLocale.Country = &quot;CN&quot; Then
+ .lstOwnData.FontName = &quot;FZ Song Ti&quot;
+ .txtEvent.FontName = &quot;FZ Song Ti&quot;
+ Else
+ .lstOwnData.FontName = &quot;FZ Ming Ti&quot;
+ .txtEvent.FontName = &quot;FZ Ming Ti&quot;
+ End If
+ Case &quot;ko&quot;
+ .lstOwnData.FontName = &quot;Sun Gulim&quot;
+ .txtEvent.FontName = &quot;Sun Gulim&quot;
+ End Select
+ .lstOwnEventMonth.StringItemList() = cCalShortMonthNames()
+ .optYear.State = 1
+ .txtYear.Value = Year(Now())
+ .txtYear.Tag = .txtYear.Value
+ .Step = 1
+ End With
+ SetupNumberFormatter(sCurLangLocale, sCurCountryLocale)
+ CalChooseCalendar() &apos; month
+ iThisMonth = Month(Now)
+ DlgCalendar.GetControl(&quot;lstMonth&quot;).SelectItemPos(iThisMonth-1, True)
+ DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(0,True)
+ DlgCalModel.cmdGoOn.DefaultButton = True
+ ToggleWindow(True)
+ DlgCalendar.GetControl(&quot;lblHolidays&quot;).Visible = sCurLangLocale = cLANGUAGE_GERMAN
+ DlgCalendar.GetControl(&quot;lstHolidays&quot;).Visible = sCurLangLocale = cLANGUAGE_GERMAN
+ fHeightCorrFactor = DlgCalendar.GetControl(&quot;imgCountry&quot;).Size.Height/198
+ fWidthCorrFactor = DlgCalendar.GetControl(&quot;imgCountry&quot;).Size.Width/166
+ DlgCalendar.Execute()
+ DlgCalendar.Dispose()
+ Exit Sub
+ErrorHandler:
+ MsgBox(sError$, 16, sWizardTitle$)
+End Sub
+
+
+Sub SetupNumberFormatter(sCurLangLocale as String, sCurCountryLocale as String)
+Dim oFormats as Object
+Dim DateFormatString as String
+ oFormats = oDocument.getNumberFormats()
+ Select Case sCurLangLocale
+ Case cLANGUAGE_GERMAN
+ DateFormatString = &quot;TT.MMM&quot;
+ Case cLANGUAGE_ENGLISH
+ DateFormatString = &quot;MMM DD&quot;
+ Case cLANGUAGE_FRENCH
+ DateFormatString = &quot;JJ/MMM&quot;
+ Case cLANGUAGE_ITALIAN
+ DateFormatString = &quot;GG/MMM&quot;
+ Case cLANGUAGE_SPANISH
+ DateFormatString = &quot;DD/MMM&quot;
+ Case cLANGUAGE_PORTUGUESE
+ If sCurCountryLocale = &quot;BR&quot; Then
+ DateFormatString = &quot;DD/MMM&quot;
+ Else
+ DateFormatString = &quot;DD-MMM&quot;
+ End If
+ Case cLANGUAGE_DUTCH
+ DateFormatString = &quot;DD/MMM&quot;
+ Case cLANGUAGE_SWEDISH
+ DateFormatString = &quot;MMM DD&quot;
+ Case cLANGUAGE_DANISH
+ DateFormatString = &quot;DD-MMM&quot;
+ Case cLANGUAGE_POLISH
+ DateFormatString = &quot;MMM DD&quot;
+ Case cLANGUAGE_RUSSIAN
+ DateFormatString = &quot;MMM DD&quot;
+ Case cLANGUAGE_JAPANESE
+ DateFormatString = &quot;M月D日&quot;
+ Case cLANGUAGE_CHINESE
+ If sCurCountryLocale = &quot;TW&quot; Then
+ DateFormatString = &quot;MMMMD&quot; &amp;&quot;&quot;&quot;&quot; &amp; &quot;日&quot; &amp; &quot;&quot;&quot;&quot;
+ Else
+ DateFormatString = &quot;M&quot; &amp; &quot;&quot;&quot;&quot; &amp; &quot;月&quot; &amp; &quot;&quot;&quot;&quot; &amp; &quot;D&quot; &amp;&quot;&quot;&quot;&quot; &amp; &quot;日&quot; &amp; &quot;&quot;&quot;&quot;
+ End If
+ Case cLANGUAGE_GREEK
+ DateFormatString = &quot;DD/MMM&quot;
+ Case cLANGUAGE_TURKISH
+ DateFormatString = &quot;DD/MMM&quot;
+ Case cLANGUAGE_POLISH
+ DateFormatString = &quot;MMM DD&quot;
+ Case cLANGUAGE_FINNISH
+ DateFormatString = &quot;PP.KKK&quot;
+ End Select
+
+ lDateFormat = AddNumberFormat(oFormats, DateFormatString, oDocument.CharLocale)
+ lDateStandardFormat = oFormats.getStandardFormat(com.sun.star.util.NumberFormat.DATE, oDocument.CharLocale)
+
+&apos; lDateStandardFormat = AddNumberFormat(oFormats, StandardDateFormatString, oDocument.CharLocale)
+ oNumberFormatter = createUNOService(&quot;com.sun.star.util.NumberFormatter&quot;)
+ oNumberFormatter.attachNumberFormatsSupplier(oDocument)
+End Sub
+
+
+Function AddNumberFormat(oNumberFormats as Object, FormatString as String, oLocale as Object) as Long
+Dim lLocDateFormat as Long
+ lLocDateFormat = oNumberFormats.QueryKey(FormatString, oLocale, True)
+ If lLocDateFormat = -1 Then
+ lLocDateFormat = oNumberFormats.addNew(FormatString, oLocale)
+ End If
+ AddNumberFormat() = lLocDateFormat
+End Function
+
+
+Sub CalChooseCalendar()
+ With DlgCalModel
+ .lstMonth.Enabled = .optMonth.State = 1
+ .lblMonth.Enabled = .optMonth.State = 1
+ End With
+End Sub
+
+
+Sub CalcmdCancel()
+ Call CalSaveOwnData()
+ DlgCalendar.EndExecute
+End Sub
+
+
+Sub CalcmdOk()
+ &apos; cmdOk is called when the Button &apos;Read&apos; is clicked on
+ &apos; It is either given out a month or a year
+Dim i, iSelYear as Integer
+Dim SelYear as String
+&apos; DlgCalendar.Visible = False
+
+ oSheets = oDocument.sheets
+ Call CalSaveOwnData()
+ UnprotectSheets(oSheets)
+ oSheets.RemovebyName(oSheets.GetbyIndex(0).Name)
+ iSelYear = DlgCalModel.txtYear.Value
+ Select Case sCurLangLocale
+ Case cLANGUAGE_GERMAN
+ If Ubound(DlgCalModel.lstHolidays.SelectedItems()) &gt; -1 Then
+ CalChoosenLand = DlgCalModel.lstHolidays.SelectedItems(0)
+ Else
+ CalChoosenLand = 0
+ End If
+ Call CalFindWholeYearHolidays_GERMANY(iSelYear, CalChoosenLand)
+ Case cLANGUAGE_ENGLISH
+ Call FindWholeYearHolidays_US(iSelYear)
+ Case cLANGUAGE_FRENCH
+ Call FindWholeYearHolidays_FRANCE(iSelYear)
+ Case cLANGUAGE_ITALIAN
+ Call FindWholeYearHolidays_ITA(iSelYear)
+ Case cLANGUAGE_SPANISH
+ Call FindWholeYearHolidays_SPAIN(iSelYear)
+ Case cLANGUAGE_PORTUGUESE
+ Call FindWholeYearHolidays_PORT(iSelYear)
+ Case cLANGUAGE_DUTCH
+ Call FindWholeYearHolidays_NL(iSelYear)
+ Case cLANGUAGE_SWEDISH
+ Call FindWholeYearHolidays_SWED(iSelYear)
+ Case cLANGUAGE_DANISH
+ Call FindWholeYearHolidays_DK(iSelYear)
+ Case cLANGUAGE_POLISH
+ Call FindWholeYearHolidays_PL(iSelYear)
+ Case cLANGUAGE_RUSSIAN
+ Call FindWholeYearHolidays_RU(iSelYear)
+ Case cLANGUAGE_JAPANESE
+ Call FindWholeYearHolidays_JP(iSelYear)
+ Case cLANGUAGE_CHINESE
+ If sCurCountryLocale = &quot;TW&quot; Then
+ Call FindWholeYearHolidays_TW(iSelYear)
+ Else
+ Call FindWholeYearHolidays_CN(iSelYear)
+ End If
+ Case cLANGUAGE_GREEK
+ Call FindWholeYearHolidays_GREEK(iSelYear)
+ Case cLANGUAGE_TURKISH
+ Call FindWholeYearHolidays_TRK(iSelYear)
+ Case cLANGUAGE_POLISH
+ Call FindWholeYearHolidays_PL(iSelYear)
+ Case cLANGUAGE_FINNISH
+ Call FindWholeYearHolidays_FI(iSelYear)
+ End Select
+
+ Call CalInsertOwnDataInTables(iSelYear)
+
+ If DlgCalModel.optYear.State = 1 Then
+ oSheets.RemovebyName(oSheets.GetbyIndex(0).Name)
+ oSheet = oSheets.GetbyIndex(0)
+ oSheet.Name = sCalendarTitle$ + &quot; &quot; + iSelYear
+ oDocument.AddActionLock
+ Call CalCreateYearTable(iSelYear)
+ ElseIf DlgCalModel.optMonth.State = 1 Then
+ Dim iMonth
+ iMonth = DlgCalModel.lstMonth.SelectedItems(0) + 1
+ oSheets.RemovebyName(oSheets.GetbyIndex(1).Name)
+ oSheet = oSheets.GetbyIndex(0)
+ If sMonthTitle = &quot;&quot; Then
+ oSheet.Name = cCalLongMonthNames(iMonth-1)
+ Else
+ oSheet.Name = sMonthTitle + &quot; &quot; + cCalLongMonthNames(iMonth-1)
+ End If
+ oDocument.AddActionLock
+ Call CalCreateMonthTable(iSelYear, iMonth)
+ End If
+
+ oDocument.RemoveActionLock
+ oSheet.protect(&quot;&quot;)
+ oStatusLine.End
+ DlgCalendar.EndExecute()
+ bCancelTask = True
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/CreateTable.xba b/wizards/source/schedule/CreateTable.xba
new file mode 100644
index 000000000000..6d472a84bca4
--- /dev/null
+++ b/wizards/source/schedule/CreateTable.xba
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="CreateTable" script:language="StarBasic">Option Explicit
+
+Public Const FirstDayRow = 5 &apos; Row on month sheet for first day of month
+Public Const DateColumn% = 3 &apos; Column on month sheet with days
+Public Const NewYearRow = 4 &apos; Row on year sheet for January 1st
+Public Const NewYearColumn = 2 &apos; Column on year sheet for January 1st
+
+
+Sub CalCreateYearTable(ByVal iSelYear as Integer)
+&apos; Completes the overview for whole year
+
+&apos; Needed by StarOffice Calc and StarOffice Schedule
+Dim CalDay as Integer
+Dim CalMonth as Integer
+Dim i as Integer
+Dim s as Integer
+Dim oYearCell as object
+Dim iDate
+Dim ColPos, RowPos as Integer
+Dim oNameCell, oDateCell as Object
+Dim iCellValue as Long
+Dim oRangeFebCell, oCellAddress, oFebcell as Object
+Dim oRangeBlank as Object
+Dim sBlankStyle as String
+&apos; On Error Goto ErrorHandling
+ oStatusLine.Start(&quot;&quot;,140) &apos;GetResText(sProgress)
+ iDate = DateSerial(iSelYear,1,1)
+ oYearCell = oSheet.GetCellRangeByName(&quot;Year&quot;)
+ oYearCell.Value = iSelYear
+
+ CalMonth = 1
+ CalDay = 0
+ s = 10
+ oStatusLine.SetValue(s)
+ For i = 1 To 374
+ CalDay = CalDay+1
+ If CalDay = 32 Then
+ CalDay = 1
+ CalMonth = CalMonth+1
+ s = s + 10
+ oStatusLine.SetValue(s)
+ End If
+ ColPos = NewYearColumn+(2*CalMonth)
+ RowPos = NewYearRow + CalDay
+ FormatCalCells(ColPos,RowPos,i)
+ Next
+ If NOT CalIsLeapYear(iSelYear) Then
+ &apos; Delete 29th February if necessary
+ oRangeFebCell = oSheet.GetCellRangeByName(&quot;Feb29&quot;)
+ oCellAddress = oRangeFebCell.RangeAddress
+ oFebCell = oSheet.GetCellByPosition(oCellAddress.StartColumn,oCellAddress.StartRow)
+ oFebCell.String = &quot;&quot;
+ &apos; Change the CellStyle according to the Range &quot;Blank&quot;
+ oRangeBlank = oSheet.GetCellRangebyName(&quot;Blank&quot;)
+ sBlankStyle = oRangeBlank.CellStyle
+ oRangeFebCell.CellStyle = sBlankStyle
+ End If
+ oStatusLine.SetValue(150)
+ ErrorHandling:
+ If Err &lt;&gt; 0 Then
+ MsgBox sError$, 16, sWizardTitle$
+ End If
+End Sub
+
+
+
+Sub CalCreateMonthTable(ByVal iSelYear as Integer, iSelMonth as Integer)
+Dim oMonthCell, oDateCell as Object
+Dim iDate as Date
+Dim oAddress
+Dim i, s as Integer
+Dim iStartDay as Integer
+
+&apos; Completes the monthly calendar
+&apos;On Error Goto ErrorHandling
+ oStatusLine.Start(&quot;&quot;,40) &apos;GetResText(sProgess)
+ &apos; Set month
+ oMonthCell = oSheet.GetCellRangeByName(&quot;Month&quot;)
+
+ iDate = DateSerial(iSelYear,iSelMonth,1)
+ oMonthCell.Value = iDate
+ &apos; Inserting holidays
+ iStartDay = (iSelMonth - 1) * 31 + 1
+ s = 5
+ For i = iStartDay To iStartDay + 30
+ oStatusLine.SetValue(s)
+ s = s + 1
+ FormatCalCells(DateColumn+1,FirstDayRow + i - iStartDay,i)
+ Next
+ oDateCell = oSheet.GetCellbyPosition(DateColumn,FirstDayRow+i-iStartDay - 1)
+ oAddress = oDateCell.RangeAddress
+
+ Select Case iSelMonth
+ Case 2,4,6,9,11
+ oSheet.RemoveRange(oAddress, com.sun.star.sheet.CellDeleteMode.ROWS)
+ If iSelMonth = 2 Then
+ oAddress.StartRow = oAddress.StartRow - 1
+ oAddress.EndRow = oAddress.StartRow
+ oSheet.RemoveRange(oAddress, com.sun.star.sheet.CellDeleteMode.ROWS)
+ If Not CalIsLeapYear(iSelYear) Then
+ oAddress.StartRow = oAddress.StartRow - 1
+ oAddress.EndRow = oAddress.StartRow
+ oSheet.RemoveRange(oAddress, com.sun.star.sheet.CellDeleteMode.ROWS)
+ End If
+ End If
+ End Select
+ oStatusLine.SetValue(45)
+ErrorHandling:
+ If Err &lt;&gt; 0 Then
+ MsgBox sError$, 16, sWizardTitle$
+ End If
+End Sub
+
+
+
+Sub FormatCalCells(ColPos,RowPos,i as Integer)
+Dim oNameCell, oDateCell as Object
+Dim iCellValue as Long
+ oDateCell = oSheet.GetCellbyPosition(ColPos-1,RowPos)
+ If oDateCell.Value &lt;&gt; 0 Then
+ iCellValue = oDateCell.Value
+ oDateCell.Value = iCellValue
+ If CalBankHolidayName$(i) &lt;&gt; &quot;&quot; Then
+ oNameCell = oSheet.GetCellbyPosition(ColPos,RowPos)
+ oNameCell.String = CalBankHolidayName$(i)
+ If CalTypeOfBankHoliday%(i) = cHolidayType_Full Then
+ oDateCell.CellStyle = cCalStyleWeekend$
+ End If
+ End If
+ End If
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/DlgCalendar.xdl b/wizards/source/schedule/DlgCalendar.xdl
new file mode 100644
index 000000000000..7f1b68d895e7
--- /dev/null
+++ b/wizards/source/schedule/DlgCalendar.xdl
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Dialog1" dlg:left="160" dlg:top="81" dlg:width="208" dlg:height="156" dlg:page="1" dlg:help-url="HID:34700" dlg:closeable="true" dlg:moveable="true">
+ <dlg:styles>
+ <dlg:style dlg:style-id="0" dlg:border="none"/>
+ <dlg:style dlg:style-id="1" dlg:font-name="Cumberland" dlg:font-stylename="Standard" dlg:font-family="modern" dlg:font-charset="ansi"/>
+ <dlg:style dlg:style-id="2" dlg:font-name="Cumberland" dlg:font-stylename="Standard" dlg:font-family="modern" dlg:font-charset="ansi"/>
+ </dlg:styles>
+ <dlg:bulletinboard>
+ <dlg:menulist dlg:id="lstHolidays" dlg:tab-index="0" dlg:left="6" dlg:top="17" dlg:width="95" dlg:height="12" dlg:page="1" dlg:help-url="HID:34708" dlg:spin="true"/>
+ <dlg:fixedline dlg:id="hlnCalendar" dlg:tab-index="1" dlg:left="6" dlg:top="36" dlg:width="95" dlg:height="8" dlg:page="1" dlg:value="hlnCalendar"/>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optYear" dlg:tab-index="2" dlg:left="12" dlg:top="47" dlg:width="81" dlg:height="10" dlg:page="1" dlg:help-url="HID:34702" dlg:value="optYear">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.CalendarMain.CalChooseCalendar?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optMonth" dlg:tab-index="3" dlg:left="12" dlg:top="61" dlg:width="81" dlg:height="10" dlg:page="1" dlg:help-url="HID:34703" dlg:value="optMonth">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.CalendarMain.CalChooseCalendar?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:text dlg:id="lblHolidays" dlg:tab-index="4" dlg:left="6" dlg:top="6" dlg:width="96" dlg:height="8" dlg:page="1" dlg:value="lblHolidays"/>
+ <dlg:img dlg:style-id="0" dlg:id="imgCountry" dlg:tab-index="5" dlg:left="106" dlg:top="6" dlg:width="95" dlg:height="113" dlg:page="1" dlg:help-url="HID:34701">
+ <script:event script:event-name="on-mousedown" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.SelectState?language=Basic&amp;location=application" script:language="Script"/>
+ <script:event script:event-name="on-mouseout" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.MouseLeavesImage?language=Basic&amp;location=application" script:language="Script"/>
+ <script:event script:event-name="on-mousemove" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.CalMouseMoved?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:img>
+ <dlg:fixedline dlg:id="hlnTime" dlg:tab-index="6" dlg:left="5" dlg:top="78" dlg:width="95" dlg:height="8" dlg:page="1" dlg:value="hlnTime"/>
+ <dlg:menulist dlg:id="lstMonth" dlg:tab-index="7" dlg:left="62" dlg:top="106" dlg:width="38" dlg:height="12" dlg:page="1" dlg:help-url="HID:34705" dlg:spin="true"/>
+ <dlg:text dlg:id="lblYear" dlg:tab-index="8" dlg:left="12" dlg:top="91" dlg:width="46" dlg:height="8" dlg:page="1" dlg:value="lblYear"/>
+ <dlg:text dlg:id="lblMonth" dlg:tab-index="9" dlg:left="12" dlg:top="108" dlg:width="46" dlg:height="8" dlg:page="1" dlg:value="lblMonth"/>
+ <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="10" dlg:left="6" dlg:top="125" dlg:width="196" dlg:height="4"/>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="11" dlg:left="6" dlg:top="136" dlg:width="50" dlg:height="14" dlg:help-url="HID:34721" dlg:value="cmdCancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.CalendarMain.CalcmdCancel?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdOwnData" dlg:tab-index="12" dlg:left="99" dlg:top="136" dlg:width="50" dlg:height="14" dlg:help-url="HID:34720" dlg:value="cmdOwnData">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.CalmdSwitchOwnDataOrGeneral?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdGoOn" dlg:tab-index="13" dlg:left="152" dlg:top="136" dlg:width="50" dlg:height="14" dlg:help-url="HID:34722" dlg:value="cmdGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.CalendarMain.CalcmdOk?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:text dlg:id="lblEvent" dlg:tab-index="14" dlg:left="12" dlg:top="17" dlg:width="67" dlg:height="8" dlg:page="2" dlg:value="lblEvent"/>
+ <dlg:fixedline dlg:id="hlnNewEvent" dlg:tab-index="15" dlg:left="6" dlg:top="6" dlg:width="196" dlg:height="8" dlg:page="2" dlg:value="hlnNewEvent"/>
+ <dlg:textfield dlg:style-id="1" dlg:id="txtEvent" dlg:tab-index="16" dlg:left="12" dlg:top="28" dlg:width="107" dlg:height="12" dlg:page="2" dlg:help-url="HID:34712">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Schedule.OwnEvents.CheckInsertedDates?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:textfield>
+ <dlg:numericfield dlg:id="txtOwnEventDay" dlg:tab-index="17" dlg:left="13" dlg:top="55" dlg:width="30" dlg:height="12" dlg:page="2" dlg:help-url="HID:34714" dlg:decimal-accuracy="0" dlg:value-min="1" dlg:spin="true">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.script:Schedule.OwnEvents.CheckInsertedDates?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:numericfield>
+ <dlg:menulist dlg:id="lstOwnEventMonth" dlg:tab-index="18" dlg:left="60" dlg:top="55" dlg:width="30" dlg:height="12" dlg:page="2" dlg:help-url="HID:34716" dlg:spin="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Schedule.OwnEvents.GetOwnMonth?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:button dlg:id="cmdInsert" dlg:tab-index="19" dlg:left="99" dlg:top="70" dlg:width="50" dlg:height="14" dlg:page="2" dlg:help-url="HID:34710" dlg:value="cmdInsert">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.OwnEvents.CalcmdInsertData?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdDelete" dlg:tab-index="20" dlg:left="152" dlg:top="70" dlg:width="50" dlg:height="14" dlg:page="2" dlg:help-url="HID:34711" dlg:value="cmdDelete">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.CalcmdDeleteSelect?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:menulist dlg:style-id="2" dlg:id="lstOwnData" dlg:tab-index="21" dlg:left="12" dlg:top="86" dlg:width="190" dlg:height="34" dlg:page="2" dlg:help-url="HID:34709">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Schedule.DlgControl.CalUpdateNewEventFrame?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:text dlg:id="lblEventDay" dlg:tab-index="22" dlg:left="12" dlg:top="44" dlg:width="44" dlg:height="8" dlg:page="2" dlg:value="lblEventDay"/>
+ <dlg:text dlg:id="lblEventMonth" dlg:tab-index="23" dlg:left="60" dlg:top="44" dlg:width="44" dlg:height="8" dlg:page="2" dlg:value="lblEventMonth"/>
+ <dlg:numericfield dlg:id="txtYear" dlg:tab-index="24" dlg:left="62" dlg:top="89" dlg:width="38" dlg:height="12" dlg:page="1" dlg:help-url="HID:34704" dlg:decimal-accuracy="0" dlg:value-min="1582" dlg:value-max="9957" dlg:spin="true"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/schedule/DlgControl.xba b/wizards/source/schedule/DlgControl.xba
new file mode 100644
index 000000000000..b7a7c4c957ae
--- /dev/null
+++ b/wizards/source/schedule/DlgControl.xba
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="DlgControl" script:language="StarBasic">Option Explicit
+
+Dim CalBitmap As Object
+Public bSelectByMouseMove as Boolean
+Public fHeightCorrFactor as Double
+Public fWidthCorrFactor as Double
+
+
+
+Sub Main()
+ Call CalAutopilotTable()
+End Sub
+
+
+Sub CalcmdDeleteSelect()
+Dim MsgBoxResult as Integer
+Dim bDoEnable as Boolean
+Dim iSel as Integer
+Dim MaxIndex as Integer
+ If Ubound(DlgCalModel.lstOwnData.SelectedItems()) &gt; -1 Then
+ MsgBoxResult = MsgBox(cCalSubcmdDeleteSelect_DeleteSelEntry$, 4+32, cCalSubcmdDeleteSelect_DeleteSelEntryTitle$)
+ If MsgBoxResult = 6 Then
+ iSel = DlgCalModel.lstOwnData.SelectedItems(0)
+ DlgCalModel.lstOwnData.StringItemList() = RemoveSelected(DlgCalModel.lstOwnData)
+ &apos; Flag to store the new data
+ bCalOwnDataChanged = True
+ bDoEnable = Ubound(DlgCalModel.lstOwnData.StringItemList()) &gt; -1
+ DlgCalModel.cmdDelete.Enabled = bDoEnable
+ If bDoEnable Then
+ MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
+ If iSel &gt; MaxIndex Then
+ iSel = MaxIndex
+ End If
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).SelectItemPos(iSel, True)
+ CalUpdateNewEventFrame()
+ Else
+ Call CalClearInputMask()
+ End If
+ End If
+ End If
+End Sub
+
+
+Sub CalSaveOwnEventControls()
+ With DlgCalModel
+ .txtOwnEventDay.Tag = .txtOwnEventDay.Value
+ .txtOwnEventMonth.Tag = .txtOwnEventMonth.Text
+ End With
+End Sub
+
+
+Sub CalMouseMoved(aEvent as object)
+Dim ListIndex as Integer
+ Select Case sCurLangLocale
+ Case cLANGUAGE_GERMAN
+ If bSelectByMouseMove Then
+&apos; oStatusLine.SetText(&quot;Position: &quot; &amp; aEvent.X &amp; &quot; ; &quot; &amp; aEvent.Y)
+ ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor))
+ DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(ListIndex, True)
+ End If
+ End Select
+End Sub
+
+
+Sub SelectState(aEvent as Object)
+Dim ListIndex as Integer
+ Select Case sCurLangLocale
+ Case cLANGUAGE_GERMAN
+ If aEvent.ClickCount &gt;= 1 Then
+ ListIndex = CalGetGermanLandAtMousePos(CInt(aEvent.X/fWidthCorrFactor), CInt(aEvent.Y/fHeightCorrFactor))
+ DlgCalendar.GetControl(&quot;lstHolidays&quot;).SelectItemPos(ListIndex, True)
+ bSelectByMouseMove = False
+ End If
+ End Select
+End Sub
+
+
+Sub MouseLeavesImage
+ bSelectbyMouseMove = True
+End Sub
+
+
+Sub CalClearInputMask()
+Dim NullList() as String
+ With DlgCalModel
+ .txtEvent.Text = &quot;&quot;
+ .txtOwnEventDay.SetPropertyToDefault(&quot;Value&quot;)
+ .cmdInsert.Enabled = False
+ End With
+ If Ubound(DlgCalModel.lstOwnData.StringItemList()) &gt; -1 Then
+ If Ubound(DlgCalModel.lstOwnData.SelectedItems()) = -1 Then
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).SelectItemPos(0,True)
+ CalUpdateNewEventFrame()
+ End If
+ End If
+End Sub
+
+
+Sub CalmdSwitchOwnDataOrGeneral()
+ If DlgCalModel.Step = 1 Then
+ DlgCalModel.Step = 2
+ DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_Back$
+ DlgCalModel.cmdInsert.Enabled = DlgCalModel.txtEvent.Text &lt;&gt; &quot;&quot;
+&apos; ToggleYearBox()
+ Else
+ dim bla as boolean
+ DlgCalModel.Step = 1
+ DlgCalendar.GetControl(&quot;lblHolidays&quot;).Visible = sCurLangLocale = cLANGUAGE_GERMAN
+ DlgCalendar.GetControl(&quot;lstHolidays&quot;).Visible = sCurLangLocale = cLANGUAGE_GERMAN
+ DlgCalModel.cmdOwnData.Label = cCalSubcmdSwitchOwnDataOrGeneral_OwnData$
+ End If
+End Sub
+
+
+Sub ToggleInsertButton()
+ DlgCalModel.cmdInsert.Enabled = LTrim(DlgCalModel.txtEvent.Text) &lt;&gt; &quot;&quot;
+End Sub
+
+
+Sub CalUpdateNewEventFrame()
+Dim bDoEnable as Boolean
+Dim sSelectedItem
+Dim ListIndex as Integer
+Dim MaxSelIndex as Integer
+Dim CurEvMonth as Integer
+Dim CurEvDay as Integer
+Dim DateStr as String
+ bDoEnable = False
+ With DlgCalModel
+ MaxSelIndex = Ubound(DlgCalModel.lstOwnData.SelectedItems())
+ If MaxSelIndex &gt; -1 Then
+ ListIndex = .lstOwnData.SelectedItems(MaxSelIndex)
+ .txtEvent.Text = CalGetNameofEvent(ListIndex)
+ If GetSelectedDateUnits(CurEvDay, CurEvMonth, ListIndex) &lt;&gt; SBDATEUNDEFINED Then
+ .txtOwnEventDay.Value = CurEvDay
+ DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).SelectItemPos(CurEvMonth-1, True)
+ .cmdDelete.Enabled = True
+ .cmdInsert.Enabled = True
+ Else
+ Call CalClearInputMask()
+ .cmdDelete.Enabled = True
+ End If
+ End If
+ End With
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/GermanHolidays.xba b/wizards/source/schedule/GermanHolidays.xba
new file mode 100644
index 000000000000..7ce4357e9699
--- /dev/null
+++ b/wizards/source/schedule/GermanHolidays.xba
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="GermanHolidays" script:language="StarBasic">Option Explicit
+
+Sub Main()
+ Call CalAutopilotTable()
+End Sub
+
+Function CalGetGermanLandAtMousePos(byval X as single, byval Y as single) as Integer
+ CalChoosenLand = 0
+ If (X&gt;73)And(X&lt;130)And(Y&gt;=117)And(Y&lt;181) Then
+ CalChoosenLand = CalBLBayern
+
+ ElseIf (X&gt;41)And(X&lt;89)And(Y&gt;=136)And(Y&lt;183) Then
+ CalChoosenLand = CalBLBadenWuert
+
+ ElseIf (X&gt;18)And(X&lt;35)And(Y&gt;136)And(Y&lt;147) Then
+ CalChoosenLand = CalBLSaarland
+
+ ElseIf (X&gt;13)And(X&lt;42)And(Y&gt;111)And(Y&lt;146) Then
+ CalChoosenLand = CalBLRheinlandPfalz
+
+ ElseIf (X&gt;15)And(X&lt;=60)And(Y&gt;=69)And(Y&lt;112) Then
+ CalChoosenLand = CalBLNordrheinWest
+
+ ElseIf (X&gt;=42)And(X&lt;78)And(Y&gt;=95)And(Y&lt;136) Then
+ CalChoosenLand = CalBLHessen
+
+ ElseIf (X&gt;=78)And(X&lt;112)And(Y&gt;=95)And(Y&lt;117) Then
+ CalChoosenLand = CalBLThueringen
+
+ ElseIf (X&gt;=112)And(X&lt;158)And(Y&gt;=88)And(Y&lt;114) Then
+ CalChoosenLand = CalBLSachsen
+
+ ElseIf (X&gt;77)And(X&lt;84)And(Y&gt;35)And(Y&lt;42) Then
+ CalChoosenLand = CalBLHamburg
+
+ ElseIf (X&gt;56)And(X&lt;60)And(Y&gt;36)And(Y&lt;41) Then
+ CalChoosenLand = CalBLBremen
+
+ ElseIf (X&gt;58)And(X&lt;63)And(Y&gt;44)And(Y&lt;52) Then
+ CalChoosenLand = CalBLBremen
+
+ ElseIf (X&gt;52)And(X&lt;95)And(Y&gt;8)And(Y&lt;40) Then
+ CalChoosenLand = CalBLSchlHolstein
+
+ ElseIf (X&gt;90)And(X&lt;149)And(Y&gt;23)And(Y&lt;48) Then
+ CalChoosenLand = CalBLMeckPomm
+
+ ElseIf (X&gt;28)And(X&lt;90)And(Y&gt;35)And(Y&lt;69) Then
+ CalChoosenLand = CalBLNiedersachsen
+
+ ElseIf (X&gt;60)And(X&lt;90)And(Y&gt;=69)And(Y&lt;95) Then
+ CalChoosenLand = CalBLNiedersachsen
+
+ ElseIf (X&gt;=90)And(X&lt;=115)And(Y&gt;47)And(Y&lt;95) Then
+ CalChoosenLand = CalBLSachsenAnhalt
+
+ ElseIf (X&gt;129)And(X&lt;139)And(Y&gt;60)And(Y&lt;66) Then
+ CalChoosenLand = CalBLBerlin
+
+ ElseIf (X&gt;115)And(X&lt;151)And(Y&gt;=48)And(Y&lt;88) Then
+ CalChoosenLand = CalBLBrandenburg
+ End If
+ CalGetGermanLandAtMousePos = CalChoosenLand
+End Function
+
+
+
+Sub CalFindWholeYearHolidays_GERMANY(ByVal iSelYear as Integer, ByVal iCountry as Integer)
+ Dim So as Integer
+ Dim OsternDate&amp;, VierterAdvent&amp;
+
+ If (iCountry &lt; 1) Or (iCountry &gt; 16) Then
+ iCountry = CalBLHamburg
+ End If
+ OsternDate&amp; = CalEasterTable&amp;(iSelYear)
+ So = 1
+
+ CalInsertBankholiday(DateSerial(iSelYear, 1, 1), &quot;Neujahr&quot;, cHolidayType_Full)
+
+ If (iCountry = CalBLBayern) Or (iCountry = CalBLBadenWuert) Or (iCountry = CalBLSachsenAnhalt) Then
+ CalInsertBankholiday(DateSerial(iSelYear, 1, 6), &quot;Hl. 3 Könige&quot;, cHolidayType_Full)
+ End If
+
+ CalInsertBankholiday(OsternDate&amp;-2, &quot;Karfreitag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(OsternDate&amp;, &quot;Ostersonntag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(OsternDate&amp;+1, &quot;Ostermontag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(iSelYear, 5, 1), &quot;Maifeiertag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(OsternDate&amp;+39, &quot;Christi Himmelfahrt&quot;, cHolidayType_Full)
+ CalInsertBankholiday(OsternDate&amp;+49, &quot;Pfingstsonntag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(OsternDate&amp;+50, &quot;Pfingstmontag&quot;, cHolidayType_Full)
+
+ If (iCountry = CalBLBadenWuert) Or (iCountry = CalBLBayern) Or (iCountry = CalBLHessen) Or (iCountry = CalBLNordRheinWest) Or (iCountry = CalBLRheinlandPfalz) Or (iCountry = CalBLSaarland) Or (iCountry = CalBLSachsen) Or (iCountry = CalBLThueringen) Then
+ CalInsertBankholiday(OsternDate&amp;+60, &quot;Fronleichnam&quot;, cHolidayType_Full)
+ End If
+
+ If (iCountry = CalBLBayern) Or (iCountry = CalBLSaarland) Then
+ CalInsertBankholiday(DateSerial(iSelYear, 8, 15), &quot;Mariä Himmelfahrt&quot;, cHolidayType_Full)
+ End If
+
+ CalInsertBankholiday(DateSerial(iSelYear, 10, 3), &quot;Tag der dt. Einheit&quot;, cHolidayType_Full)
+
+ If (iCountry=CalBLBrandenburg) Or (iCountry=CalBLMeckPomm) Or (iCountry=CalBLSachsenAnhalt) Or (iCountry=CalBLSachsen) Or (iCountry=CalBLThueringen) Then
+ CalInsertBankholiday(DateSerial(iSelYear, 10, 31), &quot;Reformationstag&quot;, cHolidayType_Full)
+ End If
+
+ If (iCountry = CalBLBadenWuert) Or (iCountry = CalBLBayern) Or (iCountry = CalBLNordRheinWest) Or (iCountry = CalBLRheinlandPfalz) Or (iCountry = CalBLSaarland) Or (iCountry = CalBLSachsen) Or (iCountry = CalBLThueringen) Then
+ CalInsertBankholiday(DateSerial(iSelYear, 11, 1), &quot;Allerheiligen&quot;, cHolidayType_Full)
+ End If
+
+ vierterAdvent = DateSerial(iSelYear, 12, 24)
+ While WeekDay(vierterAdvent) &lt;&gt; So
+ vierterAdvent = vierterAdvent - 1
+ Wend
+
+ If iCountry = CalBLSachsen Then
+ CalInsertBankholiday(vierterAdvent-32, &quot;Buß- und Bettag&quot;, cHolidayType_Full)
+ Else
+ CalInsertBankholiday(vierterAdvent-32, &quot;Buß- und Bettag&quot;, cHolidayType_Half)
+ End If
+ CalInsertBankholiday(vierterAdvent-21, &quot;1. Advent&quot;, cHolidayType_Full)
+ CalInsertBankholiday(vierterAdvent-14, &quot;2. Advent&quot;, cHolidayType_Full)
+ CalInsertBankholiday(vierterAdvent-7, &quot;3. Advent&quot;, cHolidayType_Full)
+ CalInsertBankholiday(vierterAdvent, &quot;4. Advent&quot;, cHolidayType_Full)
+
+ CalInsertBankholiday(Dateserial(iSelYear, 12, 24), &quot;Heiligabend&quot;, cHolidayType_Half)
+ CalInsertBankholiday(Dateserial(iSelYear, 12, 25), &quot;1. Weihnachtstag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(Dateserial(iSelYear, 12, 26), &quot;2. Weihnachtstag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(Dateserial(iSelYear, 12, 31), &quot;Sylvester&quot;, cHolidayType_Half)
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/Language.xba b/wizards/source/schedule/Language.xba
new file mode 100644
index 000000000000..9fbf0942e94f
--- /dev/null
+++ b/wizards/source/schedule/Language.xba
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
+
+
+Public Const cLANGUAGE_SYSTEM = &quot;&quot;, cLANGUAGE_CHINESE = &quot;zh&quot;, cLANGUAGE_DANISH = &quot;da&quot;
+Public Const cLANGUAGE_DUTCH = &quot;nl&quot;, cLANGUAGE_ENGLISH = &quot;en&quot;, cLANGUAGE_FINNISH = &quot;fi&quot;
+Public Const cLANGUAGE_FRENCH = &quot;fr&quot;, cLANGUAGE_GERMAN = &quot;de&quot;, cLANGUAGE_GREEK = &quot;el&quot;
+Public Const cLANGUAGE_ITALIAN = &quot;it&quot;, cLANGUAGE_JAPANESE = &quot;ja&quot;, cLANGUAGE_NORWEGIAN = &quot;no&quot;
+Public Const cLANGUAGE_POLISH = &quot;pl&quot;, cLANGUAGE_PORTUGUESE = &quot;pt&quot;, cLANGUAGE_RUSSIAN = &quot;ru&quot;
+Public Const cLANGUAGE_SPANISH = &quot;es&quot;, cLANGUAGE_SWEDISH = &quot;sv&quot;, cLANGUAGE_TURKISH = &quot;tr&quot;
+
+Public BLNameList(0 To 16) as String
+
+
+&apos; R e s o u r c e s t r i n g c o n s t a n t s
+&apos; -------------------------------------------------
+&apos; Dialog labels start at 1000
+
+Sub LoadLanguage%(ByVal LangLocale)
+Dim Dummy$
+Dim i as Integer
+Const dlgMonth = 1200
+&apos; Abreviated months start 1225
+Const dlgShortMonth = 1225
+ If InitResources(&quot;schedule&quot;, &quot;cal&quot;) Then
+ If LangLocale = cLANGUAGE_GERMAN Then
+
+ &apos; Load all states
+ BLNameList(0) = GetResText(1100)
+ BLNameList(1) = &quot;Bayern&quot;
+ BLNameList(2) = &quot;Baden-Württemberg&quot;
+ BLNameList(3) = &quot;Berlin&quot;
+ BLNameList(4) = &quot;Bremen&quot;
+ BLNameList(5) = &quot;Brandenburg&quot;
+ BLNameList(6) = &quot;Hamburg&quot;
+ BLNameList(7) = &quot;Hessen&quot;
+ BLNameList(8) = &quot;Mecklenburg-Vorpommern&quot;
+ BLNameList(9) = &quot;Niedersachsen&quot;
+ BLNameList(10) = &quot;Nordrhein-Westfalen&quot;
+ BLNameList(11) = &quot;Rheinland-Pfalz&quot;
+ BLNameList(12) = &quot;Saarland&quot;
+ BLNameList(13) = &quot;Sachsen&quot;
+ BLNameList(14) = &quot;Sachsen-Anhalt&quot;
+ BLNameList(15) = &quot;Schleswig Holstein&quot;
+ BLNameList(16) = &quot;Thüringen&quot;
+
+ DlgCalModel.lstHolidays.StringItemList() = BLNameList()
+ End If
+ sWizardTitle$ = GetResText(1300)
+ sError = GetResText(1301)
+ cCalSubcmdDeleteSelect_DeleteSelEntryTitle$ = GetResText(1302)
+ cCalSubcmdDeleteSelect_DeleteSelEntry$ = GetResText(1303)
+ DlgCalendar.Title = GetResText(1000)
+
+ With DlgCalModel
+ cCalSubcmdSwitchOwnDataOrGeneral_OwnData$ = GetResText(1002)
+ cCalSubcmdSwitchOwnDataOrGeneral_Back$ = GetResText(1001)
+ .hlnTime.Label = GetResText(1011)
+ .lblYear.Label = GetResText(1012)
+ .cmdCancel.Label = GetResText(1005)
+ .cmdGoOn.Label = GetResText(1004)
+ .lblHolidays.Label = GetResText(1014)
+ sBitmapFilename = GetResText(1099)
+ sBitmapFilename = ReplaceString(sBitmapFileName, &quot;.gif&quot;, &quot;.bmp&quot;)
+ DlgCalModel.hlnCalendar.Label = GetResText(1006)
+ .optYear.Label = GetResText(1007)
+ .optMonth.Label = GetResText(1008)
+ .lblMonth.Label = GetResText(1013)
+ .cmdOwnData.Label = GetResText(1015)
+ .hlnNewEvent.Label = GetResText(1019)
+ .lblEvent.Label = GetResText(1019)
+ .lblEventDay.Label = GetResText(1021)
+ .lblEventMonth.Label = GetResText(1022)
+&apos; .lblEventYear.Label = GetResText(1023)
+&apos; .chkEventOnce.Label = GetResText(1020)
+ .cmdInsert.Label = GetResText(1016)
+ .cmdDelete.Label = GetResText(1017)
+ &apos; Load long month names
+ For i = 0 To 11
+ cCalLongMonthNames(i) = GetResText(dlgMonth+i)
+ cCalShortMonthNames(i)= cCalLongMonthNames(i)
+ &apos;cCalShortMonthNames(i)= Left$(cCalLongMonthNames(i), 3)
+ cCalShortMonthNames(i)= RTrim(cCalShortMonthNames(i))
+ Next
+ &apos; Load sheet names
+ sCalendarTitle = GetResText(1410)
+ sMonthTitle = GetResText(1411)
+ &apos; Load names of styles
+ cCalStyleWorkday$ = GetResText(1400)
+ cCalStyleWeekend$ = GetResText(1401)
+ End With
+ End If
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/LocalHolidays.xba b/wizards/source/schedule/LocalHolidays.xba
new file mode 100644
index 000000000000..0b347c03f031
--- /dev/null
+++ b/wizards/source/schedule/LocalHolidays.xba
@@ -0,0 +1,642 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="LocalHolidays" script:language="StarBasic">Option Explicit
+
+Sub Main
+ Call CalAutopilotTable()
+End Sub
+
+
+Sub FindWholeYearHolidays_FRANCE(ByVal YearInt as Integer)
+Dim lEasterDate&amp;
+Dim lDate&amp;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Jour de l&apos;an&quot;, cHolidayType_Full)
+ lEasterDate = CalEasterTable(YearInt)
+ CalInsertBankholiday(lEasterDate, &quot;Pâques&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lEasterDate + 1, &quot;Lundi de Pâques&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lEasterDate + 39, &quot;Ascension&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lEasterDate + 49, &quot;Pentecôte&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lEasterDate + 50, &quot;Lundi de Pentecôte&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;Fête du travail&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 8), &quot;Victoire 1945&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 7, 14), &quot;Fête Nationale&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 8, 15), &quot;Assomption&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 1), &quot;Toussaint&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 11), &quot;Armistice ou Victoire 1918&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;Noël&quot;, cHolidayType_Full)
+End Sub
+
+
+Sub FindWholeYearHolidays_SWED(ByVal YearInt as Integer)
+Dim lDate&amp;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Nyårsdagen&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 1, 6), &quot;Trettondagen&quot;, cHolidayType_Full)
+ lDate = CalEasterTable(YearInt)
+ CalInsertBankholiday(lDate - 2, &quot;Långfredagen&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate, &quot;Påskdagen&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate + 1, &quot;Annandag påsk&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate + 39, &quot;Kristi himmelfärds dag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate + 49, &quot;Pingstdagen&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate + 50, &quot;Annandag pingst&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;1:a maj&quot;, cHolidayType_Full)
+ &apos; MidSummerfeast (next Sunday after 20th June)
+ CalInsertBankholiday(GetNextWeekday(YearInt, 6, 20, 7), &quot;Midsommardagen&quot;, cHolidayType_Full)
+ CalInsertBankholiday(GetNextWeekDay(YearInt, 10, 31, 7), &quot;Alla helgons dag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;Juldagen&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 26), &quot;Annandag jul&quot;, cHolidayType_Full)
+End Sub
+
+
+
+Sub FindWholeYearHolidays_FI(ByVal YearInt as Integer)
+ Dim OsternDate&amp;
+ &apos; New Year
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Uudenvuodenpäivä&quot;, cHolidayType_Full)
+ &apos; &quot;the three Magi&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 6), &quot;Loppiainen&quot;, cHolidayType_Half)
+ OsternDate = CalEasterTable(YearInt)
+ CalInsertBankholiday(OsternDate-2, &quot;Pitkäperjantai&quot;, cHolidayType_Full)
+ CalInsertBankholiday(OsternDate, &quot;Pääsiäispäivä&quot;, cHolidayType_Full)
+ CalInsertBankholiday(OsternDate+1, &quot;2. pääsiäispäivä&quot;, cHolidayType_Full)
+ &apos; Ascension Day
+ CalInsertBankholiday(OsternDate+39, &quot;Helatorstai&quot;, cHolidayType_Full)
+ &apos; First of May
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;Vappu, suomalaisen työn päivä&quot;, cHolidayType_Full)
+ &apos; Mothers Day : 2nd Sunday in May, Full
+ CalInsertBankholiday(GetMonthDate(YearInt, 5,1,7), &quot;Äitienpäivä&quot;, cHolidayType_Full)
+ &apos; MidSummerfeast (next Sunday after 20th June)
+ CalInsertBankholiday(GetNextWeekday(YearInt, 6, 20, 7), &quot;Juhannus, Suomen lipun päivä&quot;, cHolidayType_Full)
+ &apos; Independance day
+ CalInsertBankholiday(DateSerial(YearInt, 12, 6), &quot;Itsenäisyyspäivä&quot;, cHolidayType_Full)
+ &apos; Christmas
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;Joulupäivä&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 26), &quot;Tapaninpäivä&quot;, cHolidayType_Full)
+End Sub
+
+
+
+Sub FindWholeYearHolidays_DK (ByVal YearInt as Integer)
+Dim lDate&amp;, VierterAdvent&amp;
+
+ &apos;New Year
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Nytårsdag&quot;, cHolidayType_Full)
+ lDate = CalEasterTable (YearInt)
+ &apos; carnival
+ CalInsertBankholiday(lDate-49, &quot;Fastelavn&quot;, cHolidayType_Half)
+ &apos;&quot;Maundy Tuesday
+ CalInsertBankholiday(lDate-3, &quot;Skærtorsdag&quot;, cHolidayType_Full)
+ &apos;&quot;Good Friday &quot;
+ CalInsertBankholiday(lDate-2, &quot;Langfredag&quot;, cHolidayType_Full)
+ &apos; Easter Sunday
+ CalInsertBankholiday(lDate, &quot;Påskesøndag&quot;, cHolidayType_Full)
+ &apos; Easter Monday
+ CalInsertBankholiday(lDate+1, &quot;2. påskedag&quot;, cHolidayType_Full)
+ &apos; 4th Friday after Easter
+ CalInsertBankholiday(lDate+26, &quot;Store bededag&quot;, cHolidayType_Full)
+ &apos; &quot;Ascension Day
+ CalInsertBankholiday(lDate+39, &quot;Kristi himmelfahrt&quot;, cHolidayType_Full)
+ &apos; &quot;Whitsunday&quot;
+ CalInsertBankholiday(lDate+49, &quot;Pinsesøndag&quot;, cHolidayType_Full)
+ &apos; &quot;Whitmonday&quot;
+ CalInsertBankholiday(lDate+50, &quot;2. pinsedag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 5), &quot;Grundlovsdag&quot;, cHolidayType_Full)
+ &apos;Christmas Days
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;1. juledag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 26), &quot;2. juledag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 1, 6), &quot;Hellig 3 konger&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 3, 28), &quot;Dr. Ingrid&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 16), &quot;Dr. Margrete&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 16), &quot;Palmesøndag&quot;, cHolidayType_Half)
+ &apos; &quot;Liberation day&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 5, 5), &quot;Befrielsesdag&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 26), &quot;Krpr. Frederik&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 7), &quot;Pr. Joachim&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 11), &quot;Pr. Henrik&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 15), &quot;Valdemarsdag&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 24), &quot;Skt. Hans&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 30), &quot;Prinsesse Alexandra&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 8, 28), &quot;Pr. Nikolai&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 10, 24), &quot;FN-dag&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 11), &quot;Morten Bisp&quot;, cHolidayType_Half)
+ &apos; all half (Memorial Days)
+ &apos;&quot;adventdays
+ VierterAdvent = DateSerial(YearInt, 12, 24)
+ While (Weekday(VierterAdvent) &lt;&gt; 1)
+ vierterAdvent = vierterAdvent - 1
+ Wend
+ CalInsertBankholiday(vierterAdvent-21, &quot;1. søndag i advent&quot;, cHolidayType_Half)
+ CalInsertBankholiday(vierterAdvent-14, &quot;2. søndag i advent&quot;, cHolidayType_Half)
+ CalInsertBankholiday(vierterAdvent-7, &quot;3. søndag i advent&quot;, cHolidayType_Half)
+ CalInsertBankholiday(vierterAdvent, &quot;4. søndag i advent&quot;, cHolidayType_Half)
+ &apos;Christmas eve
+ CalInsertBankholiday(DateSerial(YearInt, 12, 24), &quot;Juleaften&quot;, cHolidayType_Half)
+ &apos;&quot;New Year&apos;s eve&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 12, 31), &quot;Nytårsaften&quot;, cHolidayType_Half)
+End Sub
+
+
+Sub FindWholeYearHolidays_ITA(ByVal YearInt as Integer)
+Dim lDate&amp;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Capodanno&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 1, 6), &quot;Epifania&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 25), &quot;Festa della liberazione&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 8, 15), &quot;Ferragusto&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 1), &quot;Tutti i Santi&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 8), &quot;Immacolata concezione&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;Natale&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 26), &quot;Santo Stefano&quot;, cHolidayType_Full)
+ lDate = CalEasterTable(YearInt)
+ CalInsertBankholiday(lDate, &quot;Pasqua&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate+1, &quot;Lunedì dell&apos;Angelo&quot;, cHolidayType_Full)
+End Sub
+
+
+
+Sub FindWholeYearHolidays_TRK(ByVal YearInt as Integer)
+Dim lDate as Long
+ &apos; New Years&apos; Day
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Yılbaşı&quot;, cHolidayType_Full)
+ &apos; National Sovereignty and Children&apos;s Day
+ CalInsertBankholiday(DateSerial(YearInt, 4, 23), &quot;Ulusal Egemenlik ve Çocuk Bayramı&quot;, cHolidayType_Full)
+ &apos; Ataturk Commemoration and Youth &amp; Sports Day
+ CalInsertBankholiday(DateSerial(YearInt, 5, 19), &quot;Atatürk&apos;ü Anma, Gençlik ve Spor Bayramı&quot;, cHolidayType_Full)
+ &apos; Mothers Day : 2nd Sunday in May, Full
+ CalInsertBankholiday(GetMonthDate(YearInt, 5,1,7), &quot;Anneler günü&quot;, cHolidayType_Full)
+ &apos; Fathers Day: 3rd Sunday in May, Full
+ CalInsertBankholiday(GetMonthDate(YearInt, 6,1,14), &quot;Babalar Günü&quot;, cHolidayType_Full)
+ &apos; Victory Day
+ CalInsertBankholiday(DateSerial(YearInt, 8, 30), &quot;Zafer Bayramı&quot;, cHolidayType_Full)
+ &apos; Republic Day
+ CalInsertBankholiday(DateSerial(YearInt, 10, 28), &quot;Cumhuriyet Bayramı&quot;, cHolidayType_Full)
+ &apos; Republic Day
+ CalInsertBankholiday(DateSerial(YearInt, 10, 29), &quot;Cumhuriyet Bayramı&quot;, cHolidayType_Full)
+ &apos; Commemoration Of Ataturk-Anniversary of Ataturk&apos;s Death
+ CalInsertBankholiday(DateSerial(YearInt, 11, 10), &quot;Atatürk&apos;ün Ölüm Günü&quot;, cHolidayType_Full)
+ CalculateturkishReligousHolidays(YearInt)
+End Sub
+
+
+Sub CalculateturkishReligousHolidays(iSelYear as Integer)
+Dim lKurbanBayRamStartDate as Long
+Dim lRamazanBayRamStartDate as Long
+
+ Select Case iSelYear
+ Case 2002
+ lKurbanBayRamStartDate = DateSerial(iSelYear, 2, 21)
+ lRamazanBayRamStartDate = DateSerial(iSelYear, 12, 4)
+ Case 2003
+ lKurbanBayRamStartDate = DateSerial(iSelYear, 2, 10)
+ lRamazanBayRamStartDate = DateSerial(iSelYear, 11, 24)
+ Case 2004
+ lKurbanBayRamStartDate = DateSerial(iSelYear, 1, 31)
+ lRamazanBayRamStartDate = DateSerial(iSelYear, 11, 13)
+ Case 2005
+ lKurbanBayRamStartDate = DateSerial(iSelYear, 1, 19)
+ lRamazanBayRamStartDate = DateSerial(iSelYear, 11, 2)
+ Case 2006
+ lKurbanBayRamStartDate = DateSerial(iSelYear, 12, 30)
+ CalInsertBankholiday(lKurbanBayRamStartDate, &quot;Kurban Bayramı Arefesi&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(iSelYear, 12, 31), &quot;Kurban Bayram&quot;, cHolidayType_Full)
+
+ lKurbanBayRamStartDate = DateSerial(iSelYear, 1, 9)
+ lRamazanBayRamStartDate = DateSerial(iSelYear, 10, 22)
+ Case 2007
+ lKurbanBayRamStartDate = DateSerial(iSelYear, 1, 1)
+ &apos; Note: The first day has already been in 2006!!!
+ AddFollowUpHolidays(lKurbanBayRamStartDate-1, 3, &quot;Kurban Bayram&quot;, cHolidayType_Full)
+ lKurbanBayRamStartDate = DateSerial(iSelYear, 12, 19)
+
+ lRamazanBayRamStartDate = DateSerial(iSelYear, 10, 11)
+ Case 2008
+ lKurbanBayRamStartDate = DateSerial(iSelYear, 12, 7)
+ lRamazanBayRamStartDate = DateSerial(iSelYear, 9, 29)
+ Case Else
+ Exit Sub
+ End Select
+ &apos;Feast Of the Sacrifice Eve
+ CalInsertBankholiday(lKurbanBayRamStartDate, &quot;Kurban Bayramı Arefesi&quot;, cHolidayType_Half)
+ &apos;Feast Of the Sacrifice
+ AddFollowUpHolidays(lKurbanBayRamStartDate, 4, &quot;Kurban Bayram&quot;, cHolidayType_Full)
+ &apos; End of Ramadan Eve
+ CalInsertBankholiday(lRamazanBayRamStartDate, &quot;Ramazan (Şeker) Bayramı Arefesi&quot;, cHolidayType_Half)
+ &apos; End of Ramadan
+ AddFollowUpHolidays(lRamazanBayRamStartDate, 3, &quot;Ramazan (Şeker) Bayramı&quot;, cHolidayType_Full)
+End Sub
+
+
+Sub FindWholeYearHolidays_GREEK(ByVal YearInt as Integer)
+Dim lDate as Long
+ &apos; New Year
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Πρωτοχρονιά&quot;, cHolidayType_Full)
+ &apos;Schol Holiday
+ CalInsertBankholiday(DateSerial(YearInt, 12, 30), &quot;Τριών Ιεραρχών&quot;, cHolidayType_Full)
+ &apos; This is both a National Holiday and a religious holiday
+ CalInsertBankholiday(DateSerial(YearInt, 3, 25), &quot;Εθνική Εορτή Ευαγγελισμός Θεοτόκου&quot;, cHolidayType_Full)
+ &apos; Labor Day
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;Πρωτομαγιά&quot;, cHolidayType_Full)
+ &apos; Assumption Day
+ CalInsertBankholiday(DateSerial(YearInt, 8, 15), &quot;Κοίμηση της Θεοτόκου&quot;, cHolidayType_Full)
+ &apos; National Resistance Day
+ CalInsertBankholiday(DateSerial(YearInt, 10, 28), &quot;Εθνική Εορτή&quot;, cHolidayType_Full)
+ &apos; School Holiday
+ CalInsertBankholiday(DateSerial(YearInt, 11, 17), &quot;Επέτειος του Πολυτεχνείου&quot;, cHolidayType_Full)
+ &apos; Christmas Eve
+ CalInsertBankholiday(DateSerial(YearInt, 12, 24), &quot;Παραμονή Χριστουγέννων&quot;, cHolidayType_Full)
+ &apos; Christmas Day
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;Χριστούγεννα&quot;, cHolidayType_Full)
+ &apos; Boxing Day
+ CalInsertBankholiday(DateSerial(YearInt, 12, 26), &quot;Δεύτερη μέρα Χριστουγέννων&quot;, cHolidayType_Full)
+ lDate = CalOrthodoxEasterTable(YearInt)
+ &apos; Triodon
+ CalInsertBankholiday(lDate-70, &quot;Αρχή Τριωδίου&quot;, cHolidayType_Full)
+ &apos; Meat Fare
+ CalInsertBankholiday(lDate-56, &quot;Τσικνοπέμπτη&quot;, cHolidayType_Full)
+ &apos; First Day of Lent
+ CalInsertBankholiday(lDate-48, &quot;Καθαρή Δευτέρα&quot;, cHolidayType_Full)
+ &apos; Saturday of Lazarus
+ CalInsertBankholiday(lDate-8, &quot;Σάββατο του Λαζάρου&quot;, cHolidayType_Full)
+ &apos; Palm Sunday
+ CalInsertBankholiday(lDate-7, &quot;Κυριακή των Βαΐων&quot;, cHolidayType_Full)
+ &apos; Monday before Easter
+ CalInsertBankholiday(lDate-6, &quot;Μεγάλη Δευτέρα&quot;, cHolidayType_Full)
+ &apos; Tuesday before Easter
+ CalInsertBankholiday(lDate-5, &quot;Μεγάλη Τρίτη&quot;, cHolidayType_Full)
+ &apos; Wednesday before Easter
+ CalInsertBankholiday(lDate-4, &quot;Μεγάλη Τετάρτη&quot;, cHolidayType_Full)
+ &apos; Thursday before Easter
+ CalInsertBankholiday(lDate-3, &quot;Μεγάλη Πέμπτη&quot;, cHolidayType_Full)
+ &apos; Good Friday
+ CalInsertBankholiday(lDate-2, &quot;Μεγάλη Παρασκευή&quot;, cHolidayType_Full)
+ &apos; Saturday before Easter
+ CalInsertBankholiday(lDate-1, &quot;Μεγάλο Σάββατο&quot;, cHolidayType_Full)
+ &apos; Easter Monday
+ CalInsertBankholiday(lDate+1, &quot;Δευτέρα του Πάσχα&quot;, cHolidayType_Full)
+ &apos; Pentecost
+ CalInsertBankholiday(lDate+49, &quot;Κυριακή της Πεντηκοστής&quot;, cHolidayType_Full)
+ &apos; Ascension Day
+ CalInsertBankholiday(lDate+39, &quot;Του Αγίου Πνεύματος&quot;, cHolidayType_Full)
+ &apos; All Saints Day
+ CalInsertBankholiday(lDate+56, &quot;Των Αγίων Πάντων&quot;, cHolidayType_Full)
+End Sub
+
+
+
+Sub FindWholeYearHolidays_SPAIN(ByVal YearInt as Integer)
+Dim lDate&amp;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Año Nuevo&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 1, 6), &quot;Reyes&quot;, cHolidayType_Full)
+ lDate = CalEasterTable(YearInt)
+ CalInsertBankholiday(lDate-2, &quot;Viernes Santo&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate+1, &quot;Lunes de Pascua Florida&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate+39, &quot;Día de la Ascensión&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;Fiesta del Trabajo&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 8, 15), &quot;Día de la Asunción&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 10, 12), &quot;Fiesta de la Hispanidad&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 1), &quot;Todos los Santos&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 6), &quot;Día de la Constitución&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 8), &quot;La Inmaculada&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;Navidad&quot;, cHolidayType_Full)
+End Sub
+
+
+Sub FindWholeYearHolidays_PORT(ByVal YearInt as Integer)
+Dim lDate&amp;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Ano Novo&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 1, 6), &quot;Reis Magos&quot;, cHolidayType_Half)
+ lDate = CalEasterTable(YearInt)
+ CalInsertBankholiday(lDate-47, &quot;Carnaval&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate-7, &quot;Domingo de Ramos&quot;, cHolidayType_Half)
+ CalInsertBankholiday(lDate-2, &quot;Sexta-feira Santa&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate, &quot;Páscoa&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 25), &quot;25 de Abril&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;Dia do Trabalhador&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 29), &quot;Corpo de Deus&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 10), &quot;Dia de Camões e das Comunidades Portuguesas&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 24), &quot;S. João&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 29), &quot;S. Pedro&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 8, 15), &quot;Assunção de Nossa Senhora&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 10, 5), &quot;Implantação da República&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 1), &quot;Dia de Todos os Santos&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 8), &quot;Imaculada Conceição&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;Natal&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 1), &quot;Restauração da Independência&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 31), &quot;Passagem de Ano&quot;, cHolidayType_Half)
+End Sub
+
+
+Sub FindWholeYearHolidays_NL(ByVal YearInt as Integer)
+Dim lDate&amp;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Nieuwjaarsdag&quot;, cHolidayType_Full)
+ lDate = CalEasterTable(YearInt)
+ CalInsertBankholiday(lDate, &quot;1e Paasdag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate + 1, &quot;2e Paasdag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate + 39, &quot;Hemelvaartsdag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate + 49, &quot;1e Pinksterdag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate + 50, &quot;2e Pinksterdag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 30), &quot;Koninginnedag&quot;, cHolidayType_Full)
+ &apos; Bevrijdingsdag is celebrated every 5th year
+ If YearInt Mod 5 = 0 then
+ CalInsertBankholiday(DateSerial(YearInt, 5, 5), &quot;Bevrijdingsdag&quot;, cHolidayType_Full)
+ End if
+ CalInsertBankholiday(DateSerial(YearInt, 12, 6), &quot;Sinterklaas&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;1e Kerstdag&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 26), &quot;2e Kerstdag&quot;, cHolidayType_Full)
+End Sub
+
+
+Sub FindWholeYearHolidays_PL (ByVal YearInt as Integer)
+ Dim lDate&amp;, OsternDate&amp;
+ &apos; New Year
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Nowy Rok&quot;, cHolidayType_Full)
+ &apos; &quot;the three Magi&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 6), &quot;Trzech Króli&quot;, cHolidayType_Half)
+ &apos; &quot;Womens&apos; Day&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 3, 8), &quot;Dzień Kobiet&quot;, cHolidayType_Half)
+ OsternDate = CalEasterTable(YearInt)
+ CalInsertBankholiday(OsternDate-2, &quot;Wielki Piątek&quot;, cHolidayType_Full)
+ CalInsertBankholiday(OsternDate, &quot;Wielka Niedziela&quot;, cHolidayType_Full)
+ CalInsertBankholiday(OsternDate+1, &quot;Lany Poniedziałek&quot;, cHolidayType_Full)
+ &apos; Ascension Day
+ CalInsertBankholiday(OsternDate+39, &quot;Wniebowstąpienie&quot;, cHolidayType_Full)
+ &apos; Pentecost
+ CalInsertBankholiday(OsternDate+49, &quot;Zielone Świątki&quot;, cHolidayType_Full)
+ &apos; Feast of Corpus Christi
+ CalInsertBankholiday(OsternDate+60, &quot;Boże Ciało&quot;, cHolidayType_Full)
+ &apos; First of May
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;Święto pracy&quot;, cHolidayType_Full)
+ &apos; Memorial day of constitution
+ CalInsertBankholiday(DateSerial(YearInt, 5, 3), &quot;Dzień konstytucji 3-go maja&quot;, cHolidayType_Full)
+ &apos; &quot;Childrens&apos; day&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 6, 1), &quot;Dzień Dziecka&quot;, cHolidayType_Half)
+ &apos; &quot;Ascension Day&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 8, 15), &quot;Matki Boskiej Zielnej&quot;, cHolidayType_Half)
+ &apos; &quot;All Saints&apos; Day &quot;
+ CalInsertBankholiday(DateSerial(YearInt, 11, 1), &quot;Wszystkich Świętych&quot;, cHolidayType_Full)
+ &apos; National day&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 11, 11), &quot;Dzień Niepodległości&quot;, cHolidayType_Full)
+ &apos; Christmas Eve
+ CalInsertBankholiday(DateSerial(YearInt, 12, 24), &quot;Wigilia&quot;, cHolidayType_Half)
+ &apos; Christmas
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;Boże Narodzenie&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 26), &quot;Boże Narodzenie&quot;, cHolidayType_Full)
+ &apos; &quot;New Year&apos;s eve&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 12, 31), &quot;Sylwester&quot;, cHolidayType_Half)
+End Sub
+
+
+Sub FindWholeYearHolidays_RU (ByVal YearInt as Integer)
+Dim lDate&amp;
+ &apos; New Year
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Новый Год&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 1, 2), &quot;Новый Год&quot;, cHolidayType_Full)
+ &apos; Russian Christmas&quot;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 7), &quot;Рождество&quot;, cHolidayType_Full)
+ &apos;Day of Defender of Motherland
+ CalInsertBankholiday(DateSerial(YearInt, 2, 23), &quot;День Защитника Отечества&quot;, cHolidayType_Full)
+ &apos; Woman Day
+ CalInsertBankholiday(DateSerial(YearInt, 3, 8), &quot;Международный Женский День&quot;, cHolidayType_Full)
+ &apos; Spring and labor holiday
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;Праздник Весны и Труда&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 2), &quot;Праздник Весны и Труда&quot;, cHolidayType_Full)
+ &apos; Victory of the second World War
+ CalInsertBankholiday(DateSerial(YearInt, 5, 9), &quot;День Победы&quot;, cHolidayType_Full)
+ &apos; Independence Day
+ CalInsertBankholiday(DateSerial(YearInt, 6, 12), &quot;День Независимости&quot;, cHolidayType_Full)
+ &apos; Day of Accord and Conciliation
+ CalInsertBankholiday(DateSerial(YearInt, 11, 7), &quot;День Согласия и Примирения&quot;, cHolidayType_Full)
+ &apos; Constitution Day
+ CalInsertBankholiday(DateSerial(YearInt, 12, 12), &quot;День Конституции&quot;, cHolidayType_Full)
+End Sub
+
+
+Sub FindWholeYearHolidays_US(ByVal YearInt as Integer)
+Dim lDate as Long
+Dim lFirstNov as Long
+Dim lElectDate as Long
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;New Year&apos;s Day&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 2, 2), &quot;Groundhog Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 2, 14), &quot;Valentine&apos;s Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 3, 17), &quot;St Patrick&apos;s Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 1), &quot;April Fools&apos; Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 22), &quot;Earth Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 6), &quot;Nurses&apos; Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 14), &quot;Flag Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 14), &quot;Army Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 6, 19), &quot;Juneteenth(Liberation of Slaves)&quot;, cHolidayType_Half)
+
+ CalInsertBankholiday(DateSerial(YearInt, 7, 4), &quot;Independence Day&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 8, 1), &quot;Air Force Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 8, 4), &quot;Coast Guard Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 9, 17), &quot;Citizenship Day or Constitution Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 10, 16), &quot;Bosses&apos; Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 10, 26 ), &quot;Mother-in-Law&apos;s Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 10, 27), &quot;Navy Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 10, 31), &quot;Halloween&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 10), &quot;Marine Corps Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 11), &quot;Veteran&apos;s Day&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 7), &quot;Pearl Harbor Remembrance Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 24), &quot;Christmas Eve&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;Christmas Day&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 31), &quot;New Year&apos;s Eve&quot;, cHolidayType_Half)
+
+ CalInsertBankholiday(CalEasterTable(YearInt), &quot;Easter Sunday&quot;, cHolidayType_Half)
+
+ &apos; Inauguration Day occurs every 4 years (1997, 2001) in the year following the presidential election
+ &apos; always on the 20th of January unless this is a Sunday in which case on Monday 21st January
+ If YearInt Mod 4 = 1 Then
+ lDate = DateSerial(YearInt, 1, 20)
+ If WeekDay(lDate) = 1 Then
+ CalInsertBankholiday(lDate + 1, &quot;Inauguration Day&quot;, cHolidayType_Half)
+ Else
+ CalInsertBankholiday(lDate, &quot;Inauguration Day&quot;, cHolidayType_Half)
+ End If
+ End If
+ &apos; First Tuesday in November, but only after the 1st of November and only on evenly numbered years
+ If YearInt Mod 2 = 0 Then
+ lFirstNov = DateSerial(YearInt, 11, 1)
+ lElectDate = GetMonthDate(YearInt, 11, 3, 0)
+ If lElectDate &gt; lFirstNov Then
+ CalInsertBankholiday(lElectDate, &quot;Election Day&quot;, cHolidayType_Half)
+ Else
+ CalInsertBankholiday(lElectDate + 7, &quot;Election Day&quot;, cHolidayType_Half)
+ End If
+ End If
+ CalInsertBankholiday(GetMonthDate(YearInt, 1, 2, 14), &quot;Martin Luther King Jr Day&quot;, cHolidayType_Full)
+ CalInsertBankholiday(GetMonthDate(YearInt, 2, 2, 14), &quot;President&apos;s Day&quot;, cHolidayType_Full)
+ &apos; Mothers Day : 2nd Sunday in May, Full
+ CalInsertBankholiday(GetMonthDate(YearInt, 5,1,7), &quot;Mother&apos;s Day&quot;, cHolidayType_Full)
+
+ &apos; Wednesday of the last full week of April Administrative Professionals&apos; Day (formerly Secretaries&apos; Day)
+ CalInsertBankholiday(GetMonthDate(YearInt, 5, 7, -7)-3, &quot;Administrative Professionals&apos; Day&quot;, cHolidayType_Half)
+
+ CalInsertBankholiday(GetMonthDate(YearInt, 5, 5, 0), &quot;National Day of Prayer&quot;, cHolidayType_Half)
+ CalInsertBankholiday(GetMonthDate(YearInt, 5, 7, 14), &quot;Armed Forces Day&quot;, cHolidayType_Half)
+ &apos; Fathers Day : 3rd Sunday in June
+ CalInsertBankholiday(GetMonthDate(YearInt, 6,1,14), &quot;Father&apos;s Day&quot;, cHolidayType_Half)
+
+ &apos; Last Monday in May: Menorial Day, Full
+ CalInsertBankholiday(GetMonthDate(YearInt, 6, 2, 0)-7, &quot;Memorial Day&quot;, cHolidayType_Full)
+ CalInsertBankholiday(GetMonthDate(YearInt, 7, 1, 21), &quot;Parents&apos; Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(GetMonthDate(YearInt, 8, 1, 0), &quot;Friendship Day&quot;, cHolidayType_Half)
+
+ &apos; 1st Monday in Sep : Labor Day, Full
+ CalInsertBankholiday(GetMonthDate(YearInt, 9, 2, 0), &quot;Labor Day&quot;, cHolidayType_Full)
+ &apos; Sunday after Labor Day Grandparents&apos; Day
+ CalInsertBankholiday(GetMonthDate(YearInt, 9, 2, 0)+6, &quot;Grandparents&apos; Day&quot;, cHolidayType_Half)
+
+ CalInsertBankholiday(GetMonthDate(YearInt, 10, 1, 0), &quot;National Children&apos;s Day&quot;, cHolidayType_Half)
+ CalInsertBankholiday(GetMonthDate(YearInt, 10, 2, 7), &quot;Columbus Day&quot;, cHolidayType_Full)
+ &apos; Sweetest Day: Third Saturday in October
+ CalInsertBankholiday(GetMonthDate(YearInt, 10, 7, 14), &quot;Sweetest Day&quot;, cHolidayType_Half)
+ &apos; 4th Thu in Nov : Thanksgiving, Full
+ CalInsertBankholiday(GetMonthDate(YearInt, 11, 5, 21), &quot;Thanksgiving&quot;, cHolidayType_Full)
+End Sub
+
+
+Sub FindWholeYearHolidays_JP(ByVal YearInt as Integer)
+Dim lDate&amp;
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;元日&quot;, cHolidayType_Full)
+ &apos; 2nd Monday in January
+ CalInsertBankholiday(GetMonthDate(YearInt, 1, 2, 7), &quot;成人の日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 2, 11), &quot;建国記念の日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 3, 20), &quot;春分の日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 29), &quot;みどりの日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 3), &quot;憲法記念日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 4), &quot;国民の休日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 5), &quot;こどもの日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 9, 23), &quot;秋分の日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(GetMonthDate(YearInt, 10, 2, 7), &quot;体育の日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 3), &quot;文化の日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 11, 23), &quot;勤労感謝の日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 23), &quot;天皇誕生日&quot;, cHolidayType_Full)
+ If YearInt &gt; 2002 Then
+ CalInsertBankholiday(GetMonthDate(YearInt, 7, 2, 14), &quot;海の日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(GetMonthDate(YearInt, 9, 2, 14), &quot;敬老の日&quot;, cHolidayType_Full)
+ Else
+ CalInsertBankholiday(DateSerial(YearInt, 7, 20), &quot;海の日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 9, 15), &quot;敬老の日&quot;, cHolidayType_Full)
+ End If
+End Sub
+
+
+Sub FindWholeYearHolidays_TW(YearInt as Integer)
+ CalculateChineseNewYear(YearInt)
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;元旦&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 2, 28), &quot;和平紀念日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 3, 8), &quot;婦女節&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 3, 29), &quot;革命先烈紀念日(青年節)&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 4), &quot;兒童節&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 4, 5), &quot;民族掃墓節&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;勞動節&quot;, cHolidayType_Full)
+ CalInsertBankholiday(GetNextWeekDay(YearInt, 5, 19, 2), &quot;佛陀誕辰紀念日&quot;, cHolidayType_Full) &apos; Just like Columbus Day
+ CalInsertBankholiday(DateSerial(YearInt, 6, 15), &quot;端午節&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 9, 3), &quot;軍人節&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 9, 21), &quot;中秋節&quot;, cHolidayType_Full)
+ CalInsertBankholiday(GetNextWeekDay(YearInt, 9, 28, 2), &quot;孔子誕辰紀念日(教師節)&quot;, cHolidayType_Full) &apos; Just like Columnbusday
+ CalInsertBankholiday(DateSerial(YearInt, 10, 10), &quot;國慶日&quot;, cHolidayType_Full)
+ CalInsertBankholiday(DateSerial(YearInt, 10, 25), &quot;臺灣光復節&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 10, 31), &quot;先總統 蔣公誕辰紀念日&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 11), &quot;國父誕辰紀念日(中華文化復興節)&quot;, cHolidayType_Half)
+ CalInsertBankholiday(DateSerial(YearInt, 12, 25), &quot;行憲紀念日&quot;, cHolidayType_Half)
+End Sub
+
+
+Sub FindWholeYearHolidays_CN(YearInt as Integer)
+ CalculateChineseNewYear(YearInt)
+ CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;元旦&quot;, cHolidayType_Full) &apos; New Year
+ CalInsertBankholiday(DateSerial(YearInt, 3, 8), &quot;妇女节&quot;, cHolidayType_Half) &apos; Women&apos;s Day
+ CalInsertBankholiday(DateSerial(YearInt, 4, 5), &quot;清明节&quot;, cHolidayType_Half) &apos; Day of the deads
+ CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;劳动节&quot;, cHolidayType_Full) &apos; International Labour Day
+ CalInsertBankholiday(DateSerial(YearInt, 6, 1), &quot;儿童节&quot;, cHolidayType_Half) &apos; Children&apos;s Day
+ CalInsertBankholiday(DateSerial(YearInt, 8, 1), &quot;建军节&quot;, cHolidayType_Half) &apos; Foundation of military
+ CalInsertBankholiday(DateSerial(YearInt, 10, 1), &quot;国庆节&quot;, cHolidayType_Full) &apos; National festival day
+End Sub
+
+
+&apos; Unfortunately I could not find a Routine to convert a &apos;Moon Date&apos; into a gregorian date
+Sub CalculateChineseNewYear(iSelYear as Integer)
+Dim lDate as Long
+ Select Case iSelYear
+ Case 1995
+ lDate = DateSerial(iSelYear, 1, 31)
+ Case 1996
+ lDate = DateSerial(iSelYear, 2, 19)
+ Case 1997
+ lDate = DateSerial(iSelYear, 2, 7)
+ Case 1998
+ lDate = DateSerial(iSelYear, 1, 28)
+ Case 1999
+ lDate = DateSerial(iSelYear,2, 16)
+ Case 2000
+ lDate = DateSerial(iSelYear,2, 5)
+ Case 2001
+ lDate = DateSerial(iSelYear, 1, 24)
+ Case 2002
+ lDate = DateSerial(iSelYear,2, 12)
+ Case 2003
+ lDate = DateSerial(iSelYear,2, 1)
+ Case 2004
+ lDate = DateSerial(iSelYear, 1, 22)
+ Case 2005
+ lDate = DateSerial(iSelYear,2, 9)
+ Case 2006
+ lDate = DateSerial(iSelYear, 1, 29)
+ Case 2007
+ lDate = DateSerial(iSelYear,2, 18)
+ Case 2008
+ lDate = DateSerial(iSelYear,2, 7)
+ Case 2009
+ lDate = DateSerial(iSelYear, 1, 26)
+ Case 2010
+ lDate = DateSerial(iSelYear,2, 10)
+ Case 2011
+ lDate = DateSerial(iSelYear,2, 3)
+ Case 2012
+ lDate = DateSerial(iSelYear, 1, 23)
+ Case 2013
+ lDate = DateSerial(iSelYear,2, 10)
+ Case 2014
+ lDate = DateSerial(iSelYear, 1, 31)
+ Case 2015
+ lDate = DateSerial(iSelYear,2, 19)
+ Case 2016
+ lDate = DateSerial(iSelYear,2, 9)
+ Case 2017
+ lDate = DateSerial(iSelYear, 1, 28)
+ Case 2018
+ lDate = DateSerial(iSelYear,2, 16)
+ Case 2019
+ lDate = DateSerial(iSelYear,2, 5)
+ Case 2020
+ lDate = DateSerial(iSelYear, 1, 25)
+ Case Else
+ Exit Sub
+ End Select
+ Select Case sCurCountryLocale
+ Case &quot;CN&quot;
+ CalInsertBankholiday(lDate-1, &quot;农历除夕&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate, &quot;春节初一&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate+1, &quot;春节初二&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate+2, &quot;春节初三&quot;, cHolidayType_Full)
+
+ Case Else
+ CalInsertBankholiday(lDate-1, &quot;農曆除夕&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate, &quot;春節初一&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate+1, &quot;春節初二&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lDate+2, &quot;春節初三&quot;, cHolidayType_Full)
+ End Select
+End Sub
+
+
+Function CalculateJapaneseSpringDay(iSelYear as Integer)
+ If (iSelYear &gt; 1979) And (iSelYear &lt; 2100) Then
+ CalculateJapaneseSpringDay() = Int(20.8431 + 0.242194)* (iSelYear-1980) - (Int((iSelYear-1980)/4))
+ End If
+End Function
+
+
+Function CalculateJapaneseAutumnDay(iSelYear as Integer)
+ If (iSelYear &gt; 1979) And (iSelYear &lt; 2100) Then
+ CalculateJapaneseAutumnDay() = Int(23.8431 + 0.242194)* (iSelYear-1980) - (Int((iSelYear-1980)/4))
+ End If
+End Function</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/OwnEvents.xba b/wizards/source/schedule/OwnEvents.xba
new file mode 100644
index 000000000000..f141c2ab0efe
--- /dev/null
+++ b/wizards/source/schedule/OwnEvents.xba
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="OwnEvents" script:language="StarBasic">Option Explicit
+
+Public Const SBDATEUNDEFINED as Double = -98765432.1
+
+Sub Main
+ Call CalAutopilotTable()
+End Sub
+
+
+Sub CalSaveOwnData()
+Dim FileName as String
+Dim FileChannel as Integer
+Dim i as Integer
+ If bCalOwnDataChanged Then
+ FileName = GetPathSettings(&quot;UserConfig&quot;, False) &amp; &quot;/&quot; &amp; &quot;DATE.DAT&quot;
+ SaveDataToFile(FileName, DlgCalModel.lstOwnData.StringItemList())
+ End If
+End Sub
+
+
+Sub CalLoadOwnData()
+Dim FileName as String
+Dim LocList() as String
+ FileName = GetPathSettings(&quot;UserConfig&quot;, False) &amp; &quot;/DATE.DAT&quot;
+ If LoadDataFromFile(FileName, LocList()) Then
+ DlgCalModel.lstOwnData.StringItemList() = LocList()
+ End If
+End Sub
+
+
+Function CalCreateDateStrOfInput() as String
+Dim DateStr as String
+Dim CurOwnMonth as Integer
+Dim CurOwnDay as Integer
+Dim FormatDateStr as String
+Dim dblDate as Double
+Dim iLen as Integer
+Dim iDiff as Integer
+Dim i as Integer
+ CurOwnDay = DlgCalModel.txtOwnEventDay.Value
+ CurOwnMonth = DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).getselectedItemPos() + 1
+ DateStr = DateSerial(0, CurOwnMonth, CurOwnDay)
+ dblDate = CDbl(DateValue(DateStr))
+ FormatDateStr = oNumberFormatter.convertNumberToString(lDateFormat, dblDate)
+ iLen = Len(FormatDateStr)
+ iDiff = 16 - iLen
+ If iDiff &gt; 0 Then
+ For i = 0 To iDiff
+ FormatDateStr = FormatDateStr + &quot; &quot;
+ Next i
+ Else
+ MsgBox(&quot;Invalid DateFormat: &apos;FormatDateStr&apos;&quot;, 16, sWizardTitle)
+ CalCreateDateStrOfInput = &quot;&quot;
+ Exit Function
+ End If
+ DateStr = FormatDateStr &amp; Trim(DlgCalModel.txtEvent.Text)
+ CalCreateDateStrOfInput = DateStr
+End Function
+
+
+
+Sub CalcmdInsertData()
+Dim MaxIndex as Integer
+Dim UIDateStr as String
+Dim DateStr as String
+Dim NewDate as Double
+Dim bInserted as Boolean
+Dim i as Integer
+Dim CurOwnDay as Integer
+Dim CurOwnMonth as Integer
+Dim CurOwnYear as Integer
+ CurOwnDay = DlgCalModel.txtOwnEventDay.Value
+ CurOwnMonth = DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).getSelectedItemPos() + 1
+ UIDateStr = CalCreateDateStrOfInput()
+ NewDate = GetDateUnits(CurOwnDay, CurOwnMonth, UIDateStr)
+ If UIDateStr = &quot;&quot; Then Exit Sub
+ MaxIndex = Ubound(DlgCalModel.lstOwnData.StringItemList())
+ If MaxIndex = -1 Then
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, 0 + 1)
+ bInserted = True
+ Else
+ Dim CurEvMonth(MaxIndex) as Integer
+ Dim CurEvDay(MaxIndex) as Integer
+ Dim CurDate(MaxIndex) as Double
+ &apos; same Years(&quot;no years&quot; are treated like same years) -&gt; delete old entry and insert new one
+ i = 0
+ Do
+ CurDate(i) = GetSelectedDateUnits(CurEvDay(i), CurEvMonth(i), i)
+ If CurDate(i) = NewDate Then
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).RemoveItems(i,1)
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, i)
+ bInserted = True
+ End If
+ i = i + 1
+ Loop Until bInserted Or i &gt; MaxIndex
+
+ &apos; There exists already a date
+ If Not bInserted Then
+ i = 0
+ Do
+ If (CurEvMonth(i) = CurOwnMonth) And (CurEvDay(i) = CurOwnDay) Then
+ bInserted = True
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).RemoveItems(i,1)
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, i)
+ End If
+ i = i + 1
+ Loop Until bInserted Or i &gt; MaxIndex
+ End If
+
+ &apos; The date is not yet existing and will will be sorted in accordingly
+ If Not bInserted Then
+ i = 0
+ Do
+ bInserted = NewDate &lt; CurDate(i)
+ If bInserted Then
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, i)
+ End If
+ i = i + 1
+ Loop Until bInserted Or i &gt; MaxIndex
+ If Not bInserted Then
+ DlgCalendar.GetControl(&quot;lstOwnData&quot;).AddItem(UIDateStr, MaxIndex+1)
+ End If
+ End If
+ End If
+ bCalOwnDataChanged = True
+ Call CalClearInputMask()
+End Sub
+
+
+Function GetSelectedDateUnits(CurEvDay as Integer, CurEvMonth as Integer, i as Integer) as Double
+Dim dblDate as Double
+Dim DateStr as String
+ dblDate = SBDATEUNDEFINED
+ DateStr = DlgCalModel.lstOwnData.StringItemList(i)
+ If DateStr &lt;&gt; &quot;&quot; Then
+ dblDate = GetDateUnits(CurEvDay, CurEvMonth, DateStr)
+ End If
+ GetSelectedDateUnits() = dblDate
+End Function
+
+
+Function GetDateUnits(CurEvDay as Integer, CurEvMonth as Integer, DateStr) as Double
+Dim bEventOnce as String
+Dim LocDateStr as String
+Dim dblDate as Double
+Dim lDate as Long
+ LocDateStr = Mid(DateStr, 1, 15)
+ LocDateStr = Trim(LocDateStr)
+
+ bEventOnce = True
+ On Local Error Goto NODATEFORMAT
+ dblDate = oNumberFormatter.convertStringToNumber(lDateFormat, LocDateStr)
+ lDate = Clng(dblDate)
+ CurEvMonth = Month(lDate)
+ CurEvDay = Day(lDate)
+ GetDateUnits() = dblDate
+ Exit Function
+ GetDateUnits() =SBDATEUNDEFINED
+NODATEFORMAT:
+ If Err &lt;&gt; 0 Then
+ MsgBox(&quot;Error: Date : &apos; &quot; &amp; LocDateStr &amp; &quot;&apos; is not a valid Format&quot;, 16, sWizardTitle)
+ Resume GETRETURNVALUE
+GETRETURNVALUE:
+ GetDateUnits() = SBDATEUNDEFINED
+ End If
+End Function
+
+
+Function CalGetNameOfEvent(ByVal ListIndex as Integer) as String
+Dim NameStr as String
+ NameStr = DlgCalModel.lstOwnData.StringItemList(ListIndex)
+ NameStr = Trim (Mid(NameStr, 16))
+ CalGetNameOfEvent = NameStr
+End Function
+
+
+
+Sub CheckInsertedDates(Optional ControlEnvironment, Optional CurOwnMonth as Integer)
+Dim EvYear as Long
+Dim EvDay as Long
+Dim sEvMonth as String
+Dim bDoEnable as Boolean
+Dim ListboxName as String
+Dim MaxValue as Integer
+ If Not IsMissing(ControlEnvironment) Then
+ CurOwnMonth = DlgCalendar.GetControl(&quot;lstOwnEventMonth&quot;).getSelectedItemPos()+1
+ End If
+ EvYear = Year(Now())
+ bDoEnable = CurOwnMonth &lt;&gt; 0
+ If bDoEnable Then
+ MaxValue = CalMaxDayInMonth(EvYear, CurOwnMonth)
+ DlgCalModel.txtOwnEventDay.ValueMax = MaxValue
+ If DlgCalModel.txtOwnEventDay.Value &gt; MaxValue Then
+ DlgCalModel.txtOwnEventDay.Value = MaxValue
+ End If
+ bDoEnable = DlgCalModel.txtOwnEventDay.Value &lt;&gt; 0
+ If bDoEnable Then
+ bDoEnable = Ubound(DlgCalModel.lstOwnEventMonth.SelectedItems()) &gt; -1
+ If bDoEnable Then
+ bDoEnable = LTrim(DlgCalModel.txtEvent.Text) &lt;&gt; &quot;&quot;
+ End If
+ End If
+ End If
+ DlgCalModel.cmdInsert.Enabled = bDoEnable
+End Sub
+
+
+Sub GetOwnMonth()
+Dim EvYear as Integer
+Dim CurOwnMonth as Integer
+ EvYear = year(now())
+ CurOwnMonth = DlgCalModel.lstOwnEventMonth.SelectedItems(0) + 1
+ DlgCalModel.txtOwnEventDay.ValueMax = CalMaxDayInMonth(EvYear, CurOwnMonth)
+ CheckInsertedDates(,CurOwnMonth)
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/schedule/delzip b/wizards/source/schedule/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/schedule/delzip
diff --git a/wizards/source/schedule/dialog.xlb b/wizards/source/schedule/dialog.xlb
new file mode 100644
index 000000000000..b1afde681e7e
--- /dev/null
+++ b/wizards/source/schedule/dialog.xlb
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Schedule" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="DlgCalendar"/>
+</library:library>
diff --git a/wizards/source/schedule/makefile.mk b/wizards/source/schedule/makefile.mk
new file mode 100644
index 000000000000..f5c549b878ce
--- /dev/null
+++ b/wizards/source/schedule/makefile.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=scheduleall
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+#
+# testresource.
+#
+SRS2NAME = schedule
+SRC2FILES= schedule.src
+RESLIB2SRSFILES= $(SRS)$/schedule.srs
+RESLIB2NAME= cal
+
+ZIP1TARGET = $(SCHEDULE_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/schedule/schedule.src b/wizards/source/schedule/schedule.src
new file mode 100644
index 000000000000..beabe83cf2a4
--- /dev/null
+++ b/wizards/source/schedule/schedule.src
@@ -0,0 +1,357 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/// Dialog labels start at 1000
+#define dlgCalTitle 1000
+#define dlgCalTitleBack 1001
+#define dlgCalTitleOwnData 1002
+#define dlgSchdlTitle 1003
+#define dlgOK 1004
+#define dlgCancel 1005
+#define dlgCalFrameOption 1006
+#define dlgCalOptionYear 1007
+#define dlgCalOptionMonth 1008
+#define dlgSchdlDescription 1009
+#define dlgSchdlCountry 1010
+#define dlgTime 1011
+#define dlgYear 1012
+#define dlgCalMonth 1013
+#define dlgSpecificBankholidays 1014
+#define dlgCalOwnData 1015
+#define dlgCalInsert 1016
+#define dlgCalDelete 1017
+#define dlgCalNewEvent 1018
+#define dlgCalEvent 1019
+#define dlgCalEventOnce 1020
+#define dlgCalEventDay 1021
+#define dlgCalEventMonth 1022
+#define dlgCalEventYear 1023
+
+// Bitmap file is 1099
+#define dlgBitmapFile 1099
+
+// Names of states start at 1100
+#define dlgState 1100
+
+// Months start at 1200
+#define dlgMonth 1200
+
+// Messages start at 1300
+#define msgCalErrorTitle 1300
+#define msgCalError 1301
+#define msgCalRemoveTitle 1302
+#define msgCalRemove 1303
+
+// Styles start at 1400
+#define stlWorkday 1400
+#define stlWeekend 1401
+
+// Sheet names start at 1410
+#define nameCalYear 1410
+#define nameCalMonth 1411
+
+#define sProgress 1500
+
+// --------------------------------------------------------------------
+
+String dlgCalTitle
+{
+Text [ en-US ] = "%PRODUCTNAME Calendar";
+};
+
+String dlgCalTitleBack
+{
+Text [ en-US ] = "Back";
+};
+
+String dlgCalTitleOwnData
+{
+Text [ en-US ] = "Personal Data";
+};
+
+String dlgSchdlTitle
+{
+Text [ en-US ] = "Add Holidays to Calendar";
+};
+
+String dlgOK
+{
+Text [ en-US ] = "Create";
+};
+
+String dlgCancel
+{
+Text [ en-US ] = "Cancel";
+};
+
+String dlgCalFrameOption
+{
+Text [ en-US ] = "Calendar";
+};
+
+String dlgCalOptionYear
+{
+Text [ en-US ] = "~Year Overview";
+};
+
+String dlgCalOptionMonth
+{
+Text [ en-US ] = "~Month";
+};
+
+String dlgSchdlDescription
+{
+Text [ en-US ] = "Add holidays for";
+};
+
+String dlgSchdlCountry
+{
+Text [ en-US ] = "USA";
+};
+
+String dlgTime
+{
+Text [ en-US ] = "Time Frame";
+};
+
+String dlgYear
+{
+Text [ en-US ] = "Year";
+};
+
+String dlgCalMonth
+{
+Text [ en-US ] = "Month";
+};
+
+String dlgSpecificBankholidays
+{
+Text [ en-US ] = "-";
+};
+
+String dlgCalOwnData
+{
+Text [ en-US ] = "Personal Data";
+};
+
+String dlgCalInsert
+{
+Text [ en-US ] = "~Insert";
+};
+
+String dlgCalDelete
+{
+Text [ en-US ] = "~Delete";
+};
+
+String dlgCalNewEvent
+{
+Text [ en-US ] = "New Event";
+};
+
+String dlgCalEvent
+{
+Text [ en-US ] = "Event";
+};
+
+String dlgCalEventOnce
+{
+Text [ en-US ] = "One-Time";
+};
+
+String dlgCalEventDay
+{
+Text [ en-US ] = "Day";
+};
+
+String dlgCalEventMonth
+{
+Text [ en-US ] = "Month";
+};
+
+String dlgCalEventYear
+{
+Text [ en-US ] = "Year";
+};
+
+// --------------------------------------------------------------------
+
+String dlgBitmapFile
+{
+Text [ en-US ] = "usa.bmp";
+
+};
+
+// --------------------------------------------------------------------
+
+String dlgState
+{
+Text [ en-US ] = "Public holidays";
+};
+
+
+// --------------------------------------------------------------------
+
+String dlgMonth
+{
+Text [ en-US ] = "January";
+};
+
+String dlgMonth+1
+{
+Text [ en-US ] = "February";
+};
+
+String dlgMonth+2
+{
+Text [ en-US ] = "March";
+};
+
+String dlgMonth+3
+{
+Text [ en-US ] = "April";
+};
+
+String dlgMonth+4
+{
+Text [ en-US ] = "May";
+};
+
+String dlgMonth+5
+{
+Text [ en-US ] = "June";
+};
+
+String dlgMonth+6
+{
+Text [ en-US ] = "July";
+};
+
+String dlgMonth+7
+{
+Text [ en-US ] = "August";
+};
+
+String dlgMonth+8
+{
+Text [ en-US ] = "September";
+};
+
+String dlgMonth+9
+{
+Text [ en-US ] = "October";
+};
+
+String dlgMonth+10
+{
+Text [ en-US ] = "November";
+};
+
+String dlgMonth+11
+{
+Text [ en-US ] = "December";
+};
+
+// --------------------------------------------------------------------
+
+String msgCalErrorTitle
+{
+Text [ en-US ] = "Yearly / Monthly Calendar";
+};
+
+String msgCalError
+{
+Text [ en-US ] = "An error occurred while creating the calendar.";
+};
+
+String msgCalRemoveTitle
+{
+Text [ en-US ] = "Delete event entries";
+};
+
+String msgCalRemove
+{
+Text [ en-US ] = "Delete the selected entries?";
+};
+
+// --------------------------------------------------------------------
+
+String stlWorkday
+{
+Text [ en-US ] = "Workweek";
+};
+
+String stlWeekend
+{
+Text [ en-US ] = "Weekend";
+};
+
+// --------------------------------------------------------------------
+
+String nameCalYear
+{
+Text [ en-US ] = "Calendar";
+};
+
+String nameCalMonth
+{
+Text [ en-US ] = "Month";
+};
+
+
+
+String sProgress
+{
+Text [ en-US ] = "Progress:";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/wizards/source/schedule/script.xlb b/wizards/source/schedule/script.xlb
new file mode 100644
index 000000000000..96dd8da57fc1
--- /dev/null
+++ b/wizards/source/schedule/script.xlb
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Schedule" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="OwnEvents"/>
+ <library:element library:name="CalendarMain"/>
+ <library:element library:name="BankHoliday"/>
+ <library:element library:name="DlgControl"/>
+ <library:element library:name="Language"/>
+ <library:element library:name="CreateTable"/>
+ <library:element library:name="GermanHolidays"/>
+ <library:element library:name="LocalHolidays"/>
+</library:library>
diff --git a/wizards/source/standard/Module1.xba b/wizards/source/standard/Module1.xba
new file mode 100644
index 000000000000..d7e2398cc642
--- /dev/null
+++ b/wizards/source/standard/Module1.xba
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">REM ***** BASIC *****
+
+Sub Main
+
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/standard/delzip b/wizards/source/standard/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/standard/delzip
diff --git a/wizards/source/standard/dialog.xlb b/wizards/source/standard/dialog.xlb
new file mode 100644
index 000000000000..669529dbce6f
--- /dev/null
+++ b/wizards/source/standard/dialog.xlb
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false"/>
diff --git a/wizards/source/standard/makefile.mk b/wizards/source/standard/makefile.mk
new file mode 100644
index 000000000000..7ffef2e63789
--- /dev/null
+++ b/wizards/source/standard/makefile.mk
@@ -0,0 +1,45 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=standard
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+ZIP1TARGET = $(STANDARD_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/standard/script.xlb b/wizards/source/standard/script.xlb
new file mode 100644
index 000000000000..67c9503b785c
--- /dev/null
+++ b/wizards/source/standard/script.xlb
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="Module1"/>
+</library:library>
diff --git a/wizards/source/template/Autotext.xba b/wizards/source/template/Autotext.xba
new file mode 100644
index 000000000000..27a7bca1290e
--- /dev/null
+++ b/wizards/source/template/Autotext.xba
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Autotext" script:language="StarBasic">Option Explicit
+
+Public UserfieldDataType(14) as String
+Public oDocAuto as Object
+Public BulletList(7) as Integer
+Public sTextFieldNotDefined as String
+Public sGeneralError as String
+
+
+Sub Main()
+ Dim oCursor as Object
+ Dim oStyles as Object
+ Dim oSearchDesc as Object
+ Dim oFoundall as Object
+ Dim oFound as Object
+ Dim i as Integer
+ Dim sFoundString as String
+ Dim sFoundContent as String
+ Dim FieldStringThere as String
+ Dim ULStringThere as String
+ Dim PHStringThere as String
+ On Local Error Goto GENERALERROR
+ &apos; Initialization...
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ If InitResources(&quot;&apos;Template&apos;&quot;, &quot;tpl&quot;) Then
+ sGeneralError = GetResText(1302)
+ sTextFieldNotDefined = GetResText(1400)
+ End If
+
+ UserfieldDatatype(0) = &quot;COMPANY&quot;
+ UserfieldDatatype(1) = &quot;FIRSTNAME&quot;
+ UserfieldDatatype(2) = &quot;NAME&quot;
+ UserfieldDatatype(3) = &quot;SHORTCUT&quot;
+ UserfieldDatatype(4) = &quot;STREET&quot;
+ UserfieldDatatype(5) = &quot;COUNTRY&quot;
+ UserfieldDatatype(6) = &quot;ZIP&quot;
+ UserfieldDatatype(7) = &quot;CITY&quot;
+ UserfieldDatatype(8) = &quot;TITLE&quot;
+ UserfieldDatatype(9) = &quot;POSITION&quot;
+ UserfieldDatatype(10) = &quot;PHONE_PRIVATE&quot;
+ UserfieldDatatype(11) = &quot;PHONE_COMPANY&quot;
+ UserfieldDatatype(12) = &quot;FAX&quot;
+ UserfieldDatatype(13) = &quot;EMAIL&quot;
+ UserfieldDatatype(14) = &quot;STATE&quot;
+ BulletList(0) = 149
+ BulletList(1) = 34
+ BulletList(2) = 65
+ BulletList(3) = 61
+ BulletList(4) = 49
+ BulletList(5) = 47
+ BulletList(6) = 79
+ BulletList(7) = 58
+
+ oDocAuto = ThisComponent
+ oStyles = oDocAuto.Stylefamilies.GetByName(&quot;NumberingStyles&quot;)
+
+ &apos; Prepare the Search-Descriptor
+ oSearchDesc = oDocAuto.createsearchDescriptor()
+ oSearchDesc.SearchRegularExpression = True
+ oSearchDesc.SearchWords = True
+ oSearchDesc.SearchString = &quot;&lt;[^&gt;]+&gt;&quot;
+ oFoundall = oDocAuto.FindAll(oSearchDesc)
+
+ &apos;Loop over the foundings
+ For i = 0 To oFoundAll.Count - 1
+ oFound = oFoundAll.GetByIndex(i)
+ sFoundString = oFound.String
+ &apos;Extract the string inside the brackets
+ sFoundContent = FindPartString(sFoundString,&quot;&lt;&quot;,&quot;&gt;&quot;,1)
+ sFoundContent = LTrim(sFoundContent)
+
+ &apos; Define the Cursor and place it on the founding
+ oCursor = oFound.Text.CreateTextCursorbyRange(oFound)
+
+ &apos; Find out, which object is to be created...
+ FieldStringThere = Instr(1,sFoundContent,&quot;Field&quot;)
+ ULStringThere = Instr(1,sFoundContent,&quot;UL&quot;)
+ PHStringThere = Instr(1,sFoundContent,&quot;Placeholder&quot;)
+ If FieldStringThere = 1 Then
+ CreateUserDatafield(oCursor, sFoundContent)
+ ElseIf ULStringThere = 1 Then
+ CreateBullet(oCursor, oStyles)
+ ElseIf PHStringThere = 1 Then
+ CreatePlaceholder(oCursor, sFoundContent)
+ End If
+ Next i
+
+ GENERALERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(sGeneralError,16, GetProductName())
+ Resume LETSGO
+ End If
+ LETSGO:
+End Sub
+
+
+&apos; creates a User - datafield out of a string with the following structure
+&apos; &quot;&lt;field:Company&gt;&quot;
+Sub CreateUserDatafield(oCursor, sFoundContent as String)
+ Dim MaxIndex as Integer
+ Dim sFoundList(3)
+ Dim oUserfield as Object
+ Dim UserInfo as String
+ Dim UserIndex as Integer
+
+ oUserfield = oDocAuto.CreateInstance(&quot;com.sun.star.text.TextField.ExtendedUser&quot;)
+ sFoundList() = ArrayoutofString(sFoundContent,&quot;:&quot;,MaxIndex)
+ UserInfo = UCase(LTrim(sFoundList(1)))
+ UserIndex = IndexinArray(UserInfo, UserfieldDatatype())
+ If UserIndex &lt;&gt; -1 Then
+ oUserField.UserDatatype = UserIndex
+ oCursor.Text.InsertTextContent(oCursor,oUserField,True)
+ oUserField.IsFixed = True
+ Else
+ Msgbox(UserInfo &amp;&quot;: &quot; &amp; sTextFieldNotDefined,16, GetProductName())
+ End If
+End Sub
+
+
+&apos; Creates a Bullet by setting a soft Formatation on the first unsorted List-Templates with a defined
+&apos; Bullet Id
+Sub CreateBullet(oCursor, oStyles as Object)
+ Dim n, m, s as Integer
+ Dim StyleSet as Boolean
+ Dim ostyle as Object
+ Dim StyleName as String
+ Dim alevel()
+ StyleSet = False
+ For s = 0 To Ubound(BulletList())
+ For n = 0 To oStyles.Count - 1
+ ostyle = oStyles.getbyindex(n)
+ StyleName = oStyle.Name
+ alevel() = ostyle.NumberingRules.getbyindex(0)
+ &apos; The properties of the style are stored in a Name-Value-Array()
+ For m = 0 to Ubound(alevel())
+ &apos; Set the first Numbering template without a bulletID
+ If (aLevel(m).Name = &quot;BulletId&quot;) Then
+ If alevel(m).Value = BulletList(s) Then
+ oCursor.NumberingStyle = StyleName
+ oCursor.SetString(&quot;&quot;)
+ exit Sub
+ End if
+ End If
+ Next m
+ Next n
+ Next s
+ If Not StyleSet Then
+ &apos; The Template with the demanded BulletID is not available, so take the first style in the sequence
+ &apos; that has a defined Bullet ID
+ oCursor.NumberingStyleName = oStyles.GetByIndex(5).Name
+ oCursor.SetString(&quot;&quot;)
+ End If
+End Sub
+
+
+&apos; Creates a placeholder out of a string with the following structure:
+&apos;&lt;placeholder:Showtext:Helptext&gt;
+Sub CreatePlaceholder(oCursor as Object, sFoundContent as String)
+ Dim oPlaceholder as Object
+ Dim MaxIndex as Integer
+ Dim sFoundList(3)
+ oPlaceholder = oDocAuto.CreateInstance(&quot;com.sun.star.text.TextField.JumpEdit&quot;)
+ sFoundList() = ArrayoutofString(sFoundContent, &quot;:&quot; &amp; chr(34),MaxIndex)
+ &apos; Delete The Double-quotes
+ oPlaceholder.Hint = DeleteStr(sFoundList(2),chr(34))
+ oPlaceholder.placeholder = DeleteStr(sFoundList(1),chr(34))
+ oCursor.Text.InsertTextContent(oCursor,oPlaceholder,True)
+End Sub
+
+
+</script:module> \ No newline at end of file
diff --git a/wizards/source/template/Correspondence.xba b/wizards/source/template/Correspondence.xba
new file mode 100644
index 000000000000..03c7ef77fbe8
--- /dev/null
+++ b/wizards/source/template/Correspondence.xba
@@ -0,0 +1,286 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Correspondence" script:language="StarBasic">Option Explicit
+
+Public msgNoTextmark$, msgError$
+Public sAddressbook$
+Public Table
+Public sCompany$, sFirstName$, sLastName$, sStreet$, sPostalCode$, sCity$, sState$, sInitials$, sPosition$
+Public DialogExited
+Public oDocument, oText, oBookMarks, oBookMark, oBookMarkCursor, oBookText as Object
+Public bTemplate, bDBFields as Boolean
+
+Sub Main
+ bTemplate = true
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ TemplateDialog = LoadDialog(&quot;Template&quot;, &quot;TemplateDialog&quot;)
+ DialogModel = TemplateDialog.Model
+ DialogModel.Step = 2
+ DialogModel.Optmerge.State = True
+ LoadLanguageCorrespondence()
+ TemplateDialog.Execute
+ TemplateDialog.Dispose()
+End Sub
+
+
+Sub Placeholder
+ bTemplate = false
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ LoadLanguageCorrespondence()
+ bDBFields = false
+ OK()
+End Sub
+
+
+Sub Database
+ bTemplate = false
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ LoadLanguageCorrespondence()
+ bDBFields = true
+ OK()
+End Sub
+
+
+Function LoadLanguageCorrespondence() as Boolean
+ If InitResources(&quot;&apos;Template&apos;&quot;, &quot;tpl&quot;) Then
+ msgNoTextmark$ = GetResText(1303) &amp; Chr(13) &amp; Chr(10) &amp; GetResText(1301)
+ msgError$ = GetResText(1302)
+ If bTemplate Then
+ DialogModel.Title = GetResText(1303+3)
+ DialogModel.CmdCancel.Label = GetResText(1102)
+ DialogModel.CmdCorrGoOn.Label = GetResText(1103)
+ DialogModel.OptSingle.Label = GetResText(1303 + 1)
+ DialogModel.Optmerge.Label = GetResText(1303 + 2)
+ DialogModel.FrmLetter.Label = GetResText(1303)
+ End If
+ LoadLanguageCorrespondence() = True
+ Else
+ msgbox(&quot;Warning: Resource could not be loaded!&quot;)
+ End If
+End Function
+
+
+Function GetFieldName(oFieldKnot as Object, GeneralFieldName as String)
+ If oFieldKnot.HasByName(GeneralFieldName) Then
+ GetFieldName = oFieldKnot.GetByName(GeneralFieldName).AssignedFieldName
+ Else
+ GetFieldName = &quot;&quot;
+ End If
+End Function
+
+
+Sub OK
+Dim ParaBreak
+Dim sDocLang as String
+Dim oSearchDesc as Object
+Dim oFoundAll as Object
+Dim oFound as Object
+Dim sFoundContent as String
+Dim sFoundString as String
+Dim sDBField as String
+Dim i as Integer
+Dim oDBAccess as Object
+Dim oAddressDialog as Object
+Dim oAddressPilot as Object
+Dim oFields as Object
+Dim oDocSettings as Object
+Dim oContext as Object
+Dim bDBvalid as Boolean
+ &apos;On Local Error Goto GENERALERROR
+
+ If bTemplate Then
+ bDBFields = DialogModel.Optmerge.State &apos;database or placeholder
+ TemplateDialog.EndExecute()
+ DialogExited = TRUE
+ End If
+
+ If bDBFields Then
+ oDBAccess = GetRegistryKeyContent(&quot;org.openoffice.Office.DataAccess/AddressBook/&quot;)
+ sAddressbook = oDBAccess.DataSourceName
+
+ bDBvalid = false
+ oContext = createUnoService( &quot;com.sun.star.sdb.DatabaseContext&quot; )
+
+ If (not isNull(oContext)) Then
+ &apos;Is the previously assigned address data source still valid?
+ bDBvalid = oContext.hasByName(sAddressbook)
+ end if
+
+ If (bDBvalid = false) Then
+ oAddressPilot = createUnoService(&quot;com.sun.star.ui.dialogs.AddressBookSourcePilot&quot;)
+ oAddressPilot.execute
+
+ oDBAccess = GetRegistryKeyContent(&quot;org.openoffice.Office.DataAccess/AddressBook/&quot;)
+ sAddressbook = oDBAccess.DataSourceName
+ If sAddressbook = &quot;&quot; Then
+ MsgBox(GetResText(1301))
+ Exit Sub
+ End If
+ End If
+ oFields = oDBAccess.GetByName(&quot;Fields&quot;)
+ Table = oDBAccess.GetByName(&quot;Command&quot;)
+ End If
+
+ ParaBreak = com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK
+ oDocument = ThisComponent
+ If bDBFields Then
+ &apos;set the address db as current db at the document
+ oDocSettings = oDocument.createInstance(&quot;com.sun.star.document.Settings&quot;)
+ oDocSettings.CurrentDatabaseDataSource = sAddressbook
+ oDocSettings.CurrentDatabaseCommand = Table
+ oDocSettings.CurrentDatabaseCommandType = 0
+ End If
+ oBookmarks = oDocument.Bookmarks
+ oText = oDocument.Text
+
+ oSearchDesc = oDocument.createsearchDescriptor()
+ oSearchDesc.SearchRegularExpression = True
+ oSearchDesc.SearchWords = True
+ oSearchDesc.SearchString = &quot;&lt;[^&gt;]+&gt;&quot;
+ oFoundall = oDocument.FindAll(oSearchDesc)
+
+ &apos;Loop over the foundings
+ For i = oFoundAll.Count -1 To 0 Step -1
+ oFound = oFoundAll.GetByIndex(i)
+ sFoundString = oFound.String
+ &apos;Extract the string inside the brackets
+ sFoundContent = FindPartString(sFoundString,&quot;&lt;&quot;,&quot;&gt;&quot;,1)
+ sFoundContent = LTrim(sFoundContent)
+ &apos; Define the Cursor and place it on the founding
+ oBookmarkCursor = oFound.Text.CreateTextCursorbyRange(oFound)
+ oBookText = oFound.Text
+ If bDBFields Then
+ sDBField = GetFieldname(oFields, sFoundContent)
+ If sDBField &lt;&gt; &quot;&quot; Then
+ InsertDBField(sAddressbook, Table, sDBField)
+ Else
+ InsertPlaceholder(sFoundContent)
+ End If
+ Else
+ InsertPlaceholder(sFoundContent)
+ End If
+ Next i
+ If bDBFields Then
+ &apos;Open the DB beamer with the right DB
+ Dim oDisp as Object
+ Dim oTransformer
+ Dim aURL as new com.sun.star.util.URL
+ aURL.complete = &quot;.component:DB/DataSourceBrowser&quot;
+ oTransformer = createUnoService(&quot;com.sun.star.util.URLTransformer&quot;)
+ oTransformer.parseStrict(aURL)
+ oDisp = oDocument.getCurrentController.getFrame.queryDispatch(aURL, &quot;_beamer&quot;, com.sun.star.frame.FrameSearchFlag.CHILDREN + com.sun.star.frame.FrameSearchFlag.CREATE)
+ Dim aArgs(3) as new com.sun.star.beans.PropertyValue
+ aArgs(1).Name = &quot;DataSourceName&quot;
+ aArgs(1).Value = sAddressbook
+ aArgs(2).Name = &quot;CommandType&quot;
+ aArgs(2).Value = com.sun.star.sdb.CommandType.TABLE
+ aArgs(3).Name = &quot;Command&quot;
+ aArgs(3).Value = Table
+ oDisp.dispatch(aURL, aArgs())
+ End If
+
+ GENERALERROR:
+ If Err &lt;&gt; 0 Then
+ Msgbox(msgError$,16, GetProductName())
+ Resume LETSGO
+ End If
+ LETSGO:
+
+End Sub
+
+
+Sub InsertDBField(sDBName as String, sTableName as String, sColName as String)
+Dim oFieldMaster, oField as Object
+ If sColname &lt;&gt; &quot;&quot; Then
+ oFieldMaster = oDocument.createInstance(&quot;com.sun.star.text.FieldMaster.Database&quot;)
+ oField = oDocument.createInstance(&quot;com.sun.star.text.TextField.Database&quot;)
+ oFieldMaster.DataBaseName = sDBName
+ oFieldMaster.DataBaseName = sDBName
+ oFieldMaster.DataTableName = sTableName
+ oFieldMaster.DataColumnName = sColName
+ oField.AttachTextfieldmaster (oFieldMaster)
+ oBookText.InsertTextContent(oBookMarkCursor, oField, True)
+ oField.Content = &quot;&lt;&quot; &amp; sColName &amp; &quot;&gt;&quot;
+ End If
+End Sub
+
+
+Sub InsertPlaceholder(sColName as String)
+Dim oFieldMaster as Object
+Dim bCorrectField as Boolean
+ If sColname &lt;&gt; &quot;&quot; Then
+ bCorrectField = True
+ oFieldMaster = oDocument.createInstance(&quot;com.sun.star.text.TextField.JumpEdit&quot;)
+ Select Case sColName
+ Case &quot;Company&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+1)
+ Case &quot;Department&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+2)
+ Case &quot;FirstName&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+3)
+ Case &quot;LastName&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+4)
+ Case &quot;Street&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+5)
+ Case &quot;Country&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+6)
+ Case &quot;Zip&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+7)
+ Case &quot;City&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+8)
+ Case &quot;Title&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+9)
+ Case &quot;Position&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+10)
+ Case &quot;AddrForm&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+11)
+ Case &quot;Code&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+12)
+ Case &quot;AddrFormMail&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+13)
+ Case &quot;PhonePriv&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+14)
+ Case &quot;PhoneComp&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+15)
+ Case &quot;Fax&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+16)
+ Case &quot;EMail&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+17)
+ Case &quot;URL&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+18)
+ Case &quot;Note&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+19)
+ Case &quot;Altfield1&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+20)
+ Case &quot;Altfield2&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+21)
+ Case &quot;Altfield3&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+22)
+ Case &quot;Altfield4&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+23)
+ Case &quot;Id&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+24)
+ Case &quot;State&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+25)
+ Case &quot;PhoneOffice&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+26)
+ Case &quot;Pager&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+27)
+ Case &quot;PhoneCell&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+28)
+ Case &quot;PhoneOther&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+29)
+ Case &quot;CalendarURL&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+30)
+ Case &quot;InviteParticipant&quot;
+ oFieldMaster.PlaceHolder = getResText(1350+31)
+ Case Else
+ bCorrectField = False
+ End Select
+ If bCorrectField Then
+ oFieldMaster.Hint = getResText(1350)
+ oBookText.InsertTextContent(oBookMarkCursor, oFieldMaster, True)
+ End If
+ End If
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/template/DialogStyles.xdl b/wizards/source/template/DialogStyles.xdl
new file mode 100644
index 000000000000..a28beb14cd27
--- /dev/null
+++ b/wizards/source/template/DialogStyles.xdl
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="DialogStyles" dlg:left="170" dlg:top="93" dlg:width="120" dlg:height="169" dlg:help-url="HID:34650" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="0" dlg:left="5" dlg:top="150" dlg:width="50" dlg:height="13" dlg:help-url="HID:34652" dlg:value="cmdCancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Template.Samples.RestoreCurrentStyles?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdOk" dlg:tab-index="1" dlg:left="65" dlg:top="150" dlg:width="50" dlg:height="12" dlg:help-url="HID:34653" dlg:value="cmdOk">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Template.Samples.CloseStyleDialog?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:menulist dlg:id="lbStyles" dlg:tab-index="2" dlg:left="5" dlg:top="5" dlg:width="110" dlg:height="133" dlg:help-url="HID:34651">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Template.Samples.SelectStyle?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/template/ModuleAgenda.xba b/wizards/source/template/ModuleAgenda.xba
new file mode 100644
index 000000000000..73b0c6cfd8dc
--- /dev/null
+++ b/wizards/source/template/ModuleAgenda.xba
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ModuleAgenda" script:language="StarBasic">&apos; All variables must be declared before use
+Option Explicit
+
+&apos; Used for &quot;disabling&quot; the cancel button of the dialog
+Public DialogExited As Boolean
+Dim DlgAgenda_gMyName as String
+Public TemplateDialog as Object
+Public DialogModel as Object
+Public sTrueContent as String
+Public Bookmarkname as String
+
+
+
+Sub Initialize()
+&apos; User sets the type of minutes
+ BasicLibraries.LoadLibrary( &quot;Tools&quot; )
+ TemplateDialog = LoadDialog(&quot;Template&quot;, &quot;TemplateDialog&quot;)
+ DialogModel = TemplateDialog.Model
+ DialogModel.Step = 1
+ LoadLanguageAgenda()
+ DialogModel.OptAgenda2.State = TRUE
+ GetOptionValues()
+ DialogExited = FALSE
+ TemplateDialog.Execute
+End Sub
+
+
+Sub LoadLanguageAgenda()
+ If InitResources(&quot;&apos;Template&apos;&quot;, &quot;tpl&quot;) Then
+ DlgAgenda_gMyName = GetResText(1200)
+ DialogModel.CmdCancel.Label = GetResText(1102)
+ DialogModel.CmdAgdGoon.Label = GetResText(1103)
+&apos; DlgAgenda_gMsgNoCancel$ = GetResText(1201)
+ DialogModel.FrmAgenda.Label = GetResText(1202)
+ DialogModel.OptAgenda1.Label = GetResText(1203)
+ DialogModel.OptAgenda2.Label = GetResText(1204)
+&apos; DialogModel.OptAgenda1.State = 1
+ End If
+End Sub
+
+
+Sub ModifyTemplate()
+Dim oDocument, oBookmarks, oBookmark, oBookmarkCursor, oTextField as Object
+Dim i as Integer
+
+ oDocument = ThisComponent
+ oBookMarks = oDocument.Bookmarks
+
+ On Local Error Goto NOBOOKMARK
+ TemplateDialog.EndExecute
+ DialogExited = TRUE
+ oBookmarkCursor = CreateBookmarkCursor(oDocument, BookmarkName)
+ oBookmarkCursor.Text.insertString(oBookmarkCursor,&quot;&quot;,True)
+ &apos; Delete all the Bookmarks except for the one named &quot;NextTopic&quot;
+ For i = oBookmarks.Count-1 To 0 Step -1
+ oBookMark = oBookMarks.GetByIndex(i)
+ If oBookMark.Name &lt;&gt; &quot;NextTopic&quot; Then
+ oBookMark.Dispose()
+ End If
+ Next i
+ oBookMarkCursor = CreateBookmarkCursor(oDocument, &quot;NextTopic&quot;)
+ If Not IsNull(oBookMarkCursor) Then
+ oTextField = oBookMarkCursor.TextField
+&apos; oTextField.TrueContent = sTrueContent
+ oTextField.Content = sTrueContent
+ End If
+
+ NOBOOKMARK:
+ If Err &lt;&gt; 0 Then
+ RESUME NEXT
+ End If
+End Sub
+
+
+Sub NewTopic
+&apos; Add a new topic to the agenda
+Dim oDocument, oBookmarks, oBookmark, oBookmarkCursor, oTextField as Object
+Dim oBaustein, oAutoText, oAutoGroup as Object
+Dim i as Integer
+
+ oDocument = ThisComponent
+ oBookMarkCursor = CreateBookMarkCursor(oDocument, &quot;NextTopic&quot;)
+ oTextField = oBookMarkCursor.TextField
+ oAutoText = CreateUnoService(&quot;com.sun.star.text.AutoTextContainer&quot;)
+ If oAutoText.HasbyName(&quot;template&quot;) Then
+ oAutoGroup = oAutoText.GetbyName(&quot;template&quot;)
+ If oAutoGroup.HasbyName(oTextField.Content) Then
+ oBaustein = oAutoGroup.GetbyName(oTextField.Content)
+ oBaustein.ApplyTo(oBookMarkCursor)
+ Else
+ Msgbox(&quot;AutoText &apos;&quot; &amp; oTextField.Content &amp; &quot;&apos; is not existing. Cannot insert additional topic!&quot;)
+ End If
+ Else
+ Msgbox(&quot;AutoGroupField template is not existing. Cannot insert additional topic!&quot;, 16, DlgAgenda_gMyName )
+ End If
+End Sub
+
+
+
+&apos; Add initials, date and time at bottom of agenda, disable and hide command buttons
+Sub FinishAgenda
+Dim BtnAddAgendaTopic As Object
+Dim BtnFinishAgenda As Object
+Dim oUserField, oDateTimeField as Object
+Dim oBookmarkCursor as Object
+Dim oFormats, oLocale as Object
+Dim iDateTimeKey as Integer
+
+ BasicLibraries.LoadLibrary( &quot;Tools&quot; )
+ oDocument = ThisComponent
+
+ oUserField = oDocument.CreateInstance(&quot;com.sun.star.text.TextField.ExtendedUser&quot;)
+ oUserField.UserDatatype = com.sun.star.text.UserDataPart.SHORTCUT
+
+ oDateTimeField = oDocument.CreateInstance(&quot;com.sun.star.text.TextField.DateTime&quot;)
+
+ &apos; Assign Standardformat to Datetime-Textfield
+ oFormats = oDocument.Numberformats
+ oLocale = oDocument.CharLocale
+ iDateTimeKey = oFormats.GetStandardFormat(com.sun.star.util.NumberFormat.DATETIME,oLocale)
+ oDateTimeField.NumberFormat = iDateTimeKey
+
+ oBookmarkCursor = CreateBookmarkCursor(oDocument, &quot;NextTopic&quot;)
+ oBookmarkCursor.Text.InsertTextContent(oBookmarkCursor,oUserField,False)
+ oBookmarkCursor.Text.InsertString(oBookmarkCursor,&quot; &quot;,False)
+ oBookmarkCursor.Text.InsertTextContent(oBookmarkCursor,oDateTimeField,False)
+ BtnAddAgendaTopic = getControlModel(oDocument, &quot;BtnAddAgendaTopic&quot;)
+ BtnFinishAgenda = getControlModel(oDocument, &quot;BtnFinishAgenda&quot;)
+ If Not IsNull(BtnAddAgendaTopic) Then BtnAddAgendaTopic.Enabled = FALSE
+ If Not IsNull(BtnFinishAgenda) Then BtnFinishAgenda.Enabled = FALSE
+End Sub
+
+
+Function CreateBookMarkCursor(oDocument as Object,sBookmarkName as String)
+ oBookMarks = oDocument.Bookmarks
+ If oBookmarks.HasbyName(sBookmarkName) Then
+ oBookMark = oBookMarks.GetbyName(sBookmarkName)
+ CreateBookMarkCursor = oBookMark.Anchor.Text.CreateTextCursorByRange(oBookMark.Anchor)
+ Else
+ Msgbox &quot;Bookmark &quot; &amp; sBookmarkName &amp; &quot; is not defined!&quot;
+ End If
+End Function
+
+
+
+Sub DeleteButtons
+Dim AgendaFinished As Boolean
+Dim BtnAddAgendaTopic As Object
+Dim BtnFinishAgenda As Object
+
+ oDocument = ThisComponent
+
+ BtnAddAgendaTopic = getControlModel(oDocument, &quot;BtnAddAgendaTopic&quot;)
+ BtnFinishAgenda = getControlModel(oDocument, &quot;BtnFinishAgenda&quot;)
+
+ &apos; If buttons could be accessed: If at least one button is disabled, then agenda is finished
+ AgendaFinished = FALSE
+ If Not IsNull(BtnAddAgendaTopic) Then
+ AgendaFinished = (AgendaFinished Or (BtnAddAgendaTopic.Enabled = FALSE))
+ End If
+
+ If Not IsNull(BtnFinishAgenda) Then
+ AgendaFinished = (AgendaFinished Or (BtnFinishAgenda.Enabled = FALSE))
+ End If
+
+ &apos; Delete Buttons, empty rows at end of document &amp; macro bindings if agenda is finished
+ If AgendaFinished Then
+ DisposeControl(oDocument, &quot;BtnAddAgendaTopic&quot;)
+ DisposeControl(oDocument, &quot;BtnFinishAgenda&quot;)
+
+ oBookmarkCursor = CreateBookMarkCursor(oDocument,&quot;NextTopic&quot;)
+ oBookMarkCursor.GotoEnd(True)
+ oBookmarkCursor.Text.insertString(oBookmarkCursor,&quot;&quot;,True)
+
+ AttachBasicMacroToEvent(oDocument,&quot;OnNew&quot;, &quot;&quot;)
+ AttachBasicMacroToEvent(oDocument,&quot;OnSave&quot;, &quot;&quot;)
+ AttachBasicMacroToEvent(oDocument,&quot;OnSaveAs&quot;, &quot;&quot;)
+ AttachBasicMacroToEvent(oDocument,&quot;OnPrint&quot;, &quot;&quot;)
+ End If
+End Sub
+
+
+
+Sub GetOptionValues(Optional aEvent as Object)
+Dim CurTag as String
+Dim Taglist() as String
+ If Not IsMissing(aEvent) Then
+ CurTag = aEvent.Source.Model.Tag
+ Else
+ If DialogModel.OptAgenda1.State = TRUE Then
+ CurTag = DialogModel.OptAgenda1.Tag
+ Else
+ CurTag = DialogModel.OptAgenda2.Tag
+ End If
+ End If
+ Taglist() = ArrayoutOfString(CurTag, &quot;;&quot;)
+ Bookmarkname = TagList(0)
+ sTrueContent = TagList(1)
+End Sub
+
+</script:module> \ No newline at end of file
diff --git a/wizards/source/template/Samples.xba b/wizards/source/template/Samples.xba
new file mode 100644
index 000000000000..b64ddc12db17
--- /dev/null
+++ b/wizards/source/template/Samples.xba
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Samples" script:language="StarBasic">Option Explicit
+
+Const SAMPLES = 1000
+Const STYLES = 1100
+Const aTempFileName = &quot;Berend_Ilko_Tom_Stella_Volker.stc&quot;
+Public Const Twip = 425
+Dim oUcbObject as Object
+Public StylesDir as String
+Public StylesDialog as Object
+Public PathSeparator as String
+Public oFamilies as Object
+Public aOptions(0) as New com.sun.star.beans.PropertyValue
+Public sQueryPath as String
+Public NoArgs()as New com.sun.star.beans.PropertyValue
+Public aTempURL as String
+
+Public Files(100) as String
+
+
+&apos;--------------------------------------------------------------------------------------
+&apos;Miscellaneous Section starts here
+
+Function PrepareForEditing(Optional ByVal oDocument)
+&apos;This sub is called when sample documents are loaded (load event).
+&apos;It checks whether the documents is read-only, in which case it
+&apos;offers the user to create a new (writable) document using the original
+&apos;as a template.
+Dim DocPath as String
+Dim MMessage as String
+Dim MTitle as String
+Dim RValue as Integer
+Dim oNewDocument as Object
+Dim mFileProperties(1) as New com.sun.star.beans.PropertyValue
+ PrepareForEditing = NULL
+ BasicLibraries.LoadLibrary( &quot;Tools&quot; )
+ If InitResources(&quot;&apos;Template&apos;&quot;, &quot;tpl&quot;) then
+ If IsMissing(oDocument) Then
+ oDocument = ThisComponent
+ End If
+ If oDocument.IsReadOnly then
+ MMessage = GetResText(SAMPLES)
+ MTitle = GetResText(SAMPLES + 1)
+ RValue = Msgbox(MMessage, (128+48+1), MTitle)
+ If RValue = 1 Then
+ DocPath = oDocument.URL
+ mFileProperties(0).Name = &quot;AsTemplate&quot;
+ mFileProperties(0).Value = True
+ mFileProperties(1).Name = &quot;MacroExecutionMode&quot;
+ mFileProperties(1).Value = com.sun.star.document.MacroExecMode.USE_CONFIG
+
+ oNewDocument = StarDesktop.LoadComponentFromURL(DocPath,&quot;_default&quot;,0, mFileProperties())
+ PrepareForEditing() = oNewDocument
+ DisposeDocument(oDocument)
+ Else
+ PrepareForEditing() = NULL
+ End If
+ Else
+ PrepareForEditing() = oDocument
+ End If
+ End If
+End Function
+
+
+
+&apos;--------------------------------------------------------------------------------------
+&apos;Calc Style Section starts here
+
+Sub ShowStyles
+&apos;This sub displays the style selection dialog if the current document is a calc document.
+Dim TemplateDir, ActFileTitle, DisplayDummy as String
+Dim sFilterName(0) as String
+Dim StyleNames() as String
+Dim t as Integer
+Dim MaxIndex as Integer
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ If InitResources(&quot;&apos;Template&apos;&quot;, &quot;tpl&quot;) then
+ oDocument = ThisComponent
+ If oDocument.SupportsService(&quot;com.sun.star.sheet.SpreadsheetDocument&quot;) Then
+ ToggleWindow(False)
+ oUcbObject = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ oFamilies = oDocument.StyleFamilies
+ SaveCurrentStyles(oDocument)
+ StylesDialog = LoadDialog(&quot;Template&quot;, &quot;DialogStyles&quot;)
+ DialogModel = StylesDialog.Model
+ TemplateDir = GetPathSettings(&quot;Template&quot;, False, 0)
+ StylesDir = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/styles/&quot;)
+ sQueryPath = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/bitmap/&quot;)
+ DialogModel.Title = GetResText(STYLES)
+ DialogModel.cmdCancel.Label = GetResText(STYLES+2)
+ DialogModel.cmdOk.Label = GetResText(STYLES+3)
+ Stylenames() = ReadDirectories(StylesDir, False, False, True,)
+ MaxIndex = Ubound(Stylenames())
+ BubbleSortList(Stylenames(),True)
+ Dim cStyles(MaxIndex)
+ For t = 0 to MaxIndex
+ Files(t) = StyleNames(t,0)
+ cStyles(t) = StyleNames(t,1)
+ Next t
+ On Local Error Resume Next
+ DialogModel.lbStyles.StringItemList() = cStyles()
+ ToggleWindow(True)
+ StylesDialog.Execute
+ End If
+ End If
+End Sub
+
+
+Sub SelectStyle
+&apos;This sub loads the specific styles from a style document and loads them into the
+&apos;current document.
+Dim StylePath as String
+Dim NewStyle as String
+Dim Position as Integer
+ Position = DialogModel.lbStyles.SelectedItems(0)
+ If Position &gt; -1 Then
+ ToggleWindow(False)
+ StylePath = Files(Position)
+ aOptions(0).Name = &quot;OverwriteStyles&quot;
+ aOptions(0).Value = true
+ oFamilies.loadStylesFromURL(StylePath, aOptions())
+ ToggleWindow(True)
+ End If
+End Sub
+
+
+Sub SaveCurrentStyles(oDocument as Object)
+&apos;This sub stores the current document in the user work directory
+ On Error Goto ErrorOcurred
+ aTempURL = GetPathSettings(&quot;Work&quot;, False)
+ Dim aRightMost as String
+ aRightMost = Right(aTempURL, 1)
+ if aRightMost = &quot;/&quot; Then
+ aTempURL = aTempURL &amp; aTempFileName
+ Else
+ aTempURL = aTempURL &amp; &quot;/&quot; &amp; aTempFileName
+ End If
+
+ While FileExists(aTempURL)
+ aTempURL=Left(aTempURL,(Len(aTempURL)-4)) &amp; &quot;_1.stc&quot;
+ Wend
+ oDocument.storeToURL(aTempURL, NoArgs())
+ Exit Sub
+
+ErrorOcurred:
+ MsgBox(GetResText( STYLES+1 ), 16, GetResText( STYLES ))
+ On Local Error Goto 0
+End Sub
+
+
+Sub RestoreCurrentStyles
+&apos;This sub retrieves the styles from the temporarily save document
+ ToggleWindow(False)
+ On Local Error Goto NoFile
+ If FileExists(aTempURL) Then
+ aOptions(0).Name = &quot;OverwriteStyles&quot;
+ aOptions(0).Value = true
+ oFamilies.LoadStylesFromURL(aTempURL, aOptions())
+ KillTempFile()
+ End If
+ StylesDialog.EndExecute
+ ToggleWindow(True)
+NOFILE:
+ If Err &lt;&gt; 0 Then
+ Msgbox(&quot;Cannot load Document from &quot; &amp; aTempUrl, 64, GetProductname())
+ End If
+ On Local Error Goto 0
+End Sub
+
+
+Sub CloseStyleDialog
+ KillTempFile()
+ DialogExited = True
+ StylesDialog.Endexecute
+End Sub
+
+
+Sub KillTempFile()
+ If oUcbObject.Exists(aTempUrl) Then
+ oUcbObject.Kill(aTempUrl)
+ End If
+End Sub
+
+</script:module> \ No newline at end of file
diff --git a/wizards/source/template/TemplateDialog.xdl b/wizards/source/template/TemplateDialog.xdl
new file mode 100644
index 000000000000..eb4cc696987a
--- /dev/null
+++ b/wizards/source/template/TemplateDialog.xdl
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="TemplateDialog" dlg:left="170" dlg:top="93" dlg:width="220" dlg:height="60" dlg:page="1" dlg:help-url="HID:34630" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="OptAgenda1" dlg:tab-index="0" dlg:left="12" dlg:top="20" dlg:width="144" dlg:height="10" dlg:page="1" dlg:tag="TOP2;PT1" dlg:help-url="HID:34632" dlg:value="OptAgenda1">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Template.ModuleAgenda.GetOptionValues?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="OptAgenda2" dlg:tab-index="1" dlg:left="12" dlg:top="34" dlg:width="144" dlg:height="10" dlg:page="1" dlg:tag="TOP1;PT2" dlg:help-url="HID:34633" dlg:value="OptAgenda2">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:Template.ModuleAgenda.GetOptionValues?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:button dlg:id="CmdCorrGoOn" dlg:tab-index="2" dlg:left="164" dlg:top="11" dlg:width="50" dlg:height="14" dlg:page="2" dlg:help-url="HID:34637" dlg:value="CmdCorrGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="Template.Correspondence.OK" script:language="StarBasic"/>
+ </dlg:button>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="OptSingle" dlg:tab-index="3" dlg:left="12" dlg:top="20" dlg:width="144" dlg:height="10" dlg:page="2" dlg:help-url="HID:34635" dlg:value="OptSingle"/>
+ <dlg:radio dlg:id="Optmerge" dlg:tab-index="4" dlg:left="12" dlg:top="34" dlg:width="144" dlg:height="10" dlg:page="2" dlg:help-url="HID:34636" dlg:value="Optmerge"/>
+ </dlg:radiogroup>
+ <dlg:button dlg:id="CmdAgdGoon" dlg:tab-index="5" dlg:left="164" dlg:top="11" dlg:width="50" dlg:height="14" dlg:page="1" dlg:help-url="HID:34634" dlg:value="CmdAgdGoOn">
+ <script:event script:event-name="on-performaction" script:macro-name="Template.ModuleAgenda.ModifyTemplate" script:language="StarBasic"/>
+ </dlg:button>
+ <dlg:button dlg:id="CmdCancel" dlg:tab-index="6" dlg:left="164" dlg:top="28" dlg:width="50" dlg:height="14" dlg:help-url="HID:34631" dlg:value="CmdCancel" dlg:button-type="cancel">
+ <script:event script:event-name="on-performaction" script:macro-name="Template.ModuleAgenda.DisposeDocument" script:language="StarBasic"/>
+ </dlg:button>
+ <dlg:fixedline dlg:id="FrmLetter" dlg:tab-index="7" dlg:left="6" dlg:top="6" dlg:width="150" dlg:height="10" dlg:page="2" dlg:value="FrmLetter"/>
+ <dlg:fixedline dlg:id="FrmAgenda" dlg:tab-index="8" dlg:left="6" dlg:top="6" dlg:width="150" dlg:height="10" dlg:page="1" dlg:value="FrmAgenda"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/template/delzip b/wizards/source/template/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/template/delzip
diff --git a/wizards/source/template/dialog.xlb b/wizards/source/template/dialog.xlb
new file mode 100644
index 000000000000..c5eed37a26f2
--- /dev/null
+++ b/wizards/source/template/dialog.xlb
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Template" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="DialogStyles"/>
+ <library:element library:name="DlgGreeting"/>
+ <library:element library:name="TemplateDialog"/>
+</library:library>
diff --git a/wizards/source/template/makefile.mk b/wizards/source/template/makefile.mk
new file mode 100644
index 000000000000..82a30d0d25a8
--- /dev/null
+++ b/wizards/source/template/makefile.mk
@@ -0,0 +1,54 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=template
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+#
+# testresource.
+#
+SRS2NAME = template
+SRC2FILES= template.src
+RESLIB2SRSFILES= $(SRS)$/template.srs
+RESLIB2NAME= tpl
+
+ZIP1TARGET = $(TEMPLATE_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/template/script.xlb b/wizards/source/template/script.xlb
new file mode 100644
index 000000000000..c89cc3788875
--- /dev/null
+++ b/wizards/source/template/script.xlb
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+ <library:library xmlns:library="http://openoffice.org/2000/library" library:name="Template" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="ModuleAgenda"/>
+ <library:element library:name="Correspondence"/>
+ <library:element library:name="Samples"/>
+ <library:element library:name="Autotext"/>
+ </library:library>
diff --git a/wizards/source/template/template.src b/wizards/source/template/template.src
new file mode 100644
index 000000000000..61e57f5cc053
--- /dev/null
+++ b/wizards/source/template/template.src
@@ -0,0 +1,358 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/#define SAMPLES 1000
+#define STYLES 1100
+#define AgendaDlgName 1200
+#define AgendaDlgNoCancel 1201
+#define AgendaDlgFrame 1202
+#define AgendaDlgButton1 1203
+#define AgendaDlgButton2 1204
+#define CorrespondenceNoTextmark 1300
+#define CorrespondenceMsgError 1302
+#define CorrespondenceDialog 1303
+#define CorrespondenceFields 1350
+#define TextField 1400
+#define Newsletter 1450
+
+// --------------------------------------------------------------------
+String SAMPLES
+{
+ Text [ en-US ] = "In order to use the full functionality of this sample, create a document that is based on this template.";
+};
+
+String SAMPLES + 1
+{
+ Text [ en-US ] = "Remarks";
+};
+
+// --------------------------------------------------------------------
+String STYLES
+{
+ Text [ en-US ] = "Theme Selection";
+};
+
+String STYLES + 1
+{
+ Text [ en-US ] = "Error while saving the document to the clipboard! The following action cannot be undone.";
+};
+
+String STYLES + 2
+{
+ Text [ en-US ] = "~Cancel";
+};
+
+String STYLES + 3
+{
+ Text [ en-US ] = "~OK";
+};
+
+// --------------------------------------------------------------------
+String AgendaDlgName
+{
+ Text [ en-US ] = "Minutes Template";
+};
+
+String AgendaDlgNoCancel
+{
+ Text [ en-US ] = "An option must be confirmed.";
+};
+
+String AgendaDlgFrame
+{
+ Text [ en-US ] = "Minutes Type";
+};
+
+String AgendaDlgButton1
+{
+ Text [ en-US ] = "Results Minutes";
+};
+
+String AgendaDlgButton2
+{
+ Text [ en-US ] = "Evaluation Minutes";
+};
+
+// --------------------------------------------------------------------
+String CorrespondenceNoTextmark
+{
+ Text [ en-US ] = "The bookmark 'Recipient' is missing.";
+};
+
+String CorrespondenceNoTextmark+1
+{
+ Text [ en-US ] = "Form letter fields can not be included.";
+};
+
+String CorrespondenceMsgError
+{
+ Text [ en-US ] = "An error has occurred.";
+};
+
+String CorrespondenceDialog
+{
+ Text [ en-US ] = "Addressee";
+};
+
+String CorrespondenceDialog+1
+{
+ Text [ en-US ] = "One recipient";
+};
+
+String CorrespondenceDialog+2
+{
+ Text [ en-US ] = "Several recipients (address database)";
+};
+
+String CorrespondenceDialog+3
+{
+ Text [ en-US ] = "Use of This Template";
+};
+
+
+String CorrespondenceFields
+{
+ Text [ en-US ] = "Click placeholder and overwrite";
+};
+
+String CorrespondenceFields+1
+{
+ Text [ en-US ] = "Company";
+};
+
+String CorrespondenceFields+2
+{
+ Text [ en-US ] = "Department";
+};
+
+String CorrespondenceFields+3
+{
+ Text [ en-US ] = "First Name";
+};
+
+String CorrespondenceFields+4
+{
+ Text [ en-US ] = "Last Name";
+};
+
+String CorrespondenceFields+5
+{
+ Text [ en-US ] = "Street";
+};
+
+String CorrespondenceFields+6
+{
+ Text [ en-US ] = "Country";
+};
+
+
+String CorrespondenceFields+7
+{
+ Text [ en-US ] = "ZIP/Postal Code";
+};
+
+String CorrespondenceFields+8
+{
+ Text [ en-US ] = "City";
+};
+
+String CorrespondenceFields+9
+{
+ Text [ en-US ] = "Title";
+};
+
+
+String CorrespondenceFields+10
+{
+ Text [ en-US ] = "Position";
+};
+
+
+String CorrespondenceFields+11
+{
+ Text [ en-US ] = "Form of Address";
+};
+
+
+String CorrespondenceFields+12
+{
+ Text [ en-US ] = "Initials";
+};
+
+
+String CorrespondenceFields+13
+{
+ Text [ en-US ] = "Salutation";
+};
+
+
+String CorrespondenceFields+14
+{
+ Text [ en-US ] = "Home Phone";
+};
+
+
+String CorrespondenceFields+15
+{
+ Text [ en-US ] = "Work Phone";
+};
+
+
+String CorrespondenceFields+16
+{
+ Text [ en-US ] = "Fax";
+};
+
+
+String CorrespondenceFields+17
+{
+ Text [ en-US ] = "E-Mail";
+};
+
+
+String CorrespondenceFields+18
+{
+ Text [ en-US ] = "URL";
+};
+
+
+String CorrespondenceFields+19
+{
+ Text [ en-US ] = "Notes";
+};
+
+
+String CorrespondenceFields+20
+{
+ Text [ en-US ] = "Alt. Field 1";
+};
+
+
+String CorrespondenceFields+21
+{
+ Text [ en-US ] = "Alt. Field 2";
+};
+
+
+String CorrespondenceFields+22
+{
+ Text [ en-US ] = "Alt. Field 3";
+};
+
+
+String CorrespondenceFields+23
+{
+ Text [ en-US ] = "Alt. Field 4";
+};
+
+
+String CorrespondenceFields+24
+{
+ Text [ en-US ] = "ID";
+};
+
+
+String CorrespondenceFields+25
+{
+ Text [ en-US ] = "State";
+};
+
+
+String CorrespondenceFields+26
+{
+ Text [ en-US ] = "Office Phone";
+};
+
+
+String CorrespondenceFields+27
+{
+ Text [ en-US ] = "Pager";
+};
+
+
+String CorrespondenceFields+28
+{
+ Text [ en-US ] = "Mobile Phone";
+};
+
+
+String CorrespondenceFields+29
+{
+ Text [ en-US ] = "Other Phone";
+};
+
+String CorrespondenceFields+30
+{
+ Text [ en-US ] = "Calendar URL";
+};
+
+String CorrespondenceFields+31
+{
+ Text [ en-US ] = "Invite";
+};
+
+
+String TextField
+{
+ Text [ en-US ] = "User data field is not defined!";
+
+};
+
+String Newsletter
+{
+ Text [ en-US ] = "General layout";
+};
+
+
+String Newsletter + 1
+{
+ Text [ en-US ] = "Default layout";
+};
+
+String Newsletter + 2
+{
+ Text [ en-US ] = "Commemorative publication layout";
+};
+
+String Newsletter + 3
+{
+ Text [ en-US ] = "Brochure layout";
+};
+
+String Newsletter + 10
+{
+ Text [ en-US ] = "Format";
+};
+
+String Newsletter + 11
+{
+ Text [ en-US ] = "Single-sided";
+};
+
+String Newsletter + 12
+{
+ Text [ en-US ] = "Double-sided";
+};
+
diff --git a/wizards/source/tools/Debug.xba b/wizards/source/tools/Debug.xba
new file mode 100644
index 000000000000..4ba60ffb8d95
--- /dev/null
+++ b/wizards/source/tools/Debug.xba
@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Debug" script:language="StarBasic">REM ***** BASIC *****
+
+Sub ActivateReadOnlyFlag()
+ SetBasicReadOnlyFlag(True)
+End Sub
+
+
+Sub DeactivateReadOnlyFlag()
+ SetBasicReadOnlyFlag(False)
+End Sub
+
+
+Sub SetBasicReadOnlyFlag(bReadOnly as Boolean)
+Dim i as Integer
+Dim LibName as String
+Dim BasicLibNames() as String
+ BasicLibNames() = BasicLibraries.ElementNames()
+ For i = 0 To Ubound(BasicLibNames())
+ LibName = BasicLibNames(i)
+ If LibName &lt;&gt; &quot;Standard&quot; Then
+ BasicLibraries.SetLibraryReadOnly(LibName, bReadOnly)
+ End If
+ Next i
+End Sub
+
+
+Sub WritedbgInfo(LocObject as Object)
+Dim locUrl as String
+Dim oLocDocument as Object
+Dim oLocText as Object
+Dim oLocCursor as Object
+Dim NoArgs()
+Dim sObjectStrings(2) as String
+Dim sProperties() as String
+Dim n as Integer
+Dim m as Integer
+Dim MaxIndex as Integer
+ sObjectStrings(0) = LocObject.dbg_Properties
+ sObjectStrings(1) = LocObject.dbg_Methods
+ sObjectStrings(2) = LocObject.dbg_SupportedInterfaces
+ LocUrl = &quot;private:factory/swriter&quot;
+ oLocDocument = StarDesktop.LoadComponentFromURL(LocUrl,&quot;_default&quot;,0,NoArgs)
+ oLocText = oLocDocument.text
+ oLocCursor = oLocText.createTextCursor()
+ oLocCursor.gotoStart(False)
+ If Vartype(LocObject) = 9 then &apos; an Object Variable
+ For n = 0 To 2
+ sProperties() = ArrayoutofString(sObjectStrings(n),&quot;;&quot;, MaxIndex)
+ For m = 0 To MaxIndex
+ oLocText.insertString(oLocCursor,sProperties(m),False)
+ oLocText.insertControlCharacter(oLocCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK,False)
+ Next m
+ Next n
+ Elseif Vartype(LocObject) = 8 Then &apos; a String Variable
+ oLocText.insertString(oLocCursor,LocObject,False)
+ ElseIf Vartype(LocObject) = 1 Then
+ Msgbox(&quot;Variable is Null!&quot;, 16, GetProductName())
+ End If
+End Sub
+
+
+Sub WriteDbgString(LocString as string)
+Dim oLocDesktop as object
+Dim LocUrl as String
+Dim oLocDocument as Object
+Dim oLocCursor as Object
+Dim oLocText as Object
+
+ LocUrl = &quot;private:factory/swriter&quot;
+ oLocDocument = StarDesktop.LoadComponentFromURL(LocUrl,&quot;_default&quot;,0,NoArgs)
+ oLocText = oLocDocument.text
+ oLocCursor = oLocText.createTextCursor()
+ oLocCursor.gotoStart(False)
+ oLocText.insertString(oLocCursor,LocString,False)
+End Sub
+
+
+Sub printdbgInfo(LocObject)
+ If Vartype(LocObject) = 9 then
+ Msgbox LocObject.dbg_properties
+ Msgbox LocObject.dbg_methods
+ Msgbox LocObject.dbg_supportedinterfaces
+ Elseif Vartype(LocObject) = 8 Then &apos; a String Variable
+ Msgbox LocObject
+ ElseIf Vartype(LocObject) = 0 Then
+ Msgbox(&quot;Variable is Null!&quot;, 16, GetProductName())
+ Else
+ Msgbox(&quot;Type of Variable: &quot; &amp; Typename(LocObject), 48, GetProductName())
+ End If
+End Sub
+
+
+Sub ShowArray(LocArray())
+Dim i as integer
+Dim msgstring
+ msgstring = &quot;&quot;
+ For i = Lbound(LocArray()) to Ubound(LocArray())
+ msgstring = msgstring + LocArray(i) + chr(13)
+ Next
+ Msgbox msgstring
+End Sub
+
+
+Sub ShowPropertyValues(oLocObject as Object)
+Dim PropName as String
+Dim sValues as String
+ On Local Error Goto NOPROPERTYSETINFO:
+ sValues = &quot;&quot;
+ For i = 0 To Ubound(oLocObject.PropertySetInfo.Properties)
+ Propname = oLocObject.PropertySetInfo.Properties(i).Name
+ sValues = sValues &amp; PropName &amp; chr(13) &amp; &quot; = &quot; &amp; oLocObject.GetPropertyValue(PropName) &amp; chr(13)
+ Next i
+ Msgbox(sValues , 64, GetProductName())
+ Exit Sub
+
+NOPROPERTYSETINFO:
+ Msgbox(&quot;Sorry, No PropertySetInfo attached to the object&quot;, 16, GetProductName())
+ Resume LEAVEPROC
+ LEAVEPROC:
+End Sub
+
+
+Sub ShowNameValuePair(Pair())
+Dim i as Integer
+Dim ShowString as String
+ ShowString = &quot;&quot;
+ On Local Error Resume Next
+ For i = 0 To Ubound(Pair())
+ ShowString = ShowString &amp; Pair(i).Name &amp; &quot; = &quot;
+ ShowString = ShowString &amp; Pair(i).Value &amp; chr(13)
+ Next i
+ Msgbox ShowString
+End Sub
+
+
+&apos; Retrieves all the Elements of aSequence of an object, with the
+&apos; possibility to define a filter(sfilter &lt;&gt; &quot;&quot;)
+Sub ShowElementNames(oLocElements() as Object, Optional sFiltername as String)
+Dim i as Integer
+Dim NameString as String
+ NameString = &quot;&quot;
+ For i = 0 To Ubound(oLocElements())
+ If Not IsMissIng(sFilterName) Then
+ If Instr(1, oLocElements(i), sFilterName) Then
+ NameString = NameString &amp; oLocElements(i) &amp; chr(13)
+ End If
+ Else
+ NameString = NameString &amp; oLocElements(i) &amp; chr(13)
+ End If
+ Next i
+ Msgbox(NameString, 64, GetProductName())
+End Sub
+
+
+&apos; Retrieves all the supported servicenames of an object, with the
+&apos; possibility to define a filter(sfilter &lt;&gt; &quot;&quot;)
+Sub ShowSupportedServiceNames(oLocObject as Object, Optional sFilterName as String)
+ On Local Error Goto NOSERVICENAMES
+ If IsMissing(sFilterName) Then
+ ShowElementNames(oLocobject.SupportedServiceNames())
+ Else
+ ShowElementNames(oLocobject.SupportedServiceNames(), sFilterName)
+ End If
+ Exit Sub
+
+ NOSERVICENAMES:
+ Msgbox(&quot;Sorry, No &apos;SupportedServiceNames&apos; - Property attached to the object&quot;, 16, GetProductName())
+ Resume LEAVEPROC
+ LEAVEPROC:
+End Sub
+
+
+&apos; Retrieves all the available Servicenames of an object, with the
+&apos; possibility to define a filter(sfilter &lt;&gt; &quot;&quot;)
+Sub ShowAvailableServiceNames(oLocObject as Object, Optional sFilterName as String)
+ On Local Error Goto NOSERVICENAMES
+ If IsMissing(sFilterName) Then
+ ShowElementNames(oLocobject.AvailableServiceNames)
+ Else
+ ShowElementNames(oLocobject.AvailableServiceNames, sFilterName)
+ End If
+ Exit Sub
+
+ NOSERVICENAMES:
+ Msgbox(&quot;Sorry, No &apos;AvailableServiceNames&apos; - Property attached to the object&quot;, 16, GetProductName())
+ Resume LEAVEPROC
+ LEAVEPROC:
+End Sub
+
+
+Sub ShowCommands(oLocObject as Object)
+ On Local Error Goto NOCOMMANDS
+ ShowElementNames(oLocObject.QueryCommands)
+ Exit Sub
+ NOCOMMANDS:
+ Msgbox(&quot;Sorry, No &apos;QueryCommands&apos; - Property attached to the object&quot;, 16, GetProductName())
+ Resume LEAVEPROC
+ LEAVEPROC:
+End Sub
+
+
+Sub ProtectCurrentSheets()
+Dim oDocument as Object
+Dim sDocType as String
+Dim iResult as Integer
+Dim oSheets as Object
+Dim i as Integer
+Dim bDoProtect as Boolean
+ oDocument = StarDesktop.ActiveFrame.Controller.Model
+ sDocType = GetDocumentType(oDocument)
+ If sDocType = &quot;scalc&quot; Then
+ oSheets = oDocument.Sheets
+ bDoProtect = False
+ For i = 0 To oSheets.Count-1
+ If Not oSheets(i).IsProtected Then
+ bDoProtect = True
+ End If
+ Next i
+ If bDoProtect Then
+ iResult = Msgbox( &quot;Do you want to protect all sheets of this document?&quot;,35, GetProductName())
+ If iResult = 6 Then
+ ProtectSheets(oDocument.Sheets)
+ End If
+ End If
+ End If
+End Sub
+
+
+Sub FillDocument()
+ oMyReport = createUNOService(&quot;com.sun.star.wizards.report.CallReportWizard&quot;)
+ oMyReport.trigger(&quot;fill&quot;)
+End Sub
+
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tools/DlgOverwriteAll.xdl b/wizards/source/tools/DlgOverwriteAll.xdl
new file mode 100644
index 000000000000..5208ead799d6
--- /dev/null
+++ b/wizards/source/tools/DlgOverwriteAll.xdl
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="DlgOverwriteAll" dlg:left="138" dlg:top="75" dlg:width="230" dlg:height="64" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="lblQueryforSave" dlg:tab-index="0" dlg:left="6" dlg:top="6" dlg:width="218" dlg:height="36" dlg:value="lblQueryforSave" dlg:multiline="true"/>
+ <dlg:button dlg:id="cmdYes" dlg:tab-index="1" dlg:left="6" dlg:top="43" dlg:width="50" dlg:height="14" dlg:value="cmdYes">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tools.ModuleControls.SetOVERWRITEToQuery?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdYesToAll" dlg:tab-index="2" dlg:left="62" dlg:top="43" dlg:width="50" dlg:height="14" dlg:value="cmdYesToAll">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tools.ModuleControls.SetOVERWRITEToAlways?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdNo" dlg:tab-index="3" dlg:left="118" dlg:top="43" dlg:width="50" dlg:height="14" dlg:default="true" dlg:value="cmdNo">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tools.ModuleControls.SetOVERWRITEToNever?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="cmdCancel" dlg:tab-index="4" dlg:left="174" dlg:top="43" dlg:width="50" dlg:height="14" dlg:value="cmdCancel" dlg:button-type="cancel"/>
+ </dlg:bulletinboard>
+</dlg:window>
diff --git a/wizards/source/tools/Listbox.xba b/wizards/source/tools/Listbox.xba
new file mode 100644
index 000000000000..01e62e7d6715
--- /dev/null
+++ b/wizards/source/tools/Listbox.xba
@@ -0,0 +1,353 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Listbox" script:language="StarBasic">Option Explicit
+Dim OriginalList()
+Dim oDialogModel as Object
+
+
+Sub MergeList(SourceListBox() as Object, SecondList() as String)
+Dim i as Integer
+Dim MaxIndex as Integer
+ MaxIndex = Ubound(SecondList())
+ OriginalList() = AddListToList(OriginalList(), SecondList())
+ For i = 0 To MaxIndex
+ SourceListbox = AddSingleItemToListbox(SourceListbox, SecondList(i))
+ Next i
+ Call FormSetMoveRights()
+End Sub
+
+
+Sub RemoveListItems(SourceListbox as Object, TargetListbox as Object, RemoveList() as String)
+Dim i as Integer
+Dim s as Integer
+Dim MaxIndex as Integer
+Dim CopyList()
+ MaxIndex = Ubound(RemoveList())
+ For i = 0 To MaxIndex
+ RemoveListboxItemByName(SourceListbox, RemoveList(i))
+ RemoveListboxItemByName(TargetListbox, RemoveList(i))
+ Next i
+ CopyList() = OriginalList()
+ s = 0
+ MaxIndex = Ubound(CopyList())
+ For i = 0 To MaxIndex
+ If IndexInArray(CopyList(i),RemoveList())= -1 Then
+ OriginalList(s) = CopyList(i)
+ s = s + 1
+ End If
+ Next i
+ ReDim Preserve OriginalList(s-1)
+ Call FormSetMoveRights()
+End Sub
+
+
+&apos; Note Boolean Parameter
+Sub InitializeListboxProcedures(oModel as Object, SourceListbox as Object, TargetListbox as Object)
+Dim EmptyList()
+ Set oDialogModel = oModel
+ OriginalList()= SourceListbox.StringItemList()
+ TargetListbox.StringItemList() = EmptyList()
+End Sub
+
+
+Sub CopyListboxItems(SourceListbox as Object, TargetListbox As Object)
+Dim NullArray()
+ TargetListbox.StringItemList() = OriginalList()
+ SourceListbox.StringItemList() = NullArray()
+End Sub
+
+
+Sub FormMoveSelected()
+ Call MoveSelectedListBox(oDialogModel.lstFields, oDialogModel.lstSelFields)
+ Call FormSetMoveRights()
+ oDialogModel.lstSelFields.Tag = True
+End Sub
+
+
+Sub FormMoveAll()
+ Call CopyListboxItems(oDialogModel.lstFields, oDialogModel.lstSelFields)
+ Call FormSetMoveRights()
+ oDialogModel.lstSelFields.Tag = True
+End Sub
+
+
+Sub FormRemoveSelected()
+ Call MoveOrderedSelectedListbox(oDialogModel.lstFields, oDialogModel.lstSelFields, False)
+ Call FormSetMoveRights()
+ oDialogModel.lstSelFields.Tag = True
+End Sub
+
+
+Sub FormRemoveAll()
+ Call MoveOrderedSelectedListbox(oDialogModel.lstFields, oDialogModel.lstSelFields, True)
+ Call FormSetMoveRights()
+ oDialogModel.lstSelFields.Tag = 1
+End Sub
+
+
+Sub MoveSelectedListBox(SourceListbox as Object, TargetListbox as Object)
+Dim MaxCurTarget as Integer
+Dim MaxSourceSelected as Integer
+Dim n as Integer
+Dim m as Integer
+Dim CurIndex
+Dim iOldTargetSelect as Integer
+Dim iOldSourceSelect as Integer
+ MaxCurTarget = Ubound(TargetListbox.StringItemList())
+ MaxSourceSelected = Ubound(SourceListbox.SelectedItems())
+ Dim TargetList(MaxCurTarget+MaxSourceSelected+1)
+ If MaxSourceSelected &gt; -1 Then
+ iOldSourceSelect = SourceListbox.SelectedItems(0)
+ If Ubound(TargetListbox.SelectedItems()) &gt; -1 Then
+ iOldTargetSelect = TargetListbox.SelectedItems(0)
+ Else
+ iOldTargetSelect = -1
+ End If
+ For n = 0 To MaxCurTarget
+ TargetList(n) = TargetListbox.StringItemList(n)
+ Next n
+ For m = 0 To MaxSourceSelected
+ CurIndex = SourceListbox.SelectedItems(m)
+ TargetList(n) = SourceListbox.StringItemList(CurIndex)
+ n = n + 1
+ Next m
+ TargetListBox.StringItemList() = TargetList()
+ SourceListbox.StringItemList() = RemoveSelected (SourceListbox)
+ SetNewSelection(SourceListbox, iOldSourceSelect)
+ SetNewSelection(TargetListbox, iOldTargetSelect)
+ End If
+End Sub
+
+
+
+Sub MoveOrderedSelectedListbox(lstSource as Object, lstTarget as Object, bMoveAll as Boolean)
+Dim NullArray()
+Dim MaxSelected as Integer
+Dim MaxSourceIndex as Integer
+Dim MaxOriginalIndex as Integer
+Dim MaxNewIndex as Integer
+Dim n as Integer
+Dim m as Integer
+Dim CurIndex as Integer
+Dim SearchString as String
+Dim SourceList() as String
+Dim iOldTargetSelect as Integer
+Dim iOldSourceSelect as Integer
+ If bMoveAll Then
+ lstSource.StringItemList() = OriginalList()
+ lstTarget.StringItemList() = NullArray()
+ Else
+ MaxOriginalIndex = Ubound(OriginalList())
+ MaxSelected = Ubound(lstTarget.SelectedItems())
+ iOldTargetSelect = lstTarget.SelectedItems(0)
+ If Ubound(lstSource.SelectedItems()) &gt; -1 Then
+ iOldSourceSelect = lstSource.SelectedItems(0)
+ End If
+ Dim SelList(MaxSelected)
+ For n = 0 To MaxSelected
+ CurIndex = lstTarget.SelectedItems(n)
+ SelList(n) = lstTarget.StringItemList(CurIndex)
+ Next n
+ SourceList() = lstSource.StringItemList()
+ MaxSourceIndex = Ubound(lstSource.StringItemList())
+ MaxNewIndex = MaxSelected + MaxSourceIndex + 1
+ Dim NewSourceList(MaxNewIndex)
+ m = 0
+ For n = 0 To MaxOriginalIndex
+ SearchString = OriginalList(n)
+ If IndexinArray(SearchString, SelList()) &lt;&gt; -1 Then
+ NewSourceList(m) = SearchString
+ m = m + 1
+ ElseIf IndexinArray(SearchString, SourceList()) &lt;&gt; -1 Then
+ NewSourceList(m) = SearchString
+ m = m + 1
+ End If
+ Next n
+ lstSource.StringItemList() = NewSourceList()
+ lstTarget.StringItemList() = RemoveSelected(lstTarget)
+ End If
+ SetNewSelection(lstSource, iOldSourceSelect)
+ SetNewSelection(lstTarget, iOldTargetSelect)
+
+End Sub
+
+
+Function RemoveSelected(oListbox as Object)
+Dim MaxIndex as Integer
+Dim MaxSelected as Integer
+Dim n as Integer
+Dim m as Integer
+Dim CurIndex as Integer
+Dim CurItem as String
+Dim ResultArray()
+ MaxIndex = Ubound(oListbox.StringItemList())
+ MaxSelected = Ubound(oListbox.SelectedItems())
+ Dim LocItemList(MaxIndex)
+ LocItemList() = oListbox.StringItemList()
+ If MaxSelected &gt; -1 Then
+ For n = 0 To MaxSelected
+ CurIndex = oListbox.SelectedItems(n)
+ LocItemList(CurIndex) = &quot;&quot;
+ Next n
+ If MaxIndex &gt; 0 Then
+ ReDim ResultArray(MaxIndex - MaxSelected - 1)
+ m = 0
+ For n = 0 To MaxIndex
+ CurItem = LocItemList(n)
+ If CurItem &lt;&gt; &quot;&quot; Then
+ ResultArray(m) = CurItem
+ m = m + 1
+ End If
+ Next n
+ End If
+ RemoveSelected = ResultArray()
+ Else
+ RemoveSelected = oListbox.StringItemList()
+ End If
+End Function
+
+
+Sub SetNewSelection(oListBox as Object, iLastSelection as Integer)
+Dim MaxIndex as Integer
+Dim SelIndex as Integer
+Dim SelList(0) as Integer
+ MaxIndex = Ubound(oListBox.StringItemList())
+ If MaxIndex &gt; -1 AND iLastSelection &gt; -1 Then
+ If iLastSelection &gt; MaxIndex Then
+ Selindex = MaxIndex
+ Else
+ SelIndex = iLastSelection
+ End If
+ Sellist(0) = SelIndex
+ oListBox.SelectedItems() = SelList()
+ End If
+End Sub
+
+
+Sub ToggleListboxControls(oDialogModel as Object, bDoEnable as Boolean)
+ With oDialogModel
+ .lblFields.Enabled = bDoEnable
+ .lblSelFields.Enabled = bDoEnable
+&apos; .lstTables.Enabled = bDoEnable
+ .lstFields.Enabled = bDoEnable
+ .lstSelFields.Enabled = bDoEnable
+ .cmdRemoveAll.Enabled = bDoEnable
+ .cmdRemoveSelected.Enabled = bDoEnable
+ .cmdMoveAll.Enabled = bDoEnable
+ .cmdMoveSelected.Enabled = bDoEnable
+ End With
+ If bDoEnable Then
+ FormSetMoveRights()
+ End If
+End Sub
+
+
+&apos; Enable or disable the buttons used for moving the available
+&apos; fields between the two list boxes.
+Sub FormSetMoveRights()
+Dim bIsFieldSelected as Boolean
+Dim bSelectSelected as Boolean
+Dim FieldCount as Integer
+Dim SelectCount as Integer
+ bIsFieldSelected = Ubound(oDialogModel.lstFields.SelectedItems()) &lt;&gt; -1
+ FieldCount = Ubound(oDialogModel.lstFields.StringItemList()) + 1
+ bSelectSelected = Ubound(oDialogModel.lstSelFields.SelectedItems()) &gt; -1
+ SelectCount = Ubound(oDialogModel.lstSelFields.StringItemList()) + 1
+ oDialogModel.cmdRemoveAll.Enabled = SelectCount&gt;=1
+ oDialogModel.cmdRemoveSelected.Enabled = bSelectSelected
+ oDialogModel.cmdMoveAll.Enabled = FieldCount &gt;=1
+ oDialogModel.cmdMoveSelected.Enabled = bIsFieldSelected
+ oDialogModel.cmdGoOn.Enabled = SelectCount&gt;=1
+ &apos; This flag is set to &apos;1&apos; when the lstSelFields has been modified
+End Sub
+
+
+Function AddSingleItemToListbox(ByVal oListbox as Object, ListItem as String, Optional iSelIndex) as Object
+Dim MaxIndex as Integer
+Dim i as Integer
+
+ MaxIndex = Ubound(oListbox.StringItemList())
+Dim LocList(MaxIndex + 1)
+&apos; Todo: This goes faster with the Redim LocList(MaxIndex + 1) Preserve function
+ For i = 0 To MaxIndex
+ LocList(i) = oListbox.StringItemList(i)
+ Next i
+ LocList(MaxIndex + 1) = ListItem
+ oListbox.StringItemList() = LocList()
+ If Not IsMissing(iSelIndex) Then
+ SelectListboxItem(oListbox, iSelIndex)
+ End If
+ AddSingleItemToListbox() = oListbox
+End Function
+
+
+Sub EmptyListbox(oListbox as Object)
+Dim NullList() as String
+ oListbox.StringItemList() = NullList()
+End Sub
+
+
+Sub SelectListboxItem(oListbox as Object, iSelIndex as Integer)
+Dim LocSelList(0) as Integer
+ If iSelIndex &lt;&gt; -1 Then
+ LocSelList(0) = iSelIndex
+ oListbox.SelectedItems() = LocSelList()
+ End If
+End Sub
+
+
+Function GetSelectedListboxItems(oListbox as Object)
+Dim SelList(Ubound(oListBox.SelectedItems())) as String
+Dim i as Integer
+Dim CurIndex as Integer
+ For i = 0 To Ubound(oListbox.SelectedItems())
+ CurIndex = oListbox.SelectedItems(i)
+ SelList(i) = oListbox.StringItemList(CurIndex)
+ Next i
+ GetSelectedListboxItems() = SelList()
+End Function
+
+
+&apos; Note: When using this Sub it must be ensured that the
+&apos; &apos;RemoveItem&apos; appears only only once in the Listbox
+Sub RemoveListboxItemByName(oListbox as Object, RemoveItem as String)
+Dim OldList() as String
+Dim NullList() as String
+Dim i as Integer
+Dim a as Integer
+Dim MaxIndex as Integer
+ OldList = oListbox.StringItemList()
+ MaxIndex = Ubound(OldList())
+ If IndexInArray(RemoveItem, OldList()) &lt;&gt; -1 Then
+ If MaxIndex &gt; 0 Then
+ a = 0
+ Dim NewList(MaxIndex -1)
+ For i = 0 To MaxIndex
+ If RemoveItem &lt;&gt; OldList(i) Then
+ NewList(a) = OldList(i)
+ a = a + 1
+ End If
+ Next i
+ oListbox.StringItemList() = NewList()
+ Else
+ oListBox.StringItemList() = NullList()
+ End If
+ End If
+End Sub
+
+
+Function GetItemPos(oListBox as Object, sItem as String)
+Dim ItemList()
+Dim MaxIndex as Integer
+Dim i as Integer
+ ItemList() = oListBox.StringItemList()
+ MaxIndex = Ubound(ItemList())
+ For i = 0 To MaxIndex
+ If sItem = ItemList(i) Then
+ GetItemPos() = i
+ Exit Function
+ End If
+ Next i
+ GetItemPos() = -1
+End Function
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tools/Misc.xba b/wizards/source/tools/Misc.xba
new file mode 100644
index 000000000000..7eca46671f12
--- /dev/null
+++ b/wizards/source/tools/Misc.xba
@@ -0,0 +1,817 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Misc" script:language="StarBasic">REM ***** BASIC *****
+
+Const SBSHARE = 0
+Const SBUSER = 1
+Dim Taskindex as Integer
+Dim oResSrv as Object
+
+Sub Main()
+Dim PropList(3,1)&apos; as String
+ PropList(0,0) = &quot;URL&quot;
+ PropList(0,1) = &quot;sdbc:odbc:Erica_Test_Unicode&quot;
+ PropList(1,0) = &quot;User&quot;
+ PropList(1,1) = &quot;extra&quot;
+ PropList(2,0) = &quot;Password&quot;
+ PropList(2,1) = &quot;extra&quot;
+ PropList(3,0) = &quot;IsPasswordRequired&quot;
+ PropList(3,1) = True
+End Sub
+
+
+Function RegisterNewDataSource(DSName as String, PropertyList(), Optional DriverProperties() as New com.sun.star.beans.PropertyValue)
+Dim oDataSource as Object
+Dim oDBContext as Object
+Dim oPropInfo as Object
+Dim i as Integer
+ oDBContext = createUnoService(&quot;com.sun.star.sdb.DatabaseContext&quot;)
+ oDataSource = createUnoService(&quot;com.sun.star.sdb.DataSource&quot;)
+ For i = 0 To Ubound(PropertyList(), 1)
+ sPropName = PropertyList(i,0)
+ sPropValue = PropertyList(i,1)
+ oDataSource.SetPropertyValue(sPropName,sPropValue)
+ Next i
+ If Not IsMissing(DriverProperties()) Then
+ oDataSource.Info() = DriverProperties()
+ End If
+ oDBContext.RegisterObject(DSName, oDataSource)
+ RegisterNewDataSource () = oDataSource
+End Function
+
+
+&apos; Connects to a registered Database
+Function ConnecttoDatabase(DSName as String, UserID as String, Password as String, Optional Propertylist(), Optional DriverProperties() as New com.sun.star.beans.PropertyValue)
+Dim oDBContext as Object
+Dim oDBSource as Object
+&apos; On Local Error Goto NOCONNECTION
+ oDBContext = CreateUnoService(&quot;com.sun.star.sdb.DatabaseContext&quot;)
+ If oDBContext.HasbyName(DSName) Then
+ oDBSource = oDBContext.GetByName(DSName)
+ ConnectToDatabase = oDBSource.GetConnection(UserID, Password)
+ Else
+ If Not IsMissing(Namelist()) Then
+ If Not IsMissing(DriverProperties()) Then
+ RegisterNewDataSource(DSName, PropertyList(), DriverProperties())
+ Else
+ RegisterNewDataSource(DSName, PropertyList())
+ End If
+ oDBSource = oDBContext.GetByName(DSName)
+ ConnectToDatabase = oDBSource.GetConnection(UserID, Password)
+ Else
+ Msgbox(&quot;DataSource &quot; &amp; DSName &amp; &quot; is not registered&quot; , 16, GetProductname())
+ ConnectToDatabase() = NULL
+ End If
+ End If
+NOCONNECTION:
+ If Err &lt;&gt; 0 Then
+ Msgbox(Error$, 16, GetProductName())
+ Resume LEAVESUB
+ LEAVESUB:
+ End If
+End Function
+
+
+Function GetStarOfficeLocale() as New com.sun.star.lang.Locale
+Dim aLocLocale As New com.sun.star.lang.Locale
+Dim sLocale as String
+Dim sLocaleList(1)
+Dim oMasterKey
+ oMasterKey = GetRegistryKeyContent(&quot;org.openoffice.Setup/L10N/&quot;)
+ sLocale = oMasterKey.getByName(&quot;ooLocale&quot;)
+ sLocaleList() = ArrayoutofString(sLocale, &quot;-&quot;)
+ aLocLocale.Language = sLocaleList(0)
+ If Ubound(sLocaleList()) &gt; 0 Then
+ aLocLocale.Country = sLocaleList(1)
+ End If
+ GetStarOfficeLocale() = aLocLocale
+End Function
+
+
+Function GetRegistryKeyContent(sKeyName as string, Optional bforUpdate as Boolean)
+Dim oConfigProvider as Object
+Dim aNodePath(0) as new com.sun.star.beans.PropertyValue
+ oConfigProvider = createUnoService(&quot;com.sun.star.configuration.ConfigurationProvider&quot;)
+ aNodePath(0).Name = &quot;nodepath&quot;
+ aNodePath(0).Value = sKeyName
+ If IsMissing(bForUpdate) Then
+ GetRegistryKeyContent() = oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationAccess&quot;, aNodePath())
+ Else
+ If bForUpdate Then
+ GetRegistryKeyContent() = oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationUpdateAccess&quot;, aNodePath())
+ Else
+ GetRegistryKeyContent() = oConfigProvider.createInstanceWithArguments(&quot;com.sun.star.configuration.ConfigurationAccess&quot;, aNodePath())
+ End If
+ End If
+End Function
+
+
+Function GetProductname() as String
+Dim oProdNameAccess as Object
+Dim sVersion as String
+Dim sProdName as String
+ oProdNameAccess = GetRegistryKeyContent(&quot;org.openoffice.Setup/Product&quot;)
+ sProdName = oProdNameAccess.getByName(&quot;ooName&quot;)
+ sVersion = oProdNameAccess.getByName(&quot;ooSetupVersion&quot;)
+ GetProductName = sProdName &amp; sVersion
+End Function
+
+
+&apos; Opens a Document, checks beforehand, wether it has to be loaded
+&apos; or wether it is already on the desktop.
+&apos; If the parameter bDisposable is set to False then then returned document
+&apos; should not be disposed afterwards, because it is already opened.
+Function OpenDocument(DocPath as String, Args(), Optional bDisposable as Boolean)
+Dim oComponents as Object
+Dim oComponent as Object
+ &apos; Search if one of the active Components ist the one that you search for
+ oComponents = StarDesktop.Components.CreateEnumeration
+ While oComponents.HasmoreElements
+ oComponent = oComponents.NextElement
+ If hasUnoInterfaces(oComponent,&quot;com.sun.star.frame.XModel&quot;) then
+ If UCase(oComponent.URL) = UCase(DocPath) then
+ OpenDocument() = oComponent
+ If Not IsMissing(bDisposable) Then
+ bDisposable = False
+ End If
+ Exit Function
+ End If
+ End If
+ Wend
+ If Not IsMissing(bDisposable) Then
+ bDisposable = True
+ End If
+ OpenDocument() = StarDesktop.LoadComponentFromURL(DocPath,&quot;_default&quot;,0,Args())
+End Function
+
+
+Function TaskonDesktop(DocPath as String) as Boolean
+Dim oComponents as Object
+Dim oComponent as Object
+ &apos; Search if one of the active Components ist the one that you search for
+ oComponents = StarDesktop.Components.CreateEnumeration
+ While oComponents.HasmoreElements
+ oComponent = oComponents.NextElement
+ If hasUnoInterfaces(oComponent,&quot;com.sun.star.frame.XModel&quot;) then
+ If UCase(oComponent.URL) = UCase(DocPath) then
+ TaskonDesktop = True
+ Exit Function
+ End If
+ End If
+ Wend
+ TaskonDesktop = False
+End Function
+
+
+&apos; Retrieves a FileName out of a StarOffice-Document
+Function RetrieveFileName(LocDoc as Object)
+Dim LocURL as String
+Dim LocURLArray() as String
+Dim MaxArrIndex as integer
+
+ LocURL = LocDoc.Url
+ LocURLArray() = ArrayoutofString(LocURL,&quot;/&quot;,MaxArrIndex)
+ RetrieveFileName = LocURLArray(MaxArrIndex)
+End Function
+
+
+&apos; Gets a special configured PathSetting
+Function GetPathSettings(sPathType as String, Optional bshowall as Boolean, Optional ListIndex as integer) as String
+Dim oSettings, oPathSettings as Object
+Dim sPath as String
+Dim PathList() as String
+Dim MaxIndex as Integer
+Dim oPS as Object
+
+ oPS = createUnoService(&quot;com.sun.star.util.PathSettings&quot;)
+
+ If Not IsMissing(bShowall) Then
+ If bShowAll Then
+ ShowPropertyValues(oPS)
+ Exit Function
+ End If
+ End If
+ sPath = oPS.getPropertyValue(sPathType)
+ If Not IsMissing(ListIndex) Then
+ &apos; Share and User-Directory
+ If Instr(1,sPath,&quot;;&quot;) &lt;&gt; 0 Then
+ PathList = ArrayoutofString(sPath,&quot;;&quot;, MaxIndex)
+ If ListIndex &lt;= MaxIndex Then
+ sPath = PathList(ListIndex)
+ Else
+ Msgbox(&quot;String Cannot be analyzed!&quot; &amp; sPath , 16, GetProductName())
+ End If
+ End If
+ End If
+ If Instr(1, sPath, &quot;;&quot;) = 0 Then
+ GetPathSettings = ConvertToUrl(sPath)
+ Else
+ GetPathSettings = sPath
+ End If
+
+End Function
+
+
+
+&apos; Gets the fully qualified path to a subdirectory of the
+&apos; Template Directory, e. g. with the parameter &quot;wizard/bitmap&quot;
+&apos; The parameter must be passed over in Url-scription
+&apos; The return-Value is in Urlscription
+Function GetOfficeSubPath(sOfficePath as String, ByVal sSubDir as String)
+Dim sOfficeString as String
+Dim sOfficeList() as String
+Dim sOfficeDir as String
+Dim sBigDir as String
+Dim i as Integer
+Dim MaxIndex as Integer
+Dim oUcb as Object
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ sOfficeString = GetPathSettings(sOfficePath)
+ If Right(sSubDir,1) &lt;&gt; &quot;/&quot; Then
+ sSubDir = sSubDir &amp; &quot;/&quot;
+ End If
+ sOfficeList() = ArrayoutofString(sOfficeString,&quot;;&quot;, MaxIndex)
+ For i = 0 To MaxIndex
+ sOfficeDir = ConvertToUrl(sOfficeList(i))
+ If Right(sOfficeDir,1) &lt;&gt; &quot;/&quot; Then
+ sOfficeDir = sOfficeDir &amp; &quot;/&quot;
+ End If
+ sBigDir = sOfficeDir &amp; sSubDir
+ If oUcb.Exists(sBigDir) Then
+ GetOfficeSubPath() = sBigDir
+ Exit Function
+ End If
+ Next i
+ ShowNoOfficePathError()
+ GetOfficeSubPath = &quot;&quot;
+End Function
+
+
+Sub ShowNoOfficePathError()
+Dim ProductName as String
+Dim sError as String
+Dim bResObjectexists as Boolean
+Dim oLocResSrv as Object
+ bResObjectexists = not IsNull(oResSrv)
+ If bResObjectexists Then
+ oLocResSrv = oResSrv
+ End If
+ If InitResources(&quot;Tools&quot;, &quot;com&quot;) Then
+ ProductName = GetProductName()
+ sError = GetResText(1006)
+ sError = ReplaceString(sError, ProductName, &quot;%PRODUCTNAME&quot;)
+ sError = ReplaceString(sError, chr(13), &quot;&lt;BR&gt;&quot;)
+ MsgBox(sError, 16, ProductName)
+ End If
+ If bResObjectexists Then
+ oResSrv = oLocResSrv
+ End If
+
+End Sub
+
+
+Function InitResources(Description, ShortDescription as String) as boolean
+ On Error Goto ErrorOcurred
+ oResSrv = createUnoService( &quot;com.sun.star.resource.VclStringResourceLoader&quot; )
+ If (IsNull(oResSrv)) then
+ InitResources = FALSE
+ MsgBox( Description &amp; &quot;: No resource loader found&quot;, 16, GetProductName())
+ Else
+ InitResources = TRUE
+ oResSrv.FileName = ShortDescription
+ End If
+ Exit Function
+ErrorOcurred:
+ Dim nSolarVer
+ InitResources = FALSE
+ nSolarVer = GetSolarVersion()
+ MsgBox(&quot;Resource file missing (&quot; &amp; ShortDescription &amp; trim(str(nSolarVer)) + &quot;*.res)&quot;, 16, GetProductName())
+ Resume CLERROR
+ CLERROR:
+End Function
+
+
+Function GetResText( nID as integer ) As string
+ On Error Goto ErrorOcurred
+ If Not IsNull(oResSrv) Then
+ GetResText = oResSrv.getString( nID )
+ Else
+ GetResText = &quot;&quot;
+ End If
+ Exit Function
+ErrorOcurred:
+ GetResText = &quot;&quot;
+ MsgBox(&quot;Resource with ID =&quot; + str( nID ) + &quot; not found!&quot;, 16, GetProductName())
+ Resume CLERROR
+ CLERROR:
+End Function
+
+
+Function CutPathView(sDocUrl as String, Optional PathLen as Integer)
+Dim sViewPath as String
+Dim FileName as String
+Dim iFileLen as Integer
+ sViewPath = ConvertfromURL(sDocURL)
+ iViewPathLen = Len(sViewPath)
+ If iViewPathLen &gt; 60 Then
+ FileName = FileNameoutofPath(sViewPath, &quot;/&quot;)
+ iFileLen = Len(FileName)
+ If iFileLen &lt; 44 Then
+ sViewPath = Left(sViewPath,57-iFileLen-10) &amp; &quot;...&quot; &amp; Right(sViewPath,iFileLen + 10)
+ Else
+ sViewPath = Left(sViewPath,27) &amp; &quot; ... &quot; &amp; Right(sViewPath,28)
+ End If
+ End If
+ CutPathView = sViewPath
+End Function
+
+
+&apos; Deletes the content of all cells that are softformatted according
+&apos; to the &apos;InputStyleName&apos;
+Sub DeleteInputCells(oSheet as Object, InputStyleName as String)
+Dim oRanges as Object
+Dim oRange as Object
+ oRanges = oSheet.CellFormatRanges.createEnumeration
+ While oRanges.hasMoreElements
+ oRange = oRanges.NextElement
+ If Instr(1,oRange.CellStyle, InputStyleName) &lt;&gt; 0 Then
+ Call ReplaceRangeValues(oRange, &quot;&quot;)
+ End If
+ Wend
+End Sub
+
+
+&apos; Inserts a certain String to all cells of a Range that ist passed over
+&apos; either as an object or as the RangeName
+Sub ChangeValueofRange(oSheet as Object, Range, ReplaceValue, Optional StyleName as String)
+Dim oCellRange as Object
+ If Vartype(Range) = 8 Then
+ &apos; Get the Range out of the Rangename
+ oCellRange = oSheet.GetCellRangeByName(Range)
+ Else
+ &apos; The range is passed over as an object
+ Set oCellRange = Range
+ End If
+ If IsMissing(StyleName) Then
+ ReplaceRangeValues(oCellRange, ReplaceValue)
+ Else
+ If Instr(1,oCellRange.CellStyle,StyleName) Then
+ ReplaceRangeValues(oCellRange, ReplaceValue)
+ End If
+ End If
+End Sub
+
+
+Sub ReplaceRangeValues(oRange as Object, ReplaceValue)
+Dim oRangeAddress as Object
+Dim ColCount as Integer
+Dim RowCount as Integer
+Dim i as Integer
+ oRangeAddress = oRange.RangeAddress
+ ColCount = oRangeAddress.EndColumn - oRangeAddress.StartColumn
+ RowCount = oRangeAddress.EndRow - oRangeAddress.StartRow
+ Dim FillArray(RowCount) as Variant
+ Dim sLine(ColCount) as Variant
+ For i = 0 To ColCount
+ sLine(i) = ReplaceValue
+ Next i
+ For i = 0 To RowCount
+ FillArray(i) = sLine()
+ Next i
+ oRange.DataArray = FillArray()
+End Sub
+
+
+&apos; Returns the Value of the first cell of a Range
+Function GetValueofCellbyName(oSheet as Object, sCellName as String)
+Dim oCell as Object
+ oCell = GetCellByName(oSheet, sCellName)
+ GetValueofCellbyName = oCell.Value
+End Function
+
+
+Function DuplicateRow(oSheet as Object, RangeName as String)
+Dim oRange as Object
+Dim oCell as Object
+Dim oCellAddress as New com.sun.star.table.CellAddress
+Dim oRangeAddress as New com.sun.star.table.CellRangeAddress
+ oRange = oSheet.GetCellRangeByName(RangeName)
+ oRangeAddress = oRange.RangeAddress
+ oCell = oSheet.GetCellByPosition(oRangeAddress.StartColumn,oRangeAddress.StartRow)
+ oCellAddress = oCell.CellAddress
+ oSheet.Rows.InsertByIndex(oCellAddress.Row,1)
+ oRangeAddress = oRange.RangeAddress
+ oSheet.CopyRange(oCellAddress, oRangeAddress)
+ DuplicateRow = oRangeAddress.StartRow-1
+End Function
+
+
+&apos; Returns the String of the first cell of a Range
+Function GetStringofCellbyName(oSheet as Object, sCellName as String)
+Dim oCell as Object
+ oCell = GetCellByName(oSheet, sCellName)
+ GetStringofCellbyName = oCell.String
+End Function
+
+
+&apos; Returns a named Cell
+Function GetCellByName(oSheet as Object, sCellName as String) as Object
+Dim oCellRange as Object
+Dim oCellAddress as Object
+ oCellRange = oSheet.GetCellRangeByName(sCellName)
+ oCellAddress = oCellRange.RangeAddress
+ GetCellByName = oSheet.GetCellByPosition(oCellAddress.StartColumn,oCellAddress.StartRow)
+End Function
+
+
+&apos; Changes the numeric Value of a cell by transmitting the String of the numeric Value
+Sub ChangeCellValue(oCell as Object, ValueString as String)
+Dim CellValue
+ oCell.Formula = &quot;=Value(&quot; &amp; &quot;&quot;&quot;&quot; &amp; ValueString &amp; &quot;&quot;&quot;&quot; &amp; &quot;)&quot;
+ CellValue = oCell.Value
+ oCell.Formula = &quot;&quot;
+ oCell.Value = CellValue
+End Sub
+
+
+Function GetDocumentType(oDocument)
+ On Local Error GoTo NODOCUMENTTYPE
+&apos; ShowSupportedServiceNames(oDocument)
+ If oDocument.SupportsService(&quot;com.sun.star.sheet.SpreadsheetDocument&quot;) Then
+ GetDocumentType() = &quot;scalc&quot;
+ ElseIf oDocument.SupportsService(&quot;com.sun.star.text.TextDocument&quot;) Then
+ GetDocumentType() = &quot;swriter&quot;
+ ElseIf oDocument.SupportsService(&quot;com.sun.star.drawing.DrawingDocument&quot;) Then
+ GetDocumentType() = &quot;sdraw&quot;
+ ElseIf oDocument.SupportsService(&quot;com.sun.star.presentation.PresentationDocument&quot;) Then
+ GetDocumentType() = &quot;simpress&quot;
+ ElseIf oDocument.SupportsService(&quot;com.sun.star.formula.FormulaProperties&quot;) Then
+ GetDocumentType() = &quot;smath&quot;
+ End If
+ NODOCUMENTTYPE:
+ If Err &lt;&gt; 0 Then
+ GetDocumentType = &quot;&quot;
+ Resume GOON
+ GOON:
+ End If
+End Function
+
+
+Function GetNumberFormatType(oDocFormats, oFormatObject as Object) as Integer
+Dim ThisFormatKey as Long
+Dim oObjectFormat as Object
+ On Local Error Goto NOFORMAT
+ ThisFormatKey = oFormatObject.NumberFormat
+ oObjectFormat = oDocFormats.GetByKey(ThisFormatKey)
+ GetNumberFormatType = oObjectFormat.Type
+ NOFORMAT:
+ If Err &lt;&gt; 0 Then
+ Msgbox(&quot;Numberformat of Object is not available!&quot;, 16, GetProductName())
+ GetNumberFormatType = 0
+ GOTO NOERROR
+ End If
+ NOERROR:
+ On Local Error Goto 0
+End Function
+
+
+Sub ProtectSheets(Optional oSheets as Object)
+Dim i as Integer
+Dim oDocSheets as Object
+ If IsMissing(oSheets) Then
+ oDocSheets = StarDesktop.CurrentFrame.Controller.Model.Sheets
+ Else
+ Set oDocSheets = oSheets
+ End If
+
+ For i = 0 To oDocSheets.Count-1
+ oDocSheets(i).Protect(&quot;&quot;)
+ Next i
+End Sub
+
+
+Sub UnprotectSheets(Optional oSheets as Object)
+Dim i as Integer
+Dim oDocSheets as Object
+ If IsMissing(oSheets) Then
+ oDocSheets = StarDesktop.CurrentFrame.Controller.Model.Sheets
+ Else
+ Set oDocSheets = oSheets
+ End If
+
+ For i = 0 To oDocSheets.Count-1
+ oDocSheets(i).Unprotect(&quot;&quot;)
+ Next i
+End Sub
+
+
+Function GetRowIndex(oSheet as Object, RowName as String)
+Dim oRange as Object
+ oRange = oSheet.GetCellRangeByName(RowName)
+ GetRowIndex = oRange.RangeAddress.StartRow
+End Function
+
+
+Function GetColumnIndex(oSheet as Object, ColName as String)
+Dim oRange as Object
+ oRange = oSheet.GetCellRangeByName(ColName)
+ GetColumnIndex = oRange.RangeAddress.StartColumn
+End Function
+
+
+Function CopySheetbyName(oSheets as Object, OldName as String, NewName as String, DestPos as Integer) as Object
+Dim oSheet as Object
+Dim Count as Integer
+Dim BasicSheetName as String
+
+ BasicSheetName = NewName
+ &apos; Copy the last table. Assumption: The last table is the template
+ On Local Error Goto RENAMESHEET
+ oSheets.CopybyName(OldName, NewName, DestPos)
+
+RENAMESHEET:
+ oSheet = oSheets(DestPos)
+ If Err &lt;&gt; 0 Then
+ &apos; Test if renaming failed
+ Count = 2
+ Do While oSheet.Name &lt;&gt; NewName
+ NewName = BasicSheetName &amp; &quot;_&quot; &amp; Count
+ oSheet.Name = NewName
+ Count = Count + 1
+ Loop
+ Resume CL_ERROR
+CL_ERROR:
+ End If
+ CopySheetbyName = oSheet
+End Function
+
+
+&apos; Dis-or enables a Window and adjusts the mousepointer accordingly
+Sub ToggleWindow(bDoEnable as Boolean)
+Dim oWindow as Object
+ oWindow = StarDesktop.CurrentFrame.ComponentWindow
+ oWindow.Enable = bDoEnable
+End Sub
+
+
+Function CheckNewSheetname(oSheets as Object, Sheetname as String, Optional oLocale) as String
+Dim nStartFlags as Long
+Dim nContFlags as Long
+Dim oCharService as Object
+Dim iSheetNameLength as Integer
+Dim iResultPos as Integer
+Dim WrongChar as String
+Dim oResult as Object
+ nStartFlags = com.sun.star.i18n.KParseTokens.ANY_LETTER_OR_NUMBER + com.sun.star.i18n.KParseTokens.ASC_UNDERSCORE
+ nContFlags = nStartFlags
+ oCharService = CreateUnoService(&quot;com.sun.star.i18n.CharacterClassification&quot;)
+ iSheetNameLength = Len(SheetName)
+ If IsMissing(oLocale) Then
+ oLocale = ThisComponent.CharLocale
+ End If
+ Do
+ oResult =oCharService.parsePredefinedToken(com.sun.star.i18n.KParseType.IDENTNAME, SheetName, 0, oLocale, nStartFlags, &quot;&quot;, nContFlags, &quot; &quot;)
+ iResultPos = oResult.EndPos
+ If iResultPos &lt; iSheetNameLength Then
+ WrongChar = Mid(SheetName, iResultPos+1,1)
+ SheetName = ReplaceString(SheetName,&quot;_&quot;, WrongChar)
+ End If
+ Loop Until iResultPos = iSheetNameLength
+ CheckNewSheetname = SheetName
+End Function
+
+
+Sub AddNewSheetName(oSheets as Object, ByVal SheetName as String)
+Dim Count as Integer
+Dim bSheetIsThere as Boolean
+Dim iSheetNameLength as Integer
+ iSheetNameLength = Len(SheetName)
+ Count = 2
+ Do
+ bSheetIsThere = oSheets.HasByName(SheetName)
+ If bSheetIsThere Then
+ SheetName = Right(SheetName,iSheetNameLength) &amp; &quot;_&quot; &amp; Count
+ Count = Count + 1
+ End If
+ Loop Until Not bSheetIsThere
+ AddNewSheetname = SheetName
+End Sub
+
+
+Function GetSheetIndex(oSheets, sName) as Integer
+Dim i as Integer
+ For i = 0 To oSheets.Count-1
+ If oSheets(i).Name = sName Then
+ GetSheetIndex = i
+ exit Function
+ End If
+ Next i
+ GetSheetIndex = -1
+End Function
+
+
+Function GetLastUsedRow(oSheet as Object) as Integer
+Dim oCell As Object
+Dim oCursor As Object
+Dim aAddress As Variant
+ oCell = oSheet.GetCellbyPosition(0, 0)
+ oCursor = oSheet.createCursorByRange(oCell)
+ oCursor.GotoEndOfUsedArea(True)
+ aAddress = oCursor.RangeAddress
+ GetLastUsedRow = aAddress.EndRow
+End Function
+
+
+&apos; Note To set a one lined frame you have to set the inner width to 0
+&apos; In the API all Units that refer to pt-Heights are &quot;1/100mm&quot;
+&apos; The convert factor from 1pt to 1/100 mm is approximately 35
+Function ModifyBorderLineWidth(ByVal oStyleBorder, iInnerLineWidth as Integer, iOuterLineWidth as Integer)
+Dim aBorder as New com.sun.star.table.BorderLine
+ aBorder = oStyleBorder
+ aBorder.InnerLineWidth = iInnerLineWidth
+ aBorder.OuterLineWidth = iOuterLineWidth
+ ModifyBorderLineWidth = aBorder
+End Function
+
+
+Sub AttachBasicMacroToEvent(oDocument as Object, EventName as String, SubPath as String)
+Dim PropValue(1) as new com.sun.star.beans.PropertyValue
+ PropValue(0).Name = &quot;EventType&quot;
+ PropValue(0).Value = &quot;StarBasic&quot;
+ PropValue(1).Name = &quot;Script&quot;
+ PropValue(1).Value = &quot;macro:///&quot; &amp; SubPath
+ oDocument.Events.ReplaceByName(EventName, PropValue())
+End Sub
+
+
+
+Function ModifyPropertyValue(oContent() as New com.sun.star.beans.PropertyValue, TargetProperties() as New com.sun.star.beans.PropertyValue)
+Dim MaxIndex as Integer
+Dim i as Integer
+Dim a as Integer
+ MaxIndex = Ubound(oContent())
+ bDoReplace = False
+ For i = 0 To MaxIndex
+ a = GetPropertyValueIndex(oContent(i).Name, TargetProperties())
+ If a &lt;&gt; -1 Then
+ If Vartype(TargetProperties(a).Value) &lt;&gt; 9 Then
+ If TargetProperties(a).Value &lt;&gt; oContent(i).Value Then
+ oContent(i).Value = TargetProperties(a).Value
+ bDoReplace = True
+ End If
+ Else
+ If Not EqualUnoObjects(TargetProperties(a).Value, oContent(i).Value) Then
+ oContent(i).Value = TargetProperties(a).Value
+ bDoReplace = True
+ End If
+ End If
+ End If
+ Next i
+ ModifyPropertyValue() = bDoReplace
+End Function
+
+
+Function GetPropertyValueIndex(SearchName as String, TargetProperties() as New com.sun.star.beans.PropertyValue ) as Integer
+Dim i as Integer
+ For i = 0 To Ubound(TargetProperties())
+ If Searchname = TargetProperties(i).Name Then
+ GetPropertyValueIndex = i
+ Exit Function
+ End If
+ Next i
+ GetPropertyValueIndex() = -1
+End Function
+
+
+Sub DispatchSlot(SlotID as Integer)
+Dim oArg() as new com.sun.star.beans.PropertyValue
+Dim oUrl as new com.sun.star.util.URL
+Dim oTrans as Object
+Dim oDisp as Object
+ oTrans = createUNOService(&quot;com.sun.star.util.URLTransformer&quot;)
+ oUrl.Complete = &quot;slot:&quot; &amp; CStr(SlotID)
+ oTrans.parsestrict(oUrl)
+ oDisp = StarDesktop.ActiveFrame.queryDispatch(oUrl, &quot;_self&quot;, 0)
+ oDisp.dispatch(oUrl, oArg())
+End Sub
+
+
+&apos;returns the type of the office application
+&apos;FatOffice = 0, WebTop = 1
+&apos;This routine has to be changed if the Product Name is being changed!
+Function IsFatOffice() As Boolean
+ If sProductname = &quot;&quot; Then
+ sProductname = GetProductname()
+ End If
+ IsFatOffice = TRUE
+ &apos;The following line has to include the current productname
+ If Instr(1,sProductname,&quot;WebTop&quot;,1) &lt;&gt; 0 Then
+ IsFatOffice = FALSE
+ End If
+End Function
+
+
+Function GetLocale(sLanguage as String, sCountry as String)
+Dim oLocale as New com.sun.star.lang.Locale
+ oLocale.Language = sLanguage
+ oLocale.Country = sCountry
+ GetLocale = oLocale
+End Function
+
+
+Sub ToggleDesignMode(oDocument as Object)
+Dim aSwitchMode as new com.sun.star.util.URL
+ aSwitchMode.Complete = &quot;.uno:SwitchControlDesignMode&quot;
+ aTransformer = createUnoService(&quot;com.sun.star.util.URLTransformer&quot;)
+ aTransformer.parseStrict(aSwitchMode)
+ oFrame = oDocument.currentController.Frame
+ oDispatch = oFrame.queryDispatch(aSwitchMode, oFrame.Name, 63)
+ Dim aEmptyArgs() as New com.sun.star.bean.PropertyValue
+ oDispatch.dispatch(aSwitchMode, aEmptyArgs())
+ Erase aSwitchMode
+End Sub
+
+
+Function isHighContrast(oPeer as Object)
+ Dim UIColor as Long
+ Dim myRed as Integer
+ Dim myGreen as Integer
+ Dim myBlue as Integer
+ Dim myLuminance as Double
+
+ UIColor = oPeer.getProperty( &quot;DisplayBackgroundColor&quot; )
+ myRed = Red (UIColor)
+ myGreen = Green (UIColor)
+ myBlue = Blue (UIColor)
+ myLuminance = (( myBlue*28 + myGreen*151 + myRed*77 ) / 256 )
+ isHighContrast = false
+ If myLuminance &lt;= 25 Then isHighContrast = true
+End Function
+
+
+Function CreateNewDocument(sType as String, Optional sAddMsg as String) as Object
+Dim NoArgs() as new com.sun.star.beans.PropertyValue
+Dim oDocument as Object
+Dim sUrl as String
+Dim ErrMsg as String
+ On Local Error Goto NOMODULEINSTALLED
+ sUrl = &quot;private:factory/&quot; &amp; sType
+ oDocument = StarDesktop.LoadComponentFromURL(sUrl,&quot;_default&quot;,0, NoArgs())
+NOMODULEINSTALLED:
+ If (Err &lt;&gt; 0) OR IsNull(oDocument) Then
+ If InitResources(&quot;&quot;, &quot;com&quot;) Then
+ Select Case sType
+ Case &quot;swriter&quot;
+ ErrMsg = GetResText(1001)
+ Case &quot;scalc&quot;
+ ErrMsg = GetResText(1002)
+ Case &quot;simpress&quot;
+ ErrMsg = GetResText(1003)
+ Case &quot;sdraw&quot;
+ ErrMsg = GetResText(1004)
+ Case &quot;smath&quot;
+ ErrMsg = GetResText(1005)
+ Case Else
+ ErrMsg = &quot;Invalid Document Type!&quot;
+ End Select
+ ErrMsg = ReplaceString(ErrMsg, chr(13), &quot;&lt;BR&gt;&quot;)
+ If Not IsMissing(sAddMsg) Then
+ ErrMsg = ErrMsg &amp; chr(13) &amp; sAddMsg
+ End If
+ Msgbox(ErrMsg, 48, GetProductName())
+ End If
+ If Err &lt;&gt; 0 Then
+ Resume GOON
+ End If
+ End If
+GOON:
+ CreateNewDocument = oDocument
+End Function
+
+
+&apos; This Sub has been used in order to ensure that after disposing a document
+&apos; from the backing window it is returned to the backing window, so the
+&apos; office won&apos;t be closed
+Sub DisposeDocument(oDocument as Object)
+Dim dispatcher as Object
+Dim parser as Object
+Dim disp as Object
+Dim url as new com.sun.star.util.URL
+Dim NoArgs() as New com.sun.star.beans.PropertyValue
+Dim oFrame as Object
+ If Not IsNull(oDocument) Then
+ oDocument.setModified(false)
+ parser = createUnoService(&quot;com.sun.star.util.URLTransformer&quot;)
+ url.Complete = &quot;.uno:CloseDoc&quot;
+ parser.parseStrict(url)
+ oFrame = oDocument.CurrentController.Frame
+ disp = oFrame.queryDispatch(url,&quot;_self&quot;, com.sun.star.util.SearchFlags.NORM_WORD_ONLY)
+ disp.dispatch(url, NoArgs())
+ End If
+End Sub
+
+&apos;Function to calculate if the year is a leap year
+Function CalIsLeapYear(ByVal iYear as Integer) as Boolean
+ CalIsLeapYear = ((iYear Mod 4 = 0) And ((iYear Mod 100 &lt;&gt; 0) Or (iYear Mod 400 = 0)))
+End Function
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tools/ModuleControls.xba b/wizards/source/tools/ModuleControls.xba
new file mode 100644
index 000000000000..dc5ef02a5b7f
--- /dev/null
+++ b/wizards/source/tools/ModuleControls.xba
@@ -0,0 +1,370 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ModuleControls" script:language="StarBasic">Option Explicit
+
+Public DlgOverwrite as Object
+Public Const SBOVERWRITEUNDEFINED as Integer = 0
+Public Const SBOVERWRITECANCEL as Integer = 2
+Public Const SBOVERWRITEQUERY as Integer = 7
+Public Const SBOVERWRITEALWAYS as Integer = 6
+Public Const SBOVERWRITENEVER as Integer = 8
+Public iGeneralOverwrite as Integer
+
+
+
+&apos; Accepts the name of a control and returns the respective control model as object
+&apos; The Container can either be a whole document or a specific sheet of a Calc-Document
+&apos; &apos;CName&apos; is the name of the Control
+Function getControlModel(oContainer as Object, CName as String)
+Dim aForm, oForms as Object
+Dim i as Integer
+ oForms = oContainer.Drawpage.GetForms
+ For i = 0 To oForms.Count-1
+ aForm = oForms.GetbyIndex(i)
+ If aForm.HasByName(CName) Then
+ GetControlModel = aForm.GetbyName(CName)
+ Exit Function
+ End If
+ Next i
+ Msgbox(&quot;No Control with the name &apos;&quot; &amp; CName &amp; &quot;&apos; found&quot; , 16, GetProductName())
+End Function
+
+
+
+&apos; Gets the Shape of a Control( e. g. to reset the size or Position of the control
+&apos; Parameters:
+&apos; The &apos;oContainer&apos; is the Document or a specific sheet of a Calc - Document
+&apos; &apos;CName&apos; is the Name of the Control
+Function GetControlShape(oContainer as Object,CName as String)
+Dim i as integer
+Dim aShape as Object
+ For i = 0 to oContainer.DrawPage.Count-1
+ aShape = oContainer.DrawPage(i)
+ If HasUnoInterfaces(aShape, &quot;com.sun.star.drawing.XControlShape&quot;) then
+ If ashape.Control.Name = CName then
+ GetControlShape = aShape
+ exit Function
+ End If
+ End If
+ Next
+End Function
+
+
+&apos; Returns the View of a Control
+&apos; Parameters:
+&apos; The &apos;oContainer&apos; is the Document or a specific sheet of a Calc - Document
+&apos; The &apos;oController&apos; is always directly attached to the Document
+&apos; &apos;CName&apos; is the Name of the Control
+Function getControlView(oContainer , oController as Object, CName as String) as Object
+Dim aForm, oForms, oControlModel as Object
+Dim i as Integer
+ oForms = oContainer.DrawPage.Forms
+ For i = 0 To oForms.Count-1
+ aForm = oforms.GetbyIndex(i)
+ If aForm.HasByName(CName) Then
+ oControlModel = aForm.GetbyName(CName)
+ GetControlView = oController.GetControl(oControlModel)
+ Exit Function
+ End If
+ Next i
+ Msgbox(&quot;No Control with the name &apos;&quot; &amp; CName &amp; &quot;&apos; found&quot; , 16, GetProductName())
+End Function
+
+
+
+&apos; Parameters:
+&apos; The &apos;oContainer&apos; is the Document or a specific sheet of a Calc - Document
+&apos; &apos;CName&apos; is the Name of the Control
+Function DisposeControl(oContainer as Object, CName as String) as Boolean
+Dim aControl as Object
+
+ aControl = GetControlModel(oContainer,CName)
+ If not IsNull(aControl) Then
+ aControl.Dispose()
+ DisposeControl = True
+ Else
+ DisposeControl = False
+ End If
+End Function
+
+
+&apos; Returns a sequence of a group of controls like option buttons or checkboxes
+&apos; The &apos;oContainer&apos; is the Document or a specific sheet of a Calc - Document
+&apos; &apos;sGroupName&apos; is the Name of the Controlgroup
+Function GetControlGroupModel(oContainer as Object, sGroupName as String )
+Dim aForm, oForms As Object
+Dim aControlModel() As Object
+Dim i as integer
+
+ oForms = oContainer.DrawPage.Forms
+ For i = 0 To oForms.Count-1
+ aForm = oForms(i)
+ If aForm.HasbyName(sGroupName) Then
+ aForm.GetGroupbyName(sGroupName,aControlModel)
+ GetControlGroupModel = aControlModel
+ Exit Function
+ End If
+ Next i
+ Msgbox(&quot;No Controlgroup with the name &apos;&quot; &amp; sGroupName &amp; &quot;&apos; found&quot; , 16, GetProductName())
+End Function
+
+
+&apos; Returns the Referencevalue of a group of e.g. option buttons or check boxes
+&apos; &apos;oControlGroup&apos; is a sequence of the Control objects
+Function GetRefValue(oControlGroup() as Object)
+Dim i as Integer
+ For i = 0 To Ubound(oControlGroup())
+&apos; oControlGroup(i).DefaultState = oControlGroup(i).State
+ If oControlGroup(i).State Then
+ GetRefValue = oControlGroup(i).RefValue
+ exit Function
+ End If
+ Next
+ GetRefValue() = -1
+End Function
+
+
+Function GetRefValueOfControlGroup(oContainer as Object, GroupName as String)
+Dim oOptGroup() as Object
+Dim iRef as Integer
+ oOptGroup() = GetControlGroupModel(oContainer, GroupName)
+ iRef = GetRefValue(oOptGroup())
+ GetRefValueofControlGroup = iRef
+End Function
+
+
+Function GetOptionGroupValue(oContainer as Object, OptGroupName as String) as Boolean
+Dim oRulesOptions() as Object
+ oRulesOptions() = GetControlGroupModel(oContainer, OptGroupName)
+ GetOptionGroupValue = oRulesOptions(0).State
+End Function
+
+
+
+Function WriteOptValueToCell(oSheet as Object, OptGroupName as String, iCol as Integer, iRow as Integer) as Boolean
+Dim bOptValue as Boolean
+Dim oCell as Object
+ bOptValue = GetOptionGroupValue(oSheet, OptGroupName)
+ oCell = oSheet.GetCellByPosition(iCol, iRow)
+ oCell.SetValue(ABS(CInt(bOptValue)))
+ WriteOptValueToCell() = bOptValue
+End Function
+
+
+Function LoadDialog(Libname as String, DialogName as String, Optional oLibContainer)
+Dim oLib as Object
+Dim oLibDialog as Object
+Dim oRuntimeDialog as Object
+ If IsMissing(oLibContainer ) then
+ oLibContainer = DialogLibraries
+ End If
+ oLibContainer.LoadLibrary(LibName)
+ oLib = oLibContainer.GetByName(Libname)
+ oLibDialog = oLib.GetByName(DialogName)
+ oRuntimeDialog = CreateUnoDialog(oLibDialog)
+ LoadDialog() = oRuntimeDialog
+End Function
+
+
+Sub GetFolderName(oRefModel as Object)
+Dim oFolderDialog as Object
+Dim iAccept as Integer
+Dim sPath as String
+Dim InitPath as String
+Dim RefControlName as String
+Dim oUcb as object
+ &apos;Note: The following services have to be called in the following order
+ &apos; because otherwise Basic does not remove the FileDialog Service
+ oFolderDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FolderPicker&quot;)
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ InitPath = ConvertToUrl(oRefModel.Text)
+ If InitPath = &quot;&quot; Then
+ InitPath = GetPathSettings(&quot;Work&quot;)
+ End If
+ If oUcb.Exists(InitPath) Then
+ oFolderDialog.SetDisplayDirectory(InitPath)
+ End If
+ iAccept = oFolderDialog.Execute()
+ If iAccept = 1 Then
+ sPath = oFolderDialog.GetDirectory()
+ If oUcb.Exists(sPath) Then
+ oRefModel.Text = ConvertFromUrl(sPath)
+ End If
+ End If
+End Sub
+
+
+Sub GetFileName(oRefModel as Object, Filternames())
+Dim oFileDialog as Object
+Dim iAccept as Integer
+Dim sPath as String
+Dim InitPath as String
+Dim RefControlName as String
+Dim oUcb as object
+&apos;Dim ListAny(0)
+ &apos;Note: The following services have to be called in the following order
+ &apos; because otherwise Basic does not remove the FileDialog Service
+ oFileDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ &apos;ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE
+ &apos;oFileDialog.initialize(ListAny())
+ AddFiltersToDialog(FilterNames(), oFileDialog)
+ InitPath = ConvertToUrl(oRefModel.Text)
+ If InitPath = &quot;&quot; Then
+ InitPath = GetPathSettings(&quot;Work&quot;)
+ End If
+ If oUcb.Exists(InitPath) Then
+ oFileDialog.SetDisplayDirectory(InitPath)
+ End If
+ iAccept = oFileDialog.Execute()
+ If iAccept = 1 Then
+ sPath = oFileDialog.Files(0)
+ If oUcb.Exists(sPath) Then
+ oRefModel.Text = ConvertFromUrl(sPath)
+ End If
+ End If
+ oFileDialog.Dispose()
+End Sub
+
+
+Function StoreDocument(oDocument as Object, FilterNames() as String, DefaultName as String, DisplayDirectory as String, Optional iAddProcedure as Integer) as String
+Dim NoArgs() as New com.sun.star.beans.PropertyValue
+Dim oStoreProperties(0) as New com.sun.star.beans.PropertyValue
+Dim oStoreDialog as Object
+Dim iAccept as Integer
+Dim sPath as String
+Dim ListAny(0) as Long
+Dim UIFilterName as String
+Dim FilterName as String
+Dim FilterIndex as Integer
+ ListAny(0) = com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION_PASSWORD
+ oStoreDialog = CreateUnoService(&quot;com.sun.star.ui.dialogs.FilePicker&quot;)
+ oStoreDialog.Initialize(ListAny())
+ AddFiltersToDialog(FilterNames(), oStoreDialog)
+ oStoreDialog.SetDisplayDirectory(DisplayDirectory)
+ oStoreDialog.SetDefaultName(DefaultName)
+ oStoreDialog.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION,0, true)
+
+ iAccept = oStoreDialog.Execute()
+ If iAccept = 1 Then
+ sPath = oStoreDialog.Files(0)
+ UIFilterName = oStoreDialog.GetCurrentFilter()
+ FilterIndex = IndexInArray(UIFilterName, FilterNames())
+ FilterName = FilterNames(FilterIndex,2)
+ If Not IsMissing(iAddProcedure) Then
+ Select Case iAddProcedure
+ Case 1
+ CommitLastDocumentChanges(sPath)
+ End Select
+ End If
+ On Local Error Goto NOSAVING
+ If FilterName = &quot;&quot; Then
+ &apos; Todo: Catch the case that a document that has to be overwritten is writeportected (e.g. it is open)
+ oDocument.StoreAsUrl(sPath, NoArgs())
+ Else
+ oStoreProperties(0).Name = &quot;FilterName&quot;
+ oStoreProperties(0).Value = FilterName
+ oDocument.StoreAsUrl(sPath, oStoreProperties())
+ End If
+ End If
+ oStoreDialog.dispose()
+ StoreDocument() = sPath
+ Exit Function
+NOSAVING:
+ If Err &lt;&gt; 0 Then
+&apos; Msgbox(&quot;Document cannot be saved under &apos;&quot; &amp; ConvertFromUrl(sPath) &amp; &quot;&apos;&quot;, 48, GetProductName())
+ sPath = &quot;&quot;
+ oStoreDialog.dispose()
+ Resume NOERROR
+ NOERROR:
+ End If
+End Function
+
+
+Sub AddFiltersToDialog(FilterNames() as String, oDialog as Object)
+Dim i as Integer
+Dim MaxIndex as Integer
+Dim ViewFiltername as String
+Dim oProdNameAccess as Object
+Dim sProdName as String
+ oProdNameAccess = GetRegistryKeyContent(&quot;org.openoffice.Setup/Product&quot;)
+ sProdName = oProdNameAccess.getByName(&quot;ooName&quot;)
+ MaxIndex = Ubound(FilterNames(), 1)
+ For i = 0 To MaxIndex
+ Filternames(i,0) = ReplaceString(Filternames(i,0), sProdName,&quot;%productname%&quot;)
+ oDialog.AppendFilter(FilterNames(i,0), FilterNames(i,1))
+ Next i
+ oDialog.SetCurrentFilter(FilterNames(0,0)
+End Sub
+
+
+Sub SwitchMousePointer(oWindowPeer as Object, bDoEnable as Boolean)
+Dim oWindowPointer as Object
+ oWindowPointer = CreateUnoService(&quot;com.sun.star.awt.Pointer&quot;)
+ If bDoEnable Then
+ oWindowPointer.SetType(com.sun.star.awt.SystemPointer.ARROW)
+ Else
+ oWindowPointer.SetType(com.sun.star.awt.SystemPointer.WAIT)
+ End If
+ oWindowPeer.SetPointer(oWindowPointer)
+End Sub
+
+
+Sub ShowOverwriteAllDialog(FilePath as String, sTitle as String)
+Dim QueryString as String
+Dim LocRetValue as Integer
+Dim lblYes as String
+Dim lblNo as String
+Dim lblYesToAll as String
+Dim lblCancel as String
+Dim OverwriteModel as Object
+ If InitResources(GetProductName(), &quot;dbw&quot;) Then
+ QueryString = GetResText(507)
+ QueryString = ReplaceString(QueryString, ConvertFromUrl(FilePath), &quot;&lt;PATH&gt;&quot;)
+ If Len(QueryString) &gt; 190 Then
+ QueryString = DeleteStr(QueryString, &quot;.&lt;BR&gt;&quot;)
+ End If
+ QueryString = ReplaceString(QueryString, chr(13), &quot;&lt;BR&gt;&quot;)
+ lblYes = GetResText(508)
+ lblYesToAll = GetResText(509)
+ lblNo = GetResText(510)
+ lblCancel = GetResText(511)
+ DlgOverwrite = LoadDialog(&quot;Tools&quot;, &quot;DlgOverwriteAll&quot;)
+ DlgOverwrite.Title = sTitle
+ OverwriteModel = DlgOverwrite.Model
+ OverwriteModel.cmdYes.Label = lblYes
+ OverwriteModel.cmdYesToAll.Label = lblYesToAll
+ OverwriteModel.cmdNo.Label = lblNo
+ OverwriteModel.cmdCancel.Label = lblCancel
+ OverwriteModel.lblQueryforSave.Label = QueryString
+ OverwriteModel.cmdNo.DefaultButton = True
+ DlgOverwrite.GetControl(&quot;cmdNo&quot;).SetFocus()
+ iGeneralOverwrite = 999
+ LocRetValue = DlgOverwrite.execute()
+ If iGeneralOverwrite = 999 Then
+ iGeneralOverwrite = SBOVERWRITECANCEL
+ End If
+ DlgOverwrite.dispose()
+ Else
+ iGeneralOverwrite = SBOVERWRITECANCEL
+ End If
+End Sub
+
+
+Sub SetOVERWRITEToQuery()
+ iGeneralOverwrite = SBOVERWRITEQUERY
+ DlgOverwrite.EndExecute()
+End Sub
+
+
+Sub SetOVERWRITEToAlways()
+ iGeneralOverwrite = SBOVERWRITEALWAYS
+ DlgOverwrite.EndExecute()
+End Sub
+
+
+Sub SetOVERWRITEToNever()
+ iGeneralOverwrite = SBOVERWRITENEVER
+ DlgOverwrite.EndExecute()
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tools/Strings.xba b/wizards/source/tools/Strings.xba
new file mode 100644
index 000000000000..a2a8907e02f2
--- /dev/null
+++ b/wizards/source/tools/Strings.xba
@@ -0,0 +1,452 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Strings" script:language="StarBasic">Option Explicit
+Public sProductname as String
+
+
+&apos; Deletes out of a String &apos;BigString&apos; all possible PartStrings, that are summed up
+&apos; in the Array &apos;ElimArray&apos;
+Function ElimChar(ByVal BigString as String, ElimArray() as String)
+Dim i% ,n%
+ For i = 0 to Ubound(ElimArray)
+ BigString = DeleteStr(BigString,ElimArray(i)
+ Next
+ ElimChar = BigString
+End Function
+
+
+&apos; Deletes out of a String &apos;BigString&apos; a possible Partstring &apos;CompString&apos;
+Function DeleteStr(ByVal BigString,CompString as String) as String
+Dim i%, CompLen%, BigLen%
+ CompLen = Len(CompString)
+ i = 1
+ While i &lt;&gt; 0
+ i = Instr(i, BigString,CompString)
+ If i &lt;&gt; 0 then
+ BigLen = Len(BigString)
+ BigString = Mid(BigString,1,i-1) + Mid(BigString,i+CompLen,BigLen-i+1-CompLen)
+ End If
+ Wend
+ DeleteStr = BigString
+End Function
+
+
+&apos; Finds a PartString, that is framed by the Strings &apos;Prestring&apos; and &apos;PostString&apos;
+Function FindPartString(BigString, PreString, PostString as String, SearchPos as Integer) as String
+Dim StartPos%, EndPos%
+Dim BigLen%, PreLen%, PostLen%
+ StartPos = Instr(SearchPos,BigString,PreString)
+ If StartPos &lt;&gt; 0 Then
+ PreLen = Len(PreString)
+ EndPos = Instr(StartPos + PreLen,BigString,PostString)
+ If EndPos &lt;&gt; 0 Then
+ BigLen = Len(BigString)
+ PostLen = Len(PostString)
+ FindPartString = Mid(BigString,StartPos + PreLen, EndPos - (StartPos + PreLen))
+ SearchPos = EndPos + PostLen
+ Else
+ Msgbox(&quot;No final tag for &apos;&quot; &amp; PreString &amp; &quot;&apos; existing&quot;, 16, GetProductName())
+ FindPartString = &quot;&quot;
+ End If
+ Else
+ FindPartString = &quot;&quot;
+ End If
+End Function
+
+
+&apos; Note iCompare = 0 (Binary comparison)
+&apos; iCompare = 1 (Text comparison)
+Function PartStringInArray(BigArray(), SearchString as String, iCompare as Integer) as Integer
+Dim MaxIndex as Integer
+Dim i as Integer
+ MaxIndex = Ubound(BigArray())
+ For i = 0 To MaxIndex
+ If Instr(1, BigArray(i), SearchString, iCompare) &lt;&gt; 0 Then
+ PartStringInArray() = i
+ Exit Function
+ End If
+ Next i
+ PartStringInArray() = -1
+End Function
+
+
+&apos; Deletes the String &apos;SmallString&apos; out of the String &apos;BigString&apos;
+&apos; in case SmallString&apos;s Position in BigString is right at the end
+Function RTrimStr(ByVal BigString, SmallString as String) as String
+Dim SmallLen as Integer
+Dim BigLen as Integer
+ SmallLen = Len(SmallString)
+ BigLen = Len(BigString)
+ If Instr(1,BigString, SmallString) &lt;&gt; 0 Then
+ If Mid(BigString,BigLen + 1 - SmallLen, SmallLen) = SmallString Then
+ RTrimStr = Mid(BigString,1,BigLen - SmallLen)
+ Else
+ RTrimStr = BigString
+ End If
+ Else
+ RTrimStr = BigString
+ End If
+End Function
+
+
+&apos; Deletes the Char &apos;CompChar&apos; out of the String &apos;BigString&apos;
+&apos; in case CompChar&apos;s Position in BigString is right at the beginning
+Function LTRimChar(ByVal BigString as String,CompChar as String) as String
+Dim BigLen as integer
+ BigLen = Len(BigString)
+ If BigLen &gt; 1 Then
+ If Left(BigString,1) = CompChar then
+ BigString = Mid(BigString,2,BigLen-1)
+ End If
+ ElseIf BigLen = 1 Then
+ BigString = &quot;&quot;
+ End If
+ LTrimChar = BigString
+End Function
+
+
+&apos; Retrieves an Array out of a String.
+&apos; The fields of the Array are separated by the parameter &apos;Separator&apos;, that is contained
+&apos; in the Array
+&apos; The Array MaxIndex delivers the highest Index of this Array
+Function ArrayOutOfString(BigString, Separator as String, Optional MaxIndex as Integer)
+Dim LocList() as String
+ LocList=Split(BigString,Separator)
+
+ If not isMissing(MaxIndex) then maxIndex=ubound(LocList())
+
+ ArrayOutOfString=LocList
+End Function
+
+
+&apos; Deletes all fieldvalues in one-dimensional Array
+Sub ClearArray(BigArray)
+Dim i as integer
+ For i = Lbound(BigArray()) to Ubound(BigArray())
+ BigArray(i) = &quot;&quot;
+ Next
+End Sub
+
+
+&apos; Deletes all fieldvalues in a multidimensional Array
+Sub ClearMultiDimArray(BigArray,DimCount as integer)
+Dim n%, m%
+ For n = Lbound(BigArray(),1) to Ubound(BigArray(),1)
+ For m = 0 to Dimcount - 1
+ BigArray(n,m) = &quot;&quot;
+ Next m
+ Next n
+End Sub
+
+
+&apos; Checks if a Field (LocField) is already defined in an Array
+&apos; Returns &apos;True&apos; or &apos;False&apos;
+Function FieldinArray(LocArray(), MaxIndex as integer, LocField as String) As Boolean
+Dim i as integer
+ For i = Lbound(LocArray()) to MaxIndex
+ If Ucase(LocArray(i)) = Ucase(LocField) Then
+ FieldInArray = True
+ Exit Function
+ End if
+ Next
+ FieldInArray = False
+End Function
+
+
+&apos; Checks if a Field (LocField) is already defined in an Array
+&apos; Returns &apos;True&apos; or &apos;False&apos;
+Function FieldinList(LocField, BigList()) As Boolean
+Dim i as integer
+ For i = Lbound(BigList()) to Ubound(BigList())
+ If LocField = BigList(i) Then
+ FieldInList = True
+ Exit Function
+ End if
+ Next
+ FieldInList = False
+End Function
+
+
+&apos; Retrieves the Index of the delivered String &apos;SearchString&apos; in
+&apos; the Array LocList()&apos;
+Function IndexinArray(SearchString as String, LocList()) as Integer
+Dim i as integer
+ For i = Lbound(LocList(),1) to Ubound(LocList(),1)
+ If Ucase(LocList(i,0)) = Ucase(SearchString) Then
+ IndexinArray = i
+ Exit Function
+ End if
+ Next
+ IndexinArray = -1
+End Function
+
+
+Sub MultiArrayInListbox(oDialog as Object, ListboxName as String, ValList(), iDim as Integer)
+Dim oListbox as Object
+Dim i as integer
+Dim a as Integer
+ a = 0
+ oListbox = oDialog.GetControl(ListboxName)
+ oListbox.RemoveItems(0, oListbox.GetItemCount)
+ For i = 0 to Ubound(ValList(), 1)
+ If ValList(i) &lt;&gt; &quot;&quot; Then
+ oListbox.AddItem(ValList(i, iDim-1), a)
+ a = a + 1
+ End If
+ Next
+End Sub
+
+
+&apos; Searches for a String in a two-dimensional Array by querying all Searchindexex of the second dimension
+&apos; and delivers the specific String of the ReturnIndex in the second dimension of the Searchlist()
+Function StringInMultiArray(SearchList(), SearchString as String, SearchIndex as Integer, ReturnIndex as Integer, Optional MaxIndex as Integer) as String
+Dim i as integer
+Dim CurFieldString as String
+ If IsMissing(MaxIndex) Then
+ MaxIndex = Ubound(SearchList(),1)
+ End If
+ For i = Lbound(SearchList()) to MaxIndex
+ CurFieldString = SearchList(i,SearchIndex)
+ If Ucase(CurFieldString) = Ucase(SearchString) Then
+ StringInMultiArray() = SearchList(i,ReturnIndex)
+ Exit Function
+ End if
+ Next
+ StringInMultiArray() = &quot;&quot;
+End Function
+
+
+&apos; Searches for a Value in multidimensial Array by querying all Searchindices of the passed dimension
+&apos; and delivers the Index where it is found.
+Function GetIndexInMultiArray(SearchList(), SearchValue, SearchIndex as Integer) as Integer
+Dim i as integer
+Dim MaxIndex as Integer
+Dim CurFieldValue
+ MaxIndex = Ubound(SearchList(),1)
+ For i = Lbound(SearchList()) to MaxIndex
+ CurFieldValue = SearchList(i,SearchIndex)
+ If CurFieldValue = SearchValue Then
+ GetIndexInMultiArray() = i
+ Exit Function
+ End if
+ Next
+ GetIndexInMultiArray() = -1
+End Function
+
+
+&apos; Searches for a Value in multidimensial Array by querying all Searchindices of the passed dimension
+&apos; and delivers the Index where the Searchvalue is found as a part string
+Function GetIndexForPartStringinMultiArray(SearchList(), SearchValue, SearchIndex as Integer) as Integer
+Dim i as integer
+Dim MaxIndex as Integer
+Dim CurFieldValue
+ MaxIndex = Ubound(SearchList(),1)
+ For i = Lbound(SearchList()) to MaxIndex
+ CurFieldValue = SearchList(i,SearchIndex)
+ If Instr(CurFieldValue, SearchValue) &gt; 0 Then
+ GetIndexForPartStringinMultiArray() = i
+ Exit Function
+ End if
+ Next
+ GetIndexForPartStringinMultiArray = -1
+End Function
+
+
+Function ArrayfromMultiArray(MultiArray as String, iDim as Integer)
+Dim MaxIndex as Integer
+Dim i as Integer
+ MaxIndex = Ubound(MultiArray())
+ Dim ResultArray(MaxIndex) as String
+ For i = 0 To MaxIndex
+ ResultArray(i) = MultiArray(i,iDim)
+ Next i
+ ArrayfromMultiArray() = ResultArray()
+End Function
+
+
+&apos; Replaces the string &quot;OldReplace&quot; through the String &quot;NewReplace&quot; in the String
+&apos; &apos;BigString&apos;
+Function ReplaceString(ByVal Bigstring, NewReplace, OldReplace as String) as String
+ ReplaceString=join(split(BigString,OldReplace),NewReplace)
+End Function
+
+
+&apos; Retrieves the second value for a next to &apos;SearchString&apos; in
+&apos; a two-dimensional string-Array
+Function FindSecondValue(SearchString as String, TwoDimList() as String ) as String
+Dim i as Integer
+ For i = 0 To Ubound(TwoDimList,1)
+ If Ucase(SearchString) = Ucase(TwoDimList(i,0)) Then
+ FindSecondValue = TwoDimList(i,1)
+ Exit For
+ End If
+ Next
+End Function
+
+
+&apos; raises a base to a certain power
+Function Power(Basis as Double, Exponent as Double) as Double
+ Power = Exp(Exponent*Log(Basis))
+End Function
+
+
+&apos; rounds a Real to a given Number of Decimals
+Function Round(BaseValue as Double, Decimals as Integer) as Double
+Dim Multiplicator as Long
+Dim DblValue#, RoundValue#
+ Multiplicator = Power(10,Decimals)
+ RoundValue = Int(BaseValue * Multiplicator)
+ Round = RoundValue/Multiplicator
+End Function
+
+
+&apos;Retrieves the mere filename out of a whole path
+Function FileNameoutofPath(ByVal Path as String, Optional Separator as String) as String
+Dim i as Integer
+Dim SepList() as String
+ If IsMissing(Separator) Then
+ Path = ConvertFromUrl(Path)
+ Separator = GetPathSeparator()
+ End If
+ SepList() = ArrayoutofString(Path, Separator,i)
+ FileNameoutofPath = SepList(i)
+End Function
+
+
+Function GetFileNameExtension(ByVal FileName as String)
+Dim MaxIndex as Integer
+Dim SepList() as String
+ SepList() = ArrayoutofString(FileName,&quot;.&quot;, MaxIndex)
+ GetFileNameExtension = SepList(MaxIndex)
+End Function
+
+
+Function GetFileNameWithoutExtension(ByVal FileName as String, Optional Separator as String)
+Dim MaxIndex as Integer
+Dim SepList() as String
+ If not IsMissing(Separator) Then
+ FileName = FileNameoutofPath(FileName, Separator)
+ End If
+ SepList() = ArrayoutofString(FileName,&quot;.&quot;, MaxIndex)
+ GetFileNameWithoutExtension = RTrimStr(FileName, &quot;.&quot; &amp; SepList(MaxIndex)
+End Function
+
+
+Function DirectoryNameoutofPath(sPath as String, Separator as String) as String
+Dim LocFileName as String
+ LocFileName = FileNameoutofPath(sPath, Separator)
+ DirectoryNameoutofPath = RTrimStr(sPath, Separator &amp; LocFileName)
+End Function
+
+
+Function CountCharsinString(BigString, LocChar as String, ByVal StartPos as Integer) as Integer
+Dim LocCount%, LocPos%
+ LocCount = 0
+ Do
+ LocPos = Instr(StartPos,BigString,LocChar)
+ If LocPos &lt;&gt; 0 Then
+ LocCount = LocCount + 1
+ StartPos = LocPos+1
+ End If
+ Loop until LocPos = 0
+ CountCharsInString = LocCount
+End Function
+
+
+Function BubbleSortList(ByVal SortList(),optional sort2ndValue as Boolean)
+&apos;This function bubble sorts an array of maximum 2 dimensions.
+&apos;The default sorting order is the first dimension
+&apos;Only if sort2ndValue is True the second dimension is the relevant for the sorting order
+ Dim s as Integer
+ Dim t as Integer
+ Dim i as Integer
+ Dim k as Integer
+ Dim dimensions as Integer
+ Dim sortvalue as Integer
+ Dim DisplayDummy
+ dimensions = 2
+
+On Local Error Goto No2ndDim
+ k = Ubound(SortList(),2)
+ No2ndDim:
+ If Err &lt;&gt; 0 Then dimensions = 1
+
+ i = Ubound(SortList(),1)
+ If ismissing(sort2ndValue) then
+ sortvalue = 0
+ else
+ sortvalue = 1
+ end if
+
+ For s = 1 to i - 1
+ For t = 0 to i-s
+ Select Case dimensions
+ Case 1
+ If SortList(t) &gt; SortList(t+1) Then
+ DisplayDummy = SortList(t)
+ SortList(t) = SortList(t+1)
+ SortList(t+1) = DisplayDummy
+ End If
+ Case 2
+ If SortList(t,sortvalue) &gt; SortList(t+1,sortvalue) Then
+ For k = 0 to UBound(SortList(),2)
+ DisplayDummy = SortList(t,k)
+ SortList(t,k) = SortList(t+1,k)
+ SortList(t+1,k) = DisplayDummy
+ Next k
+ End If
+ End Select
+ Next t
+ Next s
+ BubbleSortList = SortList()
+End Function
+
+
+Function GetValueoutofList(SearchValue, BigList(), iDim as Integer, Optional ValueIndex)
+Dim i as Integer
+Dim MaxIndex as Integer
+ MaxIndex = Ubound(BigList(),1)
+ For i = 0 To MaxIndex
+ If BigList(i,0) = SearchValue Then
+ If Not IsMissing(ValueIndex) Then
+ ValueIndex = i
+ End If
+ GetValueOutOfList() = BigList(i,iDim)
+ End If
+ Next i
+End Function
+
+
+Function AddListtoList(ByVal FirstArray(), ByVal SecondArray(), Optional StartIndex)
+Dim n as Integer
+Dim m as Integer
+Dim MaxIndex as Integer
+ MaxIndex = Ubound(FirstArray()) + Ubound(SecondArray()) + 1
+ If MaxIndex &gt; -1 Then
+ Dim ResultArray(MaxIndex)
+ For m = 0 To Ubound(FirstArray())
+ ResultArray(m) = FirstArray(m)
+ Next m
+ For n = 0 To Ubound(SecondArray())
+ ResultArray(m) = SecondArray(n)
+ m = m + 1
+ Next n
+ AddListToList() = ResultArray()
+ Else
+ Dim NullArray()
+ AddListToList() = NullArray()
+ End If
+End Function
+
+
+Function CheckDouble(DoubleString as String)
+On Local Error Goto WRONGDATATYPE
+ CheckDouble() = CDbl(DoubleString)
+WRONGDATATYPE:
+ If Err &lt;&gt; 0 Then
+ CheckDouble() = 0
+ Resume NoErr:
+ End If
+NOERR:
+End Function
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tools/UCB.xba b/wizards/source/tools/UCB.xba
new file mode 100644
index 000000000000..524afe60c4d9
--- /dev/null
+++ b/wizards/source/tools/UCB.xba
@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="UCB" script:language="StarBasic">&apos;Option explicit
+Public oDocument
+Public oDocInfo as object
+Const SBMAXDIRCOUNT = 10
+Dim CurDirMaxCount as Integer
+Dim sDirArray(SBMAXDIRCOUNT-1) as String
+Dim DirIndex As Integer
+Dim iDirCount as Integer
+Public bInterruptSearch as Boolean
+Public NoArgs()as New com.sun.star.beans.PropertyValue
+
+Sub Main()
+Dim LocsfileContent(0) as String
+ LocsfileContent(0) = &quot;*&quot;
+ ReadDirectories(&quot;file:///space&quot;, LocsfileContent(), True, False, false)
+End Sub
+
+&apos; ReadDirectories( sSourceDir, bRecursive, bCheckRealType, False, sFileContent(), sLocExtension)
+
+Function ReadDirectories(ByVal AnchorDir As String, bRecursive as Boolean, bcheckFileType as Boolean, bGetByTitle as Boolean, Optional sFileContent(), Optional sExtension as String)
+Dim i as integer
+Dim Status as Object
+Dim FileCountinDir as Integer
+Dim RealFileContent as String
+Dim FileName as string
+Dim oUcbObject as Object
+Dim DirContent()
+Dim CurIndex as Integer
+Dim MaxIndex as Integer
+Dim StartUbound as Integer
+Dim FileExtension as String
+ StartUbound = 5
+ MaxIndex = StartUBound
+ CurDirMaxCount = SBMAXDIRCOUNT
+Dim sFileArray(StartUbound,1) as String
+ On Local Error Goto FILESYSTEMPROBLEM:
+ CurIndex = -1
+ &apos; Todo: Is the last separator valid?
+ DirIndex = 0
+ sDirArray(iDirIndex) = AnchorDir
+ iDirCount = 1
+ oDocInfo = CreateUnoService(&quot;com.sun.star.document.DocumentProperties&quot;)
+ oUcbObject = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ If oUcbObject.Exists(AnchorDir) Then
+ Do
+ AnchorDir = sDirArray(DirIndex)
+ On Local Error Resume Next
+ DirContent() = oUcbObject.GetFolderContents(AnchorDir,True)
+ DirIndex = DirIndex + 1
+ On Local Error Goto 0
+ On Local Error Goto FILESYSTEMPROBLEM:
+ If Ubound(DirContent()) &lt;&gt; -1 Then
+ FileCountinDir = Ubound(DirContent())+ 1
+ For i = 0 to FilecountinDir -1
+ If bInterruptSearch = True Then
+ Exit Do
+ End If
+
+ Filename = DirContent(i)
+ If oUcbObject.IsFolder(FileName) Then
+ If brecursive Then
+ AddFoldertoList(FileName, DirIndex)
+ End If
+ Else
+ If bcheckFileType Then
+ RealFileContent = GetRealFileContent(FileName)
+ Else
+ RealFileContent = GetFileNameExtension(FileName)
+ End If
+ If RealFileContent &lt;&gt; &quot;&quot; Then
+ &apos; Retrieve the Index in the Array, where a Filename is positioned
+ If Not IsMissing(sFileContent()) Then
+ If (FieldinArray(sFileContent(), Ubound(sFileContent), RealFileContent)) Then
+ &apos; The extension of the current file passes the filter and is therefor admitted to the
+ &apos; fileList
+ If Not IsMissing(sExtension) Then
+ If sExtension &lt;&gt; &quot;&quot; Then
+ &apos; Consider that some Formats like old StarOffice Templates with the extension &quot;.vor&quot; can only be
+ &apos; precisely identified by their mimetype and their extension
+ FileExtension = GetFileNameExtension(FileName)
+ If FileExtension = sExtension Then
+ AddFileNameToList(sFileArray(), FileName, RealFileContent, bGetByTitle, CurIndex)
+ End If
+ Else
+ AddFileNameToList(sFileArray(), FileName, RealFileContent, bGetByTitle, CurIndex)
+ End If
+ Else
+ AddFileNameToList(sFileArray(), FileName, RealFileContent, bGetByTitle, CurIndex)
+ End If
+ End If
+ Else
+ AddFileNameToList(sFileArray(), FileName, RealFileContent, bGetByTitle, CurIndex)
+ End If
+ If CurIndex = MaxIndex Then
+ MaxIndex = MaxIndex + StartUbound
+ ReDim Preserve sFileArray(MaxIndex,1) as String
+ End If
+ End If
+ End If
+ Next i
+ End If
+ Loop Until DirIndex &gt;= iDirCount
+ If CurIndex &gt; -1 Then
+ ReDim Preserve sFileArray(CurIndex,1) as String
+ Else
+ ReDim sFileArray() as String
+ End If
+ Else
+ Msgbox(&quot;Directory &apos;&quot; &amp; ConvertFromUrl(AnchorDir) &amp; &quot;&apos; does not exist!&quot;, 16, GetProductName())
+ End If
+ ReadDirectories() = sFileArray()
+ Exit Function
+
+ FILESYSTEMPROBLEM:
+ Msgbox(&quot;Sorry, Filesystem Problem&quot;)
+ ReadDirectories() = sFileArray()
+ Resume LEAVEPROC
+ LEAVEPROC:
+End Function
+
+
+Sub AddFoldertoList(sDirURL as String, iDirIndex)
+ iDirCount = iDirCount + 1
+ If iDirCount = CurDirMaxCount Then
+ CurDirMaxCount = CurDirMaxCount + SBMAXDIRCOUNT
+ ReDim Preserve sDirArray(CurDirMaxCount) as String
+ End If
+ sDirArray(iDirCount-1) = sDirURL
+End Sub
+
+
+Sub AddFileNameToList(sFileArray(), FileName as String, FileContent as String, bGetByTitle as Boolean, CurIndex)
+Dim FileCount As Integer
+ CurIndex = CurIndex + 1
+ sFileArray(CurIndex,0) = FileName
+ If bGetByTitle Then
+ sFileArray(CurIndex,1) = RetrieveDocTitle(oDocInfo, FileName)
+ &apos; Add the documenttitles to the Filearray
+ Else
+ sFileArray(CurIndex,1) = FileContent
+ End If
+End Sub
+
+
+Function RetrieveDocTitle(oDocProps as Object, sFileName as String) As String
+Dim sDocTitle as String
+ On Local Error Goto NOFILE
+ oDocProps.loadFromMedium(sFileName, NoArgs())
+ sDocTitle = oDocProps.Title
+ NOFILE:
+ If Err &lt;&gt; 0 Then
+ RetrieveDocTitle = &quot;&quot;
+ RESUME CLR_ERROR
+ End If
+ CLR_ERROR:
+ If sDocTitle = &quot;&quot; Then
+ sDocTitle = GetFileNameWithoutExtension(sFilename, &quot;/&quot;)
+ End If
+ RetrieveDocTitle = sDocTitle
+End Function
+
+
+&apos; Retrieves The Filecontent of a Document by extracting the content
+&apos; from the Header of the document
+Function GetRealFileContent(FileName as String) As String
+ On Local Error Goto NOFILE
+ oTypeDetect = createUnoService(&quot;com.sun.star.document.TypeDetection&quot;)
+ GetRealFileContent = oTypeDetect.queryTypeByURL(FileName)
+ NOFILE:
+ If Err &lt;&gt; 0 Then
+ GetRealFileContent = &quot;&quot;
+ resume CLR_ERROR
+ End If
+ CLR_ERROR:
+End Function
+
+
+Function CopyRecursively(SourceFilePath as String, SourceStemDir as String, TargetStemDir as String)
+Dim TargetDir as String
+Dim TargetFile as String
+
+ TargetFile= ReplaceString(SourceFilePath, TargetStemDir, SourceStemDir)
+ TargetFileName = FileNameoutofPath(TargetFile,&quot;/&quot;)
+ TargetDir = DeleteStr(TargetFile, TargetFileName)
+ CreateFolder(TargetDir)
+ CopyRecursively() = TargetFile
+End Function
+
+
+&apos; Opens a help url referenced by a Help ID that is retrieved from the calling button tag
+Sub ShowHelperDialog(aEvent)
+Dim oSystemNode as Object
+Dim sSystem as String
+Dim oLanguageNode as Object
+Dim sLocale as String
+Dim sLocaleList() as String
+Dim sLanguage as String
+Dim sHelpUrl as String
+Dim sDocType as String
+ HelpID = aEvent.Source.Model.Tag
+ oLocDocument = StarDesktop.ActiveFrame.Controller.Model
+ sDocType = GetDocumentType(oLocDocument)
+ oSystemNode = GetRegistryKeyContent(&quot;org.openoffice.Office.Common/Help&quot;)
+ sSystem = oSystemNode.GetByName(&quot;System&quot;)
+ oLanguageNode = GetRegistryKeyContent(&quot;org.openoffice.Setup/L10N/&quot;)
+ sLocale = oLanguageNode.getByName(&quot;ooLocale&quot;)
+ sLocaleList() = ArrayoutofString(sLocale, &quot;-&quot;)
+ sLanguage = sLocaleList(0)
+ sHelpUrl = &quot;vnd.sun.star.help://&quot; &amp; sDocType &amp; &quot;/&quot; &amp; HelpID &amp; &quot;?Language=&quot; &amp; sLanguage &amp; &quot;&amp;System=&quot; &amp; sSystem
+ StarDesktop.LoadComponentfromUrl(sHelpUrl, &quot;OFFICE_HELP&quot;, 63, NoArgs())
+End Sub
+
+
+Sub SaveDataToFile(FilePath as String, DataList())
+Dim FileChannel as Integer
+Dim i as Integer
+Dim oFile as Object
+Dim oOutputStream as Object
+Dim oStreamString as Object
+Dim oUcb as Object
+Dim sCRLF as String
+
+ sCRLF = CHR(13) &amp; CHR(10)
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ oOutputStream = createUnoService(&quot;com.sun.star.io.TextOutputStream&quot;)
+ If oUcb.Exists(FilePath) Then
+ oUcb.Kill(FilePath)
+ End If
+ oFile = oUcb.OpenFileReadWrite(FilePath)
+ oOutputStream.SetOutputStream(oFile.GetOutputStream)
+ For i = 0 To Ubound(DataList())
+ oOutputStream.WriteString(DataList(i) &amp; sCRLF)
+ Next i
+ oOutputStream.CloseOutput()
+End Sub
+
+
+Function LoadDataFromFile(FilePath as String, DataList()) as Boolean
+Dim oInputStream as Object
+Dim i as Integer
+Dim oUcb as Object
+Dim oFile as Object
+Dim MaxIndex as Integer
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ If oUcb.Exists(FilePath) Then
+ MaxIndex = 10
+ oInputStream = createUnoService(&quot;com.sun.star.io.TextInputStream&quot;)
+ oFile = oUcb.OpenFileReadWrite(FilePath)
+ oInputStream.SetInputStream(oFile.GetInputStream)
+ i = -1
+ Redim Preserve DataList(MaxIndex)
+ While Not oInputStream.IsEOF
+ i = i + 1
+ If i &gt; MaxIndex Then
+ MaxIndex = MaxIndex + 10
+ Redim Preserve DataList(MaxIndex)
+ End If
+ DataList(i) = oInputStream.ReadLine
+ Wend
+ If i &gt; -1 And i &lt;&gt; MaxIndex Then
+ Redim Preserve DataList(i)
+ End If
+ LoadDataFromFile() = True
+ oInputStream.CloseInput()
+ Else
+ LoadDataFromFile() = False
+ End If
+End Function
+
+
+Function CreateFolder(sNewFolder) as Boolean
+Dim oUcb as Object
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ On Local Error Goto NOSPACEONDRIVE
+ If Not oUcb.Exists(sNewFolder) Then
+ oUcb.CreateFolder(sNewFolder)
+ End If
+ CreateFolder = True
+NOSPACEONDRIVE:
+ If Err &lt;&gt; 0 Then
+ If InitResources(&quot;&quot;, &quot;dbw&quot;) Then
+ ErrMsg = GetResText(500)
+ ErrMsg = ReplaceString(ErrMsg, chr(13), &quot;&lt;BR&gt;&quot;)
+ ErrMsg = ReplaceString(ErrMsg, sNewFolder, &quot;%1&quot;)
+ Msgbox(ErrMsg, 48, GetProductName())
+ End If
+ CreateFolder = False
+ Resume GOON
+ End If
+GOON:
+End Function
+</script:module>
diff --git a/wizards/source/tools/delzip b/wizards/source/tools/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/tools/delzip
diff --git a/wizards/source/tools/dialog.xlb b/wizards/source/tools/dialog.xlb
new file mode 100644
index 000000000000..dc8dfbda2701
--- /dev/null
+++ b/wizards/source/tools/dialog.xlb
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Tools" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="DlgOverwriteAll"/>
+</library:library>
diff --git a/wizards/source/tools/makefile.mk b/wizards/source/tools/makefile.mk
new file mode 100644
index 000000000000..801db34b4c3f
--- /dev/null
+++ b/wizards/source/tools/makefile.mk
@@ -0,0 +1,45 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=tools
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+ZIP1TARGET = $(TOOLS_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/tools/script.xlb b/wizards/source/tools/script.xlb
new file mode 100644
index 000000000000..fe4d74d60332
--- /dev/null
+++ b/wizards/source/tools/script.xlb
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Tools" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="ModuleControls"/>
+ <library:element library:name="Strings"/>
+ <library:element library:name="Misc"/>
+ <library:element library:name="UCB"/>
+ <library:element library:name="Listbox"/>
+ <library:element library:name="Debug"/>
+</library:library> \ No newline at end of file
diff --git a/wizards/source/tutorials/Functions.xba b/wizards/source/tutorials/Functions.xba
new file mode 100644
index 000000000000..6524ec19338c
--- /dev/null
+++ b/wizards/source/tutorials/Functions.xba
@@ -0,0 +1,368 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Functions" script:language="StarBasic">REM ***** BASIC *****
+Dim DialogVisible As Boolean
+Dim TutorStep As Integer
+Dim TutorLastStep As Integer
+Dim myDialog As Object
+Dim myTutorial As Object
+Public TutorText() As String
+Dim documentTitle As String
+Dim exampleUse As Object
+Dim properties() As Object
+Dim docTYP As String
+&apos;public myWidth As Long
+Dim myHeight As Long
+Dim oTextField As Object
+Dim stepTitle As String
+Dim oOpenDialogFlag
+Dim imageStatus As String
+
+Sub LoadTutorialDialog(exampleToUse, documentTYP)
+ Init()
+ exampleUse = exampleToUse
+ TutorText() = exampleUse.LoadText()
+ properties() = exampleUse.GetProperties()
+ If properties(3).Value = &quot;True&quot; Then
+ Dim localisation(0) As new com.sun.star.beans.NamedValue
+ localisation(0).Name = &quot;Localisation&quot;
+ localisation(0).Value = properties()
+ myTutorial.execute(localisation())
+ Else
+ TutorStep = 0
+ TutorLastStep = 0
+ docTYP = documentTYP
+ InitAction()
+ ShowInfoMain()
+ DialogVisible = True
+ myDialog = LoadDialog(&quot;Tutorials&quot;,&quot;TutorialsDialog&quot;)
+
+ SetTutorialDocumentPosSize()
+
+ documentProps = ThisComponent.getDocumentProperties()
+ myDialog.Title = &quot;Tutorials - &quot; &amp; documentProps.Title
+ oTextField = myDialog.GetControl(&quot;myTextField&quot;)
+ oTextField.setVisible(False)
+
+ imageStatus = &quot;MIN&quot;
+ setMaxMinImage(imageStatus)
+
+ &apos;myWidth = myDialog.Size.Width
+ myHeight = myDialog.Size.Height
+
+ CheckForStepShowButtonStatus()
+ CheckForStepNextButtonStatus()
+ InitRoadMap()
+ SetVisibleTrue()
+ myDialog.model.myTextField.Label = stepTitle
+ myDialog.model.myText.Label = GetStepText()&apos;TutorText(TutorStep)
+
+
+ Do
+ wait 1000
+ Loop Until DialogVisible = False
+ If( oOpenDialogFlag = True) Then
+ Destroy()
+ TutorialOpen.TutorialOpenMain()
+ Else
+ Destroy()
+ End If
+ End If
+End Sub
+
+Sub setMaxMinImage(param As String)
+ On Local Error Goto NOIMAGE
+ oCommandButton = myDialog.GetControl(&quot;CommandButton&quot;)
+ templatePath = GetPathSettings(&quot;Template&quot;,false, 0)
+ Dim bitmapPath As String
+ iPos = InStr(templatePath,&quot;/&quot;)
+ If(iPos &gt; 0) Then
+ If(param = &quot;MAX&quot;) Then
+ bitmapPath = templatePath &amp; &quot;/wizard/bitmap/maximize.bmp&quot;
+ ElseIf(param = &quot;MIN&quot;) Then
+ bitmapPath = templatePath &amp; &quot;/wizard/bitmap/minimize.bmp&quot;
+ End If
+ Else
+ If(param = &quot;MAX&quot;) Then
+ bitmapPath = templatePath &amp; &quot;\wizard\bitmap\maximize.bmp&quot;
+ ElseIf(param = &quot;MIN&quot;) Then
+ bitmapPath = templatePath &amp; &quot;\wizard\bitmap\minimize.bmp&quot;
+ End If
+ End If
+ &apos;printdbgInfo oCommandButton.Model
+ oCommandButton.Model.ImageUrl = bitmapPath
+ Exit Sub
+ NOIMAGE:
+End Sub
+
+Sub SetTutorialDocumentPosSize()
+ activDesktopWindow = StarDesktop.activeFrame.ContainerWindow
+ If(activDesktopWindow.posSize.Height &lt; 550) Then
+ activDesktopWindow.setPosSize(0,0,0,550,8)
+ End If
+ If (activDesktopWindow.posSize.Width &lt; 750 ) Then
+ activDesktopWindow.setPosSize(0,0,750,0,4)
+ EndIf
+End Sub
+
+Sub InitRoadMap()
+ RoadMapMain(Functions, myDialog)
+ SetControlModelPosSize(0, 0, 85, 176)
+ SetControlModelText(&quot;Steps&quot;)
+
+ StepSize = Ubound(TutorText())
+ Dim ItemsArray(StepSize) as String
+ For i = 0 To StepSize
+ stepcontent = TutorText(i)
+ iPos = InStr(stepcontent,CHR(13))
+ ItemName = Left(stepcontent, iPos)
+ ItemsArray(i) = ItemName
+ Next i
+ InsertItemsLabels( ItemsArray())
+
+ For i = 1 To StepSize
+ SetItemEnabled( i, False)
+ Next i
+ SetItemEnabled( 0, True)
+End Sub
+
+Sub Destroy()
+ &apos;myDialog.dispose
+ wait 1000
+ ShowInfoDialog.DisposeIDialog()
+
+ &apos; HIER WIRD DAS DOCUMENT GESCHLOSSEN!!!!!!!! GPF
+ thisComponent.CurrentController.Frame.close(True)
+
+End Sub
+
+Sub Init
+ GlobalScope.BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ myTutorial = createUNOService(&quot;com.sun.star.wizards.tutorial.executer.CallTutorialFramework&quot;)
+ documentTitle = ThisComponent.getCurrentController.getFrame.Title
+End Sub
+
+Sub InitStep
+ udProps = ThisComponent.DocumentProperties.UserDefinedProperties
+ If udProps.PropertySetInfo.hasPropertyByName(&quot;CurrentStep&quot;) Then
+ TutorStep = udProps.CurrentStep
+ Else
+ udProps.addProperty(&quot;CurrentStep&quot;, 0, TutorStep)
+ End If
+End Sub
+
+Sub setStep
+ ThisComponent.DocumentProperties.UserDefinedProperties.CurrentStep = TutorStep
+End Sub
+
+Sub InitAction()
+ SetStepTitle()
+
+ Dim property(6) As new com.sun.star.beans.PropertyValue
+ property(0).Name = &quot;DocumentTYP&quot;
+ property(0).Value = docTYP
+ property(1).Name = &quot;MethodName&quot;
+ property(1).Value = &quot;setDelay&quot;
+ property(2).Name = &quot;Param&quot;
+ property(2).Value = 0 &apos;key insert speed (Millis)
+ property(3).Name = &quot;Param&quot;
+ property(3).Value = 4 &apos;mouse animate speed (Millis)
+ property(4).Name = &quot;Param&quot;
+ property(4).Value = 2000 &apos;after mouse animate sleep (Millis)
+ property(5).Name = &quot;Param&quot;
+ property(5).Value = 10 &apos;mouse scroll speed (Millis)
+ property(6).Name = &quot;Param&quot;
+ property(6).Value = -1 &apos;mouse speed (step)
+ myTutorial.setPropertyValues(property())
+End Sub
+
+Sub EndDialog
+ oOpenDialogFlag = False
+ If (myDialog.model.done.Label = &quot;Close&quot;) Then
+ TutorialCloseMain()
+ Else
+ DialogVisible = False
+ End If
+End Sub
+
+Sub NextStep
+ GotoStep(TutorStep + 1)
+End Sub
+
+Sub GotoStep(StepIndex)
+ If(StepIndex &lt;= Ubound(TutorText())) Then
+ TutorStep = StepIndex
+ If TutorStep &gt; TutorLastStep Then
+ TutorLastStep = TutorStep
+ End If
+ If(TutorStep = Ubound(TutorText())) Then
+ myDialog.model.next.enabled = False
+ myDialog.model.done.Label = &quot;Done&quot;
+ myDialog.model.show.Label = &quot;Tutorials&quot;
+ Else
+ myDialog.model.next.enabled = True
+ End If
+ SetStepTitle()
+ myDialog.model.myText.Label = GetStepText()
+ CheckForStepShowButtonStatus()
+ SetItemEnabled( TutorStep, True)
+ &apos;setStep()
+ End If
+End Sub
+
+Function GetStepText()
+ Dim tempText As String
+ tempText = TutorText(TutorStep)
+ iPos = InStr(tempText,CHR(13))
+ ResultString = Right(tempText, Len(tempText) - iPos - 1)
+ GetStepText() = ResultString
+End Function
+
+Sub ItemChange(CurrentItemID, SelectitemID)
+ GotoStep(SelectitemID)
+End Sub
+
+Sub SetDisableShowMeButton()
+ myDialog.model.show.enabled = False
+ TutorLastStep = TutorLastStep + 1
+End Sub
+
+Sub Minimize(aEvent)
+ ActionItemsTextField = myDialog.GetControl(&quot;ActionItemsLabel&quot;)
+ FixedLineVertikal = myDialog.GetControl(&quot;FixedLineVertikal&quot;)
+
+ If myDialog.Size.Height = 35 Then
+ myDialog.setPosSize(0,0,0,myHeight,8)
+ oTextField.setVisible(False)
+ ActionItemsTextField.setVisible(True)
+ FixedLineVertikal.setVisible(True)
+ RoadMap.SetVisibleRoadMap(True)
+ Else
+ myDialog.setPosSize(0,0,0,35,8)
+ rmSelectedIndex = RoadMap.GetSelectedIndex() + 1
+ gsTitle = GetStepTitle()
+ oTextField.setText(rmSelectedIndex &amp; &quot;. &quot; &amp; gsTitle)
+ oTextField.setVisible(True)
+ ActionItemsTextField.setVisible(False)
+ FixedLineVertikal.setVisible(False)
+ RoadMap.SetVisibleRoadMap(False)
+ End If
+ If(imageStatus = &quot;MAX&quot;) Then
+ imageStatus = &quot;MIN&quot;
+ ElseIf(imageStatus = &quot;MIN&quot;) Then
+ imageStatus = &quot;MAX&quot;
+ End If
+ setMaxMinImage(imageStatus)
+
+End Sub
+
+Sub SetStepTitle()
+ stepcontent = TutorText(TutorStep)
+ iPos = InStr(stepcontent,CHR(13))
+ stepTitle = Left(stepcontent, iPos)
+ SetStepTitle() = stepTitle
+End Sub
+
+Function GetStepTitle()
+ GetStepTitle() = stepTitle
+End Function
+
+Sub CheckForStepShowButtonStatus()
+ If ((exampleUse.ContainsStepAction() = True And TutorStep = TutorLastStep) Or myDialog.model.show.Label = &quot;Tutorials&quot;) Then
+ myDialog.model.show.enabled = True
+ Else
+ myDialog.model.show.enabled = False
+ End If
+End Sub
+
+Sub CheckForStepNextButtonStatus()
+ If(TutorStep = Ubound(TutorText())) Then
+ myDialog.model.next.enabled = False
+ myDialog.model.done.Label = &quot;Done&quot;
+ End If
+End Sub
+
+Sub Show(aEvent)
+ &apos;ShowInfoMain()
+ If( myDialog.model.show.Label = &quot;Tutorials&quot;) Then
+ oOpenDialogFlag = True
+ DialogVisible = False
+ Else
+ SetMousePosition(aEvent)
+ exampleUse.Action()
+ End If
+End Sub
+
+Sub SetMousePosition(aEvent)
+ MyPoints() = MousePoints(aEvent)
+
+ Dim mousePosition(3) as new com.sun.star.beans.PropertyValue
+ mousePosition(0).Name = &quot;DocumentTYP&quot;
+ mousePosition(0).Value = docTYP
+ mousePosition(1).Name = &quot;MethodName&quot;
+ mousePosition(1).Value = &quot;setMousePosition&quot;
+ mousePosition(2).Name = &quot;Param&quot;
+ mousePosition(2).Value = MyPoints(0)
+ mousePosition(3).Name = &quot;Param&quot;
+ mousePosition(3).Value = MyPoints(1)
+
+ myTutorial.setPropertyValues(mousePosition())
+End Sub
+
+Function MousePoints(aEvent)
+ Dim position(1) As Integer
+ position(0) = myDialog.getControl(&quot;show&quot;).AccessibleContext.LocationOnScreen.X + aEvent.Source.Model.PositionX
+ position(1) = myDialog.getControl(&quot;show&quot;).AccessibleContext.LocationOnScreen.Y + aEvent.Source.Model.PositionY
+ MousePoints = position()
+End Function
+
+Function CheckPath(path() As String)
+ &apos;documentTitle = ThisComponent.getCurrentController.getFrame.Title
+ sTitle = path(0)
+ ResultString = Right(sTitle, 3)
+ iPos = InStr(ResultString,&quot;#&quot;)
+ ResultString = Right(ResultString, Len(ResultString) - iPos)
+ ResultFrameString = InStr (sTitle, &quot;{D}FRAME#&quot;)
+ If ResultFrameString &lt;&gt; 0 Then
+ If Not (sTitle = (&quot;{D}FRAME#&quot; &amp; documentTitle &amp; &quot;#&quot; &amp; ResultString)) Then
+ &apos;path(0) = &quot;{D}FRAME#&quot; &amp; documentTitle &amp; &quot;#&quot; &amp; ResultString
+ path(0) = &quot;FRAME#&quot; &amp; documentTitle &amp; &quot;#&quot; &amp; ResultString
+ sTitle = path(1)
+ ResultString = Right(sTitle, 3)
+ iPos = InStr(ResultString,&quot;#&quot;)
+ ResultString = Right(ResultString, Len(ResultString) - iPos)
+ path(1) = &quot;ROOT_PANE#&quot; &amp; documentTitle &amp; &quot;#&quot; &amp; ResultString
+ Else
+ &apos;path(0) = &quot;{D}FRAME#&quot; &amp; documentTitle &amp; &quot;#&quot; &amp; ResultString
+ path(0) = &quot;FRAME#&quot; &amp; documentTitle &amp; &quot;#&quot; &amp; ResultString
+ End If
+ End If
+End Function
+
+Sub SetVisibleTutorialsDialog(param)
+ myDialog.setVisible(param)
+End Sub
+
+Sub SetVisibleTrue()
+ myDialog.setVisible(True)
+End Sub
+
+Sub SetVisibleFalse()
+ myDialog.setVisible(False)
+End Sub
+
+Sub ExitTutorial()
+ Dim aUrl As new com.sun.star.util.URL
+ oDoc = ThisComponent
+ urlTransformer = createUNOService(&quot;com.sun.star.util.URLTransformer&quot;)
+ aUrl.Complete = &quot;slot:5621&quot;
+ urlTransformer.parseStrict(aUrl)
+ xController = oDoc.getCurrentController()
+ xDispatcher = xController.queryDispatch(aUrl, &quot;&quot;, 0)
+ if NOT isNull(xDispatcher) then
+ xDispatcher.dispatch(aUrl, DimArray())
+ else
+ msgBox &quot;Error! Cannot close document.&quot;
+ End If
+End Sub
+</script:module>
diff --git a/wizards/source/tutorials/RoadMap.xba b/wizards/source/tutorials/RoadMap.xba
new file mode 100644
index 000000000000..fa992cb13b8c
--- /dev/null
+++ b/wizards/source/tutorials/RoadMap.xba
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="RoadMap" script:language="StarBasic">REM ***** BASIC *****
+Dim oControlModel
+Dim oDialogModel
+Dim CurrentItem
+Dim bLongString
+Dim oControl
+Dim oEvent
+Dim oUseDialog As Object
+Dim oModulName As Object
+
+Sub RoadMapMain(ModulNameforItemChange, dialogtoUse)
+ GlobalScope.BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ oUseDialog = dialogtoUse
+ oModulName = ModulNameforItemChange
+ oDialogModel = oUseDialog.Model
+ oControlModel = oUseDialog.Model.CreateInstance(&quot;com.sun.star.awt.UnoControlRoadmapModel&quot;)
+
+ oDialogModel.insertByName(&quot;RoadMap&quot;, oControlModel)
+ oControl = oUseDialog.getControl(&quot;RoadMap&quot;)
+ oEvent = createUnoListener( &quot;CallBack_&quot;, &quot;com.sun.star.awt.XItemListener&quot; )
+ oControl.addItemListener(oEvent)
+ oControlModel.CurrentItemID = 0
+ oControlModel.Complete = True
+ oControlModel.Activated = True
+End Sub
+
+Sub SetVisibleRoadMap(param)
+ oControl.SetVisible(param)
+End Sub
+
+Sub SetDialogModelSize(Width, Height)
+ oDialogModel.Width = Width
+ oDialogModel.Height = Height
+End Sub
+
+Sub SetControlModelPosSize(X, Y, Width, Height)
+ oControlModel.PositionX = X
+ oControlModel.PositionY = Y
+ oControlModel.Width = Width
+ oControlModel.Height = Height
+End Sub
+
+Sub SetControlModelText( ModelText As String)
+ oControlModel.Text = ModelText
+End Sub
+
+Sub InsertItemsLabels( ItemLabelsArray() As String)
+ For i = 0 To Ubound(ItemLabelsArray())
+ oRoadmapItem = oControlModel.createInstance()
+ oRoadmapItem.Label = ItemLabelsArray(i)
+ oRoadmapItem.ID = i
+ oControlModel.insertbyIndex(i, oRoadmapItem)
+ Next i
+End Sub
+
+Sub SetItemEnabled( ItemIndex, param)
+ oControlModel.getByIndex(ItemIndex).Enabled = param
+ oControlModel.CurrentItemID = ItemIndex
+End Sub
+
+Sub AddImagetoControlModel( Url As String)
+ oControlModel.ImageUrl = ConvertToUrl(Url)
+End Sub
+
+Function GetSelectedIndex()
+ GetSelectedIndex() = oControlModel.CurrentItemID
+End Function
+
+Function GetControlModel()
+ GetControlModel = oControlModel
+End Function
+
+Function GetDialogModel()
+ GetDialogModel = oDialogModel
+End Function
+
+Sub Callback_itemStateChanged(aEvent)
+ oModulName.ItemChange(oControlModel.CurrentItemID, aEvent.itemID)
+End Sub
+
+Sub SetComplete(param)
+ oControlModel.Complete = param
+End Sub
+
+Sub SetActivated(param)
+ oControlModel.Activated = param
+End Sub
+
+Sub RemoveItem(ItemIndex)
+ If ItemIndex &gt; -1 Then
+ oControlModel.removeByIndex(ItemIndex)
+ End If
+End Sub
+
+Sub InsertItem(ItemLabel As String)
+ oRoadmapItem = oControlModel.createInstance()
+ oRoadmapItem.Label = ItemLabel
+ oControlModel.insertbyIndex(oControlModel.CurrentItemID, oRoadmapItem)
+End Sub
+
+Sub ReplaceItem(ItemLabel As String)
+ oRoadmapItem = oControlModel.createInstance()
+ oRoadmapItem.Label = ItemLabel
+ oControlModel.replacebyIndex(oControlModel.CurrentItemID, oRoadmapItem)
+End Sub
+
+Sub Callback_disposing(aEvent)
+End Sub
+
+Sub Property_propertyChange(aEvent)
+End Sub
+
+Sub Property_disposing(aEvent)
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tutorials/ShowInfoDialog.xba b/wizards/source/tutorials/ShowInfoDialog.xba
new file mode 100644
index 000000000000..4bb0f608d9b6
--- /dev/null
+++ b/wizards/source/tutorials/ShowInfoDialog.xba
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ShowInfoDialog" script:language="StarBasic">REM ***** BASIC *****
+Dim oWnd As Object
+Dim oWnd2 As Object
+Dim oWnd3 As Object
+Dim oDoc as Object
+
+Sub ShowInfoMain
+ prop() = GetShowInfoPropeties()
+ Init(prop(0).Value, prop(1).Value, prop(2).Value, prop(3).Value, prop(4).Value, prop(5).Value, prop(6).Value, prop(7).Value, prop(8).Value)
+End Sub
+
+Sub Init(tFieldText As String, windowX, windowY, windowWidth, windowHeight, tFieldX, tFieldY, tFieldWidth, tFieldHeight)
+ toolkit = createUnoService(&quot;com.sun.star.awt.Toolkit&quot;)
+ Dim oWndDescr As new com.sun.star.awt.WindowDescriptor
+ Dim oBounds As new com.sun.star.awt.Rectangle
+ oWndDescr.Type = com.sun.star.awt.WindowClass.TOP
+ oWndDescr.WindowServiceName = &quot;&quot;
+ oWndDescr.ParentIndex = 0
+
+ &apos;officeX = StarDesktop.ActiveFrame.getContainerWindow().AccessibleContext.LocationOnScreen.X
+ &apos;officeY = StarDesktop.ActiveFrame.getContainerWindow().AccessibleContext.LocationOnScreen.Y
+ &apos;officeWidth = StarDesktop.ActiveFrame.getContainerWindow().getPosSize().Width
+ &apos;officeHeight = StarDesktop.ActiveFrame.getContainerWindow().getPosSize().Height
+ officeWidth = thisComponent.CurrentController.Frame.getContainerWindow().getPosSize().Width
+ officeHeight = thisComponent.CurrentController.Frame.getContainerWindow().getPosSize().Height
+
+ &apos;dialogWidth = myTutoShowDialog.getPosSize().Width
+ &apos;dialogHeight = myTutoShowDialog.getPosSize().Height
+ X = officeWidth - windowWidth - windowX
+ Y = officeHeight - windowHeight - windowY
+
+ oBounds.X = X : oBounds.Y = Y
+ oBounds.Width = windowWidth : oBounds.Height = windowHeight
+ oWndDescr.Bounds = oBounds
+ oWndDescr.Parent = thisComponent.CurrentController.Frame.ContainerWindow
+ with com.sun.star.awt.WindowAttribute
+ oWndDescr.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
+ end with
+
+ oWnd = toolkit.createWindow(oWndDescr)
+
+ Dim oWndDescr3 As new com.sun.star.awt.WindowDescriptor
+ Dim oBounds3 As new com.sun.star.awt.Rectangle
+ oWndDescr3.Type = com.sun.star.awt.WindowClass.TOP
+ oWndDescr3.WindowServiceName = &quot;fixedimage&quot; &apos;&quot;fixedtext&quot;
+ oWndDescr3.ParentIndex = 0
+ oBounds3.X = 0 : oBounds3.Y = 0
+ oBounds3.Width = tFieldWidth : oBounds3.Height = tFieldHeight
+ oWndDescr3.Bounds = oBounds3
+ oWndDescr3.Parent = oWnd
+ with com.sun.star.awt.WindowAttribute
+ oWndDescr3.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
+ end with
+
+ oWnd3= toolkit.createWindow(oWndDescr3)
+ &apos;oWnd2.Text = tFieldText
+ &apos;printdbgInfo(oWnd3)
+ setImage(oWnd3)
+ &apos;oWnd3.Background = 16777215
+&apos; oWnd2.SetBackGround(16776960)
+ oWnd.SetBackGround(16776960)
+&apos; oWnd.FontDescriptors(0).Name = &quot;Albany&quot;
+&apos; oWnd.FontDescriptors(0).StyleName = &quot;BOLD&quot;
+
+ Dim oWndDescr2 As new com.sun.star.awt.WindowDescriptor
+ Dim oBounds2 As new com.sun.star.awt.Rectangle
+ oWndDescr2.Type = com.sun.star.awt.WindowClass.TOP
+ oWndDescr2.WindowServiceName = &quot;fixedtext&quot;
+ oWndDescr2.ParentIndex = 0
+ oBounds2.X = tFieldX : oBounds2.Y = tFieldY
+ oBounds2.Width = tFieldWidth : oBounds2.Height = tFieldHeight
+ oWndDescr2.Bounds = oBounds2
+ oWndDescr2.Parent = oWnd3
+ with com.sun.star.awt.WindowAttribute
+ oWndDescr2.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
+ end with
+
+ oWnd2= toolkit.createWindow(oWndDescr2)
+ oWnd2.Text = tFieldText
+ oWnd2.Background = 268435455
+ &apos;printdbgInfo(oWnd2)
+
+ &apos;printdbgInfo oWnd.getPosSize()
+
+End Sub
+
+Function GetShowInfoPropeties()
+ stepText = GetStepTitle()
+ Dim Properties(8) As new com.sun.star.beans.NamedValue
+ Properties(0).Name = &quot;ShowInfoDialogText&quot;
+ Properties(0).Value = stepText &amp; &quot;Press [Esc] to abort.&quot;
+ Properties(1).Name = &quot;WindowX&quot;
+ Properties(1).Value = 20
+ Properties(2).Name = &quot;WindowY&quot;
+ Properties(2).Value = 40
+ Properties(3).Name = &quot;WindowWidth&quot;
+ Properties(3).Value = 190
+ Properties(4).Name = &quot;WindowHeight&quot;
+ Properties(4).Value = 50
+ Properties(5).Name = &quot;TFieldX&quot;
+ Properties(5).Value = 7
+ Properties(6).Name = &quot;TFieldY&quot;
+ Properties(6).Value = 8
+ Properties(7).Name = &quot;TFieldWidth&quot;
+ Properties(7).Value = 190
+ Properties(8).Name = &quot;TFieldHeight&quot;
+ Properties(8).Value = 50
+ GetShowInfoPropeties = Properties()
+End Function
+
+Sub setShowInfoText()
+ stepText = GetStepTitle()
+ oWnd2.Text = stepText &amp; &quot;Press [Esc] to abort.&quot;
+End Sub
+
+Sub ShowON()
+ setShowInfoText()
+ oWnd.setVisible(True)
+ oWnd3.setVisible(True)
+ oWnd2.setVisible(True)
+End Sub
+
+Sub ShowOFF()
+ &apos;On Local Error Goto NOPROPERTYSETINFO:
+ oWnd.setVisible(False)
+ oWnd2.setVisible(False)
+ oWnd3.setVisible(False)
+ &apos;oDoc.dispose()
+ Exit Sub
+ &apos;NOPROPERTYSETINFO:
+End Sub
+
+Sub DisposeIDialog()
+ &apos;On Local Error Goto NOPROPERTYSETINFO:
+ oWnd3.dispose
+ oWnd2.dispose
+ oWnd.dispose
+ oDoc.dispose()
+ Exit Sub
+ &apos;NOPROPERTYSETINFO:
+End Sub
+
+sub setImage(whatever as Object)
+
+ templatePath = GetPathSettings(&quot;Template&quot;,false, 0)
+ Dim bitmapPath As String
+ iPos = InStr(templatePath,&quot;/&quot;)
+ if(iPos &gt; 0) Then
+ bitmapPath = templatePath &amp; &quot;/wizard/bitmap/tutorial_background.gif&quot;
+ Else
+ bitmapPath = templatePath &amp; &quot;\wizard\bitmap\tutorial_background.gif&quot;
+ End If
+
+ dim props(0) as new com.sun.star.beans.PropertyValue
+ props(0).Name = &quot;Hidden&quot;
+ props(0).Value = true
+ oDoc = StarDesktop.loadComponentFromUrl(&quot;private:factory/swriter&quot;,&quot;_blank&quot;,0,props())
+ oShape = addControlToDefaultForm(&quot;ImageButton&quot;, 1000, 1000, 2000, 1000)
+ imgControl = oShape.getControl()
+ &apos;imgControl.ImageUrl=&quot;file:///D:/Program%20Files/src680_m11_qwizards1_49_TEST/share/gallery/tutoItem.gif&quot;
+ imgControl.ImageUrl = bitmapPath
+ imgControl.addConsumer(whatever)
+ imgControl.startProduction()
+end sub
+
+Function createControlShape(cKind As String) As Object
+
+ Dim oControlShape As Object
+ Dim oControl As Object
+
+
+ oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
+ oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; &amp; cKind)
+ oControl.setPropertyValue(&quot;DefaultControl&quot;, &quot;com.sun.star.form.control.&quot; &amp; cKind)
+ oControlShape.setControl(oControl)
+
+
+ createControlShape() = oControlShape
+
+End Function
+
+Function createControlShapeWithDefaultControl(cKind As String) As Object
+
+ Dim oControlShape As Object
+ Dim oControl As Object
+
+
+ oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
+ oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; &amp; cKind)
+ oControlShape.setControl(oControl)
+
+
+ createControlShapeWithDefaultControl() = oControlShape
+
+End Function
+
+Function createUNOControlShape(cKind As String, defControl As String) As Object
+
+ Dim oControlShape As Object
+ Dim oControl As Object
+
+
+ oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
+ oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; &amp; cKind)
+ oControl.setPropertyValue(&quot;DefaultControl&quot;, &quot;com.sun.star.awt.&quot; &amp; defControl)
+ oControlShape.setControl(oControl)
+
+
+ createUNOControlShape() = oControlShape
+
+End Function
+
+Function addShape(oShape As Object) As Boolean
+
+ Dim vSize As New com.sun.star.awt.Size
+ Dim oDrawPage As Object
+ Dim oForms As Object
+ Dim oForm As Object
+
+ oDrawPage = oDoc.getDrawPage()
+ oForms = oDrawPage.getForms()
+
+ if oForms.Count = 0 then
+ oForm = oDoc.createInstance(&quot;com.sun.star.form.component.Form&quot;)
+ oForms.insertByIndex(0, oForm)
+ end if
+
+ vSize.Height = 2000 : vSize.Width = 2000
+ oShape.Size = vSize
+ oDrawPage.add(oShape)
+
+ addShape() = true
+
+End Function
+
+sub addControl(cKind as String)
+
+ Dim oDrawPage As Object
+ Dim oForm As Object, oForms As Object
+ Dim oControl As Object, oControlShape As Object
+ Dim aSz As Variant
+ Dim oText As Object
+
+ oDrawPage = oDoc.DrawPage
+ oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
+ oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; + cKind)
+ oForm = oDoc.createInstance(&quot;com.sun.star.form.component.Form&quot;)
+ oforms = oDrawPage.Forms
+ if oforms.count = 0 then
+ oforms.insertbyindex(0,oForm)
+ end if
+ oControlShape.Control = oControl
+ oDrawPage.add(oControlShape)
+
+End sub
+
+Function addControlToDefaultForm(cKind as String, x As Integer, y As Integer, width As Integer, height As Integer) As Object
+
+ Dim oDrawPage As Object
+ Dim oControl As Object, oControlShape As Object
+ Dim pos As New com.sun.star.awt.Point
+ Dim size As New com.sun.star.awt.Size
+
+ pos.X = x
+ pos.Y = y
+ size.Width = width
+ size.Height = height
+
+ oDrawPage = oDoc.DrawPage
+ oControlShape = oDoc.createInstance(&quot;com.sun.star.drawing.ControlShape&quot;)
+ oControl = oDoc.createInstance(&quot;com.sun.star.form.component.&quot; + cKind)
+ oControlShape.Control = oControl
+ oControlShape.Position = pos
+ oControlShape.Size = size
+ oDrawPage.add(oControlShape)
+
+ addControlToDefaultForm() = oControlShape
+
+End Function
+
+Function addShapeToDrawDoc(oPage as Object, nPosX, nPosY as Integer, oType As String) As Object
+ Dim aPoint As New com.sun.star.awt.Point
+ Dim aSize As New com.sun.star.awt.Size
+ Dim oShape As Object
+ Dim servNames As Variant
+
+ aPoint.x = nPosX
+ aPoint.y = nPosY
+ aSize.Width = 2000
+ aSize.Height = 1000
+ oShape = oDoc.createInstance(&quot;com.sun.star.drawing.&quot;+oType+&quot;Shape&quot;)
+ oShape.Size = aSize
+ oShape.Position = aPoint
+
+ if oShape.getPropertySetInfo().hasPropertyByName(&quot;FillColor&quot;) then
+ oShape.FillColor = RGB(128, 255, 0)
+ End If
+
+ oPage.add(oShape)
+
+ addShapeToDrawDoc() = oShape
+End Function
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tutorials/TutorialClose.xba b/wizards/source/tutorials/TutorialClose.xba
new file mode 100644
index 000000000000..2438243b82ff
--- /dev/null
+++ b/wizards/source/tutorials/TutorialClose.xba
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="TutorialClose" script:language="StarBasic">REM ***** BASIC *****
+Dim myCloseDialog As Object
+
+Sub TutorialCloseMain
+ myCloseDialog = LoadDialog(&quot;Tutorials&quot;,&quot;TutorialCloseDialog&quot;)
+ myCloseDialog.Execute()
+End Sub
+
+Sub CloseYes(aEvent)
+ myCloseDialog.EndExecute()
+ DialogVisible = False
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tutorials/TutorialCloseDialog.xdl b/wizards/source/tutorials/TutorialCloseDialog.xdl
new file mode 100644
index 000000000000..edc1dae7e699
--- /dev/null
+++ b/wizards/source/tutorials/TutorialCloseDialog.xdl
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="TutorialCloseDialog" dlg:left="173" dlg:top="82" dlg:width="132" dlg:height="38" dlg:closeable="true" dlg:moveable="true">
+ <dlg:styles>
+ <dlg:style dlg:style-id="0" dlg:font-weight="150"/>
+ </dlg:styles>
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="yesButton" dlg:tab-index="1" dlg:left="24" dlg:top="20" dlg:width="50" dlg:height="14" dlg:value="Yes">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tutorials.TutorialClose.CloseYes?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="noButton" dlg:tab-index="0" dlg:left="76" dlg:top="20" dlg:width="50" dlg:height="14" dlg:value="No" dlg:button-type="cancel"/>
+ <dlg:text dlg:style-id="0" dlg:id="Label1" dlg:tab-index="2" dlg:left="6" dlg:top="6" dlg:width="120" dlg:height="8" dlg:value="Do you want to close this Tutorial?." dlg:align="center"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/tutorials/TutorialCreator.xba b/wizards/source/tutorials/TutorialCreator.xba
new file mode 100644
index 000000000000..7169b4e2e467
--- /dev/null
+++ b/wizards/source/tutorials/TutorialCreator.xba
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="TutorialCreator" script:language="StarBasic">REM ***** BASIC *****
+Sub TutorialCreatorMain
+ GlobalScope.BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ myTutorial = createUNOService(&quot;com.sun.star.wizards.tutorial.executer.CallTutorialFramework&quot;)
+ myTutorial.trigger(&quot;StartTutorialCreator&quot;)
+End Sub
+
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tutorials/TutorialOpen.xba b/wizards/source/tutorials/TutorialOpen.xba
new file mode 100644
index 000000000000..a64a72507ba1
--- /dev/null
+++ b/wizards/source/tutorials/TutorialOpen.xba
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="TutorialOpen" script:language="StarBasic">REM ***** BASIC *****
+Dim myOpenDialog As Object
+Dim oListBox As Object
+Dim files As Object
+Dim oUcb As Object
+Dim oListener As Object
+
+Sub TutorialOpenMain
+ GlobalScope.BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ myOpenDialog = LoadDialog(&quot;Tutorials&quot;,&quot;TutorialOpenDialog&quot;)
+ init()
+ myOpenDialog.Execute()
+End Sub
+
+Sub Init
+ On Local Error Goto NOFILE
+ myOpenDialog.Title = &quot;Tutorials&quot;
+ oListBox = myOpenDialog.GetControl(&quot;ListBox&quot;)
+ templatePath = GetPathSettings(&quot;Template&quot;,false, 0)
+ Dim tutorialPath As String
+ iPos = InStr(templatePath,&quot;/&quot;)
+ if(iPos &gt; 0) Then
+ tutorialPath = templatePath &amp; &quot;/tutorials&quot;
+ Else
+ tutorialPath = templatePath &amp; &quot;\tutorials&quot;
+ End If
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ files = oUcb.getFolderContents(tutorialPath,true)
+ size = Ubound( files() )
+ Dim tempFiles(size) As String
+ tempCount = 0
+ For iCount = 0 To size
+ completPath = files(iCount)
+ oDocInfo = CreateUnoService(&quot;com.sun.star.document.DocumentProperties&quot;)
+ oDocInfo.Read(completPath)
+ sDocTitle = oDocInfo.Title
+ if(not isNull(sDocTitle) And len(sDocTitle) &gt; 0) Then
+ oListbox.additem(sDocTitle,0)
+ tempFiles(tempCount) = completPath
+ tempCount = tempCount + 1
+ End If
+ Next iCount
+ &apos;printdbgInfo oListbox
+ size = oListbox.ItemCount - 1
+ Dim tempFiles2(size) As String
+ For iCount = 0 To size
+ tempFiles2(iCount) = tempFiles(iCount)
+ Next iCount
+ files() = tempFiles2()
+ Exit Sub
+ NOFILE:
+ If Err &lt;&gt; 0 Then
+ Msgbox &quot;No file found error!&quot; &amp; CHR(13) &amp; &quot;Path: ...\share\template\...\tutorials\&quot;
+ myOpenDialog.model.Open.enabled = False
+ End If
+End Sub
+
+Sub ItemSelected(oEvent)
+ On Local Error Goto NOFILE
+ completPath = files(Ubound(files()) - oEvent.Selected)
+ oTextField = myOpenDialog.GetControl(&quot;Label&quot;) &apos;TextField
+ oTextField.setText(&quot;&quot;)
+ Dim NoArgs() as new com.sun.star.beans.PropertyValue
+ oDocInfo = CreateUnoService(&quot;com.sun.star.document.DocumentProperties&quot;)
+ oDocInfo.Read(completPath)
+ sDocDescription = oDocInfo.Description
+ if(not isNull(sDocTitle) And len(sDocDescription) &gt; 0) Then
+ oTextField.setText(sDocDescription)
+ Else
+ oTextField.setText(&quot;Not Description!!!.&quot;)
+ End If
+ Exit Sub
+ NOFILE:
+ If Err &lt;&gt; 0 Then
+ Msgbox &quot;Open file error!&quot;
+ End If
+End Sub
+
+Sub OpenTutorial(aEvent)
+ completPath = files(Ubound(files()) - oListBox.getSelectedItemPos())
+ Dim Args(2) as new com.sun.star.beans.PropertyValue
+ Args(1).Name = &quot;MacroExecutionMode&quot;
+ Args(1).Value = com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE
+ Args(2).Name = &quot;AsTemplate&quot;
+ Args(2).Value = true
+
+ StarDesktop.LoadComponentFromURL(completPath,&quot;_default&quot;,0, Args())
+ myOpenDialog.endExecute()
+End Sub
+
+Sub Cancel(aEvent)
+ myOpenDialog.endExecute()
+End Sub
+</script:module> \ No newline at end of file
diff --git a/wizards/source/tutorials/TutorialOpenDialog.xdl b/wizards/source/tutorials/TutorialOpenDialog.xdl
new file mode 100644
index 000000000000..6c9893306c6e
--- /dev/null
+++ b/wizards/source/tutorials/TutorialOpenDialog.xdl
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="TutorialOpenDialog" dlg:left="158" dlg:top="58" dlg:width="250" dlg:height="200" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="Open" dlg:tab-index="1" dlg:left="141" dlg:top="180" dlg:width="50" dlg:height="14" dlg:value="Open">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tutorials.TutorialOpen.OpenTutorial?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="Cancel" dlg:tab-index="2" dlg:left="194" dlg:top="180" dlg:width="50" dlg:height="14" dlg:value="Cancel">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tutorials.TutorialOpen.Cancel?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:menulist dlg:id="ListBox" dlg:tab-index="0" dlg:left="8" dlg:top="17" dlg:width="98" dlg:height="155">
+ <script:event script:event-name="on-performaction" script:location="application" script:macro-name="Tutorials.TutorialOpen.OpenTutorial" script:language="StarBasic"/>
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="Tutorials.TutorialOpen.ItemSelected" script:language="StarBasic"/>
+ </dlg:menulist>
+ <dlg:fixedline dlg:id="FixedLine" dlg:tab-index="3" dlg:left="6" dlg:top="6" dlg:width="100" dlg:height="8" dlg:value="Tutorials"/>
+ <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="4" dlg:left="6" dlg:top="176" dlg:width="238" dlg:height="1"/>
+ <dlg:fixedline dlg:id="FixedLine2" dlg:tab-index="5" dlg:left="110" dlg:top="6" dlg:width="134" dlg:height="8" dlg:value="Description"/>
+ <dlg:fixedline dlg:id="FixedLine3" dlg:tab-index="6" dlg:left="267" dlg:top="44" dlg:width="0" dlg:height="2"/>
+ <dlg:text dlg:id="Label" dlg:tab-index="7" dlg:left="112" dlg:top="17" dlg:width="132" dlg:height="155" dlg:multiline="true"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/tutorials/TutorialsDialog.xdl b/wizards/source/tutorials/TutorialsDialog.xdl
new file mode 100644
index 000000000000..3a211f9f649a
--- /dev/null
+++ b/wizards/source/tutorials/TutorialsDialog.xdl
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="TutorialsDialog" dlg:left="149" dlg:top="54" dlg:width="250" dlg:height="200" dlg:closeable="true" dlg:moveable="true">
+ <dlg:styles>
+ <dlg:style dlg:style-id="0" dlg:font-weight="150"/>
+ </dlg:styles>
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="CommandButton" dlg:tab-index="3" dlg:left="232" dlg:top="4" dlg:width="13" dlg:height="13" dlg:value="C">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tutorials.Functions.Minimize?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:text dlg:id="myText" dlg:tab-index="4" dlg:left="91" dlg:top="26" dlg:width="153" dlg:height="145" dlg:value="This text explains all the action items that the user can do to follow the current step highlighted in the road map at the left side of the tutorial window.&#x0a;&#x0a;1. Open the Format menu&#x0a;2. Choose the Paragraph command&#x0a;3. Click the Numbering tab&#x0a;&#x0a;The first step will always explain what the current tutorial is about.&#x0a;&#x0a;The last step - it is higjlighted currently in the road map - will summarize what the user now has seen or learned." dlg:multiline="true"/>
+ <dlg:button dlg:id="show" dlg:tab-index="1" dlg:left="142" dlg:top="180" dlg:width="50" dlg:height="14" dlg:value="Show me">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tutorials.Functions.Show?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:button dlg:id="next" dlg:tab-index="0" dlg:left="89" dlg:top="180" dlg:width="50" dlg:height="14" dlg:value="Next &gt;&gt;">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tutorials.Functions.NextStep?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:text dlg:style-id="0" dlg:id="myTextField" dlg:tab-index="5" dlg:left="6" dlg:top="6" dlg:width="192" dlg:height="8" dlg:value="Current Step (in Road Map)"/>
+ <dlg:button dlg:id="done" dlg:tab-index="2" dlg:left="195" dlg:top="180" dlg:width="50" dlg:height="14" dlg:value="Close">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:Tutorials.Functions.EndDialog?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:button>
+ <dlg:text dlg:style-id="0" dlg:id="ActionItemsLabel" dlg:tab-index="8" dlg:left="91" dlg:top="8" dlg:width="45" dlg:height="8" dlg:value="Action Items"/>
+ <dlg:fixedline dlg:id="FixedLineHorizontal" dlg:tab-index="7" dlg:left="0" dlg:top="176" dlg:width="250" dlg:height="1"/>
+ <dlg:fixedline dlg:id="FixedLineVertikal" dlg:tab-index="6" dlg:left="85" dlg:top="0" dlg:width="1" dlg:height="176" dlg:align="vertical"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/tutorials/delzip b/wizards/source/tutorials/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/tutorials/delzip
diff --git a/wizards/source/tutorials/dialog.xlb b/wizards/source/tutorials/dialog.xlb
new file mode 100644
index 000000000000..e02b20688a72
--- /dev/null
+++ b/wizards/source/tutorials/dialog.xlb
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Tutorials" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="TutorialsDialog"/>
+ <library:element library:name="TutorialOpenDialog"/>
+ <library:element library:name="TutorialCloseDialog"/>
+</library:library> \ No newline at end of file
diff --git a/wizards/source/tutorials/makefile.mk b/wizards/source/tutorials/makefile.mk
new file mode 100644
index 000000000000..a5f673b1d3f0
--- /dev/null
+++ b/wizards/source/tutorials/makefile.mk
@@ -0,0 +1,45 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=tutorials
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+ZIP1TARGET = $(TUTORIALS_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/tutorials/script.xlb b/wizards/source/tutorials/script.xlb
new file mode 100644
index 000000000000..30280c6b1feb
--- /dev/null
+++ b/wizards/source/tutorials/script.xlb
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Tutorials" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="Functions"/>
+ <library:element library:name="TutorialCreator"/>
+ <library:element library:name="TutorialOpen"/>
+ <library:element library:name="RoadMap"/>
+ <library:element library:name="ShowInfoDialog"/>
+ <library:element library:name="TutorialClose"/>
+</library:library> \ No newline at end of file
diff --git a/wizards/source/webwizard/Bullets.xba b/wizards/source/webwizard/Bullets.xba
new file mode 100644
index 000000000000..78b8fa0b0d52
--- /dev/null
+++ b/wizards/source/webwizard/Bullets.xba
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Bullets" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+
+
+Sub SetBulletGraphics(sBulletUrl as String)
+Dim i as Integer
+Dim oBookMarkCursor as Object
+ oBookmarks = oBaseDocument.BookMarks
+ For i = 0 To oBookmarks.Count - 1
+ oBookMark = oBookmarks.GetbyIndex(i)
+ oBookMarkCursor = oBookMark.Anchor.Text.CreateTextCursorByRange(oBookMark.Anchor)
+ If oBookMarkCursor.PropertySetInfo.HasPropertybyName(&quot;NumberingRules&quot;) Then
+ ChangeBulletURL(sBulletUrl, oBookMarkCursor)
+ End If
+ Next i
+End Sub
+
+
+Sub ChangeBulletURL(sBulletUrl as String, oBookMarkCursor as Object)
+Dim n, m as Integer
+Dim oLevel()
+Dim oRules
+Dim bDoReplace as Boolean
+Dim oSize as New com.sun.star.awt.Size
+Dim oNumberingBuffer(0) as New com.sun.star.beans.PropertyValue
+Dim oNewBuffer(0) as New com.sun.star.beans.PropertyValue
+ oRules = oBookMarkCursor.NumberingRules
+ If Vartype(oRules()) = 9 Then
+ oNumberingBuffer(0).Name = &quot;NumberingType&quot;
+ oNumberingBuffer(0).Value = com.sun.star.style.NumberingType.BITMAP
+ For n = 0 To oRules.Count - 1
+ oLevel() = oRules.GetByIndex(n)
+ bDoReplace = ModifyPropertyValue(oLevel(), oNumberingBuffer())
+ If bDoReplace Then
+ oRules.ReplaceByIndex(n, oNumberingBuffer())
+ End If
+ Next n
+ oBookmarkCursor.NumberingRules = oRules
+ oNewBuffer(0).Name = &quot;GraphicURL&quot;
+ oNewBuffer(0).Value = sBulletUrl
+ For n = 0 To oRules.Count - 1
+ oLevel() = oRules.GetByIndex(0)
+ bDoReplace = ModifyPropertyValue(oLevel(), oNewBuffer())
+ If bDoReplace Then
+ oRules.ReplaceByIndex(n, oNewBuffer())
+ End If
+ Next n
+ oBookmarkCursor.NumberingRules = oRules
+ End If
+End Sub
+
+
+Sub BulletUrlsToSavePath(SavePath as String)
+Dim n as Integer
+Dim m as Integer
+Dim i as Integer
+Dim sNewBulletUrl as String
+Dim oLevel()
+Dim oRules
+Dim bIsFirstRun as Boolean
+Dim oNewBuffer()&apos; as New com.sun.star.beans.PropertyValue
+Dim bDoReplace as Boolean
+Dim oBookmarkCursor as Object
+ bIsFirstRun = True
+ oBookmarks = oBaseDocument.BookMarks
+ For i = 0 To oBookmarks.Count - 1
+ oBookMark = oBookmarks.GetbyIndex(i)
+ oBookMarkCursor = oBookMark.Anchor.Text.CreateTextCursorByRange(oBookMark.Anchor)
+ If oBookMarkCursor.PropertySetInfo.HasPropertybyName(&quot;NumberingRules&quot;) Then
+ oRules = oBookMarkCursor.NumberingRules
+ If Vartype(oRules()) = 9 Then
+ For n = 0 To oRules.Count - 1
+ oLevel() = oRules.GetByIndex(n)
+ oNewBuffer() = ChangeBulletUrlToSavePath(SavePath, oLevel(), bIsFirstRun, bDoReplace)
+ If bDoReplace Then
+ bIsFirstRun = False
+ oRules.ReplaceByIndex(n, oNewBuffer())
+ End If
+ Next n
+ oBookmarkCursor.NumberingRules = oRules
+ End If
+ End If
+ Next i
+End Sub
+
+
+Function ChangeBulletUrlToSavePath(SavePath as String, oLevel(), bIsFirstRun as Boolean, bDoReplace as Boolean)
+Dim MaxIndex as Integer
+Dim i as Integer
+Dim BulletName as String
+Dim oSize as New com.sun.star.awt.Size
+ MaxIndex = Ubound(oLevel())
+ Dim oNewBuffer(MaxIndex) as New com.sun.star.beans.PropertyValue
+ For i = 0 To MaxIndex
+ oNewBuffer(i).Name = oLevel(i).Name
+ If oLevel(i).Name = &quot;GraphicURL&quot; Then
+ bDoReplace = True
+ BulletName = FileNameoutofPath(oLevel(i).Value)
+ If bIsFirstRun Then
+ If oUcb.exists(SavePath &amp; Bulletname) Then
+ FileCopy(oLevel(i).Value, SavePath &amp; BulletName)
+ End If
+ End If
+ oNewBuffer(i).Value = BulletName
+&apos; ElseIf oLevel(i).Name = &quot;GraphicSize&quot; Then
+&apos;&apos; Todo: Get the original Size of the Bullet (see Bug #86196)
+&apos; oSize.Height = 300
+&apos; oSize.Width = 300
+&apos; oNewBuffer(i).Value = oSize
+ Else
+ oNewBuffer(i).Value = oLevel(i).Value
+ End If
+ Next i
+ ChangeBulletUrlToSavePath() = oNewBuffer()
+End Function</script:module> \ No newline at end of file
diff --git a/wizards/source/webwizard/Common.xba b/wizards/source/webwizard/Common.xba
new file mode 100644
index 000000000000..806c49423b67
--- /dev/null
+++ b/wizards/source/webwizard/Common.xba
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Common" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+
+
+Function LoadNewStyles(oDocument as Object, oDialogModel as Object, CurIndex as Integer, SourceFile as String, Styles() as String, TextureDir as String) as Boolean
+Dim BackGroundURL as String
+Dim oBackGraph as Object
+Dim i, BackColor as Long
+Dim bLocWithBackGraphic as Boolean
+Dim oFamilies as Object, oFamily as Object&apos;, oStyle as Object
+Dim StylesOptions(0) as New com.sun.star.beans.PropertyValue
+
+ If SourceFile &lt;&gt; &quot;&quot; Then
+ StylesOptions(0).Name = &quot;OverwriteStyles&quot;
+ StylesOptions(0).Value = True
+ oDocument.StyleFamilies.LoadStylesFromURL(SourceFile, StylesOptions())
+ End If
+
+ &apos; Read array fields for background, bullet &amp; graphics
+ BackgroundURL = Styles(CurIndex, 7)
+ If Left(BackgroundURL, 1) &lt;&gt; &quot;#&quot; Then
+ BackgroundURL = TextureDir + BackgroundURL
+ bLocWithBackGraphic = True
+ Else
+ BackColor = clng(&quot;&amp;H&quot; &amp; Right(BackgroundURL, Len(BackgroundURL)-1))
+ bLocWithBackGraphic = False
+ End If
+ oFamilies = oDocument.StyleFamilies
+ oFamily = oFamilies.GetbyName(&quot;PageStyles&quot;)
+ For i = 0 To oFamily.Count - 1
+ If oFamily.GetByIndex(i).IsInUse Then
+ oStyle = oFamily.GetbyIndex(i)
+ If oStyle.PropertySetInfo.HasPropertybyName(&quot;BackGraphicURL&quot;) Then
+ If Left(BackgroundURL, 1) = &quot;#&quot; Then
+ oStyle.BackGraphicURL = &quot;&quot;
+ oStyle.BackColor = BackColor
+ oStyle.BackTransparent = False
+ Else
+ oStyle.BackGraphicUrl = BackGroundURL
+ SetTileBackgroundorNot(oDialogModel, oStyle)
+ End If
+ Exit For
+ End If
+ End If
+ Next i
+ LoadNewStyles() = bLocWithBackGraphic
+ErrorOcurred:
+ If Err &lt;&gt; 0 Then
+ MsgBox (WebWiz_gErrWhileLoadStyles$, 16, WebWiz_gWizardName$)
+ RESUME EXITSUB
+EXITSUB:
+ End If
+End Function
+
+
+
+Sub ChangeBackGraphicUrl(SavePath as String)
+Dim oPageFamily as Object
+Dim i as Integer
+ oPageFamily = oBaseDocument.StyleFamilies.GetbyName(&quot;PageStyles&quot;)
+ For i = 0 To oPageFamily.Count - 1
+ If oPageFamily.GetByIndex(i).IsInUse Then
+ oStyle = oPageFamily.GetbyIndex(i)
+ If oStyle.PropertySetInfo.HasPropertybyName(&quot;BackGraphicURL&quot;) Then
+ If oStyle.BackGraphicUrl &lt;&gt; &quot;&quot; Then
+ oStyle.BackGraphicUrl = CopyFile(oStyle.BackGraphicUrl, SavePath)
+ Exit Sub
+ End If
+ End If
+ End If
+ Next i
+End Sub
+
+
+Sub SetBackGraphicStyle(oEvent as Object)
+Dim oFamilies as Object
+Dim oFamily as Object
+Dim i as Integer
+Dim oOptModel as Object
+Dim iBackgroundValue as Integer
+Dim oLocDocument as Object
+ ooptModel = oEvent.Source.Model
+ iBackgroundValue = Val(ooptModel.Tag)
+ oLocDocument = StarDesktop.ActiveFrame.Controller.Model
+ oLocDocument.LockControllers
+ oFamilies = oLocDocument.StyleFamilies
+ oFamily = oFamilies.GetbyName(&quot;PageStyles&quot;)
+ For i = 0 To oFamily.Count - 1
+ If oFamily.GetByIndex(i).IsInUse Then
+ oStyle = oFamily.GetbyIndex(i)
+ If oStyle.PropertySetInfo.HasPropertybyName(&quot;BackGraphicURL&quot;) Then
+ oStyle.BackGraphicLocation = iBackgroundValue
+ End If
+ End If
+ Next i
+ oLocDocument.UnlockControllers
+End Sub
+
+
+Sub SetTileBackgroundorNot(DialogModel as Object, oStyle as Object)
+ If Not IsNull(DialogModel) Then
+ If DialogModel.optTiled.State = 1 Then
+ oStyle.BackGraphicLocation = com.sun.star.style.GraphicLocation.TILED
+ Else
+ oStyle.BackGraphicLocation = com.sun.star.style.GraphicLocation.AREA
+ End If
+ End If
+End Sub
+
+
+Sub ToggleOptionButtons(DialogModel as Object, bDoEnable as Integer)
+ If Not IsNull(DialogModel) Then
+ DialogModel.optTiled.Enabled = bDoEnable
+ DialogModel.optArea.Enabled = bDoEnable
+ DialogModel.hlnBackground.Enabled = bDoEnable
+ End If
+End Sub
+
+
+Function GetCurIndex(oListbox as Object, sList() as String, FileIndex as Integer)
+Dim i as Integer
+Dim n as Integer
+Dim SelValue as String
+Dim MaxIndex as Integer
+ If IsNull(oListBox) Then
+ &apos; Startup for WebWizard
+ SelValue = sList(0,1)
+ Else
+ n = oListbox.SelectedItems(0)
+ SelValue = oListbox.StringItemList(n)
+ End If
+ &apos; Find field index for chosen list entry
+ MaxIndex = Ubound(sList)
+ For i = 0 To MaxIndex
+ If sList(i,1) = SelValue Then
+ FileStr = sList(i, FileIndex)
+ Exit For
+ End If
+ Next
+ GetCurIndex = i
+End Function
+
+</script:module> \ No newline at end of file
diff --git a/wizards/source/webwizard/HtmlAutoPilotBasic.xba b/wizards/source/webwizard/HtmlAutoPilotBasic.xba
new file mode 100644
index 000000000000..00675bbf0c74
--- /dev/null
+++ b/wizards/source/webwizard/HtmlAutoPilotBasic.xba
@@ -0,0 +1,436 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="HtmlAutoPilotBasic" script:language="StarBasic">&apos; Variables must be declared
+Option Explicit
+
+Public CurDocIndex as Integer
+Public CurWebPageIndex as Integer
+
+
+Public bWithBackGraphic as Boolean
+Public oStyle as Object
+&apos; Maximum number of content templates, style templates and bullets
+Const MaxLayouts = 50
+Const MaxStyles = 100
+Const MaxBullets = 10
+
+&apos;Public NumberOfLayouts%, NumberOfStyles%
+
+&apos; Filled with title, previous, next, home, top, bullet, background, file name
+Public Style(MaxStyles, 8) as String
+
+Public Layout$(MaxLayouts, 2)
+
+Public TextureDir$, BulletDir$, GraphicsDir$, GalleryDir$, PhotosDir$
+Public SOBitmapPath as String
+Public CurrentBullet$, CurrentPrev$, CurrentNext$, CurrentHome$, CurrentTop$
+Public FileStr as String
+
+Public WebWiz_gWizardName$, WebWiz_gErrContentNotFound$, WebWiz_gErrStyleNotFound$
+Public WebWiz_gErrMainTemplateError$, WebWiz_gErrWhileReloading$
+Public WebWiz_gErrWhileLoadStyles$, WebWiz_gErrMsg$, WebWiz_gErrMainDocumentError$
+
+Public ProgressBar as Object
+Public ProgressValue As Long
+Public oBaseDocument as Object
+Public oViewCursor as Object
+Public oViewSettings as Object
+Public NoArgs() as New com.sun.star.beans.PropertyValue
+
+Public oCursor as Object
+Public oBookmarks as Object
+Public oBookMark as Object
+
+Public oUcb as Object
+Public MainDialog as Object
+Public DialogModel as Object
+
+
+Sub Main
+Dim RetValue
+On Local Error Goto GlobalErrorHandler
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ oBaseDocument = StarDesktop.LoadComponentFromURL(&quot;private:factory/swriter/web&quot;, &quot;_default&quot;, 0, NoArgs())
+ oViewSettings = oBaseDocument.CurrentController.ViewSettings
+ oViewCursor = oBaseDocument.GetCurrentController.ViewCursor
+ CurWebPageIndex = -1
+ ProgressBar = oBaseDocument.GetCurrentController.GetFrame.CreateStatusIndicator
+ ProgressBar.Start(&quot;&quot;, 100)
+ SetProgressValue(2)
+ oBaseDocument.LockControllers
+ oViewSettings.ShowTableBoundaries = False
+ If Not GetWebWizardPaths() Then
+ Exit Sub
+ End If
+ LoadLanguage
+ SetProgressValue(10)
+ Layout() = getListBoxArrays(oUcb, &quot;/cnt&quot;)
+ GetCurIndex(DialogModel, Layout(),2)
+ SetProgressValue(30)
+ oCursor = oBasedocument.Text.CreateTextCursor
+ oCursor.InsertDocumentfromURL(FileStr, NoArgs())
+ SetProgressValue(50)
+ Style() = getListBoxArrays(oUcb, &quot;/stl&quot;)
+ SetProgressValue(70)
+ LoadWebPageStyles(oBaseDocument)
+ SetProgressValue(90)
+ oBaseDocument.UnlockControllers
+ OpenWebDialog()
+ SetProgressValue(98)
+ SetProgressValue(0)
+ MainDialog.Model.ImagePreview.BackGroundColor = RGB(0, 60,126)
+ RetValue = MainDialog.Execute
+ Select Case RetValue
+ Case 0
+ MainDialog.Dispose()
+ DisposeDocument(oBaseDocument)
+ Case 1
+ EndDialog()
+ MainDialog.Dispose()
+ End Select
+GLOBALERRORHANDLER:
+ If Err &lt;&gt; 0 Then
+ MsgBox (WebWiz_gErrMsg$, 16, WebWiz_gWizardName$)
+ DisposeDocument(oBaseDocument)
+ RESUME EXITWIZARD
+EXITWIZARD:
+ End If
+End Sub
+
+
+Function SetProgressValue(iValue as Integer)
+ If iValue = 0 Then
+ ProgressBar.End
+ End If
+ ProgressValue = iValue
+ ProgressBar.Value = iValue
+End Function
+
+
+Sub ReloadCurrentDocument()
+Dim OldDocIndex as Integer
+On Local Error Goto ErrorOcurred
+ OldDocIndex = CurDocIndex
+ CurDocIndex = GetCurIndex(DialogModel.lbTemplate, Layout(), 2)
+ If OldDocIndex &lt;&gt; CurDocIndex Then
+ oBaseDocument.LockControllers
+ ToggleDialogControls(False)
+ oCursor = oBaseDocument.Text.CreateTextCursor()
+ oCursor.GotoStart(False)
+ oCursor.GotoEnd(True)
+ oCursor.SetAllPropertiesToDefault()
+ oCursor.InsertDocumentfromURL(FileStr, NoArgs())
+ SetBulletAndGraphics
+ CheckControls(oBaseDocument.DrawPage)
+ ErrorOcurred:
+ If Err &lt;&gt; 0 Then
+ MsgBox(WebWiz_gErrWhileReloading$, 16, WebWiz_gWizardName$)
+ End If
+ oBaseDocument.UnlockControllers
+ oViewCursor.GotoStart(False)
+ ToggleDialogControls(True, &quot;lbTemplate&quot;)
+ End If
+End Sub
+
+
+
+
+Sub LoadWebPageStyles(aEvent as Object, Optional bStartUp as Boolean)
+Dim OldWebPageIndex as Integer
+ OldWebPageIndex = CurWebPageIndex
+ If IsNull(DialogModel) Then
+ CurWebPageIndex = GetCurIndex(DialogModel, Style(), 8)
+ Else
+ CurWebPageIndex = GetCurIndex(DialogModel.lbStyles, Style(), 8)
+ End If
+ If OldWebPageIndex &lt;&gt; CurWebPageIndex Then
+ ToggleDialogControls(False)
+ oBaseDocument.LockControllers
+ bWithBackGraphic = LoadNewStyles(oBaseDocument, DialogModel, CurWebPageIndex, FileStr, Style(), TextureDir)
+ CurrentBullet$ = BulletDir + Style(CurWebPageIndex, 6)
+ CurrentPrev$ = GraphicsDir + Style(CurWebPageIndex, 2)
+ CurrentNext$ = GraphicsDir + Style(CurWebPageIndex, 3)
+ CurrentHome$ = GraphicsDir + Style(CurWebPageIndex, 4)
+ CurrentTop$ = GraphicsDir + Style(CurWebPageIndex, 5)
+ With oBaseDocument.DocumentProperties.UserDefinedProperties
+ .AutoPilotName1 = ExtractGraphicNames(CurWebPageIndex,2)
+ .AutoPilotName2 = ExtractGraphicNames(CurWebPageIndex, 4)
+ .AutoPilotBullet = Style(CurWebPageIndex, 6)
+ .AutoPilotBackground = Style(CurWebPageIndex, 7)
+ End With
+ SetBulletAndGraphics()
+ CheckControls(oBaseDocument.DrawPage)
+ oViewCursor.GotoStart(False)
+ oBaseDocument.UnlockControllers
+ ToggleDialogControls(True, &quot;lbStyles&quot;)
+ End If
+End Sub
+
+
+Function ExtractGraphicNames(CurIndex as Integer, i as Integer) as String
+Dim FieldValue as String
+ FieldValue = GetFileNameWithoutExtension(Style(CurIndex, i))
+ FieldValue = FieldValue &amp; &quot; &quot; &amp; GetFileNameWithoutExtension(Style(CurIndex, i+1))
+ ExtractGraphicNames = FieldValue
+End Function
+
+
+Sub SetBulletAndGraphics
+ SetGraphic(&quot;Prev&quot;, CurrentPrev)
+ SetGraphic(&quot;Next&quot;, CurrentNext)
+ SetGraphic(&quot;Home&quot;, CurrentHome)
+ SetGraphic(&quot;Top&quot;, CurrentTop)
+ SetBulletGraphics(CurrentBullet)
+ SetGraphicsToOriginalSize()
+End Sub
+
+
+Sub SetGraphicsToOriginalSize()
+Dim oGraphics as Object
+Dim oGraphic as Object
+Dim i as Integer
+Dim aActSize as New com.sun.star.awt.Size
+ oGraphics = oBaseDocument.GraphicObjects
+ For i = 0 To oGraphics.Count-1
+ oGraphic = oGraphics.GetByIndex(i)
+ aActSize = oGraphic.ActualSize
+ If aActSize.Height &gt; 0 And aActSize.Width &gt; 0 Then
+ oGraphic.SetSize(aActSize)
+ End If
+ Next i
+End Sub
+
+
+Sub EndDialog()
+ If DialogModel.chkSaveasTemplate.State = 1 Then
+ &apos; Generating template? Set events later!
+ AttachBasicMacroToEvent(oBaseDocument,&quot;OnNew&quot;, &quot;WebWizard.HtmlAutoPilotBasic.SetEvent()&quot;)
+ &apos; Call the Store template dialog
+ DispatchSlot(5538)
+ AttachBasicMacroToEvent(oBaseDocument,&quot;OnNew&quot;, &quot;&quot;)
+ End If
+ SetEvent()
+End Sub
+
+
+Sub SetEvent()
+Dim oDocument as Object
+&apos; This sub links the events OnSaveDone and OnSaveAsDone to the procedure
+&apos; CopyGraphics. It is invoked when a document is created, either directly
+&apos; from the AutoPilot or from a template. It is not possible to set these
+&apos; links for the template created by the AutoPilot because then it is not
+&apos; possible to modify the template.
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ oDocument = ThisComponent
+ AttachBasicMacroToEvent(oDocument,&quot;OnSaveDone&quot;, &quot;WebWizard.HtmlAutoPilotBasic.CopyGraphics()&quot;)
+ AttachBasicMacroToEvent(oDocument,&quot;OnSaveAsDone&quot;, &quot;WebWizard.HtmlAutoPilotBasic.CopyGraphics()&quot;)
+End Sub
+
+
+
+Sub CopyGraphics
+&apos; This sub copies all the graphics used in the document to the same directory the
+&apos; document has been copied into and changes the graphics links in the document.
+Dim oGraphicObjects as Object
+Dim oGraphic as Object
+Dim i as Integer
+Dim udProps as Object
+Dim SavePath as String
+ BasicLibraries.LoadLibrary(&quot;Tools&quot;)
+ oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
+ GetWebWizardPaths()
+ oBaseDocument = ThisComponent
+&apos; oBaseDocument.LockControllers()
+
+ &apos; Note: The sub DirectoryNameoutofPath should be change, so that the last character is a slash
+ SavePath = DirectoryNameoutofPath(oBaseDocument.Url, &quot;/&quot;) &amp; &quot;/&quot;
+
+ oGraphicObjects = oBaseDocument.GraphicObjects
+ For i = 0 to oGraphicObjects.Count-1
+ oGraphic = oGraphicObjects.GetbyIndex(i)
+ oGraphic.GraphicUrl = CopyFile(oGraphic.GraphicURL, SavePath)
+ Next i
+
+ ChangeBackGraphicUrl(SavePath)
+
+ BulletUrlsToSavePath(SavePath)
+
+ udProps = oBaseDocument.DocumentProperties.UserDefinedProperties
+ udProps.addProperty(&quot;AutoPilotName1&quot;, 0, &quot;&quot;)
+ udProps.addProperty(&quot;AutoPilotName2&quot;, 0, &quot;&quot;)
+ udProps.addProperty(&quot;AutoPilotBullet&quot;, 0, &quot;&quot;)
+ udProps.addProperty(&quot;AutoPilotBackground&quot;, 0, &quot;&quot;)
+
+ AttachBasicMacroToEvent(oBaseDocument,&quot;OnSaveDone&quot;, &quot;&quot;)
+ AttachBasicMacroToEvent(oBaseDocument,&quot;OnSaveAsDone&quot;, &quot;&quot;)
+ AttachBasicMacroToEvent(oBaseDocument,&quot;OnNew&quot;, &quot;&quot;)
+ oBaseDocument.Store
+&apos; oBaseDocument.UnlockControllers()
+End Sub
+
+
+Function CopyFile(ByVal SourceUrl as String, TargetDir as String)
+Dim sFileName as String
+Dim sNewFileUrl as String
+ If oUcb.Exists(TargetDir) Then
+ If Len(TargetDir) &gt; 2 Then
+ sFileName = FileNameoutofPath(SourceUrl)
+ sNewFileUrl = TargetDir &amp; sFileName
+ oUcb.Copy(SourceUrl, sNewFileUrl)
+ CopyFile() = sNewFileUrl
+ End If
+ End If
+End Function
+
+
+Function getListBoxArrays(oUcb as Object, sFileFilter as String)
+Dim oDocProps as Object
+Dim oListboxControl as Object
+Dim Description as String
+Dim sField as String
+Dim sFieldList() as String
+Dim bItemFound as Boolean
+Dim MaxIndex as Integer
+Dim DirContent() as String
+Dim FileName as String
+Dim TemplatePath as String
+Dim FilterLen as Integer
+Dim i as Integer
+Dim m as Integer
+Dim n as Integer
+Dim s as Integer
+Dim a as Integer
+Dim LocMaxIndex as Integer
+Dim Properties()
+Dim DimCount as Integer
+Dim sExtension as String
+ oDocProps = CreateUnoService(&quot;com.sun.star.document.DocumentProperties&quot;)
+ FilterLen = Len(sFileFilter)
+ bItemFound = False
+ &apos; It has to be made sure that the TemplatePath &lt;&gt; &quot;&quot;
+ TemplatePath = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/web/&quot;)
+ If TemplatePath = &quot;&quot; Then
+ Dim NullList()
+ getListBoxArrays() = NullList()
+ Exit Function
+ End If
+ DirContent() = oUcb.GetFolderContents(TemplatePath,True)
+ If sFileFilter = &quot;/cnt&quot; Then
+ DimCount = 2
+ Else
+ DimCount = 8
+ End If
+ LocMaxIndex = Ubound(DirContent())
+ Dim List(LocMaxIndex, DimCount) as String
+ Dim SortList(LocMaxIndex,1)
+ For i = 0 to LocMaxIndex
+ SortList(i,0) = DirContent(i)
+ SortList(i,1) = RetrieveDocTitle(oDocProps, DirContent(i))
+ Next i
+ SortList() = BubbleSortList(SortList(),True)
+ For i = 0 to LocMaxIndex
+ DirContent(i) = SortList(i,0)
+ Next i
+ a = 0
+ For i = 0 To LocMaxIndex
+ FileName = DirContent(i)
+ sExtension = Ucase(GetFileNameExtension(FileName))
+ If Instr(1,Filename, sFileFilter) And sExtension = &quot;STW&quot; Then
+ bItemFound = True
+ Description = RetrieveDocTitle(oDocProps, FileName)
+ Properties = oDocProps.UserDefinedProperties.PropertyValues
+ List(a,1) = Description
+ If sFileFilter = &quot;/cnt&quot; Then
+ List(a,2) = Filename
+ Else
+ m = 2
+ For n = 0 To 3
+ sField = Properties(n).Value
+ sFieldList() = ArrayoutofString(sField, &quot; &quot;, MaxIndex)
+ For s = 0 To MaxIndex
+ If m &lt; 6 Then
+ List(a,m) = sFieldList(s) &amp; &quot;.gif&quot;
+ Else
+ List(a,m) = sFieldList(s)
+ End If
+ m = m + 1
+ Next s
+ Next n
+ List(a,8) = FileName
+ End If
+ a = a + 1
+ End If
+ Next i
+ If sFileFilter = &quot;/cnt&quot; Then
+ ReDim Preserve List(a-1,2) as String
+ Else
+ ReDim Preserve List(a-1,8) as String
+ End If
+ If Not bItemfound Then
+ MsgBox(WebWiz_gErrContentNotFound$, 16, WebWiz_gWizardName$)
+ DisposeDocument(oBaseDocument)
+ Stop
+ End If
+ getListBoxArrays = List()
+End Function
+
+
+Sub SetGraphic(sWhich, sGraphicText as String)
+Dim oLocCursor as Object
+Dim oGraphic as Object
+Dim bGetGraphic as Boolean
+ oBookmarks = oBaseDocument.BookMarks
+ If oBookmarks.HasbyName(sWhich)Then
+ oBookMark = oBookmarks.GetbyName(sWhich)
+ oLocCursor = oBookMark.Anchor.Text.CreateTextCursorByRange(oBookMark.Anchor)
+ oGraphic = oBaseDocument.CreateInstance(&quot;com.sun.star.text.GraphicObject&quot;)
+ oLocCursor.GoRight(3,True)
+ oGraphic.AnchorType = 1
+ oGraphic.GraphicURL = ConverttoURL(sGraphicText)
+ oLocCursor.Text.InsertTextContent(oLocCursor, oGraphic, True)
+ oGraphic.Name = sWhich
+ ElseIf oBaseDocument.GraphicObjects.HasbyName(sWhich) Then
+ oGraphic = oBaseDocument.GraphicObjects.GetByName(sWhich)
+ oGraphic.GraphicUrl = sGraphicText
+ End If
+End Sub
+
+
+Sub CheckControls(oDrawPage as Object)
+Dim aForm as Object
+Dim m,n as integer
+Dim lColor as Long
+Dim oControl as Object
+ lColor = oBaseDocument.StyleFamilies.GetbyName(&quot;ParagraphStyles&quot;).GetByName(&quot;Standard&quot;).CharColor
+ &apos;SearchFor all possible Controls
+ For n = 0 to oDrawPage.Forms.Count - 1
+ aForm = oDrawPage.Forms(n)
+ For m = 0 to aForm.Count-1
+ oControl = aForm.GetbyIndex(m)
+ oControl.TextColor = lColor
+ Next
+ Next
+End Sub
+
+
+Sub RepaintHeaderPreview()
+Dim Bitmap As Object
+Dim sBitmapPath as String
+ sBitmapPath = SOBitmapPath &amp; &quot;webwizard.bmp&quot;
+ WebWzrd.ImagePreview.ImageURL = sBitmapPath
+End Sub
+
+
+Sub ToggleDialogControls(ByVal bDoEnable as Boolean, Optional FocusControlName as String)
+ If Not IsNull(DialogModel) Then
+ DialogModel.Enabled = bDoEnable
+ If bDoEnable Then
+ &apos; Enable Controls referring to Background graphic only when this Property is set
+ bDoEnable = bWithBackGraphic
+ ToggleOptionButtons(DialogModel, bDoEnable)
+ MainDialog.GetControl(FocusControlName).SetFocus()
+ End If
+ End If
+End Sub
+</script:module>
diff --git a/wizards/source/webwizard/Language.xba b/wizards/source/webwizard/Language.xba
new file mode 100644
index 000000000000..1aa26fac30cb
--- /dev/null
+++ b/wizards/source/webwizard/Language.xba
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
+
+
+
+
+Sub LoadLanguage()
+ If InitResources(&quot;WebWizard&quot;,&quot;wwz&quot;) Then
+ WebWiz_gErrContentNotFound = GetResText(1101)
+ WebWiz_gErrStyleNotFound = GetResText(1102)
+ WebWiz_gErrMainTemplateError = GetResText(1103)
+ WebWiz_gErrWhileReloading = GetResText(1104)
+ WebWiz_gErrWhileLoadStyles = GetResText(1105)
+ WebWiz_gErrMainDocumentError = GetResText(1106)
+ WebWiz_gErrMsg = GetResText(1107)
+ End If
+End Sub
+
+
+Function GetWebWizardPaths() as Boolean
+Dim TemplatePath as String
+ TextureDir = GetOfficeSubPath(&quot;Gallery&quot;,&quot;www-back&quot;)
+ If TextureDir &lt;&gt; &quot;&quot; Then
+ GraphicsDir = GetOfficeSubPath(&quot;Gallery&quot;,&quot;www-graf/&quot;)
+ If GraphicsDir &lt;&gt; &quot;&quot; Then
+ BulletDir = GetOfficeSubPath(&quot;Gallery&quot;, &quot;bullets/&quot;)
+ If BulletDir &lt;&gt; &quot;&quot; Then
+ PhotosDir = GetPathSettings(&quot;Gallery&quot;, False, 1)
+ If PhotosDir &lt;&gt; &quot;&quot; Then
+ TemplatePath = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/web/&quot;)
+ If TemplatePath &lt;&gt; &quot;&quot; Then
+ SOBitmapPath = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/bitmap&quot;)
+ If SOBitmapPath &lt;&gt; &quot;&quot; Then
+ GetWebwizardPaths() = True
+ Exit Function
+ End If
+ End If
+ End If
+ End If
+ End If
+ End If
+ DisposeDocument(oBaseDocument)
+ GetWebWizardPaths() = False
+End Function
+
+
+
+Sub OpenWebDialog()
+ Dim sBitmapPath as String
+ Dim BufferNames() as String
+ Dim SelList(0) as Integer
+ SelList(0) = 0
+ MainDialog = LoadDialog(&quot;WebWizard&quot;,&quot;WebWzrd&quot;)
+ DialogModel = MainDialog.Model
+ With DialogModel
+ .cbHelp.Label = GetResText(1000)
+ .Title = GetResText(1001)
+ .cbCancel.Label = GetResText(1002)
+ .cbGoOn.Label = GetResText(1003)
+ .lblTemplate.Label = GetResText(1004)
+ .lblStyle.Label = GetResText(1005)
+ .hlnBackground.Label = GetResText(1006)
+ .optTiled.Label = GetRestext(1007)
+ .optArea.Label = GetResText(1008)
+ .chkSaveasTemplate.Label = GetResText(1010)
+ End With
+
+ BufferNames() = ArrayfromMultiArray(Layout, 1)
+ DialogModel.lbTemplate.StringItemList() = BufferNames()
+ DialogModel.lbTemplate.SelectedItems() = SelList()
+
+
+ BufferNames() = ArrayfromMultiArray(Style, 1)
+ DialogModel.lbStyles.StringItemList() = BufferNames()
+ DialogModel.lbStyles.SelectedItems() = SelList()
+ sBitmapPath = SOBitmapPath &amp; &quot;webwizard.bmp&quot;
+
+ DialogModel.ImagePreview.ImageURL = sBitmapPath
+ ToggleOptionButtons(DialogModel, bWithBackGraphic)
+ MainDialog.GetControl(&quot;lbTemplate&quot;).SetFocus()
+ DialogModel.cbGoOn.DefaultButton = True
+ DialogModel.ImagePreview.BackGroundColor = RGB(0,60,126)
+End Sub</script:module> \ No newline at end of file
diff --git a/wizards/source/webwizard/WebWzrd.xdl b/wizards/source/webwizard/WebWzrd.xdl
new file mode 100644
index 000000000000..be1bec77eb40
--- /dev/null
+++ b/wizards/source/webwizard/WebWzrd.xdl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="WebWzrd" dlg:left="96" dlg:top="28" dlg:width="270" dlg:height="210" dlg:help-url="HID:34200" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="cbCancel" dlg:tab-index="0" dlg:left="6" dlg:top="190" dlg:width="50" dlg:height="14" dlg:help-url="HID:34206" dlg:value="Cancel" dlg:button-type="cancel"/>
+ <dlg:button dlg:id="cbHelp" dlg:tab-index="1" dlg:left="66" dlg:top="190" dlg:width="50" dlg:height="14" dlg:tag="HID:34200" dlg:value="cbHelp" dlg:button-type="help"/>
+ <dlg:button dlg:id="cbGoOn" dlg:tab-index="2" dlg:left="214" dlg:top="190" dlg:width="50" dlg:height="14" dlg:help-url="HID:34205" dlg:default="true" dlg:value="cbGoOn" dlg:button-type="ok"/>
+ <dlg:img dlg:id="ImagePreview" dlg:tab-index="3" dlg:left="6" dlg:top="6" dlg:width="258" dlg:height="26" dlg:scale-image="false"/>
+ <dlg:menulist dlg:id="lbTemplate" dlg:tab-index="4" dlg:left="6" dlg:top="53" dlg:width="110" dlg:height="94" dlg:help-url="HID:34201">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:WebWizard.HtmlAutoPilotBasic.ReloadCurrentDocument?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:menulist dlg:id="lbStyles" dlg:tab-index="5" dlg:left="154" dlg:top="53" dlg:width="110" dlg:height="94" dlg:help-url="HID:34202">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:WebWizard.HtmlAutoPilotBasic.LoadWebPageStyles?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:menulist>
+ <dlg:text dlg:id="lblTemplate" dlg:tab-index="6" dlg:left="6" dlg:top="42" dlg:width="110" dlg:height="10"/>
+ <dlg:text dlg:id="lblStyle" dlg:tab-index="7" dlg:left="154" dlg:top="42" dlg:width="110" dlg:height="10" dlg:value="lblStyle"/>
+ <dlg:checkbox dlg:id="chkSaveasTemplate" dlg:tab-index="8" dlg:left="6" dlg:top="164" dlg:width="110" dlg:height="12" dlg:help-url="HID:34207" dlg:value="chkSaveasTemplate" dlg:checked="false"/>
+ <dlg:radiogroup>
+ <dlg:radio dlg:id="optTiled" dlg:tab-index="9" dlg:left="161" dlg:top="164" dlg:width="96" dlg:height="10" dlg:tag="11" dlg:help-url="HID:34208" dlg:value="optTiled" dlg:checked="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.script:WebWizard.Common.SetBackGraphicStyle?language=Basic&amp;location=application" script:language="Script"/>
+ </dlg:radio>
+ <dlg:radio dlg:id="optArea" dlg:tab-index="10" dlg:left="161" dlg:top="177" dlg:width="96" dlg:height="10" dlg:tag="10" dlg:help-url="HID:34209" dlg:value="optArea">
+ <script:event script:event-name="on-itemstatechange" script:location="application" script:macro-name="WebWizard.HtmlAutoPilotBasic.SetBackGraphicStyle" script:language="StarBasic"/>
+ </dlg:radio>
+ </dlg:radiogroup>
+ <dlg:fixedline dlg:id="hlnBackground" dlg:tab-index="11" dlg:left="154" dlg:top="152" dlg:width="110" dlg:height="9" dlg:value="hlnBackground"/>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/wizards/source/webwizard/delzip b/wizards/source/webwizard/delzip
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/wizards/source/webwizard/delzip
diff --git a/wizards/source/webwizard/dialog.xlb b/wizards/source/webwizard/dialog.xlb
new file mode 100644
index 000000000000..d1b9cb066f0c
--- /dev/null
+++ b/wizards/source/webwizard/dialog.xlb
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="WebWizard" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="WebWzrd"/>
+</library:library>
diff --git a/wizards/source/webwizard/makefile.mk b/wizards/source/webwizard/makefile.mk
new file mode 100644
index 000000000000..415e08bf9475
--- /dev/null
+++ b/wizards/source/webwizard/makefile.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+PRJ=..$/..
+
+PRJNAME=wizards
+TARGET=webwizardall
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+# --- Files --------------------------------------------------------
+
+#
+# testresource.
+#
+SRS2NAME = webwizar
+SRC2FILES= webwizar.src
+RESLIB2SRSFILES= $(SRS)$/webwizar.srs
+RESLIB2NAME= wwz
+
+ZIP1TARGET = $(WEBWIZARD_ALL_TARGET)
+ZIP1LIST = *.xdl *.xba *.xlb
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/source/webwizard/script.xlb b/wizards/source/webwizard/script.xlb
new file mode 100644
index 000000000000..1045820b7002
--- /dev/null
+++ b/wizards/source/webwizard/script.xlb
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="WebWizard" library:readonly="true" library:passwordprotected="false">
+ <library:element library:name="HtmlAutoPilotBasic"/>
+ <library:element library:name="Language"/>
+ <library:element library:name="Bullets"/>
+ <library:element library:name="Common"/>
+</library:library>
diff --git a/wizards/source/webwizard/webwizar.src b/wizards/source/webwizard/webwizar.src
new file mode 100644
index 000000000000..19d77d89f4a9
--- /dev/null
+++ b/wizards/source/webwizard/webwizar.src
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/#define WEBDIALOG 1000
+/*
+#define WEBERROR 1100
+// --------------------------------------------------------------------
+
+String WEBDIALOG
+{
+ Text [ en-US ] = "~Help";
+};
+
+
+String WEBDIALOG + 1
+{
+ Text [ en-US ] = "AutoPilot Web Page";
+};
+
+
+
+
+String WEBDIALOG + 2
+{
+ Text [ en-US ] = "~Cancel";
+};
+
+String WEBDIALOG + 3
+{
+ Text [ en-US ] = "C~reate";
+};
+
+
+String WEBDIALOG + 4
+{
+ Text [ en-US ] = "Which template should be used?";
+};
+
+String WEBDIALOG + 5
+{
+ Text [ en-US ] = "Which layout should be used?";
+};
+
+
+String WEBDIALOG + 6
+{
+ Text [ en-US ] = "Background Image";
+};
+
+
+
+String WEBDIALOG + 7
+{
+ Text [ en-US ] = "~Tiled";
+};
+
+
+String WEBDIALOG + 8
+{
+ Text [ en-US ] = "~Scaled";
+};
+
+
+String WEBDIALOG + 9
+{
+ Text [ en-US ] = "Edit document";
+};
+
+String WEBDIALOG + 10
+{
+ Text [ en-US ] = "Create template";
+};
+
+
+String WEBERROR + 1
+{
+ Text [ en-US ] = "A template for the page setup could not be found.";
+};
+
+String WEBERROR + 2
+{
+ Text [ en-US ] = "A Style for the Page Style could not be found.";
+};
+
+String WEBERROR + 3
+{
+ Text [ en-US ] = "An error occurred as the templates were being interpreted.";
+};
+
+String WEBERROR + 4
+{
+ Text [ en-US ] = "An error occurred as the template was being refreshed.";
+};
+
+String WEBERROR + 5
+{
+ Text [ en-US ] = "An error occurred while applying the Styles.";
+};
+
+String WEBERROR + 6
+{
+ Text [ en-US ] = "An error occurred while evaluating the documents.";
+};
+
+String WEBERROR + 7
+{
+ Text [ en-US ] = "An error occurred while running the AutoPilot.";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+*/
diff --git a/wizards/util/hidother.src b/wizards/util/hidother.src
new file mode 100644
index 000000000000..7f706a69b657
--- /dev/null
+++ b/wizards/util/hidother.src
@@ -0,0 +1,1498 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+//two ranges available:
+//34200 - 34767
+//40768 - 42767
+
+/*
+ * web wizard : 34200 - 34319
+ * report wizard : 34320 - 34399
+ * others to be listed...
+ *
+ * web wizard (cont.) : 41000 - 41050
+ * agenda wizard : 41051 - 41099
+ */
+
+
+// ***************
+// WEB WIZARD
+// 34200 - 34319
+// 41000 - 41050
+// ***************
+//webwizardgeneralcontrols
+
+#define HID0_WEBWIZARD 34200
+hidspecial HID { HelpID = HID0_WEBWIZARD; } ;
+#define HID0_HELP 34201
+hidspecial HID { HelpID = HID0_HELP; } ;
+#define HID0_NEXT 34202
+hidspecial HID { HelpID = HID0_NEXT; } ;
+#define HID0_PREV 34203
+hidspecial HID { HelpID = HID0_PREV; } ;
+#define HID0_CREATE 34204
+hidspecial HID { HelpID = HID0_CREATE; } ;
+#define HID0_CANCEL 34205
+hidspecial HID { HelpID = HID0_CANCEL; } ;
+#define HID0_STATUS_DIALOG 34206
+hidspecial HID { HelpID = HID0_STATUS_DIALOG; } ;
+
+
+//step1
+#define HID1_LST_SESSIONS 34207
+hidspecial HID { HelpID = HID1_LST_SESSIONS; } ;
+#define HID1_BTN_DEL_SES 34209
+hidspecial HID { HelpID = HID1_BTN_DEL_SES; } ;
+
+//step2
+#define HID2_LST_DOCS 34210
+hidspecial HID { HelpID = HID2_LST_DOCS; } ;
+#define HID2_BTN_ADD_DOC 34211
+hidspecial HID { HelpID = HID2_BTN_ADD_DOC; } ;
+#define HID2_BTN_REM_DOC 34212
+hidspecial HID { HelpID = HID2_BTN_REM_DOC; } ;
+#define HID2_BTN_DOC_UP 34213
+hidspecial HID { HelpID = HID2_BTN_DOC_UP; } ;
+#define HID2_BTN_DOC_DOWN 34214
+hidspecial HID { HelpID = HID2_BTN_DOC_DOWN; } ;
+#define HID2_TXT_DOC_TITLE 34215
+hidspecial HID { HelpID = HID2_TXT_DOC_TITLE; } ;
+#define HID2_TXT_DOC_DESC 34216
+hidspecial HID { HelpID = HID2_TXT_DOC_DESC; } ;
+#define HID2_TXT_DOC_AUTHOR 34217
+hidspecial HID { HelpID = HID2_TXT_DOC_AUTHOR; } ;
+#define HID2_LST_DOC_EXPORT 34218
+hidspecial HID { HelpID = HID2_LST_DOC_EXPORT; } ;
+#define HID2_STATUS_ADD_DOCS 34219
+hidspecial HID { HelpID = HID2_STATUS_ADD_DOCS; } ;
+
+//step3
+#define HID3_IL_LAYOUTS_IMG1 34220
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG1; } ;
+#define HID3_IL_LAYOUTS_IMG2 34221
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG2; } ;
+#define HID3_IL_LAYOUTS_IMG3 34222
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG3; } ;
+#define HID3_IL_LAYOUTS_IMG4 34223
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG4; } ;
+#define HID3_IL_LAYOUTS_IMG5 34224
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG5; } ;
+#define HID3_IL_LAYOUTS_IMG6 34225
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG6; } ;
+#define HID3_IL_LAYOUTS_IMG7 34226
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG7; } ;
+#define HID3_IL_LAYOUTS_IMG8 34227
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG8; } ;
+#define HID3_IL_LAYOUTS_IMG9 34228
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG9; } ;
+#define HID3_IL_LAYOUTS_IMG10 34229
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG10; } ;
+#define HID3_IL_LAYOUTS_IMG11 34230
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG11; } ;
+#define HID3_IL_LAYOUTS_IMG12 34231
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG12; } ;
+#define HID3_IL_LAYOUTS_IMG13 34232
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG13; } ;
+#define HID3_IL_LAYOUTS_IMG14 34233
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG14; } ;
+#define HID3_IL_LAYOUTS_IMG15 34234
+hidspecial HID { HelpID = HID3_IL_LAYOUTS_IMG15; } ;
+
+//step4
+#define HID4_CHK_DISPLAY_FILENAME 34235
+hidspecial HID { HelpID = HID4_CHK_DISPLAY_FILENAME; } ;
+#define HID4_CHK_DISPLAY_DESCRIPTION 34236
+hidspecial HID { HelpID = HID4_CHK_DISPLAY_DESCRIPTION; } ;
+#define HID4_CHK_DISPLAY_AUTHOR 34237
+hidspecial HID { HelpID = HID4_CHK_DISPLAY_AUTHOR; } ;
+#define HID4_CHK_DISPLAY_CR_DATE 34238
+hidspecial HID { HelpID = HID4_CHK_DISPLAY_CR_DATE; } ;
+#define HID4_CHK_DISPLAY_UP_DATE 34239
+hidspecial HID { HelpID = HID4_CHK_DISPLAY_UP_DATE; } ;
+#define HID4_CHK_DISPLAY_FORMAT 34240
+hidspecial HID { HelpID = HID4_CHK_DISPLAY_FORMAT; } ;
+#define HID4_CHK_DISPLAY_F_ICON 34241
+hidspecial HID { HelpID = HID4_CHK_DISPLAY_F_ICON; } ;
+#define HID4_CHK_DISPLAY_PAGES 34242
+hidspecial HID { HelpID = HID4_CHK_DISPLAY_PAGES; } ;
+#define HID4_CHK_DISPLAY_SIZE 34243
+hidspecial HID { HelpID = HID4_CHK_DISPLAY_SIZE; } ;
+
+#define HID4_GRP_OPTIMAIZE_640 34244
+hidspecial HID { HelpID = HID4_GRP_OPTIMAIZE_640; } ;
+#define HID4_GRP_OPTIMAIZE_800 34245
+hidspecial HID { HelpID = HID4_GRP_OPTIMAIZE_800; } ;
+#define HID4_GRP_OPTIMAIZE_1024 34246
+hidspecial HID { HelpID = HID4_GRP_OPTIMAIZE_1024; } ;
+
+
+//step5
+#define HID5_LST_STYLES 34247
+hidspecial HID { HelpID = HID5_LST_STYLES; } ;
+#define HID5_BTN_BACKGND 34248
+hidspecial HID { HelpID = HID5_BTN_BACKGND; } ;
+#define HID5_BTN_ICONS 34249
+hidspecial HID { HelpID = HID5_BTN_ICONS; } ;
+
+//step6
+#define HID6_TXT_SITE_TITLE 34250
+hidspecial HID { HelpID = HID6_TXT_SITE_TITLE; } ;
+#define HID6_TXT_SITE_DESC 34253
+hidspecial HID { HelpID = HID6_TXT_SITE_DESC; } ;
+#define HID6_DATE_SITE_CREATED 34255
+hidspecial HID { HelpID = HID6_DATE_SITE_CREATED; } ;
+#define HID6_DATE_SITE_UPDATED 34256
+hidspecial HID { HelpID = HID6_DATE_SITE_UPDATED; } ;
+#define HID6_TXT_SITE_EMAIL 34258
+hidspecial HID { HelpID = HID6_TXT_SITE_EMAIL; } ;
+#define HID6_TXT_SITE_COPYRIGHT 34259
+hidspecial HID { HelpID = HID6_TXT_SITE_COPYRIGHT; } ;
+
+//step7
+#define HID7_BTN_PREVIEW 34260
+hidspecial HID { HelpID = HID7_BTN_PREVIEW; } ;
+#define HID7_CHK_PUBLISH_LOCAL 34261
+hidspecial HID { HelpID = HID7_CHK_PUBLISH_LOCAL; } ;
+#define HID7_TXT_LOCAL 34262
+hidspecial HID { HelpID = HID7_TXT_LOCAL; } ;
+#define HID7_BTN_LOCAL 34263
+hidspecial HID { HelpID = HID7_BTN_LOCAL; } ;
+#define HID7_CHK_PUBLISH_ZIP 34264
+hidspecial HID { HelpID = HID7_CHK_PUBLISH_ZIP; } ;
+#define HID7_TXT_ZIP 34265
+hidspecial HID { HelpID = HID7_TXT_ZIP; } ;
+#define HID7_BTN_ZIP 34266
+hidspecial HID { HelpID = HID7_BTN_ZIP; } ;
+#define HID7_CHK_PUBLISH_FTP 34267
+hidspecial HID { HelpID = HID7_CHK_PUBLISH_FTP; } ;
+#define HID7_TXT_FTP 34268
+hidspecial HID { HelpID = HID7_TXT_FTP; } ;
+#define HID7_BTN_FTP 34269
+hidspecial HID { HelpID = HID7_BTN_FTP; } ;
+#define HID7_CHK_SAVE 34270
+hidspecial HID { HelpID = HID7_CHK_SAVE; } ;
+#define HID7_TXT_SAVE 34271
+hidspecial HID { HelpID = HID7_TXT_SAVE; } ;
+
+//web wizard backgrounds dialog
+#define HID_BG 34290
+hidspecial HID { HelpID = HID_BG; } ;
+#define HID_BG_BTN_OTHER 34291
+hidspecial HID { HelpID = HID_BG_BTN_OTHER; } ;
+#define HID_BG_BTN_NONE 34292
+hidspecial HID { HelpID = HID_BG_BTN_NONE; } ;
+#define HID_BG_BTN_OK 34293
+hidspecial HID { HelpID = HID_BG_BTN_OK; } ;
+#define HID_BG_BTN_CANCEL 34294
+hidspecial HID { HelpID = HID_BG_BTN_CANCEL; } ;
+
+#define HID_BG_BTN_BACK 34295
+hidspecial HID { HelpID = HID_BG_BTN_BACK; } ;
+#define HID_BG_BTN_FW 34296
+hidspecial HID { HelpID = HID_BG_BTN_FW; } ;
+#define HID_BG_BTN_IMG1 34297
+hidspecial HID { HelpID = HID_BG_BTN_IMG1; } ;
+#define HID_BG_BTN_IMG2 34298
+hidspecial HID { HelpID = HID_BG_BTN_IMG2; } ;
+#define HID_BG_BTN_IMG3 34299
+hidspecial HID { HelpID = HID_BG_BTN_IMG3; } ;
+#define HID_BG_BTN_IMG4 34300
+hidspecial HID { HelpID = HID_BG_BTN_IMG4; } ;
+#define HID_BG_BTN_IMG5 34301
+hidspecial HID { HelpID = HID_BG_BTN_IMG5; } ;
+#define HID_BG_BTN_IMG6 34302
+hidspecial HID { HelpID = HID_BG_BTN_IMG6; } ;
+#define HID_BG_BTN_IMG7 34303
+hidspecial HID { HelpID = HID_BG_BTN_IMG7; } ;
+#define HID_BG_BTN_IMG8 34304
+hidspecial HID { HelpID = HID_BG_BTN_IMG8; } ;
+#define HID_BG_BTN_IMG9 34305
+hidspecial HID { HelpID = HID_BG_BTN_IMG9; } ;
+#define HID_BG_BTN_IMG10 34306
+hidspecial HID { HelpID = HID_BG_BTN_IMG10; } ;
+#define HID_BG_BTN_IMG11 34307
+hidspecial HID { HelpID = HID_BG_BTN_IMG11; } ;
+#define HID_BG_BTN_IMG12 34308
+hidspecial HID { HelpID = HID_BG_BTN_IMG12; } ;
+#define HID_BG_BTN_IMG13 34309
+hidspecial HID { HelpID = HID_BG_BTN_IMG13; } ;
+#define HID_BG_BTN_IMG14 34300
+hidspecial HID { HelpID = HID_BG_BTN_IMG14; } ;
+#define HID_BG_BTN_IMG15 34311
+hidspecial HID { HelpID = HID_BG_BTN_IMG15; } ;
+#define HID_BG_BTN_IMG16 34312
+hidspecial HID { HelpID = HID_BG_BTN_IMG16; } ;
+
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Note: Web Wizard continues on 41000 later in this file.
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
+// *************
+// REPORT WIZARD
+// *************
+
+#define HID_DLGREPORT_DIALOG 34320
+hidspecial HID { HelpID = HID_DLGREPORT_DIALOG; };
+#define HID_DLGREPORT_0_CMDPREV 34322
+hidspecial HID { HelpID = HID_DLGREPORT_0_CMDPREV; };
+#define HID_DLGREPORT_0_CMDNEXT 34323
+hidspecial HID { HelpID = HID_DLGREPORT_0_CMDNEXT; };
+#define HID_DLGREPORT_0_CMDFINISH 34324
+hidspecial HID { HelpID = HID_DLGREPORT_0_CMDFINISH; };
+#define HID_DLGREPORT_0_CMDCANCEL 34325
+hidspecial HID { HelpID = HID_DLGREPORT_0_CMDCANCEL; };
+
+#define HID_DLGREPORT_1_LBTABLES 34330
+hidspecial HID { HelpID = HID_DLGREPORT_1_LBTABLES; };
+#define HID_DLGREPORT_1_FIELDSAVAILABLE 34331
+hidspecial HID { HelpID = HID_DLGREPORT_1_FIELDSAVAILABLE; };
+#define HID_DLGREPORT_1_CMDMOVESELECTED 34332
+hidspecial HID { HelpID = HID_DLGREPORT_1_CMDMOVESELECTED; };
+#define HID_DLGREPORT_1_CMDMOVEALL 34333
+hidspecial HID { HelpID = HID_DLGREPORT_1_CMDMOVEALL; };
+#define HID_DLGREPORT_1_CMDREMOVESELECTED 34334
+hidspecial HID { HelpID = HID_DLGREPORT_1_CMDREMOVESELECTED; };
+#define HID_DLGREPORT_1_CMDREMOVEALL 34335
+hidspecial HID { HelpID = HID_DLGREPORT_1_CMDREMOVEALL; };
+#define HID_DLGREPORT_1_FIELDSSELECTED 34336
+hidspecial HID { HelpID = HID_DLGREPORT_1_FIELDSSELECTED; };
+#define HID_DLGREPORT_1_CMDMOVEUP 34337
+hidspecial HID { HelpID = HID_DLGREPORT_1_CMDMOVEUP; };
+#define HID_DLGREPORT_1_CMDMOVEDOWN 34338
+hidspecial HID { HelpID = HID_DLGREPORT_1_CMDMOVEDOWN; };
+
+
+#define HID_DLGREPORT_2_GROUPING 34340
+hidspecial HID { HelpID = HID_DLGREPORT_2_GROUPING; };
+#define HID_DLGREPORT_2_CMDGROUP 34341
+hidspecial HID { HelpID = HID_DLGREPORT_2_CMDGROUP; };
+#define HID_DLGREPORT_2_CMDUNGROUP 34342
+hidspecial HID { HelpID = HID_DLGREPORT_2_CMDUNGROUP; };
+#define HID_DLGREPORT_2_PREGROUPINGDEST 34343
+hidspecial HID { HelpID = HID_DLGREPORT_2_PREGROUPINGDEST; };
+#define HID_DLGREPORT_2_CMDMOVEUPGROUP 34344
+hidspecial HID { HelpID = HID_DLGREPORT_2_CMDMOVEUPGROUP; };
+#define HID_DLGREPORT_2_CMDMOVEDOWNGROUP 34345
+hidspecial HID { HelpID = HID_DLGREPORT_2_CMDMOVEDOWNGROUP; };
+
+
+#define HID_DLGREPORT_3_SORT1 34346
+hidspecial HID { HelpID = HID_DLGREPORT_3_SORT1; };
+#define HID_DLGREPORT_3_OPTASCEND1 34347
+hidspecial HID { HelpID = HID_DLGREPORT_3_OPTASCEND1; };
+#define HID_DLGREPORT_3_OPTDESCEND1 34348
+hidspecial HID { HelpID = HID_DLGREPORT_3_OPTDESCEND1; };
+#define HID_DLGREPORT_3_SORT2 34349
+hidspecial HID { HelpID = HID_DLGREPORT_3_SORT2; };
+#define HID_DLGREPORT_3_OPTASCEND2 34350
+hidspecial HID { HelpID = HID_DLGREPORT_3_OPTASCEND2; };
+#define HID_DLGREPORT_3_OPTDESCEND2 34351
+hidspecial HID { HelpID = HID_DLGREPORT_3_OPTDESCEND2; };
+#define HID_DLGREPORT_3_SORT3 34352
+hidspecial HID { HelpID = HID_DLGREPORT_3_SORT3; };
+#define HID_DLGREPORT_3_OPTASCEND3 34353
+hidspecial HID { HelpID = HID_DLGREPORT_3_OPTASCEND3; };
+#define HID_DLGREPORT_3_OPTDESCEND3 34354
+hidspecial HID { HelpID = HID_DLGREPORT_3_OPTDESCEND3; };
+#define HID_DLGREPORT_3_SORT4 34355
+hidspecial HID { HelpID = HID_DLGREPORT_3_SORT4; };
+#define HID_DLGREPORT_3_OPTASCEND4 34356
+hidspecial HID { HelpID = HID_DLGREPORT_3_OPTASCEND4; };
+#define HID_DLGREPORT_3_OPTDESCEND4 34357
+hidspecial HID { HelpID = HID_DLGREPORT_3_OPTDESCEND4; };
+
+#define HID_DLGREPORT_4_TITLE 34362
+hidspecial HID { HelpID = HID_DLGREPORT_4_TITLE; };
+#define HID_DLGREPORT_4_DATALAYOUT 34363
+hidspecial HID { HelpID = HID_DLGREPORT_4_DATALAYOUT; };
+#define HID_DLGREPORT_4_PAGELAYOUT 34364
+hidspecial HID { HelpID = HID_DLGREPORT_4_PAGELAYOUT; };
+#define HID_DLGREPORT_4_LANDSCAPE 34365
+hidspecial HID { HelpID = HID_DLGREPORT_4_LANDSCAPE; };
+#define HID_DLGREPORT_4_PORTRAIT 34366
+hidspecial HID { HelpID = HID_DLGREPORT_4_PORTRAIT; };
+
+#define HID_DLGREPORT_5_OPTDYNTEMPLATE 34370
+hidspecial HID { HelpID = HID_DLGREPORT_5_OPTDYNTEMPLATE; };
+#define HID_DLGREPORT_5_OPTSTATDOCUMENT 34371
+hidspecial HID { HelpID = HID_DLGREPORT_5_OPTSTATDOCUMENT; };
+#define HID_DLGREPORT_5_TXTTEMPLATEPATH 34372
+hidspecial HID { HelpID = HID_DLGREPORT_5_TXTTEMPLATEPATH; };
+#define HID_DLGREPORT_5_CMDTEMPLATEPATH 34373
+hidspecial HID { HelpID = HID_DLGREPORT_5_CMDTEMPLATEPATH; };
+#define HID_DLGREPORT_5_OPTEDITTEMPLATE 34374
+hidspecial HID { HelpID = HID_DLGREPORT_5_OPTEDITTEMPLATE; };
+#define HID_DLGREPORT_5_OPTUSETEMPLATE 34375
+hidspecial HID { HelpID = HID_DLGREPORT_5_OPTUSETEMPLATE; };
+#define HID_DLGREPORT_5_TXTDOCUMENTPATH 34376
+hidspecial HID { HelpID = HID_DLGREPORT_5_TXTDOCUMENTPATH; };
+#define HID_DLGREPORT_5_CMDDOCUMENTPATH 34377
+hidspecial HID { HelpID = HID_DLGREPORT_5_CMDDOCUMENTPATH; };
+#define HID_DLGREPORT_5_CHKLINKTODB 34378
+hidspecial HID { HelpID = HID_DLGREPORT_5_CHKLINKTODB; };
+#define HID_DLGREPORT_6_TXTTITLE_1 34381
+hidspecial HID { HelpID = HID_DLGREPORT_6_TXTTITLE_1; };
+#define HID_DLGREPORT_6_TXTTITLE_2 34382
+hidspecial HID { HelpID = HID_DLGREPORT_6_TXTTITLE_2; };
+#define HID_DLGREPORT_6_TXTTITLE_3 34383
+hidspecial HID { HelpID = HID_DLGREPORT_6_TXTTITLE_3; };
+#define HID_DLGREPORT_6_TXTTITLE_4 34384
+hidspecial HID { HelpID = HID_DLGREPORT_6_TXTTITLE_4; };
+#define HID_DLGREPORT_6_TXTTITLE_5 34385
+hidspecial HID { HelpID = HID_DLGREPORT_6_TXTTITLE_5; };
+#define HID_DLGREPORT_6_TXTTITLE_6 34386
+hidspecial HID { HelpID = HID_DLGREPORT_6_TXTTITLE_6; };
+#define HID_DLGREPORT_6_TXTTITLE_7 34387
+hidspecial HID { HelpID = HID_DLGREPORT_6_TXTTITLE_7; };
+
+
+/* ====================================
+ * FormWizard
+ * ====================================
+ */
+
+
+#define HID_DLGFORM_DIALOG 34400
+hidspecial HID { HelpID = HID_DLGFORM_DIALOG; };
+#define HID_DLGFORM_CMDPREV 34402
+hidspecial HID { HelpID = HID_DLGFORM_CMDPREV; };
+#define HID_DLGFORM_CMDNEXT 34403
+hidspecial HID { HelpID = HID_DLGFORM_CMDNEXT; };
+#define HID_DLGFORM_CMDFINISH 34404
+hidspecial HID { HelpID = HID_DLGFORM_CMDFINISH; };
+#define HID_DLGFORM_CMDCANCEL 34405
+hidspecial HID { HelpID = HID_DLGFORM_CMDCANCEL; };
+
+#define HID_DLGFORM_MASTER_LBTABLES 34411
+hidspecial HID { HelpID = HID_DLGFORM_MASTER_LBTABLES; };
+#define HID_DLGFORM_MASTER_FIELDSAVAILABLE 34412
+hidspecial HID { HelpID = HID_DLGFORM_MASTER_FIELDSAVAILABLE; };
+#define HID_DLGFORM_MASTER_CMDMOVESELECTED 34413
+hidspecial HID { HelpID = HID_DLGFORM_MASTER_CMDMOVESELECTED; };
+#define HID_DLGFORM_MASTER_CMDMOVEALL 34414
+hidspecial HID { HelpID = HID_DLGFORM_MASTER_CMDMOVEALL; };
+#define HID_DLGFORM_MASTER_CMDREMOVESELECTED 34415
+hidspecial HID { HelpID = HID_DLGFORM_MASTER_CMDREMOVESELECTED; };
+#define HID_DLGFORM_MASTER_CMDREMOVEALL 34416
+hidspecial HID { HelpID = HID_DLGFORM_MASTER_CMDREMOVEALL; };
+#define HID_DLGFORM_MASTER_FIELDSSELECTED 34417
+hidspecial HID { HelpID = HID_DLGFORM_MASTER_FIELDSSELECTED; };
+#define HID_DLGFORM_MASTER_CMDMOVEUP 34418
+hidspecial HID { HelpID = HID_DLGFORM_MASTER_CMDMOVEUP; };
+#define HID_DLGFORM_MASTER_CMDMOVEDOWN 34419
+hidspecial HID { HelpID = HID_DLGFORM_MASTER_CMDMOVEDOWN; };
+
+
+#define HID_DLGFORM_CHKCREATESUBFORM 34421
+hidspecial HID { HelpID = HID_DLGFORM_CHKCREATESUBFORM; };
+#define HID_DLGFORM_OPTONEXISTINGRELATION 34422
+hidspecial HID { HelpID = HID_DLGFORM_OPTONEXISTINGRELATION; };
+#define HID_DLGFORM_OPTSELECTMANUALLY 34423
+hidspecial HID { HelpID = HID_DLGFORM_OPTSELECTMANUALLY; };
+#define HID_DLGFORM_lstRELATIONS 34424
+hidspecial HID { HelpID = HID_DLGFORM_lstRELATIONS; };
+
+
+#define HID_DLGFORM_SUB_LBTABLES 34431
+hidspecial HID { HelpID = HID_DLGFORM_SUB_LBTABLES; };
+#define HID_DLGFORM_SUB_FIELDSAVAILABLE 34432
+hidspecial HID { HelpID = HID_DLGFORM_SUB_FIELDSAVAILABLE; };
+#define HID_DLGFORM_SUB_CMDMOVESELECTED 34433
+hidspecial HID { HelpID = HID_DLGFORM_SUB_CMDMOVESELECTED; };
+#define HID_DLGFORM_SUB_CMDMOVEALL 34434
+hidspecial HID { HelpID = HID_DLGFORM_SUB_CMDMOVEALL; };
+#define HID_DLGFORM_SUB_CMDREMOVESELECTED 34435
+hidspecial HID { HelpID = HID_DLGFORM_SUB_CMDREMOVESELECTED; };
+#define HID_DLGFORM_SUB_CMDREMOVEALL 34436
+hidspecial HID { HelpID = HID_DLGFORM_SUB_CMDREMOVEALL; };
+#define HID_DLGFORM_SUB_FIELDSSELECTED 34437
+hidspecial HID { HelpID = HID_DLGFORM_SUB_FIELDSSELECTED; };
+#define HID_DLGFORM_SUB_CMDMOVEUP 34438
+hidspecial HID { HelpID = HID_DLGFORM_SUB_CMDMOVEUP; };
+#define HID_DLGFORM_SUB_CMDMOVEDOWN 34439
+hidspecial HID { HelpID = HID_DLGFORM_SUB_CMDMOVEDOWN; };
+
+
+#define HID_DLGFORM_LINKER_LSTSLAVELINK1 34441
+hidspecial HID { HelpID = HID_DLGFORM_LINKER_LSTSLAVELINK1; };
+#define HID_DLGFORM_LINKER_LSTMASTERLINK1 34442
+hidspecial HID { HelpID = HID_DLGFORM_LINKER_LSTMASTERLINK1; };
+#define HID_DLGFORM_LINKER_LSTSLAVELINK2 34443
+hidspecial HID { HelpID = HID_DLGFORM_LINKER_LSTSLAVELINK2; };
+#define HID_DLGFORM_LINKER_LSTMASTERLINK2 34444
+hidspecial HID { HelpID = HID_DLGFORM_LINKER_LSTMASTERLINK2; };
+#define HID_DLGFORM_LINKER_LSTSLAVELINK3 34445
+hidspecial HID { HelpID = HID_DLGFORM_LINKER_LSTSLAVELINK3; };
+#define HID_DLGFORM_LINKER_LSTMASTERLINK3 34446
+hidspecial HID { HelpID = HID_DLGFORM_LINKER_LSTMASTERLINK3; };
+#define HID_DLGFORM_LINKER_LSTSLAVELINK4 34447
+hidspecial HID { HelpID = HID_DLGFORM_LINKER_LSTSLAVELINK4; };
+#define HID_DLGFORM_LINKER_LSTMASTERLINK4 34448
+hidspecial HID { HelpID = HID_DLGFORM_LINKER_LSTMASTERLINK4; };
+
+#define HID_DLGFORM_CMDALIGNLEFT 34451
+hidspecial HID { HelpID = HID_DLGFORM_CMDALIGNLEFT; };
+#define HID_DLGFORM_CMDALIGNRIGHT 34452
+hidspecial HID { HelpID = HID_DLGFORM_CMDALIGNRIGHT; };
+
+
+#define HID_DLGFORM_CMDLEFTLABELED 34453
+hidspecial HID { HelpID = HID_DLGFORM_CMDLEFTLABELED; };
+#define HID_DLGFORM_CMDTOPLABELED 34454
+hidspecial HID { HelpID = HID_DLGFORM_CMDTOPLABELED; };
+#define HID_DLGFORM_CMDTABLESTYLE 34455
+hidspecial HID { HelpID = HID_DLGFORM_CMDTABLESTYLE; };
+#define HID_DLGFORM_CMDTOPJUSTIFIED 34456
+hidspecial HID { HelpID = HID_DLGFORM_CMDTOPJUSTIFIED; };
+
+#define HID_DLGFORM_CMDLEFTLABELED2 34457
+hidspecial HID { HelpID = HID_DLGFORM_CMDLEFTLABELED2; };
+#define HID_DLGFORM_CMDTOPLABELED2 34458
+hidspecial HID { HelpID = HID_DLGFORM_CMDTOPLABELED2; };
+#define HID_DLGFORM_CMDTABLESTYLE2 34459
+hidspecial HID { HelpID = HID_DLGFORM_CMDTABLESTYLE2; };
+#define HID_DLGFORM_CMDTOPJUSTIFIED2 34460
+hidspecial HID { HelpID = HID_DLGFORM_CMDTOPJUSTIFIED2; };
+
+#define HID_DLGFORM_OPTNEWDATAONLY 34461
+hidspecial HID { HelpID = HID_DLGFORM_OPTNEWDATAONLY; };
+#define HID_DLGFORM_OPTDISPLAYALLDATA 34462
+hidspecial HID { HelpID = HID_DLGFORM_OPTDISPLAYALLDATA; };
+#define HID_DLGFORM_CHKNOMODIFICATION 34463
+hidspecial HID { HelpID = HID_DLGFORM_CHKNOMODIFICATION; };
+#define HID_DLGFORM_CHKNODELETION 34464
+hidspecial HID { HelpID = HID_DLGFORM_CHKNODELETION; };
+#define HID_DLGFORM_CHKNOADDITION 34465
+hidspecial HID { HelpID = HID_DLGFORM_CHKNOADDITION; };
+
+
+#define HID_DLGFORM_LSTSTYLES 34471
+hidspecial HID { HelpID = HID_DLGFORM_LSTSTYLES; };
+#define HID_DLGFORM_CMDNOBORDER 34472
+hidspecial HID { HelpID = HID_DLGFORM_CMDNOBORDER; };
+#define HID_DLGFORM_CMD3DBORDER 34473
+hidspecial HID { HelpID = HID_DLGFORM_CMD3DBORDER; };
+#define HID_DLGFORM_CMDSIMPLEBORDER 34474
+hidspecial HID { HelpID = HID_DLGFORM_CMDSIMPLEBORDER; };
+
+#define HID_DLGFORM_TXTPATH 34481
+hidspecial HID { HelpID = HID_DLGFORM_TXTPATH; };
+#define HID_DLGFORM_OPTWORKWITHFORM 34482
+hidspecial HID { HelpID = HID_DLGFORM_OPTWORKWITHFORM; };
+#define HID_DLGFORM_OPTMODIFYFORM 34483
+hidspecial HID { HelpID = HID_DLGFORM_OPTMODIFYFORM; };
+
+
+#define HID_DLGNEWSLTR_DIALOG 34500
+hidspecial HID { HelpID = HID_DLGNEWSLTR_DIALOG; };
+#define HID_DLGNEWSLTR_OPTSTANDARDLAYOUT 34501
+hidspecial HID { HelpID = HID_DLGNEWSLTR_OPTSTANDARDLAYOUT; };
+#define HID_DLGNEWSLTR_OPTPARTYLAYOUT 34502
+hidspecial HID { HelpID = HID_DLGNEWSLTR_OPTPARTYLAYOUT; };
+#define HID_DLGNEWSLTR_OPTBROCHURELAYOUT 34503
+hidspecial HID { HelpID = HID_DLGNEWSLTR_OPTBROCHURELAYOUT; };
+#define HID_DLGNEWSLTR_OPTSINGLESIDED 34504
+hidspecial HID { HelpID = HID_DLGNEWSLTR_OPTSINGLESIDED; };
+#define HID_DLGNEWSLTR_OPTDOUBLESIDED 34505
+hidspecial HID { HelpID = HID_DLGNEWSLTR_OPTDOUBLESIDED; };
+#define HID_DLGNEWSLTR_CMDGOON 34506
+hidspecial HID { HelpID = HID_DLGNEWSLTR_CMDGOON; };
+
+
+#define HID_DLGDEPOT_DIALOG_SELLBUY 34520
+hidspecial HID { HelpID = HID_DLGDEPOT_DIALOG_SELLBUY ; };
+#define HID_DLGDEPOT_0_TXTSTOCKID_SELLBUY 34521
+hidspecial HID { HelpID = HID_DLGDEPOT_0_TXTSTOCKID_SELLBUY ; };
+#define HID_DLGDEPOT_0_TXTQUANTITY 34522
+hidspecial HID { HelpID = HID_DLGDEPOT_0_TXTQUANTITY ; };
+#define HID_DLGDEPOT_0_TXTRATE 34523
+hidspecial HID { HelpID = HID_DLGDEPOT_0_TXTRATE ; };
+#define HID_DLGDEPOT_0_TXTDATE 34524
+hidspecial HID { HelpID = HID_DLGDEPOT_0_TXTDATE ; };
+#define HID_DLGDEPOT_0_TXTCOMMISSION 34525
+hidspecial HID { HelpID = HID_DLGDEPOT_0_TXTCOMMISSION ; };
+#define HID_DLGDEPOT_0_TXTFIX 34526
+hidspecial HID { HelpID = HID_DLGDEPOT_0_TXTFIX ; };
+#define HID_DLGDEPOT_0_TXTMINIMUM 34527
+hidspecial HID { HelpID = HID_DLGDEPOT_0_TXTMINIMUM ; };
+#define HID_DLGDEPOT_0_CMDCANCEL_SELLBUY 34528
+hidspecial HID { HelpID = HID_DLGDEPOT_0_CMDCANCEL_SELLBUY ; };
+#define HID_DLGDEPOT_0_CMDGOON_SELLBUY 34529
+hidspecial HID { HelpID = HID_DLGDEPOT_0_CMDGOON_SELLBUY ; };
+#define HID_DLGDEPOT_1_LSTSELLSTOCKS 34530
+hidspecial HID { HelpID = HID_DLGDEPOT_1_LSTSELLSTOCKS ; };
+#define HID_DLGDEPOT_2_LSTBUYSTOCKS 34531
+hidspecial HID { HelpID = HID_DLGDEPOT_2_LSTBUYSTOCKS ; };
+#define HID_DLGDEPOT_DIALOG_SPLIT 34532
+hidspecial HID { HelpID = HID_DLGDEPOT_DIALOG_SPLIT ; };
+#define HID_DLGDEPOT_0_LSTSTOCKNAMES 34533
+hidspecial HID { HelpID = HID_DLGDEPOT_0_LSTSTOCKNAMES ; };
+#define HID_DLGDEPOT_0_TXTSTOCKID_SPLIT 34534
+hidspecial HID { HelpID = HID_DLGDEPOT_0_TXTSTOCKID_SPLIT ; };
+#define HID_DLGDEPOT_0_CMDCANCEL_SPLIT 34535
+hidspecial HID { HelpID = HID_DLGDEPOT_0_CMDCANCEL_SPLIT ; };
+#define HID_DLGDEPOT_0_CMDGOON_SPLIT 34536
+hidspecial HID { HelpID = HID_DLGDEPOT_0_CMDGOON_SPLIT ; };
+#define HID_DLGDEPOT_1_OPTPERSHARE 34537
+hidspecial HID { HelpID = HID_DLGDEPOT_1_OPTPERSHARE ; };
+#define HID_DLGDEPOT_1_OPTTOTAL 34538
+hidspecial HID { HelpID = HID_DLGDEPOT_1_OPTTOTAL ; };
+#define HID_DLGDEPOT_1_TXTDIVIDEND 34539
+hidspecial HID { HelpID = HID_DLGDEPOT_1_TXTDIVIDEND ; };
+#define HID_DLGDEPOT_2_TXTOLDRATE 34540
+hidspecial HID { HelpID = HID_DLGDEPOT_2_TXTOLDRATE ; };
+#define HID_DLGDEPOT_2_TXTNEWRATE 34541
+hidspecial HID { HelpID = HID_DLGDEPOT_2_TXTNEWRATE ; };
+#define HID_DLGDEPOT_2_TXTDATE 34542
+hidspecial HID { HelpID = HID_DLGDEPOT_2_TXTDATE ; };
+#define HID_DLGDEPOT_3_TXTSTARTDATE 34543
+hidspecial HID { HelpID = HID_DLGDEPOT_3_TXTSTARTDATE ; };
+#define HID_DLGDEPOT_3_TXTENDDATE 34544
+hidspecial HID { HelpID = HID_DLGDEPOT_3_TXTENDDATE ; };
+#define HID_DLGDEPOT_3_OPTDAILY 34545
+hidspecial HID { HelpID = HID_DLGDEPOT_3_OPTDAILY ; };
+#define HID_DLGDEPOT_3_OPTWEEKLY 34546
+hidspecial HID { HelpID = HID_DLGDEPOT_3_OPTWEEKLY ; };
+#define HID_DLGDEPOT_DIALOG_HISTORY 34547
+hidspecial HID { HelpID = HID_DLGDEPOT_DIALOG_HISTORY ; };
+#define HID_DLGDEPOT_LSTMARKETS 34548
+hidspecial HID { HelpID = HID_DLGDEPOT_LSTMARKETS ; };
+#define HID_DLGDEPOT_0_CMDCANCEL_HISTORY 34549
+hidspecial HID { HelpID = HID_DLGDEPOT_0_CMDCANCEL_HISTORY ; };
+#define HID_DLGDEPOT_0_CMDGOON_HISTORY 34550
+hidspecial HID { HelpID = HID_DLGDEPOT_0_CMDGOON_HISTORY ; };
+
+#define HID_DLGIMPORT_DIALOG 34570
+hidspecial HID { HelpID = HID_DLGIMPORT_DIALOG; };
+#define HID_DLGIMPORT_0_CMDHELP 34571
+hidspecial HID { HelpID = HID_DLGIMPORT_0_CMDHELP; };
+#define HID_DLGIMPORT_0_CMDCANCEL 34572
+hidspecial HID { HelpID = HID_DLGIMPORT_0_CMDCANCEL; };
+#define HID_DLGIMPORT_0_CMDPREV 34573
+hidspecial HID { HelpID = HID_DLGIMPORT_0_CMDPREV; };
+#define HID_DLGIMPORT_0_CMDNEXT 34574
+hidspecial HID { HelpID = HID_DLGIMPORT_0_CMDNEXT; };
+#define HID_DLGIMPORT_0_OPTSODOCUMENTS 34575
+hidspecial HID { HelpID = HID_DLGIMPORT_0_OPTSODOCUMENTS; };
+#define HID_DLGIMPORT_0_OPTMSDOCUMENTS 34576
+hidspecial HID { HelpID = HID_DLGIMPORT_0_OPTMSDOCUMENTS; };
+#define HID_DLGIMPORT_0_CHKLOGFILE 34577
+hidspecial HID { HelpID = HID_DLGIMPORT_0_CHKLOGFILE; };
+#define HID_DLGIMPORT_2_CHKWORD 34578
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CHKWORD; };
+#define HID_DLGIMPORT_2_CHKEXCEL 34579
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CHKEXCEL; };
+#define HID_DLGIMPORT_2_CHKPOWERPOINT 34580
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CHKPOWERPOINT; };
+#define HID_DLGIMPORT_2_CBTEMPLATE 34581
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CBTEMPLATE; };
+#define HID_DLGIMPORT_2_CBTEMPLATERECURSE 34582
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CBTEMPLATERECURSE; };
+#define HID_DLGIMPORT_2_LBTEMPLATEPATH 34583
+hidspecial HID { HelpID = HID_DLGIMPORT_2_LBTEMPLATEPATH; };
+#define HID_DLGIMPORT_2_EDTEMPLATEPATH 34584
+hidspecial HID { HelpID = HID_DLGIMPORT_2_EDTEMPLATEPATH; };
+#define HID_DLGIMPORT_2_CBDOCUMENT 34586
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CBDOCUMENT; };
+#define HID_DLGIMPORT_2_CMDTEMPLATEPATHSELECT 34585
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CMDTEMPLATEPATHSELECT; };
+#define HID_DLGIMPORT_2_CBDOCUMENT 34586
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CBDOCUMENT; };
+#define HID_DLGIMPORT_2_CBDOCUMENTRECURSE 34587
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CBDOCUMENTRECURSE; };
+#define HID_DLGIMPORT_2_LBDOCUMENTPATH 34588
+hidspecial HID { HelpID = HID_DLGIMPORT_2_LBDOCUMENTPATH; };
+#define HID_DLGIMPORT_2_EDDOCUMENTPATH 34589
+hidspecial HID { HelpID = HID_DLGIMPORT_2_EDDOCUMENTPATH; };
+#define HID_DLGIMPORT_2_CMDDOCUMENTPATHSELECT 34590
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CMDDOCUMENTPATHSELECT; };
+#define HID_DLGIMPORT_2_LBEXPORTDOCUMENTPATH 34591
+hidspecial HID { HelpID = HID_DLGIMPORT_2_LBEXPORTDOCUMENTPATH; };
+#define HID_DLGIMPORT_2_EDEXPORTDOCUMENTPATH 34592
+hidspecial HID { HelpID = HID_DLGIMPORT_2_EDEXPORTDOCUMENTPATH; };
+#define HID_DLGIMPORT_2_CMDEXPORTPATHSELECT 34593
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CMDEXPORTPATHSELECT; };
+#define HID_DLGIMPORT_3_TBSUMMARY 34595
+hidspecial HID { HelpID = HID_DLGIMPORT_3_TBSUMMARY; };
+
+#define HID_DLGIMPORT_2_CMDTEMPLATEPATHSELECT2 34600
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CMDTEMPLATEPATHSELECT2; };
+#define HID_DLGIMPORT_2_CMDDOCUMENTPATHSELECT2 34601
+hidspecial HID { HelpID = HID_DLGIMPORT_2_CMDDOCUMENTPATHSELECT2; };
+
+
+#define HID_DLGIMPORT_0_CHKWRITER 34596
+hidspecial HID { HelpID = HID_DLGIMPORT_0_CHKWRITER; };
+#define HID_DLGIMPORT_0_CHKCALC 34597
+hidspecial HID { HelpID = HID_DLGIMPORT_0_CHKCALC; };
+#define HID_DLGIMPORT_0_CHKIMPRESS 34598
+hidspecial HID { HelpID = HID_DLGIMPORT_0_CHKIMPRESS; };
+#define HID_DLGIMPORT_0_CHKMATHGLOBAL 34599
+hidspecial HID { HelpID = HID_DLGIMPORT_0_CHKMATHGLOBAL; };
+
+
+#define HID_DLGCORRESPONDENCE_DIALOG 34630
+hidspecial HID { HelpID = HID_DLGCORRESPONDENCE_DIALOG; };
+#define HID_DLGCORRESPONDENCE_CANCEL 34631
+hidspecial HID { HelpID = HID_DLGCORRESPONDENCE_CANCEL; };
+#define HID_DLGCORRESPONDENCE_OPTIONAGENDA1 34632
+hidspecial HID { HelpID = HID_DLGCORRESPONDENCE_OPTIONAGENDA1; };
+#define HID_DLGCORRESPONDENCE_OPTIONAGENDA2 34633
+hidspecial HID { HelpID = HID_DLGCORRESPONDENCE_OPTIONAGENDA2; };
+#define HID_DLGCORRESPONDENCE_AGENDAOKAY 34634
+hidspecial HID { HelpID = HID_DLGCORRESPONDENCE_AGENDAOKAY; };
+#define HID_DLGCORRESPONDENCE_OPTIONLETTER1 34635
+hidspecial HID { HelpID = HID_DLGCORRESPONDENCE_OPTIONLETTER1; };
+#define HID_DLGCORRESPONDENCE_OPTIONLETTER2 34636
+hidspecial HID { HelpID = HID_DLGCORRESPONDENCE_OPTIONLETTER2; };
+#define HID_DLGCORRESPONDENCE_LETTEROKAY 34637
+hidspecial HID { HelpID = HID_DLGCORRESPONDENCE_LETTEROKAY; };
+
+#define HID_DLGSTYLES_DIALOG 34650
+hidspecial HID { HelpID = HID_DLGSTYLES_DIALOG; };
+#define HID_DLGSTYLES_LISTBOX 34651
+hidspecial HID { HelpID = HID_DLGSTYLES_LISTBOX; };
+#define HID_DLGSTYLES_CANCEL 34652
+hidspecial HID { HelpID = HID_DLGSTYLES_CANCEL; };
+#define HID_DLGSTYLES_OKAY 34653
+hidspecial HID { HelpID = HID_DLGSTYLES_OKAY; };
+
+#define HID_DLGCONVERT_DIALOG 34660
+hidspecial HID { HelpID = HID_DLGCONVERT_DIALOG; };
+#define HID_DLGCONVERT_CHECKBOX1 34661
+hidspecial HID { HelpID = HID_DLGCONVERT_CHECKBOX1; };
+#define HID_DLGCONVERT_OPTIONBUTTON1 34662
+hidspecial HID { HelpID = HID_DLGCONVERT_OPTIONBUTTON1; };
+#define HID_DLGCONVERT_OPTIONBUTTON2 34663
+hidspecial HID { HelpID = HID_DLGCONVERT_OPTIONBUTTON2; };
+#define HID_DLGCONVERT_OPTIONBUTTON3 34664
+hidspecial HID { HelpID = HID_DLGCONVERT_OPTIONBUTTON3; };
+#define HID_DLGCONVERT_OPTIONBUTTON4 34665
+hidspecial HID { HelpID = HID_DLGCONVERT_OPTIONBUTTON4; };
+#define HID_DLGCONVERT_LISTBOX1 34666
+hidspecial HID { HelpID = HID_DLGCONVERT_LISTBOX1; };
+#define HID_DLGCONVERT_OBFILE 34667
+hidspecial HID { HelpID = HID_DLGCONVERT_OBFILE; };
+#define HID_DLGCONVERT_OBDIR 34668
+hidspecial HID { HelpID = HID_DLGCONVERT_OBDIR; };
+#define HID_DLGCONVERT_COMBOBOX1 34669
+hidspecial HID { HelpID = HID_DLGCONVERT_COMBOBOX1; };
+#define HID_DLGCONVERT_TBSOURCE 34670
+hidspecial HID { HelpID = HID_DLGCONVERT_TBSOURCE; };
+#define HID_DLGCONVERT_CHECKRECURSIVE 34671
+hidspecial HID { HelpID = HID_DLGCONVERT_CHECKRECURSIVE; };
+#define HID_DLGCONVERT_TBTARGET 34672
+hidspecial HID { HelpID = HID_DLGCONVERT_TBTARGET; };
+#define HID_DLGCONVERT_CBCANCEL 34673
+hidspecial HID { HelpID = HID_DLGCONVERT_CBCANCEL; };
+#define HID_DLGCONVERT_CBHELP 34674
+hidspecial HID { HelpID = HID_DLGCONVERT_CBHELP; };
+#define HID_DLGCONVERT_CBBACK 34675
+hidspecial HID { HelpID = HID_DLGCONVERT_CBBACK; };
+#define HID_DLGCONVERT_CBGOON 34676
+hidspecial HID { HelpID = HID_DLGCONVERT_CBGOON; };
+#define HID_DLGCONVERT_CBSOURCEOPEN 34677
+hidspecial HID { HelpID = HID_DLGCONVERT_CBSOURCEOPEN; };
+#define HID_DLGCONVERT_CBTARGETOPEN 34678
+hidspecial HID { HelpID = HID_DLGCONVERT_CBTARGETOPEN; };
+#define HID_DLGCONVERT_CHKPROTECT 34679
+hidspecial HID { HelpID = HID_DLGCONVERT_CHKPROTECT; };
+#define HID_DLGCONVERT_CHKTEXTDOCUMENTS 34680
+hidspecial HID { HelpID = HID_DLGCONVERT_CHKTEXTDOCUMENTS; };
+
+#define HID_DLGPASSWORD_CMDGOON 34690
+hidspecial HID { HelpID = HID_DLGPASSWORD_CMDGOON; };
+#define HID_DLGPASSWORD_CMDCANCEL 34691
+hidspecial HID { HelpID = HID_DLGPASSWORD_CMDCANCEL; };
+#define HID_DLGPASSWORD_CMDHELP 34692
+hidspecial HID { HelpID = HID_DLGPASSWORD_CMDHELP; };
+#define HID_DLGPASSWORD_TXTPASSWORD 34693
+hidspecial HID { HelpID = HID_DLGPASSWORD_TXTPASSWORD; };
+
+#define HID_DLGHOLIDAYCAL_DIALOG 34700
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_DIALOG; };
+#define HID_DLGHOLIDAYCAL_1_PREVIEW 34701
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_1_PREVIEW; };
+#define HID_DLGHOLIDAYCAL_1_OPYEAR 34702
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_1_OPYEAR; };
+#define HID_DLGHOLIDAYCAL_1_OPMONTH 34703
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_1_OPMONTH; };
+#define HID_DLGHOLIDAYCAL_1_EDYEAR 34704
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_1_EDYEAR; };
+#define HID_DLGHOLIDAYCAL_1_EDMONTH 34705
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_1_EDMONTH; };
+#define HID_DLGHOLIDAYCAL_1_SPINYEAR 34706
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_1_SPINYEAR; };
+#define HID_DLGHOLIDAYCAL_1_SPINMONTH 34707
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_1_SPINMONTH; };
+#define HID_DLGHOLIDAYCAL_1_CMBSTATE 34708
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_1_CMBSTATE; };
+#define HID_DLGHOLIDAYCAL_2_LBOWNDATA 34709
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_LBOWNDATA; };
+#define HID_DLGHOLIDAYCAL_2_CMDINSERT 34710
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_CMDINSERT; };
+#define HID_DLGHOLIDAYCAL_2_CMDDELETE 34711
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_CMDDELETE; };
+#define HID_DLGHOLIDAYCAL_2_EDEVENT 34712
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_EDEVENT; };
+#define HID_DLGHOLIDAYCAL_2_CHKEVENT 34713
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_CHKEVENT; };
+#define HID_DLGHOLIDAYCAL_2_EDEVENTDAY 34714
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_EDEVENTDAY; };
+#define HID_DLGHOLIDAYCAL_2_SPINEVENTDAY 34715
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_SPINEVENTDAY; };
+#define HID_DLGHOLIDAYCAL_2_EDEVENTMONTH 34716
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_EDEVENTMONTH; };
+#define HID_DLGHOLIDAYCAL_2_SPINEVENTMONTH 34717
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_SPINEVENTMONTH; };
+#define HID_DLGHOLIDAYCAL_2_EDEVENTYEAR 34718
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_EDEVENTYEAR; };
+#define HID_DLGHOLIDAYCAL_2_SPINEVENTYEAR 34719
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_2_SPINEVENTYEAR; };
+#define HID_DLGHOLIDAYCAL_0_CMDOWNDATA 34720
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_0_CMDOWNDATA; };
+#define HID_DLGHOLIDAYCAL_0_CMDCANCEL 34721
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_0_CMDCANCEL; };
+#define HID_DLGHOLIDAYCAL_0_CMDOK 34722
+hidspecial HID { HelpID = HID_DLGHOLIDAYCAL_0_CMDOK; };
+//End at 34767
+
+//Start at 40768
+
+//LetterWizard---------------------------
+
+#define HID_LTRWIZ_OPTBUSINESSLETTER 40769
+hidspecial HID { HelpID = HID_LTRWIZ_OPTBUSINESSLETTER; };
+#define HID_LTRWIZ_OPTPRIVOFFICIALLETTER 40770
+hidspecial HID { HelpID = HID_LTRWIZ_OPTPRIVOFFICIALLETTER; };
+#define HID_LTRWIZ_OPTPRIVATELETTER 40771
+hidspecial HID { HelpID = HID_LTRWIZ_OPTPRIVATELETTER; };
+#define HID_LTRWIZ_LSTBUSINESSSTYLE 40772
+hidspecial HID { HelpID = HID_LTRWIZ_LSTBUSINESSSTYLE; };
+#define HID_LTRWIZ_CHKBUSINESSPAPER 40773
+hidspecial HID { HelpID = HID_LTRWIZ_CHKBUSINESSPAPER; };
+#define HID_LTRWIZ_LSTPRIVOFFICIALSTYLE 40774
+hidspecial HID { HelpID = HID_LTRWIZ_LSTPRIVOFFICIALSTYLE; };
+#define HID_LTRWIZ_LSTPRIVATESTYLE 40775
+hidspecial HID { HelpID = HID_LTRWIZ_LSTPRIVATESTYLE; };
+#define HID_LTRWIZ_CHKPAPERCOMPANYLOGO 40776
+hidspecial HID { HelpID = HID_LTRWIZ_CHKPAPERCOMPANYLOGO; };
+#define HID_LTRWIZ_NUMLOGOHEIGHT 40777
+hidspecial HID { HelpID = HID_LTRWIZ_NUMLOGOHEIGHT; };
+#define HID_LTRWIZ_NUMLOGOX 40778
+hidspecial HID { HelpID = HID_LTRWIZ_NUMLOGOX; };
+#define HID_LTRWIZ_NUMLOGOWIDTH 40779
+hidspecial HID { HelpID = HID_LTRWIZ_NUMLOGOWIDTH; };
+#define HID_LTRWIZ_NUMLOGOY 40780
+hidspecial HID { HelpID = HID_LTRWIZ_NUMLOGOY; };
+#define HID_LTRWIZ_CHKPAPERCOMPANYADDRESS 40781
+hidspecial HID { HelpID = HID_LTRWIZ_CHKPAPERCOMPANYADDRESS; };
+#define HID_LTRWIZ_NUMADDRESSHEIGHT 40782
+hidspecial HID { HelpID = HID_LTRWIZ_NUMADDRESSHEIGHT; };
+#define HID_LTRWIZ_NUMADDRESSX 40783
+hidspecial HID { HelpID = HID_LTRWIZ_NUMADDRESSX; };
+#define HID_LTRWIZ_NUMADDRESSWIDTH 40784
+hidspecial HID { HelpID = HID_LTRWIZ_NUMADDRESSWIDTH; };
+#define HID_LTRWIZ_NUMADDRESSY 40785
+hidspecial HID { HelpID = HID_LTRWIZ_NUMADDRESSY; };
+#define HID_LTRWIZ_CHKCOMPANYRECEIVER 40786
+hidspecial HID { HelpID = HID_LTRWIZ_CHKCOMPANYRECEIVER; };
+#define HID_LTRWIZ_CHKPAPERFOOTER 40787
+hidspecial HID { HelpID = HID_LTRWIZ_CHKPAPERFOOTER; };
+#define HID_LTRWIZ_NUMFOOTERHEIGHT 40788
+hidspecial HID { HelpID = HID_LTRWIZ_NUMFOOTERHEIGHT; };
+#define HID_LTRWIZ_LSTLETTERNORM 40789
+hidspecial HID { HelpID = HID_LTRWIZ_LSTLETTERNORM; };
+#define HID_LTRWIZ_CHKUSELOGO 40790
+hidspecial HID { HelpID = HID_LTRWIZ_CHKUSELOGO; };
+#define HID_LTRWIZ_CHKUSEADDRESSRECEIVER 40791
+hidspecial HID { HelpID = HID_LTRWIZ_CHKUSEADDRESSRECEIVER; };
+#define HID_LTRWIZ_CHKUSESIGNS 40792
+hidspecial HID { HelpID = HID_LTRWIZ_CHKUSESIGNS; };
+#define HID_LTRWIZ_CHKUSESUBJECT 40793
+hidspecial HID { HelpID = HID_LTRWIZ_CHKUSESUBJECT; };
+#define HID_LTRWIZ_CHKUSESALUTATION 40794
+hidspecial HID { HelpID = HID_LTRWIZ_CHKUSESALUTATION; };
+#define HID_LTRWIZ_LSTSALUTATION 40795
+hidspecial HID { HelpID = HID_LTRWIZ_LSTSALUTATION; };
+#define HID_LTRWIZ_CHKUSEBENDMARKS 40796
+hidspecial HID { HelpID = HID_LTRWIZ_CHKUSEBENDMARKS; };
+#define HID_LTRWIZ_CHKUSEGREETING 40797
+hidspecial HID { HelpID = HID_LTRWIZ_CHKUSEGREETING; };
+#define HID_LTRWIZ_LSTGREETING 40798
+hidspecial HID { HelpID = HID_LTRWIZ_LSTGREETING; };
+#define HID_LTRWIZ_CHKUSEFOOTER 40799
+hidspecial HID { HelpID = HID_LTRWIZ_CHKUSEFOOTER; };
+#define HID_LTRWIZ_OPTSENDERPLACEHOLDER 40800
+hidspecial HID { HelpID = HID_LTRWIZ_OPTSENDERPLACEHOLDER; };
+#define HID_LTRWIZ_OPTSENDERDEFINE 40801
+hidspecial HID { HelpID = HID_LTRWIZ_OPTSENDERDEFINE; };
+#define HID_LTRWIZ_TXTSENDERNAME 40802
+hidspecial HID { HelpID = HID_LTRWIZ_TXTSENDERNAME; };
+#define HID_LTRWIZ_TXTSENDERSTREET 40803
+hidspecial HID { HelpID = HID_LTRWIZ_TXTSENDERSTREET; };
+#define HID_LTRWIZ_TXTSENDERPOSTCODE 40804
+hidspecial HID { HelpID = HID_LTRWIZ_TXTSENDERPOSTCODE; };
+#define HID_LTRWIZ_TXTSENDERSTATE_TEXT 40805
+hidspecial HID { HelpID = HID_LTRWIZ_TXTSENDERSTATE_TEXT; };
+#define HID_LTRWIZ_TXTSENDERCITY 40806
+hidspecial HID { HelpID = HID_LTRWIZ_TXTSENDERCITY; };
+#define HID_LTRWIZ_OPTRECEIVERPLACEHOLDER 40807
+hidspecial HID { HelpID = HID_LTRWIZ_OPTRECEIVERPLACEHOLDER; };
+#define HID_LTRWIZ_OPTRECEIVERDATABASE 40808
+hidspecial HID { HelpID = HID_LTRWIZ_OPTRECEIVERDATABASE; };
+#define HID_LTRWIZ_TXTFOOTER 40809
+hidspecial HID { HelpID = HID_LTRWIZ_TXTFOOTER; };
+#define HID_LTRWIZ_CHKFOOTERNEXTPAGES 40810
+hidspecial HID { HelpID = HID_LTRWIZ_CHKFOOTERNEXTPAGES; };
+#define HID_LTRWIZ_CHKFOOTERPAGENUMBERS 40811
+hidspecial HID { HelpID = HID_LTRWIZ_CHKFOOTERPAGENUMBERS; };
+#define HID_LTRWIZ_TXTTEMPLATENAME 40812
+hidspecial HID { HelpID = HID_LTRWIZ_TXTTEMPLATENAME; };
+#define HID_LTRWIZ_OPTCREATELETTER 40813
+hidspecial HID { HelpID = HID_LTRWIZ_OPTCREATELETTER; };
+#define HID_LTRWIZ_OPTMAKECHANGES 40814
+hidspecial HID { HelpID = HID_LTRWIZ_OPTMAKECHANGES; };
+#define HID_LTRWIZ_TXTPATH 40815
+hidspecial HID { HelpID = HID_LTRWIZ_TXTPATH; };
+#define HID_LTRWIZ_CMDPATH 40816
+hidspecial HID { HelpID = HID_LTRWIZ_CMDPATH; };
+
+#define HID_LTRWIZARD 40820
+hidspecial HID { HelpID = HID_LTRWIZARD; };
+#define HID_LTRWIZARD_HELP 40821
+hidspecial HID { HelpID = HID_LTRWIZARD_HELP; };
+#define HID_LTRWIZARD_BACK 40822
+hidspecial HID { HelpID = HID_LTRWIZARD_BACK; };
+#define HID_LTRWIZARD_NEXT 40823
+hidspecial HID { HelpID = HID_LTRWIZARD_NEXT; };
+#define HID_LTRWIZARD_CREATE 40824
+hidspecial HID { HelpID = HID_LTRWIZARD_CREATE; };
+#define HID_LTRWIZARD_CANCEL 40825
+hidspecial HID { HelpID = HID_LTRWIZARD_CANCEL; };
+
+#define HID_QUERYWIZARD_LSTTABLES 40850
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTTABLES; };
+#define HID_QUERYWIZARD_LSTFIELDS 40851
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFIELDS; };
+#define HID_QUERYWIZARD_CMDMOVESELECTED 40852
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDMOVESELECTED; };
+#define HID_QUERYWIZARD_CMDMOVEALL 40853
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDMOVEALL; };
+#define HID_QUERYWIZARD_CMDREMOVESELECTED 40854
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDREMOVESELECTED; };
+#define HID_QUERYWIZARD_CMDREMOVEALL 40855
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDREMOVEALL; };
+#define HID_QUERYWIZARD_LSTSELFIELDS 40856
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTSELFIELDS; };
+#define HID_QUERYWIZARD_CMDMOVEUP 40857
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDMOVEUP; };
+#define HID_QUERYWIZARD_CMDMOVEDOWN 40858
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDMOVEDOWN; };
+
+#define HID_QUERYWIZARD_SORT1 40865
+hidspecial HID { HelpID = HID_QUERYWIZARD_SORT1; };
+#define HID_QUERYWIZARD_OPTASCEND1 40866
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTASCEND1; };
+#define HID_QUERYWIZARD_OPTDESCEND1 40867
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTDESCEND1; };
+#define HID_QUERYWIZARD_SORT2 40868
+hidspecial HID { HelpID = HID_QUERYWIZARD_SORT2; };
+#define HID_QUERYWIZARD_OPTASCEND2 40869
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTASCEND2; };
+#define HID_QUERYWIZARD_OPTDESCEND2 40870
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTDESCEND2; };
+#define HID_QUERYWIZARD_SORT3 40871
+hidspecial HID { HelpID = HID_QUERYWIZARD_SORT3; };
+#define HID_QUERYWIZARD_OPTASCEND3 40872
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTASCEND3; };
+#define HID_QUERYWIZARD_OPTDESCEND3 40873
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTDESCEND3; };
+#define HID_QUERYWIZARD_SORT4 40874
+hidspecial HID { HelpID = HID_QUERYWIZARD_SORT4; };
+#define HID_QUERYWIZARD_OPTASCEND4 40875
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTASCEND4; };
+#define HID_QUERYWIZARD_OPTDESCEND4 40876
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTDESCEND4; };
+
+#define HID_QUERYWIZARD_OPTMATCHALL 40878
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTMATCHALL; };
+#define HID_QUERYWIZARD_OPTMATCHANY 40879
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTMATCHANY; };
+
+#define HID_QUERYWIZARD_LSTFIELDNAME_1 40880
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFIELDNAME_1; };
+#define HID_QUERYWIZARD_LSTOPERATOR_1 40881
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTOPERATOR_1; };
+#define HID_QUERYWIZARD_TXTVALUE_1 40882
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTVALUE_1; };
+#define HID_QUERYWIZARD_LSTFIELDNAME_2 40883
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFIELDNAME_2; };
+#define HID_QUERYWIZARD_LSTOPERATOR_2 40884
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTOPERATOR_2; };
+#define HID_QUERYWIZARD_TXTVALUE_2 40885
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTVALUE_2; };
+#define HID_QUERYWIZARD_LSTFIELDNAME_3 40886
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFIELDNAME_3; };
+#define HID_QUERYWIZARD_LSTOPERATOR_3 40887
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTOPERATOR_3; };
+#define HID_QUERYWIZARD_TXTVALUE_3 40888
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTVALUE_3; };
+
+#define HID_QUERYWIZARD_OPTAGGREGATEDETAILQUERY 40895
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTAGGREGATEDETAILQUERY; };
+#define HID_QUERYWIZARD_OPTAGGREGATESUMMARYQUERY 40896
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTAGGREGATESUMMARYQUERY; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_1 40897
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_1; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFIELDS_1 40898
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFIELDS_1; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_2 40899
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_2; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFIELDS_2 40900
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFIELDS_2; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_3 40901
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_3; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFIELDS_3 40902
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFIELDS_3; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_4 40903
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_4; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFIELDS_4 40904
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFIELDS_4; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_5 40905
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_5; };
+#define HID_QUERYWIZARD_LSTAGGREGATEFIELDS_5 40906
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTAGGREGATEFIELDS_5; };
+#define HID_QUERYWIZARD_BTNAGGREGATEPLUS 40907
+hidspecial HID { HelpID = HID_QUERYWIZARD_BTNAGGREGATEPLUS; };
+#define HID_QUERYWIZARD_BTNAGGREGATEMINUS 40908
+hidspecial HID { HelpID = HID_QUERYWIZARD_BTNAGGREGATEMINUS; };
+
+#define HID_QUERYWIZARD_LSTFILTERFIELDS 40915
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFILTERFIELDS; };
+#define HID_QUERYWIZARD_CMDFILTERMOVESELECTED 40916
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDFILTERMOVESELECTED; };
+#define HID_QUERYWIZARD_CMDFILTERREMOVESELECTED 40917
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDFILTERREMOVESELECTED; };
+#define HID_QUERYWIZARD_LSTFILTERSELFIELDS 40918
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFILTERSELFIELDS; };
+#define HID_QUERYWIZARD_CMDFILTERMOVEUP 40919
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDFILTERMOVEUP; };
+#define HID_QUERYWIZARD_CMDFILTERMOVEDOWN 40920
+hidspecial HID { HelpID = HID_QUERYWIZARD_CMDFILTERMOVEDOWN; };
+
+#define HID_QUERYWIZARD_OPTGROUPMATCHALL 40923
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTGROUPMATCHALL; };
+#define HID_QUERYWIZARD_OPTGROUPMATCHANY 40924
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTGROUPMATCHANY; };
+
+#define HID_QUERYWIZARD_LSTFILTERFIELDNAME_1 40925
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFILTERFIELDNAME_1; };
+#define HID_QUERYWIZARD_LSTFILTEROPERATOR_1 40926
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFILTEROPERATOR_1; };
+#define HID_QUERYWIZARD_TXTFILTERVALUE_1 40927
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTFILTERVALUE_1; };
+#define HID_QUERYWIZARD_LSTFILTERFIELDNAME_2 40928
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFILTERFIELDNAME_2; };
+#define HID_QUERYWIZARD_LSTFILTEROPERATOR_2 40929
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFILTEROPERATOR_2; };
+#define HID_QUERYWIZARD_TXTFILTERVALUE_2 40930
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTFILTERVALUE_2; };
+#define HID_QUERYWIZARD_LSTFILTERFIELDNAME_3 40931
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFILTERFIELDNAME_3; };
+#define HID_QUERYWIZARD_LSTFILTEROPERATOR_3 40932
+hidspecial HID { HelpID = HID_QUERYWIZARD_LSTFILTEROPERATOR_3; };
+#define HID_QUERYWIZARD_TXTFILTERVALUE_3 40933
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTFILTERVALUE_3; };
+
+#define HID_QUERYWIZARD_TXTTITLE_1 40940
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTTITLE_1; };
+#define HID_QUERYWIZARD_TXTTITLE_2 40941
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTTITLE_2; };
+#define HID_QUERYWIZARD_TXTTITLE_3 40942
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTTITLE_3; };
+#define HID_QUERYWIZARD_TXTTITLE_4 40943
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTTITLE_4; };
+#define HID_QUERYWIZARD_TXTTITLE_5 40944
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTTITLE_5; };
+#define HID_QUERYWIZARD_TXTTITLE_6 40945
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTTITLE_6; };
+#define HID_QUERYWIZARD_TXTTITLE_7 40946
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTTITLE_7; };
+
+#define HID_QUERYWIZARD_TXTQUERYTITLE 40955
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTQUERYTITLE; };
+#define HID_QUERYWIZARD_OPTDISPLAYQUERY 40956
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTDISPLAYQUERY; };
+#define HID_QUERYWIZARD_OPTMODIFYQUERY 40957
+hidspecial HID { HelpID = HID_QUERYWIZARD_OPTMODIFYQUERY; };
+#define HID_QUERYWIZARD_TXTSUMMARY 40958
+hidspecial HID { HelpID = HID_QUERYWIZARD_TXTSUMMARY; };
+
+#define HID_QUERYWIZARD 40970
+hidspecial HID { HelpID = HID_QUERYWIZARD; };
+#define HID_QUERYWIZARD_BACK 40972
+hidspecial HID { HelpID = HID_QUERYWIZARD_BACK; };
+#define HID_QUERYWIZARD_NEXT 40973
+hidspecial HID { HelpID = HID_QUERYWIZARD_NEXT; };
+#define HID_QUERYWIZARD_CREATE 40974
+hidspecial HID { HelpID = HID_QUERYWIZARD_CREATE; };
+#define HID_QUERYWIZARD_CANCEL 40975
+hidspecial HID { HelpID = HID_QUERYWIZARD_CANCEL; };
+
+// ++++++++++++++++++++++++++++++++++++++
+// +++ Web Wizard : Continued from 34312
+// ++++++++++++++++++++++++++++++++++++++
+// web wizard iconssets dialog
+#define HID_IS 41000
+hidspecial HID { HelpID = HID_IS; } ;
+#define HID_IS_BTN_NONE 41002
+hidspecial HID { HelpID = HID_IS_BTN_NONE; } ;
+#define HID_IS_BTN_OK 41003
+hidspecial HID { HelpID = HID_IS_BTN_OK; } ;
+#define HID_IS_BTN_CANCEL 41004
+hidspecial HID { HelpID = HID_IS_BTN_CANCEL; } ;
+
+#define HID_IS_BTN_IMG1 41005
+hidspecial HID { HelpID = HID_IS_BTN_IMG1; } ;
+#define HID_IS_BTN_IMG2 41006
+hidspecial HID { HelpID = HID_IS_BTN_IMG2; } ;
+#define HID_IS_BTN_IMG3 41007
+hidspecial HID { HelpID = HID_IS_BTN_IMG3; } ;
+#define HID_IS_BTN_IMG4 41008
+hidspecial HID { HelpID = HID_IS_BTN_IMG4; } ;
+#define HID_IS_BTN_IMG5 41009
+hidspecial HID { HelpID = HID_IS_BTN_IMG5; } ;
+#define HID_IS_BTN_IMG6 41010
+hidspecial HID { HelpID = HID_IS_BTN_IMG6; } ;
+#define HID_IS_BTN_IMG7 41011
+hidspecial HID { HelpID = HID_IS_BTN_IMG7; } ;
+#define HID_IS_BTN_IMG8 41012
+hidspecial HID { HelpID = HID_IS_BTN_IMG8; } ;
+#define HID_IS_BTN_IMG9 41013
+hidspecial HID { HelpID = HID_IS_BTN_IMG9; } ;
+#define HID_IS_BTN_IMG10 41014
+hidspecial HID { HelpID = HID_IS_BTN_IMG10; } ;
+#define HID_IS_BTN_IMG11 41015
+hidspecial HID { HelpID = HID_IS_BTN_IMG11; } ;
+#define HID_IS_BTN_IMG12 41016
+hidspecial HID { HelpID = HID_IS_BTN_IMG12; } ;
+#define HID_IS_BTN_IMG13 41017
+hidspecial HID { HelpID = HID_IS_BTN_IMG13; } ;
+#define HID_IS_BTN_IMG14 41018
+hidspecial HID { HelpID = HID_IS_BTN_IMG14; } ;
+#define HID_IS_BTN_IMG15 41019
+hidspecial HID { HelpID = HID_IS_BTN_IMG15; } ;
+#define HID_IS_BTN_IMG16 41020
+hidspecial HID { HelpID = HID_IS_BTN_IMG16; } ;
+#define HID_IS_BTN_IMG17 41021
+hidspecial HID { HelpID = HID_IS_BTN_IMG17; } ;
+#define HID_IS_BTN_IMG18 41022
+hidspecial HID { HelpID = HID_IS_BTN_IMG18; } ;
+#define HID_IS_BTN_IMG19 41023
+hidspecial HID { HelpID = HID_IS_BTN_IMG19; } ;
+#define HID_IS_BTN_IMG20 41024
+hidspecial HID { HelpID = HID_IS_BTN_IMG20; } ;
+#define HID_IS_BTN_IMG21 41025
+hidspecial HID { HelpID = HID_IS_BTN_IMG21; } ;
+#define HID_IS_BTN_IMG22 41026
+hidspecial HID { HelpID = HID_IS_BTN_IMG22; } ;
+#define HID_IS_BTN_IMG23 41027
+hidspecial HID { HelpID = HID_IS_BTN_IMG23; } ;
+#define HID_IS_BTN_IMG24 41028
+hidspecial HID { HelpID = HID_IS_BTN_IMG24; } ;
+#define HID_IS_BTN_IMG25 41029
+hidspecial HID { HelpID = HID_IS_BTN_IMG25; } ;
+#define HID_IS_BTN_IMG26 41030
+hidspecial HID { HelpID = HID_IS_BTN_IMG26; } ;
+#define HID_IS_BTN_IMG27 41031
+hidspecial HID { HelpID = HID_IS_BTN_IMG27; } ;
+#define HID_IS_BTN_IMG28 41032
+hidspecial HID { HelpID = HID_IS_BTN_IMG28; } ;
+#define HID_IS_BTN_IMG29 41033
+hidspecial HID { HelpID = HID_IS_BTN_IMG29; } ;
+#define HID_IS_BTN_IMG30 41034
+hidspecial HID { HelpID = HID_IS_BTN_IMG30; } ;
+#define HID_IS_BTN_IMG31 41035
+hidspecial HID { HelpID = HID_IS_BTN_IMG31; } ;
+#define HID_IS_BTN_IMG32 41036
+hidspecial HID { HelpID = HID_IS_BTN_IMG32; } ;
+
+// web wizard ftp dialog
+#define HID_FTP 41040
+hidspecial HID { HelpID = HID_FTP; } ;
+#define HID_FTP_SERVER 41041
+hidspecial HID { HelpID = HID_FTP_SERVER; } ;
+#define HID_FTP_USERNAME 41042
+hidspecial HID { HelpID = HID_FTP_USERNAME; } ;
+#define HID_FTP_PASS 41043
+hidspecial HID { HelpID = HID_FTP_PASS; } ;
+#define HID_FTP_TEST 41044
+hidspecial HID { HelpID = HID_FTP_TEST; } ;
+#define HID_FTP_TXT_PATH 41045
+hidspecial HID { HelpID = HID_FTP_TXT_PATH; } ;
+#define HID_FTP_BTN_PATH 41046
+hidspecial HID { HelpID = HID_FTP_BTN_PATH; } ;
+#define HID_FTP_OK 41047
+hidspecial HID { HelpID = HID_FTP_OK; } ;
+#define HID_FTP_CANCEL 41048
+hidspecial HID { HelpID = HID_FTP_CANCEL; } ;
+
+
+/* ====================================
+ * AGENDA WIZARD
+ * 41051 - 41099
+ * ====================================
+ */
+
+// step 0 - navibar
+
+#define HID_AGWIZ 41051
+hidspecial HID { HelpID = HID_AGWIZ; } ;
+#define HID_AGWIZ_HELP 41052
+hidspecial HID { HelpID = HID_AGWIZ_HELP; } ;
+#define HID_AGWIZ_NEXT 41053
+hidspecial HID { HelpID = HID_AGWIZ_NEXT; } ;
+#define HID_AGWIZ_PREV 41054
+hidspecial HID { HelpID = HID_AGWIZ_PREV; } ;
+#define HID_AGWIZ_CREATE 41055
+hidspecial HID { HelpID = HID_AGWIZ_CREATE; } ;
+#define HID_AGWIZ_CANCEL 41056
+hidspecial HID { HelpID = HID_AGWIZ_CANCEL; } ;
+
+//step 1 - design
+
+#define HID_AGWIZ_1_LIST_PAGEDESIGN 41057
+hidspecial HID { HelpID = HID_AGWIZ_1_LIST_PAGEDESIGN; } ;
+#define HID_AGWIZ_1_CHK_MINUTES 41058
+hidspecial HID { HelpID = HID_AGWIZ_1_CHK_MINUTES; } ;
+
+// step 2 - general attributes
+
+#define HID_AGWIZ_2_TXT_TIME 41059
+hidspecial HID { HelpID = HID_AGWIZ_2_TXT_TIME; } ;
+#define HID_AGWIZ_2_TXT_DATE 41060
+hidspecial HID { HelpID = HID_AGWIZ_2_TXT_DATE; } ;
+#define HID_AGWIZ_2_TXT_TITLE 41061
+hidspecial HID { HelpID = HID_AGWIZ_2_TXT_TITLE; } ;
+#define HID_AGWIZ_2_TXT_LOCATION 41062
+hidspecial HID { HelpID = HID_AGWIZ_2_TXT_LOCATION; } ;
+
+// step 3 - headings
+
+#define HID_AGWIZ_3_CHK_MEETING_TYPE 41063
+hidspecial HID { HelpID = HID_AGWIZ_3_CHK_MEETING_TYPE; } ;
+#define HID_AGWIZ_3_CHK_READ 41064
+hidspecial HID { HelpID = HID_AGWIZ_3_CHK_READ; } ;
+#define HID_AGWIZ_3_CHK_BRING 41065
+hidspecial HID { HelpID = HID_AGWIZ_3_CHK_BRING; } ;
+#define HID_AGWIZ_3_CHK_NOTES 41066
+hidspecial HID { HelpID = HID_AGWIZ_3_CHK_NOTES; } ;
+
+// step 4 - names
+
+#define HID_AGWIZ_4_CHK_CALLED_BY 41067
+hidspecial HID { HelpID = HID_AGWIZ_4_CHK_CALLED_BY; } ;
+#define HID_AGWIZ_4_CHK_FACILITATOR 41068
+hidspecial HID { HelpID = HID_AGWIZ_4_CHK_FACILITATOR; } ;
+#define HID_AGWIZ_4_CHK_NOTETAKER 41069
+hidspecial HID { HelpID = HID_AGWIZ_4_CHK_NOTETAKER; } ;
+#define HID_AGWIZ_4_CHK_TIMEKEEPER 41070
+hidspecial HID { HelpID = HID_AGWIZ_4_CHK_TIMEKEEPER; } ;
+#define HID_AGWIZ_4_CHK_ATTENDEES 41071
+hidspecial HID { HelpID = HID_AGWIZ_4_CHK_ATTENDEES; } ;
+#define HID_AGWIZ_4_CHK_OBSERVERS 41072
+hidspecial HID { HelpID = HID_AGWIZ_4_CHK_OBSERVERS; } ;
+#define HID_AGWIZ_4_CHK_RESOURCEPERSONS 41073
+hidspecial HID { HelpID = HID_AGWIZ_4_CHK_RESOURCEPERSONS; } ;
+
+// step 5 - topics
+
+#define HID_AGWIZ_6_TXT_TEMPLATENAME 41074
+hidspecial HID { HelpID = HID_AGWIZ_6_TXT_TEMPLATENAME; } ;
+#define HID_AGWIZ_6_TXT_TEMPLATEPATH 41075
+hidspecial HID { HelpID = HID_AGWIZ_6_TXT_TEMPLATEPATH; } ;
+#define HID_AGWIZ_6_BTN_TEMPLATEPATH 41076
+hidspecial HID { HelpID = HID_AGWIZ_6_BTN_TEMPLATEPATH; } ;
+
+// step 6 - file info
+
+#define HID_AGWIZ_6_OPT_CREATEAGENDA 41077
+hidspecial HID { HelpID = HID_AGWIZ_6_OPT_CREATEAGENDA; } ;
+#define HID_AGWIZ_6_OPT_MAKECHANGES 41078
+hidspecial HID { HelpID = HID_AGWIZ_6_OPT_MAKECHANGES; } ;
+
+// - again step 5 - buttons
+
+#define HID_AGWIZ_5_BTN_INSERT 41079
+hidspecial HID { HelpID = HID_AGWIZ_5_BTN_INSERT; } ;
+#define HID_AGWIZ_5_BTN_REMOVE 41080
+hidspecial HID { HelpID = HID_AGWIZ_5_BTN_REMOVE; } ;
+#define HID_AGWIZ_5_BTN_UP 41081
+hidspecial HID { HelpID = HID_AGWIZ_5_BTN_UP; } ;
+#define HID_AGWIZ_5_BTN_DOWN 41082
+hidspecial HID { HelpID = HID_AGWIZ_5_BTN_DOWN; } ;
+
+// again step 5 - scroll control
+
+#define HID_AGWIZ_5_SCROLL_BAR 41083
+hidspecial HID { HelpID = HID_AGWIZ_5_SCROLL_BAR; } ;
+
+#define HID_AGWIZ_5_TXT_TOPIC_1 41084
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_TOPIC_1; } ;
+#define HID_AGWIZ_5_TXT_RESPONSIBLE_1 41085
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_RESPONSIBLE_1; } ;
+#define HID_AGWIZ_5_TXT_MINUTES_1 41086
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_MINUTES_1; } ;
+
+#define HID_AGWIZ_5_TXT_TOPIC_2 41087
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_TOPIC_2; } ;
+#define HID_AGWIZ_5_TXT_RESPONSIBLE_2 41088
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_RESPONSIBLE_2; } ;
+#define HID_AGWIZ_5_TXT_MINUTES_2 41089
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_MINUTES_2; } ;
+
+#define HID_AGWIZ_5_TXT_TOPIC_3 41090
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_TOPIC_3; } ;
+#define HID_AGWIZ_5_TXT_RESPONSIBLE_3 41091
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_RESPONSIBLE_3; } ;
+#define HID_AGWIZ_5_TXT_MINUTES_3 41092
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_MINUTES_3; } ;
+
+#define HID_AGWIZ_5_TXT_TOPIC_4 41093
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_TOPIC_4; } ;
+#define HID_AGWIZ_5_TXT_RESPONSIBLE_4 41094
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_RESPONSIBLE_4; } ;
+#define HID_AGWIZ_5_TXT_MINUTES_4 41095
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_MINUTES_4; } ;
+
+#define HID_AGWIZ_5_TXT_TOPIC_5 41096
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_TOPIC_5; } ;
+#define HID_AGWIZ_5_TXT_RESPONSIBLE_5 41097
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_RESPONSIBLE_5; } ;
+#define HID_AGWIZ_5_TXT_MINUTES_5 41098
+hidspecial HID { HelpID = HID_AGWIZ_5_TXT_MINUTES_5; } ;
+
+
+//FaxWizard---------------------------
+
+#define HID_FAXWIZ_OPTBUSINESSFAX 41120
+hidspecial HID { HelpID = HID_FAXWIZ_OPTBUSINESSFAX; };
+#define HID_FAXWIZ_LSTBUSINESSSTYLE 41121
+hidspecial HID { HelpID = HID_FAXWIZ_LSTBUSINESSSTYLE; };
+#define HID_FAXWIZ_OPTPRIVATEFAX 41122
+hidspecial HID { HelpID = HID_FAXWIZ_OPTPRIVATEFAX; };
+#define HID_LSTPRIVATESTYLE 41123
+hidspecial HID { HelpID = HID_LSTPRIVATESTYLE; };
+#define HID_IMAGECONTROL3 41124
+hidspecial HID { HelpID = HID_IMAGECONTROL3; };
+#define HID_CHKUSELOGO 41125
+hidspecial HID { HelpID = HID_CHKUSELOGO; };
+#define HID_CHKUSEDATE 41126
+hidspecial HID { HelpID = HID_CHKUSEDATE; };
+#define HID_CHKUSECOMMUNICATIONTYPE 41127
+hidspecial HID { HelpID = HID_CHKUSECOMMUNICATIONTYPE; };
+#define HID_LSTCOMMUNICATIONTYPE 41128
+hidspecial HID { HelpID = HID_LSTCOMMUNICATIONTYPE; };
+#define HID_CHKUSESUBJECT 41129
+hidspecial HID { HelpID = HID_CHKUSESUBJECT; };
+#define HID_CHKUSESALUTATION 41130
+hidspecial HID { HelpID = HID_CHKUSESALUTATION; };
+#define HID_LSTSALUTATION 41131
+hidspecial HID { HelpID = HID_LSTSALUTATION; };
+#define HID_CHKUSEGREETING 41132
+hidspecial HID { HelpID = HID_CHKUSEGREETING; };
+#define HID_LSTGREETING 41133
+hidspecial HID { HelpID = HID_LSTGREETING; };
+#define HID_CHKUSEFOOTER 41134
+hidspecial HID { HelpID = HID_CHKUSEFOOTER; };
+#define HID_OPTSENDERPLACEHOLDER 41135
+hidspecial HID { HelpID = HID_OPTSENDERPLACEHOLDER; };
+#define HID_OPTSENDERDEFINE 41136
+hidspecial HID { HelpID = HID_OPTSENDERDEFINE; };
+#define HID_TXTSENDERNAME 41137
+hidspecial HID { HelpID = HID_TXTSENDERNAME; };
+#define HID_TXTSENDERSTREET 41138
+hidspecial HID { HelpID = HID_TXTSENDERSTREET; };
+#define HID_TXTSENDERPOSTCODE 41139
+hidspecial HID { HelpID = HID_TXTSENDERPOSTCODE; };
+#define HID_TXTSENDERSTATE 41140
+hidspecial HID { HelpID = HID_TXTSENDERSTATE; };
+#define HID_TXTSENDERCITY 41141
+hidspecial HID { HelpID = HID_TXTSENDERCITY; };
+#define HID_TXTSENDERFAX 41142
+hidspecial HID { HelpID = HID_TXTSENDERFAX; };
+#define HID_OPTRECEIVERPLACEHOLDER 41143
+hidspecial HID { HelpID = HID_OPTRECEIVERPLACEHOLDER; };
+#define HID_OPTRECEIVERDATABASE 41144
+hidspecial HID { HelpID = HID_OPTRECEIVERDATABASE; };
+#define HID_TXTFOOTER 41145
+hidspecial HID { HelpID = HID_TXTFOOTER; };
+#define HID_CHKFOOTERNEXTPAGES 41146
+hidspecial HID { HelpID = HID_CHKFOOTERNEXTPAGES; };
+#define HID_CHKFOOTERPAGENUMBERS 41147
+hidspecial HID { HelpID = HID_CHKFOOTERPAGENUMBERS; };
+#define HID_TXTTEMPLATENAME 41148
+hidspecial HID { HelpID = HID_TXTTEMPLATENAME; };
+#define HID_FILETEMPLATEPATH 41149
+hidspecial HID { HelpID = HID_FILETEMPLATEPATH; };
+#define HID_OPTCREATEFAX 41150
+hidspecial HID { HelpID = HID_OPTCREATEFAX; };
+#define HID_OPTMAKECHANGES 41151
+hidspecial HID { HelpID = HID_OPTMAKECHANGES; };
+#define HID_IMAGECONTROL2 41152
+hidspecial HID { HelpID = HID_IMAGECONTROL2; };
+#define HID_FAXWIZ_TXTPATH 41153
+hidspecial HID { HelpID = HID_FAXWIZ_TXTPATH; };
+#define HID_FAXWIZ_CMDPATH 41154
+hidspecial HID { HelpID = HID_FAXWIZ_CMDPATH; };
+
+#define HID_FAXWIZARD 41180
+hidspecial HID { HelpID = HID_FAXWIZARD; };
+#define HID_FAXWIZARD_HELP 41181
+hidspecial HID { HelpID = HID_FAXWIZARD_HELP; };
+#define HID_FAXWIZARD_BACK 41182
+hidspecial HID { HelpID = HID_FAXWIZARD_BACK; };
+#define HID_FAXWIZARD_NEXT 41183
+hidspecial HID { HelpID = HID_FAXWIZARD_NEXT; };
+#define HID_FAXWIZARD_CREATE 41184
+hidspecial HID { HelpID = HID_FAXWIZARD_CREATE; };
+#define HID_FAXWIZARD_CANCEL 41185
+hidspecial HID { HelpID = HID_FAXWIZARD_CANCEL; };
+
+
+
+/* ====================================
+ * TableWizard
+ * ====================================
+ */
+
+#define HID_DLGTABLE_DIALOG 41200
+hidspecial HID { HelpID = HID_DLGTABLE_DIALOG; };
+#define HID_DLGTABLE_CMDPREV 41202
+hidspecial HID { HelpID = HID_DLGTABLE_CMDPREV; };
+#define HID_DLGTABLE_CMDNEXT 41203
+hidspecial HID { HelpID = HID_DLGTABLE_CMDNEXT; };
+#define HID_DLGTABLE_CMDFINISH 41204
+hidspecial HID { HelpID = HID_DLGTABLE_CMDFINISH; };
+#define HID_DLGTABLE_CMDCANCEL 41205
+hidspecial HID { HelpID = HID_DLGTABLE_CMDCANCEL; };
+
+
+#define HID_DLGTABLE_OPTBUSINESS 41206
+hidspecial HID { HelpID = HID_DLGTABLE_OPTBUSINESS; };
+#define HID_DLGTABLE_OPTPRIVATE 41207
+hidspecial HID { HelpID = HID_DLGTABLE_OPTPRIVATE; };
+
+
+#define HID_DLGTABLE_LBTABLES 41208
+hidspecial HID { HelpID = HID_DLGTABLE_LBTABLES; };
+#define HID_DLGTABLE_FIELDSAVAILABLE 41209
+hidspecial HID { HelpID = HID_DLGTABLE_FIELDSAVAILABLE; };
+#define HID_DLGTABLE_CMDMOVESELECTED 41210
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMOVESELECTED; };
+#define HID_DLGTABLE_CMDMOVEALL 41211
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMOVEALL; };
+#define HID_DLGTABLE_CMDREMOVESELECTED 41212
+hidspecial HID { HelpID = HID_DLGTABLE_CMDREMOVESELECTED; };
+#define HID_DLGTABLE_CMDREMOVEALL 41213
+hidspecial HID { HelpID = HID_DLGTABLE_CMDREMOVEALL; };
+#define HID_DLGTABLE_FIELDSSELECTED 41214
+hidspecial HID { HelpID = HID_DLGTABLE_FIELDSSELECTED; };
+
+#define HID_DLGTABLE_CMDMOVEUP 41215
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMOVEUP; };
+#define HID_DLGTABLE_CMDMOVEDOWN 41216
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMOVEDOWN; };
+
+
+#define HID_DLGTABLE_LB_SELFIELDNAMES 41220
+hidspecial HID { HelpID = HID_DLGTABLE_LB_SELFIELDNAMES; };
+#define HID_DLGTABLE_CMDMOVEFIELDUP 41221
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMOVEFIELDUP; };
+#define HID_DLGTABLE_CMDMOVEFIELDDOWN 41222
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMOVEFIELDDOWN; };
+#define HID_DLGTABLE_CMDMINUS 41223
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMINUS; };
+#define HID_DLGTABLE_CMDPLUS 41224
+hidspecial HID { HelpID = HID_DLGTABLE_CMDPLUS; };
+#define HID_DLGTABLE_COLNAME 41225
+hidspecial HID { HelpID = HID_DLGTABLE_COLNAME; };
+#define HID_DLGTABLE_COLMODIFIER 41226
+hidspecial HID { HelpID = HID_DLGTABLE_COLMODIFIER; };
+
+
+#define HID_DLGTABLE_CHK_USEPRIMEKEY 41227
+hidspecial HID { HelpID = HID_DLGTABLE_CHK_USEPRIMEKEY; };
+#define HID_DLGTABLE_OPT_PK_AUTOMATIC 41228
+hidspecial HID { HelpID = HID_DLGTABLE_OPT_PK_AUTOMATIC; };
+
+#define HID_DLGTABLE_CK_PK_AUTOVALUE_AUTOMATIC 41229
+hidspecial HID { HelpID = HID_DLGTABLE_CK_PK_AUTOVALUE_AUTOMATIC; };
+
+#define HID_DLGTABLE_OPT_PK_SINGLE 41230
+hidspecial HID { HelpID = HID_DLGTABLE_OPT_PK_SINGLE; };
+#define HID_DLGTABLE_LB_PK_FIELDNAME 41231
+hidspecial HID { HelpID = HID_DLGTABLE_LB_PK_FIELDNAME; };
+#define HID_DLGTABLE_CK_PK_AUTOVALUE 41232
+hidspecial HID { HelpID = HID_DLGTABLE_CK_PK_AUTOVALUE; };
+#define HID_DLGTABLE_OPT_PK_SEVERAL 41233
+hidspecial HID { HelpID = HID_DLGTABLE_OPT_PK_SEVERAL; };
+#define HID_DLGTABLE_FIELDS_PK_AVAILABLE 41234
+hidspecial HID { HelpID = HID_DLGTABLE_FIELDS_PK_AVAILABLE; };
+#define HID_DLGTABLE_CMDMOVE_PK_SELECTED 41235
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMOVE_PK_SELECTED; };
+#define HID_DLGTABLE_CMDREMOVE_PK_SELECTED 41236
+hidspecial HID { HelpID = HID_DLGTABLE_CMDREMOVE_PK_SELECTED; };
+#define HID_DLGTABLE_FIELDS_PK_SELECTED 41237
+hidspecial HID { HelpID = HID_DLGTABLE_FIELDS_PK_SELECTED; };
+
+#define HID_DLGTABLE_CMDMOVEUP_PK_SELECTED 41238
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMOVEUP_PK_SELECTED; };
+#define HID_DLGTABLE_CMDMOVEDOWN_PK_SELECTED 41239
+hidspecial HID { HelpID = HID_DLGTABLE_CMDMOVEDOWN_PK_SELECTED; };
+
+
+
+
+#define HID_DLGTABLE_TXT_NAME 41240
+hidspecial HID { HelpID = HID_DLGTABLE_TXT_NAME; };
+#define HID_DLGTABLE_OPT_MODIFYTABLE 41241
+hidspecial HID { HelpID = HID_DLGTABLE_OPT_MODIFYTABLE; };
+#define HID_DLGTABLE_OPT_WORKWITHTABLE 41242
+hidspecial HID { HelpID = HID_DLGTABLE_OPT_WORKWITHTABLE; };
+#define HID_DLGTABLE_OPT_STARTFORMWIZARD 41243
+hidspecial HID { HelpID = HID_DLGTABLE_OPT_STARTFORMWIZARD; };
+#define HID_DLGTABLE_LST_CATALOG 41244
+hidspecial HID { HelpID = HID_DLGTABLE_LST_CATALOG; };
+#define HID_DLGTABLE_LST_SCHEMA 41245
+hidspecial HID { HelpID = HID_DLGTABLE_LST_SCHEMA; };
+
+
+
+
+//End at 42767
diff --git a/wizards/util/makefile.mk b/wizards/util/makefile.mk
new file mode 100644
index 000000000000..16cf678b4281
--- /dev/null
+++ b/wizards/util/makefile.mk
@@ -0,0 +1,42 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=wizards
+TARGET=NOTARGET
+GEN_HID=TRUE
+GEN_HID_OTHER=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Targets ------------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/wizards/util/soffice.lnk b/wizards/util/soffice.lnk
new file mode 100644
index 000000000000..f9f1eb297f90
--- /dev/null
+++ b/wizards/util/soffice.lnk
@@ -0,0 +1,248 @@
+[Main]
+; Linken der Module zu den entsprechenden SBLs
+; Pfade relativ zum Script.
+SBL-Dir=../sbl
+Modules-Dir=../../source
+CharSet=ANSI
+;
+[Libs]
+Standard=embedded
+;=soffice.sbl
+CreateReport=createre.sbl
+dbhandler=dbhandle.sbl
+ComboWizard=combowiz.sbl
+GridWizard=gridwiza.sbl
+GroupWizard=groupwiz.sbl
+FormEdit=formedit.sbl
+FormWizard=formwiza.sbl
+QueryWizard=querywiz.sbl
+ReportWizard=reportwi.sbl
+TableWizard=tablewiz.sbl
+Template=template.sbl
+Tools=tools.sbl
+WebWizard=webwizar.sbl
+Schedule=schedule.sbl
+Gimmicks=gimmicks.sbl
+ImportWizard=importwi.sbl
+Euro=euro.sbl
+;
+;
+[Standard-Modules]
+Module1=standard/modul1.mod
+;
+[CreateReport-Password]
+Password=createreport
+[CreateReport-Modules]
+CreateReport=createre/crearep.mod
+Language=createre/crelang.mod
+;
+;[CreateRepeat-Dialogs]
+;
+;
+[dbhandler-Password]
+Password=dbhandler
+[dbhandler-Modules]
+dbhandler=dbhandle/dbhdl.mod
+dbFormEdit=dbhandle/formedt.mod
+Language=dbhandle/dbhlang.mod
+;
+;[dbhandler-Dialogs]
+;
+;
+[FormWizard-Password]
+Password=formwizard
+[FormWizard-Modules]
+FormWizard=formwiza/frmwiz.mod
+Layouter=formwiza/layout.mod
+Language=formwiza/frmlang.mod
+DBMeta=formwiza/dbmeta.mod
+tools=formwiza/tools.mod
+develop=formwiza/develop.mod
+;
+[FormWizard-Dialogs]
+DlgFormDB=formwiza/form.dlg
+;
+;
+[ComboWizard-Password]
+Password=combowizard
+[ComboWizard-Modules]
+ComboWizard=combowiz/comwiz.mod
+Language=combowiz/comlang.mod
+;
+[ComboWizard-Dialogs]
+DlgComboDB=combowiz/combo.dlg
+;
+;
+[GridWizard-Password]
+Password=gridwizard
+[GridWizard-Modules]
+GridWizard=gridwiza/gridwiz.mod
+Language=gridwiza/grdlang.mod
+;
+[GridWizard-Dialogs]
+DlgGridDB=gridwiza/grid.dlg
+;
+;
+[GroupWizard-Password]
+Password=groupwizard
+[GroupWizard-Modules]
+GroupWizard=groupwiz/grpwiz.mod
+Layouter=groupwiz/layout.mod
+Language=groupwiz/grplang.mod
+;
+[GroupWizard-Dialogs]
+DlgGroupDB=groupwiz/group.dlg
+;
+;
+[FormEdit-Password]
+Password=formedit
+[FormEdit-Modules]
+dbDlgEditForm=formedit/edform.mod
+dbDlgAddGroup=formedit/addgroup.mod
+dbChgTabindex=formedit/chgtabix.mod
+dbChgSQL=formedit/dbchgsql.mod
+Language=formedit/lang.mod
+;
+[FormEdit-Dialogs]
+DlgChgGroup=formedit/chggrp.dlg
+DlgAddGroup=formedit/addgrp.dlg
+DlgChgTabindex=formedit/chgtabix.dlg
+DlgChgSQL=formedit/dlgsql.dlg
+;
+;
+[QueryWizard-Password]
+Password=querywizard
+[QueryWizard-Modules]
+QueryWizard=querywiz/qurypwiz.mod
+QueryLanguage=querywiz/qrylang.mod
+;
+[QueryWizard-Dialogs]
+DlgQuery=querywiz/query.dlg
+;
+;
+[ReportWizard-Password]
+Password=reportwizard
+[ReportWizard-Modules]
+ReportWizard=reportwi/repwiz.mod
+CreateReportView=reportwi/repview.mod
+ReportLanguage=reportwi/replang.mod
+;
+[ReportWizard-Dialogs]
+DlgReport=reportwi/report.dlg
+;
+;
+[TableWizard-Password]
+Password=tablewizard
+[TableWizard-Modules]
+TableWizard=tablewiz/tblwiz.mod
+TableLanguage=tablewiz/tbllang.mod
+;
+[TableWizard-Dialogs]
+DlgTable=tablewiz/table.dlg
+;
+;
+[Template-Password]
+Password=template
+[Template-Modules]
+ModuleAgenda=template/agenda.mod
+Correspondence=template/corresp.mod
+Samples=template/samples.mod
+Autotext=template/autotext.mod
+Greeting=template/greeting.mod
+;
+[Template-Dialogs]
+DialogAgenda=template/agenda.dlg
+DialogCorrespondence=template/corresp.dlg
+DialogStyles=template/styles.dlg
+DlgGreeting=template/greeting.dlg
+;
+;
+[Tools-Password]
+Password=tools
+[Tools-Modules]
+ModuleControls=tools/controls.mod
+Strings=tools/strings.mod
+Misc=tools/misc.mod
+Recursive=tools/recursiv.mod
+Listbox=tools/listbox.mod
+;
+;[Tools-Dialogs]
+;
+;
+[WebWizard-Password]
+Password=webwizard
+[WebWizard-Modules]
+HtmlAutoPilotBasic=webwizar/htmlplt.mod
+Language=webwizar/htmllang.mod
+;
+[WebWizard-Dialogs]
+MainDialog=webwizar/htmlaplt.dlg
+;
+;
+[Schedule-Password]
+Password=schedule
+[Schedule-Modules]
+OwnEvents=schedule/ownevent.mod
+CalendarMain=schedule/calmain.mod
+BankHoliday=schedule/bankholi.mod
+DlgControl=schedule/dlgctrl.mod
+Language=schedule/lang.mod
+CreateTable=schedule/creatabl.mod
+HolidayGerman=schedule/holi_ger.mod
+HolidayUSA=schedule/holi_usa.mod
+HolidayFrance=schedule/holi_fra.mod
+HolidayItalia=schedule/holi_ita.mod
+HolidaySpain=schedule/holi_spa.mod
+HolidayPortugal=schedule/holi_por.mod
+HolidayNetherlands=schedule/holi_nl.mod
+HolidaySweden=schedule/holi_swe.mod
+HolidayDanmark=schedule/holi_dan.mod
+HolidayRussia=schedule/holi_rus.mod
+HolidayPoland=schedule/holi_pol.mod
+;
+[Schedule-Dialogs]
+DlgCalendar=schedule/dlgcal.dlg
+;
+;
+[Gimmicks-Modules]
+GetTexts=gimmicks/gettext.mod
+Userfields=gimmicks/autfld.mod
+UserfieldsLanguage=gimmicks/usfldlan.mod
+ChangeAllChars=gimmicks/chchars.mod
+AutoText=gimmicks/autotext.mod
+AutoTextLanguage=gimmicks/autolang.mod
+ReadDir=gimmicks/readdirs.mod
+;
+[Gimmicks-Dialogs]
+UserfieldDlg=gimmicks/autfldlg.dlg
+ReadDirDlg=gimmicks/readdirs.dlg
+;
+;
+[ImportWizard-Password]
+Password=importwizard
+[ImportWizard-Modules]
+Main=importwi/main.mod
+DialogModul=importwi/dlgmodul.mod
+Language=importwi/impolang.mod
+FilesModul=importwi/filesmod.mod
+API=importwi/api.mod
+;
+[ImportWizard-Dialogs]
+ImportDialog=importwi/impordlg.dlg
+;
+;
+[Euro-Password]
+Password=euro
+[Euro-Modules]
+ConvertRun=euro/convert.mod
+AutoPilotRun=euro/autoplt.mod
+Hard=euro/hard.mod
+Soft=euro/soft.mod
+Init=euro/init.mod
+Common=euro/common.mod
+;
+[Euro-Dialogs]
+DialogConvert=euro/dlgconvt.dlg
+DialogPW = euro/dlgPW.dlg
+;
+;
diff --git a/wizards/util/target.pmk b/wizards/util/target.pmk
new file mode 100644
index 000000000000..c44093461234
--- /dev/null
+++ b/wizards/util/target.pmk
@@ -0,0 +1,41 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+CONFIG_ALL_TARGET = basicusr
+CONFIG_SHARE_TARGET = basicshare
+EURO_ALL_TARGET = basicsrveuro
+FORMWIZARD_ALL_TARGET = basicsrvform
+GIMMICKS_ALL_TARGET = basicsrvgimmicks
+IMPORTWIZARD_ALL_TARGET = basicsrvimport
+SCHEDULE_ALL_TARGET = basicsrvschedule
+TEMPLATE_ALL_TARGET = basicsrvtemplate
+TOOLS_ALL_TARGET = basicsrvtools
+WEBWIZARD_ALL_TARGET = basicsrvweb
+DEPOT_ALL_TARGET = basicsrvdepot
+STANDARD_ALL_TARGET = basicsrvstandard
+LAUNCHER_ALL_TARGET = basicsrvlauncher
+TUTORIALS_ALL_TARGET = basicsrvtutorials
+