summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/customize/macropg.cxx2
-rw-r--r--extensions/prj/build.lst3
-rw-r--r--extensions/source/propctrlr/eventhandler.cxx3
-rw-r--r--extensions/source/svg/svgaction.cxx1461
-rw-r--r--extensions/source/svg/svgaction.hxx167
-rw-r--r--extensions/source/svg/svgcom.hxx76
-rw-r--r--extensions/source/svg/svgprinter.cxx331
-rw-r--r--extensions/source/svg/svgprinter.hxx70
-rw-r--r--extensions/source/svg/svguno.cxx101
-rw-r--r--extensions/source/svg/svgwriter.cxx174
-rw-r--r--forms/source/component/Columns.cxx9
-rw-r--r--forms/source/component/DatabaseForm.cxx2
-rw-r--r--forms/source/component/Edit.cxx58
-rw-r--r--forms/source/component/Edit.hxx1
-rw-r--r--forms/source/component/Filter.cxx34
-rw-r--r--forms/source/component/FormattedField.cxx4
-rw-r--r--package/inc/EncryptedDataHeader.hxx32
-rw-r--r--package/inc/EncryptionData.hxx52
-rw-r--r--package/inc/PackageConstants.hxx36
-rw-r--r--package/inc/ZipFile.hxx52
-rw-r--r--package/inc/ZipOutputStream.hxx33
-rw-r--r--package/inc/ZipPackage.hxx42
-rw-r--r--package/inc/ZipPackageEntry.hxx (renamed from package/source/zippackage/ZipPackageEntry.hxx)0
-rw-r--r--package/inc/ZipPackageFolder.hxx4
-rw-r--r--package/inc/ZipPackageStream.hxx (renamed from package/source/zippackage/ZipPackageStream.hxx)74
-rw-r--r--package/qa/storages/TestHelper.java16
-rw-r--r--package/source/manifest/Base64Codec.cxx8
-rw-r--r--package/source/manifest/Base64Codec.hxx4
-rw-r--r--package/source/manifest/ManifestDefines.hxx21
-rw-r--r--package/source/manifest/ManifestExport.cxx285
-rw-r--r--package/source/manifest/ManifestImport.cxx169
-rw-r--r--package/source/manifest/ManifestImport.hxx28
-rw-r--r--package/source/manifest/UnoRegister.cxx5
-rw-r--r--package/source/xstor/owriteablestream.cxx188
-rw-r--r--package/source/xstor/xstorage.cxx210
-rw-r--r--package/source/xstor/xstorage.hxx11
-rw-r--r--package/source/zipapi/Deflater.cxx8
-rw-r--r--package/source/zipapi/EntryInputStream.cxx205
-rw-r--r--package/source/zipapi/EntryInputStream.hxx85
-rw-r--r--package/source/zipapi/Inflater.cxx4
-rw-r--r--package/source/zipapi/MemoryByteGrabber.hxx2
-rw-r--r--package/source/zipapi/XFileStream.cxx230
-rw-r--r--package/source/zipapi/XFileStream.hxx95
-rw-r--r--package/source/zipapi/XMemoryStream.cxx55
-rw-r--r--package/source/zipapi/XUnbufferedStream.cxx100
-rw-r--r--package/source/zipapi/XUnbufferedStream.hxx17
-rw-r--r--package/source/zipapi/ZipFile.cxx512
-rw-r--r--package/source/zipapi/ZipOutputStream.cxx122
-rw-r--r--package/source/zipapi/blowfishcontext.cxx122
-rw-r--r--package/source/zipapi/blowfishcontext.hxx58
-rw-r--r--package/source/zipapi/makefile.mk2
-rw-r--r--package/source/zipapi/sha1context.cxx97
-rw-r--r--package/source/zipapi/sha1context.hxx (renamed from package/source/zipapi/XMemoryStream.hxx)34
-rw-r--r--package/source/zippackage/ZipPackage.cxx573
-rw-r--r--package/source/zippackage/ZipPackageEntry.cxx24
-rw-r--r--package/source/zippackage/ZipPackageFolder.cxx197
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx406
-rw-r--r--package/source/zippackage/zipfileaccess.cxx5
-rwxr-xr-xsetup_native/source/packinfo/shellscripts_extensions.txt24
-rw-r--r--setup_native/source/win32/customactions/rebase/rebase.cxx85
-rw-r--r--setup_native/source/win32/customactions/shellextensions/registerextensions.cxx55
-rw-r--r--setup_native/source/win32/msi-encodinglist.txt2
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaTemplate.java135
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java112
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java31
-rw-r--r--wizards/com/sun/star/wizards/agenda/CGAgenda.java5
-rw-r--r--wizards/com/sun/star/wizards/agenda/CGTopic.java3
-rw-r--r--wizards/com/sun/star/wizards/agenda/CallWizard.java5
-rw-r--r--wizards/com/sun/star/wizards/agenda/TopicsControl.java52
-rw-r--r--wizards/com/sun/star/wizards/common/ConfigSet.java4
-rw-r--r--wizards/com/sun/star/wizards/common/Configuration.java45
-rw-r--r--wizards/com/sun/star/wizards/common/Desktop.java80
-rw-r--r--wizards/com/sun/star/wizards/common/FileAccess.java180
-rw-r--r--wizards/com/sun/star/wizards/common/HelpIds.java726
-rw-r--r--wizards/com/sun/star/wizards/common/Helper.java49
-rw-r--r--wizards/com/sun/star/wizards/common/JavaTools.java59
-rw-r--r--wizards/com/sun/star/wizards/common/NamedValueCollection.java2
-rw-r--r--wizards/com/sun/star/wizards/common/NumberFormatter.java14
-rw-r--r--wizards/com/sun/star/wizards/common/NumericalHelper.java45
-rw-r--r--wizards/com/sun/star/wizards/common/PropertyNames.java19
-rw-r--r--wizards/com/sun/star/wizards/common/PropertySetHelper.java6
-rw-r--r--wizards/com/sun/star/wizards/common/Resource.java8
-rw-r--r--wizards/com/sun/star/wizards/common/SystemDialog.java35
-rw-r--r--wizards/com/sun/star/wizards/common/UCB.java24
-rw-r--r--wizards/com/sun/star/wizards/common/XMLHelper.java2
-rw-r--r--wizards/com/sun/star/wizards/db/BlindtextCreator.java10
-rw-r--r--wizards/com/sun/star/wizards/db/ColumnPropertySet.java8
-rw-r--r--wizards/com/sun/star/wizards/db/CommandMetaData.java878
-rw-r--r--wizards/com/sun/star/wizards/db/CommandName.java45
-rw-r--r--wizards/com/sun/star/wizards/db/DBMetaData.java93
-rw-r--r--wizards/com/sun/star/wizards/db/FieldColumn.java39
-rw-r--r--wizards/com/sun/star/wizards/db/QueryMetaData.java33
-rw-r--r--wizards/com/sun/star/wizards/db/RecordParser.java23
-rw-r--r--wizards/com/sun/star/wizards/db/RelationController.java7
-rw-r--r--wizards/com/sun/star/wizards/db/SQLQueryComposer.java161
-rw-r--r--wizards/com/sun/star/wizards/db/TableDescriptor.java42
-rw-r--r--wizards/com/sun/star/wizards/db/TypeInspector.java34
-rw-r--r--wizards/com/sun/star/wizards/document/Control.java12
-rw-r--r--wizards/com/sun/star/wizards/document/DatabaseControl.java12
-rw-r--r--wizards/com/sun/star/wizards/document/FormHandler.java137
-rw-r--r--wizards/com/sun/star/wizards/document/GridControl.java2
-rw-r--r--wizards/com/sun/star/wizards/document/OfficeDocument.java72
-rw-r--r--wizards/com/sun/star/wizards/document/Shape.java10
-rw-r--r--wizards/com/sun/star/wizards/document/TimeStampControl.java11
-rw-r--r--wizards/com/sun/star/wizards/fax/CallWizard.java5
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxDocument.java27
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialog.java128
-rw-r--r--wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java79
-rw-r--r--wizards/com/sun/star/wizards/form/CallFormWizard.java5
-rw-r--r--wizards/com/sun/star/wizards/form/DataEntrySetter.java26
-rw-r--r--wizards/com/sun/star/wizards/form/FieldLinker.java81
-rw-r--r--wizards/com/sun/star/wizards/form/Finalizer.java12
-rw-r--r--wizards/com/sun/star/wizards/form/FormConfiguration.java28
-rw-r--r--wizards/com/sun/star/wizards/form/FormControlArranger.java395
-rw-r--r--wizards/com/sun/star/wizards/form/FormDocument.java40
-rw-r--r--wizards/com/sun/star/wizards/form/FormWizard.java70
-rw-r--r--wizards/com/sun/star/wizards/form/StyleApplier.java46
-rw-r--r--wizards/com/sun/star/wizards/form/UIControlArranger.java51
-rw-r--r--wizards/com/sun/star/wizards/letter/CallWizard.java5
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterDocument.java43
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialog.java184
-rw-r--r--wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java139
-rw-r--r--wizards/com/sun/star/wizards/query/CallQueryWizard.java12
-rw-r--r--wizards/com/sun/star/wizards/query/Finalizer.java25
-rw-r--r--wizards/com/sun/star/wizards/query/QuerySummary.java81
-rw-r--r--wizards/com/sun/star/wizards/query/QueryWizard.java86
-rw-r--r--wizards/com/sun/star/wizards/report/CallReportWizard.java22
-rw-r--r--wizards/com/sun/star/wizards/report/DBColumn.java30
-rw-r--r--wizards/com/sun/star/wizards/report/Dataimport.java35
-rw-r--r--wizards/com/sun/star/wizards/report/GroupFieldHandler.java12
-rwxr-xr-xwizards/com/sun/star/wizards/report/IReportBuilderLayouter.java8
-rw-r--r--wizards/com/sun/star/wizards/report/RecordTable.java12
-rw-r--r--wizards/com/sun/star/wizards/report/ReportFinalizer.java36
-rw-r--r--wizards/com/sun/star/wizards/report/ReportLayouter.java40
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextDocument.java190
-rw-r--r--wizards/com/sun/star/wizards/report/ReportTextImplementation.java75
-rw-r--r--wizards/com/sun/star/wizards/report/ReportWizard.java87
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java117
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java6
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java3
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java6
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java17
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java6
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java6
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java368
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java3
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java3
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java6
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java3
-rw-r--r--wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java44
-rw-r--r--wizards/com/sun/star/wizards/table/CGCategory.java5
-rw-r--r--wizards/com/sun/star/wizards/table/CallTableWizard.java9
-rw-r--r--wizards/com/sun/star/wizards/table/FieldDescription.java14
-rw-r--r--wizards/com/sun/star/wizards/table/FieldFormatter.java83
-rw-r--r--wizards/com/sun/star/wizards/table/Finalizer.java42
-rw-r--r--wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java50
-rw-r--r--wizards/com/sun/star/wizards/table/ScenarioSelector.java32
-rw-r--r--wizards/com/sun/star/wizards/table/TableWizard.java20
-rw-r--r--wizards/com/sun/star/wizards/text/TextDocument.java102
-rw-r--r--wizards/com/sun/star/wizards/text/TextFieldHandler.java39
-rw-r--r--wizards/com/sun/star/wizards/text/TextFrameHandler.java5
-rw-r--r--wizards/com/sun/star/wizards/text/TextSectionHandler.java37
-rw-r--r--wizards/com/sun/star/wizards/text/TextStyleHandler.java15
-rw-r--r--wizards/com/sun/star/wizards/text/TextTableHandler.java29
-rw-r--r--wizards/com/sun/star/wizards/text/ViewHandler.java18
-rw-r--r--wizards/com/sun/star/wizards/ui/AggregateComponent.java47
-rw-r--r--wizards/com/sun/star/wizards/ui/ButtonList.java38
-rw-r--r--wizards/com/sun/star/wizards/ui/CommandFieldSelection.java52
-rw-r--r--wizards/com/sun/star/wizards/ui/ControlScroller.java30
-rw-r--r--wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java18
-rw-r--r--wizards/com/sun/star/wizards/ui/DocumentPreview.java17
-rw-r--r--wizards/com/sun/star/wizards/ui/FieldSelection.java58
-rw-r--r--wizards/com/sun/star/wizards/ui/FilterComponent.java131
-rw-r--r--wizards/com/sun/star/wizards/ui/ImageList.java42
-rwxr-xr-xwizards/com/sun/star/wizards/ui/PathSelection.java14
-rw-r--r--wizards/com/sun/star/wizards/ui/PeerConfig.java10
-rw-r--r--wizards/com/sun/star/wizards/ui/SortingComponent.java59
-rw-r--r--wizards/com/sun/star/wizards/ui/TitlesComponent.java8
-rw-r--r--wizards/com/sun/star/wizards/ui/UIConsts.java16
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog.java195
-rw-r--r--wizards/com/sun/star/wizards/ui/UnoDialog2.java24
-rw-r--r--wizards/com/sun/star/wizards/ui/WizardDialog.java53
-rw-r--r--wizards/com/sun/star/wizards/ui/event/AbstractListener.java2
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAware.java6
-rw-r--r--wizards/com/sun/star/wizards/ui/event/DataAwareFields.java14
-rw-r--r--wizards/com/sun/star/wizards/ui/event/ListModelBinder.java19
-rw-r--r--wizards/com/sun/star/wizards/ui/event/MethodInvocation.java7
-rw-r--r--wizards/com/sun/star/wizards/ui/event/RadioDataAware.java4
-rw-r--r--wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java2
-rw-r--r--wizards/com/sun/star/wizards/ui/event/UnoDataAware.java20
-rw-r--r--wizards/com/sun/star/wizards/web/BackgroundsDialog.java5
-rw-r--r--wizards/com/sun/star/wizards/web/CallWizard.java7
-rw-r--r--wizards/com/sun/star/wizards/web/FTPDialog.java69
-rw-r--r--wizards/com/sun/star/wizards/web/IconsDialog.java5
-rw-r--r--wizards/com/sun/star/wizards/web/ImageListDialog.java22
-rw-r--r--wizards/com/sun/star/wizards/web/LogTaskListener.java3
-rw-r--r--wizards/com/sun/star/wizards/web/Process.java19
-rw-r--r--wizards/com/sun/star/wizards/web/StatusDialog.java14
-rw-r--r--wizards/com/sun/star/wizards/web/StylePreview.java5
-rw-r--r--wizards/com/sun/star/wizards/web/TOCPreview.java5
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_Events.java50
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_General.java6
-rw-r--r--wizards/com/sun/star/wizards/web/WWD_Startup.java28
-rw-r--r--wizards/com/sun/star/wizards/web/WebWizardDialog.java204
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGDesign.java2
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGDocument.java80
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGExporter.java5
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGPublish.java5
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGSettings.java10
-rw-r--r--wizards/com/sun/star/wizards/web/data/CGStyle.java4
-rw-r--r--wizards/com/sun/star/wizards/web/export/AbstractExporter.java6
-rw-r--r--wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java6
-rw-r--r--xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx4
-rw-r--r--xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx7
-rw-r--r--xmlsecurity/prj/build.lst3
-rw-r--r--xmlsecurity/qa/certext/SanCertExt.cxx281
-rw-r--r--xmlsecurity/qa/certext/User_35_Root_11.crt64
-rw-r--r--xmlsecurity/qa/certext/export.map (renamed from extensions/source/svg/makefile.mk)47
-rw-r--r--xmlsecurity/qa/certext/makefile.mk71
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx8
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx4
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper.cxx7
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper2.cxx1
-rw-r--r--xmlsecurity/source/xmlsec/makefile.mk6
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/makefile.mk3
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx182
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx84
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx3
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx9
-rw-r--r--xmlsecurity/source/xmlsec/nss/ciphercontext.cxx276
-rw-r--r--xmlsecurity/source/xmlsec/nss/ciphercontext.hxx89
-rw-r--r--xmlsecurity/source/xmlsec/nss/digestcontext.cxx101
-rw-r--r--xmlsecurity/source/xmlsec/nss/digestcontext.hxx (renamed from extensions/source/svg/svgwriter.hxx)45
-rw-r--r--xmlsecurity/source/xmlsec/nss/makefile.mk27
-rw-r--r--xmlsecurity/source/xmlsec/nss/nssinitializer.cxx521
-rw-r--r--xmlsecurity/source/xmlsec/nss/nssinitializer.hxx90
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx244
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx77
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx38
-rw-r--r--xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx365
-rw-r--r--xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx62
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx57
-rw-r--r--xmlsecurity/source/xmlsec/nss/xsec_nss.cxx34
-rw-r--r--xmlsecurity/source/xmlsec/xsec_xmlsec.cxx4
-rwxr-xr-xxmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt1
-rw-r--r--xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem64
-rwxr-xr-xxmlsecurity/test_docs/CAs/Root_11/demoCA/serial2
-rwxr-xr-xxmlsecurity/test_docs/CAs/Root_11/openssl.cfg17
-rw-r--r--xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt64
-rw-r--r--xmlsecurity/util/makefile.mk11
-rw-r--r--xmlsecurity/util/xsec_xmlsec.component1
-rw-r--r--xmlsecurity/util/xsec_xmlsec.windows.component3
252 files changed, 8916 insertions, 8865 deletions
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 007ad3d2ab1e..4ca097865063 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -924,7 +924,7 @@ IMPL_LINK( SvxMacroAssignSingleTabDialog, OKHdl_Impl, Button *, pButton )
{
(void)pButton; //unused
pPage->FillItemSet( *pOutSet );
- EndDialog( RET_CANCEL );
+ EndDialog( RET_OK );
return 0;
}
diff --git a/extensions/prj/build.lst b/extensions/prj/build.lst
index 377eca327ebf..9e31422bc577 100644
--- a/extensions/prj/build.lst
+++ b/extensions/prj/build.lst
@@ -17,9 +17,8 @@ ex extensions\source\plugin\unx nmake - u ex_plunx ex_inc
ex extensions\source\plugin\util nmake - all ex_plutil ex_plbase ex_plunx.u ex_plwin.w ex_plaqua.u ex_inc NULL
ex extensions\source\macosx\spotlight nmake - u ex_mxspotlight NULL
ex extensions\source\scanner nmake - all ex_scan ex_resrc ex_inc NULL
-ex extensions\source\svg nmake - all ex_svg ex_scan ex_inc NULL
ex extensions\source\bibliography nmake - all ex_bib ex_inc NULL
-ex extensions\source\xmlextract nmake - all ex_xmlextr ex_svg ex_inc NULL
+ex extensions\source\xmlextract nmake - all ex_xmlextr ex_inc NULL
ex extensions\source\propctrlr nmake - all ex_propctrlr ex_bib ex_inc NULL
ex extensions\source\dbpilots nmake - all ex_dbpilots ex_inc NULL
ex extensions\source\abpilot nmake - all ex_abpilot ex_inc NULL
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index ca4baaca2afb..62314f1ac7e6 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -75,6 +75,7 @@
#include <svx/svxdlg.hxx>
#include <svx/svxids.hrc>
#include <tools/diagnose_ex.h>
+#include <vcl/msgbox.hxx>
#include <map>
#include <algorithm>
@@ -942,7 +943,7 @@ namespace pcr
// DF definite problem here
// OK & Cancel seem to be both returning 0
- if ( pDialog->Execute() != 0 )
+ if ( pDialog->Execute() == RET_CANCEL )
return InteractiveSelectionResult_Cancelled;
try
diff --git a/extensions/source/svg/svgaction.cxx b/extensions/source/svg/svgaction.cxx
deleted file mode 100644
index 324fefa16b6f..000000000000
--- a/extensions/source/svg/svgaction.cxx
+++ /dev/null
@@ -1,1461 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_extensions.hxx"
-
-#include "svgaction.hxx"
-#include <vcl/virdev.hxx>
-#include <vcl/cvtgrf.hxx>
-#include <vcl/metric.hxx>
-
-#undef _SVG_USE_NATIVE_TEXTDECORATION
-#undef _SVG_USE_TSPANS
-
-// -----------
-// - statics -
-// -----------
-
-static const char aXMLElemSVG[] = "svg";
-static const char aXMLElemG[] = "g";
-static const char aXMLElemDefs[] = "defs";
-static const char aXMLElemClipPath[] = "clipPath";
-static const char aXMLElemLine[] = "line";
-static const char aXMLElemRect[] = "rect";
-static const char aXMLElemEllipse[] = "ellipse";
-static const char aXMLElemPath[] = "path";
-static const char aXMLElemPolygon[] = "polygon";
-static const char aXMLElemPolyLine[] = "polyline";
-static const char aXMLElemText[] = "text";
-static const char aXMLElemTSpan[] = "tspan";
-static const char aXMLElemImage[] = "image";
-
-static const char aXMLAttrTransform[] = "transform";
-static const char aXMLAttrStyle[] = "style";
-static const char aXMLAttrId[] = "id";
-
-static const char aXMLAttrD[] = "d";
-static const char aXMLAttrX[] = "x";
-static const char aXMLAttrY[] = "y";
-static const char aXMLAttrX1[] = "x1";
-static const char aXMLAttrY1[] = "y1";
-static const char aXMLAttrX2[] = "x2";
-static const char aXMLAttrY2[] = "y2";
-static const char aXMLAttrCX[] = "cx";
-static const char aXMLAttrCY[] = "cy";
-static const char aXMLAttrRX[] = "rx";
-static const char aXMLAttrRY[] = "ry";
-static const char aXMLAttrWidth[] = "width";
-static const char aXMLAttrHeight[] = "height";
-static const char aXMLAttrPoints[] = "points";
-static const char aXMLAttrXLinkHRef[] = "xlink:href";
-
-static const sal_Unicode pBase64[] =
-{
- //0 1 2 3 4 5 6 7
- 'A','B','C','D','E','F','G','H', // 0
- 'I','J','K','L','M','N','O','P', // 1
- 'Q','R','S','T','U','V','W','X', // 2
- 'Y','Z','a','b','c','d','e','f', // 3
- 'g','h','i','j','k','l','m','n', // 4
- 'o','p','q','r','s','t','u','v', // 5
- 'w','x','y','z','0','1','2','3', // 6
- '4','5','6','7','8','9','+','/' // 7
-};
-
-// --------------
-// - FastString -
-// --------------
-
-FastString::FastString( sal_uInt32 nInitLen, sal_uInt32 nIncrement ) :
- mpBuffer( new sal_Unicode[ nInitLen * sizeof( sal_Unicode ) ] ),
- mnBufLen( nInitLen ),
- mnCurLen( 0 ),
- mnBufInc( nIncrement ),
- mnPartPos( 0 )
-{
- DBG_ASSERT( nInitLen, "invalid initial length" );
- DBG_ASSERT( nIncrement, "invalid increment" );
-}
-
-// -----------------------------------------------------------------------------
-
-FastString::FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen ) :
- mnBufInc( 2048 ),
- mnPartPos( 0 )
-{
- DBG_ASSERT( pBufferForBase64Encoding && nBufLen, "invalid arguments" );
-
- const sal_uInt32 nQuadCount = nBufLen / 3;
- const sal_uInt32 nRest = nBufLen % 3;
-
- if( nQuadCount || nRest )
- {
- mnBufLen = mnCurLen = ( ( nQuadCount + ( nRest ? 1 : 0 ) ) << 2 );
- mpBuffer = new sal_Unicode[ mnBufLen * sizeof( sal_Unicode ) ];
-
- sal_Char* pTmpSrc = pBufferForBase64Encoding;
- sal_Unicode* pTmpDst = mpBuffer;
-
- for( sal_uInt32 i = 0; i < nQuadCount; i++ )
- {
- const sal_Int32 nA = *pTmpSrc++;
- const sal_Int32 nB = *pTmpSrc++;
- const sal_Int32 nC = *pTmpSrc++;
-
- *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
- *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
- *pTmpDst++ = pBase64[ ( ( nB << 2 ) & 0x3c ) + ( ( nC >> 6 ) & 0x3 ) ];
- *pTmpDst++ = pBase64[ nC & 0x3f ];
- }
-
- if( 1 == nRest )
- {
- const sal_Int32 nA = *pTmpSrc;
-
- *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
- *pTmpDst++ = pBase64[ ( nA << 4 ) & 0x30 ];
- *pTmpDst++ = '=';
- *pTmpDst = '=';
- }
- else if( 2 == nRest )
- {
- const sal_Int32 nA = *pTmpSrc++;
- const sal_Int32 nB = *pTmpSrc;
-
- *pTmpDst++ = pBase64[ ( nA >> 2 ) & 0x3f ];
- *pTmpDst++ = pBase64[ ( ( nA << 4 ) & 0x30 ) + ( ( nB >> 4 ) & 0xf ) ];
- *pTmpDst++ = pBase64[ ( nB << 2 ) & 0x3c ];
- *pTmpDst = '=';
- }
- }
- else
- {
- mpBuffer = new sal_Unicode[ ( mnBufLen = 1 ) * sizeof( sal_Unicode ) ];
- mnCurLen = 0;
- }
-}
-
-// -----------------------------------------------------------------------------
-
-FastString::~FastString()
-{
- delete[] mpBuffer;
-}
-
-// -----------------------------------------------------------------------------
-
-FastString& FastString::operator+=( const NMSP_RTL::OUString& rStr )
-{
- if( rStr.getLength() )
- {
- if( ( mnCurLen + rStr.getLength() ) > mnBufLen )
- {
- const sal_uInt32 nNewBufLen = ( mnBufLen + ( ( ( mnCurLen + rStr.getLength() ) - mnBufLen ) / mnBufInc + 1 ) * mnBufInc );
- sal_Unicode* pNewBuffer = new sal_Unicode[ nNewBufLen * sizeof( sal_Unicode ) ];
-
- memcpy( pNewBuffer, mpBuffer, mnBufLen * sizeof( sal_Unicode ) );
- delete[] mpBuffer;
- mpBuffer = pNewBuffer;
- mnBufLen = nNewBufLen;
- }
-
- memcpy( mpBuffer + mnCurLen, rStr.getStr(), rStr.getLength() * sizeof( sal_Unicode ) );
- mnCurLen += rStr.getLength();
-
- if( maString.getLength() )
- maString = NMSP_RTL::OUString();
- }
-
- return *this;
-}
-
-// -----------------------------------------------------------------------------
-
-const NMSP_RTL::OUString& FastString::GetString() const
-{
- if( !maString.getLength() && mnCurLen )
- ( (FastString*) this )->maString = NMSP_RTL::OUString( mpBuffer, mnCurLen );
-
- return maString;
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool FastString::GetFirstPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString )
-{
- const sal_uInt32 nLength = Min( mnCurLen, nPartLen );
-
- mnPartPos = 0;
-
- if( nLength )
- {
- rPartString = NMSP_RTL::OUString( mpBuffer, nLength );
- mnPartPos = nLength;
- }
-
- return( rPartString.getLength() > 0 );
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool FastString::GetNextPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString )
-{
- if( mnPartPos < mnCurLen )
- {
- const sal_uInt32 nLength = Min( mnCurLen - mnPartPos, nPartLen );
- rPartString = NMSP_RTL::OUString( mpBuffer + mnPartPos, nLength );
- mnPartPos += nLength;
- }
- else
- rPartString = NMSP_RTL::OUString();
-
- return( rPartString.getLength() > 0 );
-}
-
-// ----------------------
-// - SVGAttributeWriter -
-// ----------------------
-
-SVGAttributeWriter::SVGAttributeWriter( SVGActionWriter& rParent, SvXMLExport& rExport ) :
- mrParent( rParent ),
- mrExport( rExport ),
- mpElemFont( NULL ),
- mpElemPaint( NULL )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-SVGAttributeWriter::~SVGAttributeWriter()
-{
- delete mpElemPaint;
- delete mpElemFont;
-}
-
-// -----------------------------------------------------------------------------
-
-NMSP_RTL::OUString SVGAttributeWriter::GetFontStyle( const Font& rFont )
-{
- FastString aStyle;
-
- // font family
- aStyle += B2UCONST( "font-family:" );
- aStyle += NMSP_RTL::OUString( rFont.GetName().GetToken( 0, ';' ) );
-
- // font size
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-size:" );
- aStyle += mrParent.GetValueString( mrParent.ImplMap( Size( 0, rFont.GetHeight() ) ).Height(), mrParent.HasDoublePoints() );
-
- // font style
- if( rFont.GetItalic() != ITALIC_NONE )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-style:" );
-
- if( rFont.GetItalic() == ITALIC_OBLIQUE )
- aStyle += B2UCONST( "oblique" );
- else
- aStyle += B2UCONST( "italic" );
- }
-
- // font weight
- sal_Int32 nFontWeight;
-
- switch( rFont.GetWeight() )
- {
- case WEIGHT_THIN: nFontWeight = 100; break;
- case WEIGHT_ULTRALIGHT: nFontWeight = 200; break;
- case WEIGHT_LIGHT: nFontWeight = 300; break;
- case WEIGHT_SEMILIGHT: nFontWeight = 400; break;
- case WEIGHT_NORMAL: nFontWeight = 400; break;
- case WEIGHT_MEDIUM: nFontWeight = 500; break;
- case WEIGHT_SEMIBOLD: nFontWeight = 600; break;
- case WEIGHT_BOLD: nFontWeight = 700; break;
- case WEIGHT_ULTRABOLD: nFontWeight = 800; break;
- case WEIGHT_BLACK: nFontWeight = 900; break;
- default: nFontWeight = 400; break;
- }
-
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "font-weight:" );
- aStyle += NMSP_RTL::OUString::valueOf( nFontWeight );
-
- // !!!
- // font-variant
- // font-stretch
- // font-size-adjust
-
-#ifdef _SVG_USE_NATIVE_TEXTDECORATION
-
- if( rFont.GetUnderline() != UNDERLINE_NONE || rFont.GetStrikeout() != STRIKEOUT_NONE )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "text-decoration:" );
-
- if( rFont.GetUnderline() != UNDERLINE_NONE )
- aStyle += B2UCONST( " underline" );
-
- if( rFont.GetStrikeout() != STRIKEOUT_NONE )
- aStyle += B2UCONST( " line-through" );
- }
-
-#endif // _SVG_USE_NATIVE_TEXTDECORATION
-
- return aStyle.GetString();
-}
-
-// -----------------------------------------------------------------------------
-
-NMSP_RTL::OUString SVGAttributeWriter::GetPaintStyle( const Color& rLineColor, const Color& rFillColor )
-{
- FastString aStyle;
-
- // line color
- aStyle += B2UCONST( "stroke:" );
-
- if( rLineColor.GetTransparency() == 255 )
- aStyle += B2UCONST( "none" );
- else
- {
- // line color value in rgb
- aStyle += B2UCONST( "rgb(" );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetRed() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetGreen() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rLineColor.GetBlue() );
- aStyle += B2UCONST( ")" );
-
- // line color opacity in percent if neccessary
- if( rLineColor.GetTransparency() )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "stroke-opacity:" );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) ( ( 255 - (double) rLineColor.GetTransparency() ) / 2.55 ) );
- aStyle += B2UCONST( "%" );
- }
- }
-
- // fill color
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "fill:" );
-
- if( rFillColor.GetTransparency() == 255 )
- aStyle += B2UCONST( "none" );
- else
- {
- // fill color value in rgb
- aStyle += B2UCONST( "rgb(" );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetRed() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetGreen() );
- aStyle += B2UCONST( "," );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) rFillColor.GetBlue() );
- aStyle += B2UCONST( ")" );
-
- // fill color opacity in percent if neccessary
- if( rFillColor.GetTransparency() )
- {
- aStyle += B2UCONST( ";" );
- aStyle += B2UCONST( "fill-opacity:" );
- aStyle += NMSP_RTL::OUString::valueOf( (sal_Int32) ( ( 255 - (double) rFillColor.GetTransparency() ) / 2.55 ) );
- aStyle += B2UCONST( "%" );
- }
- }
-
- return aStyle.GetString();
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGAttributeWriter::SetFontAttr( const Font& rFont )
-{
- if( !mpElemFont || ( rFont != maCurFont ) )
- {
- delete mpElemPaint, mpElemPaint = NULL;
- delete mpElemFont;
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetFontStyle( maCurFont = rFont ) );
- mpElemFont = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGAttributeWriter::SetPaintAttr( const Color& rLineColor, const Color& rFillColor )
-{
- if( !mpElemPaint || ( rLineColor != maCurLineColor ) || ( rFillColor != maCurFillColor ) )
- {
- delete mpElemPaint;
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, GetPaintStyle( maCurLineColor = rLineColor, maCurFillColor = rFillColor ) );
- mpElemPaint = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- }
-}
-
-// -------------------
-// - SVGActionWriter -
-// -------------------
-
-SVGActionWriter::SVGActionWriter( SvXMLExport& rExport, const GDIMetaFile& rMtf,
- VirtualDevice* pParentVDev, sal_Bool bWriteDoublePoints ) :
- mrExport( rExport ),
- mrMtf( rMtf ),
- mpContext( NULL ),
- mnCurClipId( 1 ),
- mbClipAttrChanged( sal_False ),
- mbDoublePoints( bWriteDoublePoints )
-{
- if( pParentVDev )
- {
- mpVDev = pParentVDev;
- mbDestroyVDev = sal_False;
- maTargetMapMode = mpVDev->GetMapMode();
- }
- else
- {
- mpVDev = new VirtualDevice;
- mpVDev->EnableOutput( sal_False );
- mbDestroyVDev = sal_True;
- maTargetMapMode = MAP_100TH_MM;
- }
-
- mpVDev->Push();
- mpVDev->SetMapMode( mrMtf.GetPrefMapMode() );
- ImplWriteActions( mrMtf );
- mpVDev->Pop();
-}
-
-// -----------------------------------------------------------------------------
-
-SVGActionWriter::~SVGActionWriter()
-{
- DBG_ASSERT( !mpContext, "Not all contexts are closed" );
-
- if( mbDestroyVDev )
- delete mpVDev;
-}
-
-// -----------------------------------------------------------------------------
-
-long SVGActionWriter::ImplMap( sal_Int32 nVal ) const
-{
- return ImplMap( Size( nVal, nVal ) ).Width();
-}
-
-// -----------------------------------------------------------------------------
-
-Point SVGActionWriter::ImplMap( const Point& rPt ) const
-{
- return mpVDev->LogicToLogic( rPt, mpVDev->GetMapMode(), maTargetMapMode );
-}
-
-// -----------------------------------------------------------------------------
-
-Size SVGActionWriter::ImplMap( const Size& rSz ) const
-{
- return mpVDev->LogicToLogic( rSz, mpVDev->GetMapMode(), maTargetMapMode );
-}
-
-// -----------------------------------------------------------------------------
-
-NMSP_RTL::OUString SVGActionWriter::GetValueString( sal_Int32 nVal, sal_Bool bDoublePoints )
-{
- if( !bDoublePoints )
- return NMSP_RTL::OUString::valueOf( nVal );
- else
- {
- const double fPoints = nVal * 72.0 / 2540.0;
- const sal_Int32 nInt = (sal_Int32) fPoints;
-
- return( ( NMSP_RTL::OUString::valueOf( nInt ) +=
- NMSP_RTL::OUString::valueOf( (sal_Unicode) '.' ) ) +=
- NMSP_RTL::OUString::valueOf( labs( (sal_Int32) ( ( fPoints - nInt ) * 100.0 ) ) ) );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor,
- const NMSP_RTL::OUString* pStyle )
-{
- const Point aPt1( ImplMap( rPt1 ) );
- const Point aPt2( ImplMap( rPt2 ) );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX1, GetValueString( aPt1.X(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY1, GetValueString( aPt1.Y(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX2, GetValueString( aPt2.X(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY2, GetValueString( aPt2.Y(), mbDoublePoints ) );
-
- // add additional style if requested
- if( pStyle )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
-
- if( pLineColor )
- {
- // !!! mrExport.AddAttribute( XML_NAMESPACE_NONE, ... )
- OSL_FAIL( "SVGActionWriter::ImplWriteLine: Line color not implemented" );
- }
-
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemLine, sal_True, sal_True );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteRect( const Rectangle& rRect, long nRadX, long nRadY,
- const NMSP_RTL::OUString* pStyle )
-{
- const Rectangle aRect( ImplMap( rRect ) );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aRect.Left(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aRect.Top(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, GetValueString( aRect.GetWidth(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, GetValueString( aRect.GetHeight(), mbDoublePoints ) );
-
- if( nRadX )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ), mbDoublePoints ) );
-
- if( nRadY )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ), mbDoublePoints ) );
-
- // add additional style if requested
- if( pStyle )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
-
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemRect, sal_True, sal_True );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY,
- const NMSP_RTL::OUString* pStyle )
-{
- const Point aCenter( ImplMap( rCenter ) );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCX, GetValueString( aCenter.X(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrCY, GetValueString( aCenter.Y(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRX, GetValueString( ImplMap( nRadX ), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrRY, GetValueString( ImplMap( nRadY ), mbDoublePoints ) );
-
- // add additional style if requested
- if( pStyle )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
-
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemEllipse, sal_True, sal_True );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWritePolygon( const Polygon& rPoly, sal_Bool bLineOnly,
- const NMSP_RTL::OUString* pStyle )
-{
- if( rPoly.GetSize() )
- {
- if( rPoly.HasFlags() )
- ImplWritePolyPolygon( rPoly, bLineOnly, pStyle );
- else
- {
- FastString aStyle;
- FastString aPoints;
- sal_uInt16 i = 0, nSize = rPoly.GetSize();
- const NMSP_RTL::OUString aBlank( B2UCONST( " " ) );
-
- // points
- while( i < nSize )
- {
- const Point aPolyPoint( ImplMap( rPoly[ i ] ) );
-
- aPoints += GetValueString( aPolyPoint.X(), mbDoublePoints );
- aPoints += B2UCONST( "," );
- aPoints += GetValueString( aPolyPoint.Y(), mbDoublePoints );
-
- if( ++i < nSize )
- aPoints += aBlank;
- }
-
- // style
- if( bLineOnly )
- {
- aStyle += B2UCONST( "fill:none" );
-
- if( pStyle )
- {
- aStyle += B2UCONST( ";" );
- aStyle += *pStyle;
- }
- }
- else if( pStyle )
- aStyle += *pStyle;
-
- // add point attribute
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrPoints, aPoints.GetString() );
-
- // add style attribute
- if( aStyle.GetLength() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() );
-
- {
- // write polyline/polygon element
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, bLineOnly ? aXMLElemPolyLine : aXMLElemPolygon, sal_True, sal_True );
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly,
- const NMSP_RTL::OUString* pStyle )
-{
- if( rPolyPoly.Count() )
- {
- if( ( rPolyPoly.Count() == 1 ) && ( rPolyPoly[ 0 ].HasFlags() == sal_False ) )
- ImplWritePolygon( rPolyPoly[ 0 ], bLineOnly, pStyle );
- else
- {
- FastString aStyle;
- FastString aPathData;
- const NMSP_RTL::OUString aBlank( B2UCONST( " " ) );
- const NMSP_RTL::OUString aComma( B2UCONST( "," ) );
- Point aPolyPoint;
-
- for( long i = 0, nCount = rPolyPoly.Count(); i < nCount; i++ )
- {
- const Polygon& rPoly = rPolyPoly[ (sal_uInt16) i ];
- sal_uInt16 n = 1, nSize = rPoly.GetSize();
-
- if( nSize > 1 )
- {
- aPathData += B2UCONST( "M " );
- aPathData += GetValueString( ( aPolyPoint = ImplMap( rPoly[ 0 ] ) ).X(), mbDoublePoints );
- aPathData += aComma;
- aPathData += GetValueString( aPolyPoint.Y(), mbDoublePoints );
- sal_Char nCurrentMode = 0;
-
- while( n < nSize )
- {
- aPathData += aBlank;
- if ( ( rPoly.GetFlags( n ) == POLY_CONTROL ) && ( ( n + 2 ) < nSize ) )
- {
- if ( nCurrentMode != 'C' )
- {
- nCurrentMode = 'C';
- aPathData += B2UCONST( "C " );
- }
- for ( int j = 0; j < 3; j++ )
- {
- if ( j )
- aPathData += aBlank;
- aPathData += GetValueString( ( aPolyPoint = ImplMap( rPoly[ n++ ] ) ).X(), mbDoublePoints );
- aPathData += aComma;
- aPathData += GetValueString( aPolyPoint.Y(), mbDoublePoints );
- }
- }
- else
- {
- if ( nCurrentMode != 'L' )
- {
- nCurrentMode = 'L';
- aPathData += B2UCONST( "L " );
- }
- aPathData += GetValueString( ( aPolyPoint = ImplMap( rPoly[ n++ ] ) ).X(), mbDoublePoints );
- aPathData += aComma;
- aPathData += GetValueString( aPolyPoint.Y(), mbDoublePoints );
- }
- }
- aPathData += B2UCONST( " Z" );
-
- if( i < ( nCount - 1 ) )
- aPathData += aBlank;
- }
- }
- if( bLineOnly )
- {
- aStyle += B2UCONST( "fill:none" );
- if( pStyle )
- aStyle += B2UCONST( ";" );
- }
- if( pStyle )
- aStyle += *pStyle;
-
- // add style attribute
- if( aStyle.GetLength() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aStyle.GetString() );
-
- // add path data attribute
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrD, aPathData.GetString() );
- {
- // write polyline/polygon element
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemPath, sal_True, sal_True );
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient,
- const NMSP_RTL::OUString* pStyle )
-{
- if( rPolyPoly.Count() )
- {
- SvXMLElementExport aElemG( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- FastString aClipId;
- FastString aClipStyle;
-
- aClipId += B2UCONST( "clip" );
- aClipId += NMSP_RTL::OUString::valueOf( ImplGetNextClipId() );
-
- {
- SvXMLElementExport aElemDefs( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, sal_True, sal_True );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, aClipId.GetString() );
-
- {
- SvXMLElementExport aElemClipPath( mrExport, XML_NAMESPACE_NONE, aXMLElemClipPath, sal_True, sal_True );
- ImplWritePolyPolygon( rPolyPoly, sal_False );
- }
- }
-
- // create new context with clippath set
- aClipStyle += B2UCONST( "clip-path:URL(#" );
- aClipStyle += aClipId.GetString();
- aClipStyle += B2UCONST( ")" );
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, aClipStyle.GetString() );
-
- {
- GDIMetaFile aTmpMtf;
- SvXMLElementExport aElemG2( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
-
- mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), rGradient, aTmpMtf );
- ImplWriteActions( aTmpMtf, pStyle );
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
- const sal_Int32* pDXArray, long nWidth,
- const NMSP_RTL::OUString* pStyle )
-{
- String aText( rText ); aText.EraseLeadingChars( ' ' );
- sal_uInt32 nLen = aText.Len(), i;
-
- if( nLen )
- {
- Size aNormSize;
- sal_Int32* pOwnArray;
- sal_Int32* pDX;
-
- // get text sizes
- if( pDXArray )
- {
- pOwnArray = NULL;
- aNormSize = Size( mpVDev->GetTextWidth( aText ), 0 );
- pDX = const_cast< sal_Int32* >( pDXArray );
- }
- else
- {
- pOwnArray = new sal_Int32[ nLen ];
- aNormSize = Size( mpVDev->GetTextArray( aText, pOwnArray ), 0 );
- pDX = pOwnArray;
- }
-
- if( nLen > 1 )
- {
- aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( aText.GetChar( (sal_uInt16) nLen - 1 ) );
-
- if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) )
- {
- const double fFactor = (double) nWidth / aNormSize.Width();
-
- for( i = 0; i < ( nLen - 1 ); i++ )
- pDX[ i ] = FRound( pDX[ i ] * fFactor );
- }
- }
-
- FastString aStyle;
- const Font& rFont = mpVDev->GetFont();
- const FontMetric aMetric( mpVDev->GetFontMetric() );
- Point aBaseLinePos( rPos );
- SvXMLElementExport* pTransform = NULL;
-
- // leading whitespaces erased? => adjust position
- if( nLen < rText.Len() )
- {
- aBaseLinePos.X() += mpVDev->GetTextWidth( ' ' ) * ( rText.Len() - nLen );
- }
-
- // always adjust text position to match baseline alignment
- switch( rFont.GetAlign() )
- {
- case( ALIGN_TOP ):
- aBaseLinePos.Y() += aMetric.GetAscent();
- break;
-
- case( ALIGN_BOTTOM ):
- aBaseLinePos.Y() -= aMetric.GetDescent();
- break;
-
- default:
- break;
- }
-
- // get mapped text position
- const Point aPt( ImplMap( aBaseLinePos ) );
-
- // if text is rotated, set transform at new g element
- if( rFont.GetOrientation() )
- {
- String aTransform;
-
- aTransform = NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM("translate"));
- aTransform += '(';
- aTransform += String( GetValueString( aPt.X(), mbDoublePoints ) );
- aTransform += ',';
- aTransform += String( GetValueString( aPt.Y(), mbDoublePoints ) );
- aTransform += ')';
-
- aTransform += String( NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(" rotate")) );
- aTransform += '(';
- aTransform += String( NMSP_RTL::OUString::valueOf( rFont.GetOrientation() * -0.1 ) );
- aTransform += ')';
-
- aTransform += String( NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(" translate")) );
- aTransform += '(';
- aTransform += String( GetValueString( -aPt.X(), mbDoublePoints ) );
- aTransform += ',';
- aTransform += String( GetValueString( -aPt.Y(), mbDoublePoints ) );
- aTransform += ')';
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform );
- pTransform = new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_True );
- }
-
- // add additional style if requested
- if( pStyle && pStyle->getLength() )
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStyle, *pStyle );
-
- // write text element
-#ifdef _SVG_USE_TSPANS
- if( pDXArray )
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_True );
- FastString aTSpanX;
- const NMSP_RTL::OUString aSpace( ' ' );
- long i, nX, nCount;
-
- aTSpanX += GetValueString( aPt.X(), mbDoublePoints );
- aTSpanX += aSpace;
-
- for( i = 0, nX = aPt.X(), nCount = ( nLen - 1 ); i < nCount; )
- {
- aTSpanX += GetValueString( aPt.X() + pDX[ i++ ], mbDoublePoints );
- aTSpanX += aSpace;
- }
-
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aTSpanX.GetString() );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y(), mbDoublePoints ) );
-
- {
- try
- {
- try
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTSpan, sal_True, sal_True );
- mrExport.GetDocHandler()->characters( NMSP_RTL::OUString( UniString( aText ) ) );
- }
- catch( ::com::sun::star::xml::sax::SAXException& )
- {
- // string seems to contain invalid characters
- }
- }
- }
- }
- else
-#endif
- {
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X(), mbDoublePoints ) );
- mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y(), mbDoublePoints ) );
-
- try
- {
- SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_True );
- mrExport.GetDocHandler()->characters( NMSP_RTL::OUString( UniString( aText ) ) );
- }
- catch( ::com::sun::star::xml::sax::SAXException& )
- {
- // string seems to contain invalid characters
- }
- }
-
-#ifndef _SVG_USE_NATIVE_TEXTDECORATION
-
- // write strikeout if neccessary
- if( ( rFont.GetStrikeout() != STRIKEOUT_NONE ) || ( rFont.GetUnderline() != UNDERLINE_NONE ) )
- {
- Polygon aPoly( 4 );
- const long nLineHeight = Max( (long) FRound( aMetric.GetLineHeight() * 0.05 ), (long) 1 );
-
- if( rFont.GetStrikeout() )
- {
- const long nYLinePos = aBaseLinePos.Y() - FRound( aMetric.GetAscent() * 0.26 );
-
- aPoly[ 0 ].X() = aBaseLinePos.X(); aPoly[ 0 ].Y() = nYLinePos - ( nLineHeight >> 1 );
- aPoly[ 1 ].X() = aBaseLinePos.X() + aNormSize.Width() - 1; aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
- aPoly[ 2 ].X() = aPoly[ 1 ].X(); aPoly[ 2 ].Y() = aPoly[ 0 ].Y() + nLineHeight - 1;
- aPoly[ 3 ].X() = aPoly[ 0 ].X(); aPoly[ 3 ].Y() = aPoly[ 2 ].Y();
-
- ImplWritePolygon( aPoly, sal_False );
- }
-
- if( rFont.GetUnderline() )
- {
- const long nYLinePos = aBaseLinePos.Y() + ( nLineHeight << 1 );
-
- aPoly[ 0 ].X() = aBaseLinePos.X(); aPoly[ 0 ].Y() = nYLinePos - ( nLineHeight >> 1 );
- aPoly[ 1 ].X() = aBaseLinePos.X() + aNormSize.Width() - 1; aPoly[ 1 ].Y() = aPoly[ 0 ].Y();
- aPoly[ 2 ].X() = aPoly[ 1 ].X(); aPoly[ 2 ].Y() = aPoly[ 0 ].Y() + nLineHeight - 1;
- aPoly[ 3 ].X() = aPoly[ 0 ].X(); aPoly[ 3 ].Y() = aPoly[ 2 ].Y();
-
- ImplWritePolygon( aPoly, sal_False );
- }
- }
-
-#endif // _SVG_USE_NATIVE_TEXTDECORATION
-
- delete[] pOwnArray;
- delete pTransform;
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
- const Point& rPt, const Size& rSz,
- const Point& rSrcPt, const Size& rSrcSz,
- const NMSP_RTL::OUString* /*pStyle*/ )
-{
- if( !!rBmpEx )
- {
- BitmapEx aBmpEx( rBmpEx );
- Point aPoint = Point();
- const Rectangle aBmpRect( aPoint, rBmpEx.GetSizePixel() );
- const Rectangle aSrcRect( rSrcPt, rSrcSz );
-
- if( aSrcRect != aBmpRect )
- aBmpEx.Crop( aSrcRect );
-
- if( !!aBmpEx )
- {
- SvMemoryStream aOStm( 65535, 65535 );
-
- if( GraphicConverter::Export( aOStm, rBmpEx, CVT_PNG ) == ERRCODE_NONE )
- {
- const Point aPt( ImplMap( rPt ) );
- const Size aSz( ImplMap( rSz ) );
- FastString aImageData( (sal_Char*) aOStm.GetData(), aOStm.Tell() );
- REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( mrExport.GetDocHandler(), NMSP_UNO::UNO_QUERY );
-
- if( xExtDocHandler.is() )
- {
- static const sal_uInt32 nPartLen = 64;
- const NMSP_RTL::OUString aSpace( ' ' );
- const NMSP_RTL::OUString aLineFeed( NMSP_RTL::OUString::valueOf( (sal_Unicode) 0x0a ) );
- NMSP_RTL::OUString aString;
- NMSP_RTL::OUString aImageString;
-
- aString = aLineFeed;
- aString += B2UCONST( "<" );
- aString += NMSP_RTL::OUString::createFromAscii( aXMLElemImage );
- aString += aSpace;
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrX );
- aString += B2UCONST( "=\"" );
- aString += GetValueString( aPt.X(), mbDoublePoints );
- aString += B2UCONST( "\" " );
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrY );
- aString += B2UCONST( "=\"" );
- aString += GetValueString( aPt.Y(), mbDoublePoints );
- aString += B2UCONST( "\" " );
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrWidth );
- aString += B2UCONST( "=\"" );
- aString += GetValueString( aSz.Width(), mbDoublePoints );
- aString += B2UCONST( "\" " );
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrHeight );
- aString += B2UCONST( "=\"" );
- aString += GetValueString( aSz.Height(), mbDoublePoints );
- aString += B2UCONST( "\" " );
-
- aString += NMSP_RTL::OUString::createFromAscii( aXMLAttrXLinkHRef );
- aString += B2UCONST( "=\"data:image/png;base64," );
-
- if( aImageData.GetFirstPartString( nPartLen, aImageString ) )
- {
- xExtDocHandler->unknown( aString += aImageString );
-
- while( aImageData.GetNextPartString( nPartLen, aImageString ) )
- {
- xExtDocHandler->unknown( aLineFeed );
- xExtDocHandler->unknown( aImageString );
- }
- }
-
- xExtDocHandler->unknown( B2UCONST( "\"/>" ) );
- }
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, const NMSP_RTL::OUString* pStyle )
-{
- ImplAcquireContext();
-
- for( sal_uLong i = 0, nCount = rMtf.GetActionCount(); i < nCount; i++ )
- {
- const MetaAction* pAction = rMtf.GetAction( i );
- const sal_uInt16 nType = pAction->GetType();
-
- switch( nType )
- {
- case( META_PIXEL_ACTION ):
- {
- const MetaPixelAction* pA = (const MetaPixelAction*) pAction;
-
- mpContext->SetPaintAttr( pA->GetColor(), pA->GetColor() );
- ImplWriteLine( pA->GetPoint(), pA->GetPoint(), &pA->GetColor(), pStyle );
- }
- break;
-
- case( META_POINT_ACTION ):
- {
- const MetaPointAction* pA = (const MetaPointAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
- ImplWriteLine( pA->GetPoint(), pA->GetPoint(), NULL, pStyle );
- }
- break;
-
- case( META_LINE_ACTION ):
- {
- const MetaLineAction* pA = (const MetaLineAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetLineColor() );
- ImplWriteLine( pA->GetStartPoint(), pA->GetEndPoint(), NULL, pStyle );
- }
- break;
-
- case( META_RECT_ACTION ):
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteRect( ( (const MetaRectAction*) pAction )->GetRect(), 0, 0, pStyle );
- }
- break;
-
- case( META_ROUNDRECT_ACTION ):
- {
- const MetaRoundRectAction* pA = (const MetaRoundRectAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteRect( pA->GetRect(), pA->GetHorzRound(), pA->GetVertRound(), pStyle );
- }
- break;
-
- case( META_ELLIPSE_ACTION ):
- {
- const MetaEllipseAction* pA = (const MetaEllipseAction*) pAction;
- const Rectangle& rRect = pA->GetRect();
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteEllipse( rRect.Center(), rRect.GetWidth() >> 1, rRect.GetHeight() >> 1, pStyle );
- }
- break;
-
- case( META_ARC_ACTION ):
- case( META_PIE_ACTION ):
- case( META_CHORD_ACTION ):
- case( META_POLYGON_ACTION ):
- {
- Polygon aPoly;
-
- switch( nType )
- {
- case( META_ARC_ACTION ):
- {
- const MetaArcAction* pA = (const MetaArcAction*) pAction;
- aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_ARC );
- }
- break;
-
- case( META_PIE_ACTION ):
- {
- const MetaPieAction* pA = (const MetaPieAction*) pAction;
- aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_PIE );
- }
- break;
-
- case( META_CHORD_ACTION ):
- {
- const MetaChordAction* pA = (const MetaChordAction*) pAction;
- aPoly = Polygon( pA->GetRect(), pA->GetStartPoint(), pA->GetEndPoint(), POLY_CHORD );
- }
- break;
-
- case( META_POLYGON_ACTION ):
- aPoly = ( (const MetaPolygonAction*) pAction )->GetPolygon();
- break;
- }
-
- if( aPoly.GetSize() )
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolygon( aPoly, sal_False, pStyle );
- }
- }
- break;
-
- case( META_POLYLINE_ACTION ):
- {
- const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
- const Polygon& rPoly = pA->GetPolygon();
-
- if( rPoly.GetSize() )
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolygon( rPoly, sal_True, pStyle );
- }
- }
- break;
-
- case( META_POLYPOLYGON_ACTION ):
- {
- const MetaPolyPolygonAction* pA = (const MetaPolyPolygonAction*) pAction;
- const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
-
- if( rPolyPoly.Count() )
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolyPolygon( rPolyPoly, sal_False, pStyle );
- }
- }
- break;
-
- case( META_GRADIENT_ACTION ):
- {
- const MetaGradientAction* pA = (const MetaGradientAction*) pAction;
- GDIMetaFile aTmpMtf;
-
- mpVDev->AddGradientActions( pA->GetRect(), pA->GetGradient(), aTmpMtf );
- ImplWriteActions( aTmpMtf, pStyle );
- }
- break;
-
- case( META_GRADIENTEX_ACTION ):
- {
- const MetaGradientExAction* pA = (const MetaGradientExAction*) pAction;
- ImplWriteGradientEx( pA->GetPolyPolygon(), pA->GetGradient(), pStyle );
- }
- break;
-
- case META_HATCH_ACTION:
- {
- const MetaHatchAction* pA = (const MetaHatchAction*) pAction;
- GDIMetaFile aTmpMtf;
-
- mpVDev->AddHatchActions( pA->GetPolyPolygon(), pA->GetHatch(), aTmpMtf );
- ImplWriteActions( aTmpMtf, pStyle );
- }
- break;
-
- case( META_TRANSPARENT_ACTION ):
- {
- const MetaTransparentAction* pA = (const MetaTransparentAction*) pAction;
- const PolyPolygon& rPolyPoly = pA->GetPolyPolygon();
-
- if( rPolyPoly.Count() )
- {
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWritePolyPolygon( rPolyPoly, sal_False, pStyle );
- }
- }
- break;
-
- case( META_FLOATTRANSPARENT_ACTION ):
- {
- const MetaFloatTransparentAction* pA = (const MetaFloatTransparentAction*) pAction;
- GDIMetaFile aTmpMtf( pA->GetGDIMetaFile() );
- Point aSrcPt( aTmpMtf.GetPrefMapMode().GetOrigin() );
- const Size aSrcSize( aTmpMtf.GetPrefSize() );
- const Point aDestPt( pA->GetPoint() );
- const Size aDestSize( pA->GetSize() );
- const double fScaleX = aSrcSize.Width() ? (double) aDestSize.Width() / aSrcSize.Width() : 1.0;
- const double fScaleY = aSrcSize.Height() ? (double) aDestSize.Height() / aSrcSize.Height() : 1.0;
- long nMoveX, nMoveY;
-
- if( fScaleX != 1.0 || fScaleY != 1.0 )
- {
- aTmpMtf.Scale( fScaleX, fScaleY );
- aSrcPt.X() = FRound( aSrcPt.X() * fScaleX ), aSrcPt.Y() = FRound( aSrcPt.Y() * fScaleY );
- }
-
- nMoveX = aDestPt.X() - aSrcPt.X(), nMoveY = aDestPt.Y() - aSrcPt.Y();
-
- if( nMoveX || nMoveY )
- aTmpMtf.Move( nMoveX, nMoveY );
-
- mpVDev->Push();
- ImplWriteActions( aTmpMtf, pStyle );
- mpVDev->Pop();
- }
- break;
-
- case( META_EPS_ACTION ):
- {
- const MetaEPSAction* pA = (const MetaEPSAction*) pAction;
- const GDIMetaFile aGDIMetaFile( pA->GetSubstitute() );
- sal_Bool bFound = sal_False;
-
- for( sal_uLong j = 0, nCount2 = aGDIMetaFile.GetActionCount(); ( j < nCount2 ) && !bFound; j++ )
- {
- const MetaAction* pSubstAct = aGDIMetaFile.GetAction( j );
-
- if( pSubstAct->GetType() == META_BMPSCALE_ACTION )
- {
- bFound = sal_True;
- const MetaBmpScaleAction* pBmpScaleAction = (const MetaBmpScaleAction*) pSubstAct;
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pBmpScaleAction->GetBitmap(),
- pA->GetPoint(), pA->GetSize(),
- Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), pStyle );
- }
- }
- }
- break;
-
- case( META_COMMENT_ACTION ):
- {
- const MetaCommentAction* pA = (const MetaCommentAction*) pAction;
- String aSkipComment;
-
- if( pA->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_BEGIN" ) == COMPARE_EQUAL )
- {
- const MetaGradientExAction* pGradAction = NULL;
- sal_Bool bDone = sal_False;
-
- while( !bDone && ( ++i < nCount ) )
- {
- pAction = rMtf.GetAction( i );
-
- if( pAction->GetType() == META_GRADIENTEX_ACTION )
- pGradAction = (const MetaGradientExAction*) pAction;
- else if( ( pAction->GetType() == META_COMMENT_ACTION ) &&
- ( ( (const MetaCommentAction*) pAction )->GetComment().CompareIgnoreCaseToAscii( "XGRAD_SEQ_END" ) == COMPARE_EQUAL ) )
- {
- bDone = sal_True;
- }
- }
-
- if( pGradAction )
- ImplWriteGradientEx( pGradAction->GetPolyPolygon(), pGradAction->GetGradient(), pStyle );
- }
- }
- break;
-
- case( META_BMP_ACTION ):
- {
- const MetaBmpAction* pA = (const MetaBmpAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmap(),
- pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel() ),
- Point(), pA->GetBitmap().GetSizePixel(), pStyle );
- }
- break;
-
- case( META_BMPSCALE_ACTION ):
- {
- const MetaBmpScaleAction* pA = (const MetaBmpScaleAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmap(),
- pA->GetPoint(), pA->GetSize(),
- Point(), pA->GetBitmap().GetSizePixel(), pStyle );
- }
- break;
-
- case( META_BMPSCALEPART_ACTION ):
- {
- const MetaBmpScalePartAction* pA = (const MetaBmpScalePartAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmap(),
- pA->GetDestPoint(), pA->GetDestSize(),
- pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
- }
- break;
-
- case( META_BMPEX_ACTION ):
- {
- const MetaBmpExAction* pA = (const MetaBmpExAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmapEx(),
- pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmapEx().GetSizePixel() ),
- Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
- }
- break;
-
- case( META_BMPEXSCALE_ACTION ):
- {
- const MetaBmpExScaleAction* pA = (const MetaBmpExScaleAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmapEx(),
- pA->GetPoint(), pA->GetSize(),
- Point(), pA->GetBitmapEx().GetSizePixel(), pStyle );
- }
- break;
-
- case( META_BMPEXSCALEPART_ACTION ):
- {
- const MetaBmpExScalePartAction* pA = (const MetaBmpExScalePartAction*) pAction;
-
- mpContext->SetPaintAttr( mpVDev->GetLineColor(), mpVDev->GetFillColor() );
- ImplWriteBmp( pA->GetBitmapEx(),
- pA->GetDestPoint(), pA->GetDestSize(),
- pA->GetSrcPoint(), pA->GetSrcSize(), pStyle );
- }
- break;
-
- case( META_TEXT_ACTION ):
- {
- const MetaTextAction* pA = (const MetaTextAction*) pAction;
-
- mpContext->SetFontAttr( mpVDev->GetFont() );
- mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
- ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, 0, pStyle );
- }
- break;
-
- case( META_TEXTRECT_ACTION ):
- {
- const MetaTextRectAction* pA = (const MetaTextRectAction*) pAction;
-
- mpContext->SetFontAttr( mpVDev->GetFont() );
- mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
- ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0, pStyle );
- }
- break;
-
- case( META_TEXTARRAY_ACTION ):
- {
- const MetaTextArrayAction* pA = (const MetaTextArrayAction*) pAction;
- const Point aPos( ImplMap( pA->GetPoint() ) );
-
- mpContext->SetFontAttr( mpVDev->GetFont() );
- mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
- ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), pA->GetDXArray(), 0, pStyle );
- }
- break;
-
- case( META_STRETCHTEXT_ACTION ):
- {
- const MetaStretchTextAction* pA = (const MetaStretchTextAction*) pAction;
-
- mpContext->SetFontAttr( mpVDev->GetFont() );
- mpContext->SetPaintAttr( COL_TRANSPARENT, mpVDev->GetFont().GetColor() );
- ImplWriteText( pA->GetPoint(), String( pA->GetText(), pA->GetIndex(), pA->GetLen() ), NULL, pA->GetWidth(), pStyle );
- }
- break;
-
- case( META_CLIPREGION_ACTION ):
- case( META_ISECTRECTCLIPREGION_ACTION ):
- case( META_ISECTREGIONCLIPREGION_ACTION ):
- case( META_MOVECLIPREGION_ACTION ):
- {
- ( (MetaAction*) pAction )->Execute( mpVDev );
- mbClipAttrChanged = sal_True;
- }
- break;
-
- case( META_REFPOINT_ACTION ):
- case( META_MAPMODE_ACTION ):
- case( META_LINECOLOR_ACTION ):
- case( META_FILLCOLOR_ACTION ):
- case( META_TEXTLINECOLOR_ACTION ):
- case( META_TEXTFILLCOLOR_ACTION ):
- case( META_TEXTCOLOR_ACTION ):
- case( META_TEXTALIGN_ACTION ):
- case( META_FONT_ACTION ):
- case( META_PUSH_ACTION ):
- case( META_POP_ACTION ):
- {
- ( (MetaAction*) pAction )->Execute( mpVDev );
- }
- break;
-
- case( META_RASTEROP_ACTION ):
- case( META_MASK_ACTION ):
- case( META_MASKSCALE_ACTION ):
- case( META_MASKSCALEPART_ACTION ):
- case( META_WALLPAPER_ACTION ):
- case( META_TEXTLINE_ACTION ):
- case( META_LAYOUTMODE_ACTION ):
- {
- // !!! >>> we don't want to support these actions
- }
- break;
-
-#ifdef DBG_UTIL
- default :
- ByteString aDbgOut( "SVGActionWriter::ImplWriteActions: unsupported MetaAction #" );
- aDbgOut.Append( ByteString::CreateFromInt32( nType ) );
- OSL_FAIL( aDbgOut.GetBuffer() );
- break;
-#endif
- }
- }
-
- ImplReleaseContext();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgaction.hxx b/extensions/source/svg/svgaction.hxx
deleted file mode 100644
index 309d20aec6b4..000000000000
--- a/extensions/source/svg/svgaction.hxx
+++ /dev/null
@@ -1,167 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _SVGACTION_HXX
-#define _SVGACTION_HXX
-
-#include "svgcom.hxx"
-
-// --------------
-// - FastString -
-// --------------
-
-class FastString
-{
-private:
-
- NMSP_RTL::OUString maString;
- sal_Unicode* mpBuffer;
- sal_uInt32 mnBufLen;
- sal_uInt32 mnCurLen;
- sal_uInt32 mnBufInc;
- sal_uInt32 mnPartPos;
-
-public:
-
- FastString( sal_uInt32 nInitLen = 2048, sal_uInt32 nIncrement = 2048 );
- FastString( sal_Char* pBufferForBase64Encoding, sal_uInt32 nBufLen );
- ~FastString();
-
- FastString& operator+=( const NMSP_RTL::OUString& rStr );
-
- const NMSP_RTL::OUString& GetString() const;
- sal_Bool GetFirstPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString );
- sal_Bool GetNextPartString( const sal_uInt32 nPartLen, NMSP_RTL::OUString& rPartString );
-
- sal_uInt32 GetLength() const { return mnCurLen; }
- void Clear() { mnCurLen = 0, maString = NMSP_RTL::OUString(); }
-};
-
-// ----------------------
-// - SVGAttributeWriter -
-// ----------------------
-
-class SVGActionWriter;
-
-class SVGAttributeWriter
-{
-private:
-
- Font maCurFont;
- Color maCurLineColor;
- Color maCurFillColor;
- SVGActionWriter& mrParent;
- SvXMLExport& mrExport;
- SvXMLElementExport* mpElemFont;
- SvXMLElementExport* mpElemPaint;
-
- SVGAttributeWriter();
-
-public:
-
- SVGAttributeWriter( SVGActionWriter& rParent, SvXMLExport& rExport );
- virtual ~SVGAttributeWriter();
-
- NMSP_RTL::OUString GetFontStyle( const Font& rFont );
- NMSP_RTL::OUString GetPaintStyle( const Color& rLineColor, const Color& rFillColor );
-
- void SetFontAttr( const Font& rFont );
- void SetPaintAttr( const Color& rLineColor, const Color& rFillColor );
-};
-
-// -------------------
-// - SVGActionWriter -
-// -------------------
-
-class SVGAttributeWriter;
-class SvXMLExport;
-class GDIMetaFile;
-
-class SVGActionWriter
-{
- friend class SVGAttributeWriter;
-
-private:
-
- Stack maContextStack;
- SvXMLExport& mrExport;
- const GDIMetaFile& mrMtf;
- SVGAttributeWriter* mpContext;
- VirtualDevice* mpVDev;
- MapMode maTargetMapMode;
- sal_Int32 mnCurClipId;
- sal_Bool mbDestroyVDev;
- sal_Bool mbPaintAttrChanged;
- sal_Bool mbFontAttrChanged;
- sal_Bool mbClipAttrChanged;
- sal_Bool mbDoublePoints;
-
- SVGAttributeWriter* ImplAcquireContext() { maContextStack.Push( mpContext = new SVGAttributeWriter( *this, mrExport ) ); return mpContext; }
- void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); }
-
- long ImplMap( sal_Int32 nVal ) const;
- Point ImplMap( const Point& rPt ) const;
- Size ImplMap( const Size& rSz ) const;
- inline Rectangle ImplMap( const Rectangle& rRect ) const { return Rectangle( ImplMap( rRect.TopLeft() ), ImplMap( rRect.GetSize() ) ); }
-
- void ImplWriteLine( const Point& rPt1, const Point& rPt2, const Color* pLineColor = NULL, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteRect( const Rectangle& rRect, long nRadX = 0, long nRadY = 0, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteEllipse( const Point& rCenter, long nRadX, long nRadY, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWritePolygon( const Polygon& rPoly, sal_Bool bLineOnly, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWritePolyPolygon( const PolyPolygon& rPolyPoly, sal_Bool bLineOnly, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteGradientEx( const PolyPolygon& rPolyPoly, const Gradient& rGradient, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, const NMSP_RTL::OUString* pStyle = NULL );
- void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, const NMSP_RTL::OUString* pStyle = NULL );
-
- void ImplCheckFontAttributes();
- void ImplCheckPaintAttributes();
-
- void ImplWriteActions( const GDIMetaFile& rMtf, const NMSP_RTL::OUString* pStyle = NULL );
-
- sal_Int32 ImplGetNextClipId() { return mnCurClipId++; }
-
- SVGActionWriter();
-
-public:
-
- static NMSP_RTL::OUString GetValueString( sal_Int32 nVal, sal_Bool bDoublePoints );
-
-public:
-
- SVGActionWriter( SvXMLExport& rExport, const GDIMetaFile& rMtf,
- VirtualDevice* pParentVDev = NULL,
- sal_Bool bWriteDoublePoints = sal_False );
- virtual ~SVGActionWriter();
-
- const VirtualDevice& GetVDev() const { return *mpVDev; }
- sal_Bool HasDoublePoints() const { return mbDoublePoints; }
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgcom.hxx b/extensions/source/svg/svgcom.hxx
deleted file mode 100644
index b43beeb611e9..000000000000
--- a/extensions/source/svg/svgcom.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _SVGCOM_HXX
-#define _SVGCOM_HXX
-
-#include <cppuhelper/weak.hxx>
-#include <rtl/ustring.hxx>
-#include <tools/debug.hxx>
-#include <tools/stream.hxx>
-#include <tools/string.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/stack.hxx>
-#include <vcl/salbtype.hxx>
-#include <vcl/gdimtf.hxx>
-#include <vcl/metaact.hxx>
-
-#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/svg/XSVGWriter.hpp>
-#include <com/sun/star/svg/XSVGPrinter.hpp>
-#include <xmloff/xmlexp.hxx>
-#include <xmloff/nmspmap.hxx>
-
-// -----------------------------------------------------------------------------
-
-#define NMSP_CPPU cppu
-#define NMSP_RTL rtl
-#define NMSP_UNO com::sun::star::uno
-#define NMSP_LANG com::sun::star::lang
-#define NMSP_SAX com::sun::star::xml::sax
-#define NMSP_SVG com::sun::star::svg
-#define NMSP_REGISTRY com::sun::star::registry
-
-
-#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj >
-#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj >
-#define ANY NMSP_UNO::Any
-#define B2UCONST( _def_pChar ) (NMSP_RTL::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
-#define SVG_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" )
-
-#endif // _SYNCCOM_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgprinter.cxx b/extensions/source/svg/svgprinter.cxx
deleted file mode 100644
index 288f5bac5d22..000000000000
--- a/extensions/source/svg/svgprinter.cxx
+++ /dev/null
@@ -1,331 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_extensions.hxx"
-
-#define _RMPRINTER_EXT
-
-#include "svgprinter.hxx"
-#include "svgaction.hxx"
-#include <uno/mapping.hxx>
-#include <vcl/print.hxx>
-#include <vcl/virdev.hxx>
-
-static const char aXMLElemSVG[] = "svg";
-static const char aXMLElemMetaSVG[] = "staroffice:svgElementMeta";
-static const char aXMLElemDesc[] = "desc";
-static const char aXMLElemMeta[] = "metadata";
-static const char aXMLElemRect[] = "rect";
-
-static const char aXMLAttrMetaSVGOuter[] = "isOuterElement";
-static const char aXMLAttrMetaSVGPage[] = "isPageElement";
-static const char aXMLAttrViewBox[] = "viewBox";
-static const char aXMLAttrX[] = "x";
-static const char aXMLAttrY[] = "y";
-static const char aXMLAttrWidth[] = "width";
-static const char aXMLAttrHeight[] = "height";
-
-// ----------------
-// - SVGMtfExport -
-// ----------------
-
-class SVGPrinterExport : public SvXMLExport
-{
-private:
-
- Printer maPrinter;
- VirtualDevice* mpVDev;
- SvXMLElementExport* mpOuterElement;
- sal_uInt32 mnPage;
-
- SVGPrinterExport();
-
- SvXMLElementExport* ImplCreateSVGElement( const JobSetup& rSetup, Size& rOutputSize );
- void ImplWriteMetaAttr( sal_Bool bOuter, sal_Bool bPage );
-
-protected:
-
- virtual void _ExportMeta() {}
- virtual void _ExportStyles( sal_Bool /*bUsed*/ ) {}
- virtual void _ExportAutoStyles() {}
- virtual void _ExportContent() {}
- virtual void _ExportMasterStyles() {}
- virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) { (void)eClass; return 0; }
-
-public:
-
- // #110680#
- SVGPrinterExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
- const JobSetup& rSetup,
- const NMSP_RTL::OUString& rJobName,
- sal_uInt32 nCopies,
- sal_Bool bCollate );
-
- virtual ~SVGPrinterExport();
-
- virtual void writePage( const JobSetup& rJobSetup, const GDIMetaFile& rMtf );
-};
-
-// -----------------------------------------------------------------------------
-
-// #110680#
-SVGPrinterExport::SVGPrinterExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
- const JobSetup& rSetup,
- const NMSP_RTL::OUString& rJobName,
- sal_uInt32 /*nCopies*/,
- sal_Bool /*bCollate*/ )
-: SvXMLExport( xServiceFactory, NMSP_RTL::OUString(), rxHandler ),
- mpVDev( NULL ),
- mnPage( 0 )
-{
- maPrinter.SetJobSetup( rSetup );
-
- GetDocHandler()->startDocument();
-
- REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( GetDocHandler(), NMSP_UNO::UNO_QUERY );
-
- if( xExtDocHandler.is() )
- {
- NMSP_RTL::OUString aString;
- const NMSP_RTL::OUString aLineFeed( NMSP_RTL::OUString::valueOf( (sal_Unicode) 0x0a ) );
-
- // intro
- xExtDocHandler->unknown( ( aString = SVG_DTD_STRING ) += aLineFeed );
- xExtDocHandler->unknown( ( aString = B2UCONST( "<!ELEMENT metadata (#PCDATA | staroffice:svgElementMeta)*> " ) += aLineFeed ) );
- xExtDocHandler->unknown( ( aString = B2UCONST( "<!ELEMENT staroffice:svgElementMeta ANY> " ) += aLineFeed ) );
- xExtDocHandler->unknown( ( aString = B2UCONST( "<!ATTLIST staroffice:svgElementMeta " ) += aLineFeed ) );
-
- // ATTLIST
- xExtDocHandler->unknown( ( aString = B2UCONST( "isOuterElement (true | false) \"false\" " ) += aLineFeed ) );
- xExtDocHandler->unknown( ( aString = B2UCONST( "isPageElement (true | false) \"true\"" ) += aLineFeed ) );
-
- // end of intro
- xExtDocHandler->unknown( ( aString = B2UCONST( ">" ) += aLineFeed ) );
- xExtDocHandler->unknown( ( aString = B2UCONST( "]>" ) ) );
- }
-
- // create outer element
- Size aOutputSize;
-
- mpOuterElement = ImplCreateSVGElement( rSetup, aOutputSize );
-
- // write description
- SvXMLElementExport* pDescElem = new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemDesc, sal_True, sal_True );
- NMSP_RTL::OUString aDesc( B2UCONST( "document name: " ) );
-
- GetDocHandler()->characters( aDesc += rJobName );
- delete pDescElem;
-
- // write meta attributes
- ImplWriteMetaAttr( sal_True, sal_False );
-}
-
-// -----------------------------------------------------------------------------
-
-SVGPrinterExport::~SVGPrinterExport()
-{
- delete mpOuterElement;
- GetDocHandler()->endDocument();
- delete mpVDev;
-}
-
-// -----------------------------------------------------------------------------
-
-SvXMLElementExport* SVGPrinterExport::ImplCreateSVGElement( const JobSetup& rSetup, Size& rOutputSize )
-{
- NMSP_RTL::OUString aAttr;
-
- delete mpVDev;
- mpVDev = new VirtualDevice;
- mpVDev->EnableOutput( sal_False );
- mpVDev->SetMapMode( MAP_100TH_MM );
- maPrinter.SetJobSetup( rSetup );
-
- rOutputSize = maPrinter.PixelToLogic( maPrinter.GetOutputSizePixel(), mpVDev->GetMapMode() );
-
- aAttr = SVGActionWriter::GetValueString( rOutputSize.Width(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, aAttr );
-
- aAttr = SVGActionWriter::GetValueString( rOutputSize.Height(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, aAttr );
-
- aAttr = B2UCONST( "0.0 0.0 " );
- aAttr += SVGActionWriter::GetValueString( rOutputSize.Width(), sal_True );
- aAttr += B2UCONST( " " );
- aAttr += SVGActionWriter::GetValueString( rOutputSize.Height(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrViewBox, aAttr );
-
- return( new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemSVG, sal_True, sal_True ) );
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGPrinterExport::ImplWriteMetaAttr( sal_Bool bOuter, sal_Bool bPage )
-{
- SvXMLElementExport aMetaData( *this, XML_NAMESPACE_NONE, aXMLElemMeta, sal_True, sal_True );
- NMSP_RTL::OUString aAttr;
-
- aAttr = bOuter ? B2UCONST( "true" ) : B2UCONST( "false" );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrMetaSVGOuter, aAttr );
-
- aAttr = bPage ? B2UCONST( "true" ) : B2UCONST( "false" );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrMetaSVGPage, aAttr );
-
- {
- delete( new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemMetaSVG, sal_True, sal_True ) );
- }
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGPrinterExport::writePage( const JobSetup& rSetup, const GDIMetaFile& rMtf )
-{
- Size aOutputSize;
- NMSP_RTL::OUString aAttr;
- SvXMLElementExport* pPageElem = ImplCreateSVGElement( rSetup, aOutputSize );
-
- // write description
- SvXMLElementExport* pDescElem = new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemDesc, sal_True, sal_True );
- NMSP_RTL::OUString aDesc( B2UCONST( "page: " ) );
-
- GetDocHandler()->characters( aDesc += NMSP_RTL::OUString::valueOf( (sal_Int32) ++mnPage ) );
- delete pDescElem;
-
- // write meta attributes
- ImplWriteMetaAttr( sal_False, sal_True );
-
- // write dummy rect element
- aAttr = B2UCONST( "0.0" );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, aAttr );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, aAttr );
-
- aAttr = SVGActionWriter::GetValueString( aOutputSize.Width(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrWidth, aAttr );
-
- aAttr = SVGActionWriter::GetValueString( aOutputSize.Height(), sal_True );
- AddAttribute( XML_NAMESPACE_NONE, aXMLAttrHeight, aAttr );
-
- delete( new SvXMLElementExport( *this, XML_NAMESPACE_NONE, aXMLElemRect, sal_True, sal_True ) );
- delete( new SVGActionWriter( *this, rMtf, mpVDev, sal_True ) );
-
- delete pPageElem;
-}
-
-// --------------
-// - SVGPrinter -
-// --------------
-
-SVGPrinter::SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
- mxFact( rxMgr ),
- mpWriter( NULL )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-SVGPrinter::~SVGPrinter()
-{
- delete mpWriter;
-}
-
-// -----------------------------------------------------------------------------
-
-
-ANY SAL_CALL SVGPrinter::queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException )
-{
- const ANY aRet( NMSP_CPPU::queryInterface( rType, static_cast< NMSP_SVG::XSVGPrinter* >( this ) ) );
-
- return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGPrinter::acquire() throw()
-{
- OWeakObject::acquire();
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGPrinter::release() throw()
-{
- OWeakObject::release();
-}
-
-// -----------------------------------------------------------------------------
-
-sal_Bool SAL_CALL SVGPrinter::startJob( const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
- const SEQ( sal_Int8 )& rJobSetupSeq,
- const NMSP_RTL::OUString& rJobName,
- sal_uInt32 nCopies, sal_Bool bCollate ) throw( NMSP_UNO::RuntimeException )
-{
- const sal_Bool bRet = ( mpWriter == NULL );
-
- if( bRet )
- {
- SvMemoryStream aMemStm( (char*) rJobSetupSeq.getConstArray(), rJobSetupSeq.getLength(), STREAM_READ );
- JobSetup aJobSetup;
-
- aMemStm.SetCompressMode( COMPRESSMODE_FULL );
- aMemStm >> aJobSetup;
-
- const REF( NMSP_SAX::XDocumentHandler ) xDocumentHandler( rxHandler );
-
- // #110680#
- // mpWriter = new SVGPrinterExport( xDocumentHandler, aJobSetup, rJobName, nCopies, bCollate );
- mpWriter = new SVGPrinterExport( mxFact, xDocumentHandler, aJobSetup, rJobName, nCopies, bCollate );
- }
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGPrinter::printPage( const SEQ( sal_Int8 )& rPrintPage ) throw( NMSP_UNO::RuntimeException )
-{
- SvMemoryStream aMemStm( (char*) rPrintPage.getConstArray(), rPrintPage.getLength(), STREAM_READ );
- PrinterPage aPage;
-
- aMemStm.SetCompressMode( COMPRESSMODE_FULL );
- aMemStm >> aPage;
- mpWriter->writePage( aPage.GetJobSetup(), *aPage.GetGDIMetaFile() );
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGPrinter::endJob() throw( NMSP_UNO::RuntimeException )
-{
- delete mpWriter, mpWriter = NULL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgprinter.hxx b/extensions/source/svg/svgprinter.hxx
deleted file mode 100644
index bbc29a06b6f8..000000000000
--- a/extensions/source/svg/svgprinter.hxx
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _SVGPRINTER_HXX
-#define _SVGPRINTER_HXX
-
-#include "svgcom.hxx"
-
-// -------------
-// - SVGWriter -
-// -------------
-
-class SVGPrinterExport;
-
-class SVGPrinter : public NMSP_CPPU::OWeakObject, NMSP_SVG::XSVGPrinter
-{
-private:
-
- REF( NMSP_LANG::XMultiServiceFactory ) mxFact;
- SVGPrinterExport* mpWriter;
-
- SVGPrinter();
-
-public:
-
- SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
- virtual ~SVGPrinter();
-
- // XInterface
- virtual ANY SAL_CALL queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException );
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // XSVGPrinter
- virtual sal_Bool SAL_CALL startJob( const REF( NMSP_SAX::XDocumentHandler )& rxHandler,
- const SEQ( sal_Int8 )& rJobSetup,
- const NMSP_RTL::OUString& rJobName,
- sal_uInt32 nCopies, sal_Bool bCollate ) throw( NMSP_UNO::RuntimeException );
- virtual void SAL_CALL printPage( const SEQ( sal_Int8 )& rPrintPage ) throw( NMSP_UNO::RuntimeException );
- virtual void SAL_CALL endJob() throw( NMSP_UNO::RuntimeException );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svguno.cxx b/extensions/source/svg/svguno.cxx
deleted file mode 100644
index 7fb81d407452..000000000000
--- a/extensions/source/svg/svguno.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_extensions.hxx"
-
-#include "svgcom.hxx"
-#include "svgwriter.hxx"
-#include "svgprinter.hxx"
-
-#include <cppuhelper/factory.hxx>
-#include <uno/mapping.hxx>
-
-// -------------------
-// - factory methods -
-// -------------------
-
-static REF( NMSP_UNO::XInterface ) SAL_CALL create_SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
-{
- return REF( NMSP_UNO::XInterface )( *new SVGWriter( rxFact ) );
-}
-
-// -----------------------------------------------------------------------------
-
-static REF( NMSP_UNO::XInterface ) SAL_CALL create_SVGPrinter( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
-{
- return REF( NMSP_UNO::XInterface )( *new SVGPrinter( rxFact ) );
-}
-
-// ------------------------------------------
-// - component_getImplementationEnvironment -
-// ------------------------------------------
-
-extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-// ------------------------
-// - component_getFactory -
-// ------------------------
-
-extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /*pRegistryKey*/ )
-{
- REF( NMSP_LANG::XSingleServiceFactory ) xFactory;
- void* pRet = 0;
-
- if( rtl_str_compare( pImplName, "com.sun.star.comp.extensions.SVGWriter" ) == 0 )
- {
- const NMSP_RTL::OUString aServiceName( B2UCONST( "com.sun.star.svg.SVGWriter" ) );
-
- xFactory = REF( NMSP_LANG::XSingleServiceFactory )( NMSP_CPPU::createSingleFactory(
- reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
- B2UCONST( "com.sun.star.comp.extensions.SVGWriter" ),
- create_SVGWriter, SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
- }
- else if( rtl_str_compare( pImplName, "com.sun.star.comp.extensions.SVGPrinter" ) == 0 )
- {
- const NMSP_RTL::OUString aServiceName( B2UCONST( "com.sun.star.svg.SVGPrinter" ) );
-
- xFactory = REF( NMSP_LANG::XSingleServiceFactory )( NMSP_CPPU::createSingleFactory(
- reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
- B2UCONST( "com.sun.star.comp.extensions.SVGPrinter" ),
- create_SVGPrinter, SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
- }
-
- if( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/svg/svgwriter.cxx b/extensions/source/svg/svgwriter.cxx
deleted file mode 100644
index e89c69e4b4e1..000000000000
--- a/extensions/source/svg/svgwriter.cxx
+++ /dev/null
@@ -1,174 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_extensions.hxx"
-
-#include "svgwriter.hxx"
-#include "svgaction.hxx"
-#include <uno/mapping.hxx>
-
-// ----------------
-// - SVGMtfExport -
-// ----------------
-
-class SVGMtfExport : public SvXMLExport
-{
-private:
-
- SVGMtfExport();
-
-protected:
-
- virtual void _ExportMeta() {}
- virtual void _ExportStyles( sal_Bool /*bUsed*/ ) {}
- virtual void _ExportAutoStyles() {}
- virtual void _ExportContent() {}
- virtual void _ExportMasterStyles() {}
- virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /*eClass*/ ) { return 0; }
-
-public:
-
- SVGMtfExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const REF( NMSP_SAX::XDocumentHandler )& rxHandler );
-
- virtual ~SVGMtfExport();
-
- virtual void writeMtf( const GDIMetaFile& rMtf );
-};
-
-// -----------------------------------------------------------------------------
-
-SVGMtfExport::SVGMtfExport(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
- const REF( NMSP_SAX::XDocumentHandler )& rxHandler )
-: SvXMLExport( xServiceFactory, NMSP_RTL::OUString(), rxHandler )
-{
- GetDocHandler()->startDocument();
-}
-
-// -----------------------------------------------------------------------------
-
-SVGMtfExport::~SVGMtfExport()
-{
- GetDocHandler()->endDocument();
-}
-
-// -----------------------------------------------------------------------------
-
-void SVGMtfExport::writeMtf( const GDIMetaFile& rMtf )
-{
- const Size aSize( OutputDevice::LogicToLogic( rMtf.GetPrefSize(), rMtf.GetPrefMapMode(), MAP_MM ) );
- NMSP_RTL::OUString aAttr;
- REF( NMSP_SAX::XExtendedDocumentHandler ) xExtDocHandler( GetDocHandler(), NMSP_UNO::UNO_QUERY );
-
- if( xExtDocHandler.is() )
- xExtDocHandler->unknown( SVG_DTD_STRING );
-
- aAttr = NMSP_RTL::OUString::valueOf( aSize.Width() );
- aAttr += B2UCONST( "mm" );
- AddAttribute( XML_NAMESPACE_NONE, "width", aAttr );
-
- aAttr = NMSP_RTL::OUString::valueOf( aSize.Height() );
- aAttr += B2UCONST( "mm" );
- AddAttribute( XML_NAMESPACE_NONE, "height", aAttr );
-
- aAttr = B2UCONST( "0 0 " );
- aAttr += NMSP_RTL::OUString::valueOf( aSize.Width() * 100L );
- aAttr += B2UCONST( " " );
- aAttr += NMSP_RTL::OUString::valueOf( aSize.Height() * 100L );
- AddAttribute( XML_NAMESPACE_NONE, "viewBox", aAttr );
-
- {
- SvXMLElementExport aSVG( *this, XML_NAMESPACE_NONE, "svg", sal_True, sal_True );
- SVGActionWriter* pWriter = new SVGActionWriter( *this, rMtf );
-
- delete pWriter;
- }
-}
-
-// -------------
-// - SVGWriter -
-// -------------
-
-SVGWriter::SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
- mxFact( rxMgr )
-{
-}
-
-// -----------------------------------------------------------------------------
-
-SVGWriter::~SVGWriter()
-{
-}
-
-// -----------------------------------------------------------------------------
-
-
-ANY SAL_CALL SVGWriter::queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException )
-{
- const ANY aRet( NMSP_CPPU::queryInterface( rType, static_cast< NMSP_SVG::XSVGWriter* >( this ) ) );
-
- return( aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ) );
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGWriter::acquire() throw()
-{
- OWeakObject::acquire();
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGWriter::release() throw()
-{
- OWeakObject::release();
-}
-
-// -----------------------------------------------------------------------------
-
-void SAL_CALL SVGWriter::write( const REF( NMSP_SAX::XDocumentHandler )& rxDocHandler,
- const SEQ( sal_Int8 )& rMtfSeq ) throw( NMSP_UNO::RuntimeException )
-{
- SvMemoryStream aMemStm( (char*) rMtfSeq.getConstArray(), rMtfSeq.getLength(), STREAM_READ );
- GDIMetaFile aMtf;
-
- aMemStm.SetCompressMode( COMPRESSMODE_FULL );
- aMemStm >> aMtf;
-
- const REF( NMSP_SAX::XDocumentHandler ) xDocumentHandler( rxDocHandler );
-
- SVGMtfExport* pWriter = new SVGMtfExport( mxFact, xDocumentHandler );
-
- pWriter->writeMtf( aMtf );
- delete pWriter;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx
index 9bc330360e56..f98b6cb862cc 100644
--- a/forms/source/component/Columns.cxx
+++ b/forms/source/component/Columns.cxx
@@ -42,9 +42,11 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/form/binding/XBindableValue.hpp>
#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/text/XText.hpp>
#include <comphelper/sequence.hxx>
#include <comphelper/property.hxx>
#include <comphelper/basicio.hxx>
+#include <comphelper/types.hxx>
#include "services.hxx"
#include "frm_resource.hrc"
#include <tools/debug.hxx>
@@ -63,6 +65,7 @@ using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::text;
using namespace ::com::sun::star::form::binding;
const sal_uInt16 WIDTH = 0x0001;
@@ -173,6 +176,7 @@ Sequence<Type> SAL_CALL OGridColumn::getTypes() throw(RuntimeException)
aTypes.removeType( XServiceInfo::static_type() );
aTypes.removeType( XBindableValue::static_type() );
aTypes.removeType( XPropertyContainer::static_type() );
+
// but re-add their base class(es)
aTypes.addType( XChild::static_type() );
@@ -180,6 +184,10 @@ Sequence<Type> SAL_CALL OGridColumn::getTypes() throw(RuntimeException)
if ( query_aggregation( m_xAggregate, xProv ))
aTypes.addTypes( xProv->getTypes() );
+ aTypes.removeType( XTextRange::static_type() );
+ aTypes.removeType( XSimpleText::static_type() );
+ aTypes.removeType( XText::static_type() );
+
return aTypes.getTypes();
}
@@ -192,6 +200,7 @@ Any SAL_CALL OGridColumn::queryAggregation( const Type& _rType ) throw (RuntimeE
|| _rType.equals(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL)))
|| _rType.equals(::getCppuType(static_cast< Reference< XBindableValue >* >(NULL)))
|| _rType.equals(::getCppuType(static_cast< Reference< XPropertyContainer >* >(NULL)))
+ || comphelper::isAssignableFrom(::getCppuType(static_cast< Reference< XTextRange >* >(NULL)),_rType)
)
return aReturn;
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index a6a14e652f62..fbde5883ebcf 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -2904,7 +2904,7 @@ void ODatabaseForm::load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirs
// a database form always uses caching
// we use starting fetchsize with at least 10 rows
if (bConnected)
- m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)10));
+ m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)40));
// if we're loaded as sub form we got a "rowSetChanged" from the parent rowset _before_ we got the "loaded"
// so we don't need to execute the statement again, this was already done
diff --git a/forms/source/component/Edit.cxx b/forms/source/component/Edit.cxx
index d745a1b3837a..260acf5d97cb 100644
--- a/forms/source/component/Edit.cxx
+++ b/forms/source/component/Edit.cxx
@@ -675,7 +675,6 @@ sal_Bool OEditModel::approveDbColumnType( sal_Int32 _nColumnType )
void OEditModel::resetNoBroadcast()
{
OEditBaseModel::resetNoBroadcast();
- m_aLastKnownValue.clear();
}
//------------------------------------------------------------------------------
@@ -683,38 +682,34 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
{
Any aNewValue( m_xAggregateFastSet->getFastPropertyValue( getValuePropertyAggHandle() ) );
- if ( aNewValue != m_aLastKnownValue )
- {
- ::rtl::OUString sNewValue;
- aNewValue >>= sNewValue;
+ ::rtl::OUString sNewValue;
+ aNewValue >>= sNewValue;
- if ( !aNewValue.hasValue()
- || ( !sNewValue.getLength() // an empty string
- && m_bEmptyIsNull // which should be interpreted as NULL
- )
+ if ( !aNewValue.hasValue()
+ || ( !sNewValue.getLength() // an empty string
+ && m_bEmptyIsNull // which should be interpreted as NULL
)
+ )
+ {
+ m_xColumnUpdate->updateNull();
+ }
+ else
+ {
+ OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" );
+ try
{
- m_xColumnUpdate->updateNull();
- }
- else
- {
- OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::commitControlValueToDbColumn: no value formatter!" );
- try
+ if ( m_pValueFormatter.get() )
{
- if ( m_pValueFormatter.get() )
- {
- if ( !m_pValueFormatter->setFormattedValue( sNewValue ) )
- return sal_False;
- }
- else
- m_xColumnUpdate->updateString( sNewValue );
- }
- catch ( const Exception& )
- {
- return sal_False;
+ if ( !m_pValueFormatter->setFormattedValue( sNewValue ) )
+ return sal_False;
}
+ else
+ m_xColumnUpdate->updateString( sNewValue );
+ }
+ catch ( const Exception& )
+ {
+ return sal_False;
}
- m_aLastKnownValue = aNewValue;
}
return sal_True;
@@ -724,6 +719,7 @@ sal_Bool OEditModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
Any OEditModel::translateDbColumnToControlValue()
{
OSL_PRECOND( m_pValueFormatter.get(), "OEditModel::translateDbColumnToControlValue: no value formatter!" );
+ Any aRet;
if ( m_pValueFormatter.get() )
{
::rtl::OUString sValue( m_pValueFormatter->getFormattedValue() );
@@ -732,7 +728,6 @@ Any OEditModel::translateDbColumnToControlValue()
&& m_pValueFormatter->getColumn()->wasNull()
)
{
- m_aLastKnownValue.clear();
}
else
{
@@ -744,14 +739,11 @@ Any OEditModel::translateDbColumnToControlValue()
sValue = sValue.replaceAt( nMaxTextLen, nDiff, ::rtl::OUString() );
}
- m_aLastKnownValue <<= sValue;
+ aRet <<= sValue;
}
}
- else
- m_aLastKnownValue.clear();
- return m_aLastKnownValue.hasValue() ? m_aLastKnownValue : makeAny( ::rtl::OUString() );
- // (m_aLastKnownValue is alllowed to be VOID, the control value isn't)
+ return aRet.hasValue() ? aRet : makeAny( ::rtl::OUString() );
}
//------------------------------------------------------------------------------
diff --git a/forms/source/component/Edit.hxx b/forms/source/component/Edit.hxx
index e3c84612443f..bbe7063c66f1 100644
--- a/forms/source/component/Edit.hxx
+++ b/forms/source/component/Edit.hxx
@@ -45,7 +45,6 @@ namespace frm
class OEditModel
:public OEditBaseModel
{
- ::com::sun::star::uno::Any m_aLastKnownValue;
::std::auto_ptr< ::dbtools::FormattedColumnValue >
m_pValueFormatter;
sal_Bool m_bMaxTextLenModified : 1; // set to <TRUE/> when we change the MaxTextLen of the aggregate
diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx
index 69643053bed8..4decc560fa4b 100644
--- a/forms/source/component/Filter.cxx
+++ b/forms/source/component/Filter.cxx
@@ -631,19 +631,39 @@ namespace frm
if (xListBox.is())
{
m_aText = aText;
- xListBox->selectItem(m_aText, sal_True);
- if ( xListBox->getSelectedItemPos() >= 0 )
+ MapString2String::const_iterator itemPos = m_aDisplayItemToValueItem.find( m_aText );
+ if ( itemPos == m_aDisplayItemToValueItem.end() )
{
- const bool isQuoted = ( aText.getLength() > 0 )
- && ( aText[0] == '\'' )
- && ( aText[aText.getLength() - 1] == '\'' );
+ const bool isQuoted = ( m_aText.getLength() > 1 )
+ && ( m_aText[0] == '\'' )
+ && ( m_aText[ m_aText.getLength() - 1 ] == '\'' );
if ( isQuoted )
{
- xListBox->selectItem( aText.copy( 1, aText.getLength() - 2 ), sal_True );
+ m_aText = m_aText.copy( 1, m_aText.getLength() - 2 );
+ itemPos = m_aDisplayItemToValueItem.find( m_aText );
}
}
+
+ OSL_ENSURE( ( itemPos != m_aDisplayItemToValueItem.end() ) || ( m_aText.getLength() == 0 ),
+ "OFilterControl::setText: this text is not in my display list!" );
+ if ( itemPos == m_aDisplayItemToValueItem.end() )
+ m_aText = ::rtl::OUString();
+
+ if ( m_aText.getLength() == 0)
+ {
+ while ( xListBox->getSelectedItemPos() >= 0 )
+ {
+ xListBox->selectItemPos( xListBox->getSelectedItemPos(), sal_False );
+ }
+ }
+ else
+ {
+ xListBox->selectItem( m_aText, sal_True );
+ }
}
- } break;
+ }
+ break;
+
default:
{
Reference< XTextComponent > xText( getPeer(), UNO_QUERY );
diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx
index 871385c207a6..9d0170078da1 100644
--- a/forms/source/component/FormattedField.cxx
+++ b/forms/source/component/FormattedField.cxx
@@ -1038,10 +1038,10 @@ sal_Bool OFormattedModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
m_xColumnUpdate->updateNull();
else
{
- // als Value koennen nur double, string oder void auftreten
try
{
- if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE )
+ double f = 0.0;
+ if ( aControlValue.getValueType().getTypeClass() == TypeClass_DOUBLE || (aControlValue >>= f)) // #i110323
{
DBTypeConversion::setValue( m_xColumnUpdate, m_aNullDate, getDouble( aControlValue ), m_nKeyType );
}
diff --git a/package/inc/EncryptedDataHeader.hxx b/package/inc/EncryptedDataHeader.hxx
index ed0ffe6628e3..43487ac88ea0 100644
--- a/package/inc/EncryptedDataHeader.hxx
+++ b/package/inc/EncryptedDataHeader.hxx
@@ -32,22 +32,26 @@
/* The structure of this header is as follows:
- Header signature 4 bytes
- Version number 2 bytes
- Iteraction count 4 bytes
- Size 4 bytes
- Salt length 2 bytes
- IV length 2 bytes
- Digest length 2 bytes
- MediaType length 2 bytes
- Salt content X bytes
- IV content X bytes
- digest content X bytes
- MediaType X bytes
+ Header signature 4 bytes
+ Version number 2 bytes
+ Iteraction count 4 bytes
+ Size 4 bytes
+ EncAlgorithm 4 bytes
+ DigestAlgorithm 4 bytes
+ DerivedKeySize 4 bytes
+ StartKeyAlgorithm 4 bytes
+ Salt length 2 bytes
+ IV length 2 bytes
+ Digest length 2 bytes
+ MediaType length 2 bytes
+ Salt content X bytes
+ IV content X bytes
+ digest content X bytes
+ MediaType X bytes
*/
-const sal_uInt32 n_ConstHeader = 0x0502474dL; // "MG\002\005"
-const sal_Int32 n_ConstHeaderSize = 22; // + salt length + iv length + digest length + mediatype length
+const sal_uInt32 n_ConstHeader = 0x05024d4dL; // "MM\002\005"
+const sal_Int32 n_ConstHeaderSize = 38; // + salt length + iv length + digest length + mediatype length
const sal_Int16 n_ConstCurrentVersion = 1;
#endif
diff --git a/package/inc/EncryptionData.hxx b/package/inc/EncryptionData.hxx
index ab2a658208c9..283b0b94caea 100644
--- a/package/inc/EncryptionData.hxx
+++ b/package/inc/EncryptionData.hxx
@@ -31,16 +31,54 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <cppuhelper/weak.hxx>
-class EncryptionData : public cppu::OWeakObject
+class BaseEncryptionData : public cppu::OWeakObject
{
public:
- // On export aKey holds the derived key
- // On import aKey holds the hash of the user enterred key
- com::sun::star::uno::Sequence < sal_Int8 > aKey;
- com::sun::star::uno::Sequence < sal_uInt8 > aSalt, aInitVector, aDigest;
- sal_Int32 nIterationCount;
- EncryptionData(): nIterationCount ( 0 ){}
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aSalt;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aInitVector;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aDigest;
+ sal_Int32 m_nIterationCount;
+
+ BaseEncryptionData()
+ : m_nIterationCount ( 0 ){}
+
+ BaseEncryptionData( const BaseEncryptionData& aData )
+ : cppu::OWeakObject()
+ , m_aSalt( aData.m_aSalt )
+ , m_aInitVector( aData.m_aInitVector )
+ , m_aDigest( aData.m_aDigest )
+ , m_nIterationCount( aData.m_nIterationCount )
+ {}
};
+
+class EncryptionData : public BaseEncryptionData
+{
+public:
+ ::com::sun::star::uno::Sequence < sal_Int8 > m_aKey;
+ sal_Int32 m_nEncAlg;
+ sal_Int32 m_nCheckAlg;
+ sal_Int32 m_nDerivedKeySize;
+ sal_Int32 m_nStartKeyGenID;
+
+ EncryptionData( const BaseEncryptionData& aData, const ::com::sun::star::uno::Sequence< sal_Int8 >& aKey, sal_Int32 nEncAlg, sal_Int32 nCheckAlg, sal_Int32 nDerivedKeySize, sal_Int32 nStartKeyGenID )
+ : BaseEncryptionData( aData )
+ , m_aKey( aKey )
+ , m_nEncAlg( nEncAlg )
+ , m_nCheckAlg( nCheckAlg )
+ , m_nDerivedKeySize( nDerivedKeySize )
+ , m_nStartKeyGenID( nStartKeyGenID )
+ {}
+
+ EncryptionData( const EncryptionData& aData )
+ : BaseEncryptionData( aData )
+ , m_aKey( aData.m_aKey )
+ , m_nEncAlg( aData.m_nEncAlg )
+ , m_nCheckAlg( aData.m_nCheckAlg )
+ , m_nDerivedKeySize( aData.m_nDerivedKeySize )
+ , m_nStartKeyGenID( aData.m_nStartKeyGenID )
+ {}
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/inc/PackageConstants.hxx b/package/inc/PackageConstants.hxx
index 7dd4d78a4e9b..be82010175fc 100644
--- a/package/inc/PackageConstants.hxx
+++ b/package/inc/PackageConstants.hxx
@@ -32,21 +32,39 @@
const sal_Int32 n_ConstBufferSize = 32768;
const sal_Int32 n_ConstMaxMemoryStreamSize = 20480;
+
+// by calculation of the digest we read 32 bytes more ( if available )
+// it allows to ignore the padding if the stream is longer than n_ConstDigestDecrypt since we read at least two blocks more;
+// if the stream is shorter or equal the padding will be done successfully
const sal_Int32 n_ConstDigestLength = 1024;
+const sal_Int32 n_ConstDigestDecrypt = 1056; // 1024 + 32
// the constants related to the manifest.xml entries
-#define PKG_MNFST_MEDIATYPE 0
-#define PKG_MNFST_VERSION 1
-#define PKG_MNFST_FULLPATH 2
+#define PKG_MNFST_MEDIATYPE 0
+#define PKG_MNFST_VERSION 1
+#define PKG_MNFST_FULLPATH 2
-#define PKG_MNFST_INIVECTOR 3
-#define PKG_MNFST_SALT 4
-#define PKG_MNFST_ITERATION 5
-#define PKG_MNFST_UCOMPSIZE 6
-#define PKG_MNFST_DIGEST 7
+#define PKG_MNFST_INIVECTOR 3
+#define PKG_MNFST_SALT 4
+#define PKG_MNFST_ITERATION 5
+#define PKG_MNFST_UCOMPSIZE 6
+#define PKG_MNFST_DIGEST 7
+#define PKG_MNFST_ENCALG 8
+#define PKG_MNFST_STARTALG 9
+#define PKG_MNFST_DIGESTALG 10
+#define PKG_MNFST_DERKEYSIZE 11
#define PKG_SIZE_NOENCR_MNFST 3
-#define PKG_SIZE_ENCR_MNFST 8
+#define PKG_SIZE_ENCR_MNFST 12
+
+// the properties related constants
+#define ENCRYPTION_KEY_PROPERTY "EncryptionKey"
+#define STORAGE_ENCRYPTION_KEYS_PROPERTY "StorageEncryptionKeys"
+#define ENCRYPTION_ALGORITHMS_PROPERTY "EncryptionAlgorithms"
+#define HAS_ENCRYPTED_ENTRIES_PROPERTY "HasEncryptedEntries"
+#define HAS_NONENCRYPTED_ENTRIES_PROPERTY "HasNonEncryptedEntries"
+#define IS_INCONSISTENT_PROPERTY "IsInconsistent"
+#define MEDIATYPE_FALLBACK_USED_PROPERTY "MediaTypeFallbackUsed"
#endif
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index 8193eef68a5d..05186c0abccf 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -32,9 +32,13 @@
#include <com/sun/star/packages/zip/ZipIOException.hpp>
#include <com/sun/star/packages/NoEncryptionException.hpp>
#include <com/sun/star/packages/WrongPasswordException.hpp>
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
+
#include <ByteGrabber.hxx>
#include <HashMaps.hxx>
#include <Inflater.hxx>
+#include <EncryptionData.hxx>
#include <mutexholder.hxx>
@@ -46,6 +50,7 @@ namespace rtl
{
template < class T > class Reference;
}
+
/*
* We impose arbitrary but reasonable limit on ZIP files.
*/
@@ -54,9 +59,7 @@ namespace rtl
#define ZIP_MAXEXTRA 256
#define ZIP_MAXENTRIES (0x10000 - 2)
-typedef void* rtlCipher;
class ZipEnumeration;
-class EncryptionData;
class ZipFile
{
@@ -69,20 +72,20 @@ protected:
ZipUtils::Inflater aInflater;
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
com::sun::star::uno::Reference < com::sun::star::io::XSeekable > xSeek;
- const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xFactory;
+ const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
::com::sun::star::uno::Reference < ::com::sun::star::ucb::XProgressHandler > xProgressHandler;
sal_Bool bRecoveryMode;
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createMemoryStream(
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bRawStream,
sal_Bool bDecrypt );
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createFileStream(
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bRawStream,
sal_Bool bDecrypt );
@@ -90,7 +93,7 @@ protected:
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createUnbufferedStream(
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Int8 nStreamMode,
sal_Bool bDecrypt,
::rtl::OUString aMediaType = ::rtl::OUString() );
@@ -126,44 +129,59 @@ public:
void setInputStream ( com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewStream );
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bDecrypt,
SotMutexHolderRef aMutexHolder )
throw(::com::sun::star::io::IOException, ::com::sun::star::packages::zip::ZipException, ::com::sun::star::uno::RuntimeException);
- static sal_Bool StaticGetCipher ( const rtl::Reference < EncryptionData > & xEncryptionData, rtlCipher &rCipher, sal_Bool bDecode );
- static void StaticFillHeader ( const rtl::Reference < EncryptionData > & rData,
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > StaticGetDigestContextForChecksum(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xArgFactory,
+ const ::rtl::Reference< EncryptionData >& xEncryptionData );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > StaticGetCipher(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xArgFactory,
+ const ::rtl::Reference< EncryptionData >& xEncryptionData,
+ bool bEncrypt );
+
+ static void StaticFillHeader ( const ::rtl::Reference < EncryptionData > & rData,
sal_Int32 nSize,
const ::rtl::OUString& aMediaType,
sal_Int8 * & pHeader );
- static sal_Bool StaticFillData ( rtl::Reference < EncryptionData > & rData,
+ static sal_Bool StaticFillData ( ::rtl::Reference < BaseEncryptionData > & rData,
+ sal_Int32 &rEncAlgorithm,
+ sal_Int32 &rChecksumAlgorithm,
+ sal_Int32 &rDerivedKeySize,
+ sal_Int32 &rStartKeyGenID,
sal_Int32 &rSize,
::rtl::OUString& aMediaType,
- ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream > &rStream );
+ const ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& rStream );
static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > StaticGetDataFromRawStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream,
- const rtl::Reference < EncryptionData > &rData )
+ const ::rtl::Reference < EncryptionData > &rData )
throw ( ::com::sun::star::packages::WrongPasswordException,
::com::sun::star::packages::zip::ZipIOException,
::com::sun::star::uno::RuntimeException );
- static sal_Bool StaticHasValidPassword ( const ::com::sun::star::uno::Sequence< sal_Int8 > &aReadBuffer,
- const rtl::Reference < EncryptionData > &rData );
+ static sal_Bool StaticHasValidPassword (
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Sequence< sal_Int8 > &aReadBuffer,
+ const ::rtl::Reference < EncryptionData > &rData );
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bDecrypt,
SotMutexHolderRef aMutexHolder )
throw(::com::sun::star::io::IOException, ::com::sun::star::packages::zip::ZipException, ::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getDataStream(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
sal_Bool bDecrypt,
SotMutexHolderRef aMutexHolder )
throw ( ::com::sun::star::packages::WrongPasswordException,
@@ -173,7 +191,7 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getWrappedRawStream(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference < EncryptionData > &rData,
const ::rtl::OUString& aMediaType,
SotMutexHolderRef aMutexHolder )
throw ( ::com::sun::star::packages::NoEncryptionException,
diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx
index 9cd58d74e657..b5d6ee8b54f2 100644
--- a/package/inc/ZipOutputStream.hxx
+++ b/package/inc/ZipOutputStream.hxx
@@ -28,39 +28,52 @@
#ifndef _ZIP_OUTPUT_STREAM_HXX
#define _ZIP_OUTPUT_STREAM_HXX
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
+
#include <ByteChucker.hxx>
#include <Deflater.hxx>
#include <CRC32.hxx>
-#include <rtl/cipher.h>
-#include <rtl/digest.h>
#include <vector>
struct ZipEntry;
-class EncryptionData;
+class ZipPackageStream;
namespace rtl
{
template < class T > class Reference;
}
+
class ZipOutputStream
{
protected:
- com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > xStream;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream;
+
::std::vector < ZipEntry * > aZipList;
- com::sun::star::uno::Sequence < sal_Int8 > aBuffer, aEncryptionBuffer;
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aDeflateBuffer;
+
::rtl::OUString sComment;
ZipUtils::Deflater aDeflater;
- rtlCipher aCipher;
- rtlDigest aDigest;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > m_xCipherContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > m_xDigestContext;
+
CRC32 aCRC;
ByteChucker aChucker;
ZipEntry *pCurrentEntry;
sal_Int16 nMethod, nLevel, mnDigested;
sal_Bool bFinished, bEncryptCurrentEntry;
- EncryptionData *pCurrentEncryptData;
+ ZipPackageStream* m_pCurrentStream;
public:
- ZipOutputStream( com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > &xOStream );
+ ZipOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > &xOStream );
~ZipOutputStream();
// rawWrite to support a direct write to the output stream
@@ -75,7 +88,7 @@ public:
void SAL_CALL setLevel( sal_Int32 nNewLevel )
throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL putNextEntry( ZipEntry& rEntry,
- rtl::Reference < EncryptionData > &rData,
+ ZipPackageStream* pStream,
sal_Bool bEncrypt = sal_False )
throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
void SAL_CALL closeEntry( )
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index 226a19e529b5..ed7be23ea429 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -36,9 +36,12 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <HashMaps.hxx>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+#include <HashMaps.hxx>
#include <osl/file.h>
#include <mutexholder.hxx>
#include <vector>
@@ -83,18 +86,24 @@ class ZipPackage : public cppu::WeakImplHelper7
protected:
SotMutexHolderRef m_aMutexHolder;
- ::com::sun::star::uno::Sequence < sal_Int8 > m_aEncryptionKey;
- FolderHash m_aRecent;
- ::rtl::OUString m_aURL;
- sal_Bool m_bHasEncryptedEntries;
- sal_Bool m_bHasNonEncryptedEntries;
- sal_Bool m_bInconsistent;
- sal_Bool m_bUseManifest;
- sal_Bool m_bForceRecovery;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > m_aStorageEncryptionKeys;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aEncryptionKey;
+
+ FolderHash m_aRecent;
+ ::rtl::OUString m_aURL;
- sal_Bool m_bMediaTypeFallbackUsed;
- sal_Int32 m_nFormat;
- sal_Bool m_bAllowRemoveOnInsert;
+ sal_Int32 m_nStartKeyGenerationID;
+ sal_Int32 m_nChecksumDigestID;
+ sal_Int32 m_nCommonEncryptionID;
+ sal_Bool m_bHasEncryptedEntries;
+ sal_Bool m_bHasNonEncryptedEntries;
+
+ sal_Bool m_bInconsistent;
+ sal_Bool m_bForceRecovery;
+
+ sal_Bool m_bMediaTypeFallbackUsed;
+ sal_Int32 m_nFormat;
+ sal_Bool m_bAllowRemoveOnInsert;
InitialisationMode m_eMode;
@@ -121,15 +130,20 @@ protected:
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xTempStream );
public:
- ZipPackage (const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > &xNewFactory);
+ ZipPackage( const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > &xNewFactory );
virtual ~ZipPackage( void );
ZipFile& getZipFile() { return *m_pZipFile;}
- const com::sun::star::uno::Sequence < sal_Int8 > & getEncryptionKey ( ) {return m_aEncryptionKey;}
sal_Int32 getFormat() const { return m_nFormat; }
+ sal_Int32 GetStartKeyGenID() const { return m_nStartKeyGenerationID; }
+ sal_Int32 GetEncAlgID() const { return m_nCommonEncryptionID; }
+ sal_Int32 GetChecksumAlgID() const { return m_nChecksumDigestID; }
+ sal_Int32 GetDefaultDerivedKeySize() const { return m_nCommonEncryptionID == ::com::sun::star::xml::crypto::CipherID::AES_CBC_W3C_PADDING ? 32 : 16; }
+
SotMutexHolderRef GetSharedMutexRef() { return m_aMutexHolder; }
void ConnectTo( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream );
+ const ::com::sun::star::uno::Sequence< sal_Int8 > GetEncryptionKey();
// XInitialization
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
diff --git a/package/source/zippackage/ZipPackageEntry.hxx b/package/inc/ZipPackageEntry.hxx
index 6ae623a50664..6ae623a50664 100644
--- a/package/source/zippackage/ZipPackageEntry.hxx
+++ b/package/inc/ZipPackageEntry.hxx
diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx
index c6ace8edf0c2..59be1b7b36ce 100644
--- a/package/inc/ZipPackageFolder.hxx
+++ b/package/inc/ZipPackageFolder.hxx
@@ -92,10 +92,10 @@ public:
void setPackageFormat_Impl( sal_Int32 nFormat ) { m_nFormat = nFormat; }
void setRemoveOnInsertMode_Impl( sal_Bool bRemove ) { this->mbAllowRemoveOnInsert = bRemove; }
- bool saveChild(const rtl::OUString &rShortName, const com::sun::star::packages::ContentInfo &rInfo, rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, com::sun::star::uno::Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool);
+ bool saveChild(const rtl::OUString &rShortName, const com::sun::star::packages::ContentInfo &rInfo, rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, const com::sun::star::uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool & rRandomPool);
// Recursive functions
- void saveContents(rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, com::sun::star::uno::Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool)
+ void saveContents(rtl::OUString &rPath, std::vector < com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > > &rManList, ZipOutputStream & rZipOut, const com::sun::star::uno::Sequence< sal_Int8 > &rEncryptionKey, rtlRandomPool & rRandomPool)
throw(::com::sun::star::uno::RuntimeException);
void releaseUpwardRef();
diff --git a/package/source/zippackage/ZipPackageStream.hxx b/package/inc/ZipPackageStream.hxx
index 9bdc09d04f92..cb165af9ee97 100644
--- a/package/source/zippackage/ZipPackageStream.hxx
+++ b/package/inc/ZipPackageStream.hxx
@@ -30,11 +30,13 @@
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/packages/XDataSinkEncrSupport.hpp>
#include <ZipPackageEntry.hxx>
#include <rtl/ref.hxx>
-#include <EncryptionData.hxx>
#include <cppuhelper/implbase2.hxx>
+
+#include <EncryptionData.hxx>
#include <mutexholder.hxx>
#define PACKAGE_STREAM_NOTSET 0
@@ -57,7 +59,15 @@ protected:
const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
ZipPackage &rZipPackage;
sal_Bool bToBeCompressed, bToBeEncrypted, bHaveOwnKey, bIsEncrypted;
- rtl::Reference < EncryptionData > xEncryptionData;
+
+ ::rtl::Reference< BaseEncryptionData > m_xBaseEncryptionData;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > m_aStorageEncryptionKeys;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aEncryptionKey;
+
+ sal_Int32 m_nImportedStartKeyAlgorithm;
+ sal_Int32 m_nImportedEncryptionAlgorithm;
+ sal_Int32 m_nImportedChecksumAlgorithm;
+ sal_Int32 m_nImportedDerivedKeySize;
sal_uInt8 m_nStreamMode;
sal_uInt32 m_nMagicalHackPos;
@@ -69,7 +79,9 @@ protected:
sal_Bool m_bFromManifest;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& GetOwnSeekStream();
+ bool m_bUseWinEncoding;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnSeekStream();
public:
sal_Bool HasOwnKey () const { return bHaveOwnKey;}
@@ -81,46 +93,56 @@ public:
sal_Bool IsFromManifest() const { return m_bFromManifest; }
void SetFromManifest( sal_Bool bValue ) { m_bFromManifest = bValue; }
- rtl::Reference < EncryptionData > & getEncryptionData ()
- { return xEncryptionData;}
- const com::sun::star::uno::Sequence < sal_Int8 >& getKey () const
- { return xEncryptionData->aKey;}
- const com::sun::star::uno::Sequence < sal_uInt8 >& getInitialisationVector () const
- { return xEncryptionData->aInitVector;}
- const com::sun::star::uno::Sequence < sal_uInt8 >& getDigest () const
- { return xEncryptionData->aDigest;}
- const com::sun::star::uno::Sequence < sal_uInt8 >& getSalt () const
- { return xEncryptionData->aSalt;}
+ ::rtl::Reference< EncryptionData > GetEncryptionData( bool bWinEncoding = false );
+ void SetBaseEncryptionData( const ::rtl::Reference< BaseEncryptionData >& xData );
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > GetEncryptionKey( bool bWinEncoding = false );
+
+ sal_Int32 GetStartKeyGenID();
+
+ const com::sun::star::uno::Sequence < sal_Int8 > getInitialisationVector () const
+ { return m_xBaseEncryptionData->m_aInitVector;}
+ const com::sun::star::uno::Sequence < sal_Int8 > getDigest () const
+ { return m_xBaseEncryptionData->m_aDigest;}
+ const com::sun::star::uno::Sequence < sal_Int8 > getSalt () const
+ { return m_xBaseEncryptionData->m_aSalt;}
sal_Int32 getIterationCount () const
- { return xEncryptionData->nIterationCount;}
+ { return m_xBaseEncryptionData->m_nIterationCount;}
sal_Int32 getSize () const
{ return aEntry.nSize;}
sal_uInt8 GetStreamMode() const { return m_nStreamMode; }
sal_uInt32 GetMagicalHackPos() const { return m_nMagicalHackPos; }
sal_uInt32 GetMagicalHackSize() const { return m_nMagicalHackSize; }
+ sal_Int32 GetEncryptionAlgorithm() const;
+ sal_Int32 GetBlockSize() const;
void SetToBeCompressed (sal_Bool bNewValue) { bToBeCompressed = bNewValue;}
void SetIsEncrypted (sal_Bool bNewValue) { bIsEncrypted = bNewValue;}
+ void SetImportedStartKeyAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedStartKeyAlgorithm = nAlgorithm; }
+ void SetImportedEncryptionAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedEncryptionAlgorithm = nAlgorithm; }
+ void SetImportedChecksumAlgorithm( sal_Int32 nAlgorithm ) { m_nImportedChecksumAlgorithm = nAlgorithm; }
+ void SetImportedDerivedKeySize( sal_Int32 nSize ) { m_nImportedDerivedKeySize = nSize; }
void SetToBeEncrypted (sal_Bool bNewValue)
{
bToBeEncrypted = bNewValue;
- if ( bToBeEncrypted && !xEncryptionData.is())
- xEncryptionData = new EncryptionData;
- else if ( !bToBeEncrypted && xEncryptionData.is() )
- xEncryptionData.clear();
+ if ( bToBeEncrypted && !m_xBaseEncryptionData.is())
+ m_xBaseEncryptionData = new BaseEncryptionData;
+ else if ( !bToBeEncrypted && m_xBaseEncryptionData.is() )
+ m_xBaseEncryptionData.clear();
}
void SetPackageMember (sal_Bool bNewValue);
+
void setKey (const com::sun::star::uno::Sequence < sal_Int8 >& rNewKey )
- { xEncryptionData->aKey = rNewKey;}
- void setInitialisationVector (const com::sun::star::uno::Sequence < sal_uInt8 >& rNewVector )
- { xEncryptionData->aInitVector = rNewVector;}
- void setSalt (const com::sun::star::uno::Sequence < sal_uInt8 >& rNewSalt )
- { xEncryptionData->aSalt = rNewSalt;}
- void setDigest (const com::sun::star::uno::Sequence < sal_uInt8 >& rNewDigest )
- { xEncryptionData->aDigest = rNewDigest;}
+ { m_aEncryptionKey = rNewKey; m_aStorageEncryptionKeys.realloc( 0 ); }
+ void setInitialisationVector (const com::sun::star::uno::Sequence < sal_Int8 >& rNewVector )
+ { m_xBaseEncryptionData->m_aInitVector = rNewVector;}
+ void setSalt (const com::sun::star::uno::Sequence < sal_Int8 >& rNewSalt )
+ { m_xBaseEncryptionData->m_aSalt = rNewSalt;}
+ void setDigest (const com::sun::star::uno::Sequence < sal_Int8 >& rNewDigest )
+ { m_xBaseEncryptionData->m_aDigest = rNewDigest;}
void setIterationCount (const sal_Int32 nNewCount)
- { xEncryptionData->nIterationCount = nNewCount;}
+ { m_xBaseEncryptionData->m_nIterationCount = nNewCount;}
void setSize (const sal_Int32 nNewSize);
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetOwnStreamNoWrap() { return xStream; }
diff --git a/package/qa/storages/TestHelper.java b/package/qa/storages/TestHelper.java
index dc28786513b1..1a67f2bfdf79 100644
--- a/package/qa/storages/TestHelper.java
+++ b/package/qa/storages/TestHelper.java
@@ -1434,24 +1434,24 @@ public class TestHelper {
try
{
- byte pData[][] = new byte[1][22];
- if ( xHeadRawStream.readBytes( pData, 22 ) != 22 )
+ byte pData[][] = new byte[1][38];
+ if ( xHeadRawStream.readBytes( pData, 38 ) != 38 )
{
Error( "Can't read header of encrypted stream '" + sStreamName + "' raw representations!" );
return false;
}
- if ( pData[0][0] != 0x4d || pData[0][1] != 0x47 || pData[0][2] != 0x02 || pData[0][3] != 0x05 )
+ if ( pData[0][0] != 0x4d || pData[0][1] != 0x4d || pData[0][2] != 0x02 || pData[0][3] != 0x05 )
{
Error( "No signature in the header of encrypted stream '" + sStreamName + "' raw representations!" );
return false;
}
int nVariableHeaderLength =
- ( pData[0][14] + pData[0][15] * 0x100 ) // salt length
- + ( pData[0][16] + pData[0][17] * 0x100 ) // iv length
- + ( pData[0][18] + pData[0][19] * 0x100 ) // digest length
- + ( pData[0][20] + pData[0][21] * 0x100 ); // mediatype length
+ ( pData[0][30] + pData[0][31] * 0x100 ) // salt length
+ + ( pData[0][32] + pData[0][33] * 0x100 ) // iv length
+ + ( pData[0][34] + pData[0][35] * 0x100 ) // digest length
+ + ( pData[0][36] + pData[0][37] * 0x100 ); // mediatype length
xHeadRawStream.skipBytes( nVariableHeaderLength );
@@ -1467,7 +1467,7 @@ public class TestHelper {
if ( nRead1 != nRead2 )
{
- Error( "The encrypted stream '" + sStreamName + "' raw representations have different size!" );
+ Error( "The encrypted stream '" + sStreamName + "' raw representations have different size! nRead1 - nRead2 = " + ( new Integer( nRead1 - nRead2 ) ).toString() );
return false;
}
diff --git a/package/source/manifest/Base64Codec.cxx b/package/source/manifest/Base64Codec.cxx
index cf539d0790c4..b4f5b6d32ffd 100644
--- a/package/source/manifest/Base64Codec.cxx
+++ b/package/source/manifest/Base64Codec.cxx
@@ -131,11 +131,11 @@ void ThreeByteToFourByte (const sal_uInt8* pBuffer, const sal_Int32 nStart, cons
sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]);
}
-void Base64Codec::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence < sal_uInt8 >& aPass)
+void Base64Codec::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence < sal_Int8 >& aPass)
{
sal_Int32 i(0);
sal_Int32 nBufferLength(aPass.getLength());
- const sal_uInt8* pBuffer = aPass.getConstArray();
+ const sal_uInt8* pBuffer = reinterpret_cast< const sal_uInt8* >( aPass.getConstArray() );
while (i < nBufferLength)
{
rtl::OUStringBuffer sBuffer;
@@ -185,7 +185,7 @@ void FourByteToThreeByte (sal_uInt8* pBuffer, sal_Int32& nLength, const sal_Int3
pBuffer[nStart + 2] = OneByte;
}
-void Base64Codec::decodeBase64(uno::Sequence< sal_uInt8 >& aBuffer, const rtl::OUString& sBuffer)
+void Base64Codec::decodeBase64(uno::Sequence< sal_Int8 >& aBuffer, const rtl::OUString& sBuffer)
{
sal_Int32 nFirstLength((sBuffer.getLength() / 4) * 3);
sal_uInt8* pBuffer = new sal_uInt8[nFirstLength];
@@ -201,7 +201,7 @@ void Base64Codec::decodeBase64(uno::Sequence< sal_uInt8 >& aBuffer, const rtl::O
i += 4;
k += 3;
}
- aBuffer = uno::Sequence<sal_uInt8>(pBuffer, nSecondLength);
+ aBuffer = uno::Sequence<sal_Int8>( reinterpret_cast< sal_Int8* >( pBuffer ), nSecondLength );
delete[] pBuffer;
}
diff --git a/package/source/manifest/Base64Codec.hxx b/package/source/manifest/Base64Codec.hxx
index 8cae2a7037fd..60bd018c159b 100644
--- a/package/source/manifest/Base64Codec.hxx
+++ b/package/source/manifest/Base64Codec.hxx
@@ -40,8 +40,8 @@ class OUStringBuffer;
class Base64Codec
{
public:
- static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_uInt8>& aPass);
- static void decodeBase64(com::sun::star::uno::Sequence<sal_uInt8>& aPass, const rtl::OUString& sBuffer);
+ static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_Int8>& aPass);
+ static void decodeBase64(com::sun::star::uno::Sequence<sal_Int8>& aPass, const rtl::OUString& sBuffer);
};
#endif
diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx
index 65b9c6181727..969f4d834835 100644
--- a/package/source/manifest/ManifestDefines.hxx
+++ b/package/source/manifest/ManifestDefines.hxx
@@ -54,16 +54,29 @@
#define ELEMENT_START_KEY_GENERATION "manifest:start-key-generation"
#define ATTRIBUTE_START_KEY_GENERATION_NAME "manifest:start-key-generation-name"
-#define ALGORITHM_SHA1 "SHA1"
#define ATTRIBUTE_KEY_SIZE "manifest:key-size"
-#define START_KEY_SIZE "20"
#define ELEMENT_KEY_DERIVATION "manifest:key-derivation"
#define ATTRIBUTE_KEY_DERIVATION_NAME "manifest:key-derivation-name"
#define ATTRIBUTE_SALT "manifest:salt"
#define ATTRIBUTE_ITERATION_COUNT "manifest:iteration-count"
-#define CHECKSUM_TYPE "SHA1/1K"
-#define DERIVED_KEY_SIZE "16"
+
+#define SHA256_URL "http://www.w3.org/2000/09/xmldsig#sha256"
+#define SHA1_NAME "SHA1"
+#define SHA1_URL "http://www.w3.org/2000/09/xmldsig#sha1"
+
+#define SHA1_1K_NAME "SHA1/1K"
+#define SHA1_1K_URL "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0#sha1-1k"
+#define SHA256_1K_URL "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0#sha256-1k"
+
+#define BLOWFISH_NAME "Blowfish CFB"
+#define BLOWFISH_URL "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0#blowfish"
+#define AES128_URL "http://www.w3.org/2001/04/xmlenc#aes128-cbc"
+#define AES192_URL "http://www.w3.org/2001/04/xmlenc#aes192-cbc"
+#define AES256_URL "http://www.w3.org/2001/04/xmlenc#aes256-cbc"
+
+#define PBKDF2_NAME "PBKDF2"
+#define PBKDF2_URL "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0#pbkdf2"
#endif
diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx
index e173e8da8d53..b5dc6c049440 100644
--- a/package/source/manifest/ManifestExport.cxx
+++ b/package/source/manifest/ManifestExport.cxx
@@ -28,80 +28,92 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_package.hxx"
-#include <ManifestExport.hxx>
-#include <ManifestDefines.hxx>
-#include <com/sun/star/xml/sax/XAttributeList.hpp>
-#include <rtl/ustrbuf.hxx>
-#include <Base64Codec.hxx>
+
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <ManifestDefines.hxx>
+#include <ManifestExport.hxx>
+#include <Base64Codec.hxx>
+
+#include <rtl/ustrbuf.hxx>
#include <comphelper/documentconstants.hxx>
#include <comphelper/attributelist.hxx>
-using namespace com::sun::star::beans;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::xml::sax;
+using namespace ::com::sun::star;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const Sequence < Sequence < PropertyValue > > &rManList )
+ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHandler, const uno::Sequence< uno::Sequence < beans::PropertyValue > >& rManList )
{
- const OUString sFileEntryElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_FILE_ENTRY ) );
- const OUString sManifestElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_MANIFEST ) );
- const OUString sEncryptionDataElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ENCRYPTION_DATA ) );
- const OUString sAlgorithmElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ALGORITHM ) );
- const OUString sStartKeyGenerationElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_START_KEY_GENERATION ) );
- const OUString sKeyDerivationElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_KEY_DERIVATION ) );
-
- const OUString sCdataAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CDATA ) );
- const OUString sMediaTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_MEDIA_TYPE ) );
- const OUString sVersionAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_VERSION ) );
- const OUString sFullPathAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_FULL_PATH ) );
- const OUString sSizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SIZE ) );
- const OUString sKeySizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_SIZE ) );
- const OUString sSaltAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SALT ) );
- const OUString sInitialisationVectorAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_INITIALISATION_VECTOR ) );
- const OUString sIterationCountAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ITERATION_COUNT ) );
- const OUString sAlgorithmNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ALGORITHM_NAME ) );
- const OUString sStartKeyGenerationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_START_KEY_GENERATION_NAME ) );
- const OUString sKeyDerivationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_DERIVATION_NAME ) );
- const OUString sChecksumTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM_TYPE ) );
- const OUString sChecksumAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM) );
-
- const OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
- const OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
- const OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
- const OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
- const OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
- const OUString sInitialisationVectorProperty( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
- const OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
- const OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
-
- const OUString sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
- const OUString sBlowfish ( RTL_CONSTASCII_USTRINGPARAM ( "Blowfish CFB" ) );
- const OUString sPBKDF2 ( RTL_CONSTASCII_USTRINGPARAM ( "PBKDF2" ) );
- const OUString sChecksumType ( RTL_CONSTASCII_USTRINGPARAM ( CHECKSUM_TYPE ) );
- const OUString sStartKeySize ( RTL_CONSTASCII_USTRINGPARAM ( START_KEY_SIZE ) );
- const OUString sDerivedKeySize ( RTL_CONSTASCII_USTRINGPARAM ( DERIVED_KEY_SIZE ) );
- const OUString sSHA1 ( RTL_CONSTASCII_USTRINGPARAM ( ALGORITHM_SHA1 ) );
+ const ::rtl::OUString sFileEntryElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_FILE_ENTRY ) );
+ const ::rtl::OUString sManifestElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_MANIFEST ) );
+ const ::rtl::OUString sEncryptionDataElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ENCRYPTION_DATA ) );
+ const ::rtl::OUString sAlgorithmElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ALGORITHM ) );
+ const ::rtl::OUString sStartKeyGenerationElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_START_KEY_GENERATION ) );
+ const ::rtl::OUString sKeyDerivationElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_KEY_DERIVATION ) );
+
+ const ::rtl::OUString sCdataAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CDATA ) );
+ const ::rtl::OUString sMediaTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_MEDIA_TYPE ) );
+ const ::rtl::OUString sVersionAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_VERSION ) );
+ const ::rtl::OUString sFullPathAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_FULL_PATH ) );
+ const ::rtl::OUString sSizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SIZE ) );
+ const ::rtl::OUString sKeySizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_SIZE ) );
+ const ::rtl::OUString sSaltAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SALT ) );
+ const ::rtl::OUString sInitialisationVectorAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_INITIALISATION_VECTOR ) );
+ const ::rtl::OUString sIterationCountAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ITERATION_COUNT ) );
+ const ::rtl::OUString sAlgorithmNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ALGORITHM_NAME ) );
+ const ::rtl::OUString sStartKeyGenerationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_START_KEY_GENERATION_NAME ) );
+ const ::rtl::OUString sKeyDerivationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_DERIVATION_NAME ) );
+ const ::rtl::OUString sChecksumTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM_TYPE ) );
+ const ::rtl::OUString sChecksumAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM) );
+
+ const ::rtl::OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
+ const ::rtl::OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
+ const ::rtl::OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
+ const ::rtl::OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
+ const ::rtl::OUString sDerivedKeySizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) );
+ const ::rtl::OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
+ const ::rtl::OUString sInitialisationVectorProperty( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
+ const ::rtl::OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
+ const ::rtl::OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
+ const ::rtl::OUString sEncryptionAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) );
+ const ::rtl::OUString sStartKeyAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) );
+ const ::rtl::OUString sDigestAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) );
+
+ const ::rtl::OUString sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) );
+
+ const ::rtl::OUString sSHA256_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_URL ) );
+ const ::rtl::OUString sSHA1_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_NAME ) );
+
+ const ::rtl::OUString sSHA1_1k_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_1K_NAME ) );
+ const ::rtl::OUString sSHA256_1k_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_1K_URL ) );
+
+ const ::rtl::OUString sBlowfish_Name ( RTL_CONSTASCII_USTRINGPARAM ( BLOWFISH_NAME ) );
+ const ::rtl::OUString sAES256_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES256_URL ) );
+
+ const ::rtl::OUString sPBKDF2_Name ( RTL_CONSTASCII_USTRINGPARAM ( PBKDF2_NAME ) );
::comphelper::AttributeList * pRootAttrList = new ::comphelper::AttributeList;
- const Sequence < PropertyValue > *pSequence = rManList.getConstArray();
+ const uno::Sequence < beans::PropertyValue > *pSequence = rManList.getConstArray();
const sal_uInt32 nManLength = rManList.getLength();
// find the mediatype of the document if any
- OUString aDocMediaType;
- OUString aDocVersion;
+ ::rtl::OUString aDocMediaType;
+ ::rtl::OUString aDocVersion;
for (sal_uInt32 nInd = 0; nInd < nManLength ; nInd++ )
{
- OUString aMediaType;
- OUString aPath;
- OUString aVersion;
+ ::rtl::OUString aMediaType;
+ ::rtl::OUString aPath;
+ ::rtl::OUString aVersion;
- const PropertyValue *pValue = pSequence[nInd].getConstArray();
+ const beans::PropertyValue *pValue = pSequence[nInd].getConstArray();
for (sal_uInt32 j = 0, nNum = pSequence[nInd].getLength(); j < nNum; j++, pValue++)
{
if (pValue->Name.equals (sMediaTypeProperty) )
@@ -121,7 +133,7 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
break;
}
- if ( aPath.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) ) )
+ if ( aPath.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) ) )
{
aDocMediaType = aMediaType;
aDocVersion = aVersion;
@@ -134,28 +146,28 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
sal_Bool bStoreStartKeyGeneration = sal_False;
if ( aDocMediaType.getLength() )
{
- if ( aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ) ) )
-
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII ) ) )
- || aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII ) ) ) )
+ if ( aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ) ) )
+
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII ) ) )
+ || aDocMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII ) ) ) )
{
// oasis format
- pRootAttrList->AddAttribute ( OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ),
+ pRootAttrList->AddAttribute ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ),
sCdataAttribute,
- OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_OASIS_NAMESPACE ) ) );
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_OASIS_NAMESPACE ) ) );
bAcceptNonemptyVersion = sal_True;
if ( aDocVersion.compareTo( ODFVER_012_TEXT ) >= 0 )
{
@@ -168,21 +180,21 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
{
// even if it is no SO6 format the namespace must be specified
// thus SO6 format is used as default one
- pRootAttrList->AddAttribute ( OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ),
+ pRootAttrList->AddAttribute ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_XMLNS ) ),
sCdataAttribute,
- OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_NAMESPACE ) ) );
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_NAMESPACE ) ) );
bProvideDTD = sal_True;
}
}
- Reference < XAttributeList > xRootAttrList (pRootAttrList);
+ uno::Reference < xml::sax::XAttributeList > xRootAttrList (pRootAttrList);
xHandler->startDocument();
- Reference < XExtendedDocumentHandler > xExtHandler ( xHandler, UNO_QUERY );
+ uno::Reference < xml::sax::XExtendedDocumentHandler > xExtHandler ( xHandler, uno::UNO_QUERY );
if ( xExtHandler.is() && bProvideDTD )
{
- OUString aDocType ( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_DOCTYPE ) );
+ ::rtl::OUString aDocType ( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_DOCTYPE ) );
xExtHandler->unknown ( aDocType );
xHandler->ignorableWhitespace ( sWhiteSpace );
}
@@ -191,9 +203,9 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
for (sal_uInt32 i = 0 ; i < nManLength ; i++)
{
::comphelper::AttributeList *pAttrList = new ::comphelper::AttributeList;
- const PropertyValue *pValue = pSequence[i].getConstArray();
- OUString aString;
- const PropertyValue *pVector = NULL, *pSalt = NULL, *pIterationCount = NULL, *pDigest = NULL;
+ const beans::PropertyValue *pValue = pSequence[i].getConstArray();
+ ::rtl::OUString aString;
+ const uno::Any *pVector = NULL, *pSalt = NULL, *pIterationCount = NULL, *pDigest = NULL, *pDigestAlg = NULL, *pEncryptAlg = NULL, *pStartKeyAlg = NULL, *pDerivedKeySize = NULL;
for (sal_uInt32 j = 0, nNum = pSequence[i].getLength(); j < nNum; j++, pValue++)
{
if (pValue->Name.equals (sMediaTypeProperty) )
@@ -217,47 +229,87 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
{
sal_Int32 nSize = 0;
pValue->Value >>= nSize;
- OUStringBuffer aBuffer;
+ ::rtl::OUStringBuffer aBuffer;
aBuffer.append ( nSize );
pAttrList->AddAttribute ( sSizeAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
}
else if (pValue->Name.equals (sInitialisationVectorProperty) )
- pVector = pValue;
+ pVector = &pValue->Value;
else if (pValue->Name.equals (sSaltProperty) )
- pSalt = pValue;
+ pSalt = &pValue->Value;
else if (pValue->Name.equals (sIterationCountProperty) )
- pIterationCount = pValue;
+ pIterationCount = &pValue->Value;
else if (pValue->Name.equals ( sDigestProperty ) )
- pDigest = pValue;
+ pDigest = &pValue->Value;
+ else if (pValue->Name.equals ( sDigestAlgProperty ) )
+ pDigestAlg = &pValue->Value;
+ else if (pValue->Name.equals ( sEncryptionAlgProperty ) )
+ pEncryptAlg = &pValue->Value;
+ else if (pValue->Name.equals ( sStartKeyAlgProperty ) )
+ pStartKeyAlg = &pValue->Value;
+ else if (pValue->Name.equals ( sDerivedKeySizeProperty ) )
+ pDerivedKeySize = &pValue->Value;
}
+
xHandler->ignorableWhitespace ( sWhiteSpace );
- Reference < XAttributeList > xAttrList ( pAttrList );
+ uno::Reference < xml::sax::XAttributeList > xAttrList ( pAttrList );
xHandler->startElement( sFileEntryElement , xAttrList);
- if ( pVector && pSalt && pIterationCount )
+ if ( pVector && pSalt && pIterationCount && pDigest && pDigestAlg && pEncryptAlg && pStartKeyAlg && pDerivedKeySize )
{
// ==== Encryption Data
::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList;
- Reference < XAttributeList > xNewAttrList (pNewAttrList);
- OUStringBuffer aBuffer;
- Sequence < sal_uInt8 > aSequence;
+ uno::Reference < xml::sax::XAttributeList > xNewAttrList (pNewAttrList);
+ ::rtl::OUStringBuffer aBuffer;
+ uno::Sequence < sal_Int8 > aSequence;
xHandler->ignorableWhitespace ( sWhiteSpace );
- if ( pDigest )
- {
- pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType );
- pDigest->Value >>= aSequence;
- Base64Codec::encodeBase64 ( aBuffer, aSequence );
- pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
- }
+
+ // ==== Digest
+ ::rtl::OUString sChecksumType;
+ sal_Int32 nDigestAlgID = 0;
+ *pDigestAlg >>= nDigestAlgID;
+ if ( nDigestAlgID == xml::crypto::DigestID::SHA256_1K )
+ sChecksumType = sSHA256_1k_URL;
+ else if ( nDigestAlgID == xml::crypto::DigestID::SHA1_1K )
+ sChecksumType = sSHA1_1k_Name;
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected digest algorithm is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType );
+ *pDigest >>= aSequence;
+ Base64Codec::encodeBase64( aBuffer, aSequence );
+ pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
+
xHandler->startElement( sEncryptionDataElement , xNewAttrList);
// ==== Algorithm
pNewAttrList = new ::comphelper::AttributeList;
xNewAttrList = pNewAttrList;
- pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sBlowfish );
+ sal_Int32 nEncAlgID = 0;
+ sal_Int32 nDerivedKeySize = 0;
+ *pEncryptAlg >>= nEncAlgID;
+ *pDerivedKeySize >>= nDerivedKeySize;
- pVector->Value >>= aSequence;
+ ::rtl::OUString sEncAlgName;
+ if ( nEncAlgID == xml::crypto::CipherID::AES_CBC_W3C_PADDING )
+ {
+ OSL_ENSURE( nDerivedKeySize, "Unexpected key size is provided!" );
+ if ( nDerivedKeySize != 32 )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected key size is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ sEncAlgName = sAES256_URL;
+ }
+ else if ( nEncAlgID == xml::crypto::CipherID::BLOWFISH_CFB_8 )
+ {
+ sEncAlgName = sBlowfish_Name;
+ }
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpecte encryption algorithm is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sEncAlgName );
+
+ *pVector >>= aSequence;
Base64Codec::encodeBase64 ( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sInitialisationVectorAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
@@ -270,17 +322,20 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
pNewAttrList = new ::comphelper::AttributeList;
xNewAttrList = pNewAttrList;
- pNewAttrList->AddAttribute ( sKeyDerivationNameAttribute, sCdataAttribute, sPBKDF2 );
+ pNewAttrList->AddAttribute ( sKeyDerivationNameAttribute, sCdataAttribute, sPBKDF2_Name );
if ( bStoreStartKeyGeneration )
- pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, sDerivedKeySize );
+ {
+ aBuffer.append( nDerivedKeySize );
+ pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
+ }
sal_Int32 nCount = 0;
- pIterationCount->Value >>= nCount;
+ *pIterationCount >>= nCount;
aBuffer.append (nCount);
pNewAttrList->AddAttribute ( sIterationCountAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
- pSalt->Value >>= aSequence;
+ *pSalt >>= aSequence;
Base64Codec::encodeBase64 ( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sSaltAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
@@ -297,8 +352,26 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
pNewAttrList = new ::comphelper::AttributeList;
xNewAttrList = pNewAttrList;
- // currently SHA1 is used to generate 20-bytes start key
- pNewAttrList->AddAttribute ( sStartKeyGenerationNameAttribute, sCdataAttribute, sSHA1 );
+ ::rtl::OUString sStartKeyAlg;
+ ::rtl::OUString sStartKeySize;
+ sal_Int32 nStartKeyAlgID = 0;
+ *pStartKeyAlg >>= nStartKeyAlgID;
+ if ( nStartKeyAlgID == xml::crypto::DigestID::SHA256 )
+ {
+ sStartKeyAlg = sSHA256_URL;
+ aBuffer.append( (sal_Int32)32 );
+ sStartKeySize = aBuffer.makeStringAndClear();
+ }
+ else if ( nStartKeyAlgID == xml::crypto::DigestID::SHA1 )
+ {
+ sStartKeyAlg = sSHA1_Name;
+ aBuffer.append( (sal_Int32)20 );
+ sStartKeySize = aBuffer.makeStringAndClear();
+ }
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key algorithm is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ pNewAttrList->AddAttribute ( sStartKeyGenerationNameAttribute, sCdataAttribute, sStartKeyAlg );
pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, sStartKeySize );
xHandler->ignorableWhitespace ( sWhiteSpace );
diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx
index 58310e5ed116..f685f7ea87fb 100644
--- a/package/source/manifest/ManifestImport.cxx
+++ b/package/source/manifest/ManifestImport.cxx
@@ -32,6 +32,8 @@
#include <ManifestDefines.hxx>
#include <Base64Codec.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
using namespace com::sun::star::uno;
@@ -45,12 +47,14 @@ using ::rtl::OUString;
ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector )
: nNumProperty ( 0 )
, bIgnoreEncryptData ( sal_False )
+, nDerivedKeySize( 0 )
, rManVector ( rNewManVector )
, sFileEntryElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_FILE_ENTRY ) )
, sManifestElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_MANIFEST ) )
, sEncryptionDataElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ENCRYPTION_DATA ) )
, sAlgorithmElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_ALGORITHM ) )
+, sStartKeyAlgElement ( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_START_KEY_GENERATION ) )
, sKeyDerivationElement( RTL_CONSTASCII_USTRINGPARAM ( ELEMENT_KEY_DERIVATION ) )
, sCdataAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CDATA ) )
@@ -61,7 +65,9 @@ ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManV
, sSaltAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_SALT ) )
, sInitialisationVectorAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_INITIALISATION_VECTOR ) )
, sIterationCountAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ITERATION_COUNT ) )
+, sKeySizeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_SIZE ) )
, sAlgorithmNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_ALGORITHM_NAME ) )
+, sStartKeyAlgNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_START_KEY_GENERATION_NAME ) )
, sKeyDerivationNameAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_KEY_DERIVATION_NAME ) )
, sChecksumAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM ) )
, sChecksumTypeAttribute ( RTL_CONSTASCII_USTRINGPARAM ( ATTRIBUTE_CHECKSUM_TYPE ) )
@@ -70,15 +76,33 @@ ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManV
, sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) )
, sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) )
, sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) )
+, sDerivedKeySizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) )
, sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) )
, sInitialisationVectorProperty ( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) )
, sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) )
, sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) )
+, sEncryptionAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) )
+, sStartKeyAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) )
+, sDigestAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) )
, sWhiteSpace ( RTL_CONSTASCII_USTRINGPARAM ( " " ) )
-, sBlowfish ( RTL_CONSTASCII_USTRINGPARAM ( "Blowfish CFB" ) )
-, sPBKDF2 ( RTL_CONSTASCII_USTRINGPARAM ( "PBKDF2" ) )
-, sChecksumType ( RTL_CONSTASCII_USTRINGPARAM ( CHECKSUM_TYPE ) )
+
+, sSHA256_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_URL ) )
+, sSHA1_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_NAME ) )
+, sSHA1_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_URL ) )
+
+, sSHA256_1k_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA256_1K_URL ) )
+, sSHA1_1k_Name ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_1K_NAME ) )
+, sSHA1_1k_URL ( RTL_CONSTASCII_USTRINGPARAM ( SHA1_1K_URL ) )
+
+, sBlowfish_Name ( RTL_CONSTASCII_USTRINGPARAM ( BLOWFISH_NAME ) )
+, sBlowfish_URL ( RTL_CONSTASCII_USTRINGPARAM ( BLOWFISH_URL ) )
+, sAES128_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES128_URL ) )
+, sAES192_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES192_URL ) )
+, sAES256_URL ( RTL_CONSTASCII_USTRINGPARAM ( AES256_URL ) )
+
+, sPBKDF2_Name ( RTL_CONSTASCII_USTRINGPARAM ( PBKDF2_NAME ) )
+, sPBKDF2_URL ( RTL_CONSTASCII_USTRINGPARAM ( PBKDF2_URL ) )
{
aStack.reserve( 10 );
}
@@ -143,15 +167,32 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
if ( aConvertedName.equals( sEncryptionDataElement ) )
{
// If this element exists, then this stream is encrypted and we need
- // to store the initialisation vector, salt and iteration count used
+ // to import the initialisation vector, salt and iteration count used
+ nDerivedKeySize = 0;
OUString aString = aConvertedAttribs[sChecksumTypeAttribute];
- if ( aString == sChecksumType && !bIgnoreEncryptData )
+ if ( !bIgnoreEncryptData )
{
- aString = aConvertedAttribs[sChecksumAttribute];
- Sequence < sal_uInt8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sDigestProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ if ( aString.equals( sSHA1_1k_Name ) || aString.equals( sSHA1_1k_URL ) )
+ {
+ aSequence[nNumProperty].Name = sDigestAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1_1K;
+ }
+ else if ( aString.equals( sSHA256_1k_URL ) )
+ {
+ aSequence[nNumProperty].Name = sDigestAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256_1K;
+ }
+ else
+ bIgnoreEncryptData = sal_True;
+
+ if ( !bIgnoreEncryptData )
+ {
+ aString = aConvertedAttribs[sChecksumAttribute];
+ uno::Sequence < sal_Int8 > aDecodeBuffer;
+ Base64Codec::decodeBase64( aDecodeBuffer, aString );
+ aSequence[nNumProperty].Name = sDigestProperty;
+ aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ }
}
}
}
@@ -159,38 +200,98 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re
{
if ( aConvertedName == sAlgorithmElement )
{
- OUString aString = aConvertedAttribs[sAlgorithmNameAttribute];
- if ( aString == sBlowfish && !bIgnoreEncryptData )
+ if ( !bIgnoreEncryptData )
{
- aString = aConvertedAttribs[sInitialisationVectorAttribute];
- Sequence < sal_uInt8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sInitialisationVectorProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ OUString aString = aConvertedAttribs[sAlgorithmNameAttribute];
+ if ( aString.equals( sBlowfish_Name ) || aString.equals( sBlowfish_URL ) )
+ {
+ aSequence[nNumProperty].Name = sEncryptionAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8;
+ }
+ else if ( aString.equals( sAES256_URL ) )
+ {
+ aSequence[nNumProperty].Name = sEncryptionAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 32, "Unexpected derived key length!" );
+ nDerivedKeySize = 32;
+ }
+ else if ( aString.equals( sAES192_URL ) )
+ {
+ aSequence[nNumProperty].Name = sEncryptionAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 24, "Unexpected derived key length!" );
+ nDerivedKeySize = 24;
+ }
+ else if ( aString.equals( sAES128_URL ) )
+ {
+ aSequence[nNumProperty].Name = sEncryptionAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 16, "Unexpected derived key length!" );
+ nDerivedKeySize = 16;
+ }
+ else
+ bIgnoreEncryptData = sal_True;
+
+ if ( !bIgnoreEncryptData )
+ {
+ aString = aConvertedAttribs[sInitialisationVectorAttribute];
+ uno::Sequence < sal_Int8 > aDecodeBuffer;
+ Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
+ aSequence[nNumProperty].Name = sInitialisationVectorProperty;
+ aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+ }
}
- else
- // If we don't recognise the algorithm, then the key derivation info
- // is useless to us
- bIgnoreEncryptData = sal_True;
}
else if ( aConvertedName == sKeyDerivationElement )
{
- OUString aString = aConvertedAttribs[sKeyDerivationNameAttribute];
- if ( aString == sPBKDF2 && !bIgnoreEncryptData )
+ if ( !bIgnoreEncryptData )
+ {
+ OUString aString = aConvertedAttribs[sKeyDerivationNameAttribute];
+ if ( aString.equals( sPBKDF2_Name ) || aString.equals( sPBKDF2_URL ) )
+ {
+ aString = aConvertedAttribs[sSaltAttribute];
+ uno::Sequence < sal_Int8 > aDecodeBuffer;
+ Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
+ aSequence[nNumProperty].Name = sSaltProperty;
+ aSequence[nNumProperty++].Value <<= aDecodeBuffer;
+
+ aString = aConvertedAttribs[sIterationCountAttribute];
+ aSequence[nNumProperty].Name = sIterationCountProperty;
+ aSequence[nNumProperty++].Value <<= aString.toInt32();
+
+ aString = aConvertedAttribs[sKeySizeAttribute];
+ if ( aString.getLength() )
+ {
+ sal_Int32 nKey = aString.toInt32();
+ OSL_ENSURE( !nDerivedKeySize || nKey == nDerivedKeySize , "Provided derived key length differs from the expected one!" );
+ nDerivedKeySize = nKey;
+ }
+ else if ( !nDerivedKeySize )
+ nDerivedKeySize = 16;
+ else if ( nDerivedKeySize != 16 )
+ OSL_ENSURE( sal_False, "Default derived key length differs from the expected one!" );
+
+ aSequence[nNumProperty].Name = sDerivedKeySizeProperty;
+ aSequence[nNumProperty++].Value <<= nDerivedKeySize;
+ }
+ else
+ bIgnoreEncryptData = sal_True;
+ }
+ }
+ else if ( aConvertedName == sStartKeyAlgElement )
+ {
+ OUString aString = aConvertedAttribs[sStartKeyAlgNameAttribute];
+ if ( aString.equals( sSHA256_URL ) )
+ {
+ aSequence[nNumProperty].Name = sStartKeyAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256;
+ }
+ else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) )
{
- aString = aConvertedAttribs[sSaltAttribute];
- Sequence < sal_uInt8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sSaltProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
-
- aString = aConvertedAttribs[sIterationCountAttribute];
- aSequence[nNumProperty].Name = sIterationCountProperty;
- aSequence[nNumProperty++].Value <<= aString.toInt32();
+ aSequence[nNumProperty].Name = sStartKeyAlgProperty;
+ aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1;
}
else
- // If we don't recognise the key derivation technique, then the
- // algorithm info is useless to us
bIgnoreEncryptData = sal_True;
}
}
diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx
index 4b74d903ee76..1c646a7952a6 100644
--- a/package/source/manifest/ManifestImport.hxx
+++ b/package/source/manifest/ManifestImport.hxx
@@ -65,12 +65,14 @@ protected:
sal_Int16 nNumProperty;
ManifestStack aStack;
sal_Bool bIgnoreEncryptData;
+ sal_Int32 nDerivedKeySize;
::std::vector < ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue > > & rManVector;
const ::rtl::OUString sFileEntryElement;
const ::rtl::OUString sManifestElement;
const ::rtl::OUString sEncryptionDataElement;
const ::rtl::OUString sAlgorithmElement;
+ const ::rtl::OUString sStartKeyAlgElement;
const ::rtl::OUString sKeyDerivationElement;
const ::rtl::OUString sCdataAttribute;
@@ -81,7 +83,9 @@ protected:
const ::rtl::OUString sSaltAttribute;
const ::rtl::OUString sInitialisationVectorAttribute;
const ::rtl::OUString sIterationCountAttribute;
+ const ::rtl::OUString sKeySizeAttribute;
const ::rtl::OUString sAlgorithmNameAttribute;
+ const ::rtl::OUString sStartKeyAlgNameAttribute;
const ::rtl::OUString sKeyDerivationNameAttribute;
const ::rtl::OUString sChecksumAttribute;
const ::rtl::OUString sChecksumTypeAttribute;
@@ -90,15 +94,33 @@ protected:
const ::rtl::OUString sMediaTypeProperty;
const ::rtl::OUString sVersionProperty;
const ::rtl::OUString sIterationCountProperty;
+ const ::rtl::OUString sDerivedKeySizeProperty;
const ::rtl::OUString sSaltProperty;
const ::rtl::OUString sInitialisationVectorProperty;
const ::rtl::OUString sSizeProperty;
const ::rtl::OUString sDigestProperty;
+ const ::rtl::OUString sEncryptionAlgProperty;
+ const ::rtl::OUString sStartKeyAlgProperty;
+ const ::rtl::OUString sDigestAlgProperty;
const ::rtl::OUString sWhiteSpace;
- const ::rtl::OUString sBlowfish;
- const ::rtl::OUString sPBKDF2;
- const ::rtl::OUString sChecksumType;
+
+ const ::rtl::OUString sSHA256_URL;
+ const ::rtl::OUString sSHA1_Name;
+ const ::rtl::OUString sSHA1_URL;
+
+ const ::rtl::OUString sSHA256_1k_URL;
+ const ::rtl::OUString sSHA1_1k_Name;
+ const ::rtl::OUString sSHA1_1k_URL;
+
+ const ::rtl::OUString sBlowfish_Name;
+ const ::rtl::OUString sBlowfish_URL;
+ const ::rtl::OUString sAES128_URL;
+ const ::rtl::OUString sAES192_URL;
+ const ::rtl::OUString sAES256_URL;
+
+ const ::rtl::OUString sPBKDF2_Name;
+ const ::rtl::OUString sPBKDF2_URL;
::rtl::OUString PushNameAndNamespaces( const ::rtl::OUString& aName,
diff --git a/package/source/manifest/UnoRegister.cxx b/package/source/manifest/UnoRegister.cxx
index e71f6fe99d6b..d26deb81ec84 100644
--- a/package/source/manifest/UnoRegister.cxx
+++ b/package/source/manifest/UnoRegister.cxx
@@ -37,6 +37,7 @@
#include <zipfileaccess.hxx>
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
@@ -65,9 +66,9 @@ extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
{
void * pRet = 0;
- Reference< XMultiServiceFactory > xSMgr(
+ uno::Reference< XMultiServiceFactory > xSMgr(
reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
- Reference< XSingleServiceFactory > xFactory;
+ uno::Reference< XSingleServiceFactory > xFactory;
if (ManifestReader::static_getImplementationName().compareToAscii( pImplName ) == 0)
xFactory = ManifestReader::createServiceFactory ( xSMgr );
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 99ad649a4d28..383d76acaa4f 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -47,16 +47,18 @@
#include <comphelper/storagehelper.hxx>
#include <comphelper/ofopxmlhelper.hxx>
+#include <rtl/digest.h>
+#include <rtl/logfile.hxx>
+#include <rtl/instance.hxx>
+
+#include <PackageConstants.hxx>
+#include <mutexholder.hxx>
+
#include "selfterminatefilestream.hxx"
#include "owriteablestream.hxx"
#include "oseekinstream.hxx"
-#include "mutexholder.hxx"
#include "xstorage.hxx"
-#include <rtl/digest.h>
-#include <rtl/logfile.hxx>
-#include <rtl/instance.hxx>
-
// since the copying uses 32000 blocks usually, it makes sense to have a smaller size
#define MAX_STORCACHE_SIZE 30000
@@ -111,15 +113,14 @@ namespace
{
//-----------------------------------------------
void SetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySet >& xPropertySet,
- const uno::Sequence< sal_Int8 >& aKey )
+ const uno::Sequence< beans::NamedValue >& aKey )
{
OSL_ENSURE( xPropertySet.is(), "No property set is provided!\n" );
if ( !xPropertySet.is() )
throw uno::RuntimeException();
- ::rtl::OUString aString_EncryptionKey (RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") );
try {
- xPropertySet->setPropertyValue( aString_EncryptionKey, uno::makeAny( aKey ) );
+ xPropertySet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ), uno::makeAny( aKey ) );
}
catch ( uno::Exception& aException )
{
@@ -137,9 +138,8 @@ uno::Any GetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySe
if ( !xPropertySet.is() )
throw uno::RuntimeException();
- ::rtl::OUString aString_EncryptionKey (RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") );
try {
- return xPropertySet->getPropertyValue( aString_EncryptionKey );
+ return xPropertySet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) );
}
catch ( uno::Exception& aException )
{
@@ -152,16 +152,65 @@ uno::Any GetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySe
}
//-----------------------------------------------
-sal_Bool SequencesEqual( uno::Sequence< sal_Int8 > aSequence1, uno::Sequence< sal_Int8 > aSequence2 )
+bool SequencesEqual( const uno::Sequence< sal_Int8 >& aSequence1, const uno::Sequence< sal_Int8 >& aSequence2 )
{
if ( aSequence1.getLength() != aSequence2.getLength() )
- return sal_False;
+ return false;
for ( sal_Int32 nInd = 0; nInd < aSequence1.getLength(); nInd++ )
if ( aSequence1[nInd] != aSequence2[nInd] )
- return sal_False;
+ return false;
+
+ return true;
+}
+
+//-----------------------------------------------
+bool SequencesEqual( const uno::Sequence< beans::NamedValue >& aSequence1, const uno::Sequence< beans::NamedValue >& aSequence2 )
+{
+ if ( aSequence1.getLength() != aSequence2.getLength() )
+ return false;
+
+ for ( sal_Int32 nInd = 0; nInd < aSequence1.getLength(); nInd++ )
+ {
+ bool bHasMember = false;
+ uno::Sequence< sal_Int8 > aMember1;
+ sal_Int32 nMember1 = 0;
+ if ( ( aSequence1[nInd].Value >>= aMember1 ) )
+ {
+ for ( sal_Int32 nInd2 = 0; nInd2 < aSequence2.getLength(); nInd2++ )
+ {
+ if ( aSequence1[nInd].Name.equals( aSequence2[nInd2].Name ) )
+ {
+ bHasMember = true;
+
+ uno::Sequence< sal_Int8 > aMember2;
+ if ( !( aSequence2[nInd2].Value >>= aMember2 ) || !SequencesEqual( aMember1, aMember2 ) )
+ return false;
+ }
+ }
+ }
+ else if ( ( aSequence1[nInd].Value >>= nMember1 ) )
+ {
+ for ( sal_Int32 nInd2 = 0; nInd2 < aSequence2.getLength(); nInd2++ )
+ {
+ if ( aSequence1[nInd].Name.equals( aSequence2[nInd2].Name ) )
+ {
+ bHasMember = true;
- return sal_True;
+ sal_Int32 nMember2 = 0;
+ if ( !( aSequence2[nInd2].Value >>= nMember2 ) || nMember1 != nMember2 )
+ return false;
+ }
+ }
+ }
+ else
+ return false;
+
+ if ( !bHasMember )
+ return false;
+ }
+
+ return true;
}
//-----------------------------------------------
@@ -395,7 +444,7 @@ sal_Bool OWriteStream_Impl::IsEncrypted()
// since a new key set to the package stream it should not be removed except the case when
// the stream becomes nonencrypted
- uno::Sequence< sal_Int8 > aKey;
+ uno::Sequence< beans::NamedValue > aKey;
if ( bToBeEncr )
GetEncryptionKeyProperty_Impl( xPropSet ) >>= aKey;
@@ -822,8 +871,8 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt
throw uno::RuntimeException();
// set to be encrypted but do not use encryption key
- xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") ),
- uno::makeAny( uno::Sequence< sal_Int8 >() ) );
+ xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( uno::Sequence< beans::NamedValue >() ) );
xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Encrypted") ),
uno::makeAny( sal_True ) );
}
@@ -921,8 +970,8 @@ void OWriteStream_Impl::Commit()
throw uno::RuntimeException();
// set to be encrypted but do not use encryption key
- xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") ),
- uno::makeAny( uno::Sequence< sal_Int8 >() ) );
+ xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( uno::Sequence< beans::NamedValue >() ) );
xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Encrypted") ),
uno::makeAny( sal_True ) );
}
@@ -931,8 +980,8 @@ void OWriteStream_Impl::Commit()
if ( m_nStorageType != embed::StorageFormats::PACKAGE )
throw uno::RuntimeException();
- xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") ),
- uno::makeAny( m_aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ) );
+ xPropertySet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( m_aEncryptionData.getAsConstNamedValueList() ) );
}
// the stream should be free soon, after package is stored
@@ -1265,7 +1314,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod
}
else
{
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) );
+ SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getAsConstNamedValueList() );
try {
xResultStream = GetStream_Impl( nStreamMode, bHierarchyAccess );
@@ -1274,55 +1323,22 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod
m_bHasCachedEncryptionData = sal_True;
m_aEncryptionData = aEncryptionData;
}
- catch( packages::WrongPasswordException& )
- {
- // retry with different encoding
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ) );
- try {
- // the stream must be cashed to be resaved
- xResultStream = GetStream_Impl( nStreamMode | embed::ElementModes::SEEKABLE, bHierarchyAccess );
-
- m_bUseCommonEncryption = sal_False; // very important to set it to false
- m_bHasCachedEncryptionData = sal_True;
- m_aEncryptionData = aEncryptionData;
-
- // the stream must be resaved with new password encryption
- if ( nStreamMode & embed::ElementModes::WRITE )
- {
- FillTempGetFileName();
- m_bHasDataToFlush = sal_True;
-
- // TODO/LATER: should the notification be done?
- if ( m_pParent )
- m_pParent->m_bIsModified = sal_True;
- }
- }
- catch( packages::WrongPasswordException& aWrongPasswordException )
- {
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- AddLog( aWrongPasswordException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- throw;
- }
- catch ( uno::Exception& aException )
- {
- AddLog( aException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) );
-
- OSL_FAIL( "Can't write encryption related properties!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- throw io::IOException(); // TODO:
- }
- }
- catch( uno::Exception& aException )
+ catch( packages::WrongPasswordException& aWrongPasswordException )
{
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
-
- AddLog( aException.Message );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
+ AddLog( aWrongPasswordException.Message );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
+ catch ( uno::Exception& aException )
+ {
+ AddLog( aException.Message );
+ AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Quiet exception" ) ) );
+ OSL_FAIL( "Can't write encryption related properties!\n" );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
+ throw io::IOException(); // TODO:
+ }
}
OSL_ENSURE( xResultStream.is(), "In case stream can not be retrieved an exception must be thrown!\n" );
@@ -1625,8 +1641,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar
{
// TODO: introduce last commited cashed password information and use it here
// that means "use common pass" also should be remembered on flash
- uno::Sequence< sal_Int8 > aNewKey = aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() );
- uno::Sequence< sal_Int8 > aOldKey = aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() );
+ uno::Sequence< beans::NamedValue > aKey = aEncryptionData.getAsConstNamedValueList();
uno::Reference< beans::XPropertySet > xProps( m_xPackageStream, uno::UNO_QUERY );
if ( !xProps.is() )
@@ -1637,9 +1652,9 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar
if ( !bEncr )
throw packages::NoEncryptionException();
- uno::Sequence< sal_Int8 > aEncrKey;
- xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EncryptionKey") ) ) >>= aEncrKey;
- if ( !SequencesEqual( aNewKey, aEncrKey ) && !SequencesEqual( aOldKey, aEncrKey ) )
+ uno::Sequence< beans::NamedValue > aPackKey;
+ xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) ) >>= aPackKey;
+ if ( !SequencesEqual( aKey, aPackKey ) )
throw packages::WrongPasswordException();
// the correct key must be set already
@@ -1648,7 +1663,7 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar
else
{
uno::Reference< beans::XPropertySet > xPropertySet( m_xPackageStream, uno::UNO_QUERY );
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) );
+ SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getAsConstNamedValueList() );
try {
xDataToCopy = m_xPackageStream->getDataStream();
@@ -1656,42 +1671,19 @@ void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTar
if ( !xDataToCopy.is() )
{
OSL_FAIL( "Encrypted ZipStream must already have input stream inside!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- }
- }
- catch( packages::WrongPasswordException& aWrongPasswordException )
- {
- SetEncryptionKeyProperty_Impl( xPropertySet, aEncryptionData.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1MS1252, uno::Sequence< sal_Int8 >() ) );
- try {
- xDataToCopy = m_xPackageStream->getDataStream();
-
- if ( !xDataToCopy.is() )
- {
- OSL_FAIL( "Encrypted ZipStream must already have input stream inside!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- AddLog( aWrongPasswordException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- throw;
- }
- }
- catch( uno::Exception& aException )
- {
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
- AddLog( aException.Message );
- AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- throw;
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
}
}
catch( uno::Exception& aException )
{
OSL_FAIL( "Can't open encrypted stream!\n" );
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
AddLog( aException.Message );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
throw;
}
- SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< sal_Int8 >() );
+ SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() );
}
// in case of new inserted package stream it is possible that input stream still was not set
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 1f7b0dd9daf0..480324752ea3 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <PackageConstants.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -572,7 +573,7 @@ void OStorage_Impl::GetStorageProperties()
if ( !m_bControlMediaType )
{
uno::Reference< beans::XPropertySet > xPackageProps( m_xPackage, uno::UNO_QUERY_THROW );
- xPackageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaTypeFallbackUsed" ) ) ) >>= m_bMTFallbackUsed;
+ xPackageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MEDIATYPE_FALLBACK_USED_PROPERTY ) ) ) >>= m_bMTFallbackUsed;
xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ) ) >>= m_aMediaType;
m_bControlMediaType = sal_True;
@@ -750,9 +751,17 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes
{
try
{
- uno::Reference< embed::XEncryptionProtectedSource2 > xEncr( xDest, uno::UNO_QUERY );
+ uno::Reference< embed::XEncryptionProtectedStorage > xEncr( xDest, uno::UNO_QUERY );
if ( xEncr.is() )
+ {
xEncr->setEncryptionData( GetCommonRootEncryptionData().getAsConstNamedValueList() );
+
+ uno::Sequence< beans::NamedValue > aAlgorithms;
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_xPackage, uno::UNO_QUERY_THROW );
+ xPackPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) )
+ >>= aAlgorithms;
+ xEncr->setEncryptionAlgorithms( aAlgorithms );
+ }
}
catch( packages::NoEncryptionException& aNoEncryptionException )
{
@@ -985,7 +994,9 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement,
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Handled exception" ) ) );
// If the common storage password does not allow to open the stream
- // it must be copyed in raw way
+ // it could be copyed in raw way, the problem is that the StartKey should be the same
+ // in the ODF1.2 package, so an invalid package could be produced if the stream
+ // is copied from ODF1.1 package, where it is allowed to have different StartKeys
uno::Reference< embed::XStorageRawAccess > xRawDest( xDest, uno::UNO_QUERY_THROW );
uno::Reference< io::XInputStream > xRawInStream = pElement->m_pStream->GetRawInStream();
xRawDest->insertRawEncrStreamElement( aName, xRawInStream );
@@ -2278,7 +2289,8 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType )
( rType
, static_cast<embed::XStorageRawAccess*> ( this )
, static_cast<embed::XEncryptionProtectedSource*> ( this )
- , static_cast<embed::XEncryptionProtectedSource2*> ( this ) );
+ , static_cast<embed::XEncryptionProtectedSource2*> ( this )
+ , static_cast<embed::XEncryptionProtectedStorage*> ( this ) );
}
else
{
@@ -2338,6 +2350,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes()
, ::getCppuType( ( const uno::Reference< embed::XTransactedObject >* )NULL )
, ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL )
, ::getCppuType( ( const uno::Reference< util::XModifiable >* )NULL )
+ , ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedStorage >* )NULL )
, ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource2 >* )NULL )
, ::getCppuType( ( const uno::Reference< embed::XEncryptionProtectedSource >* )NULL )
, ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) );
@@ -4697,18 +4710,23 @@ void SAL_CALL OStorage::removeEncryption()
// TODO: check if the password is valid
// update all streams that was encrypted with old password
- uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY );
- if ( !xPackPropSet.is() )
- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
-
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
try
{
- xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ),
- uno::makeAny( uno::Sequence< sal_Int8 >() ) );
+ xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( uno::Sequence< beans::NamedValue >() ) );
m_pImpl->m_bHasCommonEncryptionData = sal_False;
m_pImpl->m_aCommonEncryptionData.clear();
}
+ catch( uno::RuntimeException& aRException )
+ {
+ m_pImpl->AddLog( aRException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ OSL_ENSURE( sal_False, "The call must not fail, it is pretty simple!" );
+ throw;
+ }
catch( uno::Exception& aException )
{
m_pImpl->AddLog( aException.Message );
@@ -4762,24 +4780,161 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
uno::Any aCaught( ::cppu::getCaughtException() );
+ throw lang::WrappedTargetRuntimeException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ),
+ uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ),
+ aCaught );
+ }
+
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
+ try
+ {
+ ::comphelper::SequenceAsHashMap aEncryptionMap( aEncryptionData );
+ xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ),
+ uno::makeAny( aEncryptionMap.getAsConstNamedValueList() ) );
+
+ m_pImpl->m_bHasCommonEncryptionData = sal_True;
+ m_pImpl->m_aCommonEncryptionData = aEncryptionMap;
+ }
+ catch( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+ }
+}
+
+//____________________________________________________________________________________________________
+// XEncryptionProtectedStorage
+//____________________________________________________________________________________________________
+
+//-----------------------------------------------
+void SAL_CALL OStorage::setEncryptionAlgorithms( const uno::Sequence< beans::NamedValue >& aAlgorithms )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::setEncryptionAlgorithms" );
+
+ ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() );
+
+ if ( !m_pImpl )
+ {
+ ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) );
+ throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+
+ if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage
+
+ if ( !aAlgorithms.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected empty encryption algorithms list!") ), uno::Reference< uno::XInterface >() );
+
+ OSL_ENSURE( m_pData->m_bIsRoot, "setEncryptionAlgorithms() method is not available for nonroot storages!\n" );
+ if ( m_pData->m_bIsRoot )
+ {
+ try {
+ m_pImpl->ReadContents();
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch ( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ uno::Any aCaught( ::cppu::getCaughtException() );
throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ),
uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
uno::UNO_QUERY ),
aCaught );
}
- uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY );
- if ( !xPackPropSet.is() )
- throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
-
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
try
{
- ::comphelper::SequenceAsHashMap aEncryptionMap( aEncryptionData );
- xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ),
- uno::makeAny( aEncryptionMap.getUnpackedValueOrDefault( PACKAGE_ENCRYPTIONDATA_SHA1UTF8, uno::Sequence< sal_Int8 >() ) ) );
+ xPackPropSet->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ),
+ uno::makeAny( aAlgorithms ) );
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch( lang::IllegalArgumentException& aIAException )
+ {
+ m_pImpl->AddLog( aIAException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
- m_pImpl->m_bHasCommonEncryptionData = sal_True;
- m_pImpl->m_aCommonEncryptionData = aEncryptionMap;
+ throw;
+ }
+ catch( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+ }
+}
+
+//-----------------------------------------------
+uno::Sequence< beans::NamedValue > SAL_CALL OStorage::getEncryptionAlgorithms()
+ throw (uno::RuntimeException)
+{
+ RTL_LOGFILE_CONTEXT( aLog, "package (mv76033) OStorage::getEncryptionAlgorithms" );
+
+ ::osl::MutexGuard aGuard( m_pData->m_rSharedMutexRef->GetMutex() );
+
+ if ( !m_pImpl )
+ {
+ ::package::StaticAddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Disposed!" ) ) );
+ throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ }
+
+ if ( m_pData->m_nStorageType != embed::StorageFormats::PACKAGE )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); // the interface must be visible only for package storage
+
+ uno::Sequence< beans::NamedValue > aResult;
+ OSL_ENSURE( m_pData->m_bIsRoot, "getEncryptionAlgorithms() method is not available for nonroot storages!\n" );
+ if ( m_pData->m_bIsRoot )
+ {
+ try {
+ m_pImpl->ReadContents();
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
+ }
+ catch ( uno::Exception& aException )
+ {
+ m_pImpl->AddLog( aException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+
+ uno::Any aCaught( ::cppu::getCaughtException() );
+ throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can not open package!\n" ) ),
+ uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
+ uno::UNO_QUERY ),
+ aCaught );
+ }
+
+ uno::Reference< beans::XPropertySet > xPackPropSet( m_pImpl->m_xPackage, uno::UNO_QUERY_THROW );
+ try
+ {
+ xPackPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) ) >>= aResult;
+ }
+ catch ( uno::RuntimeException& aRuntimeException )
+ {
+ m_pImpl->AddLog( aRuntimeException.Message );
+ m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
+ throw;
}
catch( uno::Exception& aException )
{
@@ -4790,6 +4945,7 @@ void SAL_CALL OStorage::setEncryptionData( const uno::Sequence< beans::NamedValu
}
}
+ return aResult;
}
@@ -4864,13 +5020,13 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName,
m_pImpl->m_bIsModified = sal_True;
}
}
- else if ( ( m_pData->m_bIsRoot && ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasEncryptedEntries" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasNonEncryptedEntries" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsInconsistent" ) )
+ else if ( ( m_pData->m_bIsRoot && ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_ENCRYPTED_ENTRIES_PROPERTY ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( IS_INCONSISTENT_PROPERTY ) )
|| aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) )
|| aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "RepairPackage" ) ) ) )
|| aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsRoot" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaTypeFallbackUsed" ) ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MEDIATYPE_FALLBACK_USED_PROPERTY ) ) )
throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else
throw beans::UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -4944,7 +5100,7 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa
if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE
&& ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaTypeFallbackUsed" ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MEDIATYPE_FALLBACK_USED_PROPERTY ) )
|| aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Version" ) ) ) )
{
try
@@ -5001,9 +5157,9 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa
return uno::makeAny( sal_False ); // RepairPackage
}
else if ( m_pData->m_nStorageType == embed::StorageFormats::PACKAGE
- && ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasEncryptedEntries" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "HasNonEncryptedEntries" ) )
- || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsInconsistent" ) ) ) )
+ && ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_ENCRYPTED_ENTRIES_PROPERTY ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) )
+ || aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( IS_INCONSISTENT_PROPERTY ) ) ) )
{
try {
m_pImpl->ReadContents();
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index 2811616424c0..f472444556c2 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -37,7 +37,7 @@
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
#include <com/sun/star/embed/XClassifiedObject.hpp>
-#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp>
+#include <com/sun/star/embed/XEncryptionProtectedStorage.hpp>
#include <com/sun/star/embed/XRelationshipAccess.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -297,7 +297,7 @@ class OStorage : public ::com::sun::star::lang::XTypeProvider
, public ::com::sun::star::embed::XTransactedObject
, public ::com::sun::star::embed::XTransactionBroadcaster
, public ::com::sun::star::util::XModifiable
- , public ::com::sun::star::embed::XEncryptionProtectedSource2
+ , public ::com::sun::star::embed::XEncryptionProtectedStorage
, public ::com::sun::star::beans::XPropertySet
, public ::com::sun::star::embed::XOptimizedStorage
, public ::com::sun::star::embed::XRelationshipAccess
@@ -647,6 +647,13 @@ public:
throw ( ::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException );
+ //____________________________________________________________________________________________________
+ // XEncryptionProtectedStorage
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL setEncryptionAlgorithms( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aAlgorithms ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getEncryptionAlgorithms() throw (::com::sun::star::uno::RuntimeException);
//____________________________________________________________________________________________________
// XPropertySet
diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx
index cd90de5b09e3..30318ce5c520 100644
--- a/package/source/zipapi/Deflater.cxx
+++ b/package/source/zipapi/Deflater.cxx
@@ -95,7 +95,7 @@ sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int
pStream->avail_in = nLength;
pStream->avail_out = nNewLength;
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
nResult = deflateParams(pStream, nLevel, nStrategy);
#else
nResult = z_deflateParams(pStream, nLevel, nStrategy);
@@ -121,7 +121,7 @@ sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > &rBuffer, sal_Int
pStream->avail_in = nLength;
pStream->avail_out = nNewLength;
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
nResult = deflate(pStream, bFinish ? Z_FINISH : Z_NO_FLUSH);
#else
nResult = z_deflate(pStream, bFinish ? Z_FINISH : Z_NO_FLUSH);
@@ -190,7 +190,7 @@ sal_Int32 SAL_CALL Deflater::getTotalOut( )
}
void SAL_CALL Deflater::reset( )
{
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIXB
deflateReset(pStream);
#else
z_deflateReset(pStream);
@@ -203,7 +203,7 @@ void SAL_CALL Deflater::end( )
{
if (pStream != NULL)
{
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
deflateEnd(pStream);
#else
z_deflateEnd(pStream);
diff --git a/package/source/zipapi/EntryInputStream.cxx b/package/source/zipapi/EntryInputStream.cxx
deleted file mode 100644
index 047f1716e0f5..000000000000
--- a/package/source/zipapi/EntryInputStream.cxx
+++ /dev/null
@@ -1,205 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_package.hxx"
-#include <EntryInputStream.hxx>
-#include <com/sun/star/packages/zip/ZipConstants.hpp>
-#include <rtl/cipher.h>
-#include <rtl/digest.h>
-#include <memory.h> // for memcpy
-
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::packages::zip;
-using namespace com::sun::star::packages::zip::ZipConstants;
-
-using ::rtl::OUString;
-
-/** Provides access to the compressed data in a zipfile.
- *
- * uncompresses the stream into memory and seeks on it 'in memory'
- * This and the ZipPackageBuffer used in the ZipOutputStream are memory hogs
- * and will hopefully be replaced eventually
- *
- * Acts on the same underlying XInputStream as both the full Zip File and other
- * EntryInputStreams, and thus must maintain its current position in the stream and
- * seek to it before performing any reads.
- */
-
-EntryInputStream::EntryInputStream( Reference < io::XInputStream > xNewInput,
- const ZipEntry & rNewEntry,
- const rtl::Reference < EncryptionData > &xEncryptData,
- sal_Bool bGetRawStream)
-: xStream( xNewInput )
-, xSeek( xNewInput, UNO_QUERY )
-, aEntry (rNewEntry )
-, nCurrent( 0 )
-, bHaveInMemory ( sal_False )
-, aInflater( sal_True )
-, aBuffer( 0 )
-, xEncryptionData (xEncryptData)
-, bRawStream (bGetRawStream)
-{
- if (bGetRawStream)
- {
- nUncompressedSize = aEntry.nMethod == DEFLATED ? aEntry.nCompressedSize : aEntry.nSize;
- nEnd = aEntry.nOffset + nUncompressedSize;
- }
- else
- {
- nEnd = aEntry.nMethod == DEFLATED ? aEntry.nOffset + aEntry.nCompressedSize : aEntry.nOffset + aEntry.nSize;
- nUncompressedSize = aEntry.nSize;
- }
-}
-void EntryInputStream::readIntoMemory()
- throw(io::NotConnectedException, io::BufferSizeExceededException, io::IOException, RuntimeException)
-{
- if (!bHaveInMemory)
- {
- Sequence < sal_Int8 > aReadBuffer;
- xSeek->seek(aEntry.nOffset);
- sal_Int32 nSize = aEntry.nMethod == DEFLATED ? aEntry.nCompressedSize : aEntry.nSize;
-
- if (nSize <0)
- throw io::BufferSizeExceededException(::rtl::OUString(), *this);
-
- xStream->readBytes( aReadBuffer, nSize ); // Now it holds the raw stuff from disk
-
- if (xEncryptionData->aSalt.getLength())
- {
- // Have salt, will travel
- Sequence < sal_uInt8 > aDerivedKey (16);
- rtlCipherError aResult;
- Sequence < sal_Int8 > aDecryptBuffer;
-
- // Get the key
- rtl_digest_PBKDF2 ( aDerivedKey.getArray(), 16,
- reinterpret_cast < const sal_uInt8 * > (xEncryptionData->aKey.getConstArray()),
- xEncryptionData->aKey.getLength(),
- xEncryptionData->aSalt.getConstArray(),
- xEncryptionData->aSalt.getLength(),
- xEncryptionData->nIterationCount );
-
- rtlCipher aCipher = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream);
- aResult = rtl_cipher_init( aCipher, rtl_Cipher_DirectionDecode,
- aDerivedKey.getConstArray(),
- aDerivedKey.getLength(),
- xEncryptionData->aInitVector.getConstArray(),
- xEncryptionData->aInitVector.getLength());
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
- aDecryptBuffer.realloc ( nSize );
- aResult = rtl_cipher_decode ( aCipher,
- aReadBuffer.getConstArray(),
- nSize,
- reinterpret_cast < sal_uInt8 * > (aDecryptBuffer.getArray()),
- nSize);
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
- aReadBuffer = aDecryptBuffer; // Now it holds the decrypted data
- }
- if (bRawStream || aEntry.nMethod == STORED)
- aBuffer = aReadBuffer; // bRawStream means the caller doesn't want it decompressed
- else
- {
- aInflater.setInputSegment(aReadBuffer, 0, nSize );
- aBuffer.realloc( aEntry.nSize );
- aInflater.doInflate(aBuffer);
- aInflater.end();
- }
- bHaveInMemory = sal_True;
- }
-}
-EntryInputStream::~EntryInputStream( void )
-{
-}
-
-sal_Int32 SAL_CALL EntryInputStream::readBytes( Sequence< sal_Int8 >& aData,
- sal_Int32 nBytesToRead )
- throw(io::NotConnectedException, io::BufferSizeExceededException, io::IOException, RuntimeException)
-{
- if (nBytesToRead <0)
- throw io::BufferSizeExceededException(::rtl::OUString(), *this);
- if (!bHaveInMemory)
- readIntoMemory();
- if (nBytesToRead + nCurrent > nUncompressedSize)
- nBytesToRead = static_cast < sal_Int32> ( nUncompressedSize - nCurrent );
-
- aData.realloc( nBytesToRead );
- memcpy(aData.getArray(), aBuffer.getConstArray() + nCurrent, nBytesToRead);
- nCurrent+=nBytesToRead;
-
- return nBytesToRead;
-}
-sal_Int32 SAL_CALL EntryInputStream::readSomeBytes( Sequence< sal_Int8 >& aData,
- sal_Int32 nMaxBytesToRead )
- throw(io::NotConnectedException, io::BufferSizeExceededException, io::IOException, RuntimeException)
-{
- return readBytes( aData, nMaxBytesToRead );
-}
-void SAL_CALL EntryInputStream::skipBytes( sal_Int32 nBytesToSkip )
- throw(io::NotConnectedException, io::BufferSizeExceededException, io::IOException, RuntimeException)
-{
- if (nBytesToSkip < 0)
- throw io::BufferSizeExceededException(::rtl::OUString(), *this);
-
- if (nBytesToSkip + nCurrent > nUncompressedSize)
- nBytesToSkip = static_cast < sal_Int32 > (nUncompressedSize- nCurrent);
-
- nCurrent+=nBytesToSkip;
-}
-sal_Int32 SAL_CALL EntryInputStream::available( )
- throw(io::NotConnectedException, io::IOException, RuntimeException)
-{
- return static_cast < sal_Int32 > (nUncompressedSize - nCurrent);
-}
-void SAL_CALL EntryInputStream::closeInput( )
- throw(io::NotConnectedException, io::IOException, RuntimeException)
-{
-}
-
-void SAL_CALL EntryInputStream::seek( sal_Int64 location )
- throw(lang::IllegalArgumentException, io::IOException, RuntimeException)
-{
- if (location > nUncompressedSize)
- location = nUncompressedSize;
- if (location <0)
- location = 0;
- nCurrent = location;
-}
-sal_Int64 SAL_CALL EntryInputStream::getPosition( )
- throw(io::IOException, RuntimeException)
-{
- return nCurrent;
-}
-sal_Int64 SAL_CALL EntryInputStream::getLength( )
- throw(io::IOException, RuntimeException)
-{
- return nUncompressedSize;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/EntryInputStream.hxx b/package/source/zipapi/EntryInputStream.hxx
deleted file mode 100644
index 8a5bf0dc835f..000000000000
--- a/package/source/zipapi/EntryInputStream.hxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-#ifndef _ENTRY_INPUT_STREAM_HXX
-#define _ENTRY_INPUT_STREAM_HXX
-
-#include <cppuhelper/implbase2.hxx> // helper for implementations
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <Inflater.hxx>
-#include <com/sun/star/packages/zip/ZipEntry.hpp>
-#include <rtl/ref.hxx>
-#include <EncryptionData.hxx>
-class EntryInputStream : public cppu::WeakImplHelper2< com::sun::star::io::XInputStream,
- com::sun::star::io::XSeekable >
-{
-protected:
- com::sun::star::uno::Reference< com::sun::star::io::XInputStream > xStream;
- com::sun::star::uno::Reference< com::sun::star::io::XSeekable > xSeek;
- sal_Int64 nEnd, nCurrent, nUncompressedSize;
- sal_Bool bRawStream, bHaveInMemory, bEncrypted;
- com::sun::star::uno::Sequence < sal_Int8 > aBuffer;
- const rtl::Reference < EncryptionData > xEncryptionData;
- const com::sun::star::packages::zip::ZipEntry aEntry;
- Inflater aInflater;
- void readIntoMemory()
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-public:
- EntryInputStream( com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xInput,
- const com::sun::star::packages::zip::ZipEntry &rNewEntry,
- const rtl::Reference < EncryptionData > &xEncryptData,
- sal_Bool bGetRawStream = sal_False);
- virtual ~EntryInputStream();
-
- // XInputStream
- virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL available( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeInput( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- // XSeekable
- virtual void SAL_CALL seek( sal_Int64 location )
- throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getPosition( )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLength( )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- /*
-private:
- void fill( void );
- */
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/Inflater.cxx b/package/source/zipapi/Inflater.cxx
index a32a0007f541..40d2bee99333 100644
--- a/package/source/zipapi/Inflater.cxx
+++ b/package/source/zipapi/Inflater.cxx
@@ -107,7 +107,7 @@ void SAL_CALL Inflater::end( )
{
if (pStream != NULL)
{
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
inflateEnd(pStream);
#else
z_inflateEnd(pStream);
@@ -132,7 +132,7 @@ sal_Int32 Inflater::doInflateBytes (Sequence < sal_Int8 > &rBuffer, sal_Int32 n
pStream->next_out = reinterpret_cast < unsigned char* > ( rBuffer.getArray() + nNewOffset );
pStream->avail_out = nNewLength;
-#ifdef SYSTEM_ZLIB
+#if defined SYSTEM_ZLIB || !defined ZLIB_PREFIX
sal_Int32 nResult = ::inflate(pStream, Z_PARTIAL_FLUSH);
#else
sal_Int32 nResult = ::z_inflate(pStream, Z_PARTIAL_FLUSH);
diff --git a/package/source/zipapi/MemoryByteGrabber.hxx b/package/source/zipapi/MemoryByteGrabber.hxx
index 5e167490d632..77315d0689db 100644
--- a/package/source/zipapi/MemoryByteGrabber.hxx
+++ b/package/source/zipapi/MemoryByteGrabber.hxx
@@ -63,7 +63,7 @@ public:
nBytesToRead = mnEnd - mnCurrent;
aData.realloc ( nBytesToRead );
- memcpy ( aData.getArray(), mpBuffer + mnCurrent, nBytesToRead );
+ rtl_copyMemory( aData.getArray(), mpBuffer + mnCurrent, nBytesToRead );
mnCurrent += nBytesToRead;
return nBytesToRead;
}
diff --git a/package/source/zipapi/XFileStream.cxx b/package/source/zipapi/XFileStream.cxx
deleted file mode 100644
index 6afe8079c5ec..000000000000
--- a/package/source/zipapi/XFileStream.cxx
+++ /dev/null
@@ -1,230 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_package.hxx"
-#include <XFileStream.hxx>
-#include <EncryptionData.hxx>
-#include <com/sun/star/packages/zip/ZipConstants.hpp>
-#include <PackageConstants.hxx>
-#include <rtl/cipher.h>
-#include <ZipFile.hxx>
-#include <EncryptedDataHeader.hxx>
-#include <com/sun/star/io/XOutputStream.hpp>
-
-using namespace com::sun::star::packages::zip::ZipConstants;
-using namespace com::sun::star::io;
-using namespace com::sun::star::uno;
-using com::sun::star::lang::IllegalArgumentException;
-using ::rtl::OUString;
-
-XFileStream::XFileStream( ZipEntry & rEntry,
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewTempStream,
- const rtl::Reference < EncryptionData > &rData,
- sal_Bool bNewRawStream,
- sal_Bool bIsEncrypted )
-: maEntry ( rEntry )
-, mxData ( rData )
-, mbRawStream ( bNewRawStream )
-, mbFinished ( sal_False )
-, mxTempIn ( xNewTempStream )
-, mxTempSeek ( xNewTempStream, UNO_QUERY )
-, mxTempOut ( xNewTempStream, UNO_QUERY )
-, mxZipStream ( xNewZipStream )
-, mxZipSeek ( xNewZipStream, UNO_QUERY )
-, maInflater ( sal_True )
-, maCipher ( NULL )
-{
- mnZipCurrent = maEntry.nOffset;
- if (mbRawStream)
- {
- mnZipSize = maEntry.nMethod == DEFLATED ? maEntry.nCompressedSize : maEntry.nSize;
- mnZipEnd = maEntry.nOffset + mnZipSize;
- }
- else
- {
- mnZipSize = maEntry.nSize;
- mnZipEnd = maEntry.nMethod == DEFLATED ? maEntry.nOffset + maEntry.nCompressedSize : maEntry.nOffset + maEntry.nSize;
- }
-
- if ( bIsEncrypted )
- {
- sal_Bool bHaveEncryptData = ( !rData.isEmpty() && rData->aSalt.getLength() && rData->aInitVector.getLength() && rData->nIterationCount != 0 ) ? sal_True : sal_False;
-
- // if we have all the encrypted data, and want a raw stream, then prepend it to the stream, otherwise
- // make a cipher so we can decrypt it
- if ( bHaveEncryptData )
- {
- if ( !bNewRawStream )
- ZipFile::StaticGetCipher ( rData, maCipher, sal_True );
- else
- {
- // Put in the EncryptedDataHeader
- Sequence < sal_Int8 > aEncryptedDataHeader ( n_ConstHeaderSize +
- rData->aInitVector.getLength() +
- rData->aSalt.getLength() +
- rData->aDigest.getLength() );
- sal_Int8 * pHeader = aEncryptedDataHeader.getArray();
- ZipFile::StaticFillHeader ( rData, rEntry.nSize, pHeader );
- mxTempOut->writeBytes ( aEncryptedDataHeader );
- mnZipSize += mxTempSeek->getPosition();
- mxTempSeek->seek ( 0 );
- }
- }
- }
-}
-
-XFileStream::~XFileStream()
-{
- if ( maCipher )
- rtl_cipher_destroy ( maCipher );
-}
-
-void XFileStream::fill( sal_Int64 nUntil)
-{
- sal_Int32 nRead;
- sal_Int64 nPosition = mxTempSeek->getPosition();
- mxTempSeek->seek ( mxTempSeek->getLength() );
- maBuffer.realloc ( n_ConstBufferSize );
-
- while ( mxTempSeek->getLength() < nUntil )
- {
- if ( !mbRawStream )
- {
- while ( 0 == ( nRead = maInflater.doInflate( maBuffer ) ) )
- {
- if ( maInflater.finished() || maInflater.needsDictionary() )
- {
- // some error handling ?
- return;
- }
-
- sal_Int64 nDiff = mnZipEnd - mnZipCurrent;
- if ( nDiff > 0 )
- {
- mxZipSeek->seek ( mnZipCurrent );
- nRead = mxZipStream->readBytes ( maCompBuffer, static_cast < sal_Int32 > ( nDiff < n_ConstBufferSize ? nDiff : n_ConstBufferSize ) );
- mnZipCurrent += nRead;
- // maCompBuffer now has the uncompressed data, check if we need to decrypt
- // before passing to the Inflater
- if ( maCipher )
- {
- Sequence < sal_Int8 > aCryptBuffer ( nRead );
- rtlCipherError aResult = rtl_cipher_decode ( maCipher,
- maCompBuffer.getConstArray(),
- nRead,
- reinterpret_cast < sal_uInt8 * > (aCryptBuffer.getArray()),
- nRead);
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
- maCompBuffer = aCryptBuffer; // Now it holds the decrypted data
-
- }
- maInflater.setInput ( maCompBuffer );
- }
- else
- {
- // some error handling ?
- return;
- }
- }
- }
- else
- {
- sal_Int64 nDiff = mnZipEnd - mnZipCurrent;
- mxZipSeek->seek ( mnZipCurrent );
- nRead = mxZipStream->readBytes ( maBuffer, static_cast < sal_Int32 > ( nDiff < n_ConstBufferSize ? nDiff : n_ConstBufferSize ) );
- mnZipCurrent += nRead;
- }
- Sequence < sal_Int8 > aTmpBuffer ( maBuffer.getConstArray(), nRead );
- mxTempOut->writeBytes ( aTmpBuffer );
- }
- mxTempSeek->seek ( nPosition );
-}
-
-sal_Int32 SAL_CALL XFileStream::readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
-{
- sal_Int64 nPosition = mxTempSeek->getPosition();
- if ( nPosition + nBytesToRead > mnZipSize )
- nBytesToRead = static_cast < sal_Int32 > ( mnZipSize - nPosition );
-
- sal_Int64 nUntil = nBytesToRead + nPosition + n_ConstBufferSize;
- if (nUntil > mnZipSize )
- nUntil = mnZipSize;
- if ( nUntil > mxTempSeek->getLength() )
- fill ( nUntil );
- sal_Int32 nRead = mxTempIn->readBytes ( aData, nBytesToRead );
- return nRead;
-}
-
-sal_Int32 SAL_CALL XFileStream::readSomeBytes( Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
- throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
-{
- return readBytes ( aData, nMaxBytesToRead );
-}
-void SAL_CALL XFileStream::skipBytes( sal_Int32 nBytesToSkip )
- throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
-{
- seek ( mxTempSeek->getPosition() + nBytesToSkip );
-}
-
-sal_Int32 SAL_CALL XFileStream::available( )
- throw( NotConnectedException, IOException, RuntimeException)
-{
- return static_cast < sal_Int32 > ( mnZipSize - mxTempSeek->getPosition() );
-}
-
-void SAL_CALL XFileStream::closeInput( )
- throw( NotConnectedException, IOException, RuntimeException)
-{
-}
-void SAL_CALL XFileStream::seek( sal_Int64 location )
- throw( IllegalArgumentException, IOException, RuntimeException)
-{
- if ( location > mnZipSize || location < 0 )
- throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 );
- if ( location > mxTempSeek->getLength() )
- {
- sal_Int64 nUntil = location + n_ConstBufferSize > mnZipSize ? mnZipSize : location + n_ConstBufferSize;
- fill ( nUntil );
- }
- mxTempSeek->seek ( location );
-}
-sal_Int64 SAL_CALL XFileStream::getPosition( )
- throw(IOException, RuntimeException)
-{
- return mxTempSeek->getPosition();
-}
-sal_Int64 SAL_CALL XFileStream::getLength( )
- throw(IOException, RuntimeException)
-{
- return mnZipSize;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/XFileStream.hxx b/package/source/zipapi/XFileStream.hxx
deleted file mode 100644
index 51518de9591c..000000000000
--- a/package/source/zipapi/XFileStream.hxx
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-#ifndef _XFILE_STREAM_HXX
-#define _XFILE_STREAM_HXX
-
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <rtl/ref.hxx>
-#include <Inflater.hxx>
-#include <ZipEntry.hxx>
-
-namespace com { namespace sun { namespace star {
- namespace io { class XOutputStream; }
-} } }
-class EncryptionData;
-typedef void* rtlCipher;
-class XFileStream : public cppu::WeakImplHelper2
-<
- com::sun::star::io::XInputStream,
- com::sun::star::io::XSeekable
->
-{
-protected:
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > mxZipStream;
- com::sun::star::uno::Reference < com::sun::star::io::XSeekable > mxZipSeek;
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > mxTempIn;
- com::sun::star::uno::Reference < com::sun::star::io::XSeekable > mxTempSeek;
- com::sun::star::uno::Reference < com::sun::star::io::XOutputStream > mxTempOut;
- com::sun::star::uno::Sequence < sal_Int8 > maBuffer, maCompBuffer;
- ZipEntry maEntry;
- rtl::Reference < EncryptionData > mxData;
- rtlCipher maCipher;
- Inflater maInflater;
- sal_Bool mbRawStream, mbFinished;
- sal_Int64 mnZipCurrent, mnZipEnd, mnZipSize;
- void fill( sal_Int64 nUntil );
-
-public:
- XFileStream( ZipEntry & rEntry,
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
- com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewTempStream,
- const rtl::Reference < EncryptionData > &rData,
- sal_Bool bRawStream,
- sal_Bool bIsEncrypted );
- virtual ~XFileStream();
-
- // XInputStream
- virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL available( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeInput( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- // XSeekable
- virtual void SAL_CALL seek( sal_Int64 location )
- throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getPosition( )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLength( )
- throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/XMemoryStream.cxx b/package/source/zipapi/XMemoryStream.cxx
deleted file mode 100644
index 7003bf1b814b..000000000000
--- a/package/source/zipapi/XMemoryStream.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_package.hxx"
-#include <XMemoryStream.hxx>
-
-using namespace com::sun::star::io;
-using namespace com::sun::star::uno;
-
-XMemoryStream::XMemoryStream ( com::sun::star::uno::Sequence < sal_Int8 > & rNewBuffer )
-: ZipPackageBuffer ( rNewBuffer )
-{
-}
-XMemoryStream::~XMemoryStream(void)
-{
-}
-::com::sun::star::uno::Any SAL_CALL XMemoryStream::queryInterface( const com::sun::star::uno::Type& rType )
- throw(com::sun::star::uno::RuntimeException)
-{
- return ::cppu::queryInterface ( rType ,
- // OWeakObject interfaces
- reinterpret_cast< XInterface* > ( this ) ,
- static_cast< XWeak* > ( this ) ,
- // my interfaces
- static_cast< XInputStream* > ( this ) ,
- static_cast< XSeekable* > ( this ) );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx
index 1cad883f972a..a6049fd2cbef 100644
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@ -28,12 +28,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_package.hxx"
-#include <XUnbufferedStream.hxx>
-#include <EncryptionData.hxx>
+
#include <com/sun/star/packages/zip/ZipConstants.hpp>
#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
+
+#include <XUnbufferedStream.hxx>
+#include <EncryptionData.hxx>
#include <PackageConstants.hxx>
-#include <rtl/cipher.h>
#include <ZipFile.hxx>
#include <EncryptedDataHeader.hxx>
#include <algorithm>
@@ -48,6 +50,7 @@
using namespace ::com::sun::star;
#endif
+using namespace ::com::sun::star;
using namespace com::sun::star::packages::zip::ZipConstants;
using namespace com::sun::star::io;
using namespace com::sun::star::uno;
@@ -55,20 +58,22 @@ using com::sun::star::lang::IllegalArgumentException;
using com::sun::star::packages::zip::ZipIOException;
using ::rtl::OUString;
-XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder,
- ZipEntry & rEntry,
- Reference < XInputStream > xNewZipStream,
- const rtl::Reference < EncryptionData > &rData,
- sal_Int8 nStreamMode,
- sal_Bool bIsEncrypted,
- const ::rtl::OUString& aMediaType,
- sal_Bool bRecoveryMode )
+XUnbufferedStream::XUnbufferedStream(
+ const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ SotMutexHolderRef aMutexHolder,
+ ZipEntry & rEntry,
+ Reference < XInputStream > xNewZipStream,
+ const ::rtl::Reference< EncryptionData >& rData,
+ sal_Int8 nStreamMode,
+ sal_Bool bIsEncrypted,
+ const ::rtl::OUString& aMediaType,
+ sal_Bool bRecoveryMode )
: maMutexHolder( aMutexHolder.Is() ? aMutexHolder : SotMutexHolderRef( new SotMutexHolder ) )
, mxZipStream ( xNewZipStream )
, mxZipSeek ( xNewZipStream, UNO_QUERY )
, maEntry ( rEntry )
, mxData ( rData )
-, maCipher ( NULL )
+, mnBlockSize( 1 )
, maInflater ( sal_True )
, mbRawStream ( nStreamMode == UNBUFF_STREAM_RAW || nStreamMode == UNBUFF_STREAM_WRAPPEDRAW )
, mbWrappedRaw ( nStreamMode == UNBUFF_STREAM_WRAPPEDRAW )
@@ -91,11 +96,15 @@ XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder,
mnZipSize = maEntry.nSize;
mnZipEnd = maEntry.nMethod == DEFLATED ? maEntry.nOffset + maEntry.nCompressedSize : maEntry.nOffset + maEntry.nSize;
}
- sal_Bool bHaveEncryptData = ( rData.is() && rData->aSalt.getLength() && rData->aInitVector.getLength() && rData->nIterationCount != 0 ) ? sal_True : sal_False;
+ sal_Bool bHaveEncryptData = ( rData.is() && rData->m_aSalt.getLength() && rData->m_aInitVector.getLength() && rData->m_nIterationCount != 0 ) ? sal_True : sal_False;
sal_Bool bMustDecrypt = ( nStreamMode == UNBUFF_STREAM_DATA && bHaveEncryptData && bIsEncrypted ) ? sal_True : sal_False;
if ( bMustDecrypt )
- ZipFile::StaticGetCipher ( rData, maCipher, sal_True );
+ {
+ m_xCipherContext = ZipFile::StaticGetCipher( xFactory, rData, false );
+ mnBlockSize = ( rData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING ? 16 : 1 );
+ }
+
if ( bHaveEncryptData && mbWrappedRaw && bIsEncrypted )
{
// if we have the data needed to decrypt it, but didn't want it decrypted (or
@@ -104,24 +113,26 @@ XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder,
// Make a buffer big enough to hold both the header and the data itself
maHeader.realloc ( n_ConstHeaderSize +
- rData->aInitVector.getLength() +
- rData->aSalt.getLength() +
- rData->aDigest.getLength() +
+ rData->m_aInitVector.getLength() +
+ rData->m_aSalt.getLength() +
+ rData->m_aDigest.getLength() +
aMediaType.getLength() * sizeof( sal_Unicode ) );
sal_Int8 * pHeader = maHeader.getArray();
- ZipFile::StaticFillHeader ( rData, rEntry.nSize, aMediaType, pHeader );
+ ZipFile::StaticFillHeader( rData, rEntry.nSize, aMediaType, pHeader );
mnHeaderToRead = static_cast < sal_Int16 > ( maHeader.getLength() );
}
}
// allows to read package raw stream
-XUnbufferedStream::XUnbufferedStream( const Reference < XInputStream >& xRawStream,
- const rtl::Reference < EncryptionData > &rData )
+XUnbufferedStream::XUnbufferedStream(
+ const uno::Reference< lang::XMultiServiceFactory >& /*xFactory*/,
+ const Reference < XInputStream >& xRawStream,
+ const ::rtl::Reference< EncryptionData >& rData )
: maMutexHolder( new SotMutexHolder )
, mxZipStream ( xRawStream )
, mxZipSeek ( xRawStream, UNO_QUERY )
, mxData ( rData )
-, maCipher ( NULL )
+, mnBlockSize( 1 )
, maInflater ( sal_True )
, mbRawStream ( sal_False )
, mbWrappedRaw ( sal_False )
@@ -137,8 +148,8 @@ XUnbufferedStream::XUnbufferedStream( const Reference < XInputStream >& xRawStre
OSL_ENSURE( mxZipSeek.is(), "The stream must be seekable!\n" );
// skip raw header, it must be already parsed to rData
- mnZipCurrent = n_ConstHeaderSize + rData->aInitVector.getLength() +
- rData->aSalt.getLength() + rData->aDigest.getLength();
+ mnZipCurrent = n_ConstHeaderSize + rData->m_aInitVector.getLength() +
+ rData->m_aSalt.getLength() + rData->m_aDigest.getLength();
try {
if ( mxZipSeek.is() )
@@ -150,13 +161,12 @@ XUnbufferedStream::XUnbufferedStream( const Reference < XInputStream >& xRawStre
mnZipEnd = mnZipCurrent + mnZipSize;
- ZipFile::StaticGetCipher ( rData, maCipher, sal_True );
+ // the raw data will not be decrypted, no need for the cipher
+ // m_xCipherContext = ZipFile::StaticGetCipher( xFactory, rData, false );
}
XUnbufferedStream::~XUnbufferedStream()
{
- if ( maCipher )
- rtl_cipher_destroy ( maCipher );
}
sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
@@ -183,7 +193,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
{
sal_Int16 nHeadRead = static_cast< sal_Int16 >(( nRequestedBytes > mnHeaderToRead ?
mnHeaderToRead : nRequestedBytes ));
- memcpy ( aData.getArray(), maHeader.getConstArray() + maHeader.getLength() - mnHeaderToRead, nHeadRead );
+ rtl_copyMemory ( aData.getArray(), maHeader.getConstArray() + maHeader.getLength() - mnHeaderToRead, nHeadRead );
mnHeaderToRead = mnHeaderToRead - nHeadRead;
if ( nHeadRead < nRequestedBytes )
@@ -245,12 +255,17 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "Dictionaries are not supported!" ) ),
Reference< XInterface >() );
- sal_Int32 nDiff = static_cast < sal_Int32 > ( mnZipEnd - mnZipCurrent );
+ sal_Int32 nDiff = static_cast< sal_Int32 >( mnZipEnd - mnZipCurrent );
if ( nDiff > 0 )
{
mxZipSeek->seek ( mnZipCurrent );
- sal_Int32 nToRead = std::min ( nDiff, std::max ( nRequestedBytes, static_cast< sal_Int32 >( 8192 ) ) );
- sal_Int32 nZipRead = mxZipStream->readBytes ( maCompBuffer, nToRead );
+
+ sal_Int32 nToRead = std::max( nRequestedBytes, static_cast< sal_Int32 >( 8192 ) );
+ if ( mnBlockSize > 1 )
+ nToRead = nToRead + mnBlockSize - nToRead % mnBlockSize;
+ nToRead = std::min( nDiff, nToRead );
+
+ sal_Int32 nZipRead = mxZipStream->readBytes( maCompBuffer, nToRead );
if ( nZipRead < nToRead )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "No expected data!" ) ),
Reference< XInterface >() );
@@ -258,23 +273,22 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
mnZipCurrent += nZipRead;
// maCompBuffer now has the data, check if we need to decrypt
// before passing to the Inflater
- if ( maCipher )
+ if ( m_xCipherContext.is() )
{
if ( mbCheckCRC )
maCRC.update( maCompBuffer );
- Sequence < sal_Int8 > aCryptBuffer ( nZipRead );
- rtlCipherError aResult =
- rtl_cipher_decode ( maCipher,
- maCompBuffer.getConstArray(),
- nZipRead,
- reinterpret_cast < sal_uInt8 * > (aCryptBuffer.getArray()),
- nZipRead);
- if( aResult != rtl_Cipher_E_None ) {
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
+ maCompBuffer = m_xCipherContext->convertWithCipherContext( maCompBuffer );
+ if ( mnZipCurrent == mnZipEnd )
+ {
+ uno::Sequence< sal_Int8 > aSuffix = m_xCipherContext->finalizeCipherContextAndDispose();
+ if ( aSuffix.getLength() )
+ {
+ sal_Int32 nOldLen = maCompBuffer.getLength();
+ maCompBuffer.realloc( nOldLen + aSuffix.getLength() );
+ rtl_copyMemory( maCompBuffer.getArray() + nOldLen, aSuffix.getConstArray(), aSuffix.getLength() );
+ }
}
- maCompBuffer = aCryptBuffer; // Now it holds the decrypted data
-
}
maInflater.setInput ( maCompBuffer );
}
@@ -293,7 +307,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
if ( mbCheckCRC && ( !mbRawStream || mbWrappedRaw ) )
{
- if ( !maCipher && !mbWrappedRaw )
+ if ( !m_xCipherContext.is() && !mbWrappedRaw )
maCRC.update( aData );
#if 0
diff --git a/package/source/zipapi/XUnbufferedStream.hxx b/package/source/zipapi/XUnbufferedStream.hxx
index 320031f515dd..43a659485c24 100644
--- a/package/source/zipapi/XUnbufferedStream.hxx
+++ b/package/source/zipapi/XUnbufferedStream.hxx
@@ -32,6 +32,8 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+
#include <cppuhelper/implbase1.hxx>
#include <rtl/ref.hxx>
#include <Inflater.hxx>
@@ -44,7 +46,6 @@
#define UNBUFF_STREAM_WRAPPEDRAW 2
class EncryptionData;
-typedef void* rtlCipher;
class XUnbufferedStream : public cppu::WeakImplHelper1
<
com::sun::star::io::XInputStream
@@ -57,8 +58,9 @@ protected:
com::sun::star::uno::Reference < com::sun::star::io::XSeekable > mxZipSeek;
com::sun::star::uno::Sequence < sal_Int8 > maCompBuffer, maHeader;
ZipEntry maEntry;
- rtl::Reference < EncryptionData > mxData;
- rtlCipher maCipher;
+ ::rtl::Reference< EncryptionData > mxData;
+ sal_Int32 mnBlockSize;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > m_xCipherContext;
ZipUtils::Inflater maInflater;
sal_Bool mbRawStream, mbWrappedRaw, mbFinished;
sal_Int16 mnHeaderToRead;
@@ -68,18 +70,21 @@ protected:
public:
XUnbufferedStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference< EncryptionData >& rData,
sal_Int8 nStreamMode,
sal_Bool bIsEncrypted,
const ::rtl::OUString& aMediaType,
sal_Bool bRecoveryMode );
// allows to read package raw stream
- XUnbufferedStream( const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xRawStream,
- const rtl::Reference < EncryptionData > &rData );
+ XUnbufferedStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xRawStream,
+ const ::rtl::Reference< EncryptionData >& rData );
virtual ~XUnbufferedStream();
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 4c6115f21768..13b7ba05e600 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -28,29 +28,36 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_package.hxx"
-#include <ZipFile.hxx>
-#include <ZipEnumeration.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <com/sun/star/packages/zip/ZipConstants.hpp>
-#include <rtl/cipher.h>
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
+#include <com/sun/star/xml/crypto/XCipherContextSupplier.hpp>
+#include <com/sun/star/xml/crypto/XDigestContextSupplier.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/processfactory.hxx>
#include <rtl/digest.h>
-/*
-#include <XMemoryStream.hxx>
-#include <XFileStream.hxx>
-*/
+
+#include <vector>
+
+#include "blowfishcontext.hxx"
+#include "sha1context.hxx"
+#include <ZipFile.hxx>
+#include <ZipEnumeration.hxx>
#include <XUnbufferedStream.hxx>
#include <PackageConstants.hxx>
#include <EncryptedDataHeader.hxx>
#include <EncryptionData.hxx>
#include <MemoryByteGrabber.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <CRC32.hxx>
-#include <string.h> // for memcpy
-#include <vector>
-
-#include <comphelper/storagehelper.hxx>
+#define AES_CBC_BLOCK_SIZE 16
using namespace com::sun::star;
using namespace com::sun::star::io;
@@ -66,13 +73,13 @@ using ZipUtils::Inflater;
/** This class is used to read entries from a zip file
*/
-ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise )
+ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise )
throw(IOException, ZipException, RuntimeException)
: aGrabber(xInput)
, aInflater (sal_True)
, xStream(xInput)
, xSeek(xInput, UNO_QUERY)
-, xFactory ( xNewFactory )
+, m_xFactory ( xNewFactory )
, bRecoveryMode( sal_False )
{
if (bInitialise)
@@ -80,20 +87,20 @@ ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiSe
if ( readCEN() == -1 )
{
aEntries.clear();
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), uno::Reference < XInterface > () );
}
}
}
-ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise, sal_Bool bForceRecovery, Reference < XProgressHandler > xProgress )
+ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise, sal_Bool bForceRecovery, uno::Reference < XProgressHandler > xProgress )
throw(IOException, ZipException, RuntimeException)
: aGrabber(xInput)
, aInflater (sal_True)
, xStream(xInput)
, xSeek(xInput, UNO_QUERY)
-, xFactory ( xNewFactory )
+, m_xFactory ( xNewFactory )
, xProgressHandler( xProgress )
, bRecoveryMode( bForceRecovery )
{
@@ -106,7 +113,7 @@ ZipFile::ZipFile( Reference < XInputStream > &xInput, const Reference < XMultiSe
else if ( readCEN() == -1 )
{
aEntries.clear();
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), uno::Reference < XInterface > () );
}
}
}
@@ -116,55 +123,94 @@ ZipFile::~ZipFile()
aEntries.clear();
}
-void ZipFile::setInputStream ( Reference < XInputStream > xNewStream )
+void ZipFile::setInputStream ( uno::Reference < XInputStream > xNewStream )
{
::osl::MutexGuard aGuard( m_aMutex );
xStream = xNewStream;
- xSeek = Reference < XSeekable > ( xStream, UNO_QUERY );
+ xSeek = uno::Reference < XSeekable > ( xStream, UNO_QUERY );
aGrabber.setInputStream ( xStream );
}
-sal_Bool ZipFile::StaticGetCipher ( const rtl::Reference < EncryptionData > & xEncryptionData, rtlCipher &rCipher, sal_Bool bDecode )
+uno::Reference< xml::crypto::XDigestContext > ZipFile::StaticGetDigestContextForChecksum( const uno::Reference< lang::XMultiServiceFactory >& xArgFactory, const ::rtl::Reference< EncryptionData >& xEncryptionData )
{
- sal_Bool bResult = sal_False;
- if ( xEncryptionData.is() )
+ uno::Reference< xml::crypto::XDigestContext > xDigestContext;
+ if ( xEncryptionData->m_nCheckAlg == xml::crypto::DigestID::SHA256_1K )
{
- Sequence < sal_uInt8 > aDerivedKey (16);
- rtlCipherError aResult;
- Sequence < sal_Int8 > aDecryptBuffer;
-
- // Get the key
- rtl_digest_PBKDF2 ( aDerivedKey.getArray(), 16,
- reinterpret_cast < const sal_uInt8 * > (xEncryptionData->aKey.getConstArray() ),
- xEncryptionData->aKey.getLength(),
- reinterpret_cast < const sal_uInt8 * > ( xEncryptionData->aSalt.getConstArray() ),
- xEncryptionData->aSalt.getLength(),
- xEncryptionData->nIterationCount );
-
- rCipher = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream);
- aResult = rtl_cipher_init( rCipher, bDecode ? rtl_Cipher_DirectionDecode : rtl_Cipher_DirectionEncode,
- aDerivedKey.getConstArray(),
- aDerivedKey.getLength(),
- reinterpret_cast < const sal_uInt8 * > ( xEncryptionData->aInitVector.getConstArray() ),
- xEncryptionData->aInitVector.getLength());
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
-
- bResult = ( aResult == rtl_Cipher_E_None );
+ uno::Reference< lang::XMultiServiceFactory > xFactory = xArgFactory;
+ if ( !xFactory.is() )
+ xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+
+ uno::Reference< xml::crypto::XDigestContextSupplier > xDigestContextSupplier(
+ xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.crypto.NSSInitializer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ xDigestContext.set( xDigestContextSupplier->getDigestContext( xEncryptionData->m_nCheckAlg, uno::Sequence< beans::NamedValue >() ), uno::UNO_SET_THROW );
}
+ else if ( xEncryptionData->m_nCheckAlg == xml::crypto::DigestID::SHA1_1K )
+ xDigestContext.set( SHA1DigestContext::Create(), uno::UNO_SET_THROW );
- return bResult;
+ return xDigestContext;
}
-void ZipFile::StaticFillHeader ( const rtl::Reference < EncryptionData > & rData,
+uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const uno::Reference< lang::XMultiServiceFactory >& xArgFactory, const ::rtl::Reference< EncryptionData >& xEncryptionData, bool bEncrypt )
+{
+ uno::Reference< xml::crypto::XCipherContext > xResult;
+
+ try
+ {
+ uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize );
+ if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ),
+ aDerivedKey.getLength(),
+ reinterpret_cast< const sal_uInt8 * > (xEncryptionData->m_aKey.getConstArray() ),
+ xEncryptionData->m_aKey.getLength(),
+ reinterpret_cast< const sal_uInt8 * > ( xEncryptionData->m_aSalt.getConstArray() ),
+ xEncryptionData->m_aSalt.getLength(),
+ xEncryptionData->m_nIterationCount ) )
+ {
+ throw ZipIOException( ::rtl::OUString::createFromAscii( "Can not create derived key!\n" ),
+ uno::Reference< XInterface >() );
+ }
+
+ if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory = xArgFactory;
+ if ( !xFactory.is() )
+ xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+
+ uno::Reference< xml::crypto::XCipherContextSupplier > xCipherContextSupplier(
+ xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.crypto.NSSInitializer" ) ) ),
+ uno::UNO_QUERY_THROW );
+
+ xResult = xCipherContextSupplier->getCipherContext( xEncryptionData->m_nEncAlg, aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt, uno::Sequence< beans::NamedValue >() );
+ }
+ else if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::BLOWFISH_CFB_8 )
+ {
+ xResult = BlowfishCFB8CipherContext::Create( aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt );
+ }
+ else
+ {
+ throw ZipIOException( ::rtl::OUString::createFromAscii( "Unknown cipher algorithm is requested!\n" ),
+ uno::Reference< XInterface >() );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "Can not create cipher context!" );
+ }
+
+ return xResult;
+}
+
+void ZipFile::StaticFillHeader( const ::rtl::Reference< EncryptionData >& rData,
sal_Int32 nSize,
const ::rtl::OUString& aMediaType,
sal_Int8 * & pHeader )
{
// I think it's safe to restrict vector and salt length to 2 bytes !
- sal_Int16 nIVLength = static_cast < sal_Int16 > ( rData->aInitVector.getLength() );
- sal_Int16 nSaltLength = static_cast < sal_Int16 > ( rData->aSalt.getLength() );
- sal_Int16 nDigestLength = static_cast < sal_Int16 > ( rData->aDigest.getLength() );
+ sal_Int16 nIVLength = static_cast < sal_Int16 > ( rData->m_aInitVector.getLength() );
+ sal_Int16 nSaltLength = static_cast < sal_Int16 > ( rData->m_aSalt.getLength() );
+ sal_Int16 nDigestLength = static_cast < sal_Int16 > ( rData->m_aDigest.getLength() );
sal_Int16 nMediaTypeLength = static_cast < sal_Int16 > ( aMediaType.getLength() * sizeof( sal_Unicode ) );
// First the header
@@ -178,7 +224,7 @@ void ZipFile::StaticFillHeader ( const rtl::Reference < EncryptionData > & rData
*(pHeader++) = ( n_ConstCurrentVersion >> 8 ) & 0xFF;
// Then the iteration Count
- sal_Int32 nIterationCount = rData->nIterationCount;
+ sal_Int32 nIterationCount = rData->m_nIterationCount;
*(pHeader++) = static_cast< sal_Int8 >(( nIterationCount >> 0 ) & 0xFF);
*(pHeader++) = static_cast< sal_Int8 >(( nIterationCount >> 8 ) & 0xFF);
*(pHeader++) = static_cast< sal_Int8 >(( nIterationCount >> 16 ) & 0xFF);
@@ -190,6 +236,34 @@ void ZipFile::StaticFillHeader ( const rtl::Reference < EncryptionData > & rData
*(pHeader++) = static_cast< sal_Int8 >(( nSize >> 16 ) & 0xFF);
*(pHeader++) = static_cast< sal_Int8 >(( nSize >> 24 ) & 0xFF);
+ // Then the encryption algorithm
+ sal_Int32 nEncAlgID = rData->m_nEncAlg;
+ *(pHeader++) = static_cast< sal_Int8 >(( nEncAlgID >> 0 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nEncAlgID >> 8 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nEncAlgID >> 16 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nEncAlgID >> 24 ) & 0xFF);
+
+ // Then the checksum algorithm
+ sal_Int32 nChecksumAlgID = rData->m_nCheckAlg;
+ *(pHeader++) = static_cast< sal_Int8 >(( nChecksumAlgID >> 0 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nChecksumAlgID >> 8 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nChecksumAlgID >> 16 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nChecksumAlgID >> 24 ) & 0xFF);
+
+ // Then the derived key size
+ sal_Int32 nDerivedKeySize = rData->m_nDerivedKeySize;
+ *(pHeader++) = static_cast< sal_Int8 >(( nDerivedKeySize >> 0 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nDerivedKeySize >> 8 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nDerivedKeySize >> 16 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nDerivedKeySize >> 24 ) & 0xFF);
+
+ // Then the start key generation algorithm
+ sal_Int32 nKeyAlgID = rData->m_nStartKeyGenID;
+ *(pHeader++) = static_cast< sal_Int8 >(( nKeyAlgID >> 0 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nKeyAlgID >> 8 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nKeyAlgID >> 16 ) & 0xFF);
+ *(pHeader++) = static_cast< sal_Int8 >(( nKeyAlgID >> 24 ) & 0xFF);
+
// Then the salt length
*(pHeader++) = static_cast< sal_Int8 >(( nSaltLength >> 0 ) & 0xFF);
*(pHeader++) = static_cast< sal_Int8 >(( nSaltLength >> 8 ) & 0xFF);
@@ -207,26 +281,30 @@ void ZipFile::StaticFillHeader ( const rtl::Reference < EncryptionData > & rData
*(pHeader++) = static_cast< sal_Int8 >(( nMediaTypeLength >> 8 ) & 0xFF);
// Then the salt content
- memcpy ( pHeader, rData->aSalt.getConstArray(), nSaltLength );
+ rtl_copyMemory ( pHeader, rData->m_aSalt.getConstArray(), nSaltLength );
pHeader += nSaltLength;
// Then the IV content
- memcpy ( pHeader, rData->aInitVector.getConstArray(), nIVLength );
+ rtl_copyMemory ( pHeader, rData->m_aInitVector.getConstArray(), nIVLength );
pHeader += nIVLength;
// Then the digest content
- memcpy ( pHeader, rData->aDigest.getConstArray(), nDigestLength );
+ rtl_copyMemory ( pHeader, rData->m_aDigest.getConstArray(), nDigestLength );
pHeader += nDigestLength;
// Then the mediatype itself
- memcpy ( pHeader, aMediaType.getStr(), nMediaTypeLength );
+ rtl_copyMemory ( pHeader, aMediaType.getStr(), nMediaTypeLength );
pHeader += nMediaTypeLength;
}
-sal_Bool ZipFile::StaticFillData ( rtl::Reference < EncryptionData > & rData,
+sal_Bool ZipFile::StaticFillData ( ::rtl::Reference< BaseEncryptionData > & rData,
+ sal_Int32 &rEncAlg,
+ sal_Int32 &rChecksumAlg,
+ sal_Int32 &rDerivedKeySize,
+ sal_Int32 &rStartKeyGenID,
sal_Int32 &rSize,
::rtl::OUString& aMediaType,
- Reference < XInputStream > &rStream )
+ const uno::Reference< XInputStream >& rStream )
{
sal_Bool bOk = sal_False;
const sal_Int32 nHeaderSize = n_ConstHeaderSize - 4;
@@ -243,13 +321,33 @@ sal_Bool ZipFile::StaticFillData ( rtl::Reference < EncryptionData > & rData,
nCount |= ( pBuffer[nPos++] & 0xFF ) << 8;
nCount |= ( pBuffer[nPos++] & 0xFF ) << 16;
nCount |= ( pBuffer[nPos++] & 0xFF ) << 24;
- rData->nIterationCount = nCount;
+ rData->m_nIterationCount = nCount;
rSize = pBuffer[nPos++] & 0xFF;
rSize |= ( pBuffer[nPos++] & 0xFF ) << 8;
rSize |= ( pBuffer[nPos++] & 0xFF ) << 16;
rSize |= ( pBuffer[nPos++] & 0xFF ) << 24;
+ rEncAlg = pBuffer[nPos++] & 0xFF;
+ rEncAlg |= ( pBuffer[nPos++] & 0xFF ) << 8;
+ rEncAlg |= ( pBuffer[nPos++] & 0xFF ) << 16;
+ rEncAlg |= ( pBuffer[nPos++] & 0xFF ) << 24;
+
+ rChecksumAlg = pBuffer[nPos++] & 0xFF;
+ rChecksumAlg |= ( pBuffer[nPos++] & 0xFF ) << 8;
+ rChecksumAlg |= ( pBuffer[nPos++] & 0xFF ) << 16;
+ rChecksumAlg |= ( pBuffer[nPos++] & 0xFF ) << 24;
+
+ rDerivedKeySize = pBuffer[nPos++] & 0xFF;
+ rDerivedKeySize |= ( pBuffer[nPos++] & 0xFF ) << 8;
+ rDerivedKeySize |= ( pBuffer[nPos++] & 0xFF ) << 16;
+ rDerivedKeySize |= ( pBuffer[nPos++] & 0xFF ) << 24;
+
+ rStartKeyGenID = pBuffer[nPos++] & 0xFF;
+ rStartKeyGenID |= ( pBuffer[nPos++] & 0xFF ) << 8;
+ rStartKeyGenID |= ( pBuffer[nPos++] & 0xFF ) << 16;
+ rStartKeyGenID |= ( pBuffer[nPos++] & 0xFF ) << 24;
+
sal_Int16 nSaltLength = pBuffer[nPos++] & 0xFF;
nSaltLength |= ( pBuffer[nPos++] & 0xFF ) << 8;
sal_Int16 nIVLength = ( pBuffer[nPos++] & 0xFF );
@@ -262,16 +360,16 @@ sal_Bool ZipFile::StaticFillData ( rtl::Reference < EncryptionData > & rData,
if ( nSaltLength == rStream->readBytes ( aBuffer, nSaltLength ) )
{
- rData->aSalt.realloc ( nSaltLength );
- memcpy ( rData->aSalt.getArray(), aBuffer.getConstArray(), nSaltLength );
+ rData->m_aSalt.realloc ( nSaltLength );
+ rtl_copyMemory ( rData->m_aSalt.getArray(), aBuffer.getConstArray(), nSaltLength );
if ( nIVLength == rStream->readBytes ( aBuffer, nIVLength ) )
{
- rData->aInitVector.realloc ( nIVLength );
- memcpy ( rData->aInitVector.getArray(), aBuffer.getConstArray(), nIVLength );
+ rData->m_aInitVector.realloc ( nIVLength );
+ rtl_copyMemory ( rData->m_aInitVector.getArray(), aBuffer.getConstArray(), nIVLength );
if ( nDigestLength == rStream->readBytes ( aBuffer, nDigestLength ) )
{
- rData->aDigest.realloc ( nDigestLength );
- memcpy ( rData->aDigest.getArray(), aBuffer.getConstArray(), nDigestLength );
+ rData->m_aDigest.realloc ( nDigestLength );
+ rtl_copyMemory ( rData->m_aDigest.getArray(), aBuffer.getConstArray(), nDigestLength );
if ( nMediaTypeLength == rStream->readBytes ( aBuffer, nMediaTypeLength ) )
{
@@ -287,85 +385,107 @@ sal_Bool ZipFile::StaticFillData ( rtl::Reference < EncryptionData > & rData,
return bOk;
}
-Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const Reference< XInputStream >& xStream,
- const rtl::Reference < EncryptionData > &rData )
+uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference< XInputStream >& xStream,
+ const ::rtl::Reference< EncryptionData > &rData )
throw ( packages::WrongPasswordException, ZipIOException, RuntimeException )
{
if ( !rData.is() )
throw ZipIOException( OUString(RTL_CONSTASCII_USTRINGPARAM( "Encrypted stream without encryption data!\n" )),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
- if ( !rData->aKey.getLength() )
+ if ( !rData->m_aKey.getLength() )
throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- Reference< XSeekable > xSeek( xStream, UNO_QUERY );
+ uno::Reference< XSeekable > xSeek( xStream, UNO_QUERY );
if ( !xSeek.is() )
throw ZipIOException( OUString(RTL_CONSTASCII_USTRINGPARAM( "The stream must be seekable!\n" )),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
// if we have a digest, then this file is an encrypted one and we should
// check if we can decrypt it or not
- OSL_ENSURE( rData->aDigest.getLength(), "Can't detect password correctness without digest!\n" );
- if ( rData->aDigest.getLength() )
+ OSL_ENSURE( rData->m_aDigest.getLength(), "Can't detect password correctness without digest!\n" );
+ if ( rData->m_aDigest.getLength() )
{
- sal_Int32 nSize = sal::static_int_cast< sal_Int32 >( xSeek->getLength() );
- nSize = nSize > n_ConstDigestLength ? n_ConstDigestLength : nSize;
+ sal_Int32 nSize = sal::static_int_cast< sal_Int32 >( xSeek->getLength() );
+ if ( nSize > n_ConstDigestLength + 32 )
+ nSize = n_ConstDigestLength + 32;
// skip header
- xSeek->seek( n_ConstHeaderSize + rData->aInitVector.getLength() +
- rData->aSalt.getLength() + rData->aDigest.getLength() );
+ xSeek->seek( n_ConstHeaderSize + rData->m_aInitVector.getLength() +
+ rData->m_aSalt.getLength() + rData->m_aDigest.getLength() );
// Only want to read enough to verify the digest
Sequence < sal_Int8 > aReadBuffer ( nSize );
xStream->readBytes( aReadBuffer, nSize );
- if ( !StaticHasValidPassword( aReadBuffer, rData ) )
+ if ( !StaticHasValidPassword( xFactory, aReadBuffer, rData ) )
throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
- return new XUnbufferedStream ( xStream, rData );
+ return new XUnbufferedStream( xFactory, xStream, rData );
+}
+
+#if 0
+// for debugging purposes
+void CheckSequence( const uno::Sequence< sal_Int8 >& aSequence )
+{
+ if ( aSequence.getLength() )
+ {
+ sal_Int32* pPointer = *( (sal_Int32**)&aSequence );
+ sal_Int32 nSize = *( pPointer + 1 );
+ sal_Int32 nMemSize = *( pPointer - 2 );
+ sal_Int32 nUsedMemSize = ( nSize + 4 * sizeof( sal_Int32 ) );
+ OSL_ENSURE( nSize == aSequence.getLength() && nUsedMemSize + 7 - ( nUsedMemSize - 1 ) % 8 == nMemSize, "Broken Sequence!" );
+ }
}
+#endif
-sal_Bool ZipFile::StaticHasValidPassword( const Sequence< sal_Int8 > &aReadBuffer, const rtl::Reference < EncryptionData > &rData )
+sal_Bool ZipFile::StaticHasValidPassword( const uno::Reference< lang::XMultiServiceFactory >& xFactory, const Sequence< sal_Int8 > &aReadBuffer, const ::rtl::Reference< EncryptionData > &rData )
{
- if ( !rData.is() || !rData->aKey.getLength() )
+ if ( !rData.is() || !rData->m_aKey.getLength() )
return sal_False;
sal_Bool bRet = sal_False;
- sal_Int32 nSize = aReadBuffer.getLength();
-
- // make a temporary cipher
- rtlCipher aCipher;
- StaticGetCipher ( rData, aCipher, sal_True );
-
- Sequence < sal_Int8 > aDecryptBuffer ( nSize );
- rtlDigest aDigest = rtl_digest_createSHA1();
- rtlDigestError aDigestResult;
- Sequence < sal_uInt8 > aDigestSeq ( RTL_DIGEST_LENGTH_SHA1 );
- rtlCipherError aResult = rtl_cipher_decode ( aCipher,
- aReadBuffer.getConstArray(),
- nSize,
- reinterpret_cast < sal_uInt8 * > (aDecryptBuffer.getArray()),
- nSize);
- if(aResult != rtl_Cipher_E_None ) {
- OSL_ASSERT ( aResult == rtl_Cipher_E_None);
+
+ uno::Reference< xml::crypto::XCipherContext > xCipher( StaticGetCipher( xFactory, rData, false ), uno::UNO_SET_THROW );
+
+ uno::Sequence< sal_Int8 > aDecryptBuffer;
+ uno::Sequence< sal_Int8 > aDecryptBuffer2;
+ try
+ {
+ aDecryptBuffer = xCipher->convertWithCipherContext( aReadBuffer );
+ aDecryptBuffer2 = xCipher->finalizeCipherContextAndDispose();
+ }
+ catch( uno::Exception& )
+ {
+ // decryption with padding will throw the exception in finalizing if the buffer represent only part of the stream
+ // it is no problem, actually this is why we read 32 additional bytes ( two of maximal possible encryption blocks )
+ }
+
+ if ( aDecryptBuffer2.getLength() )
+ {
+ sal_Int32 nOldLen = aDecryptBuffer.getLength();
+ aDecryptBuffer.realloc( nOldLen + aDecryptBuffer2.getLength() );
+ rtl_copyMemory( aDecryptBuffer.getArray() + nOldLen, aDecryptBuffer2.getArray(), aDecryptBuffer2.getLength() );
}
- aDigestResult = rtl_digest_updateSHA1 ( aDigest,
- static_cast < const void * > ( aDecryptBuffer.getConstArray() ), nSize );
- OSL_ASSERT ( aDigestResult == rtl_Digest_E_None );
+ if ( aDecryptBuffer.getLength() > n_ConstDigestLength )
+ aDecryptBuffer.realloc( n_ConstDigestLength );
+
+ uno::Sequence< sal_Int8 > aDigestSeq;
+ uno::Reference< xml::crypto::XDigestContext > xDigestContext( StaticGetDigestContextForChecksum( xFactory, rData ), uno::UNO_SET_THROW );
- aDigestResult = rtl_digest_getSHA1 ( aDigest, aDigestSeq.getArray(), RTL_DIGEST_LENGTH_SHA1 );
- OSL_ASSERT ( aDigestResult == rtl_Digest_E_None );
- (void)aDigestResult;
+ xDigestContext->updateDigest( aDecryptBuffer );
+ aDigestSeq = xDigestContext->finalizeDigestAndDispose();
// If we don't have a digest, then we have to assume that the password is correct
- if ( rData->aDigest.getLength() != 0 &&
- ( aDigestSeq.getLength() != rData->aDigest.getLength() ||
+ if ( rData->m_aDigest.getLength() != 0 &&
+ ( aDigestSeq.getLength() != rData->m_aDigest.getLength() ||
0 != rtl_compareMemory ( aDigestSeq.getConstArray(),
- rData->aDigest.getConstArray(),
+ rData->m_aDigest.getConstArray(),
aDigestSeq.getLength() ) ) )
{
// We should probably tell the user that the password they entered was wrong
@@ -373,136 +493,44 @@ sal_Bool ZipFile::StaticHasValidPassword( const Sequence< sal_Int8 > &aReadBuffe
else
bRet = sal_True;
- rtl_digest_destroySHA1 ( aDigest );
-
return bRet;
}
-sal_Bool ZipFile::hasValidPassword ( ZipEntry & rEntry, const rtl::Reference < EncryptionData > &rData )
+sal_Bool ZipFile::hasValidPassword ( ZipEntry & rEntry, const ::rtl::Reference< EncryptionData >& rData )
{
::osl::MutexGuard aGuard( m_aMutex );
sal_Bool bRet = sal_False;
- if ( rData->aKey.getLength() )
+ if ( rData.is() && rData->m_aKey.getLength() )
{
xSeek->seek( rEntry.nOffset );
sal_Int32 nSize = rEntry.nMethod == DEFLATED ? rEntry.nCompressedSize : rEntry.nSize;
// Only want to read enough to verify the digest
- nSize = nSize > n_ConstDigestLength ? n_ConstDigestLength : nSize;
+ if ( nSize > n_ConstDigestDecrypt )
+ nSize = n_ConstDigestDecrypt;
+
Sequence < sal_Int8 > aReadBuffer ( nSize );
xStream->readBytes( aReadBuffer, nSize );
- bRet = StaticHasValidPassword( aReadBuffer, rData );
+ bRet = StaticHasValidPassword( m_xFactory, aReadBuffer, rData );
}
+
return bRet;
}
-#if 0
-Reference < XInputStream > ZipFile::createFileStream(
- ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
- sal_Bool bRawStream,
- sal_Bool bIsEncrypted )
-{
- static OUString sServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
- Reference < XInputStream > xTempStream = Reference < XInputStream > ( xFactory->createInstance ( sServiceName ), UNO_QUERY );
- return new XFileStream ( rEntry, xStream, xTempStream, rData, bRawStream, bIsEncrypted );
-}
-Reference < XInputStream > ZipFile::createMemoryStream(
- ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
- sal_Bool bRawStream,
- sal_Bool bIsEncrypted )
-{
- sal_Int32 nUncompressedSize, nEnd;
- if (bRawStream)
- {
- nUncompressedSize = rEntry.nMethod == DEFLATED ? rEntry.nCompressedSize : rEntry.nSize;
- nEnd = rEntry.nOffset + nUncompressedSize;
- }
- else
- {
- nUncompressedSize = rEntry.nSize;
- nEnd = rEntry.nMethod == DEFLATED ? rEntry.nOffset + rEntry.nCompressedSize : rEntry.nOffset + rEntry.nSize;
- }
- sal_Int32 nSize = rEntry.nMethod == DEFLATED ? rEntry.nCompressedSize : rEntry.nSize;
- Sequence < sal_Int8 > aReadBuffer ( nSize ), aDecryptBuffer, aWriteBuffer;
- rtlCipher aCipher;
-
- // If the encryption key is zero, we need to return the raw stream. First check if
- // we have the salt. If we have the salt, then check if we have the encryption key
- // if not, return rawStream instead.
-
- sal_Bool bHaveEncryptData = ( rData.is() && rData->aSalt.getLength() && rData->aInitVector.getLength() && rData->nIterationCount != 0 ) ? sal_True : sal_False;
- sal_Bool bMustDecrypt = ( !bRawStream && bHaveEncryptData && bIsEncrypted ) ? sal_True : sal_False;
-
- if ( bMustDecrypt )
- {
- StaticGetCipher ( rData, aCipher, sal_True );
- aDecryptBuffer.realloc ( nSize );
- }
-
- if ( nSize <0 )
- throw IOException ( );
-
- xSeek->seek( rEntry.nOffset );
- xStream->readBytes( aReadBuffer, nSize ); // Now it holds the raw stuff from disk
-
- if ( bMustDecrypt )
- {
- rtlCipherError aResult = rtl_cipher_decode ( aCipher,
- aReadBuffer.getConstArray(),
- nSize,
- reinterpret_cast < sal_uInt8 * > (aDecryptBuffer.getArray()),
- nSize);
- OSL_ASSERT (aResult == rtl_Cipher_E_None);
- aReadBuffer = aDecryptBuffer; // Now it holds the decrypted data
- }
- if (bRawStream || rEntry.nMethod == STORED)
- aWriteBuffer = aReadBuffer; // bRawStream means the caller doesn't want it decompressed
- else
- {
- aInflater.setInputSegment( aReadBuffer, 0, nSize );
- aWriteBuffer.realloc( nUncompressedSize );
- aInflater.doInflate( aWriteBuffer );
- aInflater.reset();
- }
-
- if ( bHaveEncryptData && !bMustDecrypt && bIsEncrypted )
- {
- // if we have the data needed to decrypt it, but didn't want it decrypted (or
- // we couldn't decrypt it due to wrong password), then we prepend this
- // data to the stream
-
- // Make a buffer big enough to hold both the header and the data itself
- Sequence < sal_Int8 > aEncryptedDataHeader ( n_ConstHeaderSize +
- rData->aInitVector.getLength() +
- rData->aSalt.getLength() +
- rData->aDigest.getLength() +
- aWriteBuffer.getLength() );
- sal_Int8 * pHeader = aEncryptedDataHeader.getArray();
- StaticFillHeader ( rData, rEntry.nSize, pHeader );
- memcpy ( pHeader, aWriteBuffer.getConstArray(), aWriteBuffer.getLength() );
-
- // dump old buffer and point aWriteBuffer to the new one with the header
- aWriteBuffer = aEncryptedDataHeader;
- }
- return Reference < XInputStream > ( new XMemoryStream ( aWriteBuffer ) );
-}
-#endif
-Reference < XInputStream > ZipFile::createUnbufferedStream(
+uno::Reference< XInputStream > ZipFile::createUnbufferedStream(
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference< EncryptionData > &rData,
sal_Int8 nStreamMode,
sal_Bool bIsEncrypted,
::rtl::OUString aMediaType )
{
::osl::MutexGuard aGuard( m_aMutex );
- return new XUnbufferedStream ( aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
+ return new XUnbufferedStream ( m_xFactory, aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
}
@@ -511,8 +539,8 @@ ZipEnumeration * SAL_CALL ZipFile::entries( )
return new ZipEnumeration ( aEntries );
}
-Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+uno::Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
+ const ::rtl::Reference< EncryptionData > &rData,
sal_Bool bIsEncrypted,
SotMutexHolderRef aMutexHolder )
throw(IOException, ZipException, RuntimeException)
@@ -529,7 +557,7 @@ Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
// if we have a digest, then this file is an encrypted one and we should
// check if we can decrypt it or not
- if ( bIsEncrypted && rData.is() && rData->aDigest.getLength() )
+ if ( bIsEncrypted && rData.is() && rData->m_aDigest.getLength() )
bNeedRawStream = !hasValidPassword ( rEntry, rData );
return createUnbufferedStream ( aMutexHolder,
@@ -539,8 +567,8 @@ Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
bIsEncrypted );
}
-Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+uno::Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
+ const ::rtl::Reference< EncryptionData > &rData,
sal_Bool bIsEncrypted,
SotMutexHolderRef aMutexHolder )
throw ( packages::WrongPasswordException,
@@ -562,12 +590,12 @@ Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
// to detect password correctness
if ( !rData.is() )
throw ZipException( OUString(RTL_CONSTASCII_USTRINGPARAM( "Encrypted stream without encryption data!\n" )),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
// if we have a digest, then this file is an encrypted one and we should
// check if we can decrypt it or not
- OSL_ENSURE( rData->aDigest.getLength(), "Can't detect password correctness without digest!\n" );
- if ( rData->aDigest.getLength() && !hasValidPassword ( rEntry, rData ) )
+ OSL_ENSURE( rData->m_aDigest.getLength(), "Can't detect password correctness without digest!\n" );
+ if ( rData->m_aDigest.getLength() && !hasValidPassword ( rEntry, rData ) )
throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
else
@@ -580,8 +608,8 @@ Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
bIsEncrypted );
}
-Reference< XInputStream > SAL_CALL ZipFile::getRawData( ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+uno::Reference< XInputStream > SAL_CALL ZipFile::getRawData( ZipEntry& rEntry,
+ const ::rtl::Reference< EncryptionData >& rData,
sal_Bool bIsEncrypted,
SotMutexHolderRef aMutexHolder )
throw(IOException, ZipException, RuntimeException)
@@ -594,9 +622,9 @@ Reference< XInputStream > SAL_CALL ZipFile::getRawData( ZipEntry& rEntry,
return createUnbufferedStream ( aMutexHolder, rEntry, rData, UNBUFF_STREAM_RAW, bIsEncrypted );
}
-Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
+uno::Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
ZipEntry& rEntry,
- const rtl::Reference < EncryptionData > &rData,
+ const ::rtl::Reference< EncryptionData >& rData,
const ::rtl::OUString& aMediaType,
SotMutexHolderRef aMutexHolder )
throw ( packages::NoEncryptionException,
@@ -628,7 +656,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
aGrabber >> nTestSig;
if (nTestSig != LOCSIG)
- throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid LOC header (bad signature") ), Reference < XInterface > () );
+ throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid LOC header (bad signature") ), uno::Reference < XInterface > () );
aGrabber >> nVersion;
aGrabber >> nFlag;
aGrabber >> nHow;
@@ -674,7 +702,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
if ( bBroken && !bRecoveryMode )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "The stream seems to be broken!" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
return sal_True;
}
@@ -708,17 +736,17 @@ sal_Int32 ZipFile::findEND( )
}
catch ( IllegalArgumentException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
catch ( NotConnectedException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
catch ( BufferSizeExceededException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
sal_Int32 ZipFile::readCEN()
@@ -739,25 +767,25 @@ sal_Int32 ZipFile::readCEN()
aGrabber >> nCenOff;
if ( nTotal * CENHDR > nCenLen )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "invalid END header (bad entry count)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "invalid END header (bad entry count)") ), uno::Reference < XInterface > () );
if ( nTotal > ZIP_MAXENTRIES )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "too many entries in ZIP File") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "too many entries in ZIP File") ), uno::Reference < XInterface > () );
if ( nCenLen < 0 || nCenLen > nEndPos )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), uno::Reference < XInterface > () );
nCenPos = nEndPos - nCenLen;
if ( nCenOff < 0 || nCenOff > nCenPos )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), uno::Reference < XInterface > () );
nLocPos = nCenPos - nCenOff;
aGrabber.seek( nCenPos );
Sequence < sal_Int8 > aCENBuffer ( nCenLen );
sal_Int64 nRead = aGrabber.readBytes ( aCENBuffer, nCenLen );
if ( static_cast < sal_Int64 > ( nCenLen ) != nRead )
- throw ZipException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Error reading CEN into memory buffer!") ), Reference < XInterface > () );
+ throw ZipException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Error reading CEN into memory buffer!") ), uno::Reference < XInterface > () );
MemoryByteGrabber aMemGrabber ( aCENBuffer );
@@ -769,19 +797,19 @@ sal_Int32 ZipFile::readCEN()
{
aMemGrabber >> nTestSig;
if ( nTestSig != CENSIG )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad signature)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad signature)") ), uno::Reference < XInterface > () );
aMemGrabber.skipBytes ( 2 );
aMemGrabber >> aEntry.nVersion;
if ( ( aEntry.nVersion & 1 ) == 1 )
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (encrypted entry)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (encrypted entry)") ), uno::Reference < XInterface > () );
aMemGrabber >> aEntry.nFlag;
aMemGrabber >> aEntry.nMethod;
if ( aEntry.nMethod != STORED && aEntry.nMethod != DEFLATED)
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad compression method)") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad compression method)") ), uno::Reference < XInterface > () );
aMemGrabber >> aEntry.nTime;
aMemGrabber >> aEntry.nCrc;
@@ -797,13 +825,13 @@ sal_Int32 ZipFile::readCEN()
aEntry.nOffset *= -1;
if ( aEntry.nPathLen < 0 )
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected name length" ) ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected name length" ) ), uno::Reference < XInterface > () );
if ( nCommentLen < 0 )
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected comment length" ) ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected comment length" ) ), uno::Reference < XInterface > () );
if ( aEntry.nExtraLen < 0 )
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected extra header info length") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected extra header info length") ), uno::Reference < XInterface > () );
// read always in UTF8, some tools seem not to set UTF8 bit
aEntry.sPath = rtl::OUString::intern ( (sal_Char *) aMemGrabber.getCurrentPos(),
@@ -811,14 +839,14 @@ sal_Int32 ZipFile::readCEN()
RTL_TEXTENCODING_UTF8 );
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aEntry.sPath, sal_True ) )
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip entry has an invalid name.") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip entry has an invalid name.") ), uno::Reference < XInterface > () );
aMemGrabber.skipBytes( aEntry.nPathLen + aEntry.nExtraLen + nCommentLen );
aEntries[aEntry.sPath] = aEntry;
}
if (nCount != nTotal)
- throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Count != Total") ), Reference < XInterface > () );
+ throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Count != Total") ), uno::Reference < XInterface > () );
}
catch ( IllegalArgumentException & )
{
@@ -991,15 +1019,15 @@ sal_Int32 ZipFile::recover()
}
catch ( IllegalArgumentException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
catch ( NotConnectedException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
catch ( BufferSizeExceededException& )
{
- throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), Reference < XInterface > () );
+ throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () );
}
}
diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index 4e08b7e8520d..fb533cf641c1 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -28,18 +28,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_package.hxx"
-#include <ZipOutputStream.hxx>
+
#include <com/sun/star/packages/zip/ZipConstants.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <comphelper/storagehelper.hxx>
+
#include <osl/time.h>
+
#include <EncryptionData.hxx>
#include <PackageConstants.hxx>
#include <ZipEntry.hxx>
#include <ZipFile.hxx>
-#include <rtl/ref.hxx>
-#include <com/sun/star/io/XOutputStream.hpp>
-
-#include <comphelper/storagehelper.hxx>
+#include <ZipPackageStream.hxx>
+#include <ZipOutputStream.hxx>
+using namespace com::sun::star;
using namespace com::sun::star::io;
using namespace com::sun::star::uno;
using namespace com::sun::star::packages;
@@ -48,17 +51,18 @@ using namespace com::sun::star::packages::zip::ZipConstants;
/** This class is used to write Zip files
*/
-ZipOutputStream::ZipOutputStream( Reference < XOutputStream > &xOStream )
-: xStream(xOStream)
-, aBuffer(n_ConstBufferSize)
+ZipOutputStream::ZipOutputStream( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference < XOutputStream > &xOStream )
+: m_xFactory( xFactory )
+, xStream(xOStream)
+, m_aDeflateBuffer(n_ConstBufferSize)
, aDeflater(DEFAULT_COMPRESSION, sal_True)
, aChucker(xOStream)
, pCurrentEntry(NULL)
, nMethod(DEFLATED)
, bFinished(sal_False)
, bEncryptCurrentEntry(sal_False)
-
-
+, m_pCurrentStream(NULL)
{
}
@@ -80,7 +84,7 @@ void SAL_CALL ZipOutputStream::setLevel( sal_Int32 nNewLevel )
}
void SAL_CALL ZipOutputStream::putNextEntry( ZipEntry& rEntry,
- rtl::Reference < EncryptionData > &xEncryptData,
+ ZipPackageStream* pStream,
sal_Bool bEncrypt)
throw(IOException, RuntimeException)
{
@@ -94,18 +98,20 @@ void SAL_CALL ZipOutputStream::putNextEntry( ZipEntry& rEntry,
rEntry.nFlag = 1 << 11;
if (rEntry.nSize == -1 || rEntry.nCompressedSize == -1 ||
rEntry.nCrc == -1)
+ {
+ rEntry.nSize = rEntry.nCompressedSize = 0;
rEntry.nFlag |= 8;
+ }
if (bEncrypt)
{
bEncryptCurrentEntry = sal_True;
- ZipFile::StaticGetCipher( xEncryptData, aCipher, sal_False );
-
- aDigest = rtl_digest_createSHA1();
+ m_xCipherContext = ZipFile::StaticGetCipher( m_xFactory, pStream->GetEncryptionData(), true );
+ m_xDigestContext = ZipFile::StaticGetDigestContextForChecksum( m_xFactory, pStream->GetEncryptionData() );
mnDigested = 0;
rEntry.nFlag |= 1 << 4;
- pCurrentEncryptData = xEncryptData.get();
+ m_pCurrentStream = pStream;
}
sal_Int32 nLOCLength = writeLOC(rEntry);
rEntry.nOffset = static_cast < sal_Int32 > (aChucker.GetPosition()) - nLOCLength;
@@ -144,11 +150,12 @@ void SAL_CALL ZipOutputStream::closeEntry( )
}
else
{
- pEntry->nSize = aDeflater.getTotalIn();
- pEntry->nCompressedSize = aDeflater.getTotalOut();
+ if ( !bEncryptCurrentEntry )
+ {
+ pEntry->nSize = aDeflater.getTotalIn();
+ pEntry->nCompressedSize = aDeflater.getTotalOut();
+ }
pEntry->nCrc = aCRC.getValue();
- if ( bEncryptCurrentEntry )
- pEntry->nSize = pEntry->nCompressedSize;
writeEXT(*pEntry);
}
aDeflater.reset();
@@ -165,19 +172,22 @@ void SAL_CALL ZipOutputStream::closeEntry( )
if (bEncryptCurrentEntry)
{
- rtlDigestError aDigestResult;
- aEncryptionBuffer.realloc ( 0 );
bEncryptCurrentEntry = sal_False;
- rtl_cipher_destroy ( aCipher );
- pCurrentEncryptData->aDigest.realloc ( RTL_DIGEST_LENGTH_SHA1 );
- aDigestResult = rtl_digest_getSHA1 ( aDigest,
- reinterpret_cast < sal_uInt8 * > ( pCurrentEncryptData->aDigest.getArray() ),
- RTL_DIGEST_LENGTH_SHA1 );
- OSL_ASSERT( aDigestResult == rtl_Digest_E_None );
- (void)aDigestResult;
- rtl_digest_destroySHA1 ( aDigest );
+
+ m_xCipherContext.clear();
+
+ uno::Sequence< sal_Int8 > aDigestSeq;
+ if ( m_xDigestContext.is() )
+ {
+ aDigestSeq = m_xDigestContext->finalizeDigestAndDispose();
+ m_xDigestContext.clear();
+ }
+
+ if ( m_pCurrentStream )
+ m_pCurrentStream->setDigest( aDigestSeq );
}
pCurrentEntry = NULL;
+ m_pCurrentStream = NULL;
}
}
@@ -242,43 +252,55 @@ void SAL_CALL ZipOutputStream::finish( )
void ZipOutputStream::doDeflate()
{
- sal_Int32 nLength = aDeflater.doDeflateSegment(aBuffer, 0, aBuffer.getLength());
- sal_Int32 nOldLength = aBuffer.getLength();
+ sal_Int32 nLength = aDeflater.doDeflateSegment(m_aDeflateBuffer, 0, m_aDeflateBuffer.getLength());
if ( nLength > 0 )
{
- Sequence < sal_Int8 > aTmpBuffer ( aBuffer.getConstArray(), nLength );
- const void *pTmpBuffer = static_cast < const void * > ( aTmpBuffer.getConstArray() );
- if (bEncryptCurrentEntry)
+ uno::Sequence< sal_Int8 > aTmpBuffer( m_aDeflateBuffer.getConstArray(), nLength );
+ if ( bEncryptCurrentEntry && m_xDigestContext.is() && m_xCipherContext.is() )
{
// Need to update our digest before encryption...
- rtlDigestError aDigestResult = rtl_Digest_E_None;
- sal_Int16 nDiff = n_ConstDigestLength - mnDigested;
+ sal_Int32 nDiff = n_ConstDigestLength - mnDigested;
if ( nDiff )
{
- sal_Int16 nEat = static_cast < sal_Int16 > ( nDiff > nLength ? nLength : nDiff );
- aDigestResult = rtl_digest_updateSHA1 ( aDigest, pTmpBuffer, nEat );
- mnDigested = mnDigested + nEat;
+ sal_Int32 nEat = ::std::min( nLength, nDiff );
+ uno::Sequence< sal_Int8 > aTmpSeq( aTmpBuffer.getConstArray(), nEat );
+ m_xDigestContext->updateDigest( aTmpSeq );
+ mnDigested = mnDigested + static_cast< sal_Int16 >( nEat );
}
- OSL_ASSERT( aDigestResult == rtl_Digest_E_None );
(void)aDigestResult;
- aEncryptionBuffer.realloc ( nLength );
-
- rtlCipherError aCipherResult;
- aCipherResult = rtl_cipher_encode ( aCipher, pTmpBuffer,
- nLength, reinterpret_cast < sal_uInt8 * > (aEncryptionBuffer.getArray()), nLength );
- OSL_ASSERT( aCipherResult == rtl_Cipher_E_None );
+ uno::Sequence< sal_Int8 > aEncryptionBuffer = m_xCipherContext->convertWithCipherContext( aTmpBuffer );
(void)aCipherResult;
aChucker.WriteBytes( aEncryptionBuffer );
- aCRC.update ( aEncryptionBuffer );
- aEncryptionBuffer.realloc ( nOldLength );
+
+ // the sizes as well as checksum for encrypted streams is calculated here
+ pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength();
+ pCurrentEntry->nSize = pCurrentEntry->nCompressedSize;
+ aCRC.update( aEncryptionBuffer );
}
else
+ {
aChucker.WriteBytes ( aTmpBuffer );
+ }
+ }
+
+ if ( aDeflater.finished() && bEncryptCurrentEntry && m_xDigestContext.is() && m_xCipherContext.is() )
+ {
+ uno::Sequence< sal_Int8 > aEncryptionBuffer = m_xCipherContext->finalizeCipherContextAndDispose();
+ if ( aEncryptionBuffer.getLength() )
+ {
+ aChucker.WriteBytes( aEncryptionBuffer );
+
+ // the sizes as well as checksum for encrypted streams is calculated hier
+ pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength();
+ pCurrentEntry->nSize = pCurrentEntry->nCompressedSize;
+ aCRC.update( aEncryptionBuffer );
+ }
}
}
+
void ZipOutputStream::writeEND(sal_uInt32 nOffset, sal_uInt32 nLength)
throw(IOException, RuntimeException)
{
@@ -295,7 +317,7 @@ void ZipOutputStream::writeCEN( const ZipEntry &rEntry )
throw(IOException, RuntimeException)
{
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) )
- throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), Reference< XInterface >() );
+ throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), uno::Reference< XInterface >() );
::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 );
sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() );
@@ -344,7 +366,7 @@ sal_Int32 ZipOutputStream::writeLOC( const ZipEntry &rEntry )
throw(IOException, RuntimeException)
{
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) )
- throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), Reference< XInterface >() );
+ throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), uno::Reference< XInterface >() );
::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 );
sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() );
diff --git a/package/source/zipapi/blowfishcontext.cxx b/package/source/zipapi/blowfishcontext.cxx
new file mode 100644
index 000000000000..1739bb15cde8
--- /dev/null
+++ b/package/source/zipapi/blowfishcontext.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_package.hxx"
+
+#include <rtl/cipher.h>
+#include <rtl/ref.hxx>
+
+#include "blowfishcontext.hxx"
+
+using namespace ::com::sun::star;
+
+// static
+uno::Reference< xml::crypto::XCipherContext > BlowfishCFB8CipherContext::Create( const uno::Sequence< sal_Int8 >& aDerivedKey, const uno::Sequence< sal_Int8 >& aInitVector, bool bEncrypt )
+{
+ ::rtl::Reference< BlowfishCFB8CipherContext > xResult = new BlowfishCFB8CipherContext();
+ xResult->m_pCipher = rtl_cipher_create( rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream );
+ if ( !xResult->m_pCipher )
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii( "Can not create cipher!\n" ),
+ uno::Reference< XInterface >() );
+
+ if ( rtl_Cipher_E_None != rtl_cipher_init(
+ xResult->m_pCipher,
+ bEncrypt ? rtl_Cipher_DirectionEncode : rtl_Cipher_DirectionDecode,
+ reinterpret_cast< const sal_uInt8* >( aDerivedKey.getConstArray() ),
+ aDerivedKey.getLength(),
+ reinterpret_cast< const sal_uInt8* >( aInitVector.getConstArray() ),
+ aInitVector.getLength() ) )
+ {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii( "Can not initialize cipher!\n" ),
+ uno::Reference< XInterface >() );
+ }
+
+ xResult->m_bEncrypt = bEncrypt;
+
+ return uno::Reference< xml::crypto::XCipherContext >( xResult.get() );
+}
+
+BlowfishCFB8CipherContext::~BlowfishCFB8CipherContext()
+{
+ if ( m_pCipher )
+ {
+ rtl_cipher_destroy ( m_pCipher );
+ m_pCipher = NULL;
+ }
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherContext( const uno::Sequence< ::sal_Int8 >& aData )
+ throw( lang::IllegalArgumentException, lang::DisposedException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pCipher )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aResult( aData.getLength() );
+ rtlCipherError nError = rtl_Cipher_E_None;
+
+ if ( m_bEncrypt )
+ {
+ rtl_cipher_encode( m_pCipher,
+ aData.getConstArray(),
+ aData.getLength(),
+ reinterpret_cast< sal_uInt8* >( aResult.getArray() ),
+ aResult.getLength() );
+ }
+ else
+ {
+ rtl_cipher_decode( m_pCipher,
+ aData.getConstArray(),
+ aData.getLength(),
+ reinterpret_cast< sal_uInt8* >( aResult.getArray() ),
+ aResult.getLength() );
+ }
+
+ if ( rtl_Cipher_E_None != nError )
+ {
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii( "Can not decrypt/encrypt with cipher!\n" ),
+ uno::Reference< uno::XInterface >() );
+ }
+
+ return aResult;
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::finalizeCipherContextAndDispose()
+ throw( lang::DisposedException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pCipher )
+ throw lang::DisposedException();
+
+ rtl_cipher_destroy ( m_pCipher );
+ m_pCipher = NULL;
+
+ return uno::Sequence< sal_Int8 >();
+}
+
+
diff --git a/package/source/zipapi/blowfishcontext.hxx b/package/source/zipapi/blowfishcontext.hxx
new file mode 100644
index 000000000000..49cce2fc0e65
--- /dev/null
+++ b/package/source/zipapi/blowfishcontext.hxx
@@ -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.
+ *
+ ************************************************************************/
+#ifndef _BLOWFISHCONTEXT_HXX
+#define _BLOWFISHCONTEXT_HXX
+
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+
+class BlowfishCFB8CipherContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XCipherContext >
+{
+ ::osl::Mutex m_aMutex;
+ void* m_pCipher;
+ bool m_bEncrypt;
+
+ BlowfishCFB8CipherContext()
+ : m_pCipher( NULL )
+ , m_bEncrypt( false )
+ {}
+
+public:
+
+ virtual ~BlowfishCFB8CipherContext();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext >
+ Create( const ::com::sun::star::uno::Sequence< sal_Int8 >& aDerivedKey, const ::com::sun::star::uno::Sequence< sal_Int8 >& aInitVector, bool bEncrypt );
+
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertWithCipherContext( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeCipherContextAndDispose( ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _BLOWFISHCONTEXT_HXX
+
diff --git a/package/source/zipapi/makefile.mk b/package/source/zipapi/makefile.mk
index ec8d63694ec6..8a07d448ddbb 100644
--- a/package/source/zipapi/makefile.mk
+++ b/package/source/zipapi/makefile.mk
@@ -46,8 +46,10 @@ SLOFILES= \
$(SLO)$/CRC32.obj \
$(SLO)$/ByteChucker.obj \
$(SLO)$/ByteGrabber.obj \
+ $(SLO)$/blowfishcontext.obj \
$(SLO)$/Inflater.obj \
$(SLO)$/Deflater.obj \
+ $(SLO)$/sha1context.obj \
$(SLO)$/ZipEnumeration.obj \
$(SLO)$/ZipFile.obj \
$(SLO)$/ZipOutputStream.obj \
diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx
new file mode 100644
index 000000000000..a71f20ad6f36
--- /dev/null
+++ b/package/source/zipapi/sha1context.cxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_package.hxx"
+
+#include <rtl/digest.h>
+#include <rtl/ref.hxx>
+
+#include "sha1context.hxx"
+
+using namespace ::com::sun::star;
+
+// static
+uno::Reference< xml::crypto::XDigestContext > SHA1DigestContext::Create()
+{
+ ::rtl::Reference< SHA1DigestContext > xResult = new SHA1DigestContext();
+ xResult->m_pDigest = rtl_digest_createSHA1();
+ if ( !xResult->m_pDigest )
+ throw uno::RuntimeException( ::rtl::OUString::createFromAscii( "Can not create cipher!\n" ),
+ uno::Reference< XInterface >() );
+
+ return uno::Reference< xml::crypto::XDigestContext >( xResult.get() );
+}
+
+SHA1DigestContext::~SHA1DigestContext()
+{
+ if ( m_pDigest )
+ {
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+ }
+}
+
+void SAL_CALL SHA1DigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& aData )
+ throw( lang::DisposedException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pDigest )
+ throw lang::DisposedException();
+
+ if ( rtl_Digest_E_None != rtl_digest_updateSHA1( m_pDigest, aData.getConstArray(), aData.getLength() ) )
+ {
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+
+ throw uno::RuntimeException();
+ }
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL SHA1DigestContext::finalizeDigestAndDispose()
+ throw( lang::DisposedException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pDigest )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aResult( RTL_DIGEST_LENGTH_SHA1 );
+ if ( rtl_Digest_E_None != rtl_digest_getSHA1( m_pDigest, reinterpret_cast< sal_uInt8* >( aResult.getArray() ), aResult.getLength() ) )
+ {
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+
+ throw uno::RuntimeException();
+ }
+
+ rtl_digest_destroySHA1( m_pDigest );
+ m_pDigest = NULL;
+
+ return aResult;
+}
+
+
diff --git a/package/source/zipapi/XMemoryStream.hxx b/package/source/zipapi/sha1context.hxx
index 935712abbe42..c8f6068f7bbf 100644
--- a/package/source/zipapi/XMemoryStream.hxx
+++ b/package/source/zipapi/sha1context.hxx
@@ -25,21 +25,35 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _XMEMORY_STREAM_HXX
-#define _XMEMORY_STREAM_HXX
+#ifndef _SHA1CONTEXT_HXX
+#define _SHA1CONTEXT_HXX
-#include <ZipPackageBuffer.hxx>
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
-class ZipPackage;
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
-class XMemoryStream: public ZipPackageBuffer
+class SHA1DigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext >
{
+ ::osl::Mutex m_aMutex;
+ void* m_pDigest;
+
+ SHA1DigestContext()
+ : m_pDigest( NULL )
+ {}
+
public:
- XMemoryStream ( com::sun::star::uno::Sequence < sal_Int8 > & rNewBuffer );
- virtual ~XMemoryStream(void);
- virtual com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type& rType )
- throw(com::sun::star::uno::RuntimeException);
+
+ virtual ~SHA1DigestContext();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext >
+ Create();
+
+ virtual void SAL_CALL updateDigest( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeDigestAndDispose() throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+
};
+
#endif
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index e3ab5caabd63..ed5f81ba592d 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -17,7 +17,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
+ * ( a copy is included in the LICENSE file that accompanied this code ).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
@@ -26,7 +26,7 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
+// MARKER( update_precomp.py ): autogen include statement, do not remove
#include "precompiled_package.hxx"
#include <ZipPackage.hxx>
#include <ZipPackageSink.hxx>
@@ -63,6 +63,8 @@
#include <com/sun/star/embed/UseBackupException.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <cppuhelper/implbase1.hxx>
#include <ContentInfo.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -83,6 +85,7 @@
#include <comphelper/storagehelper.hxx>
#include <comphelper/ofopxmlhelper.hxx>
#include <comphelper/documentconstants.hxx>
+#include <comphelper/sequenceashashmap.hxx>
using namespace std;
using namespace osl;
@@ -156,35 +159,37 @@ public:
class DummyInputStream : public ::cppu::WeakImplHelper1< XInputStream >
{
- virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >&, sal_Int32 )
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ virtual sal_Int32 SAL_CALL readBytes( uno::Sequence< sal_Int8 >&, sal_Int32 )
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{ return 0; }
- virtual sal_Int32 SAL_CALL readSomeBytes( Sequence< sal_Int8 >&, sal_Int32 )
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ virtual sal_Int32 SAL_CALL readSomeBytes( uno::Sequence< sal_Int8 >&, sal_Int32 )
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{ return 0; }
virtual void SAL_CALL skipBytes( sal_Int32 )
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{}
virtual sal_Int32 SAL_CALL available()
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{ return 0; }
virtual void SAL_CALL closeInput()
- throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
+ throw ( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException )
{}
};
//===========================================================================
-ZipPackage::ZipPackage (const uno::Reference < XMultiServiceFactory > &xNewFactory)
+ZipPackage::ZipPackage ( const uno::Reference < XMultiServiceFactory > &xNewFactory )
: m_aMutexHolder( new SotMutexHolder )
+, m_nStartKeyGenerationID( xml::crypto::DigestID::SHA1 )
+, m_nChecksumDigestID( xml::crypto::DigestID::SHA1_1K )
+, m_nCommonEncryptionID( xml::crypto::CipherID::BLOWFISH_CFB_8 )
, m_bHasEncryptedEntries ( sal_False )
, m_bHasNonEncryptedEntries ( sal_False )
, m_bInconsistent ( sal_False )
-, m_bUseManifest ( sal_True )
, m_bForceRecovery ( sal_False )
, m_bMediaTypeFallbackUsed ( sal_False )
, m_nFormat( embed::StorageFormats::PACKAGE ) // package is the default format
@@ -206,28 +211,19 @@ ZipPackage::~ZipPackage( void )
// So there is no need in explicit m_pRootFolder->releaseUpwardRef() call here any more
// since m_pRootFolder has no parent and cleaning of it's children will be done automatically
// during m_pRootFolder dieing by refcount.
-
-#if 0
- // As all folders and streams contain references to their parents,
- // we must remove these references so that they will be deleted when
- // the boost::unordered_map of the root folder is cleared, releasing all subfolders
- // and substreams which in turn release theirs, etc. When m_xRootFolder is
- // released when this destructor completes, the folder tree should be
- // deleted fully (and automagically).
-
- m_pRootFolder->releaseUpwardRef();
-#endif
}
+//--------------------------------------------------------
void ZipPackage::parseManifest()
{
if ( m_nFormat == embed::StorageFormats::PACKAGE )
{
sal_Bool bManifestParsed = sal_False;
+ bool bDifferentStartKeyAlgorithm = false;
const OUString sMeta ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF" ) );
if ( m_xRootFolder->hasByName( sMeta ) )
{
- const OUString sManifest (RTL_CONSTASCII_USTRINGPARAM( "manifest.xml") );
+ const OUString sManifest ( RTL_CONSTASCII_USTRINGPARAM( "manifest.xml" ) );
try {
uno::Reference< XUnoTunnel > xTunnel;
@@ -238,11 +234,11 @@ void ZipPackage::parseManifest()
{
aAny = xMetaInfFolder->getByName( sManifest );
aAny >>= xTunnel;
- uno::Reference < XActiveDataSink > xSink (xTunnel, UNO_QUERY);
- if (xSink.is())
+ uno::Reference < XActiveDataSink > xSink ( xTunnel, UNO_QUERY );
+ if ( xSink.is() )
{
OUString sManifestReader ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.manifest.ManifestReader" ) );
- uno::Reference < XManifestReader > xReader (m_xFactory->createInstance( sManifestReader ), UNO_QUERY );
+ uno::Reference < XManifestReader > xReader ( m_xFactory->createInstance( sManifestReader ), UNO_QUERY );
if ( xReader.is() )
{
const OUString sPropFullPath ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
@@ -253,45 +249,57 @@ void ZipPackage::parseManifest()
const OUString sPropIterationCount ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
const OUString sPropSize ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
const OUString sPropDigest ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
+ const OUString sPropDerivedKeySize ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) );
+ const OUString sPropDigestAlgorithm ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) );
+ const OUString sPropEncryptionAlgorithm ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) );
+ const OUString sPropStartKeyAlgorithm ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) );
- Sequence < Sequence < PropertyValue > > aManifestSequence = xReader->readManifestSequence ( xSink->getInputStream() );
+ uno::Sequence < uno::Sequence < PropertyValue > > aManifestSequence = xReader->readManifestSequence ( xSink->getInputStream() );
sal_Int32 nLength = aManifestSequence.getLength();
- const Sequence < PropertyValue > *pSequence = aManifestSequence.getConstArray();
+ const uno::Sequence < PropertyValue > *pSequence = aManifestSequence.getConstArray();
ZipPackageStream *pStream = NULL;
ZipPackageFolder *pFolder = NULL;
- for (sal_Int32 i = 0; i < nLength ; i++, pSequence++)
+ for ( sal_Int32 i = 0; i < nLength ; i++, pSequence++ )
{
OUString sPath, sMediaType, sVersion;
const PropertyValue *pValue = pSequence->getConstArray();
- const Any *pSalt = NULL, *pVector = NULL, *pCount = NULL, *pSize = NULL, *pDigest = NULL;
- for (sal_Int32 j = 0, nNum = pSequence->getLength(); j < nNum; j++ )
+ const Any *pSalt = NULL, *pVector = NULL, *pCount = NULL, *pSize = NULL, *pDigest = NULL, *pDigestAlg = NULL, *pEncryptionAlg = NULL, *pStartKeyAlg = NULL, *pDerivedKeySize = NULL;
+ for ( sal_Int32 j = 0, nNum = pSequence->getLength(); j < nNum; j++ )
{
- if (pValue[j].Name.equals( sPropFullPath ) )
+ if ( pValue[j].Name.equals( sPropFullPath ) )
pValue[j].Value >>= sPath;
- else if (pValue[j].Name.equals( sPropVersion ) )
+ else if ( pValue[j].Name.equals( sPropVersion ) )
pValue[j].Value >>= sVersion;
- else if (pValue[j].Name.equals( sPropMediaType ) )
+ else if ( pValue[j].Name.equals( sPropMediaType ) )
pValue[j].Value >>= sMediaType;
- else if (pValue[j].Name.equals( sPropSalt ) )
- pSalt = &(pValue[j].Value);
- else if (pValue[j].Name.equals( sPropInitialisationVector ) )
- pVector = &(pValue[j].Value);
- else if (pValue[j].Name.equals( sPropIterationCount ) )
- pCount = &(pValue[j].Value);
- else if (pValue[j].Name.equals( sPropSize ) )
- pSize = &(pValue[j].Value);
- else if (pValue[j].Name.equals( sPropDigest ) )
- pDigest = &(pValue[j].Value);
+ else if ( pValue[j].Name.equals( sPropSalt ) )
+ pSalt = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropInitialisationVector ) )
+ pVector = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropIterationCount ) )
+ pCount = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropSize ) )
+ pSize = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropDigest ) )
+ pDigest = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropDigestAlgorithm ) )
+ pDigestAlg = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropEncryptionAlgorithm ) )
+ pEncryptionAlg = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropStartKeyAlgorithm ) )
+ pStartKeyAlg = &( pValue[j].Value );
+ else if ( pValue[j].Name.equals( sPropDerivedKeySize ) )
+ pDerivedKeySize = &( pValue[j].Value );
}
- if (sPath.getLength() && hasByHierarchicalName ( sPath ) )
+ if ( sPath.getLength() && hasByHierarchicalName ( sPath ) )
{
aAny = getByHierarchicalName( sPath );
uno::Reference < XUnoTunnel > xUnoTunnel;
aAny >>= xUnoTunnel;
sal_Int64 nTest=0;
- if ((nTest = xUnoTunnel->getSomething(ZipPackageFolder::static_getImplementationId())) != 0)
+ if ( (nTest = xUnoTunnel->getSomething( ZipPackageFolder::static_getImplementationId() )) != 0 )
{
pFolder = reinterpret_cast < ZipPackageFolder* > ( nTest );
pFolder->SetMediaType ( sMediaType );
@@ -299,15 +307,16 @@ void ZipPackage::parseManifest()
}
else
{
- pStream = reinterpret_cast < ZipPackageStream* > ( xUnoTunnel->getSomething(ZipPackageStream::static_getImplementationId()));
+ pStream = reinterpret_cast < ZipPackageStream* > ( xUnoTunnel->getSomething( ZipPackageStream::static_getImplementationId() ));
pStream->SetMediaType ( sMediaType );
pStream->SetFromManifest( sal_True );
- if (pSalt && pVector && pCount && pSize)
+ if ( pSalt && pVector && pCount && pSize && pDigest && pDigestAlg && pEncryptionAlg )
{
- Sequence < sal_uInt8 > aSequence;
- sal_Int32 nCount = 0, nSize = 0;
- pStream->SetToBeEncrypted ( sal_True );
+ uno::Sequence < sal_Int8 > aSequence;
+ sal_Int32 nCount = 0, nSize = 0, nDigestAlg = 0, nEncryptionAlg = 0, nDerivedKeySize = 16, nStartKeyAlg = xml::crypto::DigestID::SHA1;
+
+ pStream->SetToBeEncrypted ( sal_True );
*pSalt >>= aSequence;
pStream->setSalt ( aSequence );
@@ -321,18 +330,34 @@ void ZipPackage::parseManifest()
*pSize >>= nSize;
pStream->setSize ( nSize );
- if ( pDigest )
- {
- *pDigest >>= aSequence;
- pStream->setDigest ( aSequence );
- }
+ *pDigest >>= aSequence;
+ pStream->setDigest ( aSequence );
+
+ *pDigestAlg >>= nDigestAlg;
+ pStream->SetImportedChecksumAlgorithm( nDigestAlg );
+
+ *pEncryptionAlg >>= nEncryptionAlg;
+ pStream->SetImportedEncryptionAlgorithm( nEncryptionAlg );
+
+ if ( pDerivedKeySize )
+ *pDerivedKeySize >>= nDerivedKeySize;
+ pStream->SetImportedDerivedKeySize( nDerivedKeySize );
+
+ if ( pStartKeyAlg )
+ *pStartKeyAlg >>= nStartKeyAlg;
+ pStream->SetImportedStartKeyAlgorithm( nStartKeyAlg );
pStream->SetToBeCompressed ( sal_True );
pStream->SetToBeEncrypted ( sal_True );
pStream->SetIsEncrypted ( sal_True );
if ( !m_bHasEncryptedEntries
&& pStream->getName().equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ) ) )
+ {
m_bHasEncryptedEntries = sal_True;
+ m_nStartKeyGenerationID = nStartKeyAlg;
+ m_nChecksumDigestID = nDigestAlg;
+ m_nCommonEncryptionID = nEncryptionAlg;
+ }
}
else
m_bHasNonEncryptedEntries = sal_True;
@@ -382,7 +407,7 @@ void ZipPackage::parseManifest()
nRead = aData.getLength();
if ( nRead )
- aPackageMediatype = ::rtl::OUString( (sal_Char*)aData.getConstArray(), nRead, RTL_TEXTENCODING_ASCII_US );
+ aPackageMediatype = ::rtl::OUString( ( sal_Char* )aData.getConstArray(), nRead, RTL_TEXTENCODING_ASCII_US );
}
}
@@ -411,24 +436,35 @@ void ZipPackage::parseManifest()
m_bInconsistent = m_pRootFolder->LookForUnexpectedODF12Streams( ::rtl::OUString() );
- sal_Bool bODF12AndOlder = ( m_pRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 );
- if ( !m_bForceRecovery && bODF12AndOlder && m_bInconsistent )
+ sal_Bool bODF12AndNewer = ( m_pRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 );
+ if ( !m_bForceRecovery && bODF12AndNewer )
{
- // this is an ODF1.2 document that contains streams not referred in the manifest.xml;
- // in case of ODF1.2 documents without version in manifest.xml the property IsInconsistent
- // should be checked later
- throw ZipIOException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "there are streams not referred in manifest.xml\n" ) ),
- uno::Reference< uno::XInterface >() );
+ if ( m_bInconsistent )
+ {
+ // this is an ODF1.2 document that contains streams not referred in the manifest.xml;
+ // in case of ODF1.2 documents without version in manifest.xml the property IsInconsistent
+ // should be checked later
+ throw ZipIOException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "there are streams not referred in manifest.xml\n" ) ),
+ uno::Reference< uno::XInterface >() );
+ }
+ else if ( bDifferentStartKeyAlgorithm )
+ {
+ // all the streams should be encrypted with the same StartKey in ODF1.2
+ // TODO/LATER: in future the exception should be thrown
+ OSL_ENSURE( false, "ODF1.2 contains different StartKey Algorithms" );
+ // throw ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "More than one Start Key Generation algorithm is specified!" ) ), uno::Reference< uno::XInterface >() );
+ }
}
// in case it is a correct ODF1.2 document, the version must be set
// and the META-INF folder is reserved for package format
- if ( bODF12AndOlder )
+ if ( bODF12AndNewer )
m_xRootFolder->removeByName( sMeta );
}
}
+//--------------------------------------------------------
void ZipPackage::parseContentType()
{
if ( m_nFormat == embed::StorageFormats::OFOPXML )
@@ -465,7 +501,7 @@ void ZipPackage::parseContentType()
for ( nInd = 0; nInd < aContentTypeInfo[1].getLength(); nInd++ )
{
::rtl::OUString aPath;
- if ( aContentTypeInfo[1][nInd].First.toChar() == (sal_Unicode)'/' )
+ if ( aContentTypeInfo[1][nInd].First.toChar() == ( sal_Unicode )'/' )
aPath = aContentTypeInfo[1][nInd].First.copy( 1 );
else
aPath = aContentTypeInfo[1][nInd].First;
@@ -497,6 +533,7 @@ void ZipPackage::parseContentType()
}
}
+//--------------------------------------------------------
void ZipPackage::getZipFileContents()
{
auto_ptr < ZipEnumeration > pEnum ( m_pZipFile->entries() );
@@ -506,7 +543,7 @@ void ZipPackage::getZipFileContents()
sal_Int32 nOldIndex, nIndex, nStreamIndex;
FolderHash::iterator aIter;
- while (pEnum->hasMoreElements())
+ while ( pEnum->hasMoreElements() )
{
nIndex = nOldIndex = 0;
pCurrent = m_pRootFolder;
@@ -523,18 +560,18 @@ void ZipPackage::getZipFileContents()
nStreamIndex = rName.lastIndexOf ( '/' );
if ( nStreamIndex != -1 )
{
- sDirName = rName.copy ( 0, nStreamIndex);
+ sDirName = rName.copy ( 0, nStreamIndex );
aIter = m_aRecent.find ( sDirName );
if ( aIter != m_aRecent.end() )
- pCurrent = (*aIter).second;
+ pCurrent = ( *aIter ).second;
}
if ( pCurrent == m_pRootFolder )
{
- while ( (nIndex = rName.indexOf('/', nOldIndex) ) != -1 )
+ while ( ( nIndex = rName.indexOf( '/', nOldIndex ) ) != -1 )
{
sTemp = rName.copy ( nOldIndex, nIndex - nOldIndex );
- if (nIndex == nOldIndex)
+ if ( nIndex == nOldIndex )
break;
if ( !pCurrent->hasByName( sTemp ) )
{
@@ -544,7 +581,7 @@ void ZipPackage::getZipFileContents()
pCurrent = pPkgFolder;
}
else
- pCurrent = pCurrent->doGetByName(sTemp).pFolder;
+ pCurrent = pCurrent->doGetByName( sTemp ).pFolder;
nOldIndex = nIndex+1;
}
if ( nStreamIndex != -1 && sDirName.getLength() )
@@ -553,7 +590,7 @@ void ZipPackage::getZipFileContents()
if ( rName.getLength() -1 != nStreamIndex )
{
nStreamIndex++;
- sTemp = rName.copy( nStreamIndex, rName.getLength() - nStreamIndex);
+ sTemp = rName.copy( nStreamIndex, rName.getLength() - nStreamIndex );
pPkgStream = new ZipPackageStream( *this, m_xFactory, m_bAllowRemoveOnInsert );
pPkgStream->SetPackageMember( sal_True );
pPkgStream->setZipEntryOnLoading( rEntry );
@@ -568,9 +605,9 @@ void ZipPackage::getZipFileContents()
parseContentType();
}
-// XInitialization
-void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException)
+//--------------------------------------------------------
+void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
+ throw( Exception, RuntimeException )
{
RTL_LOGFILE_TRACE_AUTHOR ( "package", LOGFILE_AUTHOR, "{ ZipPackage::initialize" );
sal_Bool bBadZipFile = sal_False, bHaveZipFile = sal_True;
@@ -582,7 +619,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
for( int ind = 0; ind < aArguments.getLength(); ind++ )
{
OUString aParamUrl;
- if ( (aArguments[ind] >>= aParamUrl))
+ if ( ( aArguments[ind] >>= aParamUrl ))
{
m_eMode = e_IMode_URL;
try
@@ -629,13 +666,13 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
if( !bHasSizeProperty || ( bHasSizeProperty && aSize ) )
{
uno::Reference < XActiveDataSink > xSink = new ZipPackageSink;
- if (aContent.openStream ( xSink ) )
+ if ( aContent.openStream ( xSink ) )
m_xContentStream = xSink->getInputStream();
}
else
bHaveZipFile = sal_False;
}
- catch (com::sun::star::uno::Exception&)
+ catch ( com::sun::star::uno::Exception& )
{
// Exception derived from uno::Exception thrown. This probably
// means the file doesn't exist...we'll create it at
@@ -643,13 +680,13 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
bHaveZipFile = sal_False;
}
}
- else if ( (aArguments[ind] >>= m_xStream ) )
+ else if ( ( aArguments[ind] >>= m_xStream ) )
{
// a writable stream can implement both XStream & XInputStream
m_eMode = e_IMode_XStream;
m_xContentStream = m_xStream->getInputStream();
}
- else if ( (aArguments[ind] >>= m_xContentStream) )
+ else if ( ( aArguments[ind] >>= m_xContentStream ) )
{
m_eMode = e_IMode_XInputStream;
}
@@ -717,7 +754,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
try
{
- if (m_xContentStream.is())
+ if ( m_xContentStream.is() )
{
// the stream must be seekable, if it is not it will be wrapped
m_xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( m_xContentStream, m_xFactory );
@@ -732,7 +769,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
else
bHaveZipFile = sal_False;
}
- catch (com::sun::star::uno::Exception&)
+ catch ( com::sun::star::uno::Exception& )
{
// Exception derived from uno::Exception thrown. This probably
// means the file doesn't exist...we'll create it at
@@ -775,22 +812,23 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
RTL_LOGFILE_TRACE_AUTHOR ( "package", LOGFILE_AUTHOR, "} ZipPackage::initialize" );
}
+//--------------------------------------------------------
Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
- throw(NoSuchElementException, RuntimeException)
+ throw( NoSuchElementException, RuntimeException )
{
OUString sTemp, sDirName;
sal_Int32 nOldIndex, nIndex, nStreamIndex;
FolderHash::iterator aIter;
- if ( (nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' )
- return makeAny ( uno::Reference < XUnoTunnel > (m_pRootFolder) );
+ if ( ( nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' )
+ return makeAny ( uno::Reference < XUnoTunnel > ( m_pRootFolder ) );
else
{
nStreamIndex = aName.lastIndexOf ( '/' );
bool bFolder = nStreamIndex == nIndex-1;
if ( nStreamIndex != -1 )
{
- sDirName = aName.copy ( 0, nStreamIndex);
+ sDirName = aName.copy ( 0, nStreamIndex );
aIter = m_aRecent.find ( sDirName );
if ( aIter != m_aRecent.end() )
{
@@ -798,16 +836,16 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
{
sal_Int32 nDirIndex = aName.lastIndexOf ( '/', nStreamIndex );
sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 );
- if ( sTemp == (*aIter).second->getName() )
- return makeAny ( uno::Reference < XUnoTunnel > ( (*aIter).second ) );
+ if ( sTemp == ( *aIter ).second->getName() )
+ return makeAny ( uno::Reference < XUnoTunnel > ( ( *aIter ).second ) );
else
m_aRecent.erase ( aIter );
}
else
{
sTemp = aName.copy ( nStreamIndex + 1 );
- if ( (*aIter).second->hasByName( sTemp ) )
- return (*aIter).second->getByName( sTemp );
+ if ( ( *aIter ).second->hasByName( sTemp ) )
+ return ( *aIter ).second->getByName( sTemp );
else
m_aRecent.erase( aIter );
}
@@ -821,15 +859,15 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
nOldIndex = 0;
ZipPackageFolder * pCurrent = m_pRootFolder;
ZipPackageFolder * pPrevious = NULL;
- while ( ( nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ while ( ( nIndex = aName.indexOf( '/', nOldIndex )) != -1 )
{
- sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ sTemp = aName.copy ( nOldIndex, nIndex - nOldIndex );
if ( nIndex == nOldIndex )
break;
if ( pCurrent->hasByName( sTemp ) )
{
pPrevious = pCurrent;
- pCurrent = pCurrent->doGetByName(sTemp).pFolder;
+ pCurrent = pCurrent->doGetByName( sTemp ).pFolder;
}
else
throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -837,16 +875,16 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
}
if ( bFolder )
{
- if (nStreamIndex != -1 )
+ if ( nStreamIndex != -1 )
m_aRecent[sDirName] = pPrevious;
return makeAny ( uno::Reference < XUnoTunnel > ( pCurrent ) );
}
else
{
- sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
+ sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex );
if ( pCurrent->hasByName ( sTemp ) )
{
- if (nStreamIndex != -1 )
+ if ( nStreamIndex != -1 )
m_aRecent[sDirName] = pCurrent;
return pCurrent->getByName( sTemp );
}
@@ -856,14 +894,15 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
}
}
+//--------------------------------------------------------
sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
- throw(RuntimeException)
+ throw( RuntimeException )
{
OUString sTemp, sDirName;
sal_Int32 nOldIndex, nIndex, nStreamIndex;
FolderHash::iterator aIter;
- if ( (nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' )
+ if ( ( nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' )
return sal_True;
else
{
@@ -871,7 +910,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
bool bFolder = nStreamIndex == nIndex-1;
if ( nStreamIndex != -1 )
{
- sDirName = aName.copy ( 0, nStreamIndex);
+ sDirName = aName.copy ( 0, nStreamIndex );
aIter = m_aRecent.find ( sDirName );
if ( aIter != m_aRecent.end() )
{
@@ -879,7 +918,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
{
sal_Int32 nDirIndex = aName.lastIndexOf ( '/', nStreamIndex );
sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 );
- if ( sTemp == (*aIter).second->getName() )
+ if ( sTemp == ( *aIter ).second->getName() )
return sal_True;
else
m_aRecent.erase ( aIter );
@@ -887,7 +926,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
else
{
sTemp = aName.copy ( nStreamIndex + 1 );
- if ( (*aIter).second->hasByName( sTemp ) )
+ if ( ( *aIter ).second->hasByName( sTemp ) )
return sal_True;
else
m_aRecent.erase( aIter );
@@ -902,9 +941,9 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
ZipPackageFolder * pCurrent = m_pRootFolder;
ZipPackageFolder * pPrevious = NULL;
nOldIndex = 0;
- while ( ( nIndex = aName.indexOf('/', nOldIndex)) != -1)
+ while ( ( nIndex = aName.indexOf( '/', nOldIndex )) != -1 )
{
- sTemp = aName.copy (nOldIndex, nIndex - nOldIndex);
+ sTemp = aName.copy ( nOldIndex, nIndex - nOldIndex );
if ( nIndex == nOldIndex )
break;
if ( pCurrent->hasByName( sTemp ) )
@@ -923,7 +962,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
}
else
{
- sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex);
+ sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex );
if ( pCurrent->hasByName( sTemp ) )
{
@@ -935,21 +974,22 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
}
}
-// XSingleServiceFactory
-uno::Reference< XInterface > SAL_CALL ZipPackage::createInstance( )
- throw(Exception, RuntimeException)
+//--------------------------------------------------------
+uno::Reference< XInterface > SAL_CALL ZipPackage::createInstance()
+ throw( Exception, RuntimeException )
{
- uno::Reference < XInterface > xRef = *(new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert ));
+ uno::Reference < XInterface > xRef = *( new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert ) );
return xRef;
}
-uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException)
+//--------------------------------------------------------
+uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( const uno::Sequence< Any >& aArguments )
+ throw( Exception, RuntimeException )
{
sal_Bool bArg = sal_False;
uno::Reference < XInterface > xRef;
if ( aArguments.getLength() )
aArguments[0] >>= bArg;
- if (bArg)
+ if ( bArg )
xRef = *new ZipPackageFolder ( m_xFactory, m_nFormat, m_bAllowRemoveOnInsert );
else
xRef = *new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert );
@@ -957,16 +997,17 @@ uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( c
return xRef;
}
+//--------------------------------------------------------
void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
{
const OUString sMime ( RTL_CONSTASCII_USTRINGPARAM ( "mimetype" ) );
- if (m_xRootFolder->hasByName( sMime ) )
+ if ( m_xRootFolder->hasByName( sMime ) )
m_xRootFolder->removeByName( sMime );
ZipEntry * pEntry = new ZipEntry;
- sal_Int32 nBufferLength = m_pRootFolder->GetMediaType( ).getLength();
+ sal_Int32 nBufferLength = m_pRootFolder->GetMediaType().getLength();
OString sMediaType = OUStringToOString( m_pRootFolder->GetMediaType(), RTL_TEXTENCODING_ASCII_US );
- Sequence< sal_Int8 > aType( (sal_Int8*)sMediaType.getStr(),
+ uno::Sequence< sal_Int8 > aType( ( sal_Int8* )sMediaType.getStr(),
nBufferLength );
@@ -981,14 +1022,12 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
try
{
- rtl::Reference < EncryptionData > xEmpty;
- aZipOut.putNextEntry( *pEntry, xEmpty );
+ aZipOut.putNextEntry( *pEntry, NULL );
aZipOut.write( aType, 0, nBufferLength );
aZipOut.closeEntry();
}
catch ( ::com::sun::star::io::IOException & r )
{
- OSL_FAIL( "Error adding mimetype to the ZipOutputStream" );
throw WrappedTargetException(
OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Error adding mimetype to the ZipOutputStream!" ) ),
static_cast < OWeakObject * > ( this ),
@@ -996,7 +1035,8 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
}
}
-void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< Sequence < PropertyValue > >& aManList )
+//--------------------------------------------------------
+void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Sequence < PropertyValue > >& aManList )
{
// Write the manifest
uno::Reference < XOutputStream > xManOutStream;
@@ -1006,28 +1046,29 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< Sequence
{
ZipEntry * pEntry = new ZipEntry;
ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
- xManOutStream = uno::Reference < XOutputStream > (*pBuffer, UNO_QUERY);
+ xManOutStream = uno::Reference < XOutputStream > ( *pBuffer, UNO_QUERY );
- pEntry->sPath = OUString( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml") );
+ pEntry->sPath = OUString( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml" ) );
pEntry->nMethod = DEFLATED;
pEntry->nCrc = pEntry->nSize = pEntry->nCompressedSize = -1;
pEntry->nTime = ZipOutputStream::getCurrentDosTime();
- // Convert vector into a Sequence
- Sequence < Sequence < PropertyValue > > aManifestSequence ( aManList.size() );
- Sequence < PropertyValue > * pSequence = aManifestSequence.getArray();
- for (vector < Sequence < PropertyValue > >::const_iterator aIter = aManList.begin(), aEnd = aManList.end();
+ // Convert vector into a uno::Sequence
+ uno::Sequence < uno::Sequence < PropertyValue > > aManifestSequence ( aManList.size() );
+ sal_Int32 nInd = 0;
+ for ( vector < uno::Sequence < PropertyValue > >::const_iterator aIter = aManList.begin(), aEnd = aManList.end();
aIter != aEnd;
- ++aIter, ++pSequence)
- *pSequence= (*aIter);
+ aIter++, nInd++ )
+ {
+ aManifestSequence[nInd] = ( *aIter );
+ }
xWriter->writeManifestSequence ( xManOutStream, aManifestSequence );
sal_Int32 nBufferLength = static_cast < sal_Int32 > ( pBuffer->getPosition() );
pBuffer->realloc( nBufferLength );
// the manifest.xml is never encrypted - so pass an empty reference
- rtl::Reference < EncryptionData > xEmpty;
- aZipOut.putNextEntry( *pEntry, xEmpty );
+ aZipOut.putNextEntry( *pEntry, NULL );
aZipOut.write( pBuffer->getSequence(), 0, nBufferLength );
aZipOut.closeEntry();
}
@@ -1042,7 +1083,8 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< Sequence
}
}
-void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< Sequence < PropertyValue > >& aManList )
+//--------------------------------------------------------
+void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno::Sequence < PropertyValue > >& aManList )
{
const OUString sFullPath ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
const OUString sMediaType ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
@@ -1051,12 +1093,12 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< Sequ
ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
uno::Reference< io::XOutputStream > xConTypeOutStream( *pBuffer, UNO_QUERY );
- pEntry->sPath = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "[Content_Types].xml") );
+ pEntry->sPath = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "[Content_Types].xml" ) );
pEntry->nMethod = DEFLATED;
pEntry->nCrc = pEntry->nSize = pEntry->nCompressedSize = -1;
pEntry->nTime = ZipOutputStream::getCurrentDosTime();
- // Convert vector into a Sequence
+ // Convert vector into a uno::Sequence
// TODO/LATER: use Defaulst entries in future
uno::Sequence< beans::StringPair > aDefaultsSequence;
uno::Sequence< beans::StringPair > aOverridesSequence( aManList.size() );
@@ -1068,14 +1110,14 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< Sequ
{
::rtl::OUString aPath;
::rtl::OUString aType;
- OSL_ENSURE( (*aIter)[PKG_MNFST_MEDIATYPE].Name.equals( sMediaType ) && (*aIter)[PKG_MNFST_FULLPATH].Name.equals( sFullPath ),
+ OSL_ENSURE( ( *aIter )[PKG_MNFST_MEDIATYPE].Name.equals( sMediaType ) && ( *aIter )[PKG_MNFST_FULLPATH].Name.equals( sFullPath ),
"The mediatype sequence format is wrong!\n" );
- (*aIter)[PKG_MNFST_MEDIATYPE].Value >>= aType;
+ ( *aIter )[PKG_MNFST_MEDIATYPE].Value >>= aType;
if ( aType.getLength() )
{
// only nonempty type makes sence here
nSeqLength++;
- (*aIter)[PKG_MNFST_FULLPATH].Value >>= aPath;
+ ( *aIter )[PKG_MNFST_FULLPATH].Value >>= aPath;
aOverridesSequence[nSeqLength-1].First = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) + aPath;
aOverridesSequence[nSeqLength-1].Second = aType;
}
@@ -1089,12 +1131,12 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< Sequ
pBuffer->realloc( nBufferLength );
// there is no encryption in this format currently
- rtl::Reference < EncryptionData > xEmpty;
- aZipOut.putNextEntry( *pEntry, xEmpty );
+ aZipOut.putNextEntry( *pEntry, NULL );
aZipOut.write( pBuffer->getSequence(), 0, nBufferLength );
aZipOut.closeEntry();
}
+//--------------------------------------------------------
void ZipPackage::ConnectTo( const uno::Reference< io::XInputStream >& xInStream )
{
m_xContentSeek.set( xInStream, uno::UNO_QUERY_THROW );
@@ -1108,6 +1150,7 @@ void ZipPackage::ConnectTo( const uno::Reference< io::XInputStream >& xInStream
m_pZipFile = new ZipFile ( m_xContentStream, m_xFactory, sal_False );
}
+//--------------------------------------------------------
uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
{
// In case the target local file does not exist or empty
@@ -1154,9 +1197,9 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
}
// Hand it to the ZipOutputStream:
- ZipOutputStream aZipOut ( xTempOut );
- aZipOut.setMethod(DEFLATED);
- aZipOut.setLevel(DEFAULT_COMPRESSION);
+ ZipOutputStream aZipOut( m_xFactory, xTempOut );
+ aZipOut.setMethod( DEFLATED );
+ aZipOut.setLevel( DEFAULT_COMPRESSION );
try
{
@@ -1169,7 +1212,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
if ( m_xRootFolder->hasByName( sMeta ) )
{
- const OUString sManifest (RTL_CONSTASCII_USTRINGPARAM( "manifest.xml") );
+ const OUString sManifest ( RTL_CONSTASCII_USTRINGPARAM( "manifest.xml" ) );
uno::Reference< XUnoTunnel > xTunnel;
Any aAny = m_xRootFolder->getByName( sMeta );
@@ -1194,7 +1237,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
}
// Create a vector to store data for the manifest.xml file
- vector < Sequence < PropertyValue > > aManList;
+ vector < uno::Sequence < PropertyValue > > aManList;
const OUString sMediaType ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
const OUString sVersion ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
@@ -1202,11 +1245,11 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
if ( m_nFormat == embed::StorageFormats::PACKAGE )
{
- Sequence < PropertyValue > aPropSeq ( PKG_SIZE_NOENCR_MNFST );
+ uno::Sequence < PropertyValue > aPropSeq( PKG_SIZE_NOENCR_MNFST );
aPropSeq [PKG_MNFST_MEDIATYPE].Name = sMediaType;
- aPropSeq [PKG_MNFST_MEDIATYPE].Value <<= m_pRootFolder->GetMediaType( );
+ aPropSeq [PKG_MNFST_MEDIATYPE].Value <<= m_pRootFolder->GetMediaType();
aPropSeq [PKG_MNFST_VERSION].Name = sVersion;
- aPropSeq [PKG_MNFST_VERSION].Value <<= m_pRootFolder->GetVersion( );
+ aPropSeq [PKG_MNFST_VERSION].Value <<= m_pRootFolder->GetVersion();
aPropSeq [PKG_MNFST_FULLPATH].Name = sFullPath;
aPropSeq [PKG_MNFST_FULLPATH].Value <<= OUString ( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
@@ -1221,15 +1264,14 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
rtlRandomPool aRandomPool = rtl_random_createPool ();
rtl_random_addBytes ( aRandomPool, &aTime, 8 );
-
- // call saveContents (it will recursively save sub-directories
+ // call saveContents ( it will recursively save sub-directories
OUString aEmptyString;
- m_pRootFolder->saveContents( aEmptyString, aManList, aZipOut, m_aEncryptionKey, aRandomPool );
+ m_pRootFolder->saveContents( aEmptyString, aManList, aZipOut, GetEncryptionKey(), aRandomPool );
// Clean up random pool memory
rtl_random_destroyPool ( aRandomPool );
- if( m_bUseManifest && m_nFormat == embed::StorageFormats::PACKAGE )
+ if( m_nFormat == embed::StorageFormats::PACKAGE )
{
WriteManifest( aZipOut, aManList );
}
@@ -1298,10 +1340,11 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
return xResult;
}
+//--------------------------------------------------------
uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
{
// open and truncate the original file
- Content aOriginalContent (m_aURL, uno::Reference < XCommandEnvironment >() );
+ Content aOriginalContent ( m_aURL, uno::Reference < XCommandEnvironment >() );
uno::Reference< XActiveDataStreamer > xSink = new ActiveDataStreamer;
if ( m_eMode == e_IMode_URL )
@@ -1335,7 +1378,7 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
aArg.Mode = OpenMode::DOCUMENT;
aArg.Priority = 0; // unused
aArg.Sink = xSink;
- aArg.Properties = Sequence< Property >( 0 ); // unused
+ aArg.Properties = uno::Sequence< Property >( 0 ); // unused
aOriginalContent.executeCommand( OUString(RTL_CONSTASCII_USTRINGPARAM( "open" )), makeAny( aArg ) );
}
@@ -1349,9 +1392,9 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
return xSink;
}
-// XChangesBatch
+//--------------------------------------------------------
void SAL_CALL ZipPackage::commitChanges()
- throw(WrappedTargetException, RuntimeException)
+ throw( WrappedTargetException, RuntimeException )
{
// lock the component for the time of commiting
::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
@@ -1414,8 +1457,8 @@ void SAL_CALL ZipPackage::commitChanges()
::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutputStream );
xOutputStream->flush();
uno::Reference< io::XAsyncOutputMonitor > asyncOutputMonitor(
- xOutputStream, uno::UNO_QUERY);
- if (asyncOutputMonitor.is()) {
+ xOutputStream, uno::UNO_QUERY );
+ if ( asyncOutputMonitor.is() ) {
asyncOutputMonitor->waitForCompletion();
}
}
@@ -1501,7 +1544,7 @@ void SAL_CALL ZipPackage::commitChanges()
// if the file is still not corrupted, it can become after the next step
aContent.executeCommand ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "transfer" ) ), aAny );
}
- catch (::com::sun::star::uno::Exception& r)
+ catch ( ::com::sun::star::uno::Exception& r )
{
if ( bCanBeCorrupted )
DisconnectFromTargetAndThrowException_Impl( xTempInStream );
@@ -1521,6 +1564,7 @@ void SAL_CALL ZipPackage::commitChanges()
RTL_LOGFILE_TRACE_AUTHOR ( "package", LOGFILE_AUTHOR, "} ZipPackage::commitChanges" );
}
+//--------------------------------------------------------
void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Reference< io::XInputStream >& xTempStream )
{
m_xStream = uno::Reference< io::XStream >( xTempStream, uno::UNO_QUERY );
@@ -1549,15 +1593,47 @@ void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Referenc
makeAny ( aException ) );
}
-sal_Bool SAL_CALL ZipPackage::hasPendingChanges( )
- throw(RuntimeException)
+//--------------------------------------------------------
+const uno::Sequence< sal_Int8 > ZipPackage::GetEncryptionKey()
+{
+ uno::Sequence< sal_Int8 > aResult;
+
+ if ( m_aStorageEncryptionKeys.getLength() )
+ {
+ ::rtl::OUString aNameToFind;
+ if ( m_nStartKeyGenerationID == xml::crypto::DigestID::SHA256 )
+ aNameToFind = PACKAGE_ENCRYPTIONDATA_SHA256UTF8;
+ else if ( m_nStartKeyGenerationID == xml::crypto::DigestID::SHA1 )
+ aNameToFind = PACKAGE_ENCRYPTIONDATA_SHA1UTF8;
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ for ( sal_Int32 nInd = 0; nInd < m_aStorageEncryptionKeys.getLength(); nInd++ )
+ if ( m_aStorageEncryptionKeys[nInd].Name.equals( aNameToFind ) )
+ m_aStorageEncryptionKeys[nInd].Value >>= aResult;
+
+ // empty keys are not allowed here
+ // so it is not important whether there is no key, or the key is empty, it is an error
+ if ( !aResult.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+ }
+ else
+ aResult = m_aEncryptionKey;
+
+ return aResult;
+}
+
+//--------------------------------------------------------
+sal_Bool SAL_CALL ZipPackage::hasPendingChanges()
+ throw( RuntimeException )
{
return sal_False;
}
-Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges( )
- throw(RuntimeException)
+//--------------------------------------------------------
+Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges()
+ throw( RuntimeException )
{
- return Sequence < ElementChange > ();
+ return uno::Sequence < ElementChange > ();
}
/**
@@ -1567,150 +1643,247 @@ Sequence< ElementChange > SAL_CALL ZipPackage::getPendingChanges( )
uno::Reference < XInterface >SAL_CALL ZipPackage_createInstance(
const uno::Reference< XMultiServiceFactory > & xMgr )
{
- return uno::Reference< XInterface >( *new ZipPackage(xMgr) );
+ return uno::Reference< XInterface >( *new ZipPackage( xMgr ) );
}
+//--------------------------------------------------------
OUString ZipPackage::static_getImplementationName()
{
return OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.comp.ZipPackage" ) );
}
+//--------------------------------------------------------
Sequence< OUString > ZipPackage::static_getSupportedServiceNames()
{
- Sequence< OUString > aNames(1);
+ uno::Sequence< OUString > aNames( 1 );
aNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.Package" ) );
return aNames;
}
+//--------------------------------------------------------
sal_Bool SAL_CALL ZipPackage::static_supportsService( OUString const & rServiceName )
{
return rServiceName == getSupportedServiceNames()[0];
}
+//--------------------------------------------------------
OUString ZipPackage::getImplementationName()
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return static_getImplementationName();
}
+//--------------------------------------------------------
Sequence< OUString > ZipPackage::getSupportedServiceNames()
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return static_getSupportedServiceNames();
}
+//--------------------------------------------------------
sal_Bool SAL_CALL ZipPackage::supportsService( OUString const & rServiceName )
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return static_supportsService ( rServiceName );
}
+//--------------------------------------------------------
uno::Reference < XSingleServiceFactory > ZipPackage::createServiceFactory( uno::Reference < XMultiServiceFactory > const & rServiceFactory )
{
- return cppu::createSingleFactory (rServiceFactory,
+ return cppu::createSingleFactory ( rServiceFactory,
static_getImplementationName(),
ZipPackage_createInstance,
- static_getSupportedServiceNames());
+ static_getSupportedServiceNames() );
}
namespace { struct lcl_ImplId : public rtl::Static< ::cppu::OImplementationId, lcl_ImplId > {}; }
-// XUnoTunnel
+//--------------------------------------------------------
Sequence< sal_Int8 > ZipPackage::getUnoTunnelImplementationId( void )
- throw (RuntimeException)
+ throw ( RuntimeException )
{
::cppu::OImplementationId &rId = lcl_ImplId::get();
return rId.getImplementationId();
}
-sal_Int64 SAL_CALL ZipPackage::getSomething( const Sequence< sal_Int8 >& aIdentifier )
- throw(RuntimeException)
+//--------------------------------------------------------
+sal_Int64 SAL_CALL ZipPackage::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier )
+ throw( RuntimeException )
{
- if (aIdentifier.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) )
+ if ( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), aIdentifier.getConstArray(), 16 ) )
return reinterpret_cast < sal_Int64 > ( this );
return 0;
}
-uno::Reference< XPropertySetInfo > SAL_CALL ZipPackage::getPropertySetInfo( )
- throw(RuntimeException)
+//--------------------------------------------------------
+uno::Reference< XPropertySetInfo > SAL_CALL ZipPackage::getPropertySetInfo()
+ throw( RuntimeException )
{
return uno::Reference < XPropertySetInfo > ();
}
+
+//--------------------------------------------------------
void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
- throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
{
if ( m_nFormat != embed::StorageFormats::PACKAGE )
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasEncryptedEntries") )
- ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("HasNonEncryptedEntries") )
- ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("IsInconsistent") )
- ||aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaTypeFallbackUsed") ) )
+ if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_ENCRYPTED_ENTRIES_PROPERTY ) )
+ ||aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) )
+ ||aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( IS_INCONSISTENT_PROPERTY ) )
+ ||aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MEDIATYPE_FALLBACK_USED_PROPERTY ) ) )
throw PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_KEY_PROPERTY ) ) )
{
- if (!( aValue >>= m_aEncryptionKey ) || m_aEncryptionKey.getLength() == 0 )
+ if ( !( aValue >>= m_aEncryptionKey ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ m_aStorageEncryptionKeys.realloc( 0 );
}
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UseManifest") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) )
{
- if (!( aValue >>= m_bUseManifest ) )
+ // this property is only necessary to support raw passwords in storage API;
+ // because of this support the storage has to operate with more than one key dependent on storage generation algorithm;
+ // when this support is removed, the storage will get only one key from outside
+ // TODO/LATER: Get rid of this property as well as of support of raw passwords in storages
+ uno::Sequence< beans::NamedValue > aKeys;
+ if ( !( aValue >>= aKeys ) || ( aKeys.getLength() && aKeys.getLength() < 2 ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ if ( aKeys.getLength() )
+ {
+ bool bHasSHA256 = false;
+ bool bHasSHA1 = false;
+ for ( sal_Int32 nInd = 0; nInd < aKeys.getLength(); nInd++ )
+ {
+ if ( aKeys[nInd].Name.equals( PACKAGE_ENCRYPTIONDATA_SHA256UTF8 ) )
+ bHasSHA256 = true;
+ if ( aKeys[nInd].Name.equals( PACKAGE_ENCRYPTIONDATA_SHA1UTF8 ) )
+ bHasSHA1 = true;
+ }
+
+ if ( !bHasSHA256 || !bHasSHA1 )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Expected keys are not provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
+ }
+
+ m_aStorageEncryptionKeys = aKeys;
+ m_aEncryptionKey.realloc( 0 );
+ }
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) )
+ {
+ uno::Sequence< beans::NamedValue > aAlgorithms;
+ if ( m_pZipFile || !( aValue >>= aAlgorithms ) || aAlgorithms.getLength() == 0 )
+ {
+ // the algorithms can not be changed if the file has a persistence based on the algorithms ( m_pZipFile )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "unexpected algorithms list is provided." ) ), uno::Reference< uno::XInterface >(), 2 );
+ }
+
+ for ( sal_Int32 nInd = 0; nInd < aAlgorithms.getLength(); nInd++ )
+ {
+ if ( aAlgorithms[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StartKeyGenerationAlgorithm" ) ) )
+ {
+ sal_Int32 nID = 0;
+ if ( !( aAlgorithms[nInd].Value >>= nID )
+ || ( nID != xml::crypto::DigestID::SHA256 && nID != xml::crypto::DigestID::SHA1 ) )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key generation algorithm is provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ m_nStartKeyGenerationID = nID;
+ }
+ else if ( aAlgorithms[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EncryptionAlgorithm" ) ) )
+ {
+ sal_Int32 nID = 0;
+ if ( !( aAlgorithms[nInd].Value >>= nID )
+ || ( nID != xml::crypto::CipherID::AES_CBC_W3C_PADDING && nID != xml::crypto::CipherID::BLOWFISH_CFB_8 ) )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key generation algorithm is provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ m_nCommonEncryptionID = nID;
+ }
+ else if ( aAlgorithms[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ChecksumAlgorithm" ) ) )
+ {
+ sal_Int32 nID = 0;
+ if ( !( aAlgorithms[nInd].Value >>= nID )
+ || ( nID != xml::crypto::DigestID::SHA1_1K && nID != xml::crypto::DigestID::SHA256_1K ) )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected start key generation algorithm is provided!" ) ), uno::Reference< uno::XInterface >(), 2 );
+
+ m_nChecksumDigestID = nID;
+ }
+ else
+ {
+ OSL_ENSURE( sal_False, "Unexpected encryption algorithm is provided!" );
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "unexpected algorithms list is provided." ) ), uno::Reference< uno::XInterface >(), 2 );
+ }
+ }
}
else
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
+
+//--------------------------------------------------------
Any SAL_CALL ZipPackage::getPropertyValue( const OUString& PropertyName )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
// TODO/LATER: Activate the check when zip-ucp is ready
// if ( m_nFormat != embed::StorageFormats::PACKAGE )
// throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
Any aAny;
- if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "EncryptionKey" ) ) )
+ if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( ENCRYPTION_KEY_PROPERTY ) ) )
{
aAny <<= m_aEncryptionKey;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "HasEncryptedEntries" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_ALGORITHMS_PROPERTY ) ) )
{
- aAny <<= m_bHasEncryptedEntries;
+ ::comphelper::SequenceAsHashMap aAlgorithms;
+ aAlgorithms[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StartKeyGenerationAlgorithm" ) ) ] <<= m_nStartKeyGenerationID;
+ aAlgorithms[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionAlgorithm" ) ) ] <<= m_nCommonEncryptionID;
+ aAlgorithms[ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ChecksumAlgorithm" ) ) ] <<= m_nChecksumDigestID;
+ aAny <<= aAlgorithms.getAsConstNamedValueList();
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "HasNonEncryptedEntries" ) ) )
+ if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) )
{
- aAny <<= m_bHasNonEncryptedEntries;
+ aAny <<= m_aStorageEncryptionKeys;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "IsInconsistent" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( HAS_ENCRYPTED_ENTRIES_PROPERTY ) ) )
{
- aAny <<= m_bInconsistent;
+ aAny <<= m_bHasEncryptedEntries;
+ return aAny;
+ }
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( HAS_NONENCRYPTED_ENTRIES_PROPERTY ) ) )
+ {
+ aAny <<= m_bHasNonEncryptedEntries;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "UseManifest" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( IS_INCONSISTENT_PROPERTY ) ) )
{
- aAny <<= m_bUseManifest;
+ aAny <<= m_bInconsistent;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "MediaTypeFallbackUsed" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( MEDIATYPE_FALLBACK_USED_PROPERTY ) ) )
{
aAny <<= m_bMediaTypeFallbackUsed;
return aAny;
}
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
+//--------------------------------------------------------
void SAL_CALL ZipPackage::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
}
+//--------------------------------------------------------
void SAL_CALL ZipPackage::removePropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*aListener*/ )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
}
+//--------------------------------------------------------
void SAL_CALL ZipPackage::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
}
+//--------------------------------------------------------
void SAL_CALL ZipPackage::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
{
}
diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx
index df789850189f..0d034f6af34c 100644
--- a/package/source/zippackage/ZipPackageEntry.cxx
+++ b/package/source/zippackage/ZipPackageEntry.cxx
@@ -75,18 +75,18 @@ void SAL_CALL ZipPackageEntry::setName( const OUString& aName )
// unfortunately no other exception than RuntimeException can be thrown here
// usually the package is used through storage implementation, the problem should be detected there
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aName, sal_True ) )
- throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected character is used in file name." ) ), Reference< XInterface >() );
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Unexpected character is used in file name." ) ), uno::Reference< XInterface >() );
msName = aName;
if ( pParent )
pParent->doInsertByName ( this, sal_False );
}
-Reference< XInterface > SAL_CALL ZipPackageEntry::getParent( )
+uno::Reference< XInterface > SAL_CALL ZipPackageEntry::getParent( )
throw(RuntimeException)
{
- // return Reference< XInterface >( xParent, UNO_QUERY );
- return Reference< XInterface >( static_cast< ::cppu::OWeakObject* >( pParent ), UNO_QUERY );
+ // return uno::Reference< XInterface >( xParent, UNO_QUERY );
+ return uno::Reference< XInterface >( static_cast< ::cppu::OWeakObject* >( pParent ), UNO_QUERY );
}
void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bInsert )
@@ -97,11 +97,11 @@ void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bIns
pNewParent->doInsertByName ( this, sal_False );
}
-void SAL_CALL ZipPackageEntry::setParent( const Reference< XInterface >& xNewParent )
+void SAL_CALL ZipPackageEntry::setParent( const uno::Reference< XInterface >& xNewParent )
throw(NoSupportException, RuntimeException)
{
sal_Int64 nTest(0);
- Reference < XUnoTunnel > xTunnel ( xNewParent, UNO_QUERY );
+ uno::Reference < XUnoTunnel > xTunnel ( xNewParent, UNO_QUERY );
if ( !xNewParent.is() || ( nTest = xTunnel->getSomething ( ZipPackageFolder::static_getImplementationId () ) ) == 0 )
throw NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -115,24 +115,24 @@ void SAL_CALL ZipPackageEntry::setParent( const Reference< XInterface >& xNewPar
}
}
//XPropertySet
-Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageEntry::getPropertySetInfo( )
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ZipPackageEntry::getPropertySetInfo( )
throw(RuntimeException)
{
- return Reference < beans::XPropertySetInfo > ();
+ return uno::Reference < beans::XPropertySetInfo > ();
}
-void SAL_CALL ZipPackageEntry::addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+void SAL_CALL ZipPackageEntry::addPropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ZipPackageEntry::removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< beans::XPropertyChangeListener >& /*aListener*/ )
+void SAL_CALL ZipPackageEntry::removePropertyChangeListener( const OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ZipPackageEntry::addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+void SAL_CALL ZipPackageEntry::addVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
-void SAL_CALL ZipPackageEntry::removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+void SAL_CALL ZipPackageEntry::removeVetoableChangeListener( const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
{
}
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index b7fd4dd0dd9c..7add5e8f7d90 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -47,22 +47,21 @@
#include <rtl/instance.hxx>
#include <memory>
+using namespace com::sun::star;
using namespace com::sun::star::packages::zip::ZipConstants;
using namespace com::sun::star::packages::zip;
using namespace com::sun::star::packages;
using namespace com::sun::star::container;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
using namespace com::sun::star::io;
using namespace cppu;
using namespace std;
using namespace ::com::sun::star;
-using rtl::OUString;
-namespace { struct lcl_CachedImplId : public rtl::Static< Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
+namespace { struct lcl_CachedImplId : public rtl::Static< uno::Sequence < sal_Int8 >, lcl_CachedImplId > {}; }
-ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xFactory,
+ZipPackageFolder::ZipPackageFolder ( const uno::Reference< XMultiServiceFactory >& xFactory,
sal_Int32 nFormat,
sal_Bool bAllowRemoveOnInsert )
: m_xFactory( xFactory )
@@ -81,7 +80,7 @@ ZipPackageFolder::ZipPackageFolder ( const Reference< XMultiServiceFactory >& xF
aEntry.nCompressedSize = 0;
aEntry.nSize = 0;
aEntry.nOffset = -1;
- Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
+ uno::Sequence < sal_Int8 > &rCachedImplId = lcl_CachedImplId::get();
if ( !rCachedImplId.getLength() )
rCachedImplId = getImplementationId();
}
@@ -99,7 +98,7 @@ sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString&
!bHasUnexpected && aCI != aEnd;
++aCI)
{
- const OUString &rShortName = (*aCI).first;
+ const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
if ( rInfo.bFolder )
@@ -111,7 +110,7 @@ sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString&
}
else
{
- OUString sOwnPath = aPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ ::rtl::OUString sOwnPath = aPath + rShortName + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
bHasUnexpected = rInfo.pFolder->LookForUnexpectedODF12Streams( sOwnPath );
}
}
@@ -157,7 +156,7 @@ void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair&
aCI != aEnd;
++aCI)
{
- const OUString &rShortName = (*aCI).first;
+ const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
if ( rInfo.bFolder )
@@ -193,14 +192,14 @@ const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageFolder::static_get
}
// XNameContainer
-void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any& aElement )
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, uno::RuntimeException)
{
if (hasByName(aName))
throw ElementExistException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else
{
- Reference < XUnoTunnel > xRef;
+ uno::Reference < XUnoTunnel > xRef;
aElement >>= xRef;
if ( ( aElement >>= xRef ) )
{
@@ -227,8 +226,8 @@ void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const Any&
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 0 );
}
}
-void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::removeByName( const ::rtl::OUString& Name )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
ContentHash::iterator aIter = maContents.find ( Name );
if ( aIter == maContents.end() )
@@ -236,55 +235,55 @@ void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name )
maContents.erase( aIter );
}
// XEnumerationAccess
-Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
- throw(RuntimeException)
+uno::Reference< XEnumeration > SAL_CALL ZipPackageFolder::createEnumeration( )
+ throw(uno::RuntimeException)
{
- return Reference < XEnumeration> (new ZipPackageFolderEnumeration(maContents));
+ return uno::Reference < XEnumeration> (new ZipPackageFolderEnumeration(maContents));
}
// XElementAccess
-Type SAL_CALL ZipPackageFolder::getElementType( )
- throw(RuntimeException)
+uno::Type SAL_CALL ZipPackageFolder::getElementType( )
+ throw(uno::RuntimeException)
{
- return ::getCppuType ((const Reference< XUnoTunnel > *) 0);
+ return ::getCppuType ((const uno::Reference< XUnoTunnel > *) 0);
}
sal_Bool SAL_CALL ZipPackageFolder::hasElements( )
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
return maContents.size() > 0;
}
// XNameAccess
-ContentInfo& ZipPackageFolder::doGetByName( const OUString& aName )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+ContentInfo& ZipPackageFolder::doGetByName( const ::rtl::OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
ContentHash::iterator aIter = maContents.find ( aName );
if ( aIter == maContents.end())
throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
return *(*aIter).second;
}
-Any SAL_CALL ZipPackageFolder::getByName( const OUString& aName )
- throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+uno::Any SAL_CALL ZipPackageFolder::getByName( const ::rtl::OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
- return makeAny ( doGetByName ( aName ).xTunnel );
+ return uno::makeAny ( doGetByName ( aName ).xTunnel );
}
-Sequence< OUString > SAL_CALL ZipPackageFolder::getElementNames( )
- throw(RuntimeException)
+uno::Sequence< ::rtl::OUString > SAL_CALL ZipPackageFolder::getElementNames( )
+ throw(uno::RuntimeException)
{
sal_uInt32 i=0, nSize = maContents.size();
- Sequence < OUString > aSequence ( nSize );
+ uno::Sequence < ::rtl::OUString > aSequence ( nSize );
for ( ContentHash::const_iterator aIterator = maContents.begin(), aEnd = maContents.end();
aIterator != aEnd;
++i, ++aIterator)
aSequence[i] = (*aIterator).first;
return aSequence;
}
-sal_Bool SAL_CALL ZipPackageFolder::hasByName( const OUString& aName )
- throw(RuntimeException)
+sal_Bool SAL_CALL ZipPackageFolder::hasByName( const ::rtl::OUString& aName )
+ throw(uno::RuntimeException)
{
return maContents.find ( aName ) != maContents.end ();
}
// XNameReplace
-void SAL_CALL ZipPackageFolder::replaceByName( const OUString& aName, const Any& aElement )
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement )
+ throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, uno::RuntimeException)
{
if ( hasByName( aName ) )
removeByName( aName );
@@ -293,7 +292,7 @@ void SAL_CALL ZipPackageFolder::replaceByName( const OUString& aName, const Any&
insertByName(aName, aElement);
}
-static void ImplSetStoredData( ZipEntry & rEntry, Reference < XInputStream> & rStream )
+static void ImplSetStoredData( ZipEntry & rEntry, uno::Reference< XInputStream> & rStream )
{
// It's very annoying that we have to do this, but lots of zip packages
// don't allow data descriptors for STORED streams, meaning we have to
@@ -305,25 +304,29 @@ static void ImplSetStoredData( ZipEntry & rEntry, Reference < XInputStream> & rS
rEntry.nCrc = aCRC32.getValue();
}
-bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo &rInfo, OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool &rRandomPool)
+bool ZipPackageFolder::saveChild( const ::rtl::OUString &rShortName, const ContentInfo &rInfo, ::rtl::OUString &rPath, std::vector < uno::Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool)
{
bool bSuccess = true;
- const OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
- const OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
- const OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
- const OUString sInitialisationVectorProperty ( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
- const OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
- const OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
- const OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
- const OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
-
- Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
+ const ::rtl::OUString sMediaTypeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
+ const ::rtl::OUString sVersionProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
+ const ::rtl::OUString sFullPathProperty ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
+ const ::rtl::OUString sInitialisationVectorProperty ( RTL_CONSTASCII_USTRINGPARAM ( "InitialisationVector" ) );
+ const ::rtl::OUString sSaltProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Salt" ) );
+ const ::rtl::OUString sIterationCountProperty ( RTL_CONSTASCII_USTRINGPARAM ( "IterationCount" ) );
+ const ::rtl::OUString sSizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Size" ) );
+ const ::rtl::OUString sDigestProperty ( RTL_CONSTASCII_USTRINGPARAM ( "Digest" ) );
+ const ::rtl::OUString sEncryptionAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "EncryptionAlgorithm" ) );
+ const ::rtl::OUString sStartKeyAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "StartKeyAlgorithm" ) );
+ const ::rtl::OUString sDigestAlgProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DigestAlgorithm" ) );
+ const ::rtl::OUString sDerivedKeySizeProperty ( RTL_CONSTASCII_USTRINGPARAM ( "DerivedKeySize" ) );
+
+ uno::Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST);
OSL_ENSURE( ( rInfo.bFolder && rInfo.pFolder ) || ( !rInfo.bFolder && rInfo.pStream ), "A valid child object is expected!" );
if ( rInfo.bFolder )
{
- OUString sTempName = rPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ ::rtl::OUString sTempName = rPath + rShortName + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
if ( rInfo.pFolder->GetMediaType().getLength() )
{
@@ -378,7 +381,7 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
sal_Int32 nOwnStreamOrigSize = bRawStream ? rInfo.pStream->GetMagicalHackSize() : rInfo.pStream->getSize();
sal_Bool bUseNonSeekableAccess = sal_False;
- Reference < XInputStream > xStream;
+ uno::Reference < XInputStream > xStream;
if ( !rInfo.pStream->IsPackageMember() && !bRawStream && !bToBeEncrypted && bToBeCompressed )
{
// the stream is not a package member, not a raw stream,
@@ -386,7 +389,7 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
// in this case nonseekable access can be used
xStream = rInfo.pStream->GetOwnStreamNoWrap();
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
+ uno::Reference < XSeekable > xSeek ( xStream, uno::UNO_QUERY );
bUseNonSeekableAccess = ( xStream.is() && !xSeek.is() );
}
@@ -402,7 +405,7 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
return bSuccess;
}
- Reference < XSeekable > xSeek ( xStream, UNO_QUERY );
+ uno::Reference < XSeekable > xSeek ( xStream, uno::UNO_QUERY );
try
{
if ( xSeek.is() )
@@ -450,15 +453,13 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
}
else
{
- OSL_FAIL( "The package component requires that every stream either be FROM a package or it must support XSeekable!" );
bSuccess = false;
return bSuccess;
}
}
}
- catch ( Exception& )
+ catch ( uno::Exception& )
{
- OSL_FAIL( "The stream provided to the package component has problems!" );
bSuccess = false;
return bSuccess;
}
@@ -467,9 +468,9 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
{
if ( bToBeEncrypted && !bTransportOwnEncrStreamAsRaw )
{
- Sequence < sal_uInt8 > aSalt ( 16 ), aVector ( 8 );
+ uno::Sequence < sal_Int8 > aSalt( 16 ), aVector( rInfo.pStream->GetBlockSize() );
rtl_random_getBytes ( rRandomPool, aSalt.getArray(), 16 );
- rtl_random_getBytes ( rRandomPool, aVector.getArray(), 8 );
+ rtl_random_getBytes ( rRandomPool, aVector.getArray(), aVector.getLength() );
sal_Int32 nIterationCount = 1024;
if ( !rInfo.pStream->HasOwnKey() )
@@ -498,8 +499,20 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
if ( bRawStream || bTransportOwnEncrStreamAsRaw )
{
+ ::rtl::Reference< EncryptionData > xEncData = rInfo.pStream->GetEncryptionData();
+ if ( !xEncData.is() )
+ throw uno::RuntimeException();
+
aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
aPropSet[PKG_MNFST_DIGEST].Value <<= rInfo.pStream->getDigest();
+ aPropSet[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ aPropSet[PKG_MNFST_ENCALG].Value <<= xEncData->m_nEncAlg;
+ aPropSet[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ aPropSet[PKG_MNFST_STARTALG].Value <<= xEncData->m_nStartKeyGenID;
+ aPropSet[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ aPropSet[PKG_MNFST_DIGESTALG].Value <<= xEncData->m_nCheckAlg;
+ aPropSet[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
+ aPropSet[PKG_MNFST_DERKEYSIZE].Value <<= xEncData->m_nDerivedKeySize;
}
}
}
@@ -520,7 +533,6 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
if ( !xStream.is() )
{
// Make sure that we actually _got_ a new one !
- OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
bSuccess = false;
return bSuccess;
}
@@ -531,11 +543,11 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
if ( bRawStream )
xStream->skipBytes( rInfo.pStream->GetMagicalHackPos() );
- rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream->getEncryptionData(), sal_False );
+ rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream, sal_False );
// the entry is provided to the ZipOutputStream that will delete it
pAutoTempEntry.release();
- Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
+ uno::Sequence < sal_Int8 > aSeq ( n_ConstBufferSize );
sal_Int32 nLength;
do
@@ -549,12 +561,10 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
}
catch ( ZipException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bSuccess = false;
}
catch ( IOException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bSuccess = false;
}
}
@@ -576,7 +586,6 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
if ( !xStream.is() )
{
// Make sure that we actually _got_ a new one !
- OSL_FAIL( "ZipPackageStream didn't have a stream associated with it, skipping!" );
bSuccess = false;
return bSuccess;
}
@@ -590,12 +599,12 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
try
{
- rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream->getEncryptionData(), bToBeEncrypted);
+ rZipOut.putNextEntry ( *pTempEntry, rInfo.pStream, bToBeEncrypted);
// the entry is provided to the ZipOutputStream that will delete it
pAutoTempEntry.release();
sal_Int32 nLength;
- Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
+ uno::Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
do
{
nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
@@ -607,19 +616,30 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
}
catch ( ZipException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bSuccess = false;
}
catch ( IOException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bSuccess = false;
}
if ( bToBeEncrypted )
{
+ ::rtl::Reference< EncryptionData > xEncData = rInfo.pStream->GetEncryptionData();
+ if ( !xEncData.is() )
+ throw uno::RuntimeException();
+
aPropSet[PKG_MNFST_DIGEST].Name = sDigestProperty;
aPropSet[PKG_MNFST_DIGEST].Value <<= rInfo.pStream->getDigest();
+ aPropSet[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ aPropSet[PKG_MNFST_ENCALG].Value <<= xEncData->m_nEncAlg;
+ aPropSet[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ aPropSet[PKG_MNFST_STARTALG].Value <<= xEncData->m_nStartKeyGenID;
+ aPropSet[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ aPropSet[PKG_MNFST_DIGESTALG].Value <<= xEncData->m_nCheckAlg;
+ aPropSet[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
+ aPropSet[PKG_MNFST_DERKEYSIZE].Value <<= xEncData->m_nDerivedKeySize;
+
rInfo.pStream->SetIsEncrypted ( sal_True );
}
}
@@ -665,8 +685,8 @@ bool ZipPackageFolder::saveChild( const OUString &rShortName, const ContentInfo
return bSuccess;
}
-void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, Sequence < sal_Int8 > &rEncryptionKey, rtlRandomPool &rRandomPool)
- throw(RuntimeException)
+void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno::Sequence < PropertyValue > > &rManList, ZipOutputStream & rZipOut, const uno::Sequence < sal_Int8 >& rEncryptionKey, rtlRandomPool &rRandomPool )
+ throw( uno::RuntimeException )
{
bool bWritingFailed = false;
@@ -681,18 +701,15 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
try
{
- rtl::Reference < EncryptionData > aEmptyEncr;
- rZipOut.putNextEntry ( *pTempEntry, aEmptyEncr, sal_False );
+ rZipOut.putNextEntry( *pTempEntry, NULL, sal_False );
rZipOut.rawCloseEntry();
}
catch ( ZipException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bWritingFailed = true;
}
catch ( IOException& )
{
- OSL_FAIL( "Error writing ZipOutputStream" );
bWritingFailed = true;
}
}
@@ -714,7 +731,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
aCI != aEnd;
aCI++)
{
- const OUString &rShortName = (*aCI).first;
+ const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
if ( !bMimeTypeStreamStored || !rShortName.equals( aMimeTypeStreamName ) )
@@ -722,7 +739,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
}
if( bWritingFailed )
- throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
void ZipPackageFolder::releaseUpwardRef( void )
@@ -754,8 +771,8 @@ void ZipPackageFolder::releaseUpwardRef( void )
#endif
}
-sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const Sequence< sal_Int8 >& aIdentifier )
- throw(RuntimeException)
+sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(uno::RuntimeException)
{
sal_Int64 nMe = 0;
if ( aIdentifier.getLength() == 16 &&
@@ -763,8 +780,8 @@ sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const Sequence< sal_Int8 >& a
nMe = reinterpret_cast < sal_Int64 > ( this );
return nMe;
}
-void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
- throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+void SAL_CALL ZipPackageFolder::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, uno::RuntimeException)
{
if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaType")))
{
@@ -781,8 +798,8 @@ void SAL_CALL ZipPackageFolder::setPropertyValue( const OUString& aPropertyName,
else
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
-Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName )
- throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+uno::Any SAL_CALL ZipPackageFolder::getPropertyValue( const ::rtl::OUString& PropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, uno::RuntimeException)
{
if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
{
@@ -790,18 +807,18 @@ Any SAL_CALL ZipPackageFolder::getPropertyValue( const OUString& PropertyName )
// if ( m_nFormat != embed::StorageFormats::PACKAGE )
// throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- return makeAny ( sMediaType );
+ return uno::makeAny ( sMediaType );
}
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Version" ) ) )
- return makeAny( m_sVersion );
+ return uno::makeAny( m_sVersion );
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Size" ) ) )
- return makeAny ( aEntry.nSize );
+ return uno::makeAny ( aEntry.nSize );
else
throw UnknownPropertyException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetParent )
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, uno::RuntimeException)
{
try
{
@@ -818,21 +835,21 @@ void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetPa
if ( bSetParent )
pEntry->setParent ( *this );
}
-OUString ZipPackageFolder::getImplementationName()
- throw (RuntimeException)
+::rtl::OUString ZipPackageFolder::getImplementationName()
+ throw (uno::RuntimeException)
{
- return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZipPackageFolder" ) );
+ return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZipPackageFolder" ) );
}
-Sequence< OUString > ZipPackageFolder::getSupportedServiceNames()
- throw (RuntimeException)
+uno::Sequence< ::rtl::OUString > ZipPackageFolder::getSupportedServiceNames()
+ throw (uno::RuntimeException)
{
- Sequence< OUString > aNames(1);
- aNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.PackageFolder" ) );
+ uno::Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.PackageFolder" ) );
return aNames;
}
-sal_Bool SAL_CALL ZipPackageFolder::supportsService( OUString const & rServiceName )
- throw (RuntimeException)
+sal_Bool SAL_CALL ZipPackageFolder::supportsService( ::rtl::OUString const & rServiceName )
+ throw (uno::RuntimeException)
{
return rServiceName == getSupportedServiceNames()[0];
}
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 06a4413492c1..06dc3edf82dd 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -17,7 +17,7 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
+ * ( a copy is included in the LICENSE file that accompanied this code ).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
@@ -26,7 +26,7 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
+// MARKER( update_precomp.py ): autogen include statement, do not remove
#include "precompiled_package.hxx"
#include <com/sun/star/packages/zip/ZipConstants.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
@@ -35,6 +35,8 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <ZipPackageStream.hxx>
@@ -67,21 +69,25 @@ const ::com::sun::star::uno::Sequence < sal_Int8 >& ZipPackageStream::static_get
}
ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
- const Reference< XMultiServiceFactory >& xFactory,
+ const uno::Reference< XMultiServiceFactory >& xFactory,
sal_Bool bAllowRemoveOnInsert )
: m_xFactory( xFactory )
-, rZipPackage(rNewPackage)
+, rZipPackage( rNewPackage )
, bToBeCompressed ( sal_True )
, bToBeEncrypted ( sal_False )
, bHaveOwnKey ( sal_False )
, bIsEncrypted ( sal_False )
-, xEncryptionData ( )
+, m_nImportedStartKeyAlgorithm( 0 )
+, m_nImportedEncryptionAlgorithm( 0 )
+, m_nImportedChecksumAlgorithm( 0 )
+, m_nImportedDerivedKeySize( 0 )
, m_nStreamMode( PACKAGE_STREAM_NOTSET )
, m_nMagicalHackPos( 0 )
, m_nMagicalHackSize( 0 )
, m_bHasSeekable( sal_False )
, m_bCompressedIsSetFromOutside( sal_False )
, m_bFromManifest( sal_False )
+, m_bUseWinEncoding( false )
{
OSL_ENSURE( m_xFactory.is(), "No factory is provided to ZipPackageStream!\n" );
@@ -108,7 +114,7 @@ ZipPackageStream::~ZipPackageStream( void )
{
}
-void ZipPackageStream::setZipEntryOnLoading( const ZipEntry &rInEntry)
+void ZipPackageStream::setZipEntryOnLoading( const ZipEntry &rInEntry )
{
aEntry.nVersion = rInEntry.nVersion;
aEntry.nFlag = rInEntry.nFlag;
@@ -138,7 +144,7 @@ void ZipPackageStream::CloseOwnStreamIfAny()
}
//--------------------------------------------------------------------------
-uno::Reference< io::XInputStream >& ZipPackageStream::GetOwnSeekStream()
+uno::Reference< io::XInputStream > ZipPackageStream::GetOwnSeekStream()
{
if ( !m_bHasSeekable && xStream.is() )
{
@@ -147,10 +153,10 @@ uno::Reference< io::XInputStream >& ZipPackageStream::GetOwnSeekStream()
// is accessed before commit it MUST be wrapped.
// Wrap the stream in case it is not seekable
xStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xStream, m_xFactory );
- Reference< io::XSeekable > xSeek( xStream, UNO_QUERY );
+ uno::Reference< io::XSeekable > xSeek( xStream, UNO_QUERY );
if ( !xSeek.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "The stream must support XSeekable!" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
m_bHasSeekable = sal_True;
}
@@ -164,18 +170,18 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop
if ( m_nStreamMode != PACKAGE_STREAM_RAW || !GetOwnSeekStream().is() )
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if ( !xEncryptionData.is() )
+ if ( m_xBaseEncryptionData.is() )
throw ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Encrypted stream without encryption data!\n" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
uno::Reference< io::XSeekable > xSeek( GetOwnSeekStream(), UNO_QUERY );
if ( !xSeek.is() )
throw ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "The stream must be seekable!\n" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
// skip header
- xSeek->seek( n_ConstHeaderSize + xEncryptionData->aInitVector.getLength() +
- xEncryptionData->aSalt.getLength() + xEncryptionData->aDigest.getLength() );
+ xSeek->seek( n_ConstHeaderSize + getInitialisationVector().getLength() +
+ getSalt().getLength() + getDigest().getLength() );
// create temporary stream
uno::Reference < io::XOutputStream > xTempOut(
@@ -195,17 +201,95 @@ uno::Reference< io::XInputStream > ZipPackageStream::GetRawEncrStreamNoHeaderCop
}
//--------------------------------------------------------------------------
-Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_Bool bAddHeaderForEncr )
+sal_Int32 ZipPackageStream::GetEncryptionAlgorithm() const
{
- if ( m_nStreamMode != PACKAGE_STREAM_DATA || !GetOwnSeekStream().is() || (bAddHeaderForEncr && !bToBeEncrypted) )
+ return m_nImportedEncryptionAlgorithm ? m_nImportedEncryptionAlgorithm : rZipPackage.GetEncAlgID();
+}
+
+//--------------------------------------------------------------------------
+sal_Int32 ZipPackageStream::GetBlockSize() const
+{
+ return GetEncryptionAlgorithm() == ::com::sun::star::xml::crypto::CipherID::AES_CBC_W3C_PADDING ? 16 : 8;
+}
+
+//--------------------------------------------------------------------------
+::rtl::Reference< EncryptionData > ZipPackageStream::GetEncryptionData( bool bUseWinEncoding )
+{
+ ::rtl::Reference< EncryptionData > xResult;
+ if ( m_xBaseEncryptionData.is() )
+ xResult = new EncryptionData(
+ *m_xBaseEncryptionData,
+ GetEncryptionKey( bUseWinEncoding ),
+ GetEncryptionAlgorithm(),
+ m_nImportedChecksumAlgorithm ? m_nImportedChecksumAlgorithm : rZipPackage.GetChecksumAlgID(),
+ m_nImportedDerivedKeySize ? m_nImportedDerivedKeySize : rZipPackage.GetDefaultDerivedKeySize(),
+ GetStartKeyGenID() );
+
+ return xResult;
+}
+
+//--------------------------------------------------------------------------
+void ZipPackageStream::SetBaseEncryptionData( const ::rtl::Reference< BaseEncryptionData >& xData )
+{
+ m_xBaseEncryptionData = xData;
+}
+
+//--------------------------------------------------------------------------
+uno::Sequence< sal_Int8 > ZipPackageStream::GetEncryptionKey( bool bUseWinEncoding )
+{
+ uno::Sequence< sal_Int8 > aResult;
+ sal_Int32 nKeyGenID = GetStartKeyGenID();
+ bUseWinEncoding = ( bUseWinEncoding || m_bUseWinEncoding );
+
+ if ( bHaveOwnKey && m_aStorageEncryptionKeys.getLength() )
+ {
+ ::rtl::OUString aNameToFind;
+ if ( nKeyGenID == xml::crypto::DigestID::SHA256 )
+ aNameToFind = PACKAGE_ENCRYPTIONDATA_SHA256UTF8;
+ else if ( nKeyGenID == xml::crypto::DigestID::SHA1 )
+ {
+ aNameToFind = bUseWinEncoding ? PACKAGE_ENCRYPTIONDATA_SHA1MS1252 : PACKAGE_ENCRYPTIONDATA_SHA1UTF8;
+ }
+ else
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+
+ for ( sal_Int32 nInd = 0; nInd < m_aStorageEncryptionKeys.getLength(); nInd++ )
+ if ( m_aStorageEncryptionKeys[nInd].Name.equals( aNameToFind ) )
+ m_aStorageEncryptionKeys[nInd].Value >>= aResult;
+
+ // empty keys are not allowed here
+ // so it is not important whether there is no key, or the key is empty, it is an error
+ if ( !aResult.getLength() )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No expected key is provided!" ) ), uno::Reference< uno::XInterface >() );
+ }
+ else
+ aResult = m_aEncryptionKey;
+
+ if ( !aResult.getLength() || !bHaveOwnKey )
+ aResult = rZipPackage.GetEncryptionKey();
+
+ return aResult;
+}
+
+//--------------------------------------------------------------------------
+sal_Int32 ZipPackageStream::GetStartKeyGenID()
+{
+ // generally should all the streams use the same Start Key
+ // but if raw copy without password takes place, we should preserve the imported algorithm
+ return m_nImportedStartKeyAlgorithm ? m_nImportedStartKeyAlgorithm : rZipPackage.GetStartKeyGenID();
+}
+
+//--------------------------------------------------------------------------
+uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_Bool bAddHeaderForEncr )
+{
+ if ( m_nStreamMode != PACKAGE_STREAM_DATA || !GetOwnSeekStream().is() || ( bAddHeaderForEncr && !bToBeEncrypted ) )
throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
Sequence< sal_Int8 > aKey;
if ( bToBeEncrypted )
{
- aKey = ( !xEncryptionData.is() || !bHaveOwnKey ) ? rZipPackage.getEncryptionKey() :
- xEncryptionData->aKey;
+ aKey = GetEncryptionKey();
if ( !aKey.getLength() )
throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
}
@@ -221,7 +305,7 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B
// create a package based on it
ZipPackage* pPackage = new ZipPackage( m_xFactory );
- Reference< XSingleServiceFactory > xPackageAsFactory( static_cast< XSingleServiceFactory* >( pPackage ) );
+ uno::Reference< XSingleServiceFactory > xPackageAsFactory( static_cast< XSingleServiceFactory* >( pPackage ) );
if ( !xPackageAsFactory.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -230,14 +314,14 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B
pPackage->initialize( aArgs );
// create a new package stream
- Reference< XDataSinkEncrSupport > xNewPackStream( xPackageAsFactory->createInstance(), UNO_QUERY );
+ uno::Reference< XDataSinkEncrSupport > xNewPackStream( xPackageAsFactory->createInstance(), UNO_QUERY );
if ( !xNewPackStream.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
xNewPackStream->setDataStream( static_cast< io::XInputStream* >(
new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() ) ) );
- Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY );
+ uno::Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY );
if ( !xNewPSProps.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -246,26 +330,26 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B
xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Compressed" ) ), makeAny( bToBeCompressed ) );
if ( bToBeEncrypted )
{
- xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EncryptionKey" ) ), makeAny( aKey ) );
+ xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_KEY_PROPERTY ) ), makeAny( aKey ) );
xNewPSProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Encrypted" ) ), makeAny( sal_True ) );
}
// insert a new stream in the package
- Reference< XUnoTunnel > xTunnel;
+ uno::Reference< XUnoTunnel > xTunnel;
Any aRoot = pPackage->getByHierarchicalName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) );
aRoot >>= xTunnel;
- Reference< container::XNameContainer > xRootNameContainer( xTunnel, UNO_QUERY );
+ uno::Reference< container::XNameContainer > xRootNameContainer( xTunnel, UNO_QUERY );
if ( !xRootNameContainer.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- Reference< XUnoTunnel > xNPSTunnel( xNewPackStream, UNO_QUERY );
+ uno::Reference< XUnoTunnel > xNPSTunnel( xNewPackStream, UNO_QUERY );
xRootNameContainer->insertByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "dummy" ) ), makeAny( xNPSTunnel ) );
// commit the temporary package
pPackage->commitChanges();
// get raw stream from the temporary package
- Reference< io::XInputStream > xInRaw;
+ uno::Reference< io::XInputStream > xInRaw;
if ( bAddHeaderForEncr )
xInRaw = xNewPackStream->getRawStream();
else
@@ -286,12 +370,12 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B
xTempSeek->seek( 0 );
// close raw stream, package stream and folder
- xInRaw = Reference< io::XInputStream >();
- xNewPSProps = Reference< XPropertySet >();
- xNPSTunnel = Reference< XUnoTunnel >();
- xNewPackStream = Reference< XDataSinkEncrSupport >();
- xTunnel = Reference< XUnoTunnel >();
- xRootNameContainer = Reference< container::XNameContainer >();
+ xInRaw = uno::Reference< io::XInputStream >();
+ xNewPSProps = uno::Reference< XPropertySet >();
+ xNPSTunnel = uno::Reference< XUnoTunnel >();
+ xNewPackStream = uno::Reference< XDataSinkEncrSupport >();
+ xTunnel = uno::Reference< XUnoTunnel >();
+ xRootNameContainer = uno::Reference< container::XNameContainer >();
// return the stream representing the first temporary file
return xTempIn;
@@ -317,7 +401,7 @@ sal_Bool ZipPackageStream::ParsePackageRawStream()
sal_Bool bOk = sal_False;
- rtl::Reference < EncryptionData > xTempEncrData;
+ ::rtl::Reference< BaseEncryptionData > xTempEncrData;
sal_Int32 nMagHackSize = 0;
Sequence < sal_Int8 > aHeader ( 4 );
@@ -333,17 +417,25 @@ sal_Bool ZipPackageStream::ParsePackageRawStream()
if ( nHeader == n_ConstHeader )
{
// this is one of our god-awful, but extremely devious hacks, everyone cheer
- xTempEncrData = new EncryptionData;
+ xTempEncrData = new BaseEncryptionData;
::rtl::OUString aMediaType;
- if ( ZipFile::StaticFillData ( xTempEncrData, nMagHackSize, aMediaType, GetOwnSeekStream() ) )
+ sal_Int32 nEncAlgorithm = 0;
+ sal_Int32 nChecksumAlgorithm = 0;
+ sal_Int32 nDerivedKeySize = 0;
+ sal_Int32 nStartKeyGenID = 0;
+ if ( ZipFile::StaticFillData( xTempEncrData, nEncAlgorithm, nChecksumAlgorithm, nDerivedKeySize, nStartKeyGenID, nMagHackSize, aMediaType, GetOwnSeekStream() ) )
{
// We'll want to skip the data we've just read, so calculate how much we just read
// and remember it
- m_nMagicalHackPos = n_ConstHeaderSize + xTempEncrData->aSalt.getLength()
- + xTempEncrData->aInitVector.getLength()
- + xTempEncrData->aDigest.getLength()
+ m_nMagicalHackPos = n_ConstHeaderSize + xTempEncrData->m_aSalt.getLength()
+ + xTempEncrData->m_aInitVector.getLength()
+ + xTempEncrData->m_aDigest.getLength()
+ aMediaType.getLength() * sizeof( sal_Unicode );
+ m_nImportedEncryptionAlgorithm = nEncAlgorithm;
+ m_nImportedChecksumAlgorithm = nChecksumAlgorithm;
+ m_nImportedDerivedKeySize = nDerivedKeySize;
+ m_nImportedStartKeyAlgorithm = nStartKeyGenID;
m_nMagicalHackSize = nMagHackSize;
sMediaType = aMediaType;
@@ -362,7 +454,7 @@ sal_Bool ZipPackageStream::ParsePackageRawStream()
return sal_False;
}
- xEncryptionData = xTempEncrData;
+ m_xBaseEncryptionData = xTempEncrData;
SetIsEncrypted ( sal_True );
// it's already compressed and encrypted
bToBeEncrypted = bToBeCompressed = sal_False;
@@ -384,11 +476,12 @@ void ZipPackageStream::SetPackageMember( sal_Bool bNewValue )
// XActiveDataSink
//--------------------------------------------------------------------------
-void SAL_CALL ZipPackageStream::setInputStream( const Reference< io::XInputStream >& aStream )
- throw(RuntimeException)
+void SAL_CALL ZipPackageStream::setInputStream( const uno::Reference< io::XInputStream >& aStream )
+ throw( RuntimeException )
{
// if seekable access is required the wrapping will be done on demand
xStream = aStream;
+ m_nImportedEncryptionAlgorithm = 0;
m_bHasSeekable = sal_False;
SetPackageMember ( sal_False );
aEntry.nTime = -1;
@@ -396,94 +489,100 @@ void SAL_CALL ZipPackageStream::setInputStream( const Reference< io::XInputStrea
}
//--------------------------------------------------------------------------
-Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawData()
- throw(RuntimeException)
+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawData()
+ throw( RuntimeException )
{
try
{
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- if ( xEncryptionData.is() && !bHaveOwnKey )
- xEncryptionData->aKey = rZipPackage.getEncryptionKey();
- return rZipPackage.getZipFile().getRawData( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ return rZipPackage.getZipFile().getRawData( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
}
else
- return Reference < io::XInputStream > ();
+ return uno::Reference < io::XInputStream > ();
}
- catch (ZipException &)//rException)
+ catch ( ZipException & )//rException )
{
- OSL_FAIL( "ZipException thrown");//rException.Message);
- return Reference < io::XInputStream > ();
+ OSL_FAIL( "ZipException thrown" );//rException.Message);
+ return uno::Reference < io::XInputStream > ();
}
- catch (Exception &)
+ catch ( Exception & )
{
- OSL_FAIL( "Exception is thrown during stream wrapping!\n");
- return Reference < io::XInputStream > ();
+ OSL_FAIL( "Exception is thrown during stream wrapping!\n" );
+ return uno::Reference < io::XInputStream > ();
}
}
//--------------------------------------------------------------------------
-Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream( )
- throw(RuntimeException)
+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream()
+ throw( RuntimeException )
{
try
{
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- if ( xEncryptionData.is() && !bHaveOwnKey )
- xEncryptionData->aKey = rZipPackage.getEncryptionKey();
- return rZipPackage.getZipFile().getInputStream( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ return rZipPackage.getZipFile().getInputStream( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
}
else
- return Reference < io::XInputStream > ();
+ return uno::Reference < io::XInputStream > ();
}
- catch (ZipException &)//rException)
+ catch ( ZipException & )//rException )
{
- OSL_FAIL( "ZipException thrown");//rException.Message);
- return Reference < io::XInputStream > ();
+ OSL_FAIL( "ZipException thrown" );//rException.Message);
+ return uno::Reference < io::XInputStream > ();
}
- catch (Exception &)
+ catch ( Exception & )
{
- OSL_FAIL( "Exception is thrown during stream wrapping!\n");
- return Reference < io::XInputStream > ();
+ OSL_FAIL( "Exception is thrown during stream wrapping!\n" );
+ return uno::Reference < io::XInputStream > ();
}
}
// XDataSinkEncrSupport
//--------------------------------------------------------------------------
-Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
throw ( packages::WrongPasswordException,
io::IOException,
RuntimeException )
{
// There is no stream attached to this object
if ( m_nStreamMode == PACKAGE_STREAM_NOTSET )
- return Reference< io::XInputStream >();
+ return uno::Reference< io::XInputStream >();
// this method can not be used together with old approach
if ( m_nStreamMode == PACKAGE_STREAM_DETECT )
throw packages::zip::ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if ( xEncryptionData.is() && !bHaveOwnKey )
- xEncryptionData->aKey = rZipPackage.getEncryptionKey();
-
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- if ( xEncryptionData.is() && !bHaveOwnKey )
- xEncryptionData->aKey = rZipPackage.getEncryptionKey();
-
- return rZipPackage.getZipFile().getDataStream( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ uno::Reference< io::XInputStream > xResult;
+ try
+ {
+ xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ }
+ catch( packages::WrongPasswordException& )
+ {
+ // workaround for the encrypted documents generated with the old OOo1.x bug.
+ if ( rZipPackage.GetStartKeyGenID() == xml::crypto::DigestID::SHA1 && !m_bUseWinEncoding )
+ {
+ xResult = rZipPackage.getZipFile().getDataStream( aEntry, GetEncryptionData( true ), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ m_bUseWinEncoding = true;
+ }
+ else
+ throw;
+ }
+ return xResult;
}
else if ( m_nStreamMode == PACKAGE_STREAM_RAW )
- return ZipFile::StaticGetDataFromRawStream( GetOwnSeekStream(), xEncryptionData );
+ return ZipFile::StaticGetDataFromRawStream( m_xFactory, GetOwnSeekStream(), GetEncryptionData() );
else if ( GetOwnSeekStream().is() )
{
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
@@ -493,25 +592,25 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
}
//--------------------------------------------------------------------------
-Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream()
+uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream()
throw ( packages::NoEncryptionException,
io::IOException,
uno::RuntimeException )
{
// There is no stream attached to this object
if ( m_nStreamMode == PACKAGE_STREAM_NOTSET )
- return Reference< io::XInputStream >();
+ return uno::Reference< io::XInputStream >();
// this method can not be used together with old approach
if ( m_nStreamMode == PACKAGE_STREAM_DETECT )
throw packages::zip::ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- if ( !bIsEncrypted || !xEncryptionData.is() )
+ if ( !bIsEncrypted || !GetEncryptionData().is() )
throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- return rZipPackage.getZipFile().getWrappedRawStream( aEntry, xEncryptionData, sMediaType, rZipPackage.GetSharedMutexRef() );
+ return rZipPackage.getZipFile().getWrappedRawStream( aEntry, GetEncryptionData(), sMediaType, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
@@ -528,7 +627,7 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream()
//--------------------------------------------------------------------------
-void SAL_CALL ZipPackageStream::setDataStream( const Reference< io::XInputStream >& aStream )
+void SAL_CALL ZipPackageStream::setDataStream( const uno::Reference< io::XInputStream >& aStream )
throw ( io::IOException,
RuntimeException )
{
@@ -537,21 +636,21 @@ void SAL_CALL ZipPackageStream::setDataStream( const Reference< io::XInputStream
}
//--------------------------------------------------------------------------
-void SAL_CALL ZipPackageStream::setRawStream( const Reference< io::XInputStream >& aStream )
+void SAL_CALL ZipPackageStream::setRawStream( const uno::Reference< io::XInputStream >& aStream )
throw ( packages::EncryptionNotAllowedException,
packages::NoRawFormatException,
io::IOException,
- RuntimeException)
+ RuntimeException )
{
// wrap the stream in case it is not seekable
- Reference< io::XInputStream > xNewStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( aStream, m_xFactory );
- Reference< io::XSeekable > xSeek( xNewStream, UNO_QUERY );
+ uno::Reference< io::XInputStream > xNewStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( aStream, m_xFactory );
+ uno::Reference< io::XSeekable > xSeek( xNewStream, UNO_QUERY );
if ( !xSeek.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "The stream must support XSeekable!" ) ),
- Reference< XInterface >() );
+ uno::Reference< XInterface >() );
xSeek->seek( 0 );
- Reference< io::XInputStream > xOldStream = xStream;
+ uno::Reference< io::XInputStream > xOldStream = xStream;
xStream = xNewStream;
if ( !ParsePackageRawStream() )
{
@@ -574,15 +673,15 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream(
{
// There is no stream attached to this object
if ( m_nStreamMode == PACKAGE_STREAM_NOTSET )
- return Reference< io::XInputStream >();
+ return uno::Reference< io::XInputStream >();
// this method can not be used together with old approach
if ( m_nStreamMode == PACKAGE_STREAM_DETECT )
throw packages::zip::ZipIOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if (IsPackageMember())
+ if ( IsPackageMember() )
{
- return rZipPackage.getZipFile().getRawData( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
+ return rZipPackage.getZipFile().getRawData( aEntry, GetEncryptionData(), bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
@@ -595,14 +694,14 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream(
return TryToGetRawFromDataStream( sal_False );
}
- return Reference< io::XInputStream >();
+ return uno::Reference< io::XInputStream >();
}
// XUnoTunnel
//--------------------------------------------------------------------------
sal_Int64 SAL_CALL ZipPackageStream::getSomething( const Sequence< sal_Int8 >& aIdentifier )
- throw(RuntimeException)
+ throw( RuntimeException )
{
sal_Int64 nMe = 0;
if ( aIdentifier.getLength() == 16 &&
@@ -614,18 +713,18 @@ sal_Int64 SAL_CALL ZipPackageStream::getSomething( const Sequence< sal_Int8 >& a
// XPropertySet
//--------------------------------------------------------------------------
void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
- throw(beans::UnknownPropertyException, beans::PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
{
- if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("MediaType")))
+ if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" )) )
{
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE && rZipPackage.getFormat() != embed::StorageFormats::OFOPXML )
throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
if ( aValue >>= sMediaType )
{
- if (sMediaType.getLength() > 0)
+ if ( sMediaType.getLength() > 0 )
{
- if ( sMediaType.indexOf (OUString( RTL_CONSTASCII_USTRINGPARAM ( "text" ) ) ) != -1
+ if ( sMediaType.indexOf ( OUString( RTL_CONSTASCII_USTRINGPARAM ( "text" ) ) ) != -1
|| sMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM ( "application/vnd.sun.star.oleobject" ) ) ) )
bToBeCompressed = sal_True;
else if ( !m_bCompressedIsSetFromOutside )
@@ -634,18 +733,18 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
}
else
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "MediaType must be a string!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Size") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Size" ) ) )
{
if ( !( aValue >>= aEntry.nSize ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for Size property!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Encrypted") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Encrypted" ) ) )
{
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE )
throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -656,25 +755,25 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
// In case of new raw stream, the stream must not be encrypted on storing
if ( bEnc && m_nStreamMode == PACKAGE_STREAM_RAW )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Raw stream can not be encrypted on storing" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
bToBeEncrypted = bEnc;
- if ( bToBeEncrypted && !xEncryptionData.is())
- xEncryptionData = new EncryptionData;
+ if ( bToBeEncrypted && !m_xBaseEncryptionData.is() )
+ m_xBaseEncryptionData = new BaseEncryptionData;
}
else
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for Encrypted property!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
- else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) )
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_KEY_PROPERTY ) ) )
{
if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE )
throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- Sequence < sal_Int8 > aNewKey;
+ uno::Sequence< sal_Int8 > aNewKey;
if ( !( aValue >>= aNewKey ) )
{
@@ -685,31 +784,69 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
Sequence < sal_Int8 > aSequence ( nPathLength );
sal_Int8 *pArray = aSequence.getArray();
const sal_Unicode *pChar = sTempString.getStr();
- for ( sal_Int16 i = 0; i < nPathLength; i++)
- pArray[i] = static_cast < const sal_Int8 > (pChar[i]);
+ for ( sal_Int16 i = 0; i < nPathLength; i++ )
+ pArray[i] = static_cast < const sal_Int8 > ( pChar[i] );
aNewKey = aSequence;
}
else
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for EncryptionKey property!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
if ( aNewKey.getLength() )
{
- if ( !xEncryptionData.is())
- xEncryptionData = new EncryptionData;
+ if ( !m_xBaseEncryptionData.is() )
+ m_xBaseEncryptionData = new BaseEncryptionData;
+
+ m_aEncryptionKey = aNewKey;
+ // In case of new raw stream, the stream must not be encrypted on storing
+ bHaveOwnKey = sal_True;
+ if ( m_nStreamMode != PACKAGE_STREAM_RAW )
+ bToBeEncrypted = sal_True;
+ }
+ else
+ {
+ bHaveOwnKey = sal_False;
+ m_aEncryptionKey.realloc( 0 );
+ }
+
+ m_aStorageEncryptionKeys.realloc( 0 );
+ }
+ else if ( aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) )
+ {
+ if ( rZipPackage.getFormat() != embed::StorageFormats::PACKAGE )
+ throw beans::PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
+
+ uno::Sequence< beans::NamedValue > aKeys;
+ if ( !( aValue >>= aKeys ) )
+ {
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for StorageEncryptionKeys property!\n" ) ),
+ uno::Reference< XInterface >(),
+ 2 );
+ }
+
+ if ( aKeys.getLength() )
+ {
+ if ( !m_xBaseEncryptionData.is() )
+ m_xBaseEncryptionData = new BaseEncryptionData;
+
+ m_aStorageEncryptionKeys = aKeys;
- xEncryptionData->aKey = aNewKey;
// In case of new raw stream, the stream must not be encrypted on storing
bHaveOwnKey = sal_True;
if ( m_nStreamMode != PACKAGE_STREAM_RAW )
bToBeEncrypted = sal_True;
}
else
+ {
bHaveOwnKey = sal_False;
+ m_aStorageEncryptionKeys.realloc( 0 );
+ }
+
+ m_aEncryptionKey.realloc( 0 );
}
- else if (aPropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Compressed" ) ) )
+ else if ( aPropertyName.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Compressed" ) ) )
{
sal_Bool bCompr = sal_False;
@@ -718,7 +855,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
// In case of new raw stream, the stream must not be encrypted on storing
if ( bCompr && m_nStreamMode == PACKAGE_STREAM_RAW )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Raw stream can not be encrypted on storing" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
bToBeCompressed = bCompr;
@@ -726,7 +863,7 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
}
else
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong type for Compressed property!\n" ) ),
- Reference< XInterface >(),
+ uno::Reference< XInterface >(),
2 );
}
else
@@ -735,37 +872,42 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
//--------------------------------------------------------------------------
Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName )
- throw(beans::UnknownPropertyException, WrappedTargetException, RuntimeException)
+ throw( beans::UnknownPropertyException, WrappedTargetException, RuntimeException )
{
Any aAny;
- if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
+ if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MediaType" ) ) )
{
aAny <<= sMediaType;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Size" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Size" ) ) )
{
aAny <<= aEntry.nSize;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Encrypted" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Encrypted" ) ) )
{
aAny <<= ( m_nStreamMode == PACKAGE_STREAM_RAW ) ? sal_True : bToBeEncrypted;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WasEncrypted" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "WasEncrypted" ) ) )
{
aAny <<= bIsEncrypted;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Compressed" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Compressed" ) ) )
{
aAny <<= bToBeCompressed;
return aAny;
}
- else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EncryptionKey" ) ) )
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ENCRYPTION_KEY_PROPERTY ) ) )
+ {
+ aAny <<= m_aEncryptionKey;
+ return aAny;
+ }
+ else if ( PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( STORAGE_ENCRYPTION_KEYS_PROPERTY ) ) )
{
- aAny <<= !xEncryptionData.is() ? Sequence < sal_Int8 > () : xEncryptionData->aKey;
+ aAny <<= m_aStorageEncryptionKeys;
return aAny;
}
else
@@ -773,30 +915,30 @@ Any SAL_CALL ZipPackageStream::getPropertyValue( const OUString& PropertyName )
}
//--------------------------------------------------------------------------
-void ZipPackageStream::setSize (const sal_Int32 nNewSize)
+void ZipPackageStream::setSize ( const sal_Int32 nNewSize )
{
- if (aEntry.nCompressedSize != nNewSize )
+ if ( aEntry.nCompressedSize != nNewSize )
aEntry.nMethod = DEFLATED;
aEntry.nSize = nNewSize;
}
//--------------------------------------------------------------------------
OUString ZipPackageStream::getImplementationName()
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZipPackageStream" ) );
}
//--------------------------------------------------------------------------
Sequence< OUString > ZipPackageStream::getSupportedServiceNames()
- throw (RuntimeException)
+ throw ( RuntimeException )
{
- Sequence< OUString > aNames(1);
+ Sequence< OUString > aNames( 1 );
aNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.PackageStream" ) );
return aNames;
}
//--------------------------------------------------------------------------
sal_Bool SAL_CALL ZipPackageStream::supportsService( OUString const & rServiceName )
- throw (RuntimeException)
+ throw ( RuntimeException )
{
return rServiceName == getSupportedServiceNames()[0];
}
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index a75bed446335..e4b9d75b9ba3 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -41,6 +41,7 @@
#include <EncryptionData.hxx>
#include <ucbhelper/content.hxx>
+#include <rtl/ref.hxx>
#include <memory>
@@ -252,7 +253,7 @@ uno::Any SAL_CALL OZipFileAccess::getByName( const ::rtl::OUString& aName )
throw container::NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
uno::Reference< io::XInputStream > xEntryStream( m_pZipFile->getDataStream( (*aIter).second,
- new EncryptionData(),
+ ::rtl::Reference< EncryptionData >(),
sal_False,
m_aMutexHolder ) );
@@ -367,7 +368,7 @@ uno::Reference< io::XInputStream > SAL_CALL OZipFileAccess::getStreamByPattern(
if ( StringGoodForPattern_Impl( (*aIter).second.sPath, aPattern ) )
{
uno::Reference< io::XInputStream > xEntryStream( m_pZipFile->getDataStream( (*aIter).second,
- new EncryptionData(),
+ ::rtl::Reference< EncryptionData >(),
sal_False,
m_aMutexHolder ) );
diff --git a/setup_native/source/packinfo/shellscripts_extensions.txt b/setup_native/source/packinfo/shellscripts_extensions.txt
index 0be870990b71..3ab47f925802 100755
--- a/setup_native/source/packinfo/shellscripts_extensions.txt
+++ b/setup_native/source/packinfo/shellscripts_extensions.txt
@@ -76,6 +76,12 @@ END
if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then
"$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
@@ -87,6 +93,12 @@ END
if [ -x "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" ]; then
"$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "$$RPM_INSTALL_PREFIX/PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
@@ -99,6 +111,12 @@ END
if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]; then
"PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
@@ -111,6 +129,12 @@ END
if [ -x "PRODUCTDIRECTORYNAME/program/unopkg" ]
then
"PRODUCTDIRECTORYNAME/program/unopkg" sync
+ if [ "$$?" != "0" ]; then
+ echo "ERROR: Registration of extensions failed!"
+ exit 1
+ else
+ echo "SUCCESS: unopkg returns successful!"
+ fi
find "PRODUCTDIRECTORYNAME/share/prereg/bundled" -type f -exec chmod 644 {} \;
fi
diff --git a/setup_native/source/win32/customactions/rebase/rebase.cxx b/setup_native/source/win32/customactions/rebase/rebase.cxx
index 1eb3fedbf2f0..601af93dd20a 100644
--- a/setup_native/source/win32/customactions/rebase/rebase.cxx
+++ b/setup_native/source/win32/customactions/rebase/rebase.cxx
@@ -20,11 +20,14 @@
#include <malloc.h>
#include <time.h>
#include <string>
+#include <hash_map>
const DWORD PE_Signature = 0x00004550;
+typedef std::pair< std::string, bool > StringPair;
+typedef std::hash_map< std::string, bool > ExcludeLibsMap;
#ifdef DEBUG
-inline void OutputDebugStringFormat( LPCSTR pFormat, ... )
+static void OutputDebugStringFormat( LPCSTR pFormat, ... )
{
CHAR buffer[1024];
va_list args;
@@ -34,7 +37,7 @@ inline void OutputDebugStringFormat( LPCSTR pFormat, ... )
OutputDebugStringA( buffer );
}
#else
-static inline void OutputDebugStringFormat( LPCSTR, ... )
+static void OutputDebugStringFormat( LPCSTR, ... )
{
}
#endif
@@ -99,22 +102,31 @@ static BOOL rebaseImage( MSIHANDLE /*handle*/, const std::string& sFilePath, LPV
return bResult;
}
-static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LPVOID address )
+static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LPVOID address, ExcludeLibsMap& rExcludeMap )
{
- std::string sDir = sPath;
- std::string sPattern = sPath + TEXT("*.dll");
-
+ std::string sDir = sPath;
+ std::string sPattern = sPath + TEXT("*.dll");
WIN32_FIND_DATA aFindFileData;
- HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData );
+ HANDLE hFind = FindFirstFile( sPattern.c_str(), &aFindFileData );
if ( IsValidHandle(hFind) )
{
BOOL fSuccess = false;
do
{
- std::string sLibFile = sDir + aFindFileData.cFileName;
- rebaseImage( handle, sLibFile, address );
+ std::string sFileName = aFindFileData.cFileName;
+ if ( rExcludeMap.find( sFileName ) == rExcludeMap.end() )
+ {
+ OutputDebugStringFormat( "Rebase library: %s", sFileName.c_str() );
+ std::string sLibFile = sDir + sFileName;
+ rebaseImage( handle, sLibFile, address );
+ }
+ else
+ {
+ OutputDebugStringFormat( "Exclude library %s from rebase", sFileName.c_str() );
+ }
+
fSuccess = FindNextFile( hFind, &aFindFileData );
}
while ( fSuccess );
@@ -125,7 +137,7 @@ static BOOL rebaseImagesInFolder( MSIHANDLE handle, const std::string& sPath, LP
return ERROR_SUCCESS;
}
-static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress )
+static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress, ExcludeLibsMap& rMap )
{
std::string sInstallPath = GetMsiProperty(handle, TEXT("INSTALLLOCATION"));
@@ -133,9 +145,9 @@ static BOOL rebaseImages( MSIHANDLE handle, LPVOID pAddress )
std::string sOfficeDir = sInstallPath + TEXT("program\\");
std::string sUreDir = sInstallPath + TEXT("URE\\bin\\");
- BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress );
- bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress );
- bResult &= rebaseImagesInFolder( handle, sUreDir, pAddress );
+ BOOL bResult = rebaseImagesInFolder( handle, sBasisDir, pAddress, rMap );
+ bResult &= rebaseImagesInFolder( handle, sOfficeDir, pAddress, rMap );
+ bResult &= rebaseImagesInFolder( handle, sUreDir, pAddress, rMap );
return bResult;
}
@@ -147,21 +159,66 @@ static BOOL IsServerSystem( MSIHANDLE /*handle*/ )
GetVersionEx(reinterpret_cast<LPOSVERSIONINFO>(&osVersionInfoEx));
if ( osVersionInfoEx.wProductType != VER_NT_WORKSTATION )
+ {
+ OutputDebugStringFormat( "Server system detected. No rebase necessary!" );
return TRUE;
+ }
else
+ {
+ OutputDebugStringFormat( "Client system detected. Rebase necessary!" );
return FALSE;
+ }
+}
+
+static void InitExcludeFromRebaseList( MSIHANDLE handle, ExcludeLibsMap& rMap )
+{
+ size_t nPos( 0 );
+ const TCHAR cDelim = ',';
+ std::string sLibsExcluded = GetMsiProperty(handle, TEXT("EXCLUDE_FROM_REBASE"));
+
+ while ( nPos < sLibsExcluded.size() )
+ {
+ size_t nDelPos = sLibsExcluded.find_first_of( cDelim, nPos );
+
+ std::string sExcludedLibName;
+ if ( nDelPos != std::string::npos )
+ {
+ sExcludedLibName = sLibsExcluded.substr( nPos, nDelPos - nPos );
+ nPos = nDelPos+1;
+ }
+ else
+ {
+ sExcludedLibName = sLibsExcluded.substr( nPos );
+ nPos = sLibsExcluded.size();
+ }
+
+ if ( sExcludedLibName.size() > 0 )
+ {
+ OutputDebugStringFormat( "Insert library %s into exclude from rebase list", sExcludedLibName.c_str() );
+ rMap.insert( StringPair( sExcludedLibName, true ));
+ }
+ }
}
extern "C" BOOL __stdcall RebaseLibrariesOnProperties( MSIHANDLE handle )
{
static LPVOID pDefault = reinterpret_cast<LPVOID>(0x10000000);
+ OutputDebugStringFormat( "RebaseLibrariesOnProperties has been called" );
std::string sDontOptimizeLibs = GetMsiProperty(handle, TEXT("DONTOPTIMIZELIBS"));
if ( sDontOptimizeLibs.length() > 0 && sDontOptimizeLibs == "1" )
+ {
+ OutputDebugStringFormat( "Don't optimize libraries set. No rebase necessary!" );
return TRUE;
+ }
if ( !IsServerSystem( handle ))
- return rebaseImages( handle, pDefault );
+ {
+ ExcludeLibsMap aExcludeLibsMap;
+ InitExcludeFromRebaseList( handle, aExcludeLibsMap );
+
+ return rebaseImages( handle, pDefault, aExcludeLibsMap );
+ }
return TRUE;
}
diff --git a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
index 6b32b33cc881..323407e54875 100644
--- a/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/registerextensions.cxx
@@ -318,14 +318,13 @@ static BOOL RemoveCompleteDirectory( std::_tstring sPath )
extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
{
- std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
+ // std::_tstring sInstDir = GetMsiProperty( handle, TEXT("INSTALLLOCATION") );
+ std::_tstring sInstDir = GetMsiProperty( handle, TEXT("CustomActionData") );
std::_tstring sUnoPkgFile = sInstDir + TEXT("program\\unopkg.exe");
std::_tstring mystr;
WIN32_FIND_DATA aFindFileData;
-
- mystr = "unopkg file: " + sUnoPkgFile;
- //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+ bool registrationError = false;
// Find unopkg.exe
HANDLE hFindUnopkg = FindFirstFile( sUnoPkgFile.c_str(), &aFindFileData );
@@ -334,32 +333,44 @@ extern "C" UINT __stdcall RegisterExtensions(MSIHANDLE handle)
{
// unopkg.exe exists in program directory
std::_tstring sCommand = sUnoPkgFile + " sync";
- mystr = "Command: " + sCommand;
- //MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
DWORD exitCode = 0;
bool fSuccess = ExecuteCommand( sCommand.c_str(), & exitCode);
-// if ( fSuccess )
-// {
-// mystr = "Executed successfully!";
-// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-// }
-// else
-// {
-// mystr = "An error occurred during execution!";
-// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-// }
+// if ( fSuccess )
+// {
+// mystr = "Executed successfully!";
+// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+// }
+// else
+// {
+// mystr = "An error occurred during execution!";
+// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+// }
+
+ if ( ! fSuccess )
+ {
+ mystr = "ERROR: An error occured during registration of extensions!";
+ MessageBox(NULL, mystr.c_str(), "ERROR", MB_OK);
+ registrationError = true;
+ }
FindClose( hFindUnopkg );
}
-// else
-// {
-// mystr = "Error: Did not find " + sUnoPkgFile;
-// MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
-// }
+ // else
+ // {
+ // mystr = "Error: Did not find " + sUnoPkgFile;
+ // MessageBox(NULL, mystr.c_str(), "Command", MB_OK);
+ // }
- return ERROR_SUCCESS;
+ if ( registrationError )
+ {
+ return 1;
+ }
+ else
+ {
+ return ERROR_SUCCESS;
+ }
}
diff --git a/setup_native/source/win32/msi-encodinglist.txt b/setup_native/source/win32/msi-encodinglist.txt
index 123339c3d9c5..fa99da814fe6 100644
--- a/setup_native/source/win32/msi-encodinglist.txt
+++ b/setup_native/source/win32/msi-encodinglist.txt
@@ -87,7 +87,6 @@ nl 1252 1043
nn 1252 2068
no 1252 1044
nr 0 1580 # Ndebele South
-ns 0 1132 # Northern Sotho (Sepedi)
nso 0 1132
ny 0 1598
oc 1252 1154 # Occitan-lengadocian
@@ -134,6 +133,7 @@ ti-ER 0 1139 # Tigrinya
tn 0 1074 # Setsuana
tr 1254 1055 # Turkish
ts 0 1073 # Tsonga
+tk 0 1090
tt 1251 1092 # Tatar
ug 0 2200
uk 1251 1058 # Ukrainian
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
index 2d7174bdb69f..32a94738da41 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.java
@@ -26,11 +26,7 @@
************************************************************************/
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 java.util.*;
import com.sun.star.awt.TextEvent;
@@ -201,7 +197,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
{
template = calcTemplateName(templateURL);
document = loadAsPreview(templateURL, false);
- docMSF = ((XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document));
+ docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
xFrame.getComponentWindow().setEnable(false);
xTextDocument.lockControllers();
initialize();
@@ -235,7 +231,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
{
try
{
- itemsTables[i].write("");
+ itemsTables[i].write(PropertyNames.EMPTY_STRING);
}
catch (Exception ex)
{
@@ -374,7 +370,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
{
itemsCache = new Hashtable(11);
- XMultiServiceFactory xmsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+ XMultiServiceFactory xmsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
// Headings
itemsCache.put(FILLIN_MEETING_TYPE,
@@ -442,7 +438,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
/*
* Get the default locale of the document, and create the date and time formatters.
*/
- XMultiServiceFactory docMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+ XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
try
{
Object defaults = docMSF.createInstance("com.sun.star.text.Defaults");
@@ -453,7 +449,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
calendar = Calendar.getInstance(jl);
- XNumberFormatsSupplier nfs = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document);
+ XNumberFormatsSupplier nfs = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document);
Object formatSettings = nfs.getNumberFormatSettings();
com.sun.star.util.Date date = (com.sun.star.util.Date) Helper.getUnoPropertyValue(formatSettings, "NullDate");
@@ -483,8 +479,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
initializeItems();
initializeTitles();
initializeItemsSections();
- XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
- textSectionHandler = new TextSectionHandler(xMultiServiceFactory, (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, document));
+ XMultiServiceFactory xMultiServiceFactory = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+ textSectionHandler = new TextSectionHandler(xMultiServiceFactory, UnoRuntime.queryInterface(XTextDocument.class, document));
initializeTopics();
_allItems.clear();
_allItems = null;
@@ -498,7 +494,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
{
XTextRange item = null;
- XMultiServiceFactory xmsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+ XMultiServiceFactory xmsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
for (int i = 0; i < _allItems.size(); i++)
{
@@ -550,7 +546,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
{
try
{
- XSearchable xSearchable = (XSearchable) UnoRuntime.queryInterface(XSearchable.class, document);
+ XSearchable xSearchable = UnoRuntime.queryInterface(XSearchable.class, document);
XSearchDescriptor sd = xSearchable.createSearchDescriptor();
sd.setSearchString("<[^>]+>");
sd.setPropertyValue("SearchRegularExpression", Boolean.TRUE);
@@ -558,12 +554,12 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
XIndexAccess ia = xSearchable.findAll(sd);
- List l = new Vector(ia.getCount());
+ List l = new ArrayList<XTextRange>(ia.getCount());
for (int i = 0; i < ia.getCount(); i++)
{
try
{
- l.add((XTextRange) UnoRuntime.queryInterface(XTextRange.class, ia.getByIndex(i)));
+ l.add(UnoRuntime.queryInterface(XTextRange.class, ia.getByIndex(i)));
}
catch (Exception ex)
{
@@ -607,20 +603,20 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
private String[] getSections(Object document, String s)
{
- XTextSectionsSupplier xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, document);
+ 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);
+ 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);
+ XTextTablesSupplier xTextTablesSupplier = UnoRuntime.queryInterface(XTextTablesSupplier.class, document);
return ((Any) xTextTablesSupplier.getTextTables().getByName(name)).getObject();
}
@@ -665,18 +661,18 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
private void writeTitle(TextElement te, XTextRange tr, String text)
{
- te.text = (text == null ? "" : text);
+ te.text = (text == null ? PropertyNames.EMPTY_STRING : text);
te.write(tr);
}
private static long DAY_IN_MILLIS = (24 * 60 * 60 * 1000);
private String getDateString(String d)
{
- if (d == null || d.equals(""))
+ if (d == null || d.equals(PropertyNames.EMPTY_STRING))
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
- int date = new Integer(d).intValue();
+ int date = Integer.parseInt(d);
calendar.clear();
calendar.set(date / 10000,
(date % 10000) / 100 - 1,
@@ -694,11 +690,11 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
private String getTimeString(String s)
{
- if (s == null || s.equals(""))
+ if (s == null || s.equals(PropertyNames.EMPTY_STRING))
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
- int time = new Integer(s).intValue();
+ int time = Integer.parseInt(s);
double t = ((double) (time / 1000000) / 24) + ((double) ((time % 1000000) / 1000) / (24 * 60));
return timeFormatter.convertNumberToString(timeFormat, t);
@@ -722,7 +718,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
private void deleteHiddenSections()
{
- XTextSectionsSupplier xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, document);
+ XTextSectionsSupplier xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, document);
String[] allSections = xTextSectionsSupplier.getTextSections().getElementNames();
try
{
@@ -733,7 +729,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
boolean visible = ((Boolean) Helper.getUnoPropertyValue(section, "IsVisible")).booleanValue();
if (!visible)
{
- ((XTextContent) UnoRuntime.queryInterface(XTextContent.class, section)).getAnchor().setString("");
+ UnoRuntime.queryInterface(XTextContent.class, section).getAnchor().setString(PropertyNames.EMPTY_STRING);
}
}
}
@@ -759,8 +755,8 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
try
{
Object minutesAllSection = getSection(SECTION_MINUTES_ALL);
- XTextSection xTextSection = (XTextSection) UnoRuntime.queryInterface(XTextSection.class, minutesAllSection);
- xTextSection.getAnchor().setString("");
+ XTextSection xTextSection = UnoRuntime.queryInterface(XTextSection.class, minutesAllSection);
+ xTextSection.getAnchor().setString(PropertyNames.EMPTY_STRING);
}
catch (Exception ex)
{
@@ -777,7 +773,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
int topicStartTime = 0;
try
{
- topicStartTime = new Integer(agenda.cp_Time).intValue();
+ topicStartTime = Integer.parseInt(agenda.cp_Time);
}
catch (Exception ex)
{
@@ -831,15 +827,15 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
if (itemText.equals(FILLIN_MINUTE_NUM))
{
- fillMinutesItem(item, topic[0].Value, "");
+ fillMinutesItem(item, topic[0].Value, PropertyNames.EMPTY_STRING);
}
else if (itemText.equals(FILLIN_MINUTE_TOPIC))
{
- fillMinutesItem(item, topic[1].Value, "");
+ fillMinutesItem(item, topic[1].Value, PropertyNames.EMPTY_STRING);
}
else if (itemText.equals(FILLIN_MINUTE_RESPONSIBLE))
{
- fillMinutesItem(item, topic[2].Value, "");
+ fillMinutesItem(item, topic[2].Value, PropertyNames.EMPTY_STRING);
}
else if (itemText.equals(FILLIN_MINUTE_TIME))
{
@@ -863,7 +859,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
topicStartTime += topicTime * 1000;
time += getTimeString(String.valueOf(topicStartTime));
}
- fillMinutesItem(item, time, "");
+ fillMinutesItem(item, time, PropertyNames.EMPTY_STRING);
}
}
@@ -889,16 +885,16 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
* 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 "")
+ * @param placeholder the placeholder text to use, if the text argument is empty (null or PropertyNames.EMPTY_STRING)
*/
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 (text == null || text.equals(PropertyNames.EMPTY_STRING))
{
- if (placeholder != null && !placeholder.equals(""))
+ if (placeholder != null && !placeholder.equals(PropertyNames.EMPTY_STRING))
{
XTextContent placeHolder = createPlaceHolder(docMSF, placeholder, resources.resPlaceHolderHint);
try
@@ -936,7 +932,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
Helper.setUnoPropertyValue(placeHolder, "PlaceHolder", ph);
Helper.setUnoPropertyValue(placeHolder, "Hint", hint);
Helper.setUnoPropertyValue(placeHolder, "PlaceHolderType", new Short(PlaceholderType.TEXT));
- return (XTextContent) UnoRuntime.queryInterface(XTextContent.class, placeHolder);
+ return UnoRuntime.queryInterface(XTextContent.class, placeHolder);
}
@@ -1016,7 +1012,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
table = getTable(name);
section = getSection(name);
- XTextTable xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, table);
+ XTextTable xTextTable = UnoRuntime.queryInterface(XTextTable.class, table);
XTextTableCursor cursor = xTextTable.createCursorByCellName("A1");
AgendaItem ai;
// should this section be visible?
@@ -1024,7 +1020,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
// write items
// ===========
- String cellName = "";
+ String cellName = PropertyNames.EMPTY_STRING;
/* now go through all items that belong to this
* table. Check each one agains the model. If it should
@@ -1072,7 +1068,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
while ((!cellName.equals(cursor.getRangeName()) && (!cursor.getRangeName().startsWith("A"))))
{
cell = xTextTable.getCellByName(cursor.getRangeName());
- ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, cell)).setString("");
+ UnoRuntime.queryInterface(XTextRange.class, cell).setString(PropertyNames.EMPTY_STRING);
cellName = cursor.getRangeName();
cursor.goRight((short) 1, false);
}
@@ -1085,7 +1081,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
return;
}
int rowIndex = getRowIndex(cursor);
- int rowsCount = getRowCount((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table));
+ int rowsCount = getRowCount(UnoRuntime.queryInterface(XTextTable.class, table));
/* now before deleteing i move the cursor up so it
* does not disappear, because it will crash office.
@@ -1201,7 +1197,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
}
// and this is the XTable.
- table = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, t));
+ table = UnoRuntime.queryInterface(XTextTable.class, t);
/* first I store all <*> ranges
* which are in the topics table.
@@ -1246,7 +1242,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
while (!cursor.getRangeName().equals(afterLastCell))
{
cell = table.getCellByName(cursor.getRangeName());
- XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, cell);
+ 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 <...>
@@ -1316,7 +1312,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
{
writtenTopics.add(null);
}
- writtenTopics.set(topic, "");
+ writtenTopics.set(topic, PropertyNames.EMPTY_STRING);
// make sure threr are enough rows for me...
int rows = getRowCount(table);
@@ -1413,12 +1409,14 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
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);
-
+ if ( te != null)
+ {
+ cursor.goRight((short) cursorMoves, false);
+ XCell xc = table.getCellByName(cursor.getRangeName());
+ // and write it !
+ te.write(xc);
+ ((TableCellFormatter) topicCellFormats.get(cursorMoves)).format(xc);
+ }
}
}
@@ -1585,7 +1583,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
public static String[] getNamesWhichStartWith(String[] allNames, String prefix)
{
- Vector v = new Vector();
+ ArrayList<String> v = new ArrayList<String>();
for (int i = 0; i < allNames.length; i++)
{
if (allNames[i].startsWith(prefix))
@@ -1594,8 +1592,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
}
}
String[] s = new String[v.size()];
- System.arraycopy(v.toArray(), 0, s, 0, s.length);
- return s;
+ return v.toArray(s);
}
/**
@@ -1605,7 +1602,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
public static String getName(Object obj)
{
- return ((XNamed) UnoRuntime.queryInterface(XNamed.class, obj)).getName();
+ return UnoRuntime.queryInterface(XNamed.class, obj).getName();
}
/**
@@ -1616,7 +1613,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
public static void removeTableRows(Object table, int start, int count)
{
- XTableRows rows = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table)).getRows();
+ XTableRows rows = UnoRuntime.queryInterface(XTextTable.class, table).getRows();
rows.removeByIndex(start, count);
}
@@ -1628,7 +1625,7 @@ public class AgendaTemplate extends TextDocument implements TemplateConsts, Data
*/
public static void insertTableRows(Object table, int start, int count)
{
- XTableRows rows = ((XTextTable) UnoRuntime.queryInterface(XTextTable.class, table)).getRows();
+ XTableRows rows = UnoRuntime.queryInterface(XTextTable.class, table).getRows();
rows.insertByIndex(start, count);
}
@@ -1717,12 +1714,12 @@ class ParaStyled implements AgendaElement
void format(Object textRange)
{
XText o;
- o = ((XText) UnoRuntime.queryInterface(XText.class, textRange));
+ o = UnoRuntime.queryInterface(XText.class, textRange);
if (o == null)
{
- o = ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange)).getText();
+ o = UnoRuntime.queryInterface(XTextRange.class, textRange).getText();
}
- XTextRange xtr = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange);
+ XTextRange xtr = UnoRuntime.queryInterface(XTextRange.class, textRange);
XTextCursor cursor = o.createTextCursorByRange(xtr);
Helper.setUnoPropertyValue(cursor, "ParaStyleName", paraStyle);
@@ -1763,8 +1760,8 @@ class TextElement extends ParaStyled
public void write(Object textRange)
{
- ((XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange)).setString(text);
- if (!text.equals(""))
+ UnoRuntime.queryInterface(XTextRange.class, textRange).setString(text);
+ if (!text.equals(PropertyNames.EMPTY_STRING))
{
super.write(textRange);
}
@@ -1772,7 +1769,7 @@ class TextElement extends ParaStyled
}
/**
- * A Text element which, if the text to write is empty (null or "")
+ * A Text element which, if the text to write is empty (null or PropertyNames.EMPTY_STRING)
* inserts a placeholder instead.
* @author rp143992
*
@@ -1805,9 +1802,9 @@ class PlaceholderTextElement extends TextElement
public void write(Object textRange)
{
super.write(textRange);
- if (text == null || text.equals(""))
+ if (text == null || text.equals(PropertyNames.EMPTY_STRING))
{
- XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange);
+ XTextRange xTextRange = UnoRuntime.queryInterface(XTextRange.class, textRange);
try
{
XTextContent xTextContent = AgendaTemplate.createPlaceHolder(xmsf, placeHolderText, hint);
@@ -1849,7 +1846,7 @@ class PlaceholderElement extends ParaStyled
public void write(Object textRange)
{
- XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, textRange);
+ XTextRange xTextRange = UnoRuntime.queryInterface(XTextRange.class, textRange);
try
{
XTextContent xTextContent = AgendaTemplate.createPlaceHolder(xmsf, placeHolderText, hint);
@@ -1896,8 +1893,8 @@ class AgendaItem implements AgendaElement
public void write(Object tableCursor) throws Exception
{
- XTextTableCursor xTextTableCursor = (XTextTableCursor) UnoRuntime.queryInterface(XTextTableCursor.class, tableCursor);
- XTextTable xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, table);
+ XTextTableCursor xTextTableCursor = UnoRuntime.queryInterface(XTextTableCursor.class, tableCursor);
+ XTextTable xTextTable = UnoRuntime.queryInterface(XTextTable.class, table);
String cellname = xTextTableCursor.getRangeName();
Object cell = xTextTable.getCellByName(cellname);
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java
index 219125b64bd2..397985c2a937 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.java
@@ -105,7 +105,7 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda
XButton btnUp;
XButton btnDown;
- final private String IMGHELP1_HID = "";
+ final private String IMGHELP1_HID = PropertyNames.EMPTY_STRING;
//Font Descriptors as Class members.
@@ -117,13 +117,13 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda
AgendaWizardDialogResources resources;
private String[] PROPS_LIST = new String[] {"Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
- private String[] PROPS_LABEL_B = new String[] {"FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
+ private String[] PROPS_LABEL_B = new String[] {PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
private String[] PROPS_CHECK = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
private String[] PROPS_BUTTON = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
private String[] PROPS_X = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
private String[] PROPS_TEXTAREA = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
private String[] PROPS_TEXT = new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
- private String[] PROPS_IMAGE = new String[] {"Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
+ private String[] PROPS_IMAGE = new String[] {PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH};
private static final Short NO_BORDER = new Short((short)0);
@@ -134,8 +134,8 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda
//set dialog properties...
Helper.setUnoPropertyValues(xDialogModel,
- new String[] { "Closeable",PropertyNames.PROPERTY_HEIGHT,"Moveable",PropertyNames.PROPERTY_POSITION_X,PropertyNames.PROPERTY_POSITION_Y,PropertyNames.PROPERTY_STEP,PropertyNames.PROPERTY_TABINDEX,"Title",PropertyNames.PROPERTY_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)}
+ new String[] { PropertyNames.PROPERTY_CLOSEABLE,PropertyNames.PROPERTY_HEIGHT,PropertyNames.PROPERTY_MOVEABLE,PropertyNames.PROPERTY_POSITION_X,PropertyNames.PROPERTY_POSITION_Y,PropertyNames.PROPERTY_STEP,PropertyNames.PROPERTY_TABINDEX,PropertyNames.PROPERTY_TITLE,PropertyNames.PROPERTY_WIDTH},
+ new Object[] { Boolean.TRUE,210,Boolean.TRUE,200,52,INTEGERS[1],new Short((short)1),resources.resAgendaWizardDialog_title,310}
);
//Set member- FontDescriptors...
@@ -149,27 +149,27 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda
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)}
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle1_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[1],new Short((short)100),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)}
+ new Object[] { INTEGERS[8],resources.reslblPageDesign_value,97,32,INTEGERS[1],new Short((short)101),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)}
+ new Object[] { Boolean.TRUE,INTEGER_12,LISTPAGEDESIGN_HID,166,30,INTEGERS[1],new Short((short)102),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)}
+ new Object[] { INTEGERS[9],CHKMINUTES_HID,resources.reschkMinutes_value,97,50,new Short((short)0),INTEGERS[1],new Short((short)103),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]}
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID, AgendaWizardDialogConst.INFO_IMAGE_URL, 92,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)}
+ new Object[] { 39,resources.reslblHelp1_value,Boolean.TRUE,104,145,INTEGERS[1],new Short((short)105),199}
);
}
@@ -177,49 +177,49 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda
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)}
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle2_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[2],new Short((short)200),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)}
+ new Object[] { INTEGERS[8],resources.reslblDate_value,97,32,INTEGERS[2],new Short((short)201),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)}
+ new Object[] { Boolean.TRUE,INTEGER_12,TXTDATE_HID,166,30,INTEGERS[2],new Short((short)202),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)}
+ new Object[] { INTEGERS[8],resources.reslblTime_value,97,50,INTEGERS[2],new Short((short)203),66}
);
txtTime = insertTimeField("txtTime", null,
new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "StrictFormat", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
- new Object[] { INTEGER_12,TXTTIME_HID,new Integer(166),new Integer(48),INTEGERS[2],Boolean.TRUE,new Short((short)204),new Integer(70)}
+ new Object[] { INTEGER_12,TXTTIME_HID,166,48,INTEGERS[2],Boolean.TRUE,new Short((short)204),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)}
+ new Object[] { INTEGERS[8],resources.reslblTitle_value,97,68,INTEGERS[2],new Short((short)205),66}
);
txtTitle = insertTextField("txtTitle", null,
new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)}
+ new Object[] { 26,TXTTITLE_HID,Boolean.TRUE,166,66,INTEGERS[2],new Short((short)206),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)}
+ new Object[] { INTEGERS[8],resources.reslblLocation_value,97,100,INTEGERS[2],new Short((short)207),66}
);
cbLocation = insertTextField("cbLocation", null,null,
new String[] { PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)}
+ new Object[] { 34,CBLOCATION_HID,Boolean.TRUE,166,98,INTEGERS[2],new Short((short)208),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]}
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,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)}
+ new Object[] { 39,resources.reslblHelp2_value,Boolean.TRUE,104,145,INTEGERS[2],new Short((short)210),199}
);
}
@@ -227,93 +227,93 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda
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)}
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle3_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[3],new Short((short)300),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)}
+ new Object[] { INTEGERS[8],CHKMEETINGTITLE_HID,resources.reschkMeetingTitle_value,97,32,new Short((short)1),INTEGERS[3],new Short((short)301),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)}
+ new Object[] { INTEGERS[8],CHKREAD_HID,resources.reschkRead_value,97,46,new Short((short)0),INTEGERS[3],new Short((short)302),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)}
+ new Object[] { INTEGERS[8],CHKBRING_HID,resources.reschkBring_value,97,60,new Short((short)0),INTEGERS[3],new Short((short)303),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)}
+ new Object[] { INTEGERS[8],CHKNOTES_HID,resources.reschkNotes_value,97,74,new Short((short)1),INTEGERS[3],new Short((short)304),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]}
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,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)}
+ new Object[] { 39,resources.reslblHelp3_value,Boolean.TRUE,104,145,INTEGERS[3],new Short((short)306),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)}
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle5_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[4],new Short((short)400),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)}
+ new Object[] { INTEGERS[8],CHKCONVENEDBY_HID,resources.reschkConvenedBy_value,97,32,new Short((short)1),INTEGERS[4],new Short((short)401),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)}
+ new Object[] { INTEGERS[8],CHKPRESIDING_HID,resources.reschkPresiding_value,97,46,new Short((short)0),INTEGERS[4],new Short((short)402),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)}
+ new Object[] { INTEGERS[8],CHKNOTETAKER_HID,resources.reschkNoteTaker_value,97,60,new Short((short)0),INTEGERS[4],new Short((short)403),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)}
+ new Object[] { INTEGERS[8],CHKTIMEKEEPER_HID,resources.reschkTimekeeper_value,97,74,new Short((short)0),INTEGERS[4],new Short((short)404),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)}
+ new Object[] { INTEGERS[8],CHKATTENDEES_HID,resources.reschkAttendees_value,97,88,new Short((short)1),INTEGERS[4],new Short((short)405),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)}
+ new Object[] { INTEGERS[8],CHKOBSERVERS_HID,resources.reschkObservers_value,97,102,new Short((short)0),INTEGERS[4],new Short((short)406),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)}
+ new Object[] { INTEGERS[8],CHKRESOURCEPERSONS_HID,resources.reschkResourcePersons_value,97,116,new Short((short)0),INTEGERS[4],new Short((short)407),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]}
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,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)}
+ new Object[] { 39,resources.reslblHelp4_value,Boolean.TRUE,104,145,INTEGERS[4],new Short((short)409),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)}
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle4_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[5],new Short((short)500),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)}
+ new Object[] { INTEGERS[8],resources.reslblTopic_value,107,28,INTEGERS[5],new Short((short)71),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)}
+ new Object[] { INTEGERS[8],resources.reslblResponsible_value,195,28,INTEGERS[5],new Short((short)72),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)}
+ new Object[] { INTEGERS[8],resources.reslblDuration_value,267,28,INTEGERS[5],new Short((short)73),503}
);
@@ -322,19 +322,19 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda
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}
+ new Object[] { INTEGER_14,BTNINSERT_HID,resources.resButtonInsert,92,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}
+ new Object[] { INTEGER_14,BTNREMOVE_HID,resources.resButtonRemove,134,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}
+ new Object[] { INTEGER_14,BTNUP_HID,resources.resButtonUp,222,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}
+ new Object[] { INTEGER_14,BTNDOWN_HID,resources.resButtonDown,264,136,INTEGERS[5],new Short((short)583),INTEGER_40}
);
@@ -344,40 +344,40 @@ public abstract class AgendaWizardDialog extends WizardDialog implements Agenda
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)}
+ new Object[] { fontDescriptor4,INTEGER_16,resources.reslblTitle6_value,Boolean.TRUE,91,INTEGERS[8],INTEGERS[6],new Short((short)600),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)}
+ new Object[] { 24,resources.reslblHelpPg6_value,Boolean.TRUE,97,32,INTEGERS[6],new Short((short)601),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)}
+ new Object[] { INTEGERS[8],resources.reslblTemplateName_value,97,62,INTEGERS[6],new Short((short)602),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)}
+ new Object[] { INTEGER_12,TXTTEMPLATENAME_HID,202,60,INTEGERS[6],new Short((short)603),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)}
+ new Object[] { INTEGERS[8],resources.reslblProceed_value,97,101,INTEGERS[6],new Short((short)607),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)}
+ new Object[] { INTEGERS[8],OPTCREATEAGENDA_HID,resources.resoptCreateAgenda_value,103,113,new Short((short)1),INTEGERS[6],new Short((short)608),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)}
+ new Object[] { INTEGERS[8],OPTMAKECHANGES_HID,resources.resoptMakeChanges_value,103,125,INTEGERS[6],new Short((short)609),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]}
+ new Object[] { NO_BORDER, INTEGERS[10],IMGHELP1_HID,AgendaWizardDialogConst.INFO_IMAGE_URL, 92,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)}
+ new Object[] { 39,resources.reslblHelp6_value,Boolean.TRUE,104,145,INTEGERS[6],new Short((short)611),199}
);
}
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java
index 50ee492f8c78..20ad03c428ae 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.java
@@ -50,6 +50,7 @@ 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.common.HelpIds;
+import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.document.OfficeDocument;
import com.sun.star.wizards.text.ViewHandler;
import com.sun.star.wizards.ui.PathSelection;
@@ -158,7 +159,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
// create the peer
XWindow xw = agendaTemplate.xFrame.getContainerWindow();
- XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xw);
+ XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xw);
this.createWindowPeer( xWindowPeer );
// initialize roadmap
@@ -172,7 +173,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
// synchronize GUI and CGAgenda object.
makeDA();
- if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase("")) {myPathSelection.initializePath();}
+ if(myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING)) {myPathSelection.initializePath();}
executeDialog(agendaTemplate.xFrame);
removeTerminateListener();
@@ -184,8 +185,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
removeTerminateListener();
ex.printStackTrace();
running=false;
- return;
- }
+ }
}
@@ -212,7 +212,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
private void initializePaths() {
try {
sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
- sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", "");
+ sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap");
} catch (NoValidPathException e) {
e.printStackTrace();
@@ -221,14 +221,14 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
private void checkSavePath() {
if (agenda.cp_TemplatePath == null ||
- agenda.cp_TemplatePath.equals("") ||
+ agenda.cp_TemplatePath.equals(PropertyNames.EMPTY_STRING) ||
!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", "", "") ,
+ FileAccess.getOfficePath(xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING) ,
resources.resDefaultFilename
);
}
@@ -243,7 +243,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
*/
private void makeDA() {
- setControlProperty("listPageDesign", "StringItemList", agendaTemplates[0]);
+ setControlProperty("listPageDesign", PropertyNames.STRING_ITEM_LIST, agendaTemplates[0]);
checkSavePath();
//setFilename(agenda.cp_TemplatePath);
@@ -420,7 +420,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
*/
private void setFilename(String url) {
try {
- String path = getFileAccess().getPath(url,"");
+ String path = getFileAccess().getPath(url,PropertyNames.EMPTY_STRING);
Helper.setUnoPropertyValue( getModel(myPathSelection.xSaveTextBox), "Text", path);
}
catch (Exception ex) {
@@ -463,7 +463,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
try {
FileAccess fileAccess = new FileAccess(xMSF);
sPath = myPathSelection.getSelectedPath();
- if (sPath.equals("")) {
+ if (sPath.equals(PropertyNames.EMPTY_STRING)) {
myPathSelection.triggerPathPicker();
sPath = myPathSelection.getSelectedPath();
}
@@ -482,7 +482,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
agendaTemplate.xTextDocument.lockControllers();
- xTextDocument = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class,agendaTemplate.document);
+ xTextDocument = UnoRuntime.queryInterface(XTextDocument.class,agendaTemplate.document);
bSaveSuccess = OfficeDocument.store(xMSF, xTextDocument, sPath , "writer8_template", false );
} catch (Exception e) {
@@ -503,7 +503,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
agendaTemplate.finish( topicsControl.getTopicsData());
try {
- XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, agendaTemplate.document);
+ XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, agendaTemplate.document);
xStoreable.store();
}
catch (Exception ex) {
@@ -528,8 +528,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
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;
+ loadValues[1].Value = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -537,7 +536,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
//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);
+ XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
ViewHandler myViewHandler = new ViewHandler(xDocMSF, xTextDocument);
try {
myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.OPTIMAL));
@@ -557,7 +556,7 @@ public class AgendaWizardDialogImpl extends AgendaWizardDialog
private void closeDocument() {
try {
//xComponent.dispose();
- XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, agendaTemplate.xFrame);
+ XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, agendaTemplate.xFrame);
xCloseable.close(false);
} catch (CloseVetoException e) {
e.printStackTrace();
diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.java b/wizards/com/sun/star/wizards/agenda/CGAgenda.java
index b7dc1cc37c00..d64ec8372bd3 100644
--- a/wizards/com/sun/star/wizards/agenda/CGAgenda.java
+++ b/wizards/com/sun/star/wizards/agenda/CGAgenda.java
@@ -28,6 +28,7 @@ package com.sun.star.wizards.agenda;
import com.sun.star.wizards.common.ConfigGroup;
import com.sun.star.wizards.common.ConfigSet;
+import com.sun.star.wizards.common.PropertyNames;
/**
* CGAgenda means Configuration Group Agenda.
@@ -43,13 +44,13 @@ public class CGAgenda extends ConfigGroup
/** step 1 - include minutes*/
public boolean cp_IncludeMinutes;
/** step 2 - title */
- public String cp_Title = "";
+ public String cp_Title = PropertyNames.EMPTY_STRING;
/** step 2 - date */
public String cp_Date;
/** step 2 - time */
public String cp_Time;
/** step 2 - location */
- public String cp_Location = "";
+ public String cp_Location = PropertyNames.EMPTY_STRING;
/** step 3 - show meeting type */
public boolean cp_ShowMeetingType;
/** step 3 - show read */
diff --git a/wizards/com/sun/star/wizards/agenda/CGTopic.java b/wizards/com/sun/star/wizards/agenda/CGTopic.java
index 74b818205b9f..6ef5ac21e3ea 100644
--- a/wizards/com/sun/star/wizards/agenda/CGTopic.java
+++ b/wizards/com/sun/star/wizards/agenda/CGTopic.java
@@ -30,6 +30,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
/**
* CGTopic means: Configuration Group Topic.
@@ -74,7 +75,7 @@ public class CGTopic extends ConfigGroup implements Indexable {
*/
public void setDataToRow(Object row) {
PropertyValue[] pv = (PropertyValue[])row;
- pv[0].Value = "" + cp_Index + ".";
+ pv[0].Value = PropertyNames.EMPTY_STRING + cp_Index + ".";
pv[1].Value = cp_Topic;
pv[2].Value = cp_Responsible;
pv[3].Value = cp_Time;
diff --git a/wizards/com/sun/star/wizards/agenda/CallWizard.java b/wizards/com/sun/star/wizards/agenda/CallWizard.java
index 3dc8dcd8ef91..ae19b4ef311d 100644
--- a/wizards/com/sun/star/wizards/agenda/CallWizard.java
+++ b/wizards/com/sun/star/wizards/agenda/CallWizard.java
@@ -37,6 +37,7 @@ 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.PropertyNames;
/**
* This class capsulates the class, that implements the minimal component, a factory for
@@ -100,7 +101,7 @@ public class CallWizard {
public void trigger(String str) {
try {
- if (str.equalsIgnoreCase("start")) {
+ if (str.equalsIgnoreCase(PropertyNames.START)) {
AgendaWizardDialogImpl aw = new AgendaWizardDialogImpl(xmultiservicefactory);
if (!AgendaWizardDialogImpl.running) {
aw.startWizard();
@@ -184,7 +185,7 @@ public class CallWizard {
};
try {
- byteReturn = ("" + this.hashCode()).getBytes();
+ byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
} catch (Exception exception) {
System.err.println(exception);
}
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.java b/wizards/com/sun/star/wizards/agenda/TopicsControl.java
index 0e3678139378..495ac8a94040 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.java
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.java
@@ -190,7 +190,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
*/
static void addKeyListener(Object control, XKeyListener listener)
{
- XWindow xlastControl = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ XWindow xlastControl = UnoRuntime.queryInterface(XWindow.class,
control);
xlastControl.addKeyListener(listener);
}
@@ -200,7 +200,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
*/
static void addFocusListener(Object control, XFocusListener listener)
{
- XWindow xlastControl = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ XWindow xlastControl = UnoRuntime.queryInterface(XWindow.class,
control);
xlastControl.addFocusListener(listener);
}
@@ -304,14 +304,14 @@ public class TopicsControl extends ControlScroller implements XFocusListener
}
/**
- * in order to use the "move up", "down" "insert" and "remove" buttons,
+ * in order to use the "move up", "downPropertyNames.SPACEinsert" 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);
+ XControl xc = UnoRuntime.queryInterface(XControl.class, fe.Source);
focusGained(xc);
}
@@ -463,9 +463,9 @@ public class TopicsControl extends ControlScroller implements XFocusListener
// 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 = "";
+ pv1[1].Value = PropertyNames.EMPTY_STRING;
+ pv1[2].Value = PropertyNames.EMPTY_STRING;
+ pv1[3].Value = PropertyNames.EMPTY_STRING;
// update the preview document.
updateDocumentRow(lastFocusRow);
@@ -487,10 +487,10 @@ public class TopicsControl extends ControlScroller implements XFocusListener
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, "");
+ pv[0] = Properties.createProperty(LABEL + i, PropertyNames.EMPTY_STRING + (i + 1) + ".");
+ pv[1] = Properties.createProperty(TOPIC + i, PropertyNames.EMPTY_STRING);
+ pv[2] = Properties.createProperty(RESP + i, PropertyNames.EMPTY_STRING);
+ pv[3] = Properties.createProperty(TIME + i, PropertyNames.EMPTY_STRING);
return pv;
}
@@ -536,9 +536,9 @@ public class TopicsControl extends ControlScroller implements XFocusListener
PropertyValue[] data = getTopicData(row);
// now - is this row empty?
- return data[1].Value.equals("") &&
- data[2].Value.equals("") &&
- data[3].Value.equals("");
+ return data[1].Value.equals(PropertyNames.EMPTY_STRING) &&
+ data[2].Value.equals(PropertyNames.EMPTY_STRING) &&
+ data[3].Value.equals(PropertyNames.EMPTY_STRING);
}
/**
@@ -698,11 +698,11 @@ public class TopicsControl extends ControlScroller implements XFocusListener
*/
private void focus(Object textControl)
{
- ((XWindow) UnoRuntime.queryInterface(XWindow.class, textControl)).setFocus();
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, textControl);
+ UnoRuntime.queryInterface(XWindow.class, textControl).setFocus();
+ 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);
+ XControl xc = UnoRuntime.queryInterface(XControl.class, textControl);
focusGained(xc);
}
@@ -876,7 +876,7 @@ public class TopicsControl extends ControlScroller implements XFocusListener
*/
private Selection getSelection(Object control)
{
- return ((XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, control)).getSelection();
+ return UnoRuntime.queryInterface(XTextComponent.class, control).getSelection();
}
/**
@@ -897,8 +897,8 @@ public class TopicsControl extends ControlScroller implements XFocusListener
{
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);
+ UnoRuntime.queryInterface(XWindow.class, control).setFocus();
+ UnoRuntime.queryInterface(XTextComponent.class, control).setSelection(s);
}
/**
@@ -1038,11 +1038,11 @@ public class TopicsControl extends ControlScroller implements XFocusListener
/**
* A static member used for the child-class ControlRow (GUI Constant)
*/
- private static Integer I_12 = new Integer(12);
+ private static Integer I_12 = 12;
/**
* A static member used for the child-class ControlRow (GUI Constant)
*/
- private static Integer I_8 = new Integer(8);
+ private static Integer I_8 = 8;
/**
* A static member used for the child-class ControlRow (GUI Constant)
*/
@@ -1173,28 +1173,28 @@ public class TopicsControl extends ControlScroller implements XFocusListener
LABEL_PROPS,
new Object[]
{
- I_8, "" + (i + 1) + ".", new Integer(x + 4), new Integer(y + 2), IStep, new Short((short) tabindex), new Integer(10)
+ I_8, PropertyNames.EMPTY_STRING + (i + 1) + ".", new Integer(x + 4), new Integer(y + 2), IStep, new Short((short) tabindex), 10
});
textbox = dialog.insertTextField(TOPIC + i, "topicTextChanged", this,
TEXT_PROPS,
new Object[]
{
- I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 1), new Integer(x + 15), y_, IStep, new Short((short) (tabindex + 1)), new Integer(84)
+ I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 1), new Integer(x + 15), y_, IStep, new Short((short) (tabindex + 1)), 84
});
combobox = dialog.insertTextField(RESP + i, "responsibleTextChanged", this,
TEXT_PROPS,
new Object[]
{
- I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 2), new Integer(x + 103), y_, IStep, new Short((short) (tabindex + 2)), new Integer(68)
+ I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 2), new Integer(x + 103), y_, IStep, new Short((short) (tabindex + 2)), 68
});
timebox = dialog.insertTextField(TIME + i, "timeTextChanged", this,
TEXT_PROPS,
new Object[]
{
- I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 3), new Integer(x + 175), y_, IStep, new Short((short) (tabindex + 3)), new Integer(20)
+ I_12, HelpIds.getHelpIdString(curHelpIndex + i * 3 + 3), new Integer(x + 175), y_, IStep, new Short((short) (tabindex + 3)), 20
});
setEnabled(false);
diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.java b/wizards/com/sun/star/wizards/common/ConfigSet.java
index 216f91b5e430..7684de5e10ce 100644
--- a/wizards/com/sun/star/wizards/common/ConfigSet.java
+++ b/wizards/com/sun/star/wizards/common/ConfigSet.java
@@ -90,11 +90,11 @@ public class ConfigSet implements ConfigNode, XMLProvider, ListModel
public void add(int i, Object o)
{
int name = i;
- while (getElement("" + name) != null)
+ while (getElement(PropertyNames.EMPTY_STRING + name) != null)
{
name++;
}
- childrenMap.put("" + name, o);
+ childrenMap.put(PropertyNames.EMPTY_STRING + name, o);
childrenList.add(i, o);
fireListDataListenerIntervalAdded(i, i);
diff --git a/wizards/com/sun/star/wizards/common/Configuration.java b/wizards/com/sun/star/wizards/common/Configuration.java
index 04dd385ddf60..08baa26b412c 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.java
+++ b/wizards/com/sun/star/wizards/common/Configuration.java
@@ -97,7 +97,7 @@ public abstract class Configuration
Object o = getNode(name, parent);
if (AnyConverter.isVoid(o))
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
return (String) o;
}
@@ -114,7 +114,7 @@ public abstract class Configuration
public static Object getNode(String name, Object parent) throws Exception
{
- return ((XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, parent)).getByName(name);
+ return UnoRuntime.queryInterface(XNameAccess.class, parent).getByName(name);
}
public static void set(int value, String name, Object parent) throws Exception
@@ -134,7 +134,7 @@ public abstract class Configuration
public static void set(boolean value, String name, Object parent) throws Exception
{
- if (value == true)
+ if (value)
{
set(Boolean.TRUE, name, parent);
}
@@ -146,7 +146,7 @@ public abstract class Configuration
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);
+ UnoRuntime.queryInterface(XHierarchicalPropertySet.class, parent).setHierarchicalPropertyValue(name, value);
}
/** Creates a new instance of RegistryEntry
@@ -157,7 +157,7 @@ public abstract class Configuration
*/
public static Object getConfigurationNode(String name, Object parent) throws Exception
{
- return ((XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, parent)).getByName(name);
+ return UnoRuntime.queryInterface(XNameAccess.class, parent).getByName(name);
}
public static Object getConfigurationRoot(XMultiServiceFactory xmsf, String sPath, boolean updateable) throws com.sun.star.uno.Exception
@@ -165,7 +165,7 @@ public abstract class Configuration
Object oConfigProvider;
oConfigProvider = xmsf.createInstance("com.sun.star.configuration.ConfigurationProvider");
- XMultiServiceFactory confMsf = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
+ XMultiServiceFactory confMsf = UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
final String sView = updateable ? "com.sun.star.configuration.ConfigurationUpdateAccess" : "com.sun.star.configuration.ConfigurationAccess";
@@ -192,7 +192,7 @@ public abstract class Configuration
public static String[] getChildrenNames(Object configView)
{
- XNameAccess nameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, configView);
+ XNameAccess nameAccess = UnoRuntime.queryInterface(XNameAccess.class, configView);
return nameAccess.getElementNames();
}
@@ -201,8 +201,7 @@ public abstract class Configuration
try
{
Object oProdNameAccess = getConfigurationRoot(xMSF, "org.openoffice.Setup/Product", false);
- String ProductName = (String) Helper.getUnoObjectbyName(oProdNameAccess, "ooName");
- return ProductName;
+ return (String) Helper.getUnoObjectbyName(oProdNameAccess, "ooName");
}
catch (Exception exception)
{
@@ -213,7 +212,7 @@ public abstract class Configuration
public static String getOfficeLocaleString(XMultiServiceFactory xMSF)
{
- String sLocale = "";
+ String sLocale = PropertyNames.EMPTY_STRING;
try
{
Locale aLocLocale = new Locale();
@@ -247,8 +246,7 @@ public abstract class Configuration
try
{
Object oMasterKey = getConfigurationRoot(xMSF, "org.openoffice.Setup/L10N/", false);
- String sLinguistic = (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
- return sLinguistic;
+ return (String) Helper.getUnoObjectbyName(oMasterKey, "ooLocale");
}
catch (Exception exception)
{
@@ -273,11 +271,11 @@ public abstract class Configuration
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);
+ XNameContainer xNameContainer = UnoRuntime.queryInterface(XNameContainer.class, configView);
if (xNameContainer == null)
{
- XNameReplace xNameReplace = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, configView);
+ XNameReplace xNameReplace = UnoRuntime.queryInterface(XNameReplace.class, configView);
return xNameReplace.getByName(name);
}
else
@@ -287,7 +285,7 @@ public abstract class Configuration
xNameContainer.removeByName(name);*/
// create a new detached set element (instance of DataSourceDescription)
- XSingleServiceFactory xElementFactory = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, configView);
+ XSingleServiceFactory xElementFactory = UnoRuntime.queryInterface(XSingleServiceFactory.class, configView);
// the new element is the result !
Object newNode = xElementFactory.createInstance();
@@ -300,7 +298,7 @@ public abstract class Configuration
public static void removeNode(Object configView, String name) throws NoSuchElementException, WrappedTargetException
{
- XNameContainer xNameContainer = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, configView);
+ XNameContainer xNameContainer = UnoRuntime.queryInterface(XNameContainer.class, configView);
if (xNameContainer.hasByName(name))
{
@@ -310,7 +308,7 @@ public abstract class Configuration
public static void commit(Object configView) throws WrappedTargetException
{
- XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, configView);
+ XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, configView);
xUpdateControl.commitChanges();
}
@@ -319,7 +317,7 @@ public abstract class Configuration
Object view = Configuration.getConfigurationRoot(xmsf, path, true);
addConfigNode(path, name);
node.writeConfiguration(view, param);
- XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, view);
+ XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view);
xUpdateControl.commitChanges();
}
@@ -327,7 +325,7 @@ public abstract class Configuration
{
Object view = Configuration.getConfigurationRoot(xmsf, path, true);
removeNode(view, name);
- XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, view);
+ XChangesBatch xUpdateControl = UnoRuntime.queryInterface(XChangesBatch.class, view);
xUpdateControl.commitChanges();
}
@@ -371,8 +369,7 @@ public abstract class Configuration
{
String[] snames = _xNameAccess.getElementNames();
Object oNode = _xNameAccess.getByName(snames[_index]);
- XNameAccess xNameAccessNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oNode);
- return xNameAccessNode;
+ return UnoRuntime.queryInterface(XNameAccess.class, oNode);
}
catch (Exception e)
{
@@ -387,7 +384,7 @@ public abstract class Configuration
{
if (_xNameAccessNode.hasByName(_SubNodeName))
{
- return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(_SubNodeName));
+ return UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(_SubNodeName));
}
}
catch (Exception e)
@@ -415,7 +412,7 @@ public abstract class Configuration
String curdisplayname = (String) Helper.getUnoPropertyValue(_xNameAccessNode.getByName(snames[i]), _nodename);
if (curdisplayname.equals(_displayname))
{
- return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i]));
+ return UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i]));
}
}
}
@@ -444,7 +441,7 @@ public abstract class Configuration
if (curdisplayname.equals(_displayname))
{
- return (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i]));
+ return UnoRuntime.queryInterface(XNameAccess.class, _xNameAccessNode.getByName(snames[i]));
}
}
}
diff --git a/wizards/com/sun/star/wizards/common/Desktop.java b/wizards/com/sun/star/wizards/common/Desktop.java
index 8902696c37b4..13de04381155 100644
--- a/wizards/com/sun/star/wizards/common/Desktop.java
+++ b/wizards/com/sun/star/wizards/common/Desktop.java
@@ -76,7 +76,7 @@ public class Desktop
try
{
xInterface = (com.sun.star.uno.XInterface) xMSF.createInstance("com.sun.star.frame.Desktop");
- xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface);
+ xDesktop = UnoRuntime.queryInterface(XDesktop.class, xInterface);
}
catch (Exception exception)
{
@@ -93,27 +93,26 @@ public class Desktop
public static XFrame getActiveFrame(XMultiServiceFactory xMSF)
{
XDesktop xDesktop = getDesktop(xMSF);
- XFramesSupplier xFrameSuppl = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
- XFrame xFrame = xFrameSuppl.getActiveFrame();
- return xFrame;
+ XFramesSupplier xFrameSuppl = UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
+ return xFrameSuppl.getActiveFrame();
}
public static XComponent getActiveComponent(XMultiServiceFactory _xMSF)
{
XFrame xFrame = getActiveFrame(_xMSF);
- return (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
+ return UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
}
public static XTextDocument getActiveTextDocument(XMultiServiceFactory _xMSF)
{
XComponent xComponent = getActiveComponent(_xMSF);
- return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ return UnoRuntime.queryInterface(XTextDocument.class, xComponent);
}
public static XSpreadsheetDocument getActiveSpreadsheetDocument(XMultiServiceFactory _xMSF)
{
XComponent xComponent = getActiveComponent(_xMSF);
- return (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
+ return UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
}
public static XDispatch getDispatcher(XMultiServiceFactory xMSF, XFrame xFrame, String _stargetframe, com.sun.star.util.URL oURL)
@@ -122,9 +121,8 @@ public class Desktop
{
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;
+ XDispatchProvider xDispatchProvider = UnoRuntime.queryInterface(XDispatchProvider.class, xFrame);
+ return xDispatchProvider.queryDispatch(oURLArray[0], _stargetframe, FrameSearchFlag.ALL); // "_self"
}
catch (Exception e)
{
@@ -138,7 +136,7 @@ public class Desktop
try
{
Object oTransformer = xMSF.createInstance("com.sun.star.util.URLTransformer");
- XURLTransformer xTransformer = (XURLTransformer) UnoRuntime.queryInterface(XURLTransformer.class, oTransformer);
+ XURLTransformer xTransformer = 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;
@@ -161,7 +159,7 @@ public class Desktop
public static void dispatchURL(XMultiServiceFactory xMSF, String sURL, XFrame xFrame)
{
- dispatchURL(xMSF, sURL, xFrame, "");
+ dispatchURL(xMSF, sURL, xFrame, PropertyNames.EMPTY_STRING);
}
public static void dispatchURL(XDispatch _xDispatch, com.sun.star.util.URL oURL)
@@ -182,20 +180,19 @@ public class Desktop
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;
+ return UnoRuntime.queryInterface(XMultiServiceFactory.class, urlResolver.resolve( connectStr ) );
}
public static String getIncrementSuffix(XNameAccess xElementContainer, String ElementName)
{
boolean bElementexists = true;
int i = 1;
- String sIncSuffix = "";
+ String sIncSuffix = PropertyNames.EMPTY_STRING;
String BaseName = ElementName;
- while (bElementexists == true)
+ while (bElementexists)
{
bElementexists = xElementContainer.hasByName(ElementName);
- if (bElementexists == true)
+ if (bElementexists)
{
i += 1;
ElementName = BaseName + Integer.toString(i);
@@ -212,12 +209,12 @@ public class Desktop
{
boolean bElementexists = true;
int i = 1;
- String sIncSuffix = "";
+ String sIncSuffix = PropertyNames.EMPTY_STRING;
String BaseName = ElementName;
- while (bElementexists == true)
+ while (bElementexists)
{
bElementexists = xElementContainer.hasByHierarchicalName(ElementName);
- if (bElementexists == true)
+ if (bElementexists)
{
i += 1;
ElementName = BaseName + Integer.toString(i);
@@ -235,10 +232,9 @@ public class Desktop
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, " ");
+ XCharacterClassification xCharacterClassification = UnoRuntime.queryInterface(XCharacterClassification.class, ocharservice);
+ ParseResult aResult = xCharacterClassification.parsePredefinedToken(KParseType.IDENTNAME, _sString, 0, _aLocale, nStartFlags, PropertyNames.EMPTY_STRING, nStartFlags, PropertyNames.SPACE);
return aResult.EndPos;
}
catch (Exception e)
@@ -258,7 +254,7 @@ public class Desktop
if (i < snewname.length())
{
String sspecialchar = snewname.substring(i, i + 1);
- snewname = JavaTools.replaceSubString(snewname, "", sspecialchar);
+ snewname = JavaTools.replaceSubString(snewname, PropertyNames.EMPTY_STRING, sspecialchar);
}
}
return snewname;
@@ -311,7 +307,7 @@ public class Desktop
{
return _sElementName;
}
- while (bElementexists == true)
+ while (bElementexists)
{
for (int i = 0; i < _slist.length; i++)
{
@@ -322,7 +318,7 @@ public class Desktop
}
scompname = _sElementName + _sSuffixSeparator + a++;
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
/**
@@ -342,8 +338,8 @@ public class Desktop
aNodePath[0] = new PropertyValue();
aNodePath[0].Name = "nodepath";
aNodePath[0].Value = KeyName;
- XMultiServiceFactory xMSFConfig = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
- if (bForUpdate == true)
+ XMultiServiceFactory xMSFConfig = UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
+ if (bForUpdate)
{
return (XInterface) xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath);
}
@@ -377,9 +373,9 @@ public class Desktop
try
{
TemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
- UserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", "");
+ UserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
BitmapPath = FileAccess.combinePaths(xMSF, TemplatePath, "/../wizard/bitmap");
- WorkPath = FileAccess.getOfficePath(xMSF, "Work", "", "");
+ WorkPath = FileAccess.getOfficePath(xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
}
catch (NoValidPathException nopathexception)
{
@@ -391,52 +387,48 @@ public class Desktop
{
try
{
- String sTemplatePath = FileAccess.getOfficePath(_xMSF, "Template", "share", "/wizard");
- return sTemplatePath;
+ return FileAccess.getOfficePath(_xMSF, "Template", "share", "/wizard");
}
catch (NoValidPathException nopathexception)
{
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public static String getUserTemplatePath(XMultiServiceFactory _xMSF)
{
try
{
- String sUserTemplatePath = FileAccess.getOfficePath(_xMSF, "Template", "user", "");
- return sUserTemplatePath;
+ return FileAccess.getOfficePath(_xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
}
catch (NoValidPathException nopathexception)
{
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public static String getBitmapPath(XMultiServiceFactory _xMSF)
{
try
{
- String sBitmapPath = FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/../wizard/bitmap");
- return sBitmapPath;
+ return FileAccess.combinePaths(_xMSF, getTemplatePath(_xMSF), "/../wizard/bitmap");
}
catch (NoValidPathException nopathexception)
{
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public static String getWorkPath(XMultiServiceFactory _xMSF)
{
try
{
- String sWorkPath = FileAccess.getOfficePath(_xMSF, "Work", "", "");
- return sWorkPath;
+ return FileAccess.getOfficePath(_xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
}
catch (NoValidPathException nopathexception)
{
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF)
@@ -452,7 +444,7 @@ public class Desktop
}
if (xPathSubst != null)
{
- return (XStringSubstitution) UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst);
+ return UnoRuntime.queryInterface(XStringSubstitution.class, xPathSubst);
}
else
{
@@ -495,7 +487,7 @@ public class Desktop
{
Object comp = ((Any) e.nextElement()).getObject();
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, comp);
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, comp);
XFrame xFrame = xModel.getCurrentController().getFrame();
if (xFrame != null && xFrame.getComponentWindow() != null)
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java
index 6278d7e71a97..40cccba9ad75 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.java
+++ b/wizards/com/sun/star/wizards/common/FileAccess.java
@@ -33,6 +33,7 @@ import com.sun.star.util.XMacroExpander;
// import com.sun.star.wizards.common.NoValidPathException;
import java.io.File;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Vector;
import com.sun.star.awt.VclWindowPeerAttribute;
@@ -74,24 +75,23 @@ public class FileAccess
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, ";");
+ String[] PathList = JavaTools.ArrayoutofString(ResultPath, PropertyNames.SEMI_COLON);
int MaxIndex = PathList.length - 1;
String CompCurPath;
// sAddPath.replace(null, (char) 47);
- String CompAddPath = JavaTools.replaceSubString(sAddPath, "", "/");
+ String CompAddPath = JavaTools.replaceSubString(sAddPath, PropertyNames.EMPTY_STRING, "/");
String CurPath;
for (int i = 0; i <= MaxIndex; i++)
{
CurPath = JavaTools.convertfromURLNotation(PathList[i]);
- CompCurPath = JavaTools.replaceSubString(CurPath, "", "/");
+ CompCurPath = JavaTools.replaceSubString(CurPath, PropertyNames.EMPTY_STRING, "/");
if (CompCurPath.equals(CompAddPath))
{
return;
}
}
- ResultPath += ";" + sAddPath;
- return;
- }
+ ResultPath += PropertyNames.SEMI_COLON + sAddPath;
+ }
public static String deleteLastSlashfromUrl(String _sPath)
{
@@ -117,7 +117,7 @@ public class FileAccess
{
try
{
- String ResultPath = "";
+ String ResultPath = PropertyNames.EMPTY_STRING;
XInterface xInterface = (XInterface) xMSF.createInstance("com.sun.star.util.PathSettings");
ResultPath = com.sun.star.uno.AnyConverter.toString(Helper.getUnoPropertyValue(xInterface, sPath));
ResultPath = deleteLastSlashfromUrl(ResultPath);
@@ -126,7 +126,7 @@ public class FileAccess
catch (Exception exception)
{
exception.printStackTrace(System.out);
- return "";
+ return PropertyNames.EMPTY_STRING;
}
}
@@ -135,7 +135,7 @@ public class FileAccess
* chapter 6.2.7
* @param xMSF
* @param sPath
- * @param sType use "share" or "user". Set to "" if not needed eg for the WorkPath;
+ * @param sType use "share" or "user". Set to PropertyNames.EMPTY_STRING if not needed eg for the WorkPath;
* In the return Officepath a possible slash at the end is cut off
* @param sSearchDir
* @return
@@ -145,9 +145,9 @@ public class FileAccess
{
//This method currently only works with sPath="Template"
- String ResultPath = "";
+ String ResultPath = PropertyNames.EMPTY_STRING;
- String Template_writable = "";
+ String Template_writable = PropertyNames.EMPTY_STRING;
String[] Template_internal;
String[] Template_user;
@@ -155,11 +155,11 @@ public class FileAccess
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 = "";
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xPathInterface);
+ String WritePath = PropertyNames.EMPTY_STRING;
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);
+ XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
Template_writable = (String) xPropertySet.getPropertyValue(sPath + "_writable");
Template_internal = (String[]) xPropertySet.getPropertyValue(sPath + "_internal");
@@ -204,11 +204,11 @@ public class FileAccess
catch (Exception exception)
{
exception.printStackTrace(System.out);
- ResultPath = "";
+ ResultPath = PropertyNames.EMPTY_STRING;
}
- if (bexists == false)
+ if (!bexists)
{
- throw new NoValidPathException(xMSF, "");
+ throw new NoValidPathException(xMSF, PropertyNames.EMPTY_STRING);
}
return ResultPath;
}
@@ -217,9 +217,9 @@ public class FileAccess
{
//This method currently only works with sPath="Template"
- // String ResultPath = "";
+ // String ResultPath = PropertyNames.EMPTY_STRING;
ArrayList<String> aPathList = new ArrayList<String>();
- String Template_writable = "";
+ String Template_writable = PropertyNames.EMPTY_STRING;
String[] Template_internal;
String[] Template_user;
@@ -229,8 +229,8 @@ public class FileAccess
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 = "";
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xPathInterface);
+ // String WritePath = PropertyNames.EMPTY_STRING;
// XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
// XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
@@ -255,10 +255,7 @@ public class FileAccess
aPathList.add(sPath);
}
- for (int i = 0; i < Template_user.length; i++)
- {
- aPathList.add(Template_user[i]);
- }
+ aPathList.addAll(Arrays.asList(Template_user));
aPathList.add(Template_writable);
// WritePath = Template_writable;
@@ -288,11 +285,11 @@ public class FileAccess
catch (Exception exception)
{
exception.printStackTrace(System.out);
- // ResultPath = "";
+ // ResultPath = PropertyNames.EMPTY_STRING;
}
// if (bexists == false)
// {
-// throw new NoValidPathException(xMSF, "");
+// throw new NoValidPathException(xMSF, PropertyNames.EMPTY_STRING);
// }
// return ResultPath;
return aPathList;
@@ -323,7 +320,7 @@ public class FileAccess
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);
+ XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
if (xSimpleFileAccess.exists(sPath))
{
return sPath;
@@ -374,7 +371,7 @@ public class FileAccess
/*
public static String getOfficePath(XMultiServiceFactory xMSF, String sPath, String sType) throws NoValidPathException {
- String ResultPath = "";
+ String ResultPath = PropertyNames.EMPTY_STRING;
Object oPathSettings;
int iPathCount;
String[] PathList;
@@ -383,10 +380,10 @@ public class FileAccess
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 = "";
+ PathList = JavaTools.ArrayoutofString(ResultPath, PropertyNames.SEMI_COLON);
+ if (!sType.equals(PropertyNames.EMPTY_STRING)) {
+ ResultPath = PropertyNames.EMPTY_STRING;
+ String CurPath = PropertyNames.EMPTY_STRING;
String EndString = "/" + sType;
int EndLength = EndString.length();
sType = "/" + sType + "/";
@@ -403,11 +400,11 @@ public class FileAccess
}
} else
ResultPath = PathList[0];
- if (ResultPath.equals("") == false)
+ if (ResultPath.equals(PropertyNames.EMPTY_STRING) == false)
bexists = xSimpleFileAccess.exists(ResultPath);
} catch (Exception exception) {
exception.printStackTrace(System.out);
- ResultPath = "";
+ ResultPath = PropertyNames.EMPTY_STRING;
}
if (bexists == false)
throw new NoValidPathException(xMSF);
@@ -439,7 +436,7 @@ public class FileAccess
try
{
XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
- XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
+ XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
bExists = xSimpleFileAccess.exists(_sPath);
}
catch (Exception exception)
@@ -452,46 +449,43 @@ public class FileAccess
public static String combinePaths(XMultiServiceFactory xMSF, String _sFirstPath, String _sSecondPath) throws NoValidPathException
{
boolean bexists = false;
- String ReturnPath = "";
+ String ReturnPath = PropertyNames.EMPTY_STRING;
try
{
XInterface xUcbInterface = (XInterface) xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
- XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) com.sun.star.uno.UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
+ XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xUcbInterface);
ReturnPath = _sFirstPath + _sSecondPath;
bexists = xSimpleFileAccess.exists(ReturnPath);
}
catch (Exception exception)
{
exception.printStackTrace(System.out);
- return "";
+ return PropertyNames.EMPTY_STRING;
}
- if (bexists == false)
+ if (!bexists)
{
- throw new NoValidPathException(xMSF, "");
+ throw new NoValidPathException(xMSF, PropertyNames.EMPTY_STRING);
}
return ReturnPath;
}
public static boolean createSubDirectory(XMultiServiceFactory xMSF, XSimpleFileAccess xSimpleFileAccess, String Path)
{
- String sNoDirCreation = "";
+ String sNoDirCreation = PropertyNames.EMPTY_STRING;
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)
{
- 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;
- }
+ xSimpleFileAccess.createFolder(Path);
+ return true;
}
return false;
}
@@ -516,7 +510,7 @@ public class FileAccess
try
{
String SubDir;
- String SubDirPath = "";
+ String SubDirPath = PropertyNames.EMPTY_STRING;
int SubLen;
int NewLen;
int RestLen;
@@ -525,7 +519,7 @@ public class FileAccess
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);
+ XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
if (baskbeforeOverwrite)
{
if (xSimpleFileAccess.exists(Path))
@@ -563,14 +557,13 @@ public class FileAccess
if (bexists)
{
LowerCasePath = NewPath.toLowerCase();
- bexists = (((LowerCasePath.equals("file:///")) || (LowerCasePath.equals("file://")) || (LowerCasePath.equals("file:/")) || (LowerCasePath.equals("file:"))) == false);
+ bexists = (!((LowerCasePath.equals("file:///")) || (LowerCasePath.equals("file://")) || (LowerCasePath.equals("file:/")) || (LowerCasePath.equals("file:"))));
}
if (bexists)
{
- if (bSubDirexists == false)
+ if (!bSubDirexists)
{
- boolean bSubDiriscreated = createSubDirectory(xMSF, xSimpleFileAccess, SubDirPath);
- return bSubDiriscreated;
+ return createSubDirectory(xMSF, xSimpleFileAccess, SubDirPath);
}
return true;
}
@@ -604,26 +597,26 @@ public class FileAccess
*/
public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String FilterName, String FolderName)
{
- String[][] LocLayoutFiles = new String[2][]; //{"",""}{""};
+ String[][] LocLayoutFiles = new String[2][]; //{PropertyNames.EMPTY_STRING,PropertyNames.EMPTY_STRING}{PropertyNames.EMPTY_STRING};
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);
+ XDocumentProperties xDocProps = 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);
+ com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(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 + "-";
+ FilterName = FilterName == null || FilterName.equals(PropertyNames.EMPTY_STRING) ? null : FilterName + "-";
- String fileName = "";
+ String fileName = PropertyNames.EMPTY_STRING;
PropertyValue[] noArgs = { };
for (int i = 0; i < nameList.length; i++)
{
@@ -676,11 +669,11 @@ public class FileAccess
public static String getPathFromList(XMultiServiceFactory xMSF, ArrayList _aList, String _sFile)
{
- String sFoundFile = "";
+ String sFoundFile = PropertyNames.EMPTY_STRING;
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);
+ com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
for (int i = 0; i < _aList.size(); i++)
{
@@ -709,16 +702,16 @@ public class FileAccess
public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String _sStartFilterName, ArrayList FolderNames)
throws NoValidPathException
{
- return getFolderTitles(xMSF, _sStartFilterName, FolderNames, "");
+ return getFolderTitles(xMSF, _sStartFilterName, FolderNames, PropertyNames.EMPTY_STRING);
}
private static String getTitle(XMultiServiceFactory xMSF, String _sFile)
{
- String sTitle = "";
+ String sTitle = PropertyNames.EMPTY_STRING;
try
{
XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
- XDocumentProperties xDocProps = (XDocumentProperties) UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);
+ XDocumentProperties xDocProps = UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);
PropertyValue[] noArgs = { };
xDocProps.loadFromMedium(_sFile, noArgs);
sTitle = xDocProps.getTitle();
@@ -732,7 +725,7 @@ public class FileAccess
public static String[][] getFolderTitles(com.sun.star.lang.XMultiServiceFactory xMSF, String _sStartFilterName, ArrayList FolderName, String _sEndFilterName)
throws NoValidPathException
{
- String[][] LocLayoutFiles = new String[2][]; //{"",""}{""};
+ String[][] LocLayoutFiles = new String[2][]; //{PropertyNames.EMPTY_STRING,PropertyNames.EMPTY_STRING}{PropertyNames.EMPTY_STRING};
if (FolderName.size() == 0)
{
throw new NoValidPathException(null, "Path not given.");
@@ -744,7 +737,7 @@ public class FileAccess
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);
+ xSimpleFileAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
}
catch (com.sun.star.uno.Exception e)
{
@@ -759,9 +752,9 @@ public class FileAccess
try
{
String[] nameList = xSimpleFileAccess.getFolderContents(sFolderName, false);
- _sStartFilterName = _sStartFilterName == null || _sStartFilterName.equals("") ? null : _sStartFilterName + "-";
+ _sStartFilterName = _sStartFilterName == null || _sStartFilterName.equals(PropertyNames.EMPTY_STRING) ? null : _sStartFilterName + "-";
- String fileName = "";
+ String fileName = PropertyNames.EMPTY_STRING;
for (int i = 0; i < nameList.length; i++)
{
fileName = getFilename(nameList[i]);
@@ -769,13 +762,13 @@ public class FileAccess
if (_sStartFilterName == null || fileName.startsWith(_sStartFilterName))
{
- if (_sEndFilterName.equals(""))
+ if (_sEndFilterName.equals(PropertyNames.EMPTY_STRING))
{
sTitle = getTitle(xMSF, nameList[i]);
}
else if (fileName.endsWith(_sEndFilterName))
{
- fileName = fileName.replaceAll(_sEndFilterName + "$", "");
+ fileName = fileName.replaceAll(_sEndFilterName + "$", PropertyNames.EMPTY_STRING);
sTitle = fileName;
}
else
@@ -818,31 +811,28 @@ public class FileAccess
{
//get a simple file access...
Object fa = xmsf.createInstance("com.sun.star.ucb.SimpleFileAccess");
- fileAccess = (XSimpleFileAccess2) UnoRuntime.queryInterface(XSimpleFileAccess2.class, fa);
+ fileAccess = 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);
+ filenameConverter = 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;
+ return filenameConverter.getFileURLFromSystemPath(parentPath, f.getAbsolutePath());
}
public String getURL(String path)
{
File f = new File(path);
- String r = filenameConverter.getFileURLFromSystemPath(
- path, f.getAbsolutePath());
- return r;
+ return filenameConverter.getFileURLFromSystemPath(path, f.getAbsolutePath());
}
public String getPath(String parentURL, String childURL)
{
- return filenameConverter.getSystemPathFromFileURL(parentURL + (((childURL == null || childURL.equals("")) ? "" : "/" + childURL)));
+ return filenameConverter.getSystemPathFromFileURL(parentURL + (((childURL == null || childURL.equals(PropertyNames.EMPTY_STRING)) ? PropertyNames.EMPTY_STRING : "/" + childURL)));
}
/**
@@ -855,7 +845,7 @@ public class FileAccess
int p = filename.indexOf(".");
if (p == -1)
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
else
{
@@ -1018,8 +1008,7 @@ public class FileAccess
{
String filename = getFilename(path, pathSeparator);
String sExtension = getExtension(filename);
- String basename = filename.substring(0, filename.length() - (sExtension.length() + 1));
- return basename;
+ return filename.substring(0, filename.length() - (sExtension.length() + 1));
}
/**
@@ -1083,7 +1072,7 @@ public class FileAccess
public String createNewDir(String parentDir, String name)
{
- String s = getNewFile(parentDir, name, "");
+ String s = getNewFile(parentDir, name, PropertyNames.EMPTY_STRING);
if (mkdir(s))
{
return s;
@@ -1102,8 +1091,7 @@ public class FileAccess
do
{
String filename = filename(name, extension, i++);
- String u = getURL(parentDir, filename);
- url = u;
+ url = getURL(parentDir, filename);
}
while (exists(url, true));
@@ -1112,7 +1100,7 @@ public class FileAccess
private static String filename(String name, String ext, int i)
{
- return name + (i == 0 ? "" : String.valueOf(i)) + (ext.equals("") ? "" : "." + ext);
+ return name + (i == 0 ? PropertyNames.EMPTY_STRING : String.valueOf(i)) + (ext.equals(PropertyNames.EMPTY_STRING) ? PropertyNames.EMPTY_STRING : "." + ext);
}
public int getSize(String url)
@@ -1129,7 +1117,7 @@ public class FileAccess
public static String connectURLs(String urlFolder, String urlFilename)
{
- return urlFolder + (urlFolder.endsWith("/") ? "" : "/") +
+ return urlFolder + (urlFolder.endsWith("/") ? PropertyNames.EMPTY_STRING : "/") +
(urlFilename.startsWith("/") ? urlFilename.substring(1) : urlFilename);
}
@@ -1140,13 +1128,13 @@ public class FileAccess
{
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);
+ XSimpleFileAccess xSimpleFileAccess = 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);
+ XTextInputStream xTextInputStream = UnoRuntime.queryInterface(XTextInputStream.class, oTextInputStream);
+ XActiveDataSink xActiveDataSink = UnoRuntime.queryInterface(XActiveDataSink.class, oTextInputStream);
xActiveDataSink.setInputStream(xInputStream);
while (!xTextInputStream.isEOF())
{
diff --git a/wizards/com/sun/star/wizards/common/HelpIds.java b/wizards/com/sun/star/wizards/common/HelpIds.java
index ad8faa2b2d42..19a51bef3e5a 100644
--- a/wizards/com/sun/star/wizards/common/HelpIds.java
+++ b/wizards/com/sun/star/wizards/common/HelpIds.java
@@ -38,7 +38,7 @@ public class HelpIds
"HID:WIZARDS_HID0_CANCEL", // HID:34205
"HID:WIZARDS_HID0_STATUS_DIALOG", // HID:34206
"HID:WIZARDS_HID1_LST_SESSIONS", // HID:34207
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID1_BTN_DEL_SES", // HID:34209
"HID:WIZARDS_HID2_LST_DOCS", // HID:34210
"HID:WIZARDS_HID2_BTN_ADD_DOC", // HID:34211
@@ -81,13 +81,13 @@ public class HelpIds
"HID:WIZARDS_HID5_BTN_BACKGND", // HID:34248
"HID:WIZARDS_HID5_BTN_ICONS", // HID:34249
"HID:WIZARDS_HID6_TXT_SITE_TITLE", // HID:34250
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID6_TXT_SITE_DESC", // HID:34253
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID6_DATE_SITE_CREATED", // HID:34255
"HID:WIZARDS_HID6_DATE_SITE_UPDATED", // HID:34256
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID6_TXT_SITE_EMAIL", // HID:34258
"HID:WIZARDS_HID6_TXT_SITE_COPYRIGHT", // HID:34259
"HID:WIZARDS_HID7_BTN_PREVIEW", // HID:34260
@@ -102,24 +102,24 @@ public class HelpIds
"HID:WIZARDS_HID7_BTN_FTP", // HID:34269
"HID:WIZARDS_HID7_CHK_SAVE", // HID:34270
"HID:WIZARDS_HID7_TXT_SAVE", // HID:34271
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_BG", // HID:34290
"HID:WIZARDS_HID_BG_BTN_OTHER", // HID:34291
"HID:WIZARDS_HID_BG_BTN_NONE", // HID:34292
@@ -143,23 +143,23 @@ public class HelpIds
"HID:WIZARDS_HID_BG_BTN_IMG14", // HID:34300
"HID:WIZARDS_HID_BG_BTN_IMG15", // HID:34311
"HID:WIZARDS_HID_BG_BTN_IMG16", // HID:34312
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGREPORT_DIALOG", // HID:34320
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGREPORT_0_CMDPREV", // HID:34322
"HID:WIZARDS_HID_DLGREPORT_0_CMDNEXT", // HID:34323
"HID:WIZARDS_HID_DLGREPORT_0_CMDFINISH", // HID:34324
"HID:WIZARDS_HID_DLGREPORT_0_CMDCANCEL", // HID:34325
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGREPORT_1_LBTABLES", // HID:34330
"HID:WIZARDS_HID_DLGREPORT_1_FIELDSAVAILABLE", // HID:34331
"HID:WIZARDS_HID_DLGREPORT_1_CMDMOVESELECTED", // HID:34332
@@ -169,7 +169,7 @@ public class HelpIds
"HID:WIZARDS_HID_DLGREPORT_1_FIELDSSELECTED", // HID:34336
"HID:WIZARDS_HID_DLGREPORT_1_CMDMOVEUP", // HID:34337
"HID:WIZARDS_HID_DLGREPORT_1_CMDMOVEDOWN", // HID:34338
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGREPORT_2_GROUPING", // HID:34340
"HID:WIZARDS_HID_DLGREPORT_2_CMDGROUP", // HID:34341
"HID:WIZARDS_HID_DLGREPORT_2_CMDUNGROUP", // HID:34342
@@ -188,18 +188,18 @@ public class HelpIds
"HID:WIZARDS_HID_DLGREPORT_3_SORT4", // HID:34355
"HID:WIZARDS_HID_DLGREPORT_3_OPTASCEND4", // HID:34356
"HID:WIZARDS_HID_DLGREPORT_3_OPTDESCEND4", // HID:34357
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGREPORT_4_TITLE", // HID:34362
"HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", // HID:34363
"HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", // HID:34364
"HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", // HID:34365
"HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", // HID:34366
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", // HID:34370
"HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", // HID:34371
"HID:WIZARDS_HID_DLGREPORT_5_TXTTEMPLATEPATH", // HID:34372
@@ -209,8 +209,8 @@ public class HelpIds
"HID:WIZARDS_HID_DLGREPORT_5_TXTDOCUMENTPATH", // HID:34376
"HID:WIZARDS_HID_DLGREPORT_5_CMDDOCUMENTPATH", // HID:34377
"HID:WIZARDS_HID_DLGREPORT_5_CHKLINKTODB", // HID:34378
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_1", // HID:34381
"HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_2", // HID:34382
"HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_3", // HID:34383
@@ -218,29 +218,29 @@ public class HelpIds
"HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_5", // HID:34385
"HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_6", // HID:34386
"HID:WIZARDS_HID_DLGREPORT_6_TXTTITLE_7", // HID:34387
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGFORM_DIALOG", // HID:34400
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGFORM_CMDPREV", // HID:34402
"HID:WIZARDS_HID_DLGFORM_CMDNEXT", // HID:34403
"HID:WIZARDS_HID_DLGFORM_CMDFINISH", // HID:34404
"HID:WIZARDS_HID_DLGFORM_CMDCANCEL", // HID:34405
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGFORM_MASTER_LBTABLES", // HID:34411
"HID:WIZARDS_HID_DLGFORM_MASTER_FIELDSAVAILABLE", // HID:34412
"HID:WIZARDS_HID_DLGFORM_MASTER_CMDMOVESELECTED", // HID:34413
@@ -250,17 +250,17 @@ public class HelpIds
"HID:WIZARDS_HID_DLGFORM_MASTER_FIELDSSELECTED", // HID:34417
"HID:WIZARDS_HID_DLGFORM_MASTER_CMDMOVEUP", // HID:34418
"HID:WIZARDS_HID_DLGFORM_MASTER_CMDMOVEDOWN", // HID:34419
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGFORM_CHKCREATESUBFORM", // HID:34421
"HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", // HID:34422
"HID:WIZARDS_HID_DLGFORM_OPTSELECTMANUALLY", // HID:34423
"HID:WIZARDS_HID_DLGFORM_lstRELATIONS", // HID:34424
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGFORM_SUB_LBTABLES", // HID:34431
"HID:WIZARDS_HID_DLGFORM_SUB_FIELDSAVAILABLE", // HID:34432
"HID:WIZARDS_HID_DLGFORM_SUB_CMDMOVESELECTED", // HID:34433
@@ -270,7 +270,7 @@ public class HelpIds
"HID:WIZARDS_HID_DLGFORM_SUB_FIELDSSELECTED", // HID:34437
"HID:WIZARDS_HID_DLGFORM_SUB_CMDMOVEUP", // HID:34438
"HID:WIZARDS_HID_DLGFORM_SUB_CMDMOVEDOWN", // HID:34439
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGFORM_LINKER_LSTSLAVELINK1", // HID:34441
"HID:WIZARDS_HID_DLGFORM_LINKER_LSTMASTERLINK1", // HID:34442
"HID:WIZARDS_HID_DLGFORM_LINKER_LSTSLAVELINK2", // HID:34443
@@ -279,8 +279,8 @@ public class HelpIds
"HID:WIZARDS_HID_DLGFORM_LINKER_LSTMASTERLINK3", // HID:34446
"HID:WIZARDS_HID_DLGFORM_LINKER_LSTSLAVELINK4", // HID:34447
"HID:WIZARDS_HID_DLGFORM_LINKER_LSTMASTERLINK4", // HID:34448
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", // HID:34451
"HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", // HID:34452
"HID:WIZARDS_HID_DLGFORM_CMDLEFTLABELED", // HID:34453
@@ -296,40 +296,40 @@ public class HelpIds
"HID:WIZARDS_HID_DLGFORM_CHKNOMODIFICATION", // HID:34463
"HID:WIZARDS_HID_DLGFORM_CHKNODELETION", // HID:34464
"HID:WIZARDS_HID_DLGFORM_CHKNOADDITION", // HID:34465
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGFORM_LSTSTYLES", // HID:34471
"HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", // HID:34472
"HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", // HID:34473
"HID:WIZARDS_HID_DLGFORM_CMDSIMPLEBORDER", // HID:34474
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGFORM_TXTPATH", // HID:34481
"HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", // HID:34482
"HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", // HID:34483
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGNEWSLTR_DIALOG", // HID:34500
"HID:WIZARDS_HID_DLGNEWSLTR_OPTSTANDARDLAYOUT", // HID:34501
"HID:WIZARDS_HID_DLGNEWSLTR_OPTPARTYLAYOUT", // HID:34502
@@ -337,19 +337,19 @@ public class HelpIds
"HID:WIZARDS_HID_DLGNEWSLTR_OPTSINGLESIDED", // HID:34504
"HID:WIZARDS_HID_DLGNEWSLTR_OPTDOUBLESIDED", // HID:34505
"HID:WIZARDS_HID_DLGNEWSLTR_CMDGOON", // HID:34506
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGDEPOT_DIALOG_SELLBUY", // HID:34520
"HID:WIZARDS_HID_DLGDEPOT_0_TXTSTOCKID_SELLBUY", // HID:34521
"HID:WIZARDS_HID_DLGDEPOT_0_TXTQUANTITY", // HID:34522
@@ -381,25 +381,25 @@ public class HelpIds
"HID:WIZARDS_HID_DLGDEPOT_LSTMARKETS", // HID:34548
"HID:WIZARDS_HID_DLGDEPOT_0_CMDCANCEL_HISTORY", // HID:34549
"HID:WIZARDS_HID_DLGDEPOT_0_CMDGOON_HISTORY", // HID:34550
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGIMPORT_DIALOG", // HID:34570
"HID:WIZARDS_HID_DLGIMPORT_0_CMDHELP", // HID:34571
"HID:WIZARDS_HID_DLGIMPORT_0_CMDCANCEL", // HID:34572
@@ -424,7 +424,7 @@ public class HelpIds
"HID:WIZARDS_HID_DLGIMPORT_2_LBEXPORTDOCUMENTPATH", // HID:34591
"HID:WIZARDS_HID_DLGIMPORT_2_EDEXPORTDOCUMENTPATH", // HID:34592
"HID:WIZARDS_HID_DLGIMPORT_2_CMDEXPORTPATHSELECT", // HID:34593
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGIMPORT_3_TBSUMMARY", // HID:34595
"HID:WIZARDS_HID_DLGIMPORT_0_CHKWRITER", // HID:34596
"HID:WIZARDS_HID_DLGIMPORT_0_CHKCALC", // HID:34597
@@ -432,34 +432,34 @@ public class HelpIds
"HID:WIZARDS_HID_DLGIMPORT_0_CHKMATHGLOBAL", // HID:34599
"HID:WIZARDS_HID_DLGIMPORT_2_CMDTEMPLATEPATHSELECT2", // HID:34600
"HID:WIZARDS_HID_DLGIMPORT_2_CMDDOCUMENTPATHSELECT2", // HID:34601
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGCORRESPONDENCE_DIALOG", // HID:34630
"HID:WIZARDS_HID_DLGCORRESPONDENCE_CANCEL", // HID:34631
"HID:WIZARDS_HID_DLGCORRESPONDENCE_OPTIONAGENDA1", // HID:34632
@@ -468,28 +468,28 @@ public class HelpIds
"HID:WIZARDS_HID_DLGCORRESPONDENCE_OPTIONLETTER1", // HID:34635
"HID:WIZARDS_HID_DLGCORRESPONDENCE_OPTIONLETTER2", // HID:34636
"HID:WIZARDS_HID_DLGCORRESPONDENCE_LETTEROKAY", // HID:34637
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGSTYLES_DIALOG", // HID:34650
"HID:WIZARDS_HID_DLGSTYLES_LISTBOX", // HID:34651
"HID:WIZARDS_HID_DLGSTYLES_CANCEL", // HID:34652
"HID:WIZARDS_HID_DLGSTYLES_OKAY", // HID:34653
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGCONVERT_DIALOG", // HID:34660
"HID:WIZARDS_HID_DLGCONVERT_CHECKBOX1", // HID:34661
"HID:WIZARDS_HID_DLGCONVERT_OPTIONBUTTON1", // HID:34662
@@ -511,25 +511,25 @@ public class HelpIds
"HID:WIZARDS_HID_DLGCONVERT_CBTARGETOPEN", // HID:34678
"HID:WIZARDS_HID_DLGCONVERT_CHKPROTECT", // HID:34679
"HID:WIZARDS_HID_DLGCONVERT_CHKTEXTDOCUMENTS", // HID:34680
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGPASSWORD_CMDGOON", // HID:34690
"HID:WIZARDS_HID_DLGPASSWORD_CMDCANCEL", // HID:34691
"HID:WIZARDS_HID_DLGPASSWORD_CMDHELP", // HID:34692
"HID:WIZARDS_HID_DLGPASSWORD_TXTPASSWORD", // HID:34693
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGHOLIDAYCAL_DIALOG", // HID:34700
"HID:WIZARDS_HID_DLGHOLIDAYCAL_1_PREVIEW", // HID:34701
"HID:WIZARDS_HID_DLGHOLIDAYCAL_1_OPYEAR", // HID:34702
@@ -604,39 +604,39 @@ public class HelpIds
"HID:WIZARDS_HID_LTRWIZ_OPTMAKECHANGES", // HID:40814
"HID:WIZARDS_HID_LTRWIZ_TXTPATH", // HID:40815
"HID:WIZARDS_HID_LTRWIZ_CMDPATH", // HID:40816
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_LTRWIZARD", // HID:40820
"HID:WIZARDS_HID_LTRWIZARD_HELP", // HID:40821
"HID:WIZARDS_HID_LTRWIZARD_BACK", // HID:40822
"HID:WIZARDS_HID_LTRWIZARD_NEXT", // HID:40823
"HID:WIZARDS_HID_LTRWIZARD_CREATE", // HID:40824
"HID:WIZARDS_HID_LTRWIZARD_CANCEL", // HID:40825
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD_LSTTABLES", // HID:40850
"HID:WIZARDS_HID_QUERYWIZARD_LSTFIELDS", // HID:40851
"HID:WIZARDS_HID_QUERYWIZARD_CMDMOVESELECTED", // HID:40852
@@ -646,12 +646,12 @@ public class HelpIds
"HID:WIZARDS_HID_QUERYWIZARD_LSTSELFIELDS", // HID:40856
"HID:WIZARDS_HID_QUERYWIZARD_CMDMOVEUP", // HID:40857
"HID:WIZARDS_HID_QUERYWIZARD_CMDMOVEDOWN", // HID:40858
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD_SORT1", // HID:40865
"HID:WIZARDS_HID_QUERYWIZARD_OPTASCEND1", // HID:40866
"HID:WIZARDS_HID_QUERYWIZARD_OPTDESCEND1", // HID:40867
@@ -664,7 +664,7 @@ public class HelpIds
"HID:WIZARDS_HID_QUERYWIZARD_SORT4", // HID:40874
"HID:WIZARDS_HID_QUERYWIZARD_OPTASCEND4", // HID:40875
"HID:WIZARDS_HID_QUERYWIZARD_OPTDESCEND4", // HID:40876
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD_OPTMATCHALL", // HID:40878
"HID:WIZARDS_HID_QUERYWIZARD_OPTMATCHANY", // HID:40879
"HID:WIZARDS_HID_QUERYWIZARD_LSTFIELDNAME_1", // HID:40880
@@ -676,12 +676,12 @@ public class HelpIds
"HID:WIZARDS_HID_QUERYWIZARD_LSTFIELDNAME_3", // HID:40886
"HID:WIZARDS_HID_QUERYWIZARD_LSTOPERATOR_3", // HID:40887
"HID:WIZARDS_HID_QUERYWIZARD_TXTVALUE_3", // HID:40888
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD_OPTAGGREGATEDETAILQUERY", // HID:40895
"HID:WIZARDS_HID_QUERYWIZARD_OPTAGGREGATESUMMARYQUERY", // HID:40896
"HID:WIZARDS_HID_QUERYWIZARD_LSTAGGREGATEFUNCTION_1", // HID:40897
@@ -696,20 +696,20 @@ public class HelpIds
"HID:WIZARDS_HID_QUERYWIZARD_LSTAGGREGATEFIELDS_5", // HID:40906
"HID:WIZARDS_HID_QUERYWIZARD_BTNAGGREGATEPLUS", // HID:40907
"HID:WIZARDS_HID_QUERYWIZARD_BTNAGGREGATEMINUS", // HID:40908
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD_LSTFILTERFIELDS", // HID:40915
"HID:WIZARDS_HID_QUERYWIZARD_CMDFILTERMOVESELECTED", // HID:40916
"HID:WIZARDS_HID_QUERYWIZARD_CMDFILTERREMOVESELECTED", // HID:40917
"HID:WIZARDS_HID_QUERYWIZARD_LSTFILTERSELFIELDS", // HID:40918
"HID:WIZARDS_HID_QUERYWIZARD_CMDFILTERMOVEUP", // HID:40919
"HID:WIZARDS_HID_QUERYWIZARD_CMDFILTERMOVEDOWN", // HID:40920
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD_OPTGROUPMATCHALL", // HID:40923
"HID:WIZARDS_HID_QUERYWIZARD_OPTGROUPMATCHANY", // HID:40924
"HID:WIZARDS_HID_QUERYWIZARD_LSTFILTERFIELDNAME_1", // HID:40925
@@ -721,12 +721,12 @@ public class HelpIds
"HID:WIZARDS_HID_QUERYWIZARD_LSTFILTERFIELDNAME_3", // HID:40931
"HID:WIZARDS_HID_QUERYWIZARD_LSTFILTEROPERATOR_3", // HID:40932
"HID:WIZARDS_HID_QUERYWIZARD_TXTFILTERVALUE_3", // HID:40933
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_1", // HID:40940
"HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_2", // HID:40941
"HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_3", // HID:40942
@@ -734,61 +734,61 @@ public class HelpIds
"HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_5", // HID:40944
"HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_6", // HID:40945
"HID:WIZARDS_HID_QUERYWIZARD_TXTTITLE_7", // HID:40946
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD_TXTQUERYTITLE", // HID:40955
"HID:WIZARDS_HID_QUERYWIZARD_OPTDISPLAYQUERY", // HID:40956
"HID:WIZARDS_HID_QUERYWIZARD_OPTMODIFYQUERY", // HID:40957
"HID:WIZARDS_HID_QUERYWIZARD_TXTSUMMARY", // HID:40958
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD", // HID:40970
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_QUERYWIZARD_BACK", // HID:40972
"HID:WIZARDS_HID_QUERYWIZARD_NEXT", // HID:40973
"HID:WIZARDS_HID_QUERYWIZARD_CREATE", // HID:40974
"HID:WIZARDS_HID_QUERYWIZARD_CANCEL", // HID:40975
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_IS", // HID:41000
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_IS_BTN_NONE", // HID:41002
"HID:WIZARDS_HID_IS_BTN_OK", // HID:41003
"HID:WIZARDS_HID_IS_BTN_CANCEL", // HID:41004
@@ -824,9 +824,9 @@ public class HelpIds
"HID:WIZARDS_HID_IS_BTN_IMG30", // HID:41034
"HID:WIZARDS_HID_IS_BTN_IMG31", // HID:41035
"HID:WIZARDS_HID_IS_BTN_IMG32", // HID:41036
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_FTP", // HID:41040
"HID:WIZARDS_HID_FTP_SERVER", // HID:41041
"HID:WIZARDS_HID_FTP_USERNAME", // HID:41042
@@ -836,8 +836,8 @@ public class HelpIds
"HID:WIZARDS_HID_FTP_BTN_PATH", // HID:41046
"HID:WIZARDS_HID_FTP_OK", // HID:41047
"HID:WIZARDS_HID_FTP_CANCEL", // HID:41048
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_AGWIZ", // HID:41051
"HID:WIZARDS_HID_AGWIZ_HELP", // HID:41052
"HID:WIZARDS_HID_AGWIZ_NEXT", // HID:41053
@@ -886,27 +886,27 @@ public class HelpIds
"HID:WIZARDS_HID_AGWIZ_5_TXT_TOPIC_5", // HID:41096
"HID:WIZARDS_HID_AGWIZ_5_TXT_RESPONSIBLE_5", // HID:41097
"HID:WIZARDS_HID_AGWIZ_5_TXT_MINUTES_5", // HID:41098
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_FAXWIZ_OPTBUSINESSFAX", // HID:41120
"HID:WIZARDS_HID_FAXWIZ_LSTBUSINESSSTYLE", // HID:41121
"HID:WIZARDS_HID_FAXWIZ_OPTPRIVATEFAX", // HID:41122
@@ -942,53 +942,53 @@ public class HelpIds
"HID:WIZARDS_HID_IMAGECONTROL2", // HID:41152
"HID:WIZARDS_HID_FAXWIZ_TXTPATH", // HID:41153
"HID:WIZARDS_HID_FAXWIZ_CMDPATH", // HID:41154
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_FAXWIZARD", // HID:41180
"HID:WIZARDS_HID_FAXWIZARD_HELP", // HID:41181
"HID:WIZARDS_HID_FAXWIZARD_BACK", // HID:41182
"HID:WIZARDS_HID_FAXWIZARD_NEXT", // HID:41183
"HID:WIZARDS_HID_FAXWIZARD_CREATE", // HID:41184
"HID:WIZARDS_HID_FAXWIZARD_CANCEL", // HID:41185
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGTABLE_DIALOG", // HID:41200
- "",
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGTABLE_CMDPREV", // HID:41202
"HID:WIZARDS_HID_DLGTABLE_CMDNEXT", // HID:41203
"HID:WIZARDS_HID_DLGTABLE_CMDFINISH", // HID:41204
@@ -1004,9 +1004,9 @@ public class HelpIds
"HID:WIZARDS_HID_DLGTABLE_FIELDSSELECTED", // HID:41214
"HID:WIZARDS_HID_DLGTABLE_CMDMOVEUP", // HID:41215
"HID:WIZARDS_HID_DLGTABLE_CMDMOVEDOWN", // HID:41216
- "",
- "",
- "",
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
+ PropertyNames.EMPTY_STRING,
"HID:WIZARDS_HID_DLGTABLE_LB_SELFIELDNAMES", // HID:41220
"HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDUP", // HID:41221
"HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDDOWN", // HID:41222
@@ -1042,6 +1042,6 @@ public class HelpIds
else if ( nHelpId >= 40769 && nHelpId <= 41245 )
return array2[ nHelpId - 40769 ];
else
- return new String();
+ return "";
}
}
diff --git a/wizards/com/sun/star/wizards/common/Helper.java b/wizards/com/sun/star/wizards/common/Helper.java
index 0df16b360de0..b00cb3b2b485 100644
--- a/wizards/com/sun/star/wizards/common/Helper.java
+++ b/wizards/com/sun/star/wizards/common/Helper.java
@@ -58,15 +58,14 @@ public class Helper
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;
+ return lTime / (3600 * 24000);
}
public static void setUnoPropertyValue(Object oUnoObject, String PropertyName, Object PropertyValue)
{
try
{
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
if (xPSet.getPropertySetInfo().hasPropertyByName(PropertyName))
{
xPSet.setPropertyValue(PropertyName, PropertyValue);
@@ -87,8 +86,8 @@ public class Helper
{
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)
+ com.sun.star.container.XNameAccess xName = UnoRuntime.queryInterface(com.sun.star.container.XNameAccess.class, oUnoObject);
+ if (xName.hasByName(ElementName))
{
return xName.getByName(ElementName);
}
@@ -126,7 +125,7 @@ public class Helper
{
if (oUnoObject != null)
{
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
Object oObject = xPSet.getPropertyValue(PropertyName);
if (AnyConverter.isVoid(oObject))
{
@@ -202,10 +201,9 @@ public class Helper
{
if (oUnoObject != null)
{
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
// Property[] aProps = xPSet.getPropertySetInfo().getProperties();
- Object oObject = xPSet.getPropertyValue(PropertyName);
- return oObject;
+ return xPSet.getPropertyValue(PropertyName);
}
}
catch (Exception exception)
@@ -221,7 +219,7 @@ public class Helper
{
if (oUnoObject != null)
{
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
Object oObject = xPSet.getPropertyValue(PropertyName);
if (AnyConverter.isArray(oObject))
{
@@ -242,11 +240,10 @@ public class Helper
{
if (oUnoObject != null)
{
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
- if (xPSet.getPropertySetInfo().hasPropertyByName(PropertyName) == true)
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oUnoObject);
+ if (xPSet.getPropertySetInfo().hasPropertyByName(PropertyName))
{
- Object oObject = xPSet.getPropertyValue(PropertyName);
- return oObject;
+ return xPSet.getPropertyValue(PropertyName);
}
}
return null;
@@ -262,7 +259,7 @@ public class Helper
{
try
{
- com.sun.star.beans.XMultiPropertySet xMultiPSetLst = (com.sun.star.beans.XMultiPropertySet) UnoRuntime.queryInterface(com.sun.star.beans.XMultiPropertySet.class, oUnoObject);
+ com.sun.star.beans.XMultiPropertySet xMultiPSetLst = UnoRuntime.queryInterface(com.sun.star.beans.XMultiPropertySet.class, oUnoObject);
if (xMultiPSetLst != null)
{
xMultiPSetLst.setPropertyValues(PropertyNames, PropertyValues);
@@ -322,7 +319,7 @@ public class Helper
public DateUtils(XMultiServiceFactory xmsf, Object document) throws Exception
{
- XMultiServiceFactory docMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
+ XMultiServiceFactory docMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, document);
Object defaults = docMSF.createInstance("com.sun.star.text.Defaults");
Locale l = (Locale) Helper.getUnoStructValue(defaults, "CharLocale");
@@ -332,7 +329,7 @@ public class Helper
calendar = Calendar.getInstance(jl);
- formatSupplier = (XNumberFormatsSupplier) UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document);
+ formatSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, document);
Object formatSettings = formatSupplier.getNumberFormatSettings();
com.sun.star.util.Date date = (com.sun.star.util.Date) Helper.getUnoPropertyValue(formatSettings, "NullDate");
@@ -379,9 +376,7 @@ public class Helper
* docNullTime and date1 are in millis, but
* I need a day...
*/
- double daysDiff = (date1 - docNullTime) / DAY_IN_MILLIS + 1;
-
- return daysDiff;
+ return (date1 - docNullTime) / DAY_IN_MILLIS + 1;
}
public double getDocumentDateAsDouble(DateTime date)
@@ -400,9 +395,7 @@ public class Helper
* docNullTime and date1 are in millis, but
* I need a day...
*/
- double daysDiff = (date1 - docNullTime) / DAY_IN_MILLIS + 1;
-
- return daysDiff;
+ return (date1 - docNullTime) / DAY_IN_MILLIS + 1;
}
@@ -425,20 +418,16 @@ public class Helper
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 XPropertySet xProps = 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;
+ return UnoRuntime.queryInterface(XComponentContext.class, aDefaultContext);
}
public static XMacroExpander getMacroExpander(XMultiServiceFactory _xMSF)
{
final XComponentContext xComponentContext = getComponentContext(_xMSF);
final Object aSingleton = xComponentContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander");
- XMacroExpander xExpander = (XMacroExpander) UnoRuntime.queryInterface(XMacroExpander.class, aSingleton);
- // String[][] aStrListList = xProvider.getExtensionList();
-// final String sLocation = xProvider.getPackageLocation("com.sun.reportdesigner");
- return xExpander;
+ return UnoRuntime.queryInterface(XMacroExpander.class, aSingleton);
}
}
diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java
index 836b2a7ea242..43a66301ba27 100644
--- a/wizards/com/sun/star/wizards/common/JavaTools.java
+++ b/wizards/com/sun/star/wizards/common/JavaTools.java
@@ -52,7 +52,7 @@ public class JavaTools
/*
public static void main(String args[])
{
- String sPath = "";
+ String sPath = PropertyNames.EMPTY_STRING;
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
@@ -79,10 +79,7 @@ public class JavaTools
if (FirstArray != null)
{
String[] SecondArray = new String[FirstArray.length];
- for (int i = 0; i < FirstArray.length; i++)
- {
- SecondArray[i] = FirstArray[i];
- }
+ System.arraycopy(FirstArray, 0, SecondArray, 0, FirstArray.length);
return SecondArray;
}
else
@@ -200,7 +197,7 @@ public class JavaTools
public static String getlongestArrayItem(String[] StringArray)
{
- String sLongestItem = "";
+ String sLongestItem = PropertyNames.EMPTY_STRING;
int FieldCount = StringArray.length;
int iOldLength = 0;
int iCurLength = 0;
@@ -218,17 +215,17 @@ public class JavaTools
public static String ArraytoString(String[] LocArray)
{
- String ResultString = "";
+ StringBuilder ResultString = new StringBuilder(PropertyNames.EMPTY_STRING);
int iLen = LocArray.length;
for (int i = 0; i < iLen; i++)
{
- ResultString += LocArray[i];
+ ResultString.append(LocArray[i]);
if (i < iLen - 1)
{
- ResultString += ";";
+ ResultString.append(PropertyNames.SEMI_COLON);
}
}
- return ResultString;
+ return ResultString.toString();
}
/**
@@ -377,7 +374,7 @@ public class JavaTools
public static String[] ArrayoutofString(String MainString, String Token)
{
String[] StringArray;
- if (MainString.equals("") == false)
+ if (!MainString.equals(PropertyNames.EMPTY_STRING))
{
Vector StringVector = new Vector();
String LocString = null;
@@ -443,17 +440,17 @@ public class JavaTools
{
String sFilename = getFilenameOutOfPath(sPath);
String[] FilenameList = ArrayoutofString(sFilename, ".");
- String FileDescription = "";
+ StringBuilder FileDescription = new StringBuilder(PropertyNames.EMPTY_STRING);
for (int i = 0; i < FilenameList.length - 1; i++)
{
- FileDescription += FilenameList[i];
+ FileDescription.append(FilenameList[i]);
}
- return FileDescription;
+ return FileDescription.toString();
}
public static String convertfromURLNotation(String _sURLPath)
{
- String sPath = "";
+ String sPath = PropertyNames.EMPTY_STRING;
try
{
URL oJavaURL = new URL(_sURLPath);
@@ -565,38 +562,32 @@ public class JavaTools
public static PropertyValue[][] removeOutdatedFields(PropertyValue[][] baselist, String[] _complist)
{
- PropertyValue[][] retarray = new PropertyValue[][]
- {
- };
if ((baselist != null) && (_complist != null))
{
- Vector firstdimvector = new Vector();
- int b = 0;
+ ArrayList<PropertyValue[]> firstdimvector = new ArrayList<PropertyValue[]>();
for (int n = 0; n < baselist.length; n++)
{
- Vector secdimvector = new Vector();
- PropertyValue[] internalArray;
- int a = 0;
+ ArrayList<PropertyValue> secdimvector = new ArrayList<PropertyValue>();
for (int m = 0; m < baselist[n].length; m++)
{
if (FieldInList(_complist, baselist[n][m].Name) > -1)
{
secdimvector.add(baselist[n][m]);
- a++;
}
}
- if (a > 0)
+ if (!secdimvector.isEmpty())
{
- internalArray = new PropertyValue[a];
+ PropertyValue[] internalArray = new PropertyValue[secdimvector.size()];
secdimvector.toArray(internalArray);
firstdimvector.add(internalArray);
- b++;
}
}
- retarray = new PropertyValue[b][];
- firstdimvector.toArray(retarray);
+ PropertyValue[][] retarray = new PropertyValue[firstdimvector.size()][];
+ return firstdimvector.toArray(retarray);
}
- return (retarray);
+ return new PropertyValue[][]
+ {
+ };
}
/**
@@ -621,7 +612,7 @@ public class JavaTools
{
if (n == 0)
{
- sDescList[m] = new String();
+ sDescList[m] = "";
}
sDescList[m] += _scomplist[n][m];
}
@@ -762,16 +753,16 @@ public class JavaTools
{
if (sSecondString != null)
{
- bissame = sSecondString.equals("");
+ bissame = sSecondString.equals(PropertyNames.EMPTY_STRING);
}
else
{
- bissame = (sSecondString == null);
+ bissame = true;
}
}
else
{
- if (sFirstString.equals(""))
+ if (sFirstString.equals(PropertyNames.EMPTY_STRING))
{
bissame = (sSecondString == null);
}
diff --git a/wizards/com/sun/star/wizards/common/NamedValueCollection.java b/wizards/com/sun/star/wizards/common/NamedValueCollection.java
index f8f2cd05224a..ebafcbd31e41 100644
--- a/wizards/com/sun/star/wizards/common/NamedValueCollection.java
+++ b/wizards/com/sun/star/wizards/common/NamedValueCollection.java
@@ -38,7 +38,7 @@ public class NamedValueCollection
}
@SuppressWarnings("unchecked")
- public final < T extends Object > T getOrDefault( final String i_key, final T i_default )
+ public final < T > T getOrDefault( final String i_key, final T i_default )
{
if ( m_values.containsKey( i_key ) )
{
diff --git a/wizards/com/sun/star/wizards/common/NumberFormatter.java b/wizards/com/sun/star/wizards/common/NumberFormatter.java
index ccfbee303f98..f4398088ff30 100644
--- a/wizards/com/sun/star/wizards/common/NumberFormatter.java
+++ b/wizards/com/sun/star/wizards/common/NumberFormatter.java
@@ -66,9 +66,9 @@ public class NumberFormatter
Object oNumberFormatter = _xMSF.createInstance("com.sun.star.util.NumberFormatter");
xNumberFormats = _xNumberFormatsSupplier.getNumberFormats();
xNumberFormatSettings = _xNumberFormatsSupplier.getNumberFormatSettings();
- xNumberFormatter = (XNumberFormatter) UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter);
+ xNumberFormatter = UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter);
xNumberFormatter.attachNumberFormatsSupplier(_xNumberFormatsSupplier);
- xNumberFormatTypes = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats);
+ xNumberFormatTypes = UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats);
}
@@ -77,7 +77,7 @@ public class NumberFormatter
aLocale = _aLocale;
xNumberFormats = _xNumberFormatsSupplier.getNumberFormats();
xNumberFormatSettings = _xNumberFormatsSupplier.getNumberFormatSettings();
- xNumberFormatTypes = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats);
+ xNumberFormatTypes = UnoRuntime.queryInterface(XNumberFormatTypes.class, xNumberFormats);
}
@@ -92,7 +92,7 @@ public class NumberFormatter
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 xNumberFormatter = UnoRuntime.queryInterface(XNumberFormatter.class, oNumberFormatter);
xNumberFormatter.attachNumberFormatsSupplier(_xNumberFormatsSupplier);
return xNumberFormatter;
}
@@ -114,9 +114,9 @@ public class NumberFormatter
*/
public static int getNumberFormatterKey( Object numberFormatsSupplier, short type)
{
- Object numberFormatTypes = ((XNumberFormatsSupplier)UnoRuntime.queryInterface(XNumberFormatsSupplier.class,numberFormatsSupplier)).getNumberFormats();
+ Object numberFormatTypes = UnoRuntime.queryInterface(XNumberFormatsSupplier.class,numberFormatsSupplier).getNumberFormats();
Locale l = new Locale();
- return ((XNumberFormatTypes)UnoRuntime.queryInterface(XNumberFormatTypes.class,numberFormatTypes)).getFormatIndex(type, l);
+ return UnoRuntime.queryInterface(XNumberFormatTypes.class,numberFormatTypes).getFormatIndex(type, l);
}
@@ -200,7 +200,7 @@ public class NumberFormatter
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);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, _xFormatObject);
xPSet.setPropertyValue("FormatsSupplier", _oNumberFormatter.xNumberFormatter.getNumberFormatsSupplier());
if (xPSet.getPropertySetInfo().hasPropertyByName("NumberFormat"))
{
diff --git a/wizards/com/sun/star/wizards/common/NumericalHelper.java b/wizards/com/sun/star/wizards/common/NumericalHelper.java
index 109affffd5ef..3a1c3b4ecf0f 100644
--- a/wizards/com/sun/star/wizards/common/NumericalHelper.java
+++ b/wizards/com/sun/star/wizards/common/NumericalHelper.java
@@ -411,7 +411,7 @@ public class NumericalHelper
// return toInt(_aValue);
// }
// catch(com.sun.star.lang.IllegalArgumentException e) {
-// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, "");
+// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, PropertyNames.EMPTY_STRING);
// return 0;
// }}
//
@@ -421,8 +421,8 @@ public class NumericalHelper
// return toString(_aValue);
// }
// catch(com.sun.star.lang.IllegalArgumentException e) {
-// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, "");
-// return "";
+// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, PropertyNames.EMPTY_STRING);
+// return PropertyNames.EMPTY_STRING;
// }}
//
//
@@ -431,7 +431,7 @@ public class NumericalHelper
// return toInt(_aValue, _ndefaultValue);
// }
// catch(com.sun.star.uno.Exception e) {
-// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, "");
+// DebugHelper.exception(BasicErrorCode.SbERR_CONVERSION, PropertyNames.EMPTY_STRING);
// return 0;
// }}
//
@@ -445,7 +445,7 @@ public class NumericalHelper
// return toBoolean(_oObject);
// }
// catch (java.lang.Exception e){
-// DebugHelper.exception(BasicErrorCode.SbERR_BAD_ARGUMENT, "");
+// DebugHelper.exception(BasicErrorCode.SbERR_BAD_ARGUMENT, PropertyNames.EMPTY_STRING);
// return false;
// }
// }
@@ -461,11 +461,11 @@ public class NumericalHelper
// return false;
// }
// else{
-// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, "");
+// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, PropertyNames.EMPTY_STRING);
// return false;
// }
// }catch (java.lang.Exception e){
-// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, "");
+// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, PropertyNames.EMPTY_STRING);
// return false;
// }}
//
@@ -489,12 +489,12 @@ public class NumericalHelper
// return false;
// }
// else{
-// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, "");
+// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, PropertyNames.EMPTY_STRING);
// return false;
// }
// }
// }catch (java.lang.Exception e){
-// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, "");
+// DebugHelper.exception(BasicErrorCode.SbERR_OUT_OF_RANGE, PropertyNames.EMPTY_STRING);
// return false;
// }}
/**
@@ -735,31 +735,31 @@ public class NumericalHelper
switch (aTypeObject.iType)
{
case BYTE_TYPE:
- retValue = ((Byte) aTypeObject.aValue).toString();
+ retValue = aTypeObject.aValue.toString();
break;
case CHAR_TYPE:
- retValue = ((Character) aTypeObject.aValue).toString();
+ retValue = aTypeObject.aValue.toString();
break;
case SHORT_TYPE:
- retValue = ((Short) aTypeObject.aValue).toString();
+ retValue = aTypeObject.aValue.toString();
break;
case INT_TYPE:
- retValue = ((Integer) aTypeObject.aValue).toString();
+ retValue = aTypeObject.aValue.toString();
break;
case LONG_TYPE:
- retValue = ((Long) aTypeObject.aValue).toString();
+ retValue = aTypeObject.aValue.toString();
break;
case FLOAT_TYPE:
- retValue = ((Float) aTypeObject.aValue).toString();
+ retValue = aTypeObject.aValue.toString();
break;
case DOUBLE_TYPE:
- retValue = ((Double) aTypeObject.aValue).toString();
+ retValue = aTypeObject.aValue.toString();
break;
case STRING_TYPE:
retValue = (String) aTypeObject.aValue;
break;
case BOOLEAN_TYPE:
- retValue = ((Boolean) aTypeObject.aValue).toString();
+ retValue = aTypeObject.aValue.toString();
break;
case ARRAY_TYPE:
retValue = new String(toByteArray((aValue)));
@@ -983,13 +983,13 @@ public class NumericalHelper
}
else
{
- DebugHelper.exception(1/* BasicErrorCode.SbERR_CONVERSION*/, "");
+ DebugHelper.exception(1/* BasicErrorCode.SbERR_CONVERSION*/, PropertyNames.EMPTY_STRING);
}
}
}
catch (com.sun.star.uno.Exception e)
{
- DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, "");
+ DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, PropertyNames.EMPTY_STRING);
}
return nreturn;
}
@@ -1511,7 +1511,7 @@ public class NumericalHelper
// }
// }
// catch (com.sun.star.uno.Exception e){
-// DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, "");
+// DebugHelper.exception(1 /*BasicErrorCode.SbERR_METHOD_FAILED*/, PropertyNames.EMPTY_STRING);
// return false;
// }}
/**
@@ -1554,7 +1554,7 @@ public class NumericalHelper
{
if (n > MAX_NUMBER || n < MIN_NUMBER)
{
- DebugHelper.exception(1 /*BasicErrorCode.SbERR_OUT_OF_RANGE*/, "");
+ DebugHelper.exception(1 /*BasicErrorCode.SbERR_OUT_OF_RANGE*/, PropertyNames.EMPTY_STRING);
}
String number = NumericalHelper.toString(new Integer(n));
/* converison idea: every digit is written with a maximum of two
@@ -1619,7 +1619,6 @@ public class NumericalHelper
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;
+ return ((double) ((int) (_dblvalue * dblfactor))) / dblfactor;
}
}
diff --git a/wizards/com/sun/star/wizards/common/PropertyNames.java b/wizards/com/sun/star/wizards/common/PropertyNames.java
index 791f1da3a2fe..bef4d4700864 100644
--- a/wizards/com/sun/star/wizards/common/PropertyNames.java
+++ b/wizards/com/sun/star/wizards/common/PropertyNames.java
@@ -46,4 +46,23 @@ public class PropertyNames
public static String PROPERTY_TABINDEX = "TabIndex";
public static String PROPERTY_STATE = "State";
public static String PROPERTY_IMAGEURL = "ImageURL";
+ public static String PROPERTY_TITLE = "Title";
+ public static String PROPERTY_BORDER = "Border";
+ public static String PROPERTY_MOVEABLE = "Moveable";
+ public static String PROPERTY_CLOSEABLE = "Closeable";
+ public static String PROPERTY_ALIGN = "Align";
+ public static String COMMAND = "Command";
+ public static String COMMAND_TYPE = "CommandType";
+ public static String SELECTED_ITEMS = "SelectedItems";
+ public static String URL = "URL";
+ public static String ACTIVE_CONNECTION = "ActiveConnection";
+ public static String ASC = "ASC";
+ public static String SEMI_COLON = ";";
+ public static String EMPTY_STRING = "";
+ public static String START = "start";
+ public static String ORIENTATION = "Orientation";
+ public static String READ_ONLY = "ReadOnly";
+ public static String SPACE = " ";
+ public static String STRING_ITEM_LIST = "StringItemList";
+ public static String FONT_DESCRIPTOR = "FontDescriptor";
}
diff --git a/wizards/com/sun/star/wizards/common/PropertySetHelper.java b/wizards/com/sun/star/wizards/common/PropertySetHelper.java
index aec166a5c1c5..bde98249f43d 100644
--- a/wizards/com/sun/star/wizards/common/PropertySetHelper.java
+++ b/wizards/com/sun/star/wizards/common/PropertySetHelper.java
@@ -49,7 +49,7 @@ public class PropertySetHelper
{
return;
}
- m_xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aObj);
+ m_xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _aObj);
}
private HashMap<String, Object> getHashMap()
@@ -371,11 +371,11 @@ public class PropertySetHelper
*/
public void showProperties()
{
- String sName = "";
+ String sName = PropertyNames.EMPTY_STRING;
if (m_xPropertySet != null)
{
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, m_xPropertySet);
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, m_xPropertySet);
if (xServiceInfo != null)
{
sName = xServiceInfo.getImplementationName();
diff --git a/wizards/com/sun/star/wizards/common/Resource.java b/wizards/com/sun/star/wizards/common/Resource.java
index 8dc660b21d07..8e93e68e6b54 100644
--- a/wizards/com/sun/star/wizards/common/Resource.java
+++ b/wizards/com/sun/star/wizards/common/Resource.java
@@ -61,8 +61,7 @@ public class Resource
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;
+ return (String) xInvocation.invoke("getString", nIDArray, PointerArray, DummyArray);
}
catch (Exception exception)
{
@@ -80,8 +79,7 @@ public class Resource
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;
+ return (PropertyValue[]) xInvocation.invoke("getStringList", nIDArray, PointerArray, DummyArray);
}
catch (Exception exception)
{
@@ -120,7 +118,7 @@ public class Resource
}
else
{
- XInvocation xResInvoke = (XInvocation) com.sun.star.uno.UnoRuntime.queryInterface(XInvocation.class, xResource);
+ XInvocation xResInvoke = com.sun.star.uno.UnoRuntime.queryInterface(XInvocation.class, xResource);
xResInvoke.setValue("FileName", Module);
return xResInvoke;
}
diff --git a/wizards/com/sun/star/wizards/common/SystemDialog.java b/wizards/com/sun/star/wizards/common/SystemDialog.java
index ac3a38c9cf7d..012b33770f5c 100644
--- a/wizards/com/sun/star/wizards/common/SystemDialog.java
+++ b/wizards/com/sun/star/wizards/common/SystemDialog.java
@@ -66,14 +66,14 @@ public class SystemDialog
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);
+ systemDialog = xMSF.createInstance(ServiceName);
+ xFilePicker = UnoRuntime.queryInterface(XFilePicker.class, systemDialog);
+ xFolderPicker = UnoRuntime.queryInterface(XFolderPicker.class, systemDialog);
+ xFilterManager = UnoRuntime.queryInterface(XFilterManager.class, systemDialog);
+ xInitialize = UnoRuntime.queryInterface(XInitialization.class, systemDialog);
+ xExecutable = UnoRuntime.queryInterface(XExecutableDialog.class, systemDialog);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, systemDialog);
+ xFilePickerControlAccess = UnoRuntime.queryInterface(XFilePickerControlAccess.class, systemDialog);
xStringSubstitution = createStringSubstitution(xMSF);
Short[] listAny = new Short[]
{
@@ -114,12 +114,7 @@ public class SystemDialog
{
try
{
- //System.out.println("SystemDialog.subst:");
- //System.out.println(path);
- String s = xStringSubstitution.substituteVariables(path, false);
- //System.out.println(s);
- return s;
-
+ return xStringSubstitution.substituteVariables(path, false);
}
catch (Exception ex)
{
@@ -157,7 +152,7 @@ public class SystemDialog
sStorePath = null;
try
{
- xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, new Boolean(true));
+ xFilePickerControlAccess.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, (short) 0, Boolean.TRUE);
xFilePicker.setDefaultName(defaultName);
xFilePicker.setDisplayDirectory(subst(displayDir));
if (execute(xExecutable))
@@ -351,7 +346,7 @@ public class SystemDialog
return 0;
}
XFrame xFrame = Desktop.getActiveFrame(xMSF);
- XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
+ XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
return showMessageBox(xMSF, xWindowPeer, windowServiceName, windowAttribute, MessageText);
}
catch (Exception exception)
@@ -382,15 +377,15 @@ public class SystemDialog
try
{
XInterface xAWTToolkit = (XInterface) xMSF.createInstance("com.sun.star.awt.Toolkit");
- XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, xAWTToolkit);
+ 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);
+ XMessageBox xMsgbox = UnoRuntime.queryInterface(XMessageBox.class, xMsgPeer);
+ XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, xMsgbox);
xMsgbox.setMessageText(MessageText);
iMessage = xMsgbox.execute();
xComponent.dispose();
@@ -417,7 +412,7 @@ public class SystemDialog
}
if (xPathSubst != null)
{
- return (XStringSubstitution) UnoRuntime.queryInterface(
+ return UnoRuntime.queryInterface(
XStringSubstitution.class, xPathSubst);
}
else
diff --git a/wizards/com/sun/star/wizards/common/UCB.java b/wizards/com/sun/star/wizards/common/UCB.java
index cb7ff9e815d7..5d8ddb4385e3 100644
--- a/wizards/com/sun/star/wizards/common/UCB.java
+++ b/wizards/com/sun/star/wizards/common/UCB.java
@@ -115,11 +115,11 @@ public class UCB
*/
public void copy(String sourceDir, String filename, String targetDir) throws Exception
{
- copy(sourceDir,filename, targetDir, "");
+ copy(sourceDir,filename, targetDir, PropertyNames.EMPTY_STRING);
}
/**
- * target name can be "", in which case the name stays lige the source name
+ * target name can be PropertyNames.EMPTY_STRING, in which case the name stays lige the source name
* @param sourceDir
* @param sourceFilename
* @param targetDir
@@ -143,7 +143,7 @@ public class UCB
throws com.sun.star.ucb.CommandAbortedException,
com.sun.star.uno.Exception
{
- XCommandProcessor xCmdProcessor = (XCommandProcessor)UnoRuntime.queryInterface(
+ XCommandProcessor xCmdProcessor = UnoRuntime.queryInterface(
XCommandProcessor.class, xContent);
Command aCommand = new Command();
aCommand.Name = aCommandName;
@@ -163,12 +163,12 @@ public class UCB
// Fill info for the properties wanted.
aArg.Properties = new Property[] {new Property()};
- aArg.Properties[0].Name = "Title";
+ aArg.Properties[0].Name = PropertyNames.PROPERTY_TITLE;
aArg.Properties[0].Handle = -1;
XDynamicResultSet xSet;
- xSet = (XDynamicResultSet)UnoRuntime.queryInterface(
+ xSet = UnoRuntime.queryInterface(
XDynamicResultSet.class,executeCommand(xContent, "open", aArg));
XResultSet xResultSet = xSet.getStaticResultSet();
@@ -178,9 +178,9 @@ public class UCB
if (xResultSet.first())
{
// obtain XContentAccess interface for child content access and XRow for properties
- XContentAccess xContentAccess = (XContentAccess)UnoRuntime.queryInterface(
+ XContentAccess xContentAccess = UnoRuntime.queryInterface(
XContentAccess.class, xResultSet);
- XRow xRow = (XRow)UnoRuntime.queryInterface(XRow.class, xResultSet);
+ XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet);
do
{
// Obtain URL of child.
@@ -189,7 +189,7 @@ public class UCB
String aTitle = xRow.getString(1);
if (aTitle.length() == 0 && xRow.wasNull())
{
- ; //ignore
+ //ignore
}
else
{
@@ -222,7 +222,7 @@ public class UCB
pv[0].Handle = -1;
Object row = executeCommand(content,"getPropertyValues",pv);
- XRow xrow = (XRow)UnoRuntime.queryInterface(XRow.class,row);
+ XRow xrow = UnoRuntime.queryInterface(XRow.class,row);
if (type.equals(String.class))
{
return xrow.getString(1);
@@ -249,10 +249,10 @@ public class UCB
public Object getContent(String path) throws Exception
{
//System.out.println("Getting Content for : " + path);
- XContentIdentifier id = ((XContentIdentifierFactory) UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb)).createContentIdentifier(path);
+ XContentIdentifier id = UnoRuntime.queryInterface(XContentIdentifierFactory.class, ucb).createContentIdentifier(path);
- return ((XContentProvider)UnoRuntime.queryInterface(
- XContentProvider.class,ucb)).queryContent(id);
+ return UnoRuntime.queryInterface(
+ XContentProvider.class,ucb).queryContent(id);
}
public static interface Verifier
diff --git a/wizards/com/sun/star/wizards/common/XMLHelper.java b/wizards/com/sun/star/wizards/common/XMLHelper.java
index 326ba03fbeea..03af04a959f7 100644
--- a/wizards/com/sun/star/wizards/common/XMLHelper.java
+++ b/wizards/com/sun/star/wizards/common/XMLHelper.java
@@ -52,7 +52,7 @@ public class XMLHelper
Element e = doc.createElement(name);
for (int i = 0; i < attNames.length; i++)
{
- if (attValues[i] != null && (!attValues[i].equals("")))
+ if (attValues[i] != null && (!attValues[i].equals(PropertyNames.EMPTY_STRING)))
{
e.setAttribute(attNames[i], attValues[i]);
}
diff --git a/wizards/com/sun/star/wizards/db/BlindtextCreator.java b/wizards/com/sun/star/wizards/db/BlindtextCreator.java
index b52381def054..989fdcc916e9 100644
--- a/wizards/com/sun/star/wizards/db/BlindtextCreator.java
+++ b/wizards/com/sun/star/wizards/db/BlindtextCreator.java
@@ -27,6 +27,7 @@
package com.sun.star.wizards.db;
import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.PropertyNames;
/**
*
@@ -40,7 +41,7 @@ public class BlindtextCreator
public static String adjustBlindTextlength(String FieldTitle, int FieldWidth, boolean bIsCurLandscape, boolean bIsGroupTable, String[] _RecordFieldNames)
{
- String BlindTextString = "";
+ String BlindTextString = PropertyNames.EMPTY_STRING;
if (bIsGroupTable)
{
return getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
@@ -66,11 +67,10 @@ public class BlindtextCreator
public static String getBlindTextString(String FieldTitle, int FieldWidth, int MaxWidth)
{
- String[] BlindTextArray = JavaTools.ArrayoutofString(BlindText, " ");
+ String[] BlindTextArray = JavaTools.ArrayoutofString(BlindText, PropertyNames.SPACE);
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())
@@ -88,7 +88,7 @@ public class BlindtextCreator
int i = 1;
do
{
- NewPartBlindText = PartBlindText + " " + BlindTextArray[i];
+ NewPartBlindText = PartBlindText + PropertyNames.SPACE + BlindTextArray[i];
if (NewPartBlindText.length() < MaxWidth)
{
PartBlindText = NewPartBlindText;
@@ -101,7 +101,7 @@ public class BlindtextCreator
private static int getMaxFieldCount(boolean bIsCurLandscape)
{
- if (bIsCurLandscape == true)
+ if (bIsCurLandscape)
{
return 5;
}
diff --git a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
index a3ff8c12b712..18e85fea868e 100644
--- a/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
+++ b/wizards/com/sun/star/wizards/db/ColumnPropertySet.java
@@ -40,7 +40,7 @@ public class ColumnPropertySet
TypeInspector oTypeInspector;
public XPropertySet xPropertySet;
private int nType;
- private String sTypeName = "";
+ private String sTypeName = PropertyNames.EMPTY_STRING;
public ColumnPropertySet(TypeInspector _oTypeInspector, XPropertySet _xPropertySet)
{
@@ -80,7 +80,7 @@ public class ColumnPropertySet
}
if ((nType == DataType.VARCHAR) && (precision == null || precision.intValue() == 0))
{
- precision = new Integer(50);
+ precision = 50;
}
if (precision != null)
{
@@ -149,7 +149,7 @@ public class ColumnPropertySet
private void setType(int _nType, String _sTypeName, Integer precision)
{
- if (_sTypeName.equals(""))
+ if (_sTypeName.equals(PropertyNames.EMPTY_STRING))
{
sTypeName = oTypeInspector.getDefaultTypeName(nType, precision);
}
@@ -174,7 +174,7 @@ public class ColumnPropertySet
else if (_spropname.equals(PropertyNames.PROPERTY_NAME))
{
String sName = (String) _oValue;
- if (!sName.equals(""))
+ if (!sName.equals(PropertyNames.EMPTY_STRING))
{
xPropertySet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
}
diff --git a/wizards/com/sun/star/wizards/db/CommandMetaData.java b/wizards/com/sun/star/wizards/db/CommandMetaData.java
index ad54020e8645..cb76e3b44a28 100644
--- a/wizards/com/sun/star/wizards/db/CommandMetaData.java
+++ b/wizards/com/sun/star/wizards/db/CommandMetaData.java
@@ -24,7 +24,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package com.sun.star.wizards.db;
import com.sun.star.lang.XMultiServiceFactory;
@@ -39,468 +38,454 @@ 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.PropertyNames;
import com.sun.star.wizards.common.Resource;
+import java.util.ArrayList;
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[] 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 = "";
+ String sCatalogSep = PropertyNames.EMPTY_STRING;
+ String sIdentifierQuote = PropertyNames.EMPTY_STRING;
boolean bCommandComposerAttributesalreadyRetrieved = false;
-
-
private XIndexAccess xIndexKeys;
public CommandMetaData(XMultiServiceFactory xMSF, Locale _aLocale, NumberFormatter oNumberFormatter)
- {
- super(xMSF, _aLocale, oNumberFormatter);
- }
+ {
+ super(xMSF, _aLocale, oNumberFormatter);
+ }
public CommandMetaData(XMultiServiceFactory xMSF)
- {
- super(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++)
{
- 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);
+ 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 = new FieldColumn[_FieldNames.length];
- for (int i = 0; i < _FieldNames.length; i++)
- {
- FieldColumns[i] = new FieldColumn(this,_xColumns, _FieldNames[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++)
{
- 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 && FieldTitleSet.containsKey(_FieldNames[i]))
{
- FieldColumns[i] = new FieldColumn(this, _FieldNames[i], _CommandName, false);
- if (FieldTitleSet != null)
+ FieldColumns[i].setFieldTitle((String) FieldTitleSet.get(_FieldNames[i]));
+ if (FieldColumns[i].getFieldTitle() == 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]);
- }
- }
+ FieldColumns[i].setFieldTitle(_FieldNames[i]);
+ FieldTitleSet.put(_FieldNames[i], _FieldNames[i]);
}
}
}
+ }
public Map getFieldTitleSet()
- {
- return FieldTitleSet;
- }
-
+ {
+ return FieldTitleSet;
+ }
public XPropertySet getColumnObjectByFieldName(String _FieldName, boolean _bgetByDisplayName)
+ {
+ try
{
- try
+ FieldColumn CurFieldColumn = null;
+ if (_bgetByDisplayName)
{
- 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;
+ CurFieldColumn = this.getFieldColumnByDisplayName(_FieldName);
}
- catch (Exception exception)
+ else
{
- exception.printStackTrace(System.out);
- return null;
+ CurFieldColumn = this.getFieldColumnByFieldName(_FieldName);
}
+ String CurCommandName = CurFieldColumn.getCommandName();
+ CommandObject oCommand = getTableByName(CurCommandName);
+ Object oColumn = oCommand.getColumns().getByName(CurFieldColumn.getFieldName());
+ return UnoRuntime.queryInterface(XPropertySet.class, oColumn);
}
-
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return null;
+ }
+ }
// @SuppressWarnings("unchecked")
public void prependSortFieldNames(String[] _fieldnames)
+ {
+ ArrayList aSortFields = new ArrayList();
+ for (int i = 0; i < _fieldnames.length; i++)
{
- 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)
{
- 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);
+ sSortFieldName[1] = SortFieldNames[index][1];
}
- for (int i = 0; i < SortFieldNames.length; i++)
+ else
{
- if (JavaTools.FieldInList(_fieldnames, SortFieldNames[i][0]) == -1)
- {
- aSortFields.add(SortFieldNames[i]);
- }
+ sSortFieldName[1] = PropertyNames.ASC;
}
- SortFieldNames = new String[aSortFields.size()][2];
- aSortFields.toArray(SortFieldNames);
+ aSortFields.add(sSortFieldName);
}
-
- public String[][] getSortFieldNames()
+ for (int i = 0; i < SortFieldNames.length; i++)
{
- return SortFieldNames;
+ 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;
- }
+ {
+ SortFieldNames = aNewListList;
+ }
public FieldColumn getFieldColumn(String _FieldName, String _CommandName)
+ {
+ for (int i = 0; i < FieldColumns.length; i++)
{
- if (FieldColumns.length > 0)
+ if (FieldColumns[i].getFieldName().equals(_FieldName) && FieldColumns[i].getCommandName().equals(_CommandName))
{
- for (int i = 0; i < FieldColumns.length; i++)
- {
- if (FieldColumns[i].getFieldName().equals(_FieldName))
-
- {
- if (FieldColumns[i].getCommandName().equals(_CommandName))
- {
- return FieldColumns[i];
- }
- }
- }
+ return FieldColumns[i];
}
- return null;
}
-
-
+ return null;
+ }
public FieldColumn getFieldColumnByFieldName(String _FieldName)
+ {
+ for (int i = 0; i < FieldColumns.length; i++)
{
- for (int i = 0; i < FieldColumns.length; i++)
+ String sFieldName = FieldColumns[i].getFieldName();
+ if (sFieldName.equals(_FieldName))
{
- 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];
}
- if (_FieldName.indexOf('.') == -1)
- {
- String sCompound = Command + "." + _FieldName;
- if (sFieldName.equals(sCompound))
- {
- return FieldColumns[i];
- }
- }
}
- throw new com.sun.star.uno.RuntimeException();
}
-
+ throw new com.sun.star.uno.RuntimeException();
+ }
public FieldColumn getFieldColumnByDisplayName(String _DisplayName)
+ {
+ String identifierQuote = getIdentifierQuote();
+ for (int i = 0; i < FieldColumns.length; i++)
{
- for (int i = 0; i < FieldColumns.length; i++)
+ String sDisplayName = FieldColumns[i].getDisplayFieldName();
+ if (sDisplayName.equals(_DisplayName))
{
- 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];
}
- if (_DisplayName.indexOf('.') == -1)
- {
- String sCompound = Command + "." + _DisplayName;
- if (sDisplayName.equals(sCompound))
- {
- return FieldColumns[i];
- }
- }
}
- throw new com.sun.star.uno.RuntimeException();
+ String quotedName = new StringBuilder(CommandName.quoteName(FieldColumns[i].getCommandName(), identifierQuote)).append('.').append(CommandName.quoteName(FieldColumns[i].getFieldName(), identifierQuote)).toString();
+ if (quotedName.equals(_DisplayName))
+ {
+ return FieldColumns[i];
+ }
}
-
+ throw new com.sun.star.uno.RuntimeException();
+ }
public FieldColumn getFieldColumnByTitle(String _FieldTitle)
+ {
+ for (int i = 0; i < FieldColumns.length; i++)
{
- for (int i = 0; i < FieldColumns.length; i++)
+ if (FieldColumns[i].getFieldTitle().equals(_FieldTitle))
{
- if (FieldColumns[i].getFieldTitle().equals(_FieldTitle))
- {
- return FieldColumns[i];
- }
+ return FieldColumns[i];
}
- // throw new com.sun.star.uno.RuntimeException();
- // LLA: Group works with fields direct
- for (int i = 0; i < FieldColumns.length; 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))
{
- if (FieldColumns[i].getFieldName().equals(_FieldTitle))
- {
- return FieldColumns[i];
- }
+ return FieldColumns[i];
}
- throw new com.sun.star.uno.RuntimeException();
}
-
+ throw new com.sun.star.uno.RuntimeException();
+ }
public boolean getFieldNamesOfCommand(String _commandname, int _commandtype, boolean _bAppendMode)
+ {
+ try
{
- try
+ // Object oField;
+ java.util.ArrayList<String> ResultFieldNames = new java.util.ArrayList<String>(10);
+ String[] FieldNames;
+ CommandObject oCommand = this.getCommandByName(_commandname, _commandtype);
+ FieldNames = oCommand.getColumns().getElementNames();
+ if (FieldNames.length > 0)
{
- // 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++)
{
- 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)
{
- 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);
- }
+ ResultFieldNames.add(sFieldName);
+ }
+ else if (JavaTools.FieldInIntTable(BinaryTypes, iType) >= 0)
+ {
+ ResultFieldNames.add(sFieldName);
}
- // FieldNames = new String[FieldNames.length];
- // FieldTypes = new int[FieldNames.length];
- m_aAllFieldNames = new String[ResultFieldNames.size()];
- ResultFieldNames.copyInto(m_aAllFieldNames);
- return true;
}
+ // FieldNames = new String[FieldNames.length];
+ // FieldTypes = new int[FieldNames.length];
+ m_aAllFieldNames = new String[ResultFieldNames.size()];
+ m_aAllFieldNames = ResultFieldNames.toArray(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;
}
-
-
-
-
-
+ 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)
+ {
+ ArrayList<String> aOrderableColumns = new ArrayList<String>();
+ for (int i = 0; i < _fieldnames.length; i++)
{
- 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()))
{
- FieldColumn ofieldcolumn = getFieldColumnByFieldName(_fieldnames[i]);
- if (getDBDataTypeInspector().isColumnOrderable(ofieldcolumn.getXColumnPropertySet()))
- {
- aOrderableColumns.addElement(_fieldnames[i]);
- ncount++;
- }
+ aOrderableColumns.add(_fieldnames[i]);
}
- String[] sretfieldnames = new String[ncount];
- aOrderableColumns.toArray(sretfieldnames);
- return sretfieldnames;
}
-
+ String[] sretfieldnames = new String[aOrderableColumns.size()];
+ return aOrderableColumns.toArray(sretfieldnames);
+ }
/**
* @return Returns the command.
*/
public String getCommandName()
- {
- return Command;
- }
+ {
+ return Command;
+ }
+
/**
* @param _command The command to set.
*/
public void setCommandName(String _command)
- {
- Command = _command;
- }
+ {
+ Command = _command;
+ }
/**
* @return Returns the commandType.
*/
public int getCommandType()
- {
- return CommandType;
- }
+ {
+ return CommandType;
+ }
/**
* @param _commandType The commandType to set.
*/
public void setCommandType(int _commandType)
- {
- CommandType = _commandType;
- }
-
+ {
+ CommandType = _commandType;
+ }
public boolean isnumeric(FieldColumn _oFieldColumn)
+ {
+ try
{
- 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))
{
- 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;
- }
+ return (NumericTypes[ifound] == iType);
}
- catch (Exception exception)
+ else
{
- exception.printStackTrace(System.out);
return false;
}
}
+ catch (Exception exception)
+ {
+ exception.printStackTrace(System.out);
+ return false;
+ }
+ }
public String[] setNumericFields()
+ {
+ try
{
- try
+ ArrayList<String> numericfieldsvector = new java.util.ArrayList<String>();
+ for (int i = 0; i < FieldColumns.length; i++)
{
- Vector<String> numericfieldsvector = new java.util.Vector<String>();
- for (int i = 0; i < FieldColumns.length; i++)
+ if (isnumeric(FieldColumns[i]))
{
- if (isnumeric(FieldColumns[i]))
- {
- numericfieldsvector.addElement(FieldColumns[i].getDisplayFieldName());
- }
+ numericfieldsvector.add(FieldColumns[i].getDisplayFieldName());
}
- NumericFieldNames = new String[numericfieldsvector.size()];
- numericfieldsvector.toArray(NumericFieldNames);
- return NumericFieldNames;
- }
- catch (Exception exception)
- {
- exception.printStackTrace(System.out);
- return new String[]{};
}
+ 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)
+ {
+ ArrayList<String> sFieldNamesVector = new java.util.ArrayList<String>();
+ for (int i = 0; i < FieldColumns.length; i++)
{
- Vector<String> sFieldNamesVector = new java.util.Vector<String>();
- for (int i = 0; i < FieldColumns.length; i++)
+ if (_sCommandName.equals(FieldColumns[i].getCommandName()) && JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].getDisplayFieldName()) > -1)
{
- if (_sCommandName.equals(FieldColumns[i].getCommandName()))
- {
- if (JavaTools.FieldInList(_sDisplayFieldNames, FieldColumns[i].getDisplayFieldName()) > -1)
- {
- sFieldNamesVector.addElement(FieldColumns[i].getFieldName());
- }
- }
+ sFieldNamesVector.add(FieldColumns[i].getFieldName());
}
- String[] sFieldNames = new String[sFieldNamesVector.size()];
- sFieldNamesVector.toArray(sFieldNames);
- return sFieldNames;
}
-
-
+ 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++)
{
- String[] sFieldNames = new String[FieldColumns.length];
- for (int i = 0; i < FieldColumns.length; i++)
- {
- sFieldNames[i] = FieldColumns[i].getFieldName();
- }
- return sFieldNames;
+ sFieldNames[i] = FieldColumns[i].getFieldName();
}
+ return sFieldNames;
+ }
public String[] getDisplayFieldNames()
+ {
+ String[] sDisplayFieldNames = new String[FieldColumns.length];
+ for (int i = 0; i < FieldColumns.length; i++)
{
- String[] sDisplayFieldNames = new String[FieldColumns.length];
- for (int i = 0; i < FieldColumns.length; i++)
- {
- sDisplayFieldNames[i] = FieldColumns[i].getDisplayFieldName();
- }
- return sDisplayFieldNames;
+ sDisplayFieldNames[i] = FieldColumns[i].getDisplayFieldName();
}
-
+ return sDisplayFieldNames;
+ }
public String[] setNonAggregateFieldNames()
+ {
+ try
{
- try
+ ArrayList<String> nonaggregatefieldsvector = new java.util.ArrayList<String>();
+ for (int i = 0; i < FieldColumns.length; i++)
{
- Vector<String> nonaggregatefieldsvector = new java.util.Vector<String>();
- for (int i = 0; i < FieldColumns.length; i++)
+ if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].getDisplayFieldName()) == -1)
{
- if (JavaTools.FieldInTable(AggregateFieldNames, FieldColumns[i].getDisplayFieldName()) == -1)
- {
- nonaggregatefieldsvector.addElement(FieldColumns[i].getDisplayFieldName());
- }
+ nonaggregatefieldsvector.add(FieldColumns[i].getDisplayFieldName());
}
- NonAggregateFieldNames = new String[nonaggregatefieldsvector.size()];
- nonaggregatefieldsvector.toArray(NonAggregateFieldNames);
- return NonAggregateFieldNames;
- }
- catch (Exception exception)
- {
- exception.printStackTrace(System.out);
- return new String[]{};
}
+ 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
@@ -508,108 +493,103 @@ public class CommandMetaData extends DBMetaData
* @return
*/
public boolean hasNumericalFields(String[] _DisplayFieldNames)
-
+ {
+ if (_DisplayFieldNames != null && _DisplayFieldNames.length > 0)
{
- if (_DisplayFieldNames != null)
+ for (int i = 0; i < _DisplayFieldNames.length; i++)
{
- if (_DisplayFieldNames.length > 0)
+ if (isnumeric(getFieldColumnByDisplayName(_DisplayFieldNames[i])))
{
- for (int i = 0; i < _DisplayFieldNames.length; i++)
- {
- if (isnumeric(getFieldColumnByDisplayName(_DisplayFieldNames[i])))
- {
- return true;
- }
- }
+ return true;
}
}
- return false;
}
+ return false;
+ }
public String getFieldTitle(String FieldName)
+ {
+ String FieldTitle = FieldName;
+ if (this.FieldTitleSet != null)
{
- String FieldTitle = FieldName;
- if (this.FieldTitleSet != null)
+ FieldTitle = (String) this.FieldTitleSet.get(FieldName); //FieldTitles[TitleIndex];
+ if (FieldTitle == null)
{
- FieldTitle = (String) this.FieldTitleSet.get(FieldName); //FieldTitles[TitleIndex];
- if (FieldTitle == null)
- {
- return FieldName;
- }
+ return FieldName;
}
- return FieldTitle;
}
-
+ return FieldTitle;
+ }
public void setFieldTitles(String[] sFieldTitles)
+ {
+ int nFieldColLength = FieldColumns.length;
+ for (int i = 0; i < sFieldTitles.length; i++)
{
- int nFieldColLength = FieldColumns.length;
- for (int i = 0; i < sFieldTitles.length; i++)
+ if (i < nFieldColLength)
{
- if (i < nFieldColLength)
- {
- FieldColumns[i].setFieldTitle(sFieldTitles[i]);
- }
-
+ FieldColumns[i].setFieldTitle(sFieldTitles[i]);
}
- }
+ }
+ }
public String[] getFieldTitles()
+ {
+ String[] sFieldTitles = new String[FieldColumns.length];
+ for (int i = 0; i < FieldColumns.length; i++)
{
- String[] sFieldTitles = new String[FieldColumns.length];
- for (int i = 0; i < FieldColumns.length; i++)
- {
- sFieldTitles[i] = FieldColumns[i].getFieldTitle();
- }
- return sFieldTitles;
+ sFieldTitles[i] = FieldColumns[i].getFieldTitle();
}
-
+ return sFieldTitles;
+ }
public void setGroupFieldNames(String[] GroupFieldNames)
- {
- this.GroupFieldNames = GroupFieldNames;
- }
-
+ {
+ this.GroupFieldNames = GroupFieldNames;
+ }
public String[] getGroupFieldNames()
- {
- return GroupFieldNames;
- }
+ {
+ 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];
+ {
+ 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++)
+ int a = 0;
+ for (int i = 0; i < TotFieldCount; i++)
+ {
+ CurFieldName = FieldColumns[i].getFieldName();
+ if (JavaTools.FieldInList(GroupFieldNames, CurFieldName) < 0)
{
- CurFieldName = FieldColumns[i].getFieldName();
- if (JavaTools.FieldInList(GroupFieldNames, CurFieldName) < 0)
- {
- RecordFieldNames[a] = CurFieldName;
- // a += 1;
- ++a;
- }
+ 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];
- }
+ }
+
+ 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
*
@@ -618,46 +598,45 @@ public class CommandMetaData extends DBMetaData
* @return
*/
public String[] getReferencedTables(String _stablename, int _ncommandtype)
+ {
+ String[] sTotReferencedTables = new String[]
{
- String[] sTotReferencedTables = new String[]{};
- try
+ };
+ try
+ {
+ if (_ncommandtype == com.sun.star.sdb.CommandType.TABLE && xDBMetaData.supportsIntegrityEnhancementFacility())
{
- if (_ncommandtype == com.sun.star.sdb.CommandType.TABLE)
+ java.util.ArrayList<String> TableVector = new java.util.ArrayList<String>();
+ Object oTable = getTableNamesAsNameAccess().getByName(_stablename);
+ XKeysSupplier xKeysSupplier = UnoRuntime.queryInterface(XKeysSupplier.class, oTable);
+ xIndexKeys = xKeysSupplier.getKeys();
+ for (int i = 0; i < xIndexKeys.getCount(); i++)
{
- if (xDBMetaData.supportsIntegrityEnhancementFacility())
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xIndexKeys.getByIndex(i));
+ int curtype = AnyConverter.toInt(xPropertySet.getPropertyValue("Type"));
+ if (curtype == KeyType.FOREIGN)
{
- 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)
+ // getImportedKeys (RelationController.cxx /source/ui/relationdesign) /Zeile 475
+ String sreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable"));
+ if (getTableNamesAsNameAccess().hasByName(sreftablename))
{
- sTotReferencedTables = new String[TableVector.size()];
- TableVector.copyInto(sTotReferencedTables);
+ TableVector.add(sreftablename);
}
}
}
+ if (TableVector.size() > 0)
+ {
+ sTotReferencedTables = new String[TableVector.size()];
+ TableVector.toArray(sTotReferencedTables);
+ }
}
- catch (Exception e)
- {
- e.printStackTrace(System.out);
- }
- return sTotReferencedTables;
}
+ catch (Exception e)
+ {
+ e.printStackTrace(System.out);
+ }
+ return sTotReferencedTables;
+ }
/**@deprecated use 'RelationController' class instead
*
@@ -665,108 +644,95 @@ public class CommandMetaData extends DBMetaData
* @return
*/
public String[][] getKeyColumns(String _sreferencedtablename)
+ {
+ String[][] skeycolumnnames = null;
+ try
{
- String[][] skeycolumnnames = null;
- try
+ for (int i = 0; i < xIndexKeys.getCount(); i++)
{
- 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)
{
- 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))
{
- String scurreftablename = AnyConverter.toString(xPropertySet.getPropertyValue("ReferencedTable"));
- if (getTableNamesAsNameAccess().hasByName(scurreftablename))
+ if (scurreftablename.equals(_sreferencedtablename))
{
- 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++)
{
- 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;
+ 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)
+ catch (Exception e)
{
- 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);
- }
+ e.printStackTrace();
}
+ return skeycolumnnames;
+ }
+ public void openFormDocument(boolean _bReadOnly)
+ {
+ }
public void setCommandComposingAttributes()
+ {
+ try
{
- try
- {
- boolean bCatalogAtStart2 = xDBMetaData.isCatalogAtStart();
- sCatalogSep = xDBMetaData.getCatalogSeparator();
- sIdentifierQuote = xDBMetaData.getIdentifierQuoteString();
- bCommandComposerAttributesalreadyRetrieved = true;
- }
- catch (SQLException e)
- {
- e.printStackTrace(System.out);
- }
+ sCatalogSep = xDBMetaData.getCatalogSeparator();
+ sIdentifierQuote = xDBMetaData.getIdentifierQuoteString();
+ bCommandComposerAttributesalreadyRetrieved = true;
}
-
+ catch (SQLException e)
+ {
+ e.printStackTrace(System.out);
+ }
+ }
/**
* @return Returns the bCatalogAtStart.
*/
public boolean isCatalogAtStart()
+ {
+ if (!bCommandComposerAttributesalreadyRetrieved)
{
- if (!bCommandComposerAttributesalreadyRetrieved)
- {
- setCommandComposingAttributes();
- }
- return bCatalogAtStart;
+ setCommandComposingAttributes();
}
+ return bCatalogAtStart;
+ }
/**
* @return Returns the sCatalogSep.
*/
public String getCatalogSeparator()
+ {
+ if (!bCommandComposerAttributesalreadyRetrieved)
{
- if (!bCommandComposerAttributesalreadyRetrieved)
- {
- setCommandComposingAttributes();
- }
- return sCatalogSep;
+ setCommandComposingAttributes();
}
+ return sCatalogSep;
+ }
/**
* @return Returns the sIdentifierQuote.
*/
public String getIdentifierQuote()
+ {
+ if (!bCommandComposerAttributesalreadyRetrieved)
{
- if (!bCommandComposerAttributesalreadyRetrieved)
- {
- setCommandComposingAttributes();
- }
- return sIdentifierQuote;
+ setCommandComposingAttributes();
}
+ return sIdentifierQuote;
+ }
}
diff --git a/wizards/com/sun/star/wizards/db/CommandName.java b/wizards/com/sun/star/wizards/db/CommandName.java
index aa8a4f9c7ea9..9d8578f5c8ba 100644
--- a/wizards/com/sun/star/wizards/db/CommandName.java
+++ b/wizards/com/sun/star/wizards/db/CommandName.java
@@ -29,17 +29,18 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
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 String CatalogName = PropertyNames.EMPTY_STRING;
+ protected String SchemaName = PropertyNames.EMPTY_STRING;
+ protected String TableName = PropertyNames.EMPTY_STRING;
+ protected String DisplayName = PropertyNames.EMPTY_STRING;
+ protected String ComposedName = PropertyNames.EMPTY_STRING;
+ protected String AliasName = PropertyNames.EMPTY_STRING;
protected boolean bCatalogAtStart;
protected String sCatalogSep;
protected String sIdentifierQuote;
@@ -59,21 +60,21 @@ public class CommandName
oCommandMetaData = _CommandMetaData;
if ((_CatalogName != null) && (oCommandMetaData.xDBMetaData.supportsCatalogsInTableDefinitions()))
{
- if (!_CatalogName.equals(""))
+ if (!_CatalogName.equals(PropertyNames.EMPTY_STRING))
{
CatalogName = _CatalogName;
}
}
if ((_SchemaName != null) && (oCommandMetaData.xDBMetaData.supportsSchemasInTableDefinitions()))
{
- if (!_SchemaName.equals(""))
+ if (!_SchemaName.equals(PropertyNames.EMPTY_STRING))
{
SchemaName = _SchemaName;
}
}
if (_TableName != null)
{
- if (!_TableName.equals(""))
+ if (!_TableName.equals(PropertyNames.EMPTY_STRING))
{
TableName = _TableName;
}
@@ -94,12 +95,12 @@ public class CommandName
{
this.DisplayName = _DisplayName;
int iIndex;
- if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation() == true)
+ if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation())
{ // ...dann Catalog mit in TableName
iIndex = _DisplayName.indexOf(sCatalogSep);
if (iIndex >= 0)
{
- if (bCatalogAtStart == true)
+ if (bCatalogAtStart)
{
CatalogName = _DisplayName.substring(0, iIndex);
_DisplayName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
@@ -111,13 +112,13 @@ public class CommandName
}
}
}
- if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation() == true)
+ if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation())
{
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 = ""
+ TableName = NameList[1]; // TODO Was ist mit diesem Fall: CatalogSep = "." und CatalogName = PropertyNames.EMPTY_STRING
}
else
{
@@ -138,9 +139,9 @@ public class CommandName
{
if (CatalogName != null)
{
- if (!CatalogName.equals(""))
+ if (!CatalogName.equals(PropertyNames.EMPTY_STRING))
{
- if (bCatalogAtStart == true)
+ if (bCatalogAtStart)
{
ComposedName = quoteName(CatalogName) + sCatalogSep;
}
@@ -148,12 +149,12 @@ public class CommandName
}
if (SchemaName != null)
{
- if (!SchemaName.equals(""))
+ if (!SchemaName.equals(PropertyNames.EMPTY_STRING))
{
ComposedName += quoteName(SchemaName) + ".";
}
}
- if (ComposedName.equals(""))
+ if (ComposedName.equals(PropertyNames.EMPTY_STRING))
{
ComposedName = quoteName(TableName);
}
@@ -161,9 +162,9 @@ public class CommandName
{
ComposedName += quoteName(TableName);
}
- if ((bCatalogAtStart == false) && (CatalogName != null))
+ if ((!bCatalogAtStart) && (CatalogName != null))
{
- if (!CatalogName.equals(""))
+ if (!CatalogName.equals(PropertyNames.EMPTY_STRING))
{
ComposedName += sCatalogSep + quoteName(CatalogName);
}
@@ -203,11 +204,9 @@ public class CommandName
{
if (sName == null)
{
- sName = "";
+ sName = PropertyNames.EMPTY_STRING;
}
- String ReturnQuote = "";
- ReturnQuote = _sIdentifierQuote + sName + _sIdentifierQuote;
- return ReturnQuote;
+ return new StringBuilder(_sIdentifierQuote).append(sName).append(_sIdentifierQuote).toString();
}
public void setAliasName(String _AliasName)
diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java
index 5a151937d73f..afddc49c5895 100644
--- a/wizards/com/sun/star/wizards/db/DBMetaData.java
+++ b/wizards/com/sun/star/wizards/db/DBMetaData.java
@@ -142,7 +142,6 @@ public class DBMetaData
private int iMaxColumnsInSelect;
private int iMaxColumnsInGroupBy;
- private int iMaxColumnsInTable;
private int iMaxColumnNameLength = -1;
private int iMaxTableNameLength = -1;
private boolean bPasswordIsRequired;
@@ -187,7 +186,7 @@ public class DBMetaData
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
}
return oNumberFormatter;
@@ -215,9 +214,9 @@ public class DBMetaData
xNameAccess = UnoRuntime.queryInterface( XNameAccess.class, xDatabaseContext );
DataSourceNames = xNameAccess.getElementNames();
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
}
@@ -326,9 +325,9 @@ public class DBMetaData
// TODO: Performance leak getColumns() take very long.
xColumns = UnoRuntime.queryInterface( XNameAccess.class, xCommandCols.getColumns() );
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
}
public XNameAccess getColumns()
@@ -357,7 +356,7 @@ public class DBMetaData
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
return bHasEscapeProcessing;
}
@@ -372,8 +371,7 @@ public class DBMetaData
public XNameAccess getTableNamesAsNameAccess()
{
XTablesSupplier xDBTables = UnoRuntime.queryInterface( XTablesSupplier.class, DBConnection );
- XNameAccess xTableNames = xDBTables.getTables();
- return xTableNames;
+ return xDBTables.getTables();
}
public String[] getQueryNames()
@@ -453,7 +451,7 @@ public class DBMetaData
}
catch (SQLException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
return - 1;
}
}
@@ -488,7 +486,7 @@ public class DBMetaData
public int getMaxColumnsInTable() throws SQLException
{
- iMaxColumnsInTable = xDBMetaData.getMaxColumnsInTable();
+ int iMaxColumnsInTable = xDBMetaData.getMaxColumnsInTable();
if (iMaxColumnsInTable == 0)
{
iMaxColumnsInTable = DBMetaData.NOLIMIT;
@@ -507,7 +505,7 @@ public class DBMetaData
}
catch (SQLException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
}
@@ -530,7 +528,7 @@ public class DBMetaData
}
catch (Exception e)
{
- e.printStackTrace();
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
return isSQL92CheckEnabled;
}
@@ -579,9 +577,9 @@ public class DBMetaData
xModel = xDocu.getDatabaseDocument();
}
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
}
@@ -596,9 +594,9 @@ public class DBMetaData
try
{
XConnection xConnection = null;
- if (Properties.hasPropertyValue(curproperties, "ActiveConnection"))
+ if (Properties.hasPropertyValue(curproperties, PropertyNames.ACTIVE_CONNECTION))
{
- xConnection = UnoRuntime.queryInterface( XConnection.class, Properties.getPropertyValue( curproperties, "ActiveConnection" ) );
+ xConnection = UnoRuntime.queryInterface( XConnection.class, Properties.getPropertyValue( curproperties, PropertyNames.ACTIVE_CONNECTION ) );
if (xConnection != null)
{
com.sun.star.container.XChild child = UnoRuntime.queryInterface( com.sun.star.container.XChild.class, xConnection );
@@ -645,23 +643,18 @@ public class DBMetaData
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);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
catch (UnknownPropertyException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
catch (WrappedTargetException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
return false;
@@ -684,7 +677,7 @@ public class DBMetaData
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
return false;
}
}
@@ -701,9 +694,9 @@ public class DBMetaData
xConnectionComponent.dispose();
}
getDataSourceInterfaces();
- if (bPasswordIsRequired == false)
+ if (!bPasswordIsRequired)
{
- DBConnection = _dataSource.getConnection("", "");
+ DBConnection = _dataSource.getConnection(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
bgetConnection = true;
}
else
@@ -717,7 +710,7 @@ public class DBMetaData
{
DBConnection = xCompleted2.connectWithCompletion( xInteractionHandler );
bgetConnection = DBConnection != null;
- if (bgetConnection == false)
+ if (!bgetConnection)
{
bExitLoop = true;
}
@@ -731,9 +724,9 @@ public class DBMetaData
bgetConnection = false;
}
}
- while (bExitLoop == false);
+ while (!bExitLoop);
}
- if (bgetConnection == false)
+ if (!bgetConnection)
{
String sMsgConnectionImpossible = oResource.getResText(RID_DB_COMMON + 35);
showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgConnectionImpossible);
@@ -746,11 +739,11 @@ public class DBMetaData
}
return bgetConnection;
}
- catch (Exception exception)
+ catch (Exception e)
{
String sMsgConnectionImpossible = oResource.getResText(RID_DB_COMMON + 35);
showMessageBox("ErrorBox", VclWindowPeerAttribute.OK, sMsgConnectionImpossible);
- exception.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
return false;
}
}
@@ -767,7 +760,7 @@ public class DBMetaData
}
catch (SQLException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
return 0;
}
}
@@ -784,7 +777,7 @@ public class DBMetaData
}
catch (SQLException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
return 0;
}
}
@@ -816,7 +809,7 @@ public class DBMetaData
}
catch (SQLException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
return false;
}
}
@@ -852,7 +845,7 @@ public class DBMetaData
XPropertySet xPSet = UnoRuntime.queryInterface( XPropertySet.class, oQuery );
String s = _oSQLQueryComposer.m_xQueryAnalyzer.getQuery();
- xPSet.setPropertyValue("Command", s);
+ xPSet.setPropertyValue(PropertyNames.COMMAND, s);
XNameContainer xNameCont = UnoRuntime.queryInterface( XNameContainer.class, xQueryDefs );
m_connectionTools.getObjectNames().checkNameForCreate(com.sun.star.sdb.CommandType.QUERY, _QueryName);
@@ -877,13 +870,13 @@ public class DBMetaData
}
exception.printStackTrace(System.out);
}
- catch (SQLException exception)
+ catch (SQLException e)
{
- callSQLErrorMessageDialog(exception, null);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
return false;
}
@@ -900,15 +893,13 @@ public class DBMetaData
{
XReportDocumentsSupplier xReportDocumentSuppl = UnoRuntime.queryInterface( XReportDocumentsSupplier.class, this.xModel );
xReportDocumentSuppl.getReportDocuments();
- XHierarchicalNameAccess xReportHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments() );
- return xReportHier;
+ return UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xReportDocumentSuppl.getReportDocuments() );
}
public XHierarchicalNameAccess getFormDocuments()
{
XFormDocumentsSupplier xFormDocumentSuppl = UnoRuntime.queryInterface( XFormDocumentsSupplier.class, xModel );
- XHierarchicalNameAccess xFormHier = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments() );
- return xFormHier;
+ return UnoRuntime.queryInterface( XHierarchicalNameAccess.class, xFormDocumentSuppl.getFormDocuments() );
}
public boolean hasFormDocumentByName(String _sFormName)
@@ -949,7 +940,7 @@ public class DBMetaData
NamedValueCollection creationArgs = new NamedValueCollection();
creationArgs.put( PropertyNames.PROPERTY_NAME, basename );
- creationArgs.put( "URL", documentURL );
+ creationArgs.put( PropertyNames.URL, documentURL );
creationArgs.put( "AsTemplate", i_createTemplate );
XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, _xDocNameAccess );
Object oDBDocument = xDocMSF.createInstanceWithArguments( "com.sun.star.sdb.DocumentDefinition", creationArgs.getPropertyValues() );
@@ -962,7 +953,7 @@ public class DBMetaData
}
catch (Exception e)
{
- e.printStackTrace();
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
}
@@ -992,7 +983,7 @@ public class DBMetaData
}
catch (SQLException e)
{
- e.printStackTrace();
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
}
return sColValues;
}
@@ -1006,7 +997,7 @@ public class DBMetaData
}
catch (SQLException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
return null;
}
}
@@ -1020,7 +1011,7 @@ public class DBMetaData
}
catch (SQLException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
return null;
}
}
@@ -1041,7 +1032,7 @@ public class DBMetaData
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger( DBMetaData.class.getName() ).log( Level.SEVERE, null, e );
return false;
}
}
diff --git a/wizards/com/sun/star/wizards/db/FieldColumn.java b/wizards/com/sun/star/wizards/db/FieldColumn.java
index 041aab5f5300..47a333e88dd9 100644
--- a/wizards/com/sun/star/wizards/db/FieldColumn.java
+++ b/wizards/com/sun/star/wizards/db/FieldColumn.java
@@ -142,8 +142,7 @@ public class FieldColumn
*/
private String getOnlyFieldName(String _DisplayFieldName, String _CommandName)
{
- final String sName = _DisplayFieldName.substring(_CommandName.length() + 1, _DisplayFieldName.length());
- return sName;
+ return _DisplayFieldName.substring(_CommandName.length() + 1, _DisplayFieldName.length());
}
public static String composeDisplayFieldName(String _sCommandName, String _sFieldName)
@@ -155,12 +154,12 @@ public class FieldColumn
{
try
{
- m_xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xColumns.getByName(m_sFieldName));
+ m_xColPropertySet = 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)
+ if (!bFormatKeysInitialized)
{
final NumberFormatter aNumberFormatter = oCommandMetaData.getNumberFormatter();
@@ -393,67 +392,67 @@ public class FieldColumn
{
case DataType.BIT: // == -7;
case DataType.BOOLEAN:
- DefaultValue = (Object) Integer.valueOf("1");
+ DefaultValue = Integer.valueOf("1");
break;
case DataType.TINYINT: // == -6;
- DefaultValue = (Object) Integer.valueOf("98");
+ DefaultValue = Integer.valueOf("98");
break;
case DataType.SMALLINT: // == 5;
- DefaultValue = (Object) Integer.valueOf("987");
+ DefaultValue = Integer.valueOf("987");
break;
case DataType.INTEGER: // == 4;
- DefaultValue = (Object) Integer.valueOf("9876");
+ DefaultValue = Integer.valueOf("9876");
break;
case DataType.BIGINT: // == -5;
- DefaultValue = (Object) Integer.valueOf("98765");
+ DefaultValue = Integer.valueOf("98765");
break;
case DataType.CHAR: // == 1;
- DefaultValue = (Object) String.valueOf('x');
+ DefaultValue = String.valueOf('x');
break;
case DataType.VARCHAR: // == 12;
- DefaultValue = (Object) BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
+ DefaultValue = BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
break;
case DataType.LONGVARCHAR: // == -1;
- DefaultValue = (Object) BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
+ DefaultValue = BlindtextCreator.getBlindTextString(FieldTitle, FieldWidth, FieldWidth);
break;
case DataType.NUMERIC: // == 2;
- DefaultValue = (Object) Double.valueOf("9876.5");
+ DefaultValue = Double.valueOf("9876.5");
break;
case DataType.DECIMAL: // == 3; [mit Nachkommastellen]
- DefaultValue = (Object) Double.valueOf("9876.5");
+ DefaultValue = Double.valueOf("9876.5");
break;
case DataType.FLOAT: // == 6;
- DefaultValue = (Object) Double.valueOf("9876.5");
+ DefaultValue = Double.valueOf("9876.5");
break;
case DataType.REAL: // == 7;
- DefaultValue = (Object) Double.valueOf("9876.5");
+ DefaultValue = Double.valueOf("9876.5");
break;
case DataType.DOUBLE: // == 8;
- DefaultValue = (Object) Double.valueOf("9876.54");
+ DefaultValue = Double.valueOf("9876.54");
break;
case DataType.DATE: // == 91;
- DefaultValue = (Object) Double.valueOf("42510");
+ DefaultValue = Double.valueOf("42510");
break;
case DataType.TIME: // == 92;
- DefaultValue = (Object) Double.valueOf("10");
+ DefaultValue = Double.valueOf("10");
break;
case DataType.TIMESTAMP: // == 93;
- DefaultValue = (Object) Double.valueOf("5454110");
+ DefaultValue = Double.valueOf("5454110");
break;
default:
diff --git a/wizards/com/sun/star/wizards/db/QueryMetaData.java b/wizards/com/sun/star/wizards/db/QueryMetaData.java
index bad14c2faa20..f6fe9176086c 100644
--- a/wizards/com/sun/star/wizards/db/QueryMetaData.java
+++ b/wizards/com/sun/star/wizards/db/QueryMetaData.java
@@ -101,9 +101,10 @@ public class QueryMetaData extends CommandMetaData
// FieldColumns = LocFieldColumns;
// }
// }
+
public void addSeveralFieldColumns(String[] _FieldNames, String _sCommandName)
{
- Vector oToBeAddedFieldColumns = new Vector();
+ ArrayList<FieldColumn> oToBeAddedFieldColumns = new ArrayList<FieldColumn>();
for (int i = 0; i < _FieldNames.length; i++)
{
FieldColumn oFieldColumn = getFieldColumn(_FieldNames[i], _sCommandName);
@@ -119,7 +120,7 @@ public class QueryMetaData extends CommandMetaData
System.arraycopy(FieldColumns, 0, LocFieldColumns, 0, nOldFieldCount);
for (int i = 0; i < oToBeAddedFieldColumns.size(); i++)
{
- LocFieldColumns[nOldFieldCount + i] = (FieldColumn) oToBeAddedFieldColumns.elementAt(i);
+ LocFieldColumns[nOldFieldCount + i] = oToBeAddedFieldColumns.get(i);
}
FieldColumns = LocFieldColumns;
}
@@ -138,7 +139,7 @@ public class QueryMetaData extends CommandMetaData
public void removeSeveralFieldColumnsByDisplayFieldName(String[] _DisplayFieldNames)
{
- Vector oRemainingFieldColumns = new Vector();
+ ArrayList<FieldColumn> oRemainingFieldColumns = new ArrayList<FieldColumn>();
int a = 0;
for (int n = 0; n < FieldColumns.length; n++)
{
@@ -161,13 +162,10 @@ public class QueryMetaData extends CommandMetaData
FieldColumn[] LocFieldColumns = new FieldColumn[FieldColumns.length - 1];
for (int i = 0; i < FieldColumns.length; i++)
{
- if (!FieldColumns[i].getFieldName().equals(_sFieldName))
+ if (!FieldColumns[i].getFieldName().equals(_sFieldName) && !FieldColumns[i].getCommandName().equals(_sCommandName))
{
- if (!FieldColumns[i].getCommandName().equals(_sCommandName))
- {
- LocFieldColumns[a] = FieldColumns[i];
- a++;
- }
+ LocFieldColumns[a] = FieldColumns[i];
+ a++;
}
}
FieldColumns = LocFieldColumns;
@@ -177,7 +175,7 @@ public class QueryMetaData extends CommandMetaData
public String[] getIncludedCommandNames()
{
// FieldColumn CurQueryField;
- Vector CommandNamesV = new Vector(1);
+ ArrayList<String> CommandNamesV = new ArrayList<String>(1);
// String CurCommandName;
for (int i = 0; i < FieldColumns.length; i++)
{
@@ -185,7 +183,7 @@ public class QueryMetaData extends CommandMetaData
final String CurCommandName = CurQueryField.getCommandName();
if (!CommandNamesV.contains(CurCommandName))
{
- CommandNamesV.addElement(CurCommandName);
+ CommandNamesV.add(CurCommandName);
}
}
String[] sIncludedCommandNames = new String[CommandNamesV.size()];
@@ -195,10 +193,10 @@ public class QueryMetaData extends CommandMetaData
public static String[] getIncludedCommandNames(String[] _FieldNames)
{
- Vector CommandNames = new Vector(1);
+ ArrayList<String> CommandNames = new ArrayList<String>(1);
for (int i = 0; i < _FieldNames.length; i++)
{
- String CurCommandName = "";
+ String CurCommandName = PropertyNames.EMPTY_STRING;
String[] MetaList = JavaTools.ArrayoutofString(_FieldNames[i], ".");
if (MetaList.length > 1)
{
@@ -208,7 +206,7 @@ public class QueryMetaData extends CommandMetaData
}
if (!CommandNames.contains(CurCommandName))
{
- CommandNames.addElement(CurCommandName);
+ CommandNames.add(CurCommandName);
}
}
}
@@ -257,7 +255,7 @@ public class QueryMetaData extends CommandMetaData
public String[] getUniqueAggregateFieldNames()
{
- Vector UniqueAggregateFieldVector = new Vector(0);
+ ArrayList<String> UniqueAggregateFieldVector = new ArrayList<String>();
for (int i = 0; i < AggregateFieldNames.length; i++)
{
if (!UniqueAggregateFieldVector.contains(AggregateFieldNames[i][0]))
@@ -291,10 +289,13 @@ public class QueryMetaData extends CommandMetaData
}
return iAggregate;
}
+
public SQLQueryComposer getSQLQueryComposer()
{
- if ( oSQLQueryComposer == null )
+ 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
index 6c8ddb5b2c36..9f2c6abbc54f 100644
--- a/wizards/com/sun/star/wizards/db/RecordParser.java
+++ b/wizards/com/sun/star/wizards/db/RecordParser.java
@@ -44,6 +44,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
public class RecordParser extends QueryMetaData
{
@@ -78,11 +79,11 @@ public class RecordParser extends QueryMetaData
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);
+ xRowSetColumnsSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xRowSet);
+ xRowSetComponent = UnoRuntime.queryInterface(XComponent.class, xRowSet);
+ xExecute = UnoRuntime.queryInterface(XCompletedExecution.class, xRowSet);
XInterface oInteraction = (XInterface) xMSF.createInstance("com.sun.star.task.InteractionHandler");
- xInteraction = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, oInteraction);
+ xInteraction = UnoRuntime.queryInterface(XInteractionHandler.class, oInteraction);
}
catch (Exception exception)
{
@@ -217,14 +218,14 @@ public class RecordParser extends QueryMetaData
try
{
Helper.setUnoPropertyValue(xRowSet, "DataSourceName", DataSourceName);
- Helper.setUnoPropertyValue(xRowSet, "ActiveConnection", DBConnection);
- Helper.setUnoPropertyValue(xRowSet, "Command", Command);
- Helper.setUnoPropertyValue(xRowSet, "CommandType", new Integer(_nCommandType)); // CommandType
+ Helper.setUnoPropertyValue(xRowSet, PropertyNames.ACTIVE_CONNECTION, DBConnection);
+ Helper.setUnoPropertyValue(xRowSet, PropertyNames.COMMAND, Command);
+ Helper.setUnoPropertyValue(xRowSet, PropertyNames.COMMAND_TYPE, 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);
+ com.sun.star.sdb.XResultSetAccess xResultAccess = 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);
+ xResultSetRow = UnoRuntime.queryInterface(com.sun.star.sdbc.XRow.class, ResultSet);
+ XColumnsSupplier xDBCols = UnoRuntime.queryInterface(XColumnsSupplier.class, ResultSet);
xColumns = xDBCols.getColumns();
setCommandType(_nCommandType);
return true;
@@ -240,7 +241,7 @@ public class RecordParser extends QueryMetaData
{
try
{
- if (binitializeDBColumns == true)
+ if (binitializeDBColumns)
{
initializeFieldColumns(_sFieldNames, xColumns);
}
diff --git a/wizards/com/sun/star/wizards/db/RelationController.java b/wizards/com/sun/star/wizards/db/RelationController.java
index acf47581d3e2..e5b8cb4b3775 100644
--- a/wizards/com/sun/star/wizards/db/RelationController.java
+++ b/wizards/com/sun/star/wizards/db/RelationController.java
@@ -33,6 +33,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
/**
* @author bc93774
@@ -72,7 +73,7 @@ public class RelationController extends CommandName
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);
+ XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet);
while (xResultSet.next())
{
String sForeignCatalog = xRow.getString(FKTABLE_CAT);
@@ -94,7 +95,7 @@ public class RelationController extends CommandName
private Object getCatalogName(CommandName _oCommandName)
{
String sLocCatalog = _oCommandName.getCatalogName();
- if (sLocCatalog.equals(""))
+ if (sLocCatalog.equals(PropertyNames.EMPTY_STRING))
{
return null;
}
@@ -113,7 +114,7 @@ public class RelationController extends CommandName
{
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);
+ XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet);
boolean bleaveLoop = false;
Vector aMasterFieldNamesVector = new Vector();
Vector aSlaveFieldNamesVector = new Vector();
diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
index 461a256ce1c3..a6d2c2b1cb00 100644
--- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
+++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java
@@ -26,7 +26,6 @@
************************************************************************/
package com.sun.star.wizards.db;
-import java.util.Vector;
// import com.sun.star.lang.IllegalArgumentException;
// import com.sun.star.lang.WrappedTargetException;
@@ -34,10 +33,9 @@ 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.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;
@@ -50,6 +48,7 @@ import com.sun.star.awt.XWindow;
import com.sun.star.sdb.SQLFilterOperator;
import com.sun.star.wizards.common.*;
+import java.util.ArrayList;
public class SQLQueryComposer
{
@@ -60,7 +59,7 @@ public class SQLQueryComposer
// String m_sSelectClause;
// String m_sFromClause;
public XSingleSelectQueryAnalyzer m_xQueryAnalyzer;
- Vector composedCommandNames = new Vector(1);
+ ArrayList<CommandName> composedCommandNames = new ArrayList<CommandName>(1);
private XSingleSelectQueryComposer m_queryComposer;
XMultiServiceFactory xMSF;
boolean bincludeGrouping = true;
@@ -70,13 +69,10 @@ public class SQLQueryComposer
try
{
this.CurDBMetaData = _CurDBMetaData;
- xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, CurDBMetaData.DBConnection);
+ xMSF = 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_queryComposer = (XSingleSelectQueryComposer) UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, m_xQueryAnalyzer);
- XSQLQueryComposerFactory xSQLComposerFactory;
- xSQLComposerFactory = (XSQLQueryComposerFactory) UnoRuntime.queryInterface(XSQLQueryComposerFactory.class, CurDBMetaData.DBConnection);
- // /* XSQLQueryComposer */ xSQLQueryComposer = xSQLComposerFactory.createQueryComposer();
+ m_xQueryAnalyzer = UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, oQueryComposer);
+ m_queryComposer = UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, m_xQueryAnalyzer);
}
catch (Exception exception)
{
@@ -86,21 +82,8 @@ public class SQLQueryComposer
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 !(bincludeGrouping && CurDBMetaData.xDBMetaData.supportsGroupByUnrelated() && CurDBMetaData.GroupFieldNames != null && JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, DisplayFieldName) > -1);
}
- return true;
- }
public String getSelectClause(boolean _baddAliasFieldNames) throws SQLException
{
@@ -182,7 +165,7 @@ public class SQLQueryComposer
{
try
{
- XPropertySet xColumnPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xColumnIndexAccess.getByIndex(i));
+ XPropertySet xColumnPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xColumnIndexAccess.getByIndex(i));
String sName = (String) xColumnPropertySet.getPropertyValue(PropertyNames.PROPERTY_NAME);
if (JavaTools.FieldInTable(CurDBMetaData.getSortFieldNames(), sName) == -1)
{
@@ -234,7 +217,6 @@ public class SQLQueryComposer
}
// just for debug!
sOrder = m_queryComposer.getOrder();
- int dummy = 0;
}
public void appendGroupByColumns(boolean _baddAliasFieldNames) throws SQLException
@@ -244,7 +226,6 @@ public class SQLQueryComposer
XPropertySet xColumn = CurDBMetaData.getColumnObjectByFieldName(CurDBMetaData.GroupFieldNames[i], _baddAliasFieldNames);
m_queryComposer.appendGroupByColumn(xColumn);
}
- String s = m_xQueryAnalyzer.getQuery();
}
public void setDBMetaData(QueryMetaData _oDBMetaData)
@@ -254,11 +235,16 @@ public class SQLQueryComposer
private PropertyValue[][] replaceConditionsByAlias(PropertyValue _filterconditions[][])
{
+ XColumnsSupplier columnSup = UnoRuntime.queryInterface(XColumnsSupplier.class, m_xQueryAnalyzer);
+ XNameAccess columns = columnSup.getColumns();
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);
+ // _filterconditions[n][m].Name = getComposedAliasFieldName(_filterconditions[n][m].Name);
+ final String aliasName = getComposedAliasFieldName(_filterconditions[n][m].Name);
+ if ( columns.hasByName(aliasName))
+ _filterconditions[n][m].Name = aliasName;
}
}
return _filterconditions;
@@ -269,19 +255,19 @@ public class SQLQueryComposer
return m_xQueryAnalyzer.getQuery();
}
- public String getFromClause()
+ public StringBuilder getFromClause()
{
- String sFromClause = "FROM";
+ StringBuilder sFromClause = new StringBuilder("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());
+ sFromClause.append(" ").append(curCommandName.getComposedName()).append(" ").append(quoteName(curCommandName.getAliasName()));
if (i < sCommandNames.length - 1)
{
- sFromClause += ", ";
+ sFromClause.append(", ");
}
// fill composedCommandNames
composedCommandNames.add(curCommandName);
@@ -291,30 +277,26 @@ public class SQLQueryComposer
public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames)
{
- return setQueryCommand(_xParentWindow,_bincludeGrouping, _baddAliasFieldNames,true);
+ return setQueryCommand(_xParentWindow, _bincludeGrouping, _baddAliasFieldNames, true);
}
+
public boolean setQueryCommand(XWindow _xParentWindow, boolean _bincludeGrouping, boolean _baddAliasFieldNames, boolean addQuery)
{
try
{
- String s;
bincludeGrouping = _bincludeGrouping;
- if ( addQuery )
+ if (addQuery)
{
- String sFromClause = getFromClause();
+ StringBuilder fromClause = getFromClause();
String sSelectClause = getSelectClause(_baddAliasFieldNames);
- String queryclause = sSelectClause + " " + sFromClause;
- m_xQueryAnalyzer.setQuery(queryclause);
- if (CurDBMetaData.getFilterConditions() != null)
+ StringBuilder queryclause = new StringBuilder(sSelectClause).append(" ").append(fromClause);
+ m_xQueryAnalyzer.setQuery(queryclause.toString());
+ if (CurDBMetaData.getFilterConditions() != null && CurDBMetaData.getFilterConditions().length > 0)
{
- if (CurDBMetaData.getFilterConditions().length > 0)
- {
- CurDBMetaData.setFilterConditions(replaceConditionsByAlias(CurDBMetaData.getFilterConditions()));
- m_queryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions());
- }
+ CurDBMetaData.setFilterConditions(replaceConditionsByAlias(CurDBMetaData.getFilterConditions()));
+ m_queryComposer.setStructuredFilter(CurDBMetaData.getFilterConditions());
}
}
- s = m_xQueryAnalyzer.getQuery();
if (_bincludeGrouping)
{
appendGroupByColumns(_baddAliasFieldNames);
@@ -325,7 +307,6 @@ public class SQLQueryComposer
}
appendSortingcriteria(_baddAliasFieldNames);
- s = m_xQueryAnalyzer.getQuery();
return true;
}
catch (Exception exception)
@@ -340,8 +321,10 @@ public class SQLQueryComposer
{
FieldColumn CurFieldColumn = CurDBMetaData.getFieldColumnByDisplayName(_fieldname);
CommandName curComposedCommandName = getComposedCommandByDisplayName(CurFieldColumn.getCommandName());
- if ( curComposedCommandName == null )
+ if (curComposedCommandName == null)
+ {
return _fieldname;
+ }
String curAliasName = curComposedCommandName.getAliasName();
return quoteName(curAliasName) + "." + quoteName(CurFieldColumn.getFieldName());
}
@@ -350,13 +333,11 @@ public class SQLQueryComposer
{
if (composedCommandNames != null)
{
- CommandName curComposedName;
- for (int i = 0; i < composedCommandNames.size(); i++)
+ for (CommandName commandName : composedCommandNames)
{
- curComposedName = (CommandName) composedCommandNames.elementAt(i);
- if (curComposedName.getAliasName().equals(_AliasName))
+ if (commandName.getAliasName().equals(_AliasName))
{
- return curComposedName;
+ return commandName;
}
}
}
@@ -367,13 +348,11 @@ public class SQLQueryComposer
{
if (composedCommandNames != null)
{
- CommandName curComposedName;
- for (int i = 0; i < composedCommandNames.size(); i++)
+ for (CommandName commandName : composedCommandNames)
{
- curComposedName = (CommandName) composedCommandNames.elementAt(i);
- if (curComposedName.getDisplayName().equals(_DisplayName))
+ if (commandName.getDisplayName().equals(_DisplayName))
{
- return curComposedName;
+ return commandName;
}
}
}
@@ -386,7 +365,7 @@ public class SQLQueryComposer
String AliasName = "";
boolean bAliasNameexists = true;
String locAliasName = _TableName;
- while (bAliasNameexists == true)
+ while (bAliasNameexists)
{
bAliasNameexists = (getComposedCommandByAliasName(locAliasName) != null);
if (bAliasNameexists)
@@ -412,15 +391,15 @@ public class SQLQueryComposer
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);
+ XInitialization xInitialize = UnoRuntime.queryInterface(XInitialization.class, oErrorDialog);
+ XExecutableDialog xExecute = UnoRuntime.queryInterface(XExecutableDialog.class, oErrorDialog);
PropertyValue[] rDispatchArguments = new PropertyValue[3];
- rDispatchArguments[0] = Properties.createProperty("Title", Configuration.getProductName(CurDBMetaData.xMSF) + " Base");
+ rDispatchArguments[0] = Properties.createProperty(PropertyNames.PROPERTY_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???
+ //TODO dispose???
}
catch (Exception typeexception)
{
@@ -443,38 +422,40 @@ public class SQLQueryComposer
public PropertyValue[][] getNormalizedStructuredFilter()
{
final PropertyValue[][] structuredFilter = m_queryComposer.getStructuredFilter();
- for ( int i=0; i<structuredFilter.length; ++i )
+ for (int i = 0; i < structuredFilter.length; ++i)
{
- for ( int j=0; j<structuredFilter[i].length; ++j )
+ for (int j = 0; j < structuredFilter[i].length; ++j)
{
- if ( !( structuredFilter[i][j].Value instanceof String ) )
+ if (!(structuredFilter[i][j].Value instanceof String))
+ {
continue;
- final StringBuffer textualValue = new StringBuffer( (String)structuredFilter[i][j].Value );
- switch ( structuredFilter[i][j].Handle )
+ }
+ final StringBuffer textualValue = new StringBuffer((String) structuredFilter[i][j].Value);
+ switch (structuredFilter[i][j].Handle)
{
- case SQLFilterOperator.EQUAL:
- break;
- case SQLFilterOperator.NOT_EQUAL:
- case SQLFilterOperator.LESS_EQUAL:
- case SQLFilterOperator.GREATER_EQUAL:
- textualValue.delete( 0, 2 );
- break;
- case SQLFilterOperator.LESS:
- case SQLFilterOperator.GREATER:
- textualValue.delete( 0, 1 );
- break;
- case SQLFilterOperator.NOT_LIKE:
- textualValue.delete( 0, 8 );
- break;
- case SQLFilterOperator.LIKE:
- textualValue.delete( 0, 4 );
- break;
- case SQLFilterOperator.SQLNULL:
- textualValue.delete( 0, 7 );
- break;
- case SQLFilterOperator.NOT_SQLNULL:
- textualValue.delete( 0, 11 );
- break;
+ case SQLFilterOperator.EQUAL:
+ break;
+ case SQLFilterOperator.NOT_EQUAL:
+ case SQLFilterOperator.LESS_EQUAL:
+ case SQLFilterOperator.GREATER_EQUAL:
+ textualValue.delete(0, 2);
+ break;
+ case SQLFilterOperator.LESS:
+ case SQLFilterOperator.GREATER:
+ textualValue.delete(0, 1);
+ break;
+ case SQLFilterOperator.NOT_LIKE:
+ textualValue.delete(0, 8);
+ break;
+ case SQLFilterOperator.LIKE:
+ textualValue.delete(0, 4);
+ break;
+ case SQLFilterOperator.SQLNULL:
+ textualValue.delete(0, 7);
+ break;
+ case SQLFilterOperator.NOT_SQLNULL:
+ textualValue.delete(0, 11);
+ break;
}
structuredFilter[i][j].Value = textualValue.toString().trim();
}
diff --git a/wizards/com/sun/star/wizards/db/TableDescriptor.java b/wizards/com/sun/star/wizards/db/TableDescriptor.java
index c7f728648467..491b724e1f09 100644
--- a/wizards/com/sun/star/wizards/db/TableDescriptor.java
+++ b/wizards/com/sun/star/wizards/db/TableDescriptor.java
@@ -81,8 +81,8 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
private XColumnsSupplier xKeyColumnSupplier;
private XPropertySet xKey;
private boolean bIDFieldisInserted = false;
- private String IDFieldName = "";
- private String sColumnAlreadyExistsMessage = "";
+ private String IDFieldName = PropertyNames.EMPTY_STRING;
+ private String sColumnAlreadyExistsMessage = PropertyNames.EMPTY_STRING;
// private WizardDialog oUnoDialog;
private XWindow xWindow;
@@ -156,16 +156,16 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
{
try
{
- XKeysSupplier xKeySupplier = (XKeysSupplier) UnoRuntime.queryInterface(XKeysSupplier.class, xPropTableDataDescriptor);
+ XKeysSupplier xKeySupplier = 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);
+ XDataDescriptorFactory xKeyFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class, xIndexAccessKeys);
+ xKeyDrop = UnoRuntime.queryInterface(XDrop.class, xIndexAccessKeys);
+ xKeyAppend = 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);
+ xKeyColumnSupplier = UnoRuntime.queryInterface(XColumnsSupplier.class, xKey);
+ XDataDescriptorFactory xKeyColFac = UnoRuntime.queryInterface(XDataDescriptorFactory.class, xKeyColumnSupplier.getColumns());
+ xKeyColAppend = UnoRuntime.queryInterface(XAppend.class, xKeyColFac);
removePrimaryKeys();
for (int i = 0; i < _fieldnames.length; i++)
{
@@ -190,7 +190,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
if (xColPropertySet.getPropertySetInfo().hasPropertyByName("IsAutoIncrement"))
{
xColPropertySet.setPropertyValue("Type", new Integer(nDataType));
- xColPropertySet.setPropertyValue("IsAutoIncrement", new Boolean(_bAutoincrementation));
+ xColPropertySet.setPropertyValue("IsAutoIncrement", Boolean.valueOf(_bAutoincrementation));
}
}
}
@@ -222,7 +222,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
{
try
{
- String sColumnName = (String) AnyConverter.toString(_xToBeAppendedPropertySet.getPropertyValue(PropertyNames.PROPERTY_NAME));
+ String sColumnName = AnyConverter.toString(_xToBeAppendedPropertySet.getPropertyValue(PropertyNames.PROPERTY_NAME));
if (_xColumns.hasByName(sColumnName))
{
String sMessage = JavaTools.replaceSubString(sColumnAlreadyExistsMessage, sColumnName, "%FIELDNAME");
@@ -251,13 +251,13 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
boolean breturn = true;
try
{
- XAppend xAppendColumns = (XAppend) UnoRuntime.queryInterface(XAppend.class, xNameAccessColumns);
+ XAppend xAppendColumns = 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))
+ xAppendColumns.appendByDescriptor(xColPropertySet); //xColPropertySet.setPropertyValue("Type", 32423)
}
else
{
@@ -269,7 +269,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
assignTableProperty(PropertyNames.PROPERTY_NAME, _tablename);
assignTableProperty("CatalogName", _catalogname);
assignTableProperty("SchemaName", _schemaname);
- xTableContainer = (XContainer) UnoRuntime.queryInterface(XContainer.class, getTableNamesAsNameAccess());
+ xTableContainer = UnoRuntime.queryInterface(XContainer.class, getTableNamesAsNameAccess());
xTableContainer.addContainerListener(this);
if (keycolumncontainer.size() > 0)
{
@@ -319,7 +319,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
{
try
{
- xPropTableDataDescriptor.setPropertyValue(PropertyNames.PROPERTY_NAME, "");
+ xPropTableDataDescriptor.setPropertyValue(PropertyNames.PROPERTY_NAME, PropertyNames.EMPTY_STRING);
if ((xKeyDrop != null) && (xIndexAccessKeys != null))
{
int icount = xIndexAccessKeys.getCount();
@@ -331,7 +331,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
}
}
}
- XDrop xColumnDrop = (XDrop) UnoRuntime.queryInterface(XDrop.class, xNameAccessColumns);
+ XDrop xColumnDrop = UnoRuntime.queryInterface(XDrop.class, xNameAccessColumns);
for (int i = xNameAccessColumns.getElementNames().length - 1; i >= 0; i--)
{
xColumnDrop.dropByIndex(i);
@@ -374,7 +374,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
{
if (_svalue != null)
{
- if (!_svalue.equals(""))
+ if (!_svalue.equals(PropertyNames.EMPTY_STRING))
{
try
{
@@ -604,7 +604,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
if (hasByName(_snewname))
{
Object oColumn = getByName(_snewname);
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn);
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, oColumn);
Property[] aColProperties = xPropertySet.getPropertySetInfo().getProperties();
for (int i = 0; i < aColProperties.length; i++)
{
@@ -664,7 +664,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
{
if (!hasByName(_columnname))
{
- if (_columnname.equals(""))
+ if (_columnname.equals(PropertyNames.EMPTY_STRING))
{
return false;
}
@@ -694,7 +694,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
try
{
XPropertySet xColPropertySet = xColumnDataDescriptorFactory.createDataDescriptor();
- IDFieldName = Desktop.getUniqueName(getColumnNames(), _columnname, "");
+ IDFieldName = Desktop.getUniqueName(getColumnNames(), _columnname, PropertyNames.EMPTY_STRING);
xColPropertySet.setPropertyValue(PropertyNames.PROPERTY_NAME, IDFieldName);
int nDataType = oTypeInspector.convertDataType(com.sun.star.sdbc.DataType.INTEGER);
@@ -777,7 +777,7 @@ public class TableDescriptor extends CommandMetaData implements XContainerListen
{
try
{
- XPropertySet xTablePropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, arg0.Element);
+ XPropertySet xTablePropertySet = UnoRuntime.queryInterface(XPropertySet.class, arg0.Element);
String stablename = AnyConverter.toString(xTablePropertySet.getPropertyValue(PropertyNames.PROPERTY_NAME));
String sschemaname = AnyConverter.toString(xPropTableDataDescriptor.getPropertyValue("SchemaName"));
String scatalogname = AnyConverter.toString(xPropTableDataDescriptor.getPropertyValue("CatalogName"));
diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java
index 1f22801fd8c5..bf1a8c3a483f 100644
--- a/wizards/com/sun/star/wizards/db/TypeInspector.java
+++ b/wizards/com/sun/star/wizards/db/TypeInspector.java
@@ -38,6 +38,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
public class TypeInspector
{
@@ -87,15 +88,15 @@ public class TypeInspector
Vector<Integer> aSearchableVector = new Vector<Integer>();
// Integer[] aIntegerDataTypes = null;
// XResultSet xResultSet = xDBMetaDagetTypeInfo();
- XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, xResultSet);
+ XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet);
while (xResultSet.next())
{
- aTypeNameVector.addElement(new String(xRow.getString(1)));
+ aTypeNameVector.addElement(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)));
+ aAutoIncrementVector.addElement(Boolean.valueOf(xRow.getBoolean(12)));
aMinScaleVector.addElement(new Integer(xRow.getShort(14)));
aMaxScaleVector.addElement(new Integer(xRow.getShort(15)));
@@ -153,12 +154,11 @@ public class TypeInspector
{
return ColumnValue.NO_NULLS;
}
- int nNullable = _nNullable;
- if (nNullable == ColumnValue.NULLABLE)
+ if (_nNullable == ColumnValue.NULLABLE)
{
return nNullableInfos[i]; //probably nullability is not allowed
}
- return nNullable;
+ return _nNullable;
}
public int getNullability(XPropertySet _xColPropertySet)
@@ -230,25 +230,19 @@ public class TypeInspector
int i = JavaTools.FieldInIntTable(nDataTypeInfos, nDataType, startindex);
startindex = i + 1;
bleaveloop = (i < 0);
- if (!bleaveloop)
+ if (!bleaveloop && sTypeName.equals(sDataTypeNames[i]))
{
- if (sTypeName.equals(sDataTypeNames[i]))
+ if (_bCheckNumericAttributes)
{
- if (_bCheckNumericAttributes)
- {
- if (nPrecision <= nPrecisionInfos[i])
- {
- if ((nScale >= nMinScaleInfos[i]) && (nScale <= nMinScaleInfos[i]))
- {
- return i;
- }
- }
- }
- else
+ if (nPrecision <= nPrecisionInfos[i] && (nScale >= nMinScaleInfos[i]) && (nScale <= nMinScaleInfos[i]) )
{
return i;
}
}
+ else
+ {
+ return i;
+ }
}
}
}
@@ -284,7 +278,7 @@ public class TypeInspector
*/
public String getDefaultTypeName(int _curDataType, Integer precision)
{
- String ret = "";
+ String ret = PropertyNames.EMPTY_STRING;
for (int i = 0; i < nDataTypeInfos.length; i++)
{
if (nDataTypeInfos[i] == _curDataType)
diff --git a/wizards/com/sun/star/wizards/document/Control.java b/wizards/com/sun/star/wizards/document/Control.java
index 96485cdf84ce..ce4afe5a3022 100644
--- a/wizards/com/sun/star/wizards/document/Control.java
+++ b/wizards/com/sun/star/wizards/document/Control.java
@@ -131,7 +131,7 @@ public class Control extends Shape
{
if (xFormName != null)
{
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xFormName);
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xFormName);
String sControlName = Desktop.getUniqueName(xNameAccess, getControlName(_fieldname));
xPropertySet.setPropertyValue(PropertyNames.PROPERTY_NAME, sControlName);
xFormName.insertByName(sControlName, xControlModel);
@@ -145,7 +145,7 @@ public class Control extends Shape
public String getControlName(String _fieldname)
{
- String controlname = "";
+ String controlname = PropertyNames.EMPTY_STRING;
switch (getControlType())
{
case FormHandler.SOLABEL:
@@ -280,7 +280,7 @@ public class Control extends Shape
*/
public XLayoutConstrains getPeer()
{
- return (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, xControl.getPeer());
+ return UnoRuntime.queryInterface(XLayoutConstrains.class, xControl.getPeer());
}
public Size getPeerSize()
@@ -314,13 +314,13 @@ public class Control extends Shape
}
else if (getControlType() == FormHandler.SODATECONTROL)
{
- xPropertySet.setPropertyValue("Date", new Integer(4711)); //TODO find a better date
+ xPropertySet.setPropertyValue("Date", 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
+ xPropertySet.setPropertyValue("Time", 47114); //TODO find a better time
aPreferredSize = getPeer().getPreferredSize();
xPropertySet.setPropertyValue("Time", com.sun.star.uno.Any.VOID);
}
@@ -338,7 +338,7 @@ public class Control extends Shape
}
xPropertySet.setPropertyValue("Text", stext);
aPreferredSize = getPeer().getPreferredSize();
- xPropertySet.setPropertyValue("Text", "");
+ xPropertySet.setPropertyValue("Text", PropertyNames.EMPTY_STRING);
}
return aPreferredSize;
}
diff --git a/wizards/com/sun/star/wizards/document/DatabaseControl.java b/wizards/com/sun/star/wizards/document/DatabaseControl.java
index 67a85c436f6f..5e8877374c9b 100644
--- a/wizards/com/sun/star/wizards/document/DatabaseControl.java
+++ b/wizards/com/sun/star/wizards/document/DatabaseControl.java
@@ -90,10 +90,10 @@ public class DatabaseControl extends Control
{
bHidden = true;
}
- xPropColumn.setPropertyValue("Hidden", new Boolean(bHidden));
+ xPropColumn.setPropertyValue("Hidden", Boolean.valueOf(bHidden));
xPropColumn.setPropertyValue("DataField", sFieldName);
xPropColumn.setPropertyValue(PropertyNames.PROPERTY_LABEL, _columntitle);
- xPropColumn.setPropertyValue(PropertyNames.PROPERTY_WIDTH, new Integer(0)); // Width of column is adjusted to Columname
+ xPropColumn.setPropertyValue(PropertyNames.PROPERTY_WIDTH, 0); // Width of column is adjusted to Columname
XPropertySetInfo xPSI = xPropColumn.getPropertySetInfo();
if ( xPSI.hasPropertyByName( "MouseWheelBehavior" ) )
@@ -152,7 +152,7 @@ public class DatabaseControl extends Control
return FormHandler.oControlData[i].GridColumnName;
}
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public int getControlHeight()
@@ -160,16 +160,14 @@ public class DatabaseControl extends Control
if (getControlType() == FormHandler.SOIMAGECONTROL)
{
// return oFormHandler.getImageControlHeight();
- final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4;
- return nMemofieldheight;
+ return oFormHandler.getControlReferenceHeight() * 4;
}
else
{
if (getFieldType() == DataType.LONGVARCHAR)
{
// Helper.setUnoPropertyValue(xControlModel, PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE);
- final int nMemofieldheight = oFormHandler.getControlReferenceHeight() * 4;
- return nMemofieldheight;
+ return oFormHandler.getControlReferenceHeight() * 4;
}
else if (getControlType() == FormHandler.SOCHECKBOX)
{
diff --git a/wizards/com/sun/star/wizards/document/FormHandler.java b/wizards/com/sun/star/wizards/document/FormHandler.java
index 17dece81a03e..828ae4fc67f0 100644
--- a/wizards/com/sun/star/wizards/document/FormHandler.java
+++ b/wizards/com/sun/star/wizards/document/FormHandler.java
@@ -59,9 +59,17 @@ import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.container.XNamed;
+import java.util.logging.Level;
+import java.util.logging.Logger;
public class FormHandler
{
+ private static final String CHECKBOX = "CheckBox";
+ private static final String DATEFIELD = "DateField";
+ private static final String FORMATTEDFIELD = "FormattedField";
+ private static final String IMAGECONTROL = "ImageControl";
+ private static final String TEXTFIELD = "TextField";
+ private static final String TIMEFIELD = "TimeField";
public XFormsSupplier xFormsSupplier;
public XMultiServiceFactory xMSFDoc;
@@ -108,12 +116,12 @@ public class FormHandler
public FormHandler(XMultiServiceFactory _xMSF, XTextDocument xTextDocument)
{
this.xMSF = _xMSF;
- xDrawPageSupplier = (XDrawPageSupplier) UnoRuntime.queryInterface(XDrawPageSupplier.class, xTextDocument);
+ 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);
+ xFormsSupplier = UnoRuntime.queryInterface(XFormsSupplier.class, xDrawPage);
+ xShapeGrouper = UnoRuntime.queryInterface(XShapeGrouper.class, xDrawPage);
+ xControlAccess = UnoRuntime.queryInterface(XControlAccess.class, xTextDocument.getCurrentController());
+ xMSFDoc = 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";
@@ -124,30 +132,30 @@ public class FormHandler
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);
+ 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[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);
+ oControlData[21] = createControlData(DataType.OTHER, SOIMAGECONTROL, IMAGECONTROL, TEXTFIELD, false);
}
public int getControlType(int _fieldtype)
@@ -156,8 +164,7 @@ public class FormHandler
{
if (oControlData[i].DataType == _fieldtype)
{
- final int nType = oControlData[i].ControlType;
- return nType;
+ return oControlData[i].ControlType;
}
}
return -1;
@@ -184,7 +191,7 @@ public class FormHandler
public void initializeBasicControlValues()
{
Control oLabelControl = new Control(this, SOLABEL, new Point(), new Size());
- XDevice xDevice = (XDevice) UnoRuntime.queryInterface(XDevice.class, oLabelControl.xWindowPeer);
+ XDevice xDevice = UnoRuntime.queryInterface(XDevice.class, oLabelControl.xWindowPeer);
iXPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterX);
iYPixelFactor = (int) (100000 / xDevice.getInfo().PixelPerMeterY);
@@ -209,8 +216,7 @@ public class FormHandler
public XNameContainer getDocumentForms()
{
- XNameContainer xNamedForms = xFormsSupplier.getForms();
- return xNamedForms;
+ return xFormsSupplier.getForms();
}
public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName, String sMsg) throws com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException
@@ -219,8 +225,7 @@ public class FormHandler
{
if (xNamedForm.hasByName(ControlName))
{
- String ControlValue = AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
- return ControlValue;
+ return AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
}
else
{
@@ -238,7 +243,7 @@ public class FormHandler
try
{
XInterface xHiddenControl;
- if (xNameAccess.hasByName(ControlName) == true)
+ if (xNameAccess.hasByName(ControlName))
{
xHiddenControl = (XInterface) AnyConverter.toObject(new Type(XInterface.class), xNameAccess.getByName(ControlName));
}
@@ -249,9 +254,9 @@ public class FormHandler
}
Helper.setUnoPropertyValue(xHiddenControl, "HiddenValue", ControlValue);
}
- catch (Exception exception)
+ catch (Exception ex)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -260,7 +265,7 @@ public class FormHandler
public UnknownHiddenControlException(XNameAccess xNamedForm, String ControlName, String sMsgHiddenControlisMissing)
{
- XNamed xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class, xNamedForm);
+ XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xNamedForm);
String FormName = xNamed.getName();
sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, FormName, "<REPORTFORM>");
sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, ControlName, "<CONTROLNAME>");
@@ -271,7 +276,7 @@ public class FormHandler
public boolean hasFormByName(String _FormName)
{
xNamedFormContainer = getDocumentForms();
- xNamedForms = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNamedFormContainer);
+ xNamedForms = UnoRuntime.queryInterface(XNameAccess.class, xNamedFormContainer);
return xNamedForms.hasByName(_FormName);
}
@@ -285,9 +290,9 @@ public class FormHandler
xNamedFormContainer.removeByName(_FormName);
}
}
- catch (com.sun.star.uno.Exception exception)
+ catch (com.sun.star.uno.Exception ex)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -299,14 +304,14 @@ public class FormHandler
{
if (belongsToForm(xDrawPage.getByIndex(i), _FormName))
{
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
xDrawPage.remove(xShape);
}
}
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -318,26 +323,26 @@ public class FormHandler
}
catch ( WrappedTargetException e )
{
- e.printStackTrace( System.err );
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
catch( final NoSuchElementException e )
{
- e.printStackTrace( System.err );
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
public boolean belongsToForm(Object _oDrawPageElement, String _FormName)
{
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement);
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, _oDrawPageElement);
if (xServiceInfo.supportsService("com.sun.star.drawing.ControlShape"))
{
- XControlShape xControlShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, _oDrawPageElement);
+ XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, _oDrawPageElement);
XControlModel xControlModel = xControlShape.getControl();
- xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xControlShape.getControl());
+ 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());
+ XChild xChild = UnoRuntime.queryInterface(XChild.class, xControlModel);
+ XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xChild.getParent());
String sName = xNamed.getName();
return _FormName.equals(sName);
}
@@ -355,7 +360,7 @@ public class FormHandler
oDBForm = xMSFDoc.createInstance("com.sun.star.form.component.Form");
_xNamedFormContainer.insertByName(_FormName, oDBForm);
XNameContainer xNamedForm;
- xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
+ xNamedForm = UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
return xNamedForm;
}
else
@@ -363,9 +368,9 @@ public class FormHandler
return getFormByName(_FormName);
}
}
- catch (com.sun.star.uno.Exception exception)
+ catch (com.sun.star.uno.Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
return null;
}
}
@@ -388,12 +393,12 @@ public class FormHandler
if (xNamedForms.hasByName(_sname))
{
Object oDBForm = AnyConverter.toObject(new Type(XInterface.class), Helper.getUnoObjectbyName(xNamedForms, _sname));
- xNamedForm = (XNameContainer) UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
+ xNamedForm = UnoRuntime.queryInterface(XNameContainer.class, oDBForm);
}
}
catch (IllegalArgumentException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
return xNamedForm;
}
@@ -484,13 +489,13 @@ public class FormHandler
{
for (int i = 0; i < this.xDrawPage.getCount(); i++)
{
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
xShape.setPosition(new Point(this.iXNirwanaPos, this.iYNirwanaPos));
}
}
catch (Exception e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -498,7 +503,7 @@ public class FormHandler
{
for (int i = this.xDrawPage.getCount(); i > -1; i--)
{
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
removeShape(xShape);
}
}
@@ -510,7 +515,7 @@ public class FormHandler
public void removeShape(XShape _xShape)
{
xDrawPage.remove(_xShape);
- XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _xShape);
+ XComponent xComponent = UnoRuntime.queryInterface(XComponent.class, _xShape);
xComponent.dispose();
}
// Destroy all Shapes in Nirwana
@@ -518,7 +523,7 @@ public class FormHandler
{
for (int i = this.xDrawPage.getCount(); i > -1; i--)
{
- XShape xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
+ XShape xShape = UnoRuntime.queryInterface(XShape.class, xDrawPage.getByIndex(i));
if (xShape.getPosition().Y < this.iYNirwanaPos)
{
xDrawPage.remove(xShape);
@@ -531,14 +536,14 @@ public class FormHandler
try
{
Object oGroupShape = _xMSF.createInstance("com.sun.star.drawing.ShapeCollection");
- XShapes xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class, oGroupShape);
+ 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);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
return null;
}
}
@@ -583,12 +588,12 @@ public class FormHandler
{
try
{
- XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, this.xMSFDoc.createInstance("com.sun.star.text.DocumentSettings"));
- xPropertySet.setPropertyValue("DoNotCaptureDrawObjsOnPage", new Boolean(!_bCaptureObjects));
+ XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, this.xMSFDoc.createInstance("com.sun.star.text.DocumentSettings"));
+ xPropertySet.setPropertyValue("DoNotCaptureDrawObjsOnPage", Boolean.valueOf(!_bCaptureObjects));
}
- catch (Exception ex)
+ catch (Exception e)
{
- ex.printStackTrace(System.out);
+ Logger.getLogger(FormHandler.class.getName()).log(Level.SEVERE, null, e);
}
}
}
diff --git a/wizards/com/sun/star/wizards/document/GridControl.java b/wizards/com/sun/star/wizards/document/GridControl.java
index ef13d5c12a66..284dc5ef4309 100644
--- a/wizards/com/sun/star/wizards/document/GridControl.java
+++ b/wizards/com/sun/star/wizards/document/GridControl.java
@@ -76,7 +76,7 @@ public class GridControl extends Shape
FieldColumn curfieldcolumn = fieldcolumns[i];
if (curfieldcolumn.getFieldType() == DataType.TIMESTAMP)
{
- TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, "", "dbw"), this, curfieldcolumn);
+ TimeStampControl oControl = new TimeStampControl(new Resource(_xMSF, PropertyNames.EMPTY_STRING, "dbw"), this, curfieldcolumn);
}
else
{
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java
index ea132453bb30..074ff5350a39 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.java
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java
@@ -81,13 +81,13 @@ public class OfficeDocument
{
try
{
- XEventsSupplier xEventsSuppl = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class, xComponent);
+ XEventsSupplier xEventsSuppl = 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].Name = "Script"; //PropertyNames.URL;
oEventProperties[1].Value = EventURL;
xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties);
}
@@ -103,8 +103,8 @@ public class OfficeDocument
{
if (xComponent != null)
{
- XModifiable xModified = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xComponent);
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
+ XModifiable xModified = UnoRuntime.queryInterface(XModifiable.class, xComponent);
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent);
XFrame xFrame = xModel.getCurrentController().getFrame();
if (xModified.isModified())
{
@@ -131,7 +131,7 @@ public class OfficeDocument
PropertyValue[] loadValues = new PropertyValue[2];
loadValues[0] = new PropertyValue();
- loadValues[0].Name = "ReadOnly";
+ loadValues[0].Name = PropertyNames.READ_ONLY;
loadValues[0].Value = readonly ? Boolean.TRUE : Boolean.FALSE;
loadValues[1] = new PropertyValue();
loadValues[1].Name = "Preview";
@@ -144,18 +144,18 @@ public class OfficeDocument
try
{
- xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, frame);
- /*if (frame.getName() == null || frame.getName().equals(""));
+ xComponentLoader = UnoRuntime.queryInterface(XComponentLoader.class, frame);
+ /*if (frame.getName() == null || frame.getName().equals(PropertyNames.EMPTY_STRING));
frame.setName("T" + System.currentTimeMillis());*/
XComponent xComponent = xComponentLoader.loadComponentFromURL(sURL, "_self", 0, loadValues);
- if (sDocumentType == "swriter")
+ if (sDocumentType.equals("swriter"))
{
- oDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ oDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent);
}
- else if (sDocumentType == "scalc")
+ else if (sDocumentType.equals("scalc"))
{
- oDocument = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
+ oDocument = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xComponent);
//TODO:
// else if (sDocumentType == "simpress")
// else if (sDocumentType == "sdraw")
@@ -182,14 +182,14 @@ public class OfficeDocument
}
else
{
- XFrame xF = (XFrame) UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xMSF));
+ XFrame xF = UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xMSF));
xFrame = xF.findFrame(FrameName, 0);
if (listener != null)
{
- XFramesSupplier xFS = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xF);
+ XFramesSupplier xFS = UnoRuntime.queryInterface(XFramesSupplier.class, xF);
XFrames xFF = xFS.getFrames();
xFF.remove(xFrame);
- XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xF);
+ XDesktop xDesktop = UnoRuntime.queryInterface(XDesktop.class, xF);
xDesktop.addTerminateListener(listener);
}
}
@@ -201,7 +201,7 @@ public class OfficeDocument
XToolkit xToolkit = null;
try
{
- xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, xMSF.createInstance("com.sun.star.awt.Toolkit"));
+ xToolkit = UnoRuntime.queryInterface(XToolkit.class, xMSF.createInstance("com.sun.star.awt.Toolkit"));
}
catch (Exception e)
{
@@ -226,14 +226,14 @@ public class OfficeDocument
XWindowPeer xPeer = null;
try
{
- xPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xToolkit.createWindow(aDescriptor));
+ xPeer = UnoRuntime.queryInterface(XWindowPeer.class, xToolkit.createWindow(aDescriptor));
}
catch (IllegalArgumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xPeer);
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xPeer);
//define some further properties of the frame window
//if it's needed .-)
@@ -243,7 +243,7 @@ public class OfficeDocument
XFrame xFrame = null;
try
{
- xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, xMSF.createInstance("com.sun.star.frame.Frame"));
+ xFrame = UnoRuntime.queryInterface(XFrame.class, xMSF.createInstance("com.sun.star.frame.Frame"));
}
catch (Exception e)
{
@@ -273,13 +273,13 @@ public class OfficeDocument
//XInterface xInterface = null;
try
{
- xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xInterface);
+ 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);
+ XServiceInfo xComponentService = 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
+ oDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); //TODO: write if clauses for Calc, Impress and Draw
}
}
catch (Exception exception)
@@ -293,7 +293,7 @@ public class OfficeDocument
{
try
{
- XStorable xStoreable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xComponent);
+ XStorable xStoreable = UnoRuntime.queryInterface(XStorable.class, xComponent);
PropertyValue[] oStoreProperties;
if (FilterName.length() > 0)
{
@@ -303,13 +303,13 @@ public class OfficeDocument
oStoreProperties[0].Value = FilterName;
oStoreProperties[1] = new PropertyValue();
oStoreProperties[1].Name = "InteractionHandler";
- oStoreProperties[1].Value = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
+ oStoreProperties[1].Value = UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
}
else
{
oStoreProperties = new PropertyValue[0];
}
- if (bStoreToUrl == true)
+ if (bStoreToUrl)
{
xStoreable.storeToURL(StorePath, oStoreProperties);
}
@@ -330,11 +330,11 @@ public class OfficeDocument
public static boolean close(XComponent xComponent)
{
boolean bState = false;
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent);
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent);
if (xModel != null)
{
- XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, xModel);
+ XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, xModel);
if (xCloseable != null)
{
@@ -351,7 +351,7 @@ public class OfficeDocument
}
else
{
- XComponent xDisposeable = (XComponent) UnoRuntime.queryInterface(XComponent.class, xModel);
+ XComponent xDisposeable = UnoRuntime.queryInterface(XComponent.class, xModel);
xDisposeable.dispose();
bState = true;
}
@@ -369,9 +369,9 @@ public class OfficeDocument
int colcount = datalist[0].length;
if (colcount > 0)
{
- XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, oTable);
+ 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);
+ XCellRangeData xDataArray = UnoRuntime.queryInterface(XCellRangeData.class, xNewRange);
xDataArray.setDataArray(datalist);
}
}
@@ -389,13 +389,13 @@ public class OfficeDocument
PropertyValue[][] mediaDescr = new PropertyValue[1][1];
mediaDescr[0][0] = new PropertyValue();
- mediaDescr[0][0].Name = "URL";
+ mediaDescr[0][0].Name = PropertyNames.URL;
mediaDescr[0][0].Value = url;
- String type = ((XTypeDetection) UnoRuntime.queryInterface(XTypeDetection.class, typeDetect)).queryTypeByDescriptor(mediaDescr, true);
+ String type = UnoRuntime.queryInterface(XTypeDetection.class, typeDetect).queryTypeByDescriptor(mediaDescr, true);
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
- if (type.equals(""))
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
+ if (type.equals(PropertyNames.EMPTY_STRING))
{
return null;
}
@@ -409,7 +409,7 @@ public class OfficeDocument
throws Exception
{
Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
return (PropertyValue[]) xNameAccess.getByName(type);
}
@@ -421,13 +421,13 @@ public class OfficeDocument
*/
public static int getSlideCount(Object model)
{
- XDrawPagesSupplier xDrawPagesSupplier = (XDrawPagesSupplier) UnoRuntime.queryInterface(XDrawPagesSupplier.class, model);
+ 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);
+ XDocumentPropertiesSupplier xDocumentPropertiesSupplier = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, document);
return xDocumentPropertiesSupplier.getDocumentProperties();
}
diff --git a/wizards/com/sun/star/wizards/document/Shape.java b/wizards/com/sun/star/wizards/document/Shape.java
index b2ef1a27e662..990fe68cb916 100644
--- a/wizards/com/sun/star/wizards/document/Shape.java
+++ b/wizards/com/sun/star/wizards/document/Shape.java
@@ -73,8 +73,8 @@ public class Shape
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);
+ xShapes = UnoRuntime.queryInterface(XShapes.class, oShape);
+ xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oShape);
}
catch (Exception e)
{
@@ -92,7 +92,7 @@ public class Shape
{
xMSF = oFormHandler.xMSFDoc;
Object oShape = xMSF.createInstance(sServiceName);
- xShape = (XShape) UnoRuntime.queryInterface(XShape.class, oShape);
+ xShape = UnoRuntime.queryInterface(XShape.class, oShape);
xShape.setPosition(aPoint);
if (aSize != null)
{
@@ -103,8 +103,8 @@ public class Shape
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);
+ xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, xShape);
+ xControlShape = UnoRuntime.queryInterface(XControlShape.class, xShape);
}
catch (Exception e)
diff --git a/wizards/com/sun/star/wizards/document/TimeStampControl.java b/wizards/com/sun/star/wizards/document/TimeStampControl.java
index 88733ee883c1..7c951921bde6 100644
--- a/wizards/com/sun/star/wizards/document/TimeStampControl.java
+++ b/wizards/com/sun/star/wizards/document/TimeStampControl.java
@@ -75,7 +75,7 @@ public class TimeStampControl extends DatabaseControl
xShapes.add(oDateControl.xShape);
xShapes.add(oTimeControl.xShape);
xShapeGroup = _oFormHandler.xShapeGrouper.group(xShapes);
- xShapeGroup = (XShape) UnoRuntime.queryInterface(XShape.class, xShapeGroup);
+ xShapeGroup = UnoRuntime.queryInterface(XShape.class, xShapeGroup);
nreldatewidth = 1.0 / ((double) getSize().Width / (double) nDateWidth);
nreltimewidth = 1.0 - nreldatewidth;
}
@@ -87,9 +87,8 @@ public class TimeStampControl extends DatabaseControl
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;
+ XControlShape xControlShape = UnoRuntime.queryInterface(XControlShape.class, oControl);
+ return UnoRuntime.queryInterface(XPropertySet.class, xControlShape.getControl());
}
}
catch (Exception e)
@@ -105,8 +104,8 @@ public class TimeStampControl extends DatabaseControl
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);
+ oDateControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.DATE, _curfieldcolumn.getFieldTitle() + PropertyNames.SPACE + sDateAppendix);
+ oTimeControl = new DatabaseControl(_oGridControl, _curfieldcolumn, DataType.TIME, _curfieldcolumn.getFieldTitle() + PropertyNames.SPACE + sTimeAppendix);
}
public void setPropertyValue(String _sPropertyName, Object _aPropertyValue) throws Exception
diff --git a/wizards/com/sun/star/wizards/fax/CallWizard.java b/wizards/com/sun/star/wizards/fax/CallWizard.java
index 69e061f95918..fd0ad8307a4e 100644
--- a/wizards/com/sun/star/wizards/fax/CallWizard.java
+++ b/wizards/com/sun/star/wizards/fax/CallWizard.java
@@ -38,6 +38,7 @@ 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.PropertyNames;
/**
* This class capsulates the class, that implements the minimal component, a factory for
@@ -105,7 +106,7 @@ public class CallWizard
*/
public void trigger(String str)
{
- if (str.equalsIgnoreCase("start"))
+ if (str.equalsIgnoreCase(PropertyNames.START))
{
FaxWizardDialogImpl lw = new FaxWizardDialogImpl(xmultiservicefactory);
if (!FaxWizardDialogImpl.running)
@@ -189,7 +190,7 @@ public class CallWizard
try
{
- byteReturn = ("" + this.hashCode()).getBytes();
+ byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
}
catch (Exception exception)
{
diff --git a/wizards/com/sun/star/wizards/fax/FaxDocument.java b/wizards/com/sun/star/wizards/fax/FaxDocument.java
index 7cb8178d3264..a8f383f74cef 100644
--- a/wizards/com/sun/star/wizards/fax/FaxDocument.java
+++ b/wizards/com/sun/star/wizards/fax/FaxDocument.java
@@ -56,8 +56,7 @@ public class FaxDocument extends TextDocument
public XWindowPeer getWindowPeer()
{
- XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument);
- return xWindowPeer;
+ return UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument);
}
public void switchElement(String sElement, boolean bState)
@@ -66,7 +65,7 @@ public class FaxDocument extends TextDocument
{
TextSectionHandler mySectionHandler = new TextSectionHandler(xMSF, xTextDocument);
Object oSection = mySectionHandler.xTextSectionsSupplier.getTextSections().getByName(sElement);
- Helper.setUnoPropertyValue(oSection, "IsVisible", new Boolean(bState));
+ Helper.setUnoPropertyValue(oSection, "IsVisible", Boolean.valueOf(bState));
}
catch (Exception exception)
@@ -88,20 +87,20 @@ public class FaxDocument extends TextDocument
xTextDocument.lockControllers();
try
{
- XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ XStyleFamiliesSupplier xStyleFamiliesSupplier = 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"));
+ xPageStyleCollection = UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles"));
XText xFooterText;
- XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle));
+ XStyle xPageStyle = 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"));
+ Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", Boolean.TRUE);
+ xFooterText = UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText"));
xFooterText.setString(sText);
if (bPageNumber)
{
@@ -109,10 +108,10 @@ public class FaxDocument extends TextDocument
XTextCursor myCursor = xFooterText.createTextCursor();
myCursor.gotoEnd(false);
xFooterText.insertControlCharacter(myCursor, ControlCharacter.PARAGRAPH_BREAK, false);
- XPropertySet xCursorPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, myCursor);
+ XPropertySet xCursorPSet = 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);
+ XTextField xPageNumberField = UnoRuntime.queryInterface(XTextField.class, xMSFDoc.createInstance("com.sun.star.text.TextField.PageNumber"));
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xPageNumberField);
xPSet.setPropertyValue("SubType", PageNumberType.CURRENT);
xPSet.setPropertyValue("NumberingType", new Short(NumberingType.ARABIC));
xFooterText.insertTextContent(xFooterText.getEnd(), xPageNumberField, false);
@@ -120,7 +119,7 @@ public class FaxDocument extends TextDocument
}
else
{
- Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(false));
+ Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", Boolean.FALSE);
}
xTextDocument.unlockControllers();
}
@@ -153,7 +152,7 @@ public class FaxDocument extends TextDocument
}
else
{
- myFieldHandler.changeUserFieldContent(sFieldName, "");
+ myFieldHandler.changeUserFieldContent(sFieldName, PropertyNames.EMPTY_STRING);
}
}
@@ -179,7 +178,7 @@ public class FaxDocument extends TextDocument
public void killEmptyUserFields()
{
TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
- myFieldHandler.removeUserFieldByContent("");
+ myFieldHandler.removeUserFieldByContent(PropertyNames.EMPTY_STRING);
}
public void killEmptyFrames()
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java
index fc095af0d337..02ccab6b177e 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialog.java
@@ -112,11 +112,11 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
- "Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_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)
+ Boolean.TRUE, 210, Boolean.TRUE, 104, 52, INTEGERS[1], new Short((short) 1), resources.resFaxWizardDialog_title, 310
});
@@ -138,7 +138,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], OPTBUSINESSFAX_HID, resources.resoptBusinessFax_value, new Integer(97), new Integer(28), INTEGERS[1], new Short((short) 1), new Integer(184)
+ INTEGERS[8], OPTBUSINESSFAX_HID, resources.resoptBusinessFax_value, 97, 28, INTEGERS[1], new Short((short) 1), 184
});
lstBusinessStyle = insertListBox("lstBusinessStyle", LSTBUSINESSSTYLE_ACTION_PERFORMED, LSTBUSINESSSTYLE_ITEM_CHANGED,
new String[]
@@ -147,7 +147,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, LSTBUSINESSSTYLE_HID, new Integer(180), INTEGER_40, INTEGERS[1], new Short((short) 3), new Integer(74)
+ Boolean.TRUE, INTEGER_12, LSTBUSINESSSTYLE_HID, 180, INTEGER_40, INTEGERS[1], new Short((short) 3), 74
});
optPrivateFax = insertRadioButton("optPrivateFax", OPTPRIVATEFAX_ITEM_CHANGED,
new String[]
@@ -156,7 +156,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], OPTPRIVATEFAX_HID, resources.resoptPrivateFax_value, new Integer(97), new Integer(81), INTEGERS[1], new Short((short) 2), new Integer(184)
+ INTEGERS[8], OPTPRIVATEFAX_HID, resources.resoptPrivateFax_value, 97, 81, INTEGERS[1], new Short((short) 2), 184
});
lstPrivateStyle = insertListBox("lstPrivateStyle", LSTPRIVATESTYLE_ACTION_PERFORMED, LSTPRIVATESTYLE_ITEM_CHANGED,
new String[]
@@ -165,7 +165,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, LSTPRIVATESTYLE_HID, new Integer(180), new Integer(95), INTEGERS[1], new Short((short) 4), new Integer(74)
+ Boolean.TRUE, INTEGER_12, LSTPRIVATESTYLE_HID, 180, 95, INTEGERS[1], new Short((short) 4), 74
});
lblBusinessStyle = insertLabel("lblBusinessStyle",
new String[]
@@ -174,16 +174,16 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.reslblBusinessStyle_value, new Integer(110), new Integer(42), INTEGERS[1], new Short((short) 32), new Integer(60)
+ INTEGERS[8], resources.reslblBusinessStyle_value, 110, 42, INTEGERS[1], new Short((short) 32), 60
});
lblTitle1 = insertLabel("lblTitle1",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor5, INTEGER_16, resources.reslblTitle1_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[1], new Short((short) 37), 212
});
lblPrivateStyle = insertLabel("lblPrivateStyle",
new String[]
@@ -192,7 +192,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.reslblPrivateStyle_value, new Integer(110), new Integer(95), INTEGERS[1], new Short((short) 50), new Integer(60)
+ INTEGERS[8], resources.reslblPrivateStyle_value, 110, 95, INTEGERS[1], new Short((short) 50), 60
});
lblIntroduction = insertLabel("lblIntroduction",
new String[]
@@ -201,12 +201,12 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ 39, resources.reslblIntroduction_value, Boolean.TRUE, 104, 145, INTEGERS[1], new Short((short) 55), 199
});
ImageControl3 = insertInfoImage(92, 145, 1);
// ImageControl3 = insertImage("ImageControl3",
-// new String[] {"Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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]}
+// new String[] {PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
+// new Object[] { new Short((short)0),INTEGERS[10],"private:resource/dbu/image/19205",92,145,Boolean.FALSE,INTEGERS[1],new Short((short)56),INTEGERS[10]}
// );
}
@@ -219,7 +219,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ INTEGERS[8], CHKUSELOGO_HID, resources.reschkUseLogo_value, 97, 28, new Short((short) 0), INTEGERS[2], new Short((short) 5), 212
});
chkUseDate = insertCheckBox("chkUseDate", CHKUSEDATE_ITEM_CHANGED,
new String[]
@@ -228,7 +228,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ INTEGERS[8], CHKUSEDATE_HID, resources.reschkUseDate_value, 97, 43, new Short((short) 0), INTEGERS[2], new Short((short) 6), 212
});
chkUseCommunicationType = insertCheckBox("chkUseCommunicationType", CHKUSECOMMUNICATIONTYPE_ITEM_CHANGED,
new String[]
@@ -237,7 +237,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ INTEGERS[8], CHKUSECOMMUNICATIONTYPE_HID, resources.reschkUseCommunicationType_value, 97, 57, new Short((short) 0), INTEGERS[2], new Short((short) 7), 100
});
lstCommunicationType = insertComboBox("lstCommunicationType", LSTCOMMUNICATIONTYPE_ACTION_PERFORMED, LSTCOMMUNICATIONTYPE_ITEM_CHANGED, LSTCOMMUNICATIONTYPE_TEXT_CHANGED,
new String[]
@@ -246,7 +246,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, LSTCOMMUNICATIONTYPE_HID, new Integer(105), new Integer(68), INTEGERS[2], new Short((short) 8), new Integer(174)
+ Boolean.TRUE, INTEGER_12, LSTCOMMUNICATIONTYPE_HID, 105, 68, INTEGERS[2], new Short((short) 8), 174
});
chkUseSubject = insertCheckBox("chkUseSubject", CHKUSESUBJECT_ITEM_CHANGED,
new String[]
@@ -255,7 +255,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ INTEGERS[8], CHKUSESUBJECT_HID, resources.reschkUseSubject_value, 97, 87, new Short((short) 0), INTEGERS[2], new Short((short) 9), 212
});
chkUseSalutation = insertCheckBox("chkUseSalutation", CHKUSESALUTATION_ITEM_CHANGED,
new String[]
@@ -264,7 +264,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ INTEGERS[8], CHKUSESALUTATION_HID, resources.reschkUseSalutation_value, 97, 102, new Short((short) 0), INTEGERS[2], new Short((short) 10), 100
});
lstSalutation = insertComboBox("lstSalutation", LSTSALUTATION_ACTION_PERFORMED, LSTSALUTATION_ITEM_CHANGED, LSTSALUTATION_TEXT_CHANGED,
new String[]
@@ -273,7 +273,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, LSTSALUTATION_HID, new Integer(105), new Integer(113), INTEGERS[2], new Short((short) 11), new Integer(174)
+ Boolean.TRUE, INTEGER_12, LSTSALUTATION_HID, 105, 113, INTEGERS[2], new Short((short) 11), 174
});
chkUseGreeting = insertCheckBox("chkUseGreeting", CHKUSEGREETING_ITEM_CHANGED,
new String[]
@@ -282,7 +282,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ INTEGERS[8], CHKUSEGREETING_HID, resources.reschkUseGreeting_value, 97, 132, new Short((short) 0), INTEGERS[2], new Short((short) 12), 100
});
lstGreeting = insertComboBox("lstGreeting", LSTGREETING_ACTION_PERFORMED, LSTGREETING_ITEM_CHANGED, LSTGREETING_TEXT_CHANGED,
new String[]
@@ -291,7 +291,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, LSTGREETING_HID, new Integer(105), new Integer(143), INTEGERS[2], new Short((short) 13), new Integer(174)
+ Boolean.TRUE, INTEGER_12, LSTGREETING_HID, 105, 143, INTEGERS[2], new Short((short) 13), 174
});
chkUseFooter = insertCheckBox("chkUseFooter", CHKUSEFOOTER_ITEM_CHANGED,
new String[]
@@ -300,16 +300,16 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ INTEGERS[8], CHKUSEFOOTER_HID, resources.reschkUseFooter_value, 97, 163, new Short((short) 0), INTEGERS[2], new Short((short) 14), 212
});
lblTitle3 = insertLabel("lblTitle3",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor5, INTEGER_16, resources.reslblTitle3_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[2], new Short((short) 59), 212
});
}
@@ -322,7 +322,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], OPTSENDERPLACEHOLDER_HID, resources.resoptSenderPlaceholder_value, new Integer(104), new Integer(42), INTEGERS[3], new Short((short) 15), new Integer(149)
+ INTEGERS[8], OPTSENDERPLACEHOLDER_HID, resources.resoptSenderPlaceholder_value, 104, 42, INTEGERS[3], new Short((short) 15), 149
});
optSenderDefine = insertRadioButton("optSenderDefine", OPTSENDERDEFINE_ITEM_CHANGED,
new String[]
@@ -331,7 +331,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], OPTSENDERDEFINE_HID, resources.resoptSenderDefine_value, new Integer(104), new Integer(54), INTEGERS[3], new Short((short) 16), new Integer(149)
+ INTEGERS[8], OPTSENDERDEFINE_HID, resources.resoptSenderDefine_value, 104, 54, INTEGERS[3], new Short((short) 16), 149
});
txtSenderName = insertTextField("txtSenderName", TXTSENDERNAME_TEXT_CHANGED,
new String[]
@@ -340,7 +340,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGER_12, TXTSENDERNAME_HID, new Integer(182), new Integer(67), INTEGERS[3], new Short((short) 17), new Integer(119)
+ INTEGER_12, TXTSENDERNAME_HID, 182, 67, INTEGERS[3], new Short((short) 17), 119
});
txtSenderStreet = insertTextField("txtSenderStreet", TXTSENDERSTREET_TEXT_CHANGED,
new String[]
@@ -349,7 +349,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGER_12, TXTSENDERSTREET_HID, new Integer(182), new Integer(81), INTEGERS[3], new Short((short) 18), new Integer(119)
+ INTEGER_12, TXTSENDERSTREET_HID, 182, 81, INTEGERS[3], new Short((short) 18), 119
});
txtSenderPostCode = insertTextField("txtSenderPostCode", TXTSENDERPOSTCODE_TEXT_CHANGED,
new String[]
@@ -358,7 +358,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGER_12, TXTSENDERPOSTCODE_HID, new Integer(182), new Integer(95), INTEGERS[3], new Short((short) 19), new Integer(25)
+ INTEGER_12, TXTSENDERPOSTCODE_HID, 182, 95, INTEGERS[3], new Short((short) 19), 25
});
txtSenderState = insertTextField("txtSenderState", TXTSENDERSTATE_TEXT_CHANGED,
new String[]
@@ -367,7 +367,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGER_12, TXTSENDERSTATE_HID, new Integer(211), new Integer(95), INTEGERS[3], new Short((short) 20), new Integer(21)
+ INTEGER_12, TXTSENDERSTATE_HID, 211, 95, INTEGERS[3], new Short((short) 20), 21
});
txtSenderCity = insertTextField("txtSenderCity", TXTSENDERCITY_TEXT_CHANGED,
new String[]
@@ -376,7 +376,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGER_12, TXTSENDERCITY_HID, new Integer(236), new Integer(95), INTEGERS[3], new Short((short) 21), new Integer(65)
+ INTEGER_12, TXTSENDERCITY_HID, 236, 95, INTEGERS[3], new Short((short) 21), 65
});
txtSenderFax = insertTextField("txtSenderFax", TXTSENDERFAX_TEXT_CHANGED,
new String[]
@@ -385,7 +385,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGER_12, TXTSENDERFAX_HID, new Integer(182), new Integer(109), INTEGERS[3], new Short((short) 22), new Integer(119)
+ INTEGER_12, TXTSENDERFAX_HID, 182, 109, INTEGERS[3], new Short((short) 22), 119
});
optReceiverPlaceholder = insertRadioButton("optReceiverPlaceholder", OPTRECEIVERPLACEHOLDER_ITEM_CHANGED,
new String[]
@@ -394,7 +394,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], OPTRECEIVERPLACEHOLDER_HID, resources.resoptReceiverPlaceholder_value, new Integer(104), new Integer(148), INTEGERS[3], new Short((short) 23), new Integer(200)
+ INTEGERS[8], OPTRECEIVERPLACEHOLDER_HID, resources.resoptReceiverPlaceholder_value, 104, 148, INTEGERS[3], new Short((short) 23), 200
});
optReceiverDatabase = insertRadioButton("optReceiverDatabase", OPTRECEIVERDATABASE_ITEM_CHANGED,
new String[]
@@ -403,7 +403,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], OPTRECEIVERDATABASE_HID, resources.resoptReceiverDatabase_value, new Integer(104), new Integer(160), INTEGERS[3], new Short((short) 24), new Integer(200)
+ INTEGERS[8], OPTRECEIVERDATABASE_HID, resources.resoptReceiverDatabase_value, 104, 160, INTEGERS[3], new Short((short) 24), 200
});
lblSenderAddress = insertLabel("lblSenderAddress",
new String[]
@@ -412,7 +412,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.reslblSenderAddress_value, new Integer(97), new Integer(28), INTEGERS[3], new Short((short) 46), new Integer(136)
+ INTEGERS[8], resources.reslblSenderAddress_value, 97, 28, INTEGERS[3], new Short((short) 46), 136
});
FixedLine2 = insertFixedLine("FixedLine2",
new String[]
@@ -421,7 +421,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[5], new Integer(90), new Integer(126), INTEGERS[3], new Short((short) 51), new Integer(212)
+ INTEGERS[5], 90, 126, INTEGERS[3], new Short((short) 51), 212
});
lblSenderName = insertLabel("lblSenderName",
new String[]
@@ -430,7 +430,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.reslblSenderName_value, new Integer(113), new Integer(69), INTEGERS[3], new Short((short) 52), new Integer(68)
+ INTEGERS[8], resources.reslblSenderName_value, 113, 69, INTEGERS[3], new Short((short) 52), 68
});
lblSenderStreet = insertLabel("lblSenderStreet",
new String[]
@@ -439,7 +439,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.reslblSenderStreet_value, new Integer(113), new Integer(82), INTEGERS[3], new Short((short) 53), new Integer(68)
+ INTEGERS[8], resources.reslblSenderStreet_value, 113, 82, INTEGERS[3], new Short((short) 53), 68
});
lblPostCodeCity = insertLabel("lblPostCodeCity",
new String[]
@@ -448,16 +448,16 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.reslblPostCodeCity_value, new Integer(113), new Integer(97), INTEGERS[3], new Short((short) 54), new Integer(68)
+ INTEGERS[8], resources.reslblPostCodeCity_value, 113, 97, INTEGERS[3], new Short((short) 54), 68
});
lblTitle4 = insertLabel("lblTitle4",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor5, INTEGER_16, resources.reslblTitle4_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[3], new Short((short) 60), 212
});
Label1 = insertLabel("lblSenderFax",
new String[]
@@ -466,7 +466,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.resLabel1_value, new Integer(113), new Integer(111), INTEGERS[3], new Short((short) 68), new Integer(68)
+ INTEGERS[8], resources.resLabel1_value, 113, 111, INTEGERS[3], new Short((short) 68), 68
});
Label2 = insertLabel("Label2",
new String[]
@@ -475,7 +475,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.resLabel2_value, new Integer(97), new Integer(137), INTEGERS[3], new Short((short) 69), new Integer(136)
+ INTEGERS[8], resources.resLabel2_value, 97, 137, INTEGERS[3], new Short((short) 69), 136
});
}
@@ -488,7 +488,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- new Integer(47), TXTFOOTER_HID, Boolean.TRUE, new Integer(97), INTEGER_40, INTEGERS[4], new Short((short) 25), new Integer(203)
+ 47, TXTFOOTER_HID, Boolean.TRUE, 97, INTEGER_40, INTEGERS[4], new Short((short) 25), 203
});
chkFooterNextPages = insertCheckBox("chkFooterNextPages", CHKFOOTERNEXTPAGES_ITEM_CHANGED,
new String[]
@@ -497,7 +497,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ INTEGERS[8], CHKFOOTERNEXTPAGES_HID, resources.reschkFooterNextPages_value, 97, 92, new Short((short) 0), INTEGERS[4], new Short((short) 26), 202
});
chkFooterPageNumbers = insertCheckBox("chkFooterPageNumbers", CHKFOOTERPAGENUMBERS_ITEM_CHANGED,
new String[]
@@ -506,25 +506,25 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ INTEGERS[8], CHKFOOTERPAGENUMBERS_HID, resources.reschkFooterPageNumbers_value, 97, 106, new Short((short) 0), INTEGERS[4], new Short((short) 27), 201
});
lblFooter = insertLabel("lblFooter",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- fontDescriptor4, INTEGERS[8], resources.reslblFooter_value, new Integer(97), new Integer(28), INTEGERS[4], new Short((short) 33), new Integer(116)
+ fontDescriptor4, INTEGERS[8], resources.reslblFooter_value, 97, 28, INTEGERS[4], new Short((short) 33), 116
});
lblTitle5 = insertLabel("lblTitle5",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor5, INTEGER_16, resources.reslblTitle5_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[4], new Short((short) 61), 212
});
}
@@ -537,12 +537,12 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGER_12, TXTTEMPLATENAME_HID, new Integer(202), new Integer(56), INTEGERS[5], new Short((short) 28), resources.restxtTemplateName_value, new Integer(100)
+ INTEGER_12, TXTTEMPLATENAME_HID, 202, 56, INTEGERS[5], new Short((short) 28), resources.restxtTemplateName_value, 100
});
/*
fileTemplatePath = insertFileControl("fileTemplatePath", FILETEMPLATEPATH_TEXT_CHANGED,
new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
- new Object[] { INTEGER_12,FILETEMPLATEPATH_HID,new Integer(172),new Integer(74),INTEGERS[5],new Short((short)29),new Integer(130)}
+ new Object[] { INTEGER_12,FILETEMPLATEPATH_HID,172,74,INTEGERS[5],new Short((short)29),130}
);
*/
optCreateFax = insertRadioButton("optCreateFax", OPTCREATEFAX_ITEM_CHANGED,
@@ -552,7 +552,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], OPTCREATEFAX_HID, resources.resoptCreateFax_value, new Integer(104), new Integer(111), INTEGERS[5], new Short((short) 30), new Integer(198)
+ INTEGERS[8], OPTCREATEFAX_HID, resources.resoptCreateFax_value, 104, 111, INTEGERS[5], new Short((short) 30), 198
});
optMakeChanges = insertRadioButton("optMakeChanges", OPTMAKECHANGES_ITEM_CHANGED,
new String[]
@@ -561,7 +561,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], OPTMAKECHANGES_HID, resources.resoptMakeChanges_value, new Integer(104), new Integer(123), INTEGERS[5], new Short((short) 31), new Integer(198)
+ INTEGERS[8], OPTMAKECHANGES_HID, resources.resoptMakeChanges_value, 104, 123, INTEGERS[5], new Short((short) 31), 198
});
lblFinalExplanation1 = insertLabel("lblFinalExplanation1",
new String[]
@@ -570,7 +570,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ 28, resources.reslblFinalExplanation1_value, Boolean.TRUE, 97, 28, INTEGERS[5], new Short((short) 34), 205
});
lblProceed = insertLabel("lblProceed",
new String[]
@@ -579,7 +579,7 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.reslblProceed_value, new Integer(97), new Integer(100), INTEGERS[5], new Short((short) 35), new Integer(204)
+ INTEGERS[8], resources.reslblProceed_value, 97, 100, INTEGERS[5], new Short((short) 35), 204
});
lblFinalExplanation2 = insertLabel("lblFinalExplanation2",
new String[]
@@ -588,16 +588,16 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
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)
+ 33, resources.reslblFinalExplanation2_value, Boolean.TRUE, 104, 145, INTEGERS[5], new Short((short) 36), 199
});
ImageControl2 = insertImage("ImageControl2",
new String[]
{
- "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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]
+ new Short((short) 0), INTEGERS[10], "private:resource/dbu/image/19205", 92, 145, Boolean.FALSE, INTEGERS[5], new Short((short) 47), INTEGERS[10]
});
lblTemplateName = insertLabel("lblTemplateName",
new String[]
@@ -606,22 +606,22 @@ public abstract class FaxWizardDialog extends WizardDialog implements FaxWizardD
},
new Object[]
{
- INTEGERS[8], resources.reslblTemplateName_value, new Integer(97), new Integer(58), INTEGERS[5], new Short((short) 57), new Integer(101)
+ INTEGERS[8], resources.reslblTemplateName_value, 97, 58, INTEGERS[5], new Short((short) 57), 101
});
/*
lblTemplatePath = insertLabel("lblTemplatePath",
new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
- new Object[] { INTEGERS[8],resources.reslblTemplatePath_value,new Integer(97),new Integer(77),INTEGERS[5],new Short((short)58),new Integer(71)}
+ new Object[] { INTEGERS[8],resources.reslblTemplatePath_value,97,77,INTEGERS[5],new Short((short)58),71}
);
*/
lblTitle6 = insertLabel("lblTitle6",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor5, INTEGER_16, resources.reslblTitle6_value, Boolean.TRUE, 91, INTEGERS[8], INTEGERS[5], new Short((short) 62), 212
});
}
diff --git a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
index 8ee9f0472c57..8f9cf8107c7f 100644
--- a/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
+++ b/wizards/com/sun/star/wizards/fax/FaxWizardDialogImpl.java
@@ -162,13 +162,13 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
//update the dialog UI according to the loaded Configuration
updateUI();
- if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING))
{
myPathSelection.initializePath();
}
XWindow xContainerWindow = myFaxDoc.xFrame.getContainerWindow();
- XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
+ XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
createWindowPeer(xWindowPeer);
//add the Roadmap to the dialog:
@@ -198,8 +198,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
removeTerminateListener();
exception.printStackTrace(System.out);
running = false;
- return;
- }
+ }
}
public void cancelWizard()
@@ -217,7 +216,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
//myFaxDoc.xTextDocument.lockControllers();
FileAccess fileAccess = new FileAccess(xMSF);
sPath = myPathSelection.getSelectedPath();
- if (sPath.equals(""))
+ if (sPath.equals(PropertyNames.EMPTY_STRING))
{
myPathSelection.triggerPathPicker();
sPath = myPathSelection.getSelectedPath();
@@ -250,7 +249,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
if (bSaveSuccess)
{
saveConfiguration();
- XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
+ XInteractionHandler xIH = 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";
@@ -275,7 +274,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
}
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);
+ XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
ViewHandler myViewHandler = new ViewHandler(xDocMSF, xTextDocument);
myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.OPTIMAL));
}
@@ -301,7 +300,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
try
{
//xComponent.dispose();
- XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myFaxDoc.xFrame);
+ XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, myFaxDoc.xFrame);
xCloseable.close(false);
}
catch (CloseVetoException e)
@@ -352,11 +351,11 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
try
{
Object oGS = xMSF.createInstance("com.sun.star.graphic.GraphicProvider");
- XGraphicProvider xGraphicProvider = (XGraphicProvider) UnoRuntime.queryInterface(XGraphicProvider.class, oGS);
+ XGraphicProvider xGraphicProvider = UnoRuntime.queryInterface(XGraphicProvider.class, oGS);
PropertyValue GraphicValues[] = new PropertyValue[1];
GraphicValues[0] = new PropertyValue();
- GraphicValues[0].Name = "URL";
+ GraphicValues[0].Name = PropertyNames.URL;
GraphicValues[0].Value = "private:resource/svx/imagelist/18000/18022";
XGraphic xGraphic = xGraphicProvider.queryGraphic(GraphicValues);
@@ -380,7 +379,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
try
{
sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
- sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", "");
+ sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap");
}
catch (NoValidPathException e)
@@ -395,19 +394,19 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
{
String sFaxSubPath = "/wizard/fax";
sFaxPath = FileAccess.combinePaths(xMSF, sTemplatePath, sFaxSubPath);
- sWorkPath = FileAccess.getOfficePath(xMSF, "Work", "", "");
+ sWorkPath = FileAccess.getOfficePath(xMSF, "Work", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
BusinessFiles = FileAccess.getFolderTitles(xMSF, "bus", sFaxPath);
PrivateFiles = FileAccess.getFolderTitles(xMSF, "pri", sFaxPath);
- setControlProperty("lstBusinessStyle", "StringItemList", BusinessFiles[0]);
- setControlProperty("lstPrivateStyle", "StringItemList", PrivateFiles[0]);
+ setControlProperty("lstBusinessStyle", PropertyNames.STRING_ITEM_LIST, BusinessFiles[0]);
+ setControlProperty("lstPrivateStyle", PropertyNames.STRING_ITEM_LIST, PrivateFiles[0]);
- setControlProperty("lstBusinessStyle", "SelectedItems", new short[]
+ setControlProperty("lstBusinessStyle", PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
- setControlProperty("lstPrivateStyle", "SelectedItems", new short[]
+ setControlProperty("lstPrivateStyle", PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
@@ -424,42 +423,42 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
public void initializeElements()
{
- setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, new Boolean(myFaxDoc.hasElement("Company Logo")));
- setControlProperty("chkUseSubject", PropertyNames.PROPERTY_ENABLED, new Boolean(myFaxDoc.hasElement("Subject Line")));
- setControlProperty("chkUseDate", PropertyNames.PROPERTY_ENABLED, new Boolean(myFaxDoc.hasElement("Date")));
+ setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myFaxDoc.hasElement("Company Logo")));
+ setControlProperty("chkUseSubject", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myFaxDoc.hasElement("Subject Line")));
+ setControlProperty("chkUseDate", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myFaxDoc.hasElement("Date")));
myFaxDoc.updateDateFields();
}
public void initializeSalutation()
{
- setControlProperty("lstSalutation", "StringItemList", resources.SalutationLabels);
+ setControlProperty("lstSalutation", PropertyNames.STRING_ITEM_LIST, resources.SalutationLabels);
}
public void initializeGreeting()
{
- setControlProperty("lstGreeting", "StringItemList", resources.GreetingLabels);
+ setControlProperty("lstGreeting", PropertyNames.STRING_ITEM_LIST, resources.GreetingLabels);
}
public void initializeCommunication()
{
- setControlProperty("lstCommunicationType", "StringItemList", resources.CommunicationLabels);
+ setControlProperty("lstCommunicationType", PropertyNames.STRING_ITEM_LIST, resources.CommunicationLabels);
}
private void setDefaultForGreetingAndSalutationAndCommunication()
{
XTextComponent xTextComponent;
- xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
- if (xTextComponent.getText().equals(""))
+ xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING))
{
xTextComponent.setText(resources.SalutationLabels[0]);
}
- xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
- if (xTextComponent.getText().equals(""))
+ xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING))
{
xTextComponent.setText(resources.GreetingLabels[0]);
}
- xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
- if (xTextComponent.getText().equals(""))
+ xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
+ if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING))
{
xTextComponent.setText(resources.CommunicationLabels[0]);
}
@@ -590,7 +589,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
public void txtTemplateNameTextChanged()
{
- XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
XDocumentProperties xDocProps = xDocPropsSuppl.getDocumentProperties();
String TitleName = txtTemplateName.getText();
xDocProps.setTitle(TitleName);
@@ -769,7 +768,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
//enable/disable roadmap item for footer page
XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER);
- Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bFooterPossible));
+ Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bFooterPossible));
}
catch (Exception exception)
@@ -795,14 +794,14 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
public void chkUseSalutationItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
myFaxDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
- setControlProperty("lstSalutation", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseSalutation.getState() != 0));
+ setControlProperty("lstSalutation", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseSalutation.getState() != 0));
}
public void lstSalutationItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
myFaxDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
}
@@ -812,14 +811,14 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
public void chkUseCommunicationItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
myFaxDoc.switchUserField("CommunicationType", xTextComponent.getText(), (chkUseCommunicationType.getState() != 0));
- setControlProperty("lstCommunicationType", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseCommunicationType.getState() != 0));
+ setControlProperty("lstCommunicationType", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseCommunicationType.getState() != 0));
}
public void lstCommunicationItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstCommunicationType);
myFaxDoc.switchUserField("CommunicationType", xTextComponent.getText(), (chkUseCommunicationType.getState() != 0));
}
@@ -829,14 +828,14 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
public void chkUseGreetingItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
myFaxDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
- setControlProperty("lstGreeting", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseGreeting.getState() != 0));
+ setControlProperty("lstGreeting", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseGreeting.getState() != 0));
}
public void lstGreetingItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
myFaxDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
}
@@ -846,7 +845,7 @@ public class FaxWizardDialogImpl extends FaxWizardDialog
private void setPossibleFooter(boolean bState)
{
- setControlProperty("chkUseFooter", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
+ setControlProperty("chkUseFooter", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
if (!bState)
{
chkUseFooter.setState((short) 0);
diff --git a/wizards/com/sun/star/wizards/form/CallFormWizard.java b/wizards/com/sun/star/wizards/form/CallFormWizard.java
index 0538eb5fa1b3..543a521c6ce7 100644
--- a/wizards/com/sun/star/wizards/form/CallFormWizard.java
+++ b/wizards/com/sun/star/wizards/form/CallFormWizard.java
@@ -29,6 +29,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>).
@@ -81,7 +82,7 @@ public class CallFormWizard
{
try
{
- if (sEvent.compareTo("start") == 0)
+ if (sEvent.compareTo(PropertyNames.START) == 0)
{
FormWizard CurFormWizard = new FormWizard( m_serviceFactory, m_wizardContext );
CurFormWizard.startFormWizard();
@@ -159,7 +160,7 @@ public class CallFormWizard
try
{
- byteReturn = new String("" + this.hashCode()).getBytes();
+ byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
}
catch (Exception exception)
{
diff --git a/wizards/com/sun/star/wizards/form/DataEntrySetter.java b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
index ae042fa7de76..9a5624f627c5 100644
--- a/wizards/com/sun/star/wizards/form/DataEntrySetter.java
+++ b/wizards/com/sun/star/wizards/form/DataEntrySetter.java
@@ -66,7 +66,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTNEWDATAONLY", sNewDataOnly, new Integer(98), new Integer(25), IDataStep, new Short(curtabindex++), new Integer(195)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTNEWDATAONLY", sNewDataOnly, 98, 25, IDataStep, new Short(curtabindex++), 195
});
optDisplayAllData = CurUnoDialog.insertRadioButton("optDisplayAllData", "toggleCheckBoxes", this,
@@ -76,7 +76,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTDISPLAYALLDATA", sDisplayAllData, new Integer(98), new Integer(50), new Short((short) 1), IDataStep, new Short(curtabindex++), new Integer(197)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTDISPLAYALLDATA", sDisplayAllData, 98, 50, new Short((short) 1), IDataStep, new Short(curtabindex++), 197
});
chknomodification = CurUnoDialog.insertCheckBox("chknomodification", null,
new String[]
@@ -85,7 +85,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOMODIFICATION", sNoModification, new Integer(108), new Integer(62), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(189)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOMODIFICATION", sNoModification, 108, 62, new Short((short) 0), IDataStep, new Short(curtabindex++), 189
});
chknodeletion = CurUnoDialog.insertCheckBox("chknodeletion", null,
new String[]
@@ -94,7 +94,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNODELETION", sNoDeletion, new Integer(108), new Integer(74), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(189)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNODELETION", sNoDeletion, 108, 74, new Short((short) 0), IDataStep, new Short(curtabindex++), 189
});
chknoaddition = CurUnoDialog.insertCheckBox("chknoaddition", null,
new String[]
@@ -103,7 +103,7 @@ public class DataEntrySetter
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOADDITION", sNoAddition, new Integer(108), new Integer(86), new Short((short) 0), IDataStep, new Short(curtabindex++), new Integer(191)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKNOADDITION", sNoAddition, 108, 86, new Short((short) 0), IDataStep, new Short(curtabindex++), 191
});
CurUnoDialog.insertLabel("lbldontdisplayExistingData",
new String[]
@@ -112,7 +112,7 @@ public class DataEntrySetter
},
new Object[]
{
- new Integer(8), sdontdisplayExistingData, new Integer(108), new Integer(33), IDataStep, new Short(curtabindex++), new Integer(134)
+ 8, sdontdisplayExistingData, 108, 33, IDataStep, new Short(curtabindex++), 134
});
}
@@ -125,14 +125,14 @@ public class DataEntrySetter
boolean bAllowUpdates = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_STATE)).shortValue()) != 1;
boolean bAllowDeletes = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_STATE)).shortValue()) != 1;
boolean bAllowInserts = (((Short) Helper.getUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_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));
+ retProperties[0] = Properties.createProperty("AllowUpdates", Boolean.valueOf(bAllowUpdates));
+ retProperties[1] = Properties.createProperty("AllowDeletes", Boolean.valueOf(bAllowDeletes));
+ retProperties[2] = Properties.createProperty("AllowInserts", Boolean.valueOf(bAllowInserts));
}
else
{
retProperties = new PropertyValue[1];
- retProperties[0] = Properties.createProperty("IgnoreResult", new Boolean(true));
+ retProperties[0] = Properties.createProperty("IgnoreResult", Boolean.TRUE);
}
return retProperties;
@@ -141,8 +141,8 @@ public class DataEntrySetter
public void toggleCheckBoxes()
{
boolean bdisplayalldata = optDisplayAllData.getState();
- Helper.setUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_ENABLED, new Boolean(bdisplayalldata));
- Helper.setUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_ENABLED, new Boolean(bdisplayalldata));
- Helper.setUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_ENABLED, new Boolean(bdisplayalldata));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chknomodification), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chknodeletion), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chknoaddition), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdisplayalldata));
}
}
diff --git a/wizards/com/sun/star/wizards/form/FieldLinker.java b/wizards/com/sun/star/wizards/form/FieldLinker.java
index b0fecf192bb8..146173ec9097 100644
--- a/wizards/com/sun/star/wizards/form/FieldLinker.java
+++ b/wizards/com/sun/star/wizards/form/FieldLinker.java
@@ -48,18 +48,9 @@ public class FieldLinker extends DBLimitedFieldSelection
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)
{
@@ -76,31 +67,31 @@ public class FieldLinker extends DBLimitedFieldSelection
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);
+ int SOFIRSTLINKLST = 0;
+ int SOSECLINKLST = 1;
+ int SOTHIRDLINKLST = 2;
+ int SOFOURTHLINKLST = 3;
+ Integer IListBoxPosX = new Integer(iCompPosX + 6);
+ sSlaveListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 20, 4); //new String[rowcount];PropertyNames.EMPTY_STRING; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
+ sMasterListHeader = CurUnoDialog.m_oResource.getResArray(UIConsts.RID_FORM + 24, 4);// new String[rowcount];PropertyNames.EMPTY_STRING; //CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 40);
SOLINKLST = new int[]
{
- SOFIRSTLINKLST, SOSECLINKLST, SOTHIRDLINKLST, SOFOURTHLINKLST
+ SOFIRSTLINKLST, SOSECLINKLST, SOTHIRDLINKLST, SOFOURTHLINKLST
};
}
- sSlaveHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2));
- sMasterHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2) + 1);
+ String sSlaveHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2));
+ String sMasterHidString = HelpIds.getHelpIdString(FirstHelpIndex + (i * 2) + 1);
boolean bDoEnable = (i < 2);
- lblSlaveFields[i] = CurUnoDialog.insertLabel("lblSlaveFieldLink" + new Integer(i + 1).toString(),
+ lblSlaveFields[i] = CurUnoDialog.insertLabel("lblSlaveFieldLink" + Integer.toString(i + 1),
new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Boolean(bDoEnable), new Integer(8), sSlaveListHeader[i], new Integer(97), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97)
+ Boolean.valueOf(bDoEnable), 8, sSlaveListHeader[i], 97, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97
});
- lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(),
+ lstSlaveFields[i] = CurUnoDialog.insertListBox("lstSlaveFieldLink" + (i + 1), SOLINKLST[i], null, new ItemListenerImpl(),
new String[]
{
"Dropdown",
@@ -117,28 +108,28 @@ public class FieldLinker extends DBLimitedFieldSelection
new Object[]
{
Boolean.TRUE,
- new Boolean(bDoEnable),
+ Boolean.valueOf(bDoEnable),
UIConsts.INTEGER_12,
- sSlaveHidString,
+ sSlaveHidString,
Short.valueOf(UnoDialog.getListBoxLineCount()),
- new Integer(97),
+ 97,
new Integer(iCurPosY + 10),
IStep,
new Short(curtabindex++),
- new Integer(97)
+ 97
});
- lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + new Integer(i + 1).toString(),
+ lblMasterFields[i] = CurUnoDialog.insertLabel("lblMasterFieldLink" + Integer.toString(i + 1),
new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Boolean(bDoEnable), new Integer(8), sMasterListHeader[i], new Integer(206), new Integer(iCurPosY), IStep, new Short(curtabindex++), new Integer(97)
+ Boolean.valueOf(bDoEnable), 8, sMasterListHeader[i], 206, new Integer(iCurPosY), IStep, new Short(curtabindex++), 97
});
- lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + new Integer(i + 1).toString(), SOLINKLST[i], null, new ItemListenerImpl(),
+ lstMasterFields[i] = CurUnoDialog.insertListBox("lstMasterFieldLink" + Integer.toString(i + 1), SOLINKLST[i], null, new ItemListenerImpl(),
new String[]
{
"Dropdown",
@@ -155,15 +146,15 @@ public class FieldLinker extends DBLimitedFieldSelection
new Object[]
{
Boolean.TRUE,
- new Boolean(bDoEnable),
+ Boolean.valueOf(bDoEnable),
UIConsts.INTEGER_12,
- sMasterHidString,
+ sMasterHidString,
Short.valueOf(UnoDialog.getListBoxLineCount()),
- new Integer(206),
+ 206,
new Integer(iCurPosY + 10),
IStep,
new Short(curtabindex++),
- new Integer(97)
+ 97
});
iCurPosY = iCurPosY + 38;
}
@@ -206,14 +197,14 @@ public class FieldLinker extends DBLimitedFieldSelection
{
if (i < rowcount)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(lblSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(lblMasterFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
- if (bDoEnable == false)
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lblSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lblMasterFields[i]), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable));
+ if (!bDoEnable)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), "SelectedItems", new short[] { 0 });
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), "SelectedItems", new short[] { 0 });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[i]), PropertyNames.SELECTED_ITEMS, new short[] { 0 });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[i]), PropertyNames.SELECTED_ITEMS, new short[] { 0 });
}
}
}
@@ -225,11 +216,11 @@ public class FieldLinker extends DBLimitedFieldSelection
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]), PropertyNames.SELECTED_ITEMS, new short[] {iNextMasterItemPos });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex]), PropertyNames.SELECTED_ITEMS, new short[] {iNextSlaveItemPos});
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), "SelectedItems", new short[] { 0 });
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), "SelectedItems", new short[] { 0 });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstMasterFields[curindex + 1]), PropertyNames.SELECTED_ITEMS, new short[] { 0 });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSlaveFields[curindex + 1]), PropertyNames.SELECTED_ITEMS, new short[] { 0 });
toggleControlRow(curindex, true);
}
}
@@ -238,7 +229,9 @@ public class FieldLinker extends DBLimitedFieldSelection
{
// short[] MasterSelList = null;
// short[] SlaveSelList = null;
+ int SOMASTERINDEX = 1;
String[] MasterLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOMASTERINDEX);
+ int SOSLAVEINDEX = 0;
String[] SlaveLinkNames = JavaTools.ArrayOutOfMultiDimArray(_LinkFieldNames, SOSLAVEINDEX);
String[] ViewMasterFieldNames = addNoneFieldItemToList(_AllMasterFieldNames); // add '-undefiened-'
String[] ViewSlaveFieldNames = addNoneFieldItemToList(_AllSlaveFieldNames);
diff --git a/wizards/com/sun/star/wizards/form/Finalizer.java b/wizards/com/sun/star/wizards/form/Finalizer.java
index c5f12728e527..7cd25f012cd6 100644
--- a/wizards/com/sun/star/wizards/form/Finalizer.java
+++ b/wizards/com/sun/star/wizards/form/Finalizer.java
@@ -64,7 +64,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], slblFormName, new Integer(97), new Integer(25), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(111)
+ UIConsts.INTEGERS[8], slblFormName, 97, 25, UIConsts.INTEGERS[8], new Short(curtabindex++), 111
});
txtFormName = CurUnoDialog.insertTextField("txtFormName", "toggleFinishButton", this,
new String[]
@@ -73,7 +73,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", new Integer(97), new Integer(35), UIConsts.INTEGERS[8], new Short((short) 82), "", new Integer(185)
+ UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", 97, 35, UIConsts.INTEGERS[8], new Short((short) 82), PropertyNames.EMPTY_STRING, 185
});
CurUnoDialog.insertLabel("lblProceed",
new String[]
@@ -82,7 +82,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(62), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(185)
+ UIConsts.INTEGERS[8], slblProceed, 97, 62, UIConsts.INTEGERS[8], new Short(curtabindex++), 185
});
CurUnoDialog.insertRadioButton("optWorkWithForm", null,
new String[]
@@ -91,7 +91,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm, new Integer(101), new Integer(77), new Short((short) 1), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm, 101, 77, new Short((short) 1), UIConsts.INTEGERS[8], new Short(curtabindex++), 107
});
optModifyForm = CurUnoDialog.insertRadioButton("optModifyForm", null,
new String[]
@@ -100,7 +100,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", sModifyForm, new Integer(101), new Integer(89), UIConsts.INTEGERS[8], new Short(curtabindex++), new Integer(107)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", sModifyForm, 101, 89, UIConsts.INTEGERS[8], new Short(curtabindex++), 107
});
}
@@ -128,7 +128,7 @@ public class Finalizer
public boolean getOpenForEditing()
{
- return optModifyForm.getState() ? true : false;
+ return optModifyForm.getState();
}
public boolean finish()
diff --git a/wizards/com/sun/star/wizards/form/FormConfiguration.java b/wizards/com/sun/star/wizards/form/FormConfiguration.java
index 9c18ab47d79d..7d7425985f83 100644
--- a/wizards/com/sun/star/wizards/form/FormConfiguration.java
+++ b/wizards/com/sun/star/wizards/form/FormConfiguration.java
@@ -83,7 +83,7 @@ public class FormConfiguration
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKCREATESUBFORM", sSelectManually, new Integer(97), new Integer(26), ISubFormStep, new Short(curtabindex++), new Integer(160)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_CHKCREATESUBFORM", sSelectManually, 97, 26, ISubFormStep, new Short(curtabindex++), 160
});
optOnExistingRelation = CurUnoDialog.insertRadioButton("optOnExistingRelation", STOGGLESTEPS, this,
new String[]
@@ -92,7 +92,7 @@ public class FormConfiguration
},
new Object[]
{
- Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", sOnExistingRelation, new Integer(107), new Integer(43), ISubFormStep, new Short(curtabindex++), new Integer(160)
+ Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTONEXISTINGRELATION", sOnExistingRelation, 107, 43, ISubFormStep, new Short(curtabindex++), 160
});
optSelectManually = CurUnoDialog.insertRadioButton("optSelectManually", STOGGLESTEPS, this,
new String[]
@@ -101,7 +101,7 @@ public class FormConfiguration
},
new Object[]
{
- Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTSELECTMANUALLY", sOnManualRelation, new Integer(107), new Integer(99), new Short((short) 1), ISubFormStep, new Short(curtabindex++), new Integer(160)
+ Boolean.FALSE, UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTSELECTMANUALLY", sOnManualRelation, 107, 99, new Short((short) 1), ISubFormStep, new Short(curtabindex++), 160
});
lblRelations = CurUnoDialog.insertLabel("lblSelectRelation",
new String[]
@@ -110,7 +110,7 @@ public class FormConfiguration
},
new Object[]
{
- Boolean.FALSE, new Integer(19), sSelectRelation, Boolean.TRUE, new Integer(119), new Integer(56), ISubFormStep, new Short(curtabindex++), new Integer(80)
+ Boolean.FALSE, 19, sSelectRelation, Boolean.TRUE, 119, 56, ISubFormStep, new Short(curtabindex++), 80
});
lstRelations = CurUnoDialog.insertListBox("lstrelations", SONEXISTINGRELATIONSELECTION, SONEXISTINGRELATIONSELECTION, this,
new String[]
@@ -119,7 +119,7 @@ public class FormConfiguration
},
new Object[]
{
- Boolean.FALSE, new Integer(37), "HID:WIZARDS_HID_DLGFORM_lstRELATIONS", new Integer(201), new Integer(55), ISubFormStep, new Short(curtabindex++), new Integer(103)
+ Boolean.FALSE, 37, "HID:WIZARDS_HID_DLGFORM_lstRELATIONS", 201, 55, ISubFormStep, new Short(curtabindex++), 103
});
lblSubFormDescription = CurUnoDialog.insertLabel("lblSubFormDescription",
new String[]
@@ -128,7 +128,7 @@ public class FormConfiguration
},
new Object[]
{
- new Integer(59), sSubFormDescription, Boolean.TRUE, new Integer(110), new Integer(120), ISubFormStep, new Short(curtabindex++), new Integer(190)
+ 59, sSubFormDescription, Boolean.TRUE, 110, 120, ISubFormStep, new Short(curtabindex++), 190
});
CurUnoDialog.insertInfoImage(97, 120, ISubFormStep.intValue());
}
@@ -151,8 +151,8 @@ public class FormConfiguration
public void toggleSubFormMode()
{
boolean bdoEnable = (this.chkcreateSubForm.getState() == 1);
- Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable && bsupportsRelations));
- Helper.setUnoPropertyValue(UnoDialog.getModel(optSelectManually), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable && bsupportsRelations));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optSelectManually), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable));
toggleSteps();
}
@@ -161,10 +161,10 @@ public class FormConfiguration
oRelationController = _oRelationController;
sreferencedTables = oRelationController.getExportedKeys();
bsupportsRelations = (sreferencedTables.length > 0);
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), "StringItemList", sreferencedTables);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), PropertyNames.STRING_ITEM_LIST, sreferencedTables);
this.CurSubFormFieldSelection = _CurSubFormFieldSelection;
toggleRelationsListbox();
- Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, new Boolean(bsupportsRelations && (chkcreateSubForm.getState() == 1)));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optOnExistingRelation), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bsupportsRelations && (chkcreateSubForm.getState() == 1)));
}
public void toggleSteps()
@@ -195,7 +195,7 @@ public class FormConfiguration
{
if (areexistingRelationsdefined())
{
- short[] iselected = (short[]) Helper.getUnoArrayPropertyValue(UnoDialog.getModel(lstRelations), "SelectedItems");
+ short[] iselected = (short[]) Helper.getUnoArrayPropertyValue(UnoDialog.getModel(lstRelations), PropertyNames.SELECTED_ITEMS);
if (iselected != null)
{
if (iselected.length > 0)
@@ -204,7 +204,7 @@ public class FormConfiguration
}
}
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public void onexistingRelationSelection()
@@ -231,8 +231,8 @@ public class FormConfiguration
private void toggleRelationsListbox()
{
boolean bdoenable = bsupportsRelations && this.optOnExistingRelation.getState() && (chkcreateSubForm.getState() == 1);
- Helper.setUnoPropertyValue(UnoDialog.getModel(lblRelations), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lblRelations), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstRelations), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable));
}
public boolean hasSubForm()
diff --git a/wizards/com/sun/star/wizards/form/FormControlArranger.java b/wizards/com/sun/star/wizards/form/FormControlArranger.java
index f5478525eab1..a87478f5690a 100644
--- a/wizards/com/sun/star/wizards/form/FormControlArranger.java
+++ b/wizards/com/sun/star/wizards/form/FormControlArranger.java
@@ -47,14 +47,13 @@ import com.sun.star.wizards.document.TimeStampControl;
public class FormControlArranger
{
+ public static final String LABELCONTROL = "LabelControl";
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;
@@ -68,23 +67,23 @@ public class FormControlArranger
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 m_currentLabelPosX;
+ private int m_currentLabelPosY;
+ private int m_currentControlPosX;
+ private int m_currentControlPosY;
+ private int m_LabelHeight;
+ private int m_LabelWidth;
+ private int m_dbControlHeight;
+ private int m_dbControlWidth;
+ private int m_MaxLabelWidth;
private int nFormWidth;
private int nFormHeight;
- private int nMaxRowY;
+ private int m_currentMaxRowHeight;
private int nSecMaxRowY;
- private int nMaxColRightX;
+ private int m_maxPostionX;
private int a;
private int StartA;
- private int nMaxDBYPos = 0; //the maximum YPosition of a DBControl in the form
+ private int m_controlMaxPosY = 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)
@@ -102,14 +101,13 @@ public class FormControlArranger
}
// 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)
+ final DatabaseControl curDBControl = DBControlList[_index];
+ if (curDBControl != null && curDBControl.getControlType() == FormHandler.SOCHECKBOX)
{
- if (curDBControl.getControlType() == FormHandler.SOCHECKBOX)
- {
- return getCheckBoxDiffHeight(_index);
- }
+ return getCheckBoxDiffHeight(_index);
}
return oFormHandler.getBasicLabelDiffHeight();
}
@@ -126,20 +124,17 @@ public class FormControlArranger
private int getCheckBoxDiffHeight(int LastIndex)
{
- if ((LastIndex < DBControlList.length))
+ if (LastIndex < DBControlList.length && DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX)
{
- if (DBControlList[LastIndex].getControlType() == FormHandler.SOCHECKBOX)
- {
- return (int) ((oFormHandler.getControlReferenceHeight() - DBControlList[LastIndex].getControlHeight()) / 2);
- }
+ return (oFormHandler.getControlReferenceHeight() - DBControlList[LastIndex].getControlHeight()) / 2;
}
return 0;
}
- private boolean isReducable(int _index)
+ private boolean isReducable(int _index, int i_labelWidth, int i_dbControlWidth)
{
boolean bisreducable = false;
- int ntype = this.FieldColumns[_index].getFieldType();
+ int ntype = FieldColumns[_index].getFieldType();
switch (ntype)
{
case DataType.TINYINT:
@@ -178,7 +173,7 @@ public class FormControlArranger
default:
bisreducable = true;
}
- if (nTCWidth > 0.9 * CMAXREDUCTION * nDBWidth)
+ if (bisreducable && i_labelWidth > 0.9 * CMAXREDUCTION * i_dbControlWidth)
{
bisreducable = false;
}
@@ -187,62 +182,54 @@ public class FormControlArranger
private int getControlGroupWidth()
{
- if (nDBWidth > nTCWidth)
+ if (m_dbControlWidth > m_LabelWidth)
{
- return nDBWidth;
+ return m_dbControlWidth;
}
else
{
- return nTCWidth;
+ return m_LabelWidth;
}
}
private void checkJustifiedPosition(int a)
{
int nBaseWidth = nFormWidth + cXOffset;
- int nLeftDist = nMaxColRightX - nBaseWidth;
- int nRightDist = nBaseWidth - (DBControlList[a].getPosition().X - this.cHoriDistance);
+ int nLeftDist = m_maxPostionX - nBaseWidth;
+ int nRightDist = nBaseWidth - (DBControlList[a].getPosition().X - 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;
+ m_currentLabelPosY = m_currentMaxRowHeight + cVertDistance;
+ m_currentControlPosY = m_currentLabelPosY + m_LabelHeight;
+ m_currentLabelPosX = cXOffset;
+ m_currentControlPosX = cXOffset;
bIsFirstRun = true;
StartA = a + 1;
}
else
{
// FieldWidths in the line can be made wider...
- if (nYDBPos + nDBHeight == nMaxRowY)
+ if (m_currentControlPosY + m_dbControlHeight == m_currentMaxRowHeight)
{
// The last Control was the highest in the row
- nYTCPos = nSecMaxRowY + cVertDistance;
+ m_currentLabelPosY = nSecMaxRowY;
}
else
{
- nYTCPos = nMaxRowY + cVertDistance;
+ m_currentLabelPosY = m_currentMaxRowHeight;
}
- nYDBPos = nYTCPos + nTCHeight;
- nXDBPos = cXOffset;
- nXTCPos = cXOffset;
- this.LabelControlList[a].setPosition(new Point(cXOffset, nYTCPos));
- this.DBControlList[a].setPosition(new Point(cXOffset, nYDBPos));
+ m_currentLabelPosY += cVertDistance;
+ m_currentControlPosY = m_currentLabelPosY + m_LabelHeight;
+ m_currentControlPosX = cXOffset;
+ m_currentLabelPosX = cXOffset;
+ LabelControlList[a].setPosition(new Point(cXOffset, m_currentLabelPosY));
+ DBControlList[a].setPosition(new Point(cXOffset, m_currentControlPosY));
bIsFirstRun = true;
- if (nDBWidth > nTCWidth)
- {
- checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
- }
- else
- {
- checkOuterPoints(nXDBPos, nTCWidth, nYDBPos, nDBHeight, true);
- }
- nXTCPos = nMaxColRightX + cHoriDistance;
- nXDBPos = nXTCPos;
+ checkOuterPoints(m_currentControlPosX, m_dbControlWidth > m_LabelWidth ? m_dbControlWidth : m_LabelWidth, m_currentControlPosY, m_dbControlHeight, true);
+ m_currentLabelPosX = m_maxPostionX + cHoriDistance;
+ m_currentControlPosX = m_currentLabelPosX;
adjustLineWidth(StartA, a - 1, nRightDist, 1);
StartA = a;
}
@@ -278,42 +265,44 @@ public class FormControlArranger
for (int i = StartIndex; i <= EndIndex; i++)
{
int nControlBaseWidth = 0;
- curDBControl = this.DBControlList[i];
- Control curLabelControl = this.LabelControlList[i];
+ DatabaseControl dbControl = DBControlList[i];
+ Control curLabelControl = LabelControlList[i];
if (i != StartIndex)
{
curLabelControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y));
- curDBControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + nTCHeight));
+ dbControl.setPosition(new Point(iLocTCPosX, curLabelControl.getPosition().Y + m_LabelHeight));
}
- if (((curLabelControl.getSize().Width > curDBControl.getSize().Width)) && (WidthFactor > 0))
+ final Size labelSize = curLabelControl.getSize();
+ Size controlSize = dbControl.getSize();
+ if (((labelSize.Width > controlSize.Width)) && (WidthFactor > 0))
{
- nControlBaseWidth = curLabelControl.getSize().Width;
+ nControlBaseWidth = labelSize.Width;
}
else
{
- nControlBaseWidth = curDBControl.getSize().Width;
+ nControlBaseWidth = controlSize.Width;
}
if (FieldColumns[i].getFieldType() == DataType.TIMESTAMP)
{
- TimeStampControl oDBTimeStampControl = (TimeStampControl) curDBControl;
+ TimeStampControl oDBTimeStampControl = (TimeStampControl) dbControl;
nControlBaseWidth = oDBTimeStampControl.getSize().Width;
- if (this.isReducable(i) || WidthFactor > 0)
- {
- oDBTimeStampControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, oDBTimeStampControl.getSize().Height));
- }
}
- else
+ if (WidthFactor > 0 || isReducable(i, labelSize.Width, controlSize.Width))
{
- if (this.isReducable(i) || WidthFactor > 0)
- {
- curDBControl.setSize(new Size(nControlBaseWidth + WidthFactor * CorrWidth, curDBControl.getSize().Height));
- }
+ controlSize.Width = nControlBaseWidth + WidthFactor * CorrWidth;
+ dbControl.setSize(controlSize);
+ controlSize = dbControl.getSize();
+ }
+
+ if (labelSize.Width > controlSize.Width)
+ {
+ iLocTCPosX += labelSize.Width;
}
- iLocTCPosX = curDBControl.getPosition().X + curDBControl.getSize().Width + cHoriDistance;
- if (curLabelControl.getSize().Width > curDBControl.getSize().Width)
+ else
{
- iLocTCPosX = curLabelControl.getPosition().X + curLabelControl.getSize().Width + cHoriDistance;
+ iLocTCPosX += controlSize.Width;
}
+ iLocTCPosX += cHoriDistance;
}
if (WidthFactor > 0)
{
@@ -325,43 +314,38 @@ public class FormControlArranger
}
}
- private void checkOuterPoints(int nXPos, int nWidth, int nYPos, int nHeight, boolean bIsDBField)
+ private void checkOuterPoints(int i_nXPos, int i_nWidth, int i_nYPos, int i_nHeight, boolean i_bIsDBField)
{
- int nColRightX;
- if (icurArrangement == FormWizard.SOTOPJUSTIFIED)
+ if (icurArrangement == FormWizard.IN_BLOCK_TOP && i_bIsDBField)
{
- if (bIsDBField)
+ // Only at DBControls you can measure the Value of nMaxRowY
+ if (bIsFirstRun)
{
- // Only at DBControls you can measure the Value of nMaxRowY
- if (bIsFirstRun)
- {
- nMaxRowY = nYPos + nHeight;
- nSecMaxRowY = nMaxRowY;
- }
- else
+ m_currentMaxRowHeight = i_nYPos + i_nHeight;
+ nSecMaxRowY = m_currentMaxRowHeight;
+ }
+ else
+ {
+ int nRowY = i_nYPos + i_nHeight;
+ if (nRowY >= m_currentMaxRowHeight)
{
- int nRowY = nYPos + nHeight;
- if (nRowY >= nMaxRowY)
- {
- int nOldMaxRowY = nMaxRowY;
- nSecMaxRowY = nOldMaxRowY;
- nMaxRowY = nRowY;
- }
+ nSecMaxRowY = m_currentMaxRowHeight;
+ m_currentMaxRowHeight = nRowY;
}
}
}
// Find the outer right point
if (bIsFirstRun)
{
- nMaxColRightX = nXPos + nWidth;
+ m_maxPostionX = i_nXPos + i_nWidth;
bIsFirstRun = false;
}
else
{
- nColRightX = nXPos + nWidth;
- if (nColRightX > nMaxColRightX)
+ int nColRightX = i_nXPos + i_nWidth;
+ if (nColRightX > m_maxPostionX)
{
- nMaxColRightX = nColRightX;
+ m_maxPostionX = nColRightX;
}
}
}
@@ -370,16 +354,16 @@ public class FormControlArranger
{
try
{
- this.NBorderType = _NBorderType;
- this.setStartPoint(_aStartPoint);
+ NBorderType = _NBorderType;
+ setStartPoint(_aStartPoint);
icurArrangement = _icurArrangement;
initializePosSizes();
initializeControlColumn(-1);
bIsVeryFirstRun = true;
- nMaxRowY = 0;
+ m_currentMaxRowHeight = 0;
nSecMaxRowY = 0;
- this.nMaxColRightX = 0;
- xProgressBar.start("", FieldColumns.length);
+ m_maxPostionX = 0;
+ xProgressBar.start(PropertyNames.EMPTY_STRING, FieldColumns.length);
for (int i = 0; i < FieldColumns.length; i++)
{
try
@@ -387,13 +371,12 @@ public class FormControlArranger
insertLabel(i, _iAlign);
insertDBControl(i);
bIsVeryFirstRun = false;
- DBControlList[i].setPropertyValue("LabelControl", LabelControlList[i].xPropertySet);
+ DBControlList[i].setPropertyValue(LABELCONTROL, LabelControlList[i].xPropertySet);
resetPosSizes(i);
xProgressBar.setValue(i + 1);
}
catch (RuntimeException e)
{
- int dummy = 0;
}
}
xProgressBar.end();
@@ -426,19 +409,19 @@ public class FormControlArranger
private void resetPosSizes(int LastIndex)
{
- int nYRefPos = nYDBPos;
+ int nYRefPos = m_currentControlPosY;
switch (icurArrangement)
{
- case FormWizard.SOCOLUMNARLEFT:
- nYDBPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
- nYRefPos = nYDBPos;
- if ((nYDBPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1)))
+ case FormWizard.COLUMNAR_LEFT:
+ m_currentControlPosY = m_currentControlPosY + m_dbControlHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
+ nYRefPos = m_currentControlPosY;
+ if ((m_currentControlPosY > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1)))
{
repositionColumnarLeftControls(LastIndex);
- nXTCPos = nMaxColRightX + 2 * cHoriDistance;
- nXDBPos = nXTCPos + this.cLabelGap + nMaxTCWidth;
- nYDBPos = cYOffset;
- nYRefPos = nYDBPos;
+ m_currentLabelPosX = m_maxPostionX + 2 * cHoriDistance;
+ m_currentControlPosX = m_currentLabelPosX + cLabelGap + m_MaxLabelWidth;
+ m_currentControlPosY = cYOffset;
+ nYRefPos = m_currentControlPosY;
initializeControlColumn(LastIndex);
}
else
@@ -447,59 +430,63 @@ public class FormControlArranger
/* a += 1;*/
++a;
}
- nYTCPos = nYDBPos + this.getLabelDiffHeight(LastIndex);
- if ((nYRefPos + nDBHeight) > nMaxDBYPos)
+ m_currentLabelPosY = m_currentControlPosY + getLabelDiffHeight(LastIndex);
+ if ((nYRefPos + m_dbControlHeight) > m_controlMaxPosY)
{
- nMaxDBYPos = nYRefPos + nDBHeight;
+ m_controlMaxPosY = nYRefPos + m_dbControlHeight;
}
break;
- case FormWizard.SOCOLUMNARTOP:
- nYTCPos = nYDBPos + nDBHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
- ;
- if ((nYTCPos > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1)))
+ case FormWizard.COLUMNAR_TOP:
+ m_currentLabelPosY = m_currentControlPosY + m_dbControlHeight + cVertDistance + getCheckBoxDiffHeight(LastIndex);
+
+ if ((m_currentLabelPosY > cYOffset + nFormHeight) || (LastIndex == (FieldColumns.length - 1)))
{
- nXDBPos = nMaxColRightX + cHoriDistance;
- nXTCPos = nXDBPos;
- nYRefPos = nYDBPos;
- nYDBPos = cYOffset + nTCHeight + cVertDistance;
- nYTCPos = cYOffset;
+ m_currentControlPosX = m_maxPostionX + cHoriDistance;
+ m_currentLabelPosX = m_currentControlPosX;
+ nYRefPos = m_currentControlPosY;
+ m_currentControlPosY = cYOffset + m_LabelHeight + cVertDistance;
+ m_currentLabelPosY = cYOffset;
initializeControlColumn(LastIndex);
}
else
{
- a = a + 1;
+ ++a;
}
- if ((nYRefPos + nDBHeight + cVertDistance) > nMaxDBYPos)
+ if ((nYRefPos + m_dbControlHeight + cVertDistance) > m_controlMaxPosY)
{
- nMaxDBYPos = nYRefPos + nDBHeight + cVertDistance;
+ m_controlMaxPosY = nYRefPos + m_dbControlHeight + cVertDistance;
}
break;
- case FormWizard.SOTOPJUSTIFIED:
- if (this.isReducable(a))
+ case FormWizard.IN_BLOCK_TOP:
+ if (isReducable(a, m_LabelWidth, m_dbControlWidth))
{
- iReduceWidth = iReduceWidth + 1;
+ ++iReduceWidth;
}
- if (nMaxColRightX > cXOffset + nFormWidth)
+ //if (m_maxPostionX > (nFormWidth-cXOffset-cXOffset)) // cXOffset + nFormWidth
+ if (m_maxPostionX > cXOffset + nFormWidth)
{
- int nOldYTCPos = nYTCPos;
checkJustifiedPosition(a);
- nYRefPos = nYDBPos;
+ nYRefPos = m_currentControlPosY;
}
else
{
- nXTCPos = nMaxColRightX + cHoriDistance;
+ m_currentLabelPosX = m_maxPostionX + cHoriDistance;
+ }
+ if (a == FieldColumns.length - 1)
+ {
+ checkJustifiedPosition(a);
+ nYRefPos = m_currentControlPosY;
}
- a = a + 1;
- if ((nYRefPos + nDBHeight) > nMaxDBYPos)
+ m_currentControlPosX = m_currentLabelPosX;
+ ++a;
+ if ((nYRefPos + m_dbControlHeight) > m_controlMaxPosY)
{
- nMaxDBYPos = nYRefPos + nDBHeight;
+ m_controlMaxPosY = nYRefPos + m_dbControlHeight;
}
break;
}
-// if ((nYRefPos + nDBHeight) > nMaxDBYPos)
-// nMaxDBYPos = nYRefPos + nDBHeight;
}
private void repositionColumnarLeftControls(int LastIndex)
@@ -509,42 +496,41 @@ public class FormControlArranger
{
if (i == StartA)
{
- nXTCPos = LabelControlList[i].getPosition().X;
- nXDBPos = nXTCPos + nMaxTCWidth + cHoriDistance;
+ m_currentLabelPosX = LabelControlList[i].getPosition().X;
+ m_currentControlPosX = m_currentLabelPosX + m_MaxLabelWidth + cHoriDistance;
}
- LabelControlList[i].setSize(new Size(nMaxTCWidth, nTCHeight));
- resetDBShape(DBControlList[i], nXDBPos);
- checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
+ LabelControlList[i].setSize(new Size(m_MaxLabelWidth, m_LabelHeight));
+ resetDBShape(DBControlList[i], m_currentControlPosX);
+ checkOuterPoints(m_currentControlPosX, m_dbControlWidth, m_currentControlPosY, m_dbControlHeight, 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));
+ m_dbControlWidth = _curDBControl.getSize().Width;
+ m_dbControlHeight = _curDBControl.getSize().Height;
+ _curDBControl.setPosition(new Point(iXPos, _curDBControl.getPosition().Y));
}
private void initializePosSizes()
{
- this.nMaxDBYPos = 0;
- nXTCPos = cXOffset;
- nTCWidth = 2000;
- nDBWidth = 2000;
- nDBHeight = oFormHandler.getControlReferenceHeight();
- nTCHeight = oFormHandler.getLabelHeight();
+ m_controlMaxPosY = 0;
+ m_currentLabelPosX = cXOffset;
+ m_LabelWidth = 2000;
+ m_dbControlWidth = 2000;
+ m_dbControlHeight = oFormHandler.getControlReferenceHeight();
+ m_LabelHeight = oFormHandler.getLabelHeight();
iReduceWidth = 0;
- if (icurArrangement == FormWizard.SOCOLUMNARLEFT)
+ if (icurArrangement == FormWizard.COLUMNAR_LEFT)
{
- nYTCPos = cYOffset + this.getLabelDiffHeight(0);
- nXDBPos = cXOffset + 3050;
- nYDBPos = cYOffset;
+ m_currentLabelPosY = cYOffset + getLabelDiffHeight(0);
+ m_currentControlPosX = cXOffset + 3050;
+ m_currentControlPosY = cYOffset;
}
else
{
- nXDBPos = cXOffset;
- nYTCPos = cYOffset;
+ m_currentControlPosX = cXOffset;
+ m_currentLabelPosY = cYOffset;
}
}
@@ -552,65 +538,65 @@ public class FormControlArranger
{
try
{
+ Point aPoint = new Point(m_currentLabelPosX, m_currentLabelPosY);
+ Size aSize = new Size(m_LabelWidth, m_LabelHeight);
if (bControlsareCreated)
{
- LabelControlList[i].setPosition(new Point(nXTCPos, nYTCPos));
- if (icurArrangement != FormWizard.SOCOLUMNARLEFT)
+ LabelControlList[i].setPosition(aPoint);
+ if (icurArrangement != FormWizard.COLUMNAR_LEFT)
{
- nTCWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].getFieldTitle());
- LabelControlList[i].setSize(new Size(nTCWidth, nTCHeight));
+ m_LabelWidth = LabelControlList[i].getPreferredWidth(FieldColumns[i].getFieldTitle());
+ aSize.Width = m_LabelWidth;
+ LabelControlList[i].setSize(aSize);
}
else
{
- nTCWidth = LabelControlList[i].getSize().Width;
+ m_LabelWidth = 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)
+ LabelControlList[i] = new Control(oFormHandler, xFormName, FormHandler.SOLABEL, sFieldName, aPoint, aSize);
+ if (bIsVeryFirstRun && icurArrangement == FormWizard.COLUMNAR_TOP)
{
- if (icurArrangement == FormWizard.SOCOLUMNARTOP)
- {
- nYDBPos = nYTCPos + nTCHeight;
- }
- }
- String sTitle = FieldColumns[i].getFieldTitle();
- nTCWidth = LabelControlList[i].getPreferredWidth(sTitle);
+ m_currentControlPosY = m_currentLabelPosY + m_LabelHeight;
}
+ final String sTitle = FieldColumns[i].getFieldTitle();
+ m_LabelWidth = LabelControlList[i].getPreferredWidth(sTitle);
+ aSize.Width = m_LabelWidth;
+ LabelControlList[i].setSize(aSize);
+ }
Control curLabelControl = LabelControlList[i];
- if (icurArrangement == FormWizard.SOCOLUMNARLEFT)
+ if (icurArrangement == FormWizard.COLUMNAR_LEFT)
{
// Note This If Sequence must be called before retrieving the outer Points
if (bIsFirstRun)
{
- nMaxTCWidth = nTCWidth;
+ m_MaxLabelWidth = m_LabelWidth;
bIsFirstRun = false;
}
- else if (nTCWidth > nMaxTCWidth)
+ else if (m_LabelWidth > m_MaxLabelWidth)
{
- nMaxTCWidth = nTCWidth;
+ m_MaxLabelWidth = m_LabelWidth;
}
}
- checkOuterPoints(nXTCPos, nTCWidth, nYTCPos, nTCHeight, false);
- if ((icurArrangement == FormWizard.SOCOLUMNARTOP) || (icurArrangement == FormWizard.SOTOPJUSTIFIED))
+ checkOuterPoints(m_currentLabelPosX, m_LabelWidth, m_currentLabelPosY, m_LabelHeight, false);
+ if ((icurArrangement == FormWizard.COLUMNAR_TOP) || (icurArrangement == FormWizard.IN_BLOCK_TOP))
{
- nXDBPos = nXTCPos;
- nYDBPos = nYTCPos + nTCHeight;
- curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short) com.sun.star.awt.TextAlign.LEFT));
+ m_currentControlPosX = m_currentLabelPosX;
+ m_currentControlPosY = m_currentLabelPosY + m_LabelHeight;
+ curLabelControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short((short) com.sun.star.awt.TextAlign.LEFT));
}
else
{
- curLabelControl.xPropertySet.setPropertyValue("Align", new Short((short) _iAlign));
+ curLabelControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short((short) _iAlign));
}
if (!bControlsareCreated)
{
- curLabelControl.setSize(new Size(nTCWidth, nTCHeight));
+ curLabelControl.setSize(new Size(m_LabelWidth, m_LabelHeight));
}
-// if (CurHelpText != ""){
+// if (CurHelpText != PropertyNames.EMPTY_STRING){
// oModel.HelpText = CurHelptext;
// }
}
@@ -627,7 +613,7 @@ public class FormControlArranger
String sFieldName = FieldColumns[i].getFieldName();
int nFieldType = FieldColumns[i].getFieldType();
- Point aPoint = new Point(nXDBPos, nYDBPos);
+ Point aPoint = new Point(m_currentControlPosX, m_currentControlPosY);
if (bControlsareCreated)
{
DBControlList[i].setPosition(aPoint);
@@ -644,29 +630,30 @@ public class FormControlArranger
if (DBControlList[i].getControlType() == FormHandler.SOCHECKBOX)
{
// Checkboxes have no Label near by
- DBControlList[i].setPropertyValue(PropertyNames.PROPERTY_LABEL, "");
+ DBControlList[i].setPropertyValue(PropertyNames.PROPERTY_LABEL, PropertyNames.EMPTY_STRING);
}
}
}
DatabaseControl aDBControl = DBControlList[i];
- nDBHeight = aDBControl.getControlHeight();
- nDBWidth = aDBControl.getControlWidth();
+ m_dbControlHeight = aDBControl.getControlHeight();
+ m_dbControlWidth = aDBControl.getControlWidth();
if (nFieldType != DataType.TIMESTAMP)
{
- aDBControl.setSize(new Size(nDBWidth, nDBHeight));
+ aDBControl.setSize(new Size(m_dbControlWidth, m_dbControlHeight));
}
if (aDBControl.getControlType() == FormHandler.SOCHECKBOX)
{
- nYDBPos = nYDBPos + /*(int)*/ ((oFormHandler.getControlReferenceHeight() - nDBHeight) / 2);
- aPoint = new Point(nXDBPos, nYDBPos);
+ m_currentControlPosY = m_currentControlPosY + /*(int)*/ ((oFormHandler.getControlReferenceHeight() - m_dbControlHeight) / 2);
+ aPoint = new Point(m_currentControlPosX, m_currentControlPosY);
aDBControl.setPosition(aPoint);
}
if (nFieldType == DataType.LONGVARCHAR) /* memo */
+
{
Helper.setUnoPropertyValue(LabelControlList[i], PropertyNames.PROPERTY_MULTILINE, Boolean.TRUE);
}
- checkOuterPoints(nXDBPos, nDBWidth, nYDBPos, nDBHeight, true);
- aDBControl.setPropertyValue("Border", NBorderType);
+ checkOuterPoints(m_currentControlPosX, m_dbControlWidth, m_currentControlPosY, m_dbControlHeight, true);
+ aDBControl.setPropertyValue(PropertyNames.PROPERTY_BORDER, NBorderType);
}
catch (Exception e)
{
@@ -688,12 +675,12 @@ public class FormControlArranger
public int getFormHeight()
{
- return nMaxDBYPos - this.cYOffset;
+ return m_controlMaxPosY - cYOffset;
}
public int getEntryPointY()
{
- if (this.icurArrangement == FormWizard.SOCOLUMNARTOP)
+ if (icurArrangement == FormWizard.COLUMNAR_TOP)
{
Control curLabelControl2 = LabelControlList[0];
return curLabelControl2.getPosition().Y;
@@ -707,8 +694,8 @@ public class FormControlArranger
public void setStartPoint(Point _aPoint)
{
- this.cXOffset = _aPoint.X;
- this.cYOffset = _aPoint.Y;
+ cXOffset = _aPoint.X;
+ cYOffset = _aPoint.Y;
}
public void adjustYPositions(int _diffY)
@@ -717,10 +704,10 @@ public class FormControlArranger
{
Point aPoint = DBControlList[i].getPosition();
DBControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY));
- aPoint = this.LabelControlList[i].getPosition();
+ aPoint = LabelControlList[i].getPosition();
LabelControlList[i].setPosition(new Point(aPoint.X, aPoint.Y - _diffY));
}
- nMaxDBYPos = -_diffY;
+ m_controlMaxPosY = -_diffY;
cYOffset = -_diffY;
}
diff --git a/wizards/com/sun/star/wizards/form/FormDocument.java b/wizards/com/sun/star/wizards/form/FormDocument.java
index 0070fed3ada1..f12455c264d5 100644
--- a/wizards/com/sun/star/wizards/form/FormDocument.java
+++ b/wizards/com/sun/star/wizards/form/FormDocument.java
@@ -152,7 +152,7 @@ public class FormDocument extends TextDocument
{
if (oControlForms.size() == 0)
{
- final ControlForm aMainControlForm = new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.SOGRID));
+ final ControlForm aMainControlForm = new ControlForm(this, SOMAINFORM, aMainFormPoint, getMainFormSize(FormWizard.AS_GRID));
oControlForms.addElement(aMainControlForm);
}
else
@@ -213,7 +213,7 @@ public class FormDocument extends TextDocument
int nMainFormHeight = nFormHeight;
if (bhasSubForm)
{
- if (_curArrangement == FormWizard.SOGRID)
+ if (_curArrangement == FormWizard.AS_GRID)
{
nMainFormHeight = (int) ((double) (nFormHeight - SOFORMGAP) / 2);
}
@@ -223,8 +223,7 @@ public class FormDocument extends TextDocument
nMainFormHeight = (int) (((double) getMainFieldCount() / (double) nTotalFieldCount) * ((double) (nFormHeight - SOFORMGAP) / 2));
}
}
- Size aMainFormSize = new Size(nFormWidth, nMainFormHeight);
- return aMainFormSize;
+ return new Size(nFormWidth, nMainFormHeight);
}
private Size getSubFormSize()
@@ -233,8 +232,7 @@ public class FormDocument extends TextDocument
// 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;
+ return new Size(nFormWidth, nFormHeight - nMainFormHeight - SOFORMGAP);
}
private Point getSubFormPoint()
@@ -248,7 +246,7 @@ public class FormDocument extends TextDocument
{
ControlForm oMainControlForm = (ControlForm) oControlForms.get(0);
oMainControlForm.setFormSize(getMainFormSize(oMainControlForm.curArrangement));
- if (oMainControlForm.curArrangement == FormWizard.SOGRID)
+ if (oMainControlForm.curArrangement == FormWizard.AS_GRID)
{
oMainControlForm.oGridControl.setSize(oMainControlForm.getFormSize());
}
@@ -265,8 +263,8 @@ public class FormDocument extends TextDocument
{
ControlForm oMainControlForm = (ControlForm) oControlForms.get(0);
ControlForm oSubControlForm = (ControlForm) oControlForms.get(1);
- oSubControlForm.setFormSize(new Size(nFormWidth, (int) nFormHeight - oMainControlForm.getFormSize().Height));
- if (oSubControlForm.curArrangement == FormWizard.SOGRID)
+ oSubControlForm.setFormSize(new Size(nFormWidth, nFormHeight - oMainControlForm.getFormSize().Height));
+ if (oSubControlForm.curArrangement == FormWizard.AS_GRID)
{
Point aPoint = oSubControlForm.oGridControl.getPosition();
int idiffheight = oSubControlForm.getEntryPointY() - oMainControlForm.getActualFormHeight() - oMainControlForm.aStartPoint.Y - SOFORMGAP;
@@ -316,7 +314,7 @@ public class FormDocument extends TextDocument
ControlForm oSubControlForm = getControlFormByName(SOSUBFORM);
oSubControlForm.setFormProperties(aFormProperties, oSubFormDBMetaData);
String sRefTableName = _curFormConfiguration.getreferencedTableName();
- if (sRefTableName.equals(""))
+ if (sRefTableName.equals(PropertyNames.EMPTY_STRING))
{
LinkFieldNames = _curFieldLinker.getLinkFieldNames();
}
@@ -378,7 +376,7 @@ public class FormDocument extends TextDocument
{
xFormContainer = oFormHandler.insertFormbyName(_sname);
}
- xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFormContainer);
+ xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xFormContainer);
if (_sname.equals(SOMAINFORM))
{
oDBMetaData = oFormDocument.oMainFormDBMetaData;
@@ -406,13 +404,13 @@ public class FormDocument extends TextDocument
}
else
{
- if (curArrangement == FormWizard.SOGRID)
+ if (curArrangement == FormWizard.AS_GRID)
{
oFormHandler.moveShapesToNirwana(getLabelControls());
oFormHandler.moveShapesToNirwana(getDatabaseControls());
}
}
- if (curArrangement == FormWizard.SOGRID)
+ if (curArrangement == FormWizard.AS_GRID)
{
insertGridControl(_NBorderType);
badaptControlStyles = true;
@@ -485,7 +483,7 @@ public class FormDocument extends TextDocument
private int getActualFormHeight()
{
- if (curArrangement == FormWizard.SOGRID)
+ if (curArrangement == FormWizard.AS_GRID)
{
return oGridControl.xShape.getSize().Height;
}
@@ -497,7 +495,7 @@ public class FormDocument extends TextDocument
private int getEntryPointY()
{
- if (curArrangement == FormWizard.SOGRID)
+ if (curArrangement == FormWizard.AS_GRID)
{
return oGridControl.xShape.getPosition().Y;
}
@@ -512,8 +510,8 @@ public class FormDocument extends TextDocument
try
{
xPropertySet.setPropertyValue("DataSourceName", getDataSourceName());
- xPropertySet.setPropertyValue("Command", _oDBMetaData.getCommandName());
- xPropertySet.setPropertyValue("CommandType", new Integer(_oDBMetaData.getCommandType()));
+ xPropertySet.setPropertyValue(PropertyNames.COMMAND, _oDBMetaData.getCommandName());
+ xPropertySet.setPropertyValue(PropertyNames.COMMAND_TYPE, new Integer(_oDBMetaData.getCommandType()));
for (int i = 0; i < _aPropertySetList.length; i++)
{
xPropertySet.setPropertyValue(_aPropertySetList[i].Name, _aPropertySetList[i].Value);
@@ -551,16 +549,16 @@ public class FormDocument extends TextDocument
{
try
{
- curArrangement = FormWizard.SOGRID;
+ curArrangement = FormWizard.AS_GRID;
if (Name.equals(SOMAINFORM))
{
- oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getMainFormSize(FormWizard.SOGRID));
+ oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getMainFormSize(FormWizard.AS_GRID));
}
else
{
oGridControl = new GridControl(xMSF, Name + "_Grid", oFormHandler, xFormContainer, oDBMetaData.FieldColumns, aStartPoint, getSubFormSize());
}
- oGridControl.xPropertySet.setPropertyValue("Border", _NBorderType);
+ oGridControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, _NBorderType);
}
catch (Exception e)
{
@@ -576,7 +574,7 @@ public class FormDocument extends TextDocument
{
for (int i = 0; i < getLabelControls().length; i++)
{
- if (curArrangement == FormWizard.SOGRID)
+ if (curArrangement == FormWizard.AS_GRID)
{
if ((oLabelControls[i] != null) && (oDBControls[i] != null))
{
diff --git a/wizards/com/sun/star/wizards/form/FormWizard.java b/wizards/com/sun/star/wizards/form/FormWizard.java
index f75f3e1b84ab..cff52f46229b 100644
--- a/wizards/com/sun/star/wizards/form/FormWizard.java
+++ b/wizards/com/sun/star/wizards/form/FormWizard.java
@@ -56,8 +56,8 @@ public class FormWizard extends DatabaseObjectWizard
private Finalizer curFinalizer;
private static String slblFields;
private static String slblSelFields;
- private String sShowBinaryFields = "";
- private String serrFormNameexists = "";
+ private String sShowBinaryFields = PropertyNames.EMPTY_STRING;
+ private String serrFormNameexists = PropertyNames.EMPTY_STRING;
public static final int SOMAIN_PAGE = 1;
public static final int SOSUBFORM_PAGE = 2;
public static final int SOSUBFORMFIELDS_PAGE = 3;
@@ -66,30 +66,30 @@ public class FormWizard extends DatabaseObjectWizard
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;
+ public static final int COLUMNAR_LEFT = 1;
+ public static final int COLUMNAR_TOP = 2;
+ public static final int AS_GRID = 3;
+ public static final int IN_BLOCK_TOP = 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 )
+ public FormWizard(XMultiServiceFactory i_servicFactory, final PropertyValue[] i_wizardContext)
{
- super( i_servicFactory, 34400, i_wizardContext );
+ super(i_servicFactory, 34400, i_wizardContext);
super.addResourceHandler("FormWizard", "dbw");
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
- PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_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)
+ 210, Boolean.TRUE, "DialogForm", 102, 41, 1, new Short((short) 0), m_oResource.getResText(UIConsts.RID_FORM), 310
});
drawNaviBar();
- if (getFormResources() == true)
+ if (getFormResources())
{
setRightPaneHeaders(m_oResource, UIConsts.RID_FORM + 90, 8);
}
@@ -117,7 +117,7 @@ public class FormWizard extends DatabaseObjectWizard
RelationController oRelationController = new RelationController(curFormDocument.oMainFormDBMetaData, sCommandName);
curFormConfiguration.initialize(curSubFormFieldSelection, oRelationController);
}
- break;
+ break;
case SOSUBFORMFIELDS_PAGE:
{
String sPreSelectedTableName = curFormConfiguration.getreferencedTableName();
@@ -133,14 +133,14 @@ public class FormWizard extends DatabaseObjectWizard
curSubFormFieldSelection.preselectCommand(sPreSelectedTableName, bReadOnly);
}
}
- break;
+ break;
case SOFIELDLINKER_PAGE:
{
final String[] aMainFieldNames = curFormDocument.oMainFormDBMetaData.getFieldNames();
final String[] aSubFieldNames = curFormDocument.oSubFormDBMetaData.getFieldNames();
curFieldLinker.initialize(aMainFieldNames, aSubFieldNames, curFormDocument.LinkFieldNames);
}
- break;
+ break;
case SOCONTROL_PAGE:
curControlArranger.enableSubFormImageList(curFormConfiguration.hasSubForm());
break;
@@ -153,7 +153,7 @@ public class FormWizard extends DatabaseObjectWizard
String sTableName = this.curDBCommandFieldSelection.getSelectedCommandName();
this.curFinalizer.initialize(sTableName, curFormDocument);
}
- break;
+ break;
default:
break;
}
@@ -186,9 +186,10 @@ public class FormWizard extends DatabaseObjectWizard
curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aMainFieldNames, 1);
}
catch (java.lang.Exception e)
- {}
+ {
+ }
}
- break;
+ break;
case SOSUBFORM_PAGE:
break;
case SOSUBFORMFIELDS_PAGE:
@@ -203,9 +204,10 @@ public class FormWizard extends DatabaseObjectWizard
curFormDocument.LinkFieldNames = JavaTools.removeOutdatedFields(curFormDocument.LinkFieldNames, aSubFieldNames, 0);
}
catch (java.lang.Exception e)
- {}
+ {
+ }
}
- break;
+ break;
case SOFIELDLINKER_PAGE:
curFormDocument.LinkFieldNames = curFieldLinker.getLinkFieldNames();
break;
@@ -235,7 +237,7 @@ public class FormWizard extends DatabaseObjectWizard
},
new Object[]
{
- new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOMAIN_PAGE), new Integer(210)
+ 28, sShowBinaryFields, Boolean.TRUE, 95, 154, new Integer(SOMAIN_PAGE), 210
});
curFormConfiguration = new FormConfiguration(this);
@@ -250,7 +252,7 @@ public class FormWizard extends DatabaseObjectWizard
},
new Object[]
{
- new Integer(28), sShowBinaryFields, Boolean.TRUE, new Integer(95), new Integer(154), new Integer(SOSUBFORMFIELDS_PAGE), new Integer(210)
+ 28, sShowBinaryFields, Boolean.TRUE, 95, 154, new Integer(SOSUBFORMFIELDS_PAGE), 210
});
curFormDocument.xProgressBar.setValue(40);
@@ -337,24 +339,24 @@ public class FormWizard extends DatabaseObjectWizard
try
{
curFormDocument = new FormDocument(xMSF);
- if ( curFormDocument.oMainFormDBMetaData.getConnection( m_wizardContext ) )
+ if (curFormDocument.oMainFormDBMetaData.getConnection(m_wizardContext))
{
curFormDocument.oSubFormDBMetaData.getConnection(new PropertyValue[]
{
- Properties.createProperty("ActiveConnection", curFormDocument.oMainFormDBMetaData.DBConnection)
+ Properties.createProperty(PropertyNames.ACTIVE_CONNECTION, curFormDocument.oMainFormDBMetaData.DBConnection)
});
curFormDocument.xProgressBar.setValue(20);
buildSteps();
- this.curDBCommandFieldSelection.preselectCommand( m_wizardContext, false );
+ this.curDBCommandFieldSelection.preselectCommand(m_wizardContext, false);
XWindowPeer xWindowPeer2 = createWindowPeer(curFormDocument.xWindowPeer);
- curFormDocument.oMainFormDBMetaData.setWindowPeer( xWindowPeer2 );
+ curFormDocument.oMainFormDBMetaData.setWindowPeer(xWindowPeer2);
insertFormRelatedSteps();
short dialogReturn = executeDialog(curFormDocument.xFrame);
xComponent.dispose();
- if ( ( dialogReturn == 0 ) && m_success )
+ if ((dialogReturn == 0) && m_success)
{
- curFormDocument.oMainFormDBMetaData.addFormDocument( curFormDocument.xComponent );
- loadSubComponent( DatabaseObject.FORM, FormName, m_openForEditing );
+ curFormDocument.oMainFormDBMetaData.addFormDocument(curFormDocument.xComponent);
+ loadSubComponent(DatabaseObject.FORM, FormName, m_openForEditing);
}
}
}
@@ -396,7 +398,7 @@ public class FormWizard extends DatabaseObjectWizard
ID = 1;
if (sIncSuffix != null)
{
- if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
+ if ((!sIncSuffix.equals(PropertyNames.EMPTY_STRING)) && (!sIncSuffix.equals("_")))
{
String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
ID = Integer.parseInt(sID);
@@ -432,6 +434,7 @@ public class FormWizard extends DatabaseObjectWizard
}
}
// @Override
+
public void moveItemDown(String item)
{
}
@@ -458,7 +461,7 @@ public class FormWizard extends DatabaseObjectWizard
curDBCommandFieldSelection.setModified(true);
boolean benable = curDBCommandFieldSelection.getSelectedFieldNames().length > 0;
enablefromStep(SOSUBFORM_PAGE, benable);
- setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, new Boolean(benable));
+ setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable));
if (benable)
{
if (curFormConfiguration.hasSubForm())
@@ -471,12 +474,7 @@ public class FormWizard extends DatabaseObjectWizard
setStepEnabled(SOFIELDLINKER_PAGE, false);
}
}
- setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, new Boolean(benable));
+ setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable));
}
}
}
-
-
-
-
-
diff --git a/wizards/com/sun/star/wizards/form/StyleApplier.java b/wizards/com/sun/star/wizards/form/StyleApplier.java
index 5098a1ffbb74..9f6f6d6160dd 100644
--- a/wizards/com/sun/star/wizards/form/StyleApplier.java
+++ b/wizards/com/sun/star/wizards/form/StyleApplier.java
@@ -116,17 +116,17 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[8], sPageStyles, new Integer(92), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(90)
+ UIConsts.INTEGERS[8], sPageStyles, 92, 25, IStyleStep, new Short(curtabindex++), 90
});
lstStyles = CurUnoDialog.insertListBox("lstStyles", null, SCHANGELAYOUT, this,
new String[]
{
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "SelectedItems", PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Integer(143), "HID:WIZARDS_HID_DLGFORM_LSTSTYLES", new Integer(92), new Integer(35), SelLayoutPos, IStyleStep, this.StyleNames, new Short(curtabindex++), new Integer(90)
+ 143, "HID:WIZARDS_HID_DLGFORM_LSTSTYLES", 92, 35, SelLayoutPos, IStyleStep, this.StyleNames, new Short(curtabindex++), 90
});
optNoBorder = CurUnoDialog.insertRadioButton("otpNoBorder", SCHANGEBORDERTYPE, this,
@@ -136,7 +136,7 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", sNoBorder, new Integer(196), new Integer(39), IStyleStep, new Short(curtabindex++), "0", new Integer(93)
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDNOBORDER", sNoBorder, 196, 39, IStyleStep, new Short(curtabindex++), "0", 93
});
opt3DLook = CurUnoDialog.insertRadioButton("otp3DLook", SCHANGEBORDERTYPE, this,
@@ -146,7 +146,7 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", s3DLook, new Integer(196), new Integer(53), new Short((short) 1), IStyleStep, new Short(curtabindex++), "1", new Integer(93)
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMD3DBORDER", s3DLook, 196, 53, new Short((short) 1), IStyleStep, new Short(curtabindex++), "1", 93
});
optFlat = CurUnoDialog.insertRadioButton("otpFlat", SCHANGEBORDERTYPE, this,
@@ -156,7 +156,7 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDSIMPLEBORDER", sFlat, new Integer(196), new Integer(67), IStyleStep, new Short(curtabindex++), "2", new Integer(93)
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDSIMPLEBORDER", sFlat, 196, 67, IStyleStep, new Short(curtabindex++), "2", 93
});
CurUnoDialog.insertFixedLine("lnFieldBorder",
@@ -166,7 +166,7 @@ public class StyleApplier
},
new Object[]
{
- UIConsts.INTEGERS[8], sFieldBorder, new Integer(192), new Integer(25), IStyleStep, new Short(curtabindex++), new Integer(98)
+ UIConsts.INTEGERS[8], sFieldBorder, 192, 25, IStyleStep, new Short(curtabindex++), 98
});
// }
// catch (Exception e)
@@ -177,7 +177,7 @@ public class StyleApplier
/* public void initialize(short _iStyleindex){
if (_iStyleindex < lstStyles.getItemCount()){
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems", new short[]{_iStyleindex});
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstStyles), PropertyNames.SELECTED_ITEMS, new short[]{_iStyleindex});
applyStyle(true, false);
}
}
@@ -187,7 +187,7 @@ public class StyleApplier
try
{
Object oRootNode = Configuration.getConfigurationRoot(xMSF, "org.openoffice.Office.FormWizard/FormWizard/Styles", false);
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oRootNode);
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oRootNode);
StyleNodeNames = xNameAccess.getElementNames();
StyleNames = new String[StyleNodeNames.length];
FileNames = new String[StyleNodeNames.length];
@@ -208,7 +208,7 @@ public class StyleApplier
{
try
{
- short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(lstStyles), "SelectedItems"));
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(lstStyles), PropertyNames.SELECTED_ITEMS));
if (SelFields != null)
{
return SelFields[0];
@@ -281,10 +281,10 @@ public class StyleApplier
for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
{
FormDocument.ControlForm curControlForm = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m));
- if (curControlForm.getArrangemode() == FormWizard.SOGRID)
+ if (curControlForm.getArrangemode() == FormWizard.AS_GRID)
{
GridControl oGridControl = curControlForm.getGridControl();
- oGridControl.xPropertySet.setPropertyValue("Border", IBorderValue);
+ oGridControl.xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue);
}
else
{
@@ -297,17 +297,17 @@ public class StyleApplier
for (int i = 0; i < 2; i++)
{
XPropertySet xPropertySet = oTimeStampControl.getControlofGroupShapeByIndex(i);
- if (xPropertySet.getPropertySetInfo().hasPropertyByName("Border"))
+ if (xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER))
{
- xPropertySet.setPropertyValue("Border", IBorderValue);
+ xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue);
}
}
}
else
{
- if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName("Border"))
+ if (DBControls[n].xPropertySet.getPropertySetInfo().hasPropertyByName(PropertyNames.PROPERTY_BORDER))
{
- DBControls[n].xPropertySet.setPropertyValue("Border", IBorderValue);
+ DBControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_BORDER, IBorderValue);
}
}
}
@@ -331,7 +331,7 @@ public class StyleApplier
int index = JavaTools.FieldInList(_sDataList, _sHeader);
if (index > -1)
{
- String sPropName = "";
+ String sPropName = PropertyNames.EMPTY_STRING;
int iStyleColor;
while (((sPropName.indexOf("}") < 0) && (index < _sDataList.length - 1)))
{
@@ -345,8 +345,8 @@ public class StyleApplier
sPropValue = sPropValue.trim();
if (sPropValue.indexOf("#") > 0)
{
- sPropValue = JavaTools.replaceSubString(sPropValue, "", ";");
- sPropValue = JavaTools.replaceSubString(sPropValue, "", " ");
+ sPropValue = JavaTools.replaceSubString(sPropValue, PropertyNames.EMPTY_STRING, PropertyNames.SEMI_COLON);
+ sPropValue = JavaTools.replaceSubString(sPropValue, PropertyNames.EMPTY_STRING, PropertyNames.SPACE);
return Integer.decode(sPropValue).intValue();
}
}
@@ -367,7 +367,7 @@ public class StyleApplier
try
{
// TODO: check different languages in header layouts
- aStylePaths = FileAccess.getOfficePaths(getMSF(), "Config", "", "");
+ aStylePaths = FileAccess.getOfficePaths(getMSF(), "Config", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
FileAccess.combinePaths(getMSF(), aStylePaths, "/wizard/form/styles");
String[][] LayoutFiles = FileAccess.getFolderTitles(getMSF(), null, aStylePaths, ".css");
@@ -384,10 +384,10 @@ public class StyleApplier
private String getStylePath()
{
// TODO: umstellen auf mehrere Pfade
- String StylesPath = "";
+ String StylesPath = PropertyNames.EMPTY_STRING;
try
{
- StylesPath = FileAccess.getOfficePath(xMSF, "Config", "", "");
+ StylesPath = FileAccess.getOfficePath(xMSF, "Config", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
StylesPath = FileAccess.combinePaths(xMSF, StylesPath, "/wizard/form/styles");
}
catch (NoValidPathException e)
@@ -439,7 +439,7 @@ public class StyleApplier
for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
{
FormDocument.ControlForm curControlForm = ((FormDocument.ControlForm) curFormDocument.oControlForms.get(m));
- if (curControlForm.getArrangemode() == FormWizard.SOGRID)
+ if (curControlForm.getArrangemode() == FormWizard.AS_GRID)
{
if (_iStyleColors[SOLABELTEXTCOLOR] > -1)
{
diff --git a/wizards/com/sun/star/wizards/form/UIControlArranger.java b/wizards/com/sun/star/wizards/form/UIControlArranger.java
index d4cd1ccc7cb6..82a063c1bb7d 100644
--- a/wizards/com/sun/star/wizards/form/UIControlArranger.java
+++ b/wizards/com/sun/star/wizards/form/UIControlArranger.java
@@ -83,7 +83,7 @@ public class UIControlArranger
},
new Object[]
{
- UIConsts.INTEGERS[8], sLabelPlacment, new Integer(97), new Integer(25), IControlStep, new Short(curtabindex++), new Integer(207)
+ UIConsts.INTEGERS[8], sLabelPlacment, 97, 25, IControlStep, new Short(curtabindex++), 207
});
// Radio Button "Align Left"
optAlignLeft = CurUnoDialog.insertRadioButton("optAlignLeft", SOALIGNMETHOD, this,
@@ -93,7 +93,7 @@ public class UIControlArranger
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", sAlignLeft, new Integer(107), new Integer(38), new Short((short) 1), IControlStep, new Short(curtabindex++), new Integer(171)
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNLEFT", sAlignLeft, 107, 38, new Short((short) 1), IControlStep, new Short(curtabindex++), 171
});
// Radio Button "Align Right"
optAlignRight = CurUnoDialog.insertRadioButton("optAlignRight", SOALIGNMETHOD, this,
@@ -103,7 +103,7 @@ public class UIControlArranger
},
new Object[]
{
- UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", sAlignRight, Boolean.TRUE, new Integer(107), new Integer(50), IControlStep, new Short(curtabindex++), new Integer(171)
+ UIConsts.INTEGERS[10], "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT", sAlignRight, Boolean.TRUE, 107, 50, IControlStep, new Short(curtabindex++), 171
});
@@ -119,7 +119,7 @@ public class UIControlArranger
// },
// new Object[]
// {
-// UIConsts.INTEGERS[8], sArrangementHeader[0], new Integer(97), new Integer(60), IControlStep, new Short(curtabindex++), new Integer(207)
+// UIConsts.INTEGERS[8], sArrangementHeader[0], 97, 60, IControlStep, new Short(curtabindex++), 207
// });
//
// boolean bEnabled = true;
@@ -142,14 +142,14 @@ public class UIControlArranger
// new Object[]
// {
// Boolean.valueOf(bEnabled),
-// new Integer(14),
+// 14,
///* TODO: WRONG!*/ "HID:WIZARDS_HID_DLGFORM_CMDALIGNRIGHT",
// "1",
// new Integer(nXPos + nBtnWidth),
// new Integer(nYPos),
// IControlStep,
// new Short(curtabindex++),
-// new Integer(16)
+// 16
// });
DefaultListModel imageModel = new DefaultListModel();
@@ -191,7 +191,7 @@ public class UIControlArranger
{
if (listItem == null)
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
return HelpTexts[((Integer) listItem).intValue()];
@@ -201,21 +201,12 @@ public class UIControlArranger
public void enableSubFormImageList(boolean _bdoEnable)
{
m_aArrangeList[1].m_aButtonList.setenabled(_bdoEnable);
- CurUnoDialog.setControlProperty("lnLabelPlacment_2", PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoEnable));
+ CurUnoDialog.setControlProperty("lnLabelPlacment_2", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoEnable));
}
public short getAlignValue()
{
- Short IAlignValue = null;
- if (optAlignLeft.getState())
- {
- IAlignValue = new Short((short) 0);
- }
- else
- {
- IAlignValue = new Short((short) 2);
- }
- return IAlignValue.shortValue();
+ return optAlignLeft.getState() ? (short)0 : (short)2;
}
public void alignLabelControls()
@@ -226,12 +217,12 @@ public class UIControlArranger
for (int m = 0; m < curFormDocument.oControlForms.size(); m++)
{
FormDocument.ControlForm curControlForm = (FormDocument.ControlForm) curFormDocument.oControlForms.get(m);
- if (curControlForm.getArrangemode() == FormWizard.SOCOLUMNARLEFT)
+ if (curControlForm.getArrangemode() == FormWizard.COLUMNAR_LEFT)
{
Control[] LabelControls = curControlForm.getLabelControls();
for (int n = 0; n < LabelControls.length; n++)
{
- LabelControls[n].xPropertySet.setPropertyValue("Align", new Short(iAlignValue));
+ LabelControls[n].xPropertySet.setPropertyValue(PropertyNames.PROPERTY_ALIGN, new Short(iAlignValue));
}
}
}
@@ -244,9 +235,9 @@ public class UIControlArranger
private void enableAlignControlGroup(boolean _bEnableAlignControlGroup)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(flnLabelPlacement), PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnableAlignControlGroup));
- Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnableAlignControlGroup));
- Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignRight), PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnableAlignControlGroup));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(flnLabelPlacement), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnableAlignControlGroup));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignLeft), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnableAlignControlGroup));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optAlignRight), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnableAlignControlGroup));
}
// private class ArrangeImageList implements XItemListener
@@ -267,7 +258,7 @@ public class UIControlArranger
// },
// new Object[]
// {
-// UIConsts.INTEGERS[8], _sArrangementHeader, new Integer(97), YPos, IControlStep, new Short(curtabindex++), new Integer(207)
+// UIConsts.INTEGERS[8], _sArrangementHeader, 97, YPos, IControlStep, new Short(curtabindex++), 207
// });
//
// int nypos = SOBASEIMAGEYPOSITION + 12 + _formindex * SOIMAGELISTHEIGHT;
@@ -396,11 +387,11 @@ public class UIControlArranger
{
UIConsts.INTEGERS[8],
_sArrangementHeader,
- new Integer(97),
+ 97,
YPos,
IControlStep,
new Short(curtabindex++),
- new Integer(207)
+ 207
});
int nypos = SOBASEIMAGEYPOSITION + 12 - 5 + _formindex * SOIMAGELISTHEIGHT;
@@ -421,7 +412,7 @@ public class UIControlArranger
m_aButtonList.setListModel(model);
m_aButtonList.create(CurUnoDialog);
- m_aButtonList.setSelected(FormWizard.SOGRID - 1);
+ m_aButtonList.setSelected(FormWizard.AS_GRID - 1);
m_aButtonList.addItemListener(this);
}
@@ -450,13 +441,13 @@ public class UIControlArranger
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));
+ bEnableAlignControlGroup = ((nSelected0 == FormWizard.COLUMNAR_LEFT) ||
+ (nSelected1 == FormWizard.COLUMNAR_LEFT));
}
else
{
final int nSelected0 = (m_aArrangeList[0].m_aButtonList.getSelected() + 1);
- bEnableAlignControlGroup = (nSelected0 == FormWizard.SOCOLUMNARLEFT);
+ bEnableAlignControlGroup = (nSelected0 == FormWizard.COLUMNAR_LEFT);
}
enableAlignControlGroup(bEnableAlignControlGroup);
final Short nBorderType = CurUnoDialog.getBorderType();
diff --git a/wizards/com/sun/star/wizards/letter/CallWizard.java b/wizards/com/sun/star/wizards/letter/CallWizard.java
index ff993c61e506..250d59aea19f 100644
--- a/wizards/com/sun/star/wizards/letter/CallWizard.java
+++ b/wizards/com/sun/star/wizards/letter/CallWizard.java
@@ -38,6 +38,7 @@ 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.PropertyNames;
/**
* This class capsulates the class, that implements the minimal component, a factory for
@@ -105,7 +106,7 @@ public class CallWizard
*/
public void trigger(String str)
{
- if (str.equalsIgnoreCase("start"))
+ if (str.equalsIgnoreCase(PropertyNames.START))
{
LetterWizardDialogImpl lw = new LetterWizardDialogImpl(xmultiservicefactory);
if (!LetterWizardDialogImpl.running)
@@ -189,7 +190,7 @@ public class CallWizard
try
{
- byteReturn = ("" + this.hashCode()).getBytes();
+ byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
}
catch (Exception exception)
{
diff --git a/wizards/com/sun/star/wizards/letter/LetterDocument.java b/wizards/com/sun/star/wizards/letter/LetterDocument.java
index b7b260e69e85..6a024ce1113f 100644
--- a/wizards/com/sun/star/wizards/letter/LetterDocument.java
+++ b/wizards/com/sun/star/wizards/letter/LetterDocument.java
@@ -61,9 +61,8 @@ public class LetterDocument extends TextDocument
public XWindowPeer getWindowPeer()
{
- XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument);
- return xWindowPeer;
- }
+ return UnoRuntime.queryInterface(XWindowPeer.class, xTextDocument);
+}
public void switchElement(String sElement, boolean bState)
{
@@ -71,7 +70,7 @@ public class LetterDocument extends TextDocument
{
TextSectionHandler mySectionHandler = new TextSectionHandler(xMSF, xTextDocument);
Object oSection = mySectionHandler.xTextSectionsSupplier.getTextSections().getByName(sElement);
- Helper.setUnoPropertyValue(oSection, "IsVisible", new Boolean(bState));
+ Helper.setUnoPropertyValue(oSection, "IsVisible", Boolean.valueOf(bState));
}
catch (Exception exception)
@@ -93,20 +92,20 @@ public class LetterDocument extends TextDocument
try
{
xTextDocument.lockControllers();
- XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ XStyleFamiliesSupplier xStyleFamiliesSupplier = 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"));
+ xPageStyleCollection = UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles"));
XText xFooterText;
- XStyle xPageStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName(sPageStyle));
+ XStyle xPageStyle = 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"));
+ Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", Boolean.TRUE);
+ xFooterText = UnoRuntime.queryInterface(XText.class, Helper.getUnoPropertyValue(xPageStyle, "FooterText"));
xFooterText.setString(sText);
if (bPageNumber)
{
@@ -114,10 +113,10 @@ public class LetterDocument extends TextDocument
XTextCursor myCursor = xFooterText.createTextCursor();
myCursor.gotoEnd(false);
xFooterText.insertControlCharacter(myCursor, ControlCharacter.PARAGRAPH_BREAK, false);
- XPropertySet xCursorPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, myCursor);
+ XPropertySet xCursorPSet = 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);
+ XTextField xPageNumberField = UnoRuntime.queryInterface(XTextField.class, xMSFDoc.createInstance("com.sun.star.text.TextField.PageNumber"));
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xPageNumberField);
xPSet.setPropertyValue("SubType", PageNumberType.CURRENT);
xPSet.setPropertyValue("NumberingType", new Short(NumberingType.ARABIC));
xFooterText.insertTextContent(xFooterText.getEnd(), xPageNumberField, false);
@@ -125,7 +124,7 @@ public class LetterDocument extends TextDocument
}
else
{
- Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", new Boolean(false));
+ Helper.setUnoPropertyValue(xPageStyle, "FooterIsOn", Boolean.FALSE);
}
xTextDocument.unlockControllers();
}
@@ -158,7 +157,7 @@ public class LetterDocument extends TextDocument
}
else
{
- myFieldHandler.changeUserFieldContent(sFieldName, "");
+ myFieldHandler.changeUserFieldContent(sFieldName, PropertyNames.EMPTY_STRING);
}
}
@@ -183,7 +182,7 @@ public class LetterDocument extends TextDocument
public void killEmptyUserFields()
{
TextFieldHandler myFieldHandler = new TextFieldHandler(xMSF, xTextDocument);
- myFieldHandler.removeUserFieldByContent("");
+ myFieldHandler.removeUserFieldByContent(PropertyNames.EMPTY_STRING);
}
public void killEmptyFrames()
@@ -259,8 +258,8 @@ public class LetterDocument extends TextDocument
try
{
- xFrame = (XTextFrame) UnoRuntime.queryInterface(XTextFrame.class, xMSFDoc.createInstance("com.sun.star.text.TextFrame"));
- xShape = (XShape) UnoRuntime.queryInterface(XShape.class, xFrame);
+ xFrame = UnoRuntime.queryInterface(XTextFrame.class, xMSFDoc.createInstance("com.sun.star.text.TextFrame"));
+ xShape = UnoRuntime.queryInterface(XShape.class, xFrame);
setFramePosition();
Helper.setUnoPropertyValue(xShape, "AnchorType", TextContentAnchorType.AT_PAGE);
@@ -268,7 +267,7 @@ public class LetterDocument extends TextDocument
Helper.setUnoPropertyValue(xFrame, "TextWrap", WrapTextMode.THROUGHT);
Helper.setUnoPropertyValue(xFrame, "Opaque", Boolean.TRUE);
- Helper.setUnoPropertyValue(xFrame, "BackColor", new Integer(15790320));
+ Helper.setUnoPropertyValue(xFrame, "BackColor", 15790320);
BorderLine myBorder = new BorderLine();
myBorder.OuterLineWidth = 0;
@@ -276,7 +275,7 @@ public class LetterDocument extends TextDocument
Helper.setUnoPropertyValue(xFrame, "RightBorder", myBorder);
Helper.setUnoPropertyValue(xFrame, "TopBorder", myBorder);
Helper.setUnoPropertyValue(xFrame, "BottomBorder", myBorder);
- Helper.setUnoPropertyValue(xFrame, "Print", new Boolean(false));
+ Helper.setUnoPropertyValue(xFrame, "Print", Boolean.FALSE);
XTextCursor xTextCursor = xTextDocument.getText().createTextCursor();
xTextCursor.gotoEnd(true);
@@ -285,10 +284,10 @@ public class LetterDocument extends TextDocument
XText xFrameText = xFrame.getText();
XTextCursor xFrameCursor = xFrameText.createTextCursor();
- XPropertySet xCursorProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xFrameCursor);
+ XPropertySet xCursorProps = 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("CharColor", 16777215);
+ xCursorProps.setPropertyValue("CharFontName", "Albany");
xCursorProps.setPropertyValue("CharHeight", new Float(18));
xFrameText.insertString(xFrameCursor, FrameText, false);
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
index 619227d9f3ba..2f3f87f244ff 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.java
@@ -143,11 +143,11 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
- "Closeable", PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_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)
+ Boolean.TRUE, 210, Boolean.TRUE, "LetterWizardDialog", 104, 52, INTEGERS[1], new Short((short) 1), resources.resLetterWizardDialog_title, 310
});
@@ -169,7 +169,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(HID + 1), resources.resoptBusinessLetter_value, "optBusinessLetter", new Integer(97), new Integer(28), INTEGERS[1], new Short((short) 1), new Integer(184)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 1), resources.resoptBusinessLetter_value, "optBusinessLetter", 97, 28, INTEGERS[1], new Short((short) 1), 184
});
optPrivOfficialLetter = insertRadioButton("optPrivOfficialLetter", OPTPRIVOFFICIALLETTER_ITEM_CHANGED,
new String[]
@@ -178,7 +178,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(HID + 2), resources.resoptPrivOfficialLetter_value, "optPrivOfficialLetter", new Integer(97), new Integer(74), INTEGERS[1], new Short((short) 2), new Integer(184)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 2), resources.resoptPrivOfficialLetter_value, "optPrivOfficialLetter", 97, 74, INTEGERS[1], new Short((short) 2), 184
});
optPrivateLetter = insertRadioButton("optPrivateLetter", OPTPRIVATELETTER_ITEM_CHANGED,
new String[]
@@ -187,7 +187,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(HID + 3), resources.resoptPrivateLetter_value, "optPrivateLetter", new Integer(97), new Integer(106), INTEGERS[1], new Short((short) 3), new Integer(184)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 3), resources.resoptPrivateLetter_value, "optPrivateLetter", 97, 106, INTEGERS[1], new Short((short) 3), 184
});
lstBusinessStyle = insertListBox("lstBusinessStyle", LSTBUSINESSSTYLE_ACTION_PERFORMED, LSTBUSINESSSTYLE_ITEM_CHANGED,
new String[]
@@ -196,7 +196,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 4), "lstBusinessStyle", new Integer(180), INTEGER_40, INTEGERS[1], new Short((short) 4), new Integer(74)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 4), "lstBusinessStyle", 180, INTEGER_40, INTEGERS[1], new Short((short) 4), 74
});
chkBusinessPaper = insertCheckBox("chkBusinessPaper", CHKBUSINESSPAPER_ITEM_CHANGED,
new String[]
@@ -205,7 +205,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 5), resources.reschkBusinessPaper_value, "chkBusinessPaper", 110, 56, new Short((short) 0), INTEGERS[1], new Short((short) 5), 168
});
lstPrivOfficialStyle = insertListBox("lstPrivOfficialStyle", LSTPRIVOFFICIALSTYLE_ACTION_PERFORMED, LSTPRIVOFFICIALSTYLE_ITEM_CHANGED,
new String[]
@@ -214,7 +214,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 6), "lstPrivOfficialStyle", new Integer(180), new Integer(86), INTEGERS[1], new Short((short) 6), new Integer(74)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 6), "lstPrivOfficialStyle", 180, 86, INTEGERS[1], new Short((short) 6), 74
});
lstPrivateStyle = insertListBox("lstPrivateStyle", LSTPRIVATESTYLE_ACTION_PERFORMED, LSTPRIVATESTYLE_ITEM_CHANGED,
new String[]
@@ -223,7 +223,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 7), "lstPrivateStyle", new Integer(180), new Integer(118), INTEGERS[1], new Short((short) 7), new Integer(74)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 7), "lstPrivateStyle", 180, 118, INTEGERS[1], new Short((short) 7), 74
});
lblBusinessStyle = insertLabel("lblBusinessStyle",
new String[]
@@ -232,7 +232,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblBusinessStyle_value, "lblBusinessStyle", new Integer(110), new Integer(42), INTEGERS[1], new Short((short) 48), new Integer(60)
+ INTEGERS[8], resources.reslblBusinessStyle_value, "lblBusinessStyle", 110, 42, INTEGERS[1], new Short((short) 48), 60
});
lblPrivOfficialStyle = insertLabel("lblPrivOfficialStyle",
new String[]
@@ -241,16 +241,16 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblPrivOfficialStyle_value, "lblPrivOfficialStyle", new Integer(110), new Integer(88), INTEGERS[1], new Short((short) 49), new Integer(60)
+ INTEGERS[8], resources.reslblPrivOfficialStyle_value, "lblPrivOfficialStyle", 110, 88, INTEGERS[1], new Short((short) 49), 60
});
lblTitle1 = insertLabel("lblTitle1",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor6, INTEGER_16, resources.reslblTitle1_value, Boolean.TRUE, "lblTitle1", 91, INTEGERS[8], INTEGERS[1], new Short((short) 55), 212
});
lblPrivateStyle = insertLabel("lblPrivateStyle",
new String[]
@@ -259,7 +259,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblPrivateStyle_value, "lblPrivateStyle", new Integer(110), new Integer(120), INTEGERS[1], new Short((short) 74), new Integer(60)
+ INTEGERS[8], resources.reslblPrivateStyle_value, "lblPrivateStyle", 110, 120, INTEGERS[1], new Short((short) 74), 60
});
lblIntroduction = insertLabel("lblIntroduction",
new String[]
@@ -268,13 +268,13 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
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)
+ 39, resources.reslblIntroduction_value, Boolean.TRUE, "lblIntroduction", 104, 145, INTEGERS[1], new Short((short) 80), 199
});
ImageControl3 = insertInfoImage(92, 145, 1);
// ImageControl3 = insertImage("ImageControl3",
-// new String[] {"Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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]}
+// new String[] {PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
+// new Object[] { new Short((short)0), INTEGERS[10],"private:resource/dbu/image/19205","ImageControl3",92,145,Boolean.FALSE,INTEGERS[1],new Short((short)81),INTEGERS[10]}
// );
}
@@ -287,7 +287,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 8), resources.reschkPaperCompanyLogo_value, "chkPaperCompanyLogo", 97, 28, new Short((short) 0), INTEGERS[2], new Short((short) 8), 68
});
numLogoHeight = insertNumericField("numLogoHeight", NUMLOGOHEIGHT_TEXT_CHANGED,
new String[]
@@ -296,7 +296,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 9), "numLogoHeight", new Integer(138), INTEGER_40, Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 9), INTEGERS[3], new Integer(30)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 9), "numLogoHeight", 138, INTEGER_40, Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 9), INTEGERS[3], 30
});
numLogoX = insertNumericField("numLogoX", NUMLOGOX_TEXT_CHANGED,
new String[]
@@ -305,7 +305,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 10), "numLogoX", new Integer(266), INTEGER_40, Boolean.TRUE, INTEGERS[2], new Short((short) 10), INTEGERS[0], new Integer(30)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 10), "numLogoX", 266, INTEGER_40, Boolean.TRUE, INTEGERS[2], new Short((short) 10), INTEGERS[0], 30
});
numLogoWidth = insertNumericField("numLogoWidth", NUMLOGOWIDTH_TEXT_CHANGED,
new String[]
@@ -314,7 +314,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 11), "numLogoWidth", new Integer(138), new Integer(56), Boolean.TRUE, INTEGERS[2], new Short((short) 11), new Double(3.8), new Integer(30)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 11), "numLogoWidth", 138, 56, Boolean.TRUE, INTEGERS[2], new Short((short) 11), new Double(3.8), 30
});
numLogoY = insertNumericField("numLogoY", NUMLOGOY_TEXT_CHANGED,
new String[]
@@ -323,7 +323,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 12), "numLogoY", new Integer(266), new Integer(56), Boolean.TRUE, INTEGERS[2], new Short((short) 12), new Double(-3.4), new Integer(30)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 12), "numLogoY", 266, 56, Boolean.TRUE, INTEGERS[2], new Short((short) 12), new Double(-3.4), 30
});
chkPaperCompanyAddress = insertCheckBox("chkPaperCompanyAddress", CHKPAPERCOMPANYADDRESS_ITEM_CHANGED,
new String[]
@@ -332,7 +332,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 13), resources.reschkPaperCompanyAddress_value, "chkPaperCompanyAddress", 98, 84, new Short((short) 0), INTEGERS[2], new Short((short) 13), 68
});
numAddressHeight = insertNumericField("numAddressHeight", NUMADDRESSHEIGHT_TEXT_CHANGED,
new String[]
@@ -341,7 +341,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 14), "numAddressHeight", new Integer(138), new Integer(96), Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 14), INTEGERS[3], new Integer(30)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 14), "numAddressHeight", 138, 96, Boolean.TRUE, INTEGERS[2], Boolean.TRUE, new Short((short) 14), INTEGERS[3], 30
});
numAddressX = insertNumericField("numAddressX", NUMADDRESSX_TEXT_CHANGED,
new String[]
@@ -350,7 +350,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 15), "numAddressX", new Integer(266), new Integer(96), Boolean.TRUE, INTEGERS[2], new Short((short) 15), new Double(3.8), new Integer(30)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 15), "numAddressX", 266, 96, Boolean.TRUE, INTEGERS[2], new Short((short) 15), new Double(3.8), 30
});
numAddressWidth = insertNumericField("numAddressWidth", NUMADDRESSWIDTH_TEXT_CHANGED,
new String[]
@@ -359,7 +359,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 16), "numAddressWidth", new Integer(138), new Integer(112), Boolean.TRUE, INTEGERS[2], new Short((short) 16), new Double(13.8), new Integer(30)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 16), "numAddressWidth", 138, 112, Boolean.TRUE, INTEGERS[2], new Short((short) 16), new Double(13.8), 30
});
numAddressY = insertNumericField("numAddressY", NUMADDRESSY_TEXT_CHANGED,
new String[]
@@ -368,7 +368,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 17), "numAddressY", new Integer(266), new Integer(112), Boolean.TRUE, INTEGERS[2], new Short((short) 17), new Double(-3.4), new Integer(30)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 17), "numAddressY", 266, 112, Boolean.TRUE, INTEGERS[2], new Short((short) 17), new Double(-3.4), 30
});
chkCompanyReceiver = insertCheckBox("chkCompanyReceiver", CHKCOMPANYRECEIVER_ITEM_CHANGED,
new String[]
@@ -377,7 +377,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 18), resources.reschkCompanyReceiver_value, "chkCompanyReceiver", 103, 131, new Short((short) 0), INTEGERS[2], new Short((short) 18), 185
});
chkPaperFooter = insertCheckBox("chkPaperFooter", CHKPAPERFOOTER_ITEM_CHANGED,
new String[]
@@ -386,7 +386,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 19), resources.reschkPaperFooter_value, "chkPaperFooter", 97, 158, new Short((short) 0), INTEGERS[2], new Short((short) 19), 68
});
numFooterHeight = insertNumericField("numFooterHeight", NUMFOOTERHEIGHT_TEXT_CHANGED,
new String[]
@@ -395,7 +395,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 20), "numFooterHeight", new Integer(236), new Integer(156), Boolean.TRUE, INTEGERS[2], new Short((short) 20), INTEGERS[5], new Integer(30)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 20), "numFooterHeight", 236, 156, Boolean.TRUE, INTEGERS[2], new Short((short) 20), INTEGERS[5], 30
});
lblLogoHeight = insertLabel("lblLogoHeight",
new String[]
@@ -404,7 +404,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblLogoHeight_value, "lblLogoHeight", new Integer(103), new Integer(42), INTEGERS[2], new Short((short) 68), new Integer(32)
+ INTEGERS[8], resources.reslblLogoHeight_value, "lblLogoHeight", 103, 42, INTEGERS[2], new Short((short) 68), 32
});
lblLogoWidth = insertLabel("lblLogoWidth",
new String[]
@@ -413,7 +413,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblLogoWidth_value, "lblLogoWidth", new Integer(103), new Integer(58), INTEGERS[2], new Short((short) 69), new Integer(32)
+ INTEGERS[8], resources.reslblLogoWidth_value, "lblLogoWidth", 103, 58, INTEGERS[2], new Short((short) 69), 32
});
FixedLine5 = insertFixedLine("FixedLine5",
new String[]
@@ -422,7 +422,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[2], "FixedLine5", new Integer(90), new Integer(78), INTEGERS[2], new Short((short) 70), new Integer(215)
+ INTEGERS[2], "FixedLine5", 90, 78, INTEGERS[2], new Short((short) 70), 215
});
FixedLine6 = insertFixedLine("FixedLine6",
new String[]
@@ -431,7 +431,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[2], "FixedLine6", new Integer(90), new Integer(150), INTEGERS[2], new Short((short) 71), new Integer(215)
+ INTEGERS[2], "FixedLine6", 90, 150, INTEGERS[2], new Short((short) 71), 215
});
lblFooterHeight = insertLabel("lblFooterHeight",
new String[]
@@ -440,7 +440,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblFooterHeight_value, "lblFooterHeight", new Integer(200), new Integer(158), INTEGERS[2], new Short((short) 72), new Integer(32)
+ INTEGERS[8], resources.reslblFooterHeight_value, "lblFooterHeight", 200, 158, INTEGERS[2], new Short((short) 72), 32
});
lblLogoX = insertLabel("lblLogoX",
new String[]
@@ -449,7 +449,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblLogoX_value, "lblLogoX", new Integer(170), new Integer(42), INTEGERS[2], new Short((short) 84), new Integer(94)
+ INTEGERS[8], resources.reslblLogoX_value, "lblLogoX", 170, 42, INTEGERS[2], new Short((short) 84), 94
});
lblLogoY = insertLabel("lblLogoY",
new String[]
@@ -458,7 +458,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblLogoY_value, "lblLogoY", new Integer(170), new Integer(58), INTEGERS[2], new Short((short) 85), new Integer(94)
+ INTEGERS[8], resources.reslblLogoY_value, "lblLogoY", 170, 58, INTEGERS[2], new Short((short) 85), 94
});
lblAddressHeight = insertLabel("lblAddressHeight",
new String[]
@@ -467,7 +467,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblAddressHeight_value, "lblAddressHeight", new Integer(103), new Integer(98), INTEGERS[2], new Short((short) 86), new Integer(32)
+ INTEGERS[8], resources.reslblAddressHeight_value, "lblAddressHeight", 103, 98, INTEGERS[2], new Short((short) 86), 32
});
lblAddressWidth = insertLabel("lblAddressWidth",
new String[]
@@ -476,7 +476,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblAddressWidth_value, "lblAddressWidth", new Integer(103), new Integer(114), INTEGERS[2], new Short((short) 87), new Integer(32)
+ INTEGERS[8], resources.reslblAddressWidth_value, "lblAddressWidth", 103, 114, INTEGERS[2], new Short((short) 87), 32
});
lblAddressX = insertLabel("lblAddressX",
new String[]
@@ -485,7 +485,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblAddressX_value, "lblAddressX", new Integer(170), new Integer(98), INTEGERS[2], new Short((short) 88), new Integer(94)
+ INTEGERS[8], resources.reslblAddressX_value, "lblAddressX", 170, 98, INTEGERS[2], new Short((short) 88), 94
});
lblAddressY = insertLabel("lblAddressY",
new String[]
@@ -494,16 +494,16 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblAddressY_value, "lblAddressY", new Integer(170), new Integer(114), INTEGERS[2], new Short((short) 89), new Integer(94)
+ INTEGERS[8], resources.reslblAddressY_value, "lblAddressY", 170, 114, INTEGERS[2], new Short((short) 89), 94
});
lblTitle2 = insertLabel("lblTitle2",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor6, INTEGER_16, resources.reslblTitle2_value, Boolean.TRUE, "lblTitle2", 91, INTEGERS[8], INTEGERS[2], new Short((short) 91), 212
});
}
@@ -516,7 +516,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 21), "lstLetterNorm", new Integer(210), new Integer(34), INTEGERS[3], new Short((short) 21), new Integer(74)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 21), "lstLetterNorm", 210, 34, INTEGERS[3], new Short((short) 21), 74
});
chkUseLogo = insertCheckBox("chkUseLogo", CHKUSELOGO_ITEM_CHANGED,
new String[]
@@ -525,7 +525,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 22), resources.reschkUseLogo_value, "chkUseLogo", 97, 54, new Short((short) 0), INTEGERS[3], new Short((short) 22), 212
});
chkUseAddressReceiver = insertCheckBox("chkUseAddressReceiver", CHKUSEADDRESSRECEIVER_ITEM_CHANGED,
new String[]
@@ -534,7 +534,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 23), resources.reschkUseAddressReceiver_value, "chkUseAddressReceiver", 97, 69, new Short((short) 0), INTEGERS[3], new Short((short) 23), 212
});
chkUseSigns = insertCheckBox("chkUseSigns", CHKUSESIGNS_ITEM_CHANGED,
new String[]
@@ -543,7 +543,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 24), resources.reschkUseSigns_value, "chkUseSigns", 97, 82, new Short((short) 0), INTEGERS[3], new Short((short) 24), 212
});
chkUseSubject = insertCheckBox("chkUseSubject", CHKUSESUBJECT_ITEM_CHANGED,
new String[]
@@ -552,7 +552,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 25), resources.reschkUseSubject_value, "chkUseSubject", 97, 98, new Short((short) 0), INTEGERS[3], new Short((short) 25), 212
});
chkUseSalutation = insertCheckBox("chkUseSalutation", CHKUSESALUTATION_ITEM_CHANGED,
new String[]
@@ -561,7 +561,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 26), resources.reschkUseSalutation_value, "chkUseSalutation", 97, 113, new Short((short) 0), INTEGERS[3], new Short((short) 26), 66
});
lstSalutation = insertComboBox("lstSalutation", LSTSALUTATION_ACTION_PERFORMED, LSTSALUTATION_ITEM_CHANGED, LSTSALUTATION_TEXT_CHANGED,
new String[]
@@ -570,7 +570,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 27), "lstSalutation", new Integer(210), new Integer(110), INTEGERS[3], new Short((short) 27), new Integer(74)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 27), "lstSalutation", 210, 110, INTEGERS[3], new Short((short) 27), 74
});
chkUseBendMarks = insertCheckBox("chkUseBendMarks", CHKUSEBENDMARKS_ITEM_CHANGED,
new String[]
@@ -579,7 +579,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 28), resources.reschkUseBendMarks_value, "chkUseBendMarks", 97, 127, new Short((short) 0), INTEGERS[3], new Short((short) 28), 212
});
chkUseGreeting = insertCheckBox("chkUseGreeting", CHKUSEGREETING_ITEM_CHANGED,
new String[]
@@ -588,7 +588,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 29), resources.reschkUseGreeting_value, "chkUseGreeting", 97, 142, new Short((short) 0), INTEGERS[3], new Short((short) 29), 66
});
lstGreeting = insertComboBox("lstGreeting", LSTGREETING_ACTION_PERFORMED, LSTGREETING_ITEM_CHANGED, LSTGREETING_TEXT_CHANGED,
new String[]
@@ -597,7 +597,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 30), "lstGreeting", new Integer(210), new Integer(141), INTEGERS[3], new Short((short) 30), new Integer(74)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID + 30), "lstGreeting", 210, 141, INTEGERS[3], new Short((short) 30), 74
});
chkUseFooter = insertCheckBox("chkUseFooter", CHKUSEFOOTER_ITEM_CHANGED,
new String[]
@@ -606,7 +606,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 31), resources.reschkUseFooter_value, "chkUseFooter", 97, 158, new Short((short) 0), INTEGERS[3], new Short((short) 31), 212
});
lblLetterNorm = insertLabel("lblLetterNorm",
new String[]
@@ -615,16 +615,16 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
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)
+ INTEGER_16, resources.reslblLetterNorm_value, Boolean.TRUE, "lblLetterNorm", 97, 28, INTEGERS[3], new Short((short) 50), 109
});
lblTitle3 = insertLabel("lblTitle3",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor6, INTEGER_16, resources.reslblTitle3_value, Boolean.TRUE, "lblTitle3", 91, INTEGERS[8], INTEGERS[3], new Short((short) 90), 212
});
}
@@ -637,7 +637,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(HID + 32), resources.resoptSenderPlaceholder_value, "optSenderPlaceholder", new Integer(104), new Integer(42), INTEGERS[4], new Short((short) 32), new Integer(149)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 32), resources.resoptSenderPlaceholder_value, "optSenderPlaceholder", 104, 42, INTEGERS[4], new Short((short) 32), 149
});
optSenderDefine = insertRadioButton("optSenderDefine", OPTSENDERDEFINE_ITEM_CHANGED,
new String[]
@@ -646,7 +646,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(HID + 33), resources.resoptSenderDefine_value, "optSenderDefine", new Integer(104), new Integer(54), INTEGERS[4], new Short((short) 33), new Integer(149)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 33), resources.resoptSenderDefine_value, "optSenderDefine", 104, 54, INTEGERS[4], new Short((short) 33), 149
});
txtSenderName = insertTextField("txtSenderName", TXTSENDERNAME_TEXT_CHANGED,
new String[]
@@ -655,7 +655,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 34), "txtSenderName", new Integer(182), new Integer(67), INTEGERS[4], new Short((short) 34), new Integer(119)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 34), "txtSenderName", 182, 67, INTEGERS[4], new Short((short) 34), 119
});
txtSenderStreet = insertTextField("txtSenderStreet", TXTSENDERSTREET_TEXT_CHANGED,
new String[]
@@ -664,7 +664,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 35), "txtSenderStreet", new Integer(182), new Integer(81), INTEGERS[4], new Short((short) 35), new Integer(119)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 35), "txtSenderStreet", 182, 81, INTEGERS[4], new Short((short) 35), 119
});
txtSenderPostCode = insertTextField("txtSenderPostCode", TXTSENDERPOSTCODE_TEXT_CHANGED,
new String[]
@@ -673,7 +673,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 36), "txtSenderPostCode", new Integer(182), new Integer(95), INTEGERS[4], new Short((short) 36), new Integer(25)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 36), "txtSenderPostCode", 182, 95, INTEGERS[4], new Short((short) 36), 25
});
txtSenderState = insertTextField("txtSenderState", TXTSENDERSTATE_TEXT_CHANGED,
new String[]
@@ -682,7 +682,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 37), "txtSenderState", new Integer(211), new Integer(95), INTEGERS[4], new Short((short) 37), new Integer(21)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 37), "txtSenderState", 211, 95, INTEGERS[4], new Short((short) 37), 21
});
txtSenderCity = insertTextField("txtSenderCity", TXTSENDERCITY_TEXT_CHANGED,
new String[]
@@ -691,7 +691,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 38), "txtSenderCity", new Integer(236), new Integer(95), INTEGERS[4], new Short((short) 38), new Integer(65)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 38), "txtSenderCity", 236, 95, INTEGERS[4], new Short((short) 38), 65
});
optReceiverPlaceholder = insertRadioButton("optReceiverPlaceholder", OPTRECEIVERPLACEHOLDER_ITEM_CHANGED,
new String[]
@@ -700,7 +700,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(HID + 39), resources.resoptReceiverPlaceholder_value, "optReceiverPlaceholder", new Integer(104), new Integer(145), INTEGERS[4], new Short((short) 39), new Integer(200)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 39), resources.resoptReceiverPlaceholder_value, "optReceiverPlaceholder", 104, 145, INTEGERS[4], new Short((short) 39), 200
});
optReceiverDatabase = insertRadioButton("optReceiverDatabase", OPTRECEIVERDATABASE_ITEM_CHANGED,
new String[]
@@ -709,7 +709,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(HID + 40), resources.resoptReceiverDatabase_value, "optReceiverDatabase", new Integer(104), new Integer(157), INTEGERS[4], new Short((short) 40), new Integer(200)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 40), resources.resoptReceiverDatabase_value, "optReceiverDatabase", 104, 157, INTEGERS[4], new Short((short) 40), 200
});
lblSenderAddress = insertLabel("lblSenderAddress",
new String[]
@@ -718,7 +718,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblSenderAddress_value, "lblSenderAddress", new Integer(97), new Integer(28), INTEGERS[4], new Short((short) 64), new Integer(136)
+ INTEGERS[8], resources.reslblSenderAddress_value, "lblSenderAddress", 97, 28, INTEGERS[4], new Short((short) 64), 136
});
FixedLine2 = insertFixedLine("FixedLine2",
new String[]
@@ -727,7 +727,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[5], "FixedLine2", new Integer(90), new Integer(126), INTEGERS[4], new Short((short) 75), new Integer(212)
+ INTEGERS[5], "FixedLine2", 90, 126, INTEGERS[4], new Short((short) 75), 212
});
lblReceiverAddress = insertLabel("lblReceiverAddress",
new String[]
@@ -736,7 +736,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblReceiverAddress_value, "lblReceiverAddress", new Integer(97), new Integer(134), INTEGERS[4], new Short((short) 76), new Integer(136)
+ INTEGERS[8], resources.reslblReceiverAddress_value, "lblReceiverAddress", 97, 134, INTEGERS[4], new Short((short) 76), 136
});
lblSenderName = insertLabel("lblSenderName",
new String[]
@@ -745,7 +745,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblSenderName_value, "lblSenderName", new Integer(113), new Integer(69), INTEGERS[4], new Short((short) 77), new Integer(68)
+ INTEGERS[8], resources.reslblSenderName_value, "lblSenderName", 113, 69, INTEGERS[4], new Short((short) 77), 68
});
lblSenderStreet = insertLabel("lblSenderStreet",
new String[]
@@ -754,7 +754,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblSenderStreet_value, "lblSenderStreet", new Integer(113), new Integer(82), INTEGERS[4], new Short((short) 78), new Integer(68)
+ INTEGERS[8], resources.reslblSenderStreet_value, "lblSenderStreet", 113, 82, INTEGERS[4], new Short((short) 78), 68
});
lblPostCodeCity = insertLabel("lblPostCodeCity",
new String[]
@@ -763,16 +763,16 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblPostCodeCity_value, "lblPostCodeCity", new Integer(113), new Integer(97), INTEGERS[4], new Short((short) 79), new Integer(68)
+ INTEGERS[8], resources.reslblPostCodeCity_value, "lblPostCodeCity", 113, 97, INTEGERS[4], new Short((short) 79), 68
});
lblTitle4 = insertLabel("lblTitle4",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor6, INTEGER_16, resources.reslblTitle4_value, Boolean.TRUE, "lblTitle4", 91, INTEGERS[8], INTEGERS[4], new Short((short) 92), 212
});
}
@@ -785,7 +785,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- new Integer(47), HelpIds.getHelpIdString(HID + 41), Boolean.TRUE, "txtFooter", new Integer(97), INTEGER_40, INTEGERS[5], new Short((short) 41), new Integer(203)
+ 47, HelpIds.getHelpIdString(HID + 41), Boolean.TRUE, "txtFooter", 97, INTEGER_40, INTEGERS[5], new Short((short) 41), 203
});
chkFooterNextPages = insertCheckBox("chkFooterNextPages", CHKFOOTERNEXTPAGES_ITEM_CHANGED,
new String[]
@@ -794,7 +794,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 42), resources.reschkFooterNextPages_value, "chkFooterNextPages", 97, 92, new Short((short) 0), INTEGERS[5], new Short((short) 42), 202
});
chkFooterPageNumbers = insertCheckBox("chkFooterPageNumbers", CHKFOOTERPAGENUMBERS_ITEM_CHANGED,
new String[]
@@ -803,25 +803,25 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 43), resources.reschkFooterPageNumbers_value, "chkFooterPageNumbers", 97, 106, new Short((short) 0), INTEGERS[5], new Short((short) 43), 201
});
lblFooter = insertLabel("lblFooter",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor5, INTEGERS[8], resources.reslblFooter_value, "lblFooter", 97, 28, INTEGERS[5], new Short((short) 52), 116
});
lblTitle5 = insertLabel("lblTitle5",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor6, INTEGER_16, resources.reslblTitle5_value, Boolean.TRUE, "lblTitle5", 91, INTEGERS[8], INTEGERS[5], new Short((short) 93), 212
});
}
@@ -834,7 +834,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID + 44), "txtTemplateName", new Integer(202), new Integer(56), INTEGERS[6], new Short((short) 44), resources.restxtTemplateName_value, new Integer(100)
+ INTEGER_12, HelpIds.getHelpIdString(HID + 44), "txtTemplateName", 202, 56, INTEGERS[6], new Short((short) 44), resources.restxtTemplateName_value, 100
});
optCreateLetter = insertRadioButton("optCreateLetter", OPTCREATELETTER_ITEM_CHANGED,
new String[]
@@ -843,7 +843,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(HID + 45), resources.resoptCreateLetter_value, "optCreateLetter", new Integer(104), new Integer(111), INTEGERS[6], new Short((short) 50), new Integer(198)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 45), resources.resoptCreateLetter_value, "optCreateLetter", 104, 111, INTEGERS[6], new Short((short) 50), 198
});
optMakeChanges = insertRadioButton("optMakeChanges", OPTMAKECHANGES_ITEM_CHANGED,
new String[]
@@ -852,7 +852,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(HID + 46), resources.resoptMakeChanges_value, "optMakeChanges", new Integer(104), new Integer(123), INTEGERS[6], new Short((short) 51), new Integer(198)
+ INTEGERS[8], HelpIds.getHelpIdString(HID + 46), resources.resoptMakeChanges_value, "optMakeChanges", 104, 123, INTEGERS[6], new Short((short) 51), 198
});
lblFinalExplanation1 = insertLabel("lblFinalExplanation1",
new String[]
@@ -861,7 +861,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
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)
+ 26, resources.reslblFinalExplanation1_value, Boolean.TRUE, "lblFinalExplanation1", 97, 28, INTEGERS[6], new Short((short) 52), 205
});
lblProceed = insertLabel("lblProceed",
new String[]
@@ -870,7 +870,7 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblProceed_value, "lblProceed", new Integer(97), new Integer(100), INTEGERS[6], new Short((short) 53), new Integer(204)
+ INTEGERS[8], resources.reslblProceed_value, "lblProceed", 97, 100, INTEGERS[6], new Short((short) 53), 204
});
lblFinalExplanation2 = insertLabel("lblFinalExplanation2",
new String[]
@@ -879,16 +879,16 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
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)
+ 33, resources.reslblFinalExplanation2_value, Boolean.TRUE, "lblFinalExplanation2", 104, 145, INTEGERS[6], new Short((short) 54), 199
});
ImageControl2 = insertImage("ImageControl2",
new String[]
{
- "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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]
+ new Short((short) 0), INTEGERS[10], "private:resource/dbu/image/19205", "ImageControl2", 92, 145, Boolean.FALSE, INTEGERS[6], new Short((short) 66), INTEGERS[10]
});
lblTemplateName = insertLabel("lblTemplateName",
new String[]
@@ -897,16 +897,16 @@ public abstract class LetterWizardDialog extends WizardDialog implements LetterW
},
new Object[]
{
- INTEGERS[8], resources.reslblTemplateName_value, "lblTemplateName", new Integer(97), new Integer(58), INTEGERS[6], new Short((short) 82), new Integer(101)
+ INTEGERS[8], resources.reslblTemplateName_value, "lblTemplateName", 97, 58, INTEGERS[6], new Short((short) 82), 101
});
lblTitle6 = insertLabel("lblTitle6",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ fontDescriptor6, INTEGER_16, resources.reslblTitle6_value, Boolean.TRUE, "lblTitle6", 91, INTEGERS[8], INTEGERS[6], new Short((short) 94), 212
});
}
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
index 482e4a82c07d..ed3161c7282d 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogImpl.java
@@ -177,27 +177,27 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
myConfig.cp_PrivateLetter.cp_Norm = oL;
initializeTemplates(xMSF);
- if (myConfig.cp_BusinessLetter.cp_Greeting.equals(""))
+ if (myConfig.cp_BusinessLetter.cp_Greeting.equals(PropertyNames.EMPTY_STRING))
{
myConfig.cp_BusinessLetter.cp_Greeting = resources.GreetingLabels[0];
}
- if (myConfig.cp_BusinessLetter.cp_Salutation.equals(""))
+ if (myConfig.cp_BusinessLetter.cp_Salutation.equals(PropertyNames.EMPTY_STRING))
{
myConfig.cp_BusinessLetter.cp_Salutation = resources.SalutationLabels[0];
}
- if (myConfig.cp_PrivateOfficialLetter.cp_Greeting.equals(""))
+ if (myConfig.cp_PrivateOfficialLetter.cp_Greeting.equals(PropertyNames.EMPTY_STRING))
{
myConfig.cp_PrivateOfficialLetter.cp_Greeting = resources.GreetingLabels[1];
}
- if (myConfig.cp_PrivateOfficialLetter.cp_Salutation.equals(""))
+ if (myConfig.cp_PrivateOfficialLetter.cp_Salutation.equals(PropertyNames.EMPTY_STRING))
{
myConfig.cp_PrivateOfficialLetter.cp_Salutation = resources.SalutationLabels[1];
}
- if (myConfig.cp_PrivateLetter.cp_Greeting.equals(""))
+ if (myConfig.cp_PrivateLetter.cp_Greeting.equals(PropertyNames.EMPTY_STRING))
{
myConfig.cp_PrivateLetter.cp_Greeting = resources.GreetingLabels[2];
}
- if (myConfig.cp_PrivateLetter.cp_Salutation.equals(""))
+ if (myConfig.cp_PrivateLetter.cp_Salutation.equals(PropertyNames.EMPTY_STRING))
{
myConfig.cp_PrivateLetter.cp_Salutation = resources.SalutationLabels[2];
}
@@ -205,13 +205,13 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
//update the dialog UI according to the loaded Configuration
updateUI();
- if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING))
{
myPathSelection.initializePath();
}
XWindow xContainerWindow = myLetterDoc.xFrame.getContainerWindow();
- XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
+ XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
createWindowPeer(xWindowPeer);
//add the Roadmap to the dialog:
@@ -240,8 +240,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
removeTerminateListener();
exception.printStackTrace(System.out);
running = false;
- return;
- }
+ }
}
public void cancelWizard()
@@ -258,7 +257,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
//myLetterDoc.xTextDocument.lockControllers();
FileAccess fileAccess = new FileAccess(xMSF);
sPath = myPathSelection.getSelectedPath();
- if (sPath.equals(""))
+ if (sPath.equals(PropertyNames.EMPTY_STRING))
{
myPathSelection.triggerPathPicker();
sPath = myPathSelection.getSelectedPath();
@@ -311,7 +310,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
if (bSaveSuccess)
{
saveConfiguration();
- XInteractionHandler xIH = (XInteractionHandler) UnoRuntime.queryInterface(XInteractionHandler.class, xMSF.createInstance("com.sun.star.comp.uui.UUIInteractionHandler"));
+ XInteractionHandler xIH = 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";
@@ -335,7 +334,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
}
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);
+ XMultiServiceFactory xDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
ViewHandler myViewHandler = new ViewHandler(xDocMSF, xTextDocument);
myViewHandler.setViewSetting("ZoomType", new Short(com.sun.star.view.DocumentZoomType.OPTIMAL));
}
@@ -361,7 +360,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
try
{
//xComponent.dispose();
- XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myLetterDoc.xFrame);
+ XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, myLetterDoc.xFrame);
xCloseable.close(false);
}
catch (CloseVetoException e)
@@ -383,7 +382,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
lstBusinessStyleItemChanged();
enableSenderReceiver();
setPossibleFooter(true);
- if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING))
{
myPathSelection.initializePath();
}
@@ -403,7 +402,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
disableBusinessPaper();
enableSenderReceiver();
setPossibleFooter(true);
- if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING))
{
myPathSelection.initializePath();
}
@@ -423,7 +422,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
disableBusinessPaper();
disableSenderReceiver();
setPossibleFooter(false);
- if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(""))
+ if (myPathSelection.xSaveTextBox.getText().equalsIgnoreCase(PropertyNames.EMPTY_STRING))
{
myPathSelection.initializePath();
}
@@ -687,7 +686,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
//Height of the Company Address in the Receiver Field
int iReceiverHeight = (int) (0.5 * 1000);
- BusCompanyAddressReceiver = myLetterDoc.new BusinessPaperObject(" ", iFrameWidth, iReceiverHeight, iFrameX, (iFrameY - iReceiverHeight));
+ BusCompanyAddressReceiver = myLetterDoc.new BusinessPaperObject(PropertyNames.SPACE, iFrameWidth, iReceiverHeight, iFrameX, (iFrameY - iReceiverHeight));
setPossibleAddressReceiver(false);
}
@@ -734,7 +733,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
{
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)));
+ BusFooter = myLetterDoc.new BusinessPaperObject("Footer", myLetterDoc.DocSize.Width, (int) (numFooterHeight.getValue() * 1000), 0, (int) (myLetterDoc.DocSize.Height - (numFooterHeight.getValue() * 1000)));
this.setControlProperty("numFooterHeight", PropertyNames.PROPERTY_ENABLED, Boolean.TRUE);
this.setControlProperty("lblFooterHeight", PropertyNames.PROPERTY_ENABLED, Boolean.TRUE);
setPossibleFooter(false);
@@ -827,7 +826,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
//enable/disable roadmap item for footer page
XInterface BPaperItem = getRoadmapItemByID(RM_FOOTER);
- Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bFooterPossible));
+ Helper.setUnoPropertyValue(BPaperItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bFooterPossible));
}
catch (Exception exception)
@@ -848,7 +847,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
private void setPossibleFooter(boolean bState)
{
- setControlProperty("chkUseFooter", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
+ setControlProperty("chkUseFooter", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
chkUseFooterItemChanged();
}
@@ -856,7 +855,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
{
if (myLetterDoc.hasElement("Sender Address Repeated"))
{
- setControlProperty("chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
+ setControlProperty("chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
chkUseAddressReceiverItemChanged();
}
}
@@ -865,7 +864,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
{
if (myLetterDoc.hasElement("Company Logo"))
{
- setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
+ setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
chkUseLogoItemChanged();
}
}
@@ -907,7 +906,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
public void txtTemplateNameTextChanged()
{
- XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
XDocumentProperties xDocProps = xDocPropsSuppl.getDocumentProperties();
String TitleName = txtTemplateName.getText();
xDocProps.setTitle(TitleName);
@@ -915,14 +914,14 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
public void chkUseSalutationItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
myLetterDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
- setControlProperty("lstSalutation", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseSalutation.getState() != 0));
+ setControlProperty("lstSalutation", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseSalutation.getState() != 0));
}
public void lstSalutationItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
myLetterDoc.switchUserField("Salutation", xTextComponent.getText(), (chkUseSalutation.getState() != 0));
}
@@ -932,21 +931,21 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
public void chkUseGreetingItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
myLetterDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
- setControlProperty("lstGreeting", PropertyNames.PROPERTY_ENABLED, new Boolean(chkUseGreeting.getState() != 0));
+ setControlProperty("lstGreeting", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(chkUseGreeting.getState() != 0));
}
private void setDefaultForGreetingAndSalutation()
{
XTextComponent xTextComponent;
- xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
- if (xTextComponent.getText().equals(""))
+ xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstSalutation);
+ if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING))
{
xTextComponent.setText(resources.SalutationLabels[0]);
}
- xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
- if (xTextComponent.getText().equals(""))
+ xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ if (xTextComponent.getText().equals(PropertyNames.EMPTY_STRING))
{
xTextComponent.setText(resources.GreetingLabels[0]);
}
@@ -954,7 +953,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
public void lstGreetingItemChanged()
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, lstGreeting);
myLetterDoc.switchUserField("Greeting", xTextComponent.getText(), (chkUseGreeting.getState() != 0));
}
@@ -1009,20 +1008,20 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
private void setPossibleSenderData(boolean bState)
{
- setControlProperty("optSenderDefine", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("optSenderPlaceholder", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("lblSenderAddress", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
+ setControlProperty("optSenderDefine", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("optSenderPlaceholder", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("lblSenderAddress", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
if (!bState)
{
- setControlProperty("txtSenderCity", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("txtSenderName", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("txtSenderPostCode", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("txtSenderStreet", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("txtSenderCity", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("txtSenderState", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("lblSenderName", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("lblSenderStreet", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
- setControlProperty("lblPostCodeCity", PropertyNames.PROPERTY_ENABLED, new Boolean(bState));
+ setControlProperty("txtSenderCity", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("txtSenderName", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("txtSenderPostCode", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("txtSenderStreet", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("txtSenderCity", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("txtSenderState", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("lblSenderName", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("lblSenderStreet", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
+ setControlProperty("lblPostCodeCity", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bState));
}
}
@@ -1099,12 +1098,12 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
public void initializeSalutation()
{
- setControlProperty("lstSalutation", "StringItemList", resources.SalutationLabels);
+ setControlProperty("lstSalutation", PropertyNames.STRING_ITEM_LIST, resources.SalutationLabels);
}
public void initializeGreeting()
{
- setControlProperty("lstGreeting", "StringItemList", resources.GreetingLabels);
+ setControlProperty("lstGreeting", PropertyNames.STRING_ITEM_LIST, resources.GreetingLabels);
}
public void initializeNorms()
@@ -1114,11 +1113,11 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
String[] allLocales = lc.getIDs();
Object[] nameList =
{
- "", ""
+ PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING
};
String[] nameList2 =
{
- "", ""
+ PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING
};
Vector allPaths = new Vector();
String sLetterSubPath = "/wizard/letter/";
@@ -1127,7 +1126,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
{
sTemplatePath = FileAccess.deleteLastSlashfromUrl(sTemplatePath);
String[] PathParts = sTemplatePath.split("/");
- String nuString = "";
+ String nuString = PropertyNames.EMPTY_STRING;
String sMainPath;
for (int i = 0; i < (PathParts.length - 1); i++)
{
@@ -1140,7 +1139,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
sLetterPath = sMainPath + 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);
+ com.sun.star.ucb.XSimpleFileAccess xSimpleFileAccess = UnoRuntime.queryInterface(com.sun.star.ucb.XSimpleFileAccess.class, xInterface);
nameList2 = xSimpleFileAccess.getFolderContents(sLetterPath, true);
for (int i = 0; i < nameList2.length; i++)
{
@@ -1170,8 +1169,8 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
String[] LanguageLabels;
boolean found = false;
- String cIsoCode = "";
- String MSID = "";
+ String cIsoCode = PropertyNames.EMPTY_STRING;
+ String MSID = PropertyNames.EMPTY_STRING;
int z = 0;
for (int i = 0; i < nameList.length; i++)
{
@@ -1179,7 +1178,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
cIsoCode = FileAccess.getFilename((String) nameList[i]);
for (int t = 0; t < allLocales.length; t++)
{
- String[] aLang = allLocales[t].split(";");
+ String[] aLang = allLocales[t].split(PropertyNames.SEMI_COLON);
if (cIsoCode.equalsIgnoreCase(aLang[1]))
{
MSID = aLang[2];
@@ -1191,7 +1190,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
{
for (int t = 0; t < allLocales.length; t++)
{
- String[] aLang = allLocales[t].split(";");
+ String[] aLang = allLocales[t].split(PropertyNames.SEMI_COLON);
if (cIsoCode.equalsIgnoreCase(aLang[1].substring(0, 2)))
{
MSID = aLang[2];
@@ -1204,7 +1203,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
if (found)
{
NormsVector.add(cIsoCode);
- NormsPathVector.add((String) nameList[i]);
+ NormsPathVector.add(nameList[i]);
LanguageLabelsVector.add(lc.getLanguageString(MSID));
}
}
@@ -1219,7 +1218,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
LanguageLabels = new String[LanguageLabelsVector.size()];
LanguageLabelsVector.toArray(LanguageLabels);
- setControlProperty("lstLetterNorm", "StringItemList", LanguageLabels);
+ setControlProperty("lstLetterNorm", PropertyNames.STRING_ITEM_LIST, LanguageLabels);
}
private CGLetter getCurrentLetter()
@@ -1242,7 +1241,7 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
try
{
sTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "share", "/wizard");
- sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", "");
+ sUserTemplatePath = FileAccess.getOfficePath(xMSF, "Template", "user", PropertyNames.EMPTY_STRING);
sBitmapPath = FileAccess.combinePaths(xMSF, sTemplatePath, "/../wizard/bitmap");
}
catch (NoValidPathException e)
@@ -1263,19 +1262,19 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
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", PropertyNames.STRING_ITEM_LIST, BusinessFiles[0]);
+ setControlProperty("lstPrivOfficialStyle", PropertyNames.STRING_ITEM_LIST, OfficialFiles[0]);
+ setControlProperty("lstPrivateStyle", PropertyNames.STRING_ITEM_LIST, PrivateFiles[0]);
- setControlProperty("lstBusinessStyle", "SelectedItems", new short[]
+ setControlProperty("lstBusinessStyle", PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
- setControlProperty("lstPrivOfficialStyle", "SelectedItems", new short[]
+ setControlProperty("lstPrivOfficialStyle", PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
- setControlProperty("lstPrivateStyle", "SelectedItems", new short[]
+ setControlProperty("lstPrivateStyle", PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
@@ -1289,11 +1288,11 @@ public class LetterWizardDialogImpl extends LetterWizardDialog
public void initializeElements()
{
- setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Company Logo")));
- setControlProperty("chkUseBendMarks", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Bend Marks")));
- setControlProperty("chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Sender Address Repeated")));
- setControlProperty("chkUseSubject", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Subject Line")));
- setControlProperty("chkUseSigns", PropertyNames.PROPERTY_ENABLED, new Boolean(myLetterDoc.hasElement("Letter Signs")));
+ setControlProperty("chkUseLogo", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Company Logo")));
+ setControlProperty("chkUseBendMarks", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Bend Marks")));
+ setControlProperty("chkUseAddressReceiver", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Sender Address Repeated")));
+ setControlProperty("chkUseSubject", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Subject Line")));
+ setControlProperty("chkUseSigns", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(myLetterDoc.hasElement("Letter Signs")));
myLetterDoc.updateDateFields();
}
diff --git a/wizards/com/sun/star/wizards/query/CallQueryWizard.java b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
index fe18fd13f6d0..84870f99646e 100644
--- a/wizards/com/sun/star/wizards/query/CallQueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/CallQueryWizard.java
@@ -28,10 +28,10 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>).
@@ -82,15 +82,15 @@ public class CallQueryWizard
{
super();
m_serviceFactory = i_serviceFactory;
- registerProperty( "Command", (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) );
- registerProperty( "CommandType", PropertyAttribute.READONLY );
+ registerProperty( PropertyNames.COMMAND, (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) );
+ registerProperty( PropertyNames.COMMAND_TYPE, PropertyAttribute.READONLY );
}
public void trigger(String sEvent)
{
try
{
- if (sEvent.compareTo("start") == 0)
+ if (sEvent.compareTo(PropertyNames.START) == 0)
{
QueryWizard CurQueryWizard = new QueryWizard( m_serviceFactory, m_wizardContext );
Command = CurQueryWizard.startQueryWizard();
@@ -160,6 +160,7 @@ public class CallQueryWizard
* whole combination of objects.
* @return Array of bytes, in order to distinguish between two sets.
*/
+ @Override
public byte[] getImplementationId()
{
byte[] byteReturn =
@@ -168,7 +169,7 @@ public class CallQueryWizard
try
{
- byteReturn = new String("" + this.hashCode()).getBytes();
+ byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
}
catch (Exception exception)
{
@@ -191,6 +192,7 @@ public class CallQueryWizard
* @return Sequence of all types (usually interface types) provided by the
* service.
*/
+ @Override
public Type[] getTypes()
{
Type[] typeReturn =
diff --git a/wizards/com/sun/star/wizards/query/Finalizer.java b/wizards/com/sun/star/wizards/query/Finalizer.java
index 1b528a749f36..6caf2dfa60a2 100644
--- a/wizards/com/sun/star/wizards/query/Finalizer.java
+++ b/wizards/com/sun/star/wizards/query/Finalizer.java
@@ -71,7 +71,7 @@ public class Finalizer
},
new Object[]
{
- new Integer(8), reslblQueryTitle, new Integer(95), new Integer(27), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(52)
+ 8, reslblQueryTitle, 95, 27, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 52
});
m_aTxtTitle = m_queryWizard.insertTextField("txtQueryTitle", "changeTitle", this, new String[]
{
@@ -79,7 +79,7 @@ public class Finalizer
},
new Object[]
{
- new Integer(12), HelpIds.getHelpIdString(curHelpIndex++), new Integer(95), new Integer(37), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(90)
+ 12, HelpIds.getHelpIdString(curHelpIndex++), 95, 37, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 90
});
m_queryWizard.insertLabel("lblHowGoOn", new String[]
{
@@ -87,7 +87,7 @@ public class Finalizer
},
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)
+ 16, reslblHowGoOn, Boolean.TRUE, 192, 27, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 112
});
this.xRadioDisplayQuery = m_queryWizard.insertRadioButton("optDisplayQuery",
new String[]
@@ -96,7 +96,7 @@ public class Finalizer
},
new Object[]
{
- new Integer(9), HelpIds.getHelpIdString(curHelpIndex++), resoptDisplayQuery, new Integer(192), new Integer(46), new Short((short) 1), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118)
+ 9, HelpIds.getHelpIdString(curHelpIndex++), resoptDisplayQuery, 192, 46, new Short((short) 1), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 118
});
m_queryWizard.insertRadioButton("optModifyQuery",
@@ -106,7 +106,7 @@ public class Finalizer
},
new Object[]
{
- new Integer(10), HelpIds.getHelpIdString(curHelpIndex++), resoptModifyQuery, new Integer(192), new Integer(56), new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), new Integer(118)
+ 10, HelpIds.getHelpIdString(curHelpIndex++), resoptModifyQuery, 192, 56, new Integer(QueryWizard.SOSUMMARY_PAGE), new Short(curtabindex++), 118
});
m_queryWizard.insertFixedLine("flnSummary", new String[]
{
@@ -114,15 +114,15 @@ public class Finalizer
},
new Object[]
{
- new Integer(10), resflnSummary, new Integer(95), new Integer(68), new Integer(8), new Short(curtabindex++), new Integer(209)
+ 10, resflnSummary, 95, 68, 8, new Short(curtabindex++), 209
});
m_queryWizard.insertTextField("txtSummary", 0, null, new String[]
{
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ReadOnly", PropertyNames.PROPERTY_STEP, "VScroll", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.READ_ONLY, PropertyNames.PROPERTY_STEP, "VScroll", PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Integer(96), HelpIds.getHelpIdString(curHelpIndex++), Boolean.TRUE, new Integer(95), new Integer(80), Boolean.TRUE, new Integer(8), Boolean.TRUE, new Integer(209)
+ 96, HelpIds.getHelpIdString(curHelpIndex++), Boolean.TRUE, 95, 80, Boolean.TRUE, 8, Boolean.TRUE, 209
});
}
@@ -142,7 +142,7 @@ public class Finalizer
String sCurQueryName = AnyConverter.toString(Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text"));
if (sCurQueryName != null)
{
- if (sCurQueryName.equals(""))
+ if (sCurQueryName.equals(PropertyNames.EMPTY_STRING))
{
String[] sCommandNames = CurDBMetaData.getIncludedCommandNames();
sCurQueryName = resQuery + "_" + sCommandNames[0];
@@ -158,14 +158,13 @@ public class Finalizer
catch (com.sun.star.uno.Exception exception)
{
exception.printStackTrace(System.out);
- return "";
+ return PropertyNames.EMPTY_STRING;
}
}
private String getTitle()
{
- final String sTitle = (String) Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text");
- return sTitle;
+ return (String) Helper.getUnoPropertyValue(UnoDialog.getModel(m_aTxtTitle), "Text");
}
public String finish()
@@ -176,7 +175,7 @@ public class Finalizer
)
return queryName;
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public final boolean displayQueryDesign()
diff --git a/wizards/com/sun/star/wizards/query/QuerySummary.java b/wizards/com/sun/star/wizards/query/QuerySummary.java
index f246ef327db8..7a0ab0d06beb 100644
--- a/wizards/com/sun/star/wizards/query/QuerySummary.java
+++ b/wizards/com/sun/star/wizards/query/QuerySummary.java
@@ -29,6 +29,7 @@ package com.sun.star.wizards.query;
import com.sun.star.beans.PropertyValue;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.JavaTools;
+import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.db.FieldColumn;
import com.sun.star.wizards.db.QueryMetaData;
@@ -58,25 +59,16 @@ public class QuerySummary extends QueryMetaData
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 = "";
+ String sFieldNamesFraction = PropertyNames.EMPTY_STRING;
+ String sSortingFraction = PropertyNames.EMPTY_STRING;
+ String sFilterFraction = PropertyNames.EMPTY_STRING;
+ String sAggregateFraction = PropertyNames.EMPTY_STRING;
+ String sGroupByFraction = PropertyNames.EMPTY_STRING;
+ String sHavingFraction = PropertyNames.EMPTY_STRING;
sFieldNamesFraction = combineFieldNameFraction() + sReturnChar;
sSortingFraction = combinePartString(RID_QUERY + 51, getSortFieldNames(), RID_QUERY + 52, RID_QUERY + 93, new String[]
{
@@ -92,7 +84,7 @@ public class QuerySummary extends QueryMetaData
}
// TODO: remove the last return from the string
sSummary = sFieldNamesFraction + sSortingFraction + sFilterFraction + sAggregateFraction + sGroupByFraction + sHavingFraction;
- sSummary = JavaTools.replaceSubString(sSummary, "", "~");
+ sSummary = JavaTools.replaceSubString(sSummary, PropertyNames.EMPTY_STRING, "~");
}
catch (com.sun.star.uno.Exception exception)
{
@@ -107,41 +99,37 @@ public class QuerySummary extends QueryMetaData
private String combineFilterNameFraction(PropertyValue[][] _filterconditions, int _InitResID, int _AlternativeResID)
{
- if (_filterconditions != null)
+ if (_filterconditions != null && _filterconditions.length > 0)
{
- if (_filterconditions.length > 0)
+ String sconditions = PropertyNames.EMPTY_STRING;
+ String sStart = oResource.getResText(_InitResID);
+ String BaseString = oResource.getResText(RID_QUERY + 96);
+ if (_filterconditions.length == 1)
{
- 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++)
{
- 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);
- }
+ sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[0][i], this);
+ sconditions = appendClauseSeparator(sconditions, PropertyNames.SPACE + sAnd + PropertyNames.SPACE, i, curfilterconditions.length);
}
- else
- {
+ }
+ else
+ {
- for (int i = 0; i < _filterconditions.length; i++)
- {
- sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0], this);
- sconditions = appendClauseSeparator(sconditions, " " + sOr + " ", i, _filterconditions.length);
- }
+ for (int i = 0; i < _filterconditions.length; i++)
+ {
+ sconditions += FilterComponent.getDisplayCondition(BaseString, _filterconditions[i][0], this);
+ sconditions = appendClauseSeparator(sconditions, PropertyNames.SPACE + sOr + PropertyNames.SPACE, i, _filterconditions.length);
}
- String sreturn = sStart + sconditions;
- return sreturn;
}
+ return sStart + sconditions;
}
return oResource.getResText(_AlternativeResID);
}
private String combineFieldNameFraction()
{
- String CurString = "";
+ String CurString = PropertyNames.EMPTY_STRING;
String sReturn = oResource.getResText(RID_QUERY + 50);
String BaseString = oResource.getResText(RID_QUERY + 92);
for (int i = 0; i < FieldColumns.length; i++)
@@ -173,14 +161,12 @@ public class QuerySummary extends QueryMetaData
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 != null && _FieldNames.length > 0)
{
- if (_FieldNames.length > 0)
- {
- return ArrayFieldsToString(_InitResID, _FieldNames);
- }
+ return ArrayFieldsToString(_InitResID, _FieldNames);
}
return oResource.getResText(_AlternativeResID);
}
@@ -202,19 +188,16 @@ public class QuerySummary extends QueryMetaData
public String combinePartString(int _InitResID, String[][] _FieldNames, int _AlternativeResID, int _BaseStringID, String[] _ReplaceTags)
{
- if (_FieldNames != null)
+ if (_FieldNames != null && _FieldNames.length > 0)
{
- if (_FieldNames.length > 0)
- {
- return ArrayFieldsToString(_InitResID, _FieldNames, _BaseStringID, _ReplaceTags);
- }
+ return ArrayFieldsToString(_InitResID, _FieldNames, _BaseStringID, _ReplaceTags);
}
return oResource.getResText(_AlternativeResID);
}
public String ArrayFieldsToString(int _InitResID, String[][] _FieldNames, int _BaseStringID, String[] _ReplaceTags)
{
- String CurString = "";
+ String CurString = PropertyNames.EMPTY_STRING;
String sReturn = oResource.getResText(_InitResID);
int FieldCount = _FieldNames.length;
if (FieldCount > 0)
diff --git a/wizards/com/sun/star/wizards/query/QueryWizard.java b/wizards/com/sun/star/wizards/query/QueryWizard.java
index bca4e1a6fa5f..f4dd3296dbce 100644
--- a/wizards/com/sun/star/wizards/query/QueryWizard.java
+++ b/wizards/com/sun/star/wizards/query/QueryWizard.java
@@ -53,6 +53,7 @@ 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;
@@ -76,21 +77,23 @@ public class QueryWizard extends DatabaseObjectWizard
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 )
+ public QueryWizard(XMultiServiceFactory xMSF, PropertyValue[] i_wizardContext)
{
- super( xMSF, 40970, i_wizardContext );
+ super(xMSF, 40970, i_wizardContext);
addResourceHandler("QueryWizard", "dbw");
m_DBMetaData = new QuerySummary(xMSF, m_oResource);
}
public static void main(String i_args[])
{
- final String settings[] = new String[] { null, null, null };
+ final String settings[] = new String[]
+ {
+ null, null, null
+ };
final int IDX_PIPE_NAME = 0;
final int IDX_LOCATION = 1;
final int IDX_DSN = 2;
@@ -98,28 +101,28 @@ public class QueryWizard extends DatabaseObjectWizard
// some simple parsing
boolean failure = false;
int settingsIndex = -1;
- for ( int i=0; i<i_args.length; ++i )
+ for (int i = 0; i < i_args.length; ++i)
{
- if ( settingsIndex >= 0 )
+ if (settingsIndex >= 0)
{
- settings[ settingsIndex ] = i_args[i];
+ settings[ settingsIndex] = i_args[i];
settingsIndex = -1;
continue;
}
- if ( i_args[i].equals( "--pipe-name" ) )
+ if (i_args[i].equals("--pipe-name"))
{
settingsIndex = IDX_PIPE_NAME;
continue;
}
- if ( i_args[i].equals( "--database-location" ) )
+ if (i_args[i].equals("--database-location"))
{
settingsIndex = IDX_LOCATION;
continue;
}
- if ( i_args[i].equals( "--data-source-name" ) )
+ if (i_args[i].equals("--data-source-name"))
{
settingsIndex = IDX_DSN;
continue;
@@ -128,18 +131,22 @@ public class QueryWizard extends DatabaseObjectWizard
failure = true;
}
- if ( settings[ IDX_PIPE_NAME ] == null )
+ if (settings[ IDX_PIPE_NAME] == null)
+ {
failure = true;
+ }
- if ( ( settings[ IDX_DSN ] == null ) && ( settings[ IDX_LOCATION ] == null ) )
+ if ((settings[ IDX_DSN] == null) && (settings[ IDX_LOCATION] == null))
+ {
failure = true;
+ }
- if ( failure )
+ if (failure)
{
- System.err.println( "supported arguments: " );
- System.err.println( " --pipe-name <name> : specifies the name of the pipe to connect to the running OOo instance" );
- System.err.println( " --database-location <url> : specifies the URL of the database document to work with" );
- System.err.println( " --data-source-name <name> : specifies the name of the data source to work with" );
+ System.err.println("supported arguments: ");
+ System.err.println(" --pipe-name <name> : specifies the name of the pipe to connect to the running OOo instance");
+ System.err.println(" --database-location <url> : specifies the URL of the database document to work with");
+ System.err.println(" --data-source-name <name> : specifies the name of the data source to work with");
return;
}
@@ -150,12 +157,16 @@ public class QueryWizard extends DatabaseObjectWizard
if (serviceFactory != null)
{
PropertyValue[] curproperties = new PropertyValue[1];
- if ( settings[ IDX_LOCATION ] != null )
- curproperties[0] = Properties.createProperty( "DatabaseLocation", settings[ IDX_LOCATION ] );
+ if (settings[ IDX_LOCATION] != null)
+ {
+ curproperties[0] = Properties.createProperty("DatabaseLocation", settings[ IDX_LOCATION]);
+ }
else
- curproperties[0] = Properties.createProperty( "DataSourceName", settings[ IDX_DSN ] );
+ {
+ curproperties[0] = Properties.createProperty("DataSourceName", settings[ IDX_DSN]);
+ }
- QueryWizard CurQueryWizard = new QueryWizard( serviceFactory, curproperties );
+ QueryWizard CurQueryWizard = new QueryWizard(serviceFactory, curproperties);
CurQueryWizard.startQueryWizard();
}
}
@@ -174,7 +185,7 @@ public class QueryWizard extends DatabaseObjectWizard
{
try
{
- if ( m_DBMetaData.getConnection( m_wizardContext ) )
+ if (m_DBMetaData.getConnection(m_wizardContext))
{
reslblFields = m_oResource.getResText(UIConsts.RID_QUERY + 4);
reslblFieldHeader = m_oResource.getResText(UIConsts.RID_QUERY + 19); //Fielnames in AliasComponent
@@ -182,27 +193,27 @@ public class QueryWizard extends DatabaseObjectWizard
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);
+ String resQueryWizard = m_oResource.getResText(UIConsts.RID_QUERY + 2);
resmsgNonNumericAsGroupBy = m_oResource.getResText(UIConsts.RID_QUERY + 88);
Helper.setUnoPropertyValues(xDialogModel, new String[]
{
- PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_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)
+ 210, Boolean.TRUE, "DialogQuery", 102, 41, 1, new Short((short) 0), resQueryWizard, 310
});
drawNaviBar();
setRightPaneHeaders(m_oResource, UIConsts.RID_QUERY + 70, 8);
this.setMaxStep(8);
buildSteps();
- this.m_DBCommandFieldSelectio.preselectCommand( m_wizardContext, false );
+ this.m_DBCommandFieldSelectio.preselectCommand(m_wizardContext, false);
- XWindowPeer windowPeer = UnoRuntime.queryInterface( XWindowPeer.class, m_frame.getContainerWindow() );
+ XWindowPeer windowPeer = UnoRuntime.queryInterface(XWindowPeer.class, m_frame.getContainerWindow());
createWindowPeer(windowPeer);
m_DBMetaData.setWindowPeer(this.xControl.getPeer());
insertQueryRelatedSteps();
- executeDialog( m_frame.getContainerWindow().getPosSize() );
+ executeDialog(m_frame.getContainerWindow().getPosSize());
}
}
catch (java.lang.Exception jexception)
@@ -237,7 +248,7 @@ public class QueryWizard extends DatabaseObjectWizard
switch (CurItemID)
{
case SOAGGREGATE_PAGE:
- if (_bEnabled == true)
+ if (_bEnabled)
{
bEnabled = ((m_DBMetaData.hasNumericalFields()) && (m_DBMetaData.xDBMetaData.supportsCoreSQLGrammar()));
}
@@ -247,7 +258,7 @@ public class QueryWizard extends DatabaseObjectWizard
break;
case SOGROUPFILTER_PAGE:
bEnabled = false;
- if (_bEnabled == true)
+ if (_bEnabled)
{
bEnabled = (m_DBMetaData.GroupByFilterConditions.length > 0);
}
@@ -310,8 +321,8 @@ public class QueryWizard extends DatabaseObjectWizard
try
{
m_DBCommandFieldSelectio = new CommandFieldSelection(
- this, m_DBMetaData, 120, reslblFields, reslblSelFields, reslblTables,
- m_DBMetaData.supportsQueriesInFrom(), 40850);
+ this, m_DBMetaData, 120, reslblFields, reslblSelFields, reslblTables,
+ m_DBMetaData.supportsQueriesInFrom(), 40850);
m_DBCommandFieldSelectio.setAppendMode(true);
m_DBCommandFieldSelectio.addFieldSelectionListener(new FieldSelectionListener());
m_sortingComponent = new SortingComponent(this, SOSORTING_PAGE, 95, 27, 210, 40865);
@@ -341,14 +352,13 @@ public class QueryWizard extends DatabaseObjectWizard
public boolean finishWizard()
{
int ncurStep = getCurrentStep();
- if ( ( ncurStep == SOSUMMARY_PAGE )
- || ( switchToStep( ncurStep, SOSUMMARY_PAGE ) )
- )
+ if ((ncurStep == SOSUMMARY_PAGE)
+ || (switchToStep(ncurStep, SOSUMMARY_PAGE)))
{
m_createdQuery = m_finalizer.finish();
- if ( m_createdQuery.length() > 0 )
+ if (m_createdQuery.length() > 0)
{
- loadSubComponent( CommandType.QUERY, m_createdQuery, m_finalizer.displayQueryDesign() );
+ loadSubComponent(CommandType.QUERY, m_createdQuery, m_finalizer.displayQueryDesign());
xDialog.endExecute();
return true;
}
@@ -490,7 +500,7 @@ public class QueryWizard extends DatabaseObjectWizard
ID = 1;
if (sIncSuffix != null)
{
- if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
+ if ((!sIncSuffix.equals(PropertyNames.EMPTY_STRING)) && (!sIncSuffix.equals("_")))
{
String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
ID = Integer.parseInt(sID);
diff --git a/wizards/com/sun/star/wizards/report/CallReportWizard.java b/wizards/com/sun/star/wizards/report/CallReportWizard.java
index c66596e11c02..8b10e96ac5a3 100644
--- a/wizards/com/sun/star/wizards/report/CallReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/CallReportWizard.java
@@ -28,11 +28,13 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>).
@@ -114,9 +116,9 @@ public class CallReportWizard
{
try
{
- if (sEvent.compareTo("start") == 0)
+ if (sEvent.compareTo(PropertyNames.START) == 0)
{
- if (bWizardstartedalready != true)
+ if (!bWizardstartedalready)
{
ReportWizard CurReportWizard = new ReportWizard( xmultiservicefactory, m_wizardContext );
CurReportWizard.startReportWizard();
@@ -138,9 +140,9 @@ public class CallReportWizard
}
}
}
- catch (Exception exception)
+ catch (Exception e)
{
- System.err.println(exception);
+ Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e);
}
System.gc();
}
@@ -212,11 +214,11 @@ public class CallReportWizard
try
{
- byteReturn = new String("" + this.hashCode()).getBytes();
+ byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
}
- catch (Exception exception)
+ catch (Exception e)
{
- System.err.println(exception);
+ Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e);
}
return (byteReturn);
@@ -251,9 +253,9 @@ public class CallReportWizard
new Type(com.sun.star.lang.XInitialization.class)
};
}
- catch (Exception exception)
+ catch (Exception e)
{
- System.err.println(exception);
+ Logger.getLogger(CallReportWizard.class.getName()).log(Level.SEVERE, null, e);
}
return (typeReturn);
diff --git a/wizards/com/sun/star/wizards/report/DBColumn.java b/wizards/com/sun/star/wizards/report/DBColumn.java
index ee60f3744000..25b6da4950c3 100644
--- a/wizards/com/sun/star/wizards/report/DBColumn.java
+++ b/wizards/com/sun/star/wizards/report/DBColumn.java
@@ -126,7 +126,7 @@ public class DBColumn
try
{
XCell xCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 0);
- XTextRange xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
+ XTextRange xTextCell = UnoRuntime.queryInterface(XTextRange.class, xCell);
String CompString = "Column";
XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString) || (_bforce))
@@ -134,7 +134,7 @@ public class DBColumn
xNameCell = xCell;
xNameTextCell = xTextCell;
xValCell = CurRecordTable.xCellRange.getCellByPosition(_nColumn, 1);
- xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell);
+ xValTextCell = UnoRuntime.queryInterface(XTextRange.class, xValCell);
xValCellCursor = TextDocument.createTextCursor(xValCell);
ValColumn = _nColumn;
return true;
@@ -190,7 +190,7 @@ public class DBColumn
for (int m = 0; m < xRows.getCount(); m++)
{
xCell = xCellRange.getCellByPosition(n, m);
- xTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xCell);
+ xTextCell = UnoRuntime.queryInterface(XTextRange.class, xCell);
String CompString = TableName.substring(4);
XTextCursor xLocCellCursor = TextDocument.createTextCursor(xCell);
if (isNameCell(xLocCellCursor, CurDBField.getFieldName(), CompString))
@@ -216,12 +216,12 @@ public class DBColumn
try
{
XNameAccess xAllTextTables = oTextTableHandler.xTextTablesSupplier.getTextTables();
- if (xAllTextTables.hasByName(TableName) == true)
+ if (xAllTextTables.hasByName(TableName))
{
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);
+ xCellRange = UnoRuntime.queryInterface(XCellRange.class, oTextTable);
+ xTextTable = UnoRuntime.queryInterface(XTextTable.class, oTextTable);
+ xTableName = UnoRuntime.queryInterface(XNamed.class, oTextTable);
xTableColumns = xTextTable.getColumns();
}
}
@@ -257,7 +257,7 @@ public class DBColumn
XTextCursor xTextCursor = TextDocument.createTextCursor(xNameCell);
xTextCursor.gotoStart(false);
xTextCursor.gotoEnd(true);
- xTextCursor.setString("");
+ xTextCursor.setString(PropertyNames.EMPTY_STRING);
oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle());
}
@@ -266,7 +266,7 @@ public class DBColumn
XTextCursor xTextCursor = TextDocument.createTextCursor(xCell);
xTextCursor.gotoStart(false);
xTextCursor.gotoEnd(true);
- xTextCursor.setString("");
+ xTextCursor.setString(PropertyNames.EMPTY_STRING);
oTextFieldHandler.insertUserField(xTextCursor, CurDBField.getFieldName(), CurDBField.getFieldTitle());
}
@@ -290,7 +290,7 @@ public class DBColumn
try
{
xValCell = xCellRange.getCellByPosition(ValColumn, ValRow);
- xValTextCell = (XTextRange) UnoRuntime.queryInterface(XTextRange.class, xValCell);
+ xValTextCell = UnoRuntime.queryInterface(XTextRange.class, xValCell);
modifyCellContent(CurGroupValue);
if (bAlignLeft)
{
@@ -361,7 +361,7 @@ public class DBColumn
try
{
Object CurGroupValue;
- if (bIsGroupColumn == false && CurDBField.isNumberFormat() == false)
+ if (!bIsGroupColumn && !CurDBField.isNumberFormat())
{
CurGroupValue = BlindtextCreator.adjustBlindTextlength(CurDBField.getFieldTitle(), CurDBField.getFieldWidth(), _bIsLandscape, bIsGroupColumn, CurDBMetaData.getRecordFieldNames());
}
@@ -381,7 +381,7 @@ public class DBColumn
{
CharFontName = "StarSymbol";
Helper.setUnoPropertyValue(xValCellCursor, "CharFontName", CharFontName);
- if (bIsGroupColumn == false)
+ if (!bIsGroupColumn)
{
Helper.setUnoPropertyValue(xValCellCursor, "ParaAdjust", new Integer(ParagraphAdjust.CENTER_value));
}
@@ -390,7 +390,7 @@ public class DBColumn
{
if (PropertyState == com.sun.star.beans.PropertyState.DEFAULT_VALUE)
{
- XPropertyState xPropState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
+ XPropertyState xPropState = UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
xPropState.setPropertyToDefault("CharFontName");
}
else
@@ -425,7 +425,7 @@ public class DBColumn
}
else
{
- xPropertyState = (XPropertyState) UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
+ xPropertyState = UnoRuntime.queryInterface(XPropertyState.class, xValCellCursor);
PropertyState = xPropertyState.getPropertyState("CharFontName");
CharFontName = AnyConverter.toString(Helper.getUnoPropertyValue(xValCellCursor, "CharFontName"));
}
@@ -449,7 +449,7 @@ public class DBColumn
}
else
{
- XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
+ XDependentTextField xDependent = UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
XPropertySet xMaster = xDependent.getTextFieldMaster();
String UserFieldName = (String) xMaster.getPropertyValue(PropertyNames.PROPERTY_NAME);
boolean bIsNameCell = false;
diff --git a/wizards/com/sun/star/wizards/report/Dataimport.java b/wizards/com/sun/star/wizards/report/Dataimport.java
index 2081b655ae7e..5b80ec41e5b8 100644
--- a/wizards/com/sun/star/wizards/report/Dataimport.java
+++ b/wizards/com/sun/star/wizards/report/Dataimport.java
@@ -34,6 +34,8 @@ import com.sun.star.text.XTextDocument;
import com.sun.star.wizards.ui.*;
import com.sun.star.wizards.common.*;
import com.sun.star.uno.Exception;
+import java.util.logging.Level;
+import java.util.logging.Logger;
public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionListener
{ // extends ReportWizard
@@ -95,8 +97,8 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
// 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");
+// curproperties[1] = Properties.createProperty(PropertyNames.COMMAND_TYPE, new Integer(CommandType.TABLE));
+// curproperties[2] = Properties.createProperty(PropertyNames.COMMAND, "Table2");
//
// Dataimport CurDataimport = new Dataimport(xMSF);
// TextDocument oTextDocument = new TextDocument(xMSF, true, null);
@@ -119,11 +121,11 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_STEP, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Integer(84), new Integer(0), sProgressTitle, new Integer(180)
+ 84, 0, sProgressTitle, 180
});
com.sun.star.awt.FontDescriptor oFontDesc = new com.sun.star.awt.FontDescriptor();
oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD;
@@ -132,11 +134,11 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDBConnection",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- oFontDesc, new Integer(10), sProgressDBConnection, new Integer(6), new Integer(6), new Integer(0), new Integer(150)
+ oFontDesc, 10, sProgressDBConnection, 6, 6, 0, 150
});
insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport",
@@ -146,7 +148,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
},
new Object[]
{
- new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120)
+ 10, sProgressDataImport, 6, 24, 0, 120
});
}
else
@@ -154,11 +156,11 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblProgressDataImport",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- oFontDesc, new Integer(10), sProgressDataImport, new Integer(6), new Integer(24), new Integer(0), new Integer(120)
+ oFontDesc, 10, sProgressDataImport, 6, 24, 0, 120
});
}
insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblCurProgress",
@@ -168,7 +170,7 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
},
new Object[]
{
- new Integer(10), "", new Integer(12), new Integer(42), new Integer(0), new Integer(120)
+ 10, PropertyNames.EMPTY_STRING, 12, 42, 0, 120
});
insertButton("cmdCancel", 10000, this,
@@ -178,22 +180,21 @@ public class Dataimport extends UnoDialog2 implements com.sun.star.awt.XActionLi
},
new Object[]
{
- new Integer(14), HelpIds.getHelpIdString(34321), new Integer(74), new Integer(58), new Integer(0), new Short((short) 1), new Integer(40), sStop
+ 14, HelpIds.getHelpIdString(34321), 74, 58, 0, new Short((short) 1), 40, sStop
});
createWindowPeer(CurReportDocument.getWizardParent());
calculateDialogPosition(CurReportDocument.getFrame().getComponentWindow().getPosSize());
xWindow.setVisible(true);
super.xReschedule.reschedule();
- return;
- }
- catch (Exception exception)
+ }
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(Dataimport.class.getName()).log(Level.SEVERE, null, e);
// return;
}
- catch (java.lang.Exception jexception)
+ catch (java.lang.Exception e)
{
- jexception.printStackTrace(System.out);
+ Logger.getLogger(Dataimport.class.getName()).log(Level.SEVERE, null, e);
// return;
}
}
diff --git a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
index bab8a4bb240e..b123bb3b06fb 100644
--- a/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
+++ b/wizards/com/sun/star/wizards/report/GroupFieldHandler.java
@@ -53,8 +53,8 @@ public class GroupFieldHandler extends FieldSelection
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));
+ CurUnoDialog.setControlProperty("lstFields_2", "MultiSelection", Boolean.FALSE);
+ CurUnoDialog.setControlProperty("lstSelFields_2", "MultiSelection", Boolean.FALSE);
addFieldSelectionListener(new FieldSelectionListener());
String sNote = ReportWizard.getBlindTextNote(_CurReportDocument, _CurUnoDialog.m_oResource);
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblBlindTextNote_1",
@@ -64,7 +64,7 @@ public class GroupFieldHandler extends FieldSelection
},
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)
+ Boolean.FALSE, 18, sNote, Boolean.TRUE, 95, 158, new Integer(ReportWizard.SOGROUPPAGE), 209
});
}
catch (Exception exception)
@@ -113,7 +113,7 @@ public class GroupFieldHandler extends FieldSelection
{
emptyFieldsListBoxes();
GroupFieldVector.removeAllElements();
- CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, new Boolean(false));
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
}
public void getGroupFieldNames(CommandMetaData CurDBMetaData)
@@ -162,7 +162,7 @@ public class GroupFieldHandler extends FieldSelection
int iSelCount = xSelectedFieldsListBox.getItemCount();
String[] CurGroupNames = xFieldsListBox.getItems();
CurReportDocument.liveupdate_addGroupNametoDocument(CurGroupNames, CurGroupTitle, GroupFieldVector, CurReportDocument.getReportPath(), iSelCount);
- CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, new Boolean(true));
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.TRUE);
if (iSelCount >= MAXSELFIELDS)
{
toggleMoveButtons(false, false);
@@ -178,7 +178,7 @@ public class GroupFieldHandler extends FieldSelection
String[] NewSelList = xSelectedFieldsListBox.getItems();
CurReportDocument.liveupdate_removeGroupName(NewSelList, OldGroupTitle, GroupFieldVector);
String[] NewSelGroupNames = xSelectedFieldsListBox.getItems();
- CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, new Boolean(NewSelGroupNames.length == 0));
+ CurUnoDialog.setControlProperty("lblBlindTextNote_1", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(NewSelGroupNames.length == 0));
// CurReportDocument.refreshGroupFields(xSelectedFieldsListBox.getItems());
}
diff --git a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
index 6422befd65f0..0de49032b901 100755
--- a/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
+++ b/wizards/com/sun/star/wizards/report/IReportBuilderLayouter.java
@@ -103,6 +103,14 @@ public interface IReportBuilderLayouter
public void insertGroupNames(String[] _aGroupFieldNames);
/**
+ * Insert the names of the groups which should be used as sorting, 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 _aSortFieldNames
+ */
+ public void insertSortingNames(String[][] _aSortFieldNames);
+
+ /**
* This method redraws the whole layout with all it's content
*/
public void layout();
diff --git a/wizards/com/sun/star/wizards/report/RecordTable.java b/wizards/com/sun/star/wizards/report/RecordTable.java
index b4af7f7fa94b..86b365fbac80 100644
--- a/wizards/com/sun/star/wizards/report/RecordTable.java
+++ b/wizards/com/sun/star/wizards/report/RecordTable.java
@@ -69,21 +69,21 @@ public class RecordTable
{
oTable = xAllTextTables.getByName(ReportTextDocument.TBLRECORDSECTION);
}
- xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
- xTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, xTextTable);
+ xTextTable = UnoRuntime.queryInterface(XTextTable.class, oTable);
+ xTableName = UnoRuntime.queryInterface(XNamed.class, xTextTable);
}
else
{
- XIndexAccess xTableIndex = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xAllTextTables);
+ XIndexAccess xTableIndex = 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);
+ xTextTable = UnoRuntime.queryInterface(XTextTable.class, x);
+ xTableName = UnoRuntime.queryInterface(XNamed.class, xTextTable);
xTableName.setName(ReportTextDocument.TBLRECORDSECTION);
}
xTableRows = xTextTable.getRows();
xTableColumns = xTextTable.getColumns();
- xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
+ xCellRange = UnoRuntime.queryInterface(XCellRange.class, xTextTable);
}
catch (Exception exception)
{
diff --git a/wizards/com/sun/star/wizards/report/ReportFinalizer.java b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
index 73a32f35c029..5498eb89dd55 100644
--- a/wizards/com/sun/star/wizards/report/ReportFinalizer.java
+++ b/wizards/com/sun/star/wizards/report/ReportFinalizer.java
@@ -94,7 +94,7 @@ public class ReportFinalizer
},
new Object[]
{
- new Integer(8), sReportTitle, new Integer(95), new Integer(27), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(68)
+ 8, sReportTitle, 95, 27, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 68
});
xTitleTextBox = CurUnoDialog.insertTextField("txtTitle", CHANGEREPORTTITLE_FUNCNAME, this,
@@ -104,7 +104,7 @@ public class ReportFinalizer
},
new Object[]
{
- new Integer(12), "HID:WIZARDS_HID_DLGREPORT_4_TITLE", new Integer(95), new Integer(37), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ 12, "HID:WIZARDS_HID_DLGREPORT_4_TITLE", 95, 37, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209
});
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblChooseReportKind",
@@ -114,7 +114,7 @@ public class ReportFinalizer
},
new Object[]
{
- new Integer(8), slblChooseReportKind, new Integer(95), new Integer(57), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ 8, slblChooseReportKind, 95, 57, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209
});
CurUnoDialog.insertRadioButton("optCreateDocument", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
@@ -124,7 +124,7 @@ public class ReportFinalizer
},
new Object[]
{
- new Integer(10), "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", sSaveAsDocument, new Integer(95), new Integer(69), new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138)
+ 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTSTATDOCUMENT", sSaveAsDocument, 95, 69, new Short((short) 0), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 138
});
CurUnoDialog.insertRadioButton("optCreateReportTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
@@ -134,7 +134,7 @@ public class ReportFinalizer
},
new Object[]
{
- new Integer(8), "HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", sSaveAsTemplate, new Integer(95), new Integer(81), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ 8, "HID:WIZARDS_HID_DLGREPORT_5_OPTDYNTEMPLATE", sSaveAsTemplate, 95, 81, new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209
});
@@ -145,7 +145,7 @@ public class ReportFinalizer
},
new Object[]
{
- new Integer(8), slblHowProceed, new Integer(105), new Integer(93), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(209)
+ 8, slblHowProceed, 105, 93, new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 209
});
@@ -156,7 +156,7 @@ public class ReportFinalizer
},
new Object[]
{
- new Integer(10), "HID:WIZARDS_HID_DLGREPORT_5_OPTEDITTEMPLATE", sEditTemplate, new Integer(111), new Integer(105), new Integer(6), new Short(curtabindex++), new Integer(138)
+ 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTEDITTEMPLATE", sEditTemplate, 111, 105, 6, new Short(curtabindex++), 138
});
CurUnoDialog.insertRadioButton("optUseTemplate", TOGGLESUBTEMPLATECONTROLS_FUNCNAME, this,
@@ -166,7 +166,7 @@ public class ReportFinalizer
},
new Object[]
{
- new Integer(10), "HID:WIZARDS_HID_DLGREPORT_5_OPTUSETEMPLATE", sUseTemplate, new Integer(111), new Integer(115), new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), new Integer(138)
+ 10, "HID:WIZARDS_HID_DLGREPORT_5_OPTUSETEMPLATE", sUseTemplate, 111, 115, new Short((short) 1), new Integer(ReportWizard.SOSTOREPAGE), new Short(curtabindex++), 138
});
}
@@ -176,15 +176,15 @@ public class ReportFinalizer
*/
public void toggleSubTemplateControls()
{
- // String sStorePath = "";
+ // String sStorePath = PropertyNames.EMPTY_STRING;
Short iState = (Short) CurUnoDialog.getControlProperty("optCreateReportTemplate", PropertyNames.PROPERTY_STATE);
boolean bDoTemplateEnable = iState.shortValue() == 1;
- CurUnoDialog.setControlProperty("optEditTemplate", PropertyNames.PROPERTY_ENABLED, new Boolean(bDoTemplateEnable));
- CurUnoDialog.setControlProperty("optUseTemplate", PropertyNames.PROPERTY_ENABLED, new Boolean(bDoTemplateEnable));
- CurUnoDialog.setControlProperty("lblHowProceed", PropertyNames.PROPERTY_ENABLED, new Boolean(bDoTemplateEnable));
+ CurUnoDialog.setControlProperty("optEditTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable);
+ CurUnoDialog.setControlProperty("optUseTemplate", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable);
+ CurUnoDialog.setControlProperty("lblHowProceed", PropertyNames.PROPERTY_ENABLED, bDoTemplateEnable);
String sTitle = xTitleTextBox.getText();
- boolean bDoEnable = sTitle.equals("");
+ boolean bDoEnable = sTitle.equals(PropertyNames.EMPTY_STRING);
CurUnoDialog.enableFinishButton(!bDoEnable);
}
// private boolean fileexists(XMultiServiceFactory _xMSF, String _spath){
@@ -200,7 +200,7 @@ public class ReportFinalizer
{
String FirstCommandName = (_CurDBMetaData.getIncludedCommandNames())[0];
DefaultName = Desktop.getUniqueName(_CurDBMetaData.getReportDocuments(), FirstCommandName);
- if (DefaultName.equals(OldDefaultName) == false)
+ if (!DefaultName.equals(OldDefaultName))
{
OldDefaultName = DefaultName;
}
@@ -212,7 +212,7 @@ public class ReportFinalizer
if (CurUnoDialog != null)
{
String LocStoreName = xTitleTextBox.getText();
- if (!LocStoreName.equals(""))
+ if (!LocStoreName.equals(PropertyNames.EMPTY_STRING))
{
StoreName = LocStoreName;
}
@@ -227,14 +227,14 @@ public class ReportFinalizer
StoreName = getStoreName();
String StorePath;
XInterface xInterface = (XInterface) m_xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess");
- XSimpleFileAccess xSimpleFileAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, xInterface);
+ 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 "";
+ return PropertyNames.EMPTY_STRING;
}
}
@@ -242,7 +242,7 @@ public class ReportFinalizer
{
final String TitleName = xTitleTextBox.getText();
CurReportDocument.liveupdate_updateReportTitle(TitleName);
- CurUnoDialog.enableFinishButton(!"".equals(TitleName));
+ CurUnoDialog.enableFinishButton(!PropertyNames.EMPTY_STRING.equals(TitleName));
}
public int getReportOpenMode()
diff --git a/wizards/com/sun/star/wizards/report/ReportLayouter.java b/wizards/com/sun/star/wizards/report/ReportLayouter.java
index 16180f4df91c..0ea91a2f2a30 100644
--- a/wizards/com/sun/star/wizards/report/ReportLayouter.java
+++ b/wizards/com/sun/star/wizards/report/ReportLayouter.java
@@ -96,7 +96,7 @@ public class ReportLayouter
},
new Object[]
{
- new Integer(8), slblDataStructure, new Integer(95), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99)
+ 8, slblDataStructure, 95, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99
});
short iSelPos = 0;
@@ -111,14 +111,14 @@ public class ReportLayouter
xContentListBox = CurUnoDialog.insertListBox("lstContent", SOCONTENTLST, new ActionListenerImpl(), new ItemListenerImpl(),
new String[]
{
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "SelectedItems", PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Integer(108), "HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", new Integer(95), new Integer(37), new short[]
+ 108, "HID:WIZARDS_HID_DLGREPORT_4_DATALAYOUT", 95, 37, new short[]
{
iSelPos
- }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), new Integer(99)
+ }, new Integer(ReportWizard.SOTEMPLATEPAGE), ContentFiles[0], new Short(curtabindex++), 99
});
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblLayout",
@@ -128,7 +128,7 @@ public class ReportLayouter
},
new Object[]
{
- new Integer(8), slblPageLayout, new Integer(205), new Integer(27), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(99)
+ 8, slblPageLayout, 205, 27, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 99
});
short iSelLayoutPos = 0;
@@ -146,14 +146,14 @@ public class ReportLayouter
xLayoutListBox = CurUnoDialog.insertListBox("lstLayout", SOLAYOUTLST, new ActionListenerImpl(), new ItemListenerImpl(),
new String[]
{
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "SelectedItems", PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.SELECTED_ITEMS, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Integer(108), "HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", new Integer(205), new Integer(37), new short[]
+ 108, "HID:WIZARDS_HID_DLGREPORT_4_PAGELAYOUT", 205, 37, new short[]
{
iSelLayoutPos
- }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), new Integer(99)
+ }, new Integer(ReportWizard.SOTEMPLATEPAGE), LayoutFiles[0], new Short(curtabindex++), 99
});
iOldLayoutPos = (int) iSelPos;
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblOrientation",
@@ -163,7 +163,7 @@ public class ReportLayouter
},
new Object[]
{
- new Integer(8), sOrientationHeader, new Integer(95), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(74)
+ 8, sOrientationHeader, 95, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 74
});
short m_nLandscapeState = CurReportDocument.getDefaultPageOrientation() == SOOPTLANDSCAPE ? (short) 1 : 0;
@@ -174,7 +174,7 @@ public class ReportLayouter
},
new Object[]
{
- new Integer(10), "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", sOrientHorizontal, new Integer(101), new Integer(158), new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60)
+ 10, "HID:WIZARDS_HID_DLGREPORT_4_LANDSCAPE", sOrientHorizontal, 101, 158, new Short(m_nLandscapeState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60
});
short m_nPortraitState = CurReportDocument.getDefaultPageOrientation() == SOOPTPORTRAIT ? (short) 1 : (short) 0;
@@ -185,17 +185,17 @@ public class ReportLayouter
},
new Object[]
{
- new Integer(10), "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", sOrientVertical, new Integer(101), new Integer(171), new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), new Integer(60)
+ 10, "HID:WIZARDS_HID_DLGREPORT_4_PORTRAIT", sOrientVertical, 101, 171, new Short(m_nPortraitState), new Integer(ReportWizard.SOTEMPLATEPAGE), new Short(curtabindex++), 60
});
aOrientationImage = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgOrientation",
new String[]
{
- "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_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)
+ new Short("0"), 23, 164, 158, Boolean.FALSE, new Integer(ReportWizard.SOTEMPLATEPAGE), 30
});
String sNote = ReportWizard.getBlindTextNote(CurReportDocument, CurUnoDialog.m_oResource);
@@ -206,7 +206,7 @@ public class ReportLayouter
},
new Object[]
{
- new Integer(34), sNote, new Boolean(true), new Integer(205), new Integer(148), new Integer(ReportWizard.SOTEMPLATEPAGE), new Integer(99)
+ 34, sNote, Boolean.TRUE, 205, 148, new Integer(ReportWizard.SOTEMPLATEPAGE), 99
});
if (m_nLandscapeState == 1)
{
@@ -227,7 +227,7 @@ public class ReportLayouter
{
// CurReportDocument.getDoc().xTextDocument.lockControllers();
CurReportDocument.layout_setupRecordSection(_defaultTemplatePath);
- if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals(""))
+ if (CurUnoDialog.getControlProperty("txtTitle", "Text").equals(PropertyNames.EMPTY_STRING))
{
String[] sCommandNames = CurReportDocument.getRecordParser().getIncludedCommandNames();
CurUnoDialog.setControlProperty("txtTitle", "Text", sCommandNames[0]);
@@ -246,7 +246,7 @@ public class ReportLayouter
try
{
int iPos;
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(false));
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
// LLA: should we lock controllers here?
// CurReportDocument.getDoc().xTextDocument.lockControllers();
int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
@@ -306,7 +306,7 @@ public class ReportLayouter
e.printStackTrace();
}
// CurReportDocument.getDoc().unlockallControllers();
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(true));
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE);
}
public void disposing(EventObject eventObject)
@@ -325,17 +325,17 @@ public class ReportLayouter
{
try
{
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(false));
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
// CurReportDocument.getDoc().xTextDocument.lockControllers();
boolean blandscape = (((Short) CurUnoDialog.getControlProperty("optLandscape", PropertyNames.PROPERTY_STATE)).shortValue() == 1);
- CurReportDocument.setPageOrientation((blandscape == true) ? SOOPTLANDSCAPE : SOOPTPORTRAIT);
+ CurReportDocument.setPageOrientation((blandscape) ? SOOPTLANDSCAPE : SOOPTPORTRAIT);
}
catch (Exception exception)
{
exception.printStackTrace(System.out);
}
// CurReportDocument.getDoc().unlockallControllers();
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(true));
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE);
}
}
}
diff --git a/wizards/com/sun/star/wizards/report/ReportTextDocument.java b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
index 3ab9e704b9b9..79196826def1 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextDocument.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextDocument.java
@@ -53,9 +53,16 @@ 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;
+import java.util.logging.Level;
+import java.util.logging.Logger;
class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implements Comparator
{
+
+ private static final String ISLANDSCAPE = "IsLandscape";
+ private static final String ISVISIBLE = "IsVisible";
+ private static final String QUERYNAME = "QueryName";
+ private static final String SIZE = "Size";
// private XMultiServiceFactory xMSF;
// private XMultiServiceFactory xMSFDoc;
private Object ReportPageStyle;
@@ -102,7 +109,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
lateInit(oResource, _aRP);
}
- void lateInit(Resource oResource, RecordParser _aRecordParser)
+ private void lateInit(Resource oResource, RecordParser _aRecordParser)
{
oTextTableHandler = new TextTableHandler(xMSFDoc, xTextDocument);
oTextSectionHandler = new TextSectionHandler(xMSFDoc, xTextDocument);
@@ -146,12 +153,11 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
oTextSection = xTextSections.getByName(RECORDSECTION);
}
- boolean bLayoutMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, "IsVisible"));
- return bLayoutMode;
+ return AnyConverter.toBoolean(Helper.getUnoPropertyValue(oTextSection, ISVISIBLE));
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e);
// In doubt we rather suggest this is LayoutMode...
return true;
}
@@ -172,7 +178,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
}
// xProgressBar.setValue(100);
oViewHandler.selectFirstPage(oTextTableHandler);
- // xProgressBar.end();
+ // xProgressBar.end();
}
public void swapLayoutTemplate(String LayoutTemplatePath/*, String BitmapPath*/)
@@ -181,39 +187,59 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
// xProgressBar.start("", 10);
this.LayoutTemplatePath = LayoutTemplatePath;
- boolean bOldIsCurLandscape = AnyConverter.toBoolean(Helper.getUnoPropertyValue(ReportPageStyle, "IsLandscape"));
+ 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();
+ // xProgressBar.end();
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e);
}
}
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())));
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xNamedForm);
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND_TYPE, 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);
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, QUERYNAME, CurDBMetaData.getCommandName());
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.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, QUERYNAME, "");
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, PropertyNames.COMMAND, CurDBMetaData.Command);
}
oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "GroupFieldNames", JavaTools.ArraytoString(CurDBMetaData.GroupFieldNames));
oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "FieldNames", JavaTools.ArraytoString(CurDBMetaData.getFieldNames()));
+ String[][] sortFieldNames = CurDBMetaData.getSortFieldNames();
+ if (sortFieldNames != null && sortFieldNames.length > 0)
+ {
+ final String space = ",";
+ final String colon = ";";
+ StringBuilder orderBy = new StringBuilder();
+ for (String[] sortPair : sortFieldNames)
+ {
+ orderBy.append(sortPair[0]).append(space).append(sortPair[1]).append(colon);
+ }
+ if (orderBy.length() != 0)
+ {
+ orderBy.delete(orderBy.lastIndexOf(colon), orderBy.length());
+ }
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Sorting", orderBy.toString());
+ }
+ else
+ {
+ oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "Sorting", "");
+ }
oFormHandler.insertHiddenControl(xNameAccess, xNamedForm, "RecordFieldNames", JavaTools.ArraytoString(CurDBMetaData.getRecordFieldNames()));
}
@@ -230,9 +256,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
ReportPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "Standard");
FirstPageStyle = Helper.getUnoObjectbyName(oPageStyleFamily, "First Page");
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -242,15 +268,15 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
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"));
+ 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);
+ Helper.setUnoPropertyValue(ReportPageStyle, ISLANDSCAPE, bNewLandscape);
+ Helper.setUnoPropertyValue(ReportPageStyle, SIZE, oNewSize);
+ Helper.setUnoPropertyValue(FirstPageStyle, ISLANDSCAPE, 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;
@@ -260,9 +286,9 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
}
}
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -290,22 +316,15 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
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);
- }
+ CurDBColumn.formatValueCell();
+ DBColumnsVector.set(i, CurDBColumn);
+ replaceFieldValueInGroupTable(CurDBColumn, i);
}
return true;
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e);
return false;
}
}
@@ -352,6 +371,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
// {
// return (JavaTools.FieldInList(CurDBMetaData.GroupFieldNames, _FieldName) != -1);
// }
+
public void replaceFieldValueInRecordSection(int RecordCount)
{
int GroupCount = CurDBMetaData.GroupFieldNames.length;
@@ -367,7 +387,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
String TableName;
DBColumn OldDBColumn;
DBColumn CurDBColumn;
- XNameAccess xTableNames = oTextTableHandler.xTextTablesSupplier.getTextTables();
+ // XNameAccess xTableNames = oTextTableHandler.xTextTablesSupplier.getTextTables();
int GroupFieldCount = SelGroupNames.length;
for (int i = 0; i < GroupFieldCount; i++)
{
@@ -471,16 +491,8 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
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);
- }
+ DBColumnsVector.addElement(CurDBColumn);
+ replaceFieldValueInGroupTable(CurDBColumn, GroupCount - 1);
}
catch (Exception exception)
{
@@ -555,43 +567,35 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
}
CurDBColumn = new DBColumn(CurRecordTable, oTextTableHandler, CurDBMetaData, i - CurDBMetaData.GroupFieldNames.length);
}
- if (CurDBColumn != null)
+ if (CurDBColumn.xNameCell != null)
{
- if (CurDBColumn.xNameCell != null)
+ DBColumnsVector.addElement(CurDBColumn);
+ }
+ else
+ {
+ String DelFieldName;
+ if (i < CurDBMetaData.GroupFieldNames.length)
{
- DBColumnsVector.addElement(CurDBColumn);
+ DelFieldName = CurDBMetaData.GroupFieldNames[i];
+ CurDBMetaData.GroupFieldNames = JavaTools.removefromList(CurDBMetaData.GroupFieldNames, new String[]
+ {
+ DelFieldName
+ });
+ CurDBMetaData.GroupFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.GroupFieldColumns);
}
else
{
- String DelFieldName;
- if (i < CurDBMetaData.GroupFieldNames.length)
- {
- DelFieldName = CurDBMetaData.GroupFieldNames[i];
- CurDBMetaData.GroupFieldNames = JavaTools.removefromList(CurDBMetaData.GroupFieldNames, new String[]
- {
- DelFieldName
- });
- CurDBMetaData.GroupFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.GroupFieldColumns);
- }
- else
- {
- DelFieldName = CurDBMetaData.getRecordFieldName(i - CurDBMetaData.GroupFieldNames.length);
- String[] aNewList = JavaTools.removefromList(CurDBMetaData.getRecordFieldNames(), new String[]
- {
- DelFieldName
- });
- CurDBMetaData.setRecordFieldNames(aNewList);
- CurDBMetaData.RecordFieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.RecordFieldColumns);
- CurDBMetaData.FieldColumns = removeFieldColumnByFieldName(DelFieldName, CurDBMetaData.FieldColumns);
+ 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);
+ i--;
}
}
java.util.Arrays.sort(CurDBMetaData.RecordFieldColumns, this);
@@ -639,7 +643,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
try
{
- Vector aFieldColumns = new Vector();
+ ArrayList<FieldColumn> aFieldColumns = new ArrayList<FieldColumn>();
for (int i = 0; i < _FieldColumns.length; i++)
{
FieldColumn CurFieldColumn = _FieldColumns[i];
@@ -654,7 +658,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
}
catch (RuntimeException e)
{
- e.printStackTrace(System.out);
+ Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e);
return null;
}
}
@@ -668,7 +672,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
sInvisibleSectionNames[i] = GROUPSECTION + i;
}
- XNameAccess xNameAccessTextSections = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextSectionHandler.xTextSectionsSupplier.getTextSections());
+ XNameAccess xNameAccessTextSections = UnoRuntime.queryInterface(XNameAccess.class, oTextSectionHandler.xTextSectionsSupplier.getTextSections());
String[] sSectionNames = xNameAccessTextSections.getElementNames();
for (int i = 0; i < sSectionNames.length; i++)
{
@@ -695,7 +699,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
public void removeNonLayoutTextTables()
{
String[] sLayoutTableNames = getLayoutTextTableNames();
- XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
+ XNameAccess xNameAccessTextTables = UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
String[] sTableNames = xNameAccessTextTables.getElementNames();
for (int i = 0; i < sTableNames.length; i++)
{
@@ -710,8 +714,8 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
public void removeLayoutTextTables()
{
String[] sLayoutTableNames = getLayoutTextTableNames();
- XNameAccess xNameAccessTextTables = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
- XRelativeTextContentRemove xRelativeTextContentRemove = (XRelativeTextContentRemove) UnoRuntime.queryInterface(XRelativeTextContentRemove.class, xText);
+ XNameAccess xNameAccessTextTables = UnoRuntime.queryInterface(XNameAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
+ XRelativeTextContentRemove xRelativeTextContentRemove = UnoRuntime.queryInterface(XRelativeTextContentRemove.class, xText);
String[] sTableNames = xNameAccessTextTables.getElementNames();
for (int i = 0; i < sTableNames.length; i++)
{
@@ -720,7 +724,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
if (!sTableName.equals(sLayoutTableNames[0]))
{
- XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName));
+ XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextTableHandler.getByName(sTableName));
boolean bleaveloop = false;
while (!bleaveloop)
{
@@ -728,7 +732,7 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
{
// xRelativeTextContentRemove.removeTextContentBefore(xTextContent);
xRelativeTextContentRemove.removeTextContentAfter(xTextContent);
- // IllegalArgumentException may be thrown when no paragraphbreak is there
+ // IllegalArgumentException may be thrown when no paragraphbreak is there
}
catch (IllegalArgumentException iexception)
{
@@ -751,17 +755,17 @@ class ReportTextDocument extends com.sun.star.wizards.text.TextDocument implemen
for (int i = 0; i < GroupFieldCount; i++)
{
oTextSection = xTextSections.getByName(GROUPSECTION + String.valueOf(i + 1));
- Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible));
+ Helper.setUnoPropertyValue(oTextSection, ISVISIBLE, _IsVisible);
}
if (xTextSections.hasByName(RECORDSECTION))
{
oTextSection = xTextSections.getByName(RECORDSECTION);
- Helper.setUnoPropertyValue(oTextSection, "IsVisible", new Boolean(_IsVisible));
+ Helper.setUnoPropertyValue(oTextSection, ISVISIBLE, _IsVisible);
}
}
- catch (Exception exception)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(ReportTextDocument.class.getName()).log(Level.SEVERE, null, e);
}
}
diff --git a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
index ceecaf28ba4f..6a79d0f37d84 100644
--- a/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
+++ b/wizards/com/sun/star/wizards/report/ReportTextImplementation.java
@@ -30,16 +30,12 @@ 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;
@@ -57,9 +53,9 @@ 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.PropertyNames;
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;
@@ -193,8 +189,8 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
Helper.setUnoPropertyValue(xTextSection, "LinkRegion", sLinkRegion);
if (CurDBColumn != null)
{
- boolean bIsGroupTable = (sLinkRegion.equals(ReportTextDocument.RECORDSECTION) != true);
- if (bIsGroupTable == true)
+ boolean bIsGroupTable = (!sLinkRegion.equals(ReportTextDocument.RECORDSECTION));
+ if (bIsGroupTable)
{
XTextTable xTextTable = getDoc().oTextTableHandler.getlastTextTable();
XCellRange xCellRange = UnoRuntime.queryInterface( XCellRange.class, xTextTable );
@@ -202,9 +198,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
}
}
}
- catch (Exception exception)
+ catch (Exception ex)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
}
return xNamedTextSection;
}
@@ -228,40 +224,54 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms();
Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME);
boolean bgetConnection;
- String sQueryName = "";
+ String sQueryName = PropertyNames.EMPTY_STRING;
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);
+ getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND, sMsg);
+ String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE, sMsg);
String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg);
String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames", sMsg);
+ final String sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting", 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, ";");
+ String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, PropertyNames.SEMI_COLON);
+ String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, PropertyNames.SEMI_COLON);
+ if ( !PropertyNames.EMPTY_STRING.equals(sorting))
+ {
+ String[] sortList = JavaTools.ArrayoutofString(sorting, PropertyNames.SEMI_COLON);
+ ArrayList<String[]> aSortFields = new ArrayList<String[]>();
+ for (String sortEntry : sortList)
+ {
+ aSortFields.add(JavaTools.ArrayoutofString(sortEntry, ","));
+ }
+ String[][] sortFieldNames = new String[aSortFields.size()][2];
+ aSortFields.toArray(sortFieldNames);
+ getRecordParser().setSortFieldNames(sortFieldNames);
+ }
getRecordParser().setRecordFieldNames(sNewList);
- getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, ";");
+ getRecordParser().GroupFieldNames = JavaTools.ArrayoutofString(sGroupFieldNames, PropertyNames.SEMI_COLON);
getRecordParser().setCommandType(Integer.valueOf(sCommandType).intValue());
+
sMsgQueryCreationImpossible = JavaTools.replaceSubString(sMsgQueryCreationImpossible, getRecordParser().Command, "<STATEMENT>");
bgetConnection = getRecordParser().getConnection(_properties);
int nCommandType = com.sun.star.sdb.CommandType.COMMAND;
boolean bexecute = false;
if (bgetConnection)
{
-
- if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals("")))
+ if ((getRecordParser().getCommandType() == CommandType.QUERY) && (getRecordParser().Command.equals(PropertyNames.EMPTY_STRING)))
{
DBMetaData.CommandObject oCommand = getRecordParser().getQueryByName(sQueryName);
if (getRecordParser().hasEscapeProcessing(oCommand.getPropertySet()))
{
- getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue("Command");
+ getRecordParser().Command = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND);
getRecordParser().getSQLQueryComposer().m_xQueryAnalyzer.setQuery(getRecordParser().Command);
getRecordParser().getSQLQueryComposer().prependSortingCriteria();
+ getRecordParser().Command = getRecordParser().getSQLQueryComposer().getQuery();
}
else
{
@@ -293,13 +303,14 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
{
return false;
}
- catch (java.lang.Exception javaexception)
+ catch (java.lang.Exception ex)
{
- javaexception.printStackTrace(System.out);
+ Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
return false;
}
- catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException exception)
+ catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException ex)
{
+ Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
return false;
}
}
@@ -322,8 +333,6 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
Object CurGroupValue;
String CurGroupTableName;
// RecordParser CurDBMetaData = getRecordParser();
- com.sun.star.style.BreakType CorrBreakValue = null;
- String CorrPageDescName = "";
getDoc().oTextFieldHandler.fixDateFields(true);
getDoc().removeAllVisibleTextSections();
getDoc().removeNonLayoutTextTables();
@@ -338,7 +347,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
XTextCursor xTextCursor = ReportTextDocument.createTextCursor(getDoc().xTextDocument.getText());
xTextDocument.lockControllers();
- if (getRecordParser().ResultSet.next() == true)
+ if (getRecordParser().ResultSet.next())
{
replaceUserFields();
Helper.setUnoPropertyValue(xTextCursor, "PageDescName", "First Page");
@@ -352,18 +361,18 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
addLinkedTextSection(xTextCursor, ReportTextDocument.GROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, CurGroupValue); //COPYOF!!!!
}
- if (getRecordParser().getcurrentRecordData(DataVector) == true)
+ if (getRecordParser().getcurrentRecordData(DataVector))
{
// int RowIndex = 1;
m_bStopProcess = false;
- while ((getRecordParser().ResultSet.next() == true) && (m_bStopProcess == false))
+ while ((getRecordParser().ResultSet.next()) && (!m_bStopProcess))
{
// RowIndex += 1;
breset = false;
for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
{
CurGroupValue = getRecordParser().getGroupColumnValue(ColIndex);
- if ((CurGroupValue.equals(OldGroupFieldValues[ColIndex]) == false) || (breset))
+ if ((!CurGroupValue.equals(OldGroupFieldValues[ColIndex])) || (breset))
{
breset = true;
insertDataToRecordTable(xTextCursor, DataVector, RecordFieldCount);
@@ -389,7 +398,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
for (ColIndex = 0; ColIndex < GroupFieldCount; ColIndex++)
{
CurDBColumn = (DBColumn) getDoc().DBColumnsVector.elementAt(ColIndex);
- Object oValue = "";
+ Object oValue = PropertyNames.EMPTY_STRING;
addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFGROUPSECTION + Integer.toString(ColIndex + 1), CurDBColumn, oValue);
}
addLinkedTextSection(xTextCursor, ReportTextDocument.COPYOFRECORDSECTION, null, null);
@@ -403,8 +412,9 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
}
getDoc().oTextSectionHandler.breakLinkofTextSections();
}
- catch (Exception exception)
+ catch (Exception ex)
{
+ Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
}
// catch (java.lang.Exception javaexception)
// {
@@ -462,7 +472,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
xNameCellCursor = ReportTextDocument.createTextCursor(CurDBColumn.xNameCell);
xNameCellCursor.gotoStart(false);
FieldContent = getDoc().oTextFieldHandler.getUserFieldContent(xNameCellCursor);
- if (!FieldContent.equals(""))
+ if (!FieldContent.equals(PropertyNames.EMPTY_STRING))
{
xNameCellCursor.goRight((short) 1, true);
xNameCellCursor.setString(FieldContent);
@@ -629,6 +639,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
}
catch (Exception e)
{
+ Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, e );
}
}
return m_aReportPath;
@@ -646,7 +657,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
return sPath;
}
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public String getLayoutPath()
@@ -661,7 +672,7 @@ public class ReportTextImplementation extends ReportImplementationHelper impleme
return sPath;
}
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public int getDefaultPageOrientation()
diff --git a/wizards/com/sun/star/wizards/report/ReportWizard.java b/wizards/com/sun/star/wizards/report/ReportWizard.java
index 46fe77fbee38..000f093b54d5 100644
--- a/wizards/com/sun/star/wizards/report/ReportWizard.java
+++ b/wizards/com/sun/star/wizards/report/ReportWizard.java
@@ -79,7 +79,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
private ReportLayouter CurReportLayouter;
private ReportFinalizer CurReportFinalizer;
private int nReportMode = ReportFinalizer.SOCREATEDOCUMENT;
- private String m_sReportName = "";
+ private String m_sReportName = PropertyNames.EMPTY_STRING;
protected static final String SOREPORTFORMNAME = "ReportSource";
private static final int SOMAINPAGE = 1;
private static final int SOTITLEPAGE = 2;
@@ -103,19 +103,19 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
{
super(i_serviceFactory, 34320, i_wizardContext);
super.addResourceHandler("Report Wizard", "dbw");
- if (getReportResources(false) == true)
+ if (getReportResources(false))
{
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
PropertyNames.PROPERTY_HEIGHT,
- "Moveable",
+ PropertyNames.PROPERTY_MOVEABLE,
PropertyNames.PROPERTY_NAME,
PropertyNames.PROPERTY_POSITION_X,
PropertyNames.PROPERTY_POSITION_Y,
PropertyNames.PROPERTY_STEP,
PropertyNames.PROPERTY_TABINDEX,
- "Title",
+ PropertyNames.PROPERTY_TITLE,
PropertyNames.PROPERTY_WIDTH
},
new Object[]
@@ -123,12 +123,12 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
Integer.valueOf(210),
Boolean.TRUE,
"DialogReport",
- new Integer(102),
- new Integer(41),
- new Integer(1),
+ 102,
+ 41,
+ 1,
new Short((short) 0),
sMsgWizardName,
- new Integer(310)
+ 310
});
drawNaviBar();
setRightPaneHeaders(this.WizardHeaderText);
@@ -245,7 +245,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
private void dialogFinish()
{
this.xComponent.dispose();
- if (bCloseDocument == true)
+ if (bCloseDocument)
{
m_reportDocument.dispose();
return;
@@ -272,10 +272,17 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
final SQLQueryComposer sqlQueryComposer = recordParser.getSQLQueryComposer();
if (this.CurDBCommandFieldSelection.getSelectedCommandType() == CommandType.TABLE)
{
- bQueryCreated = sqlQueryComposer.setQueryCommand(this.xWindow, false, false);
- m_reportDocument.setCommandType(CommandType.COMMAND);
- String sQuery = sqlQueryComposer.getQuery();
- m_reportDocument.setCommand(sQuery);
+ if (m_reportDocument instanceof ReportTextImplementation)
+ {
+ bQueryCreated = sqlQueryComposer.setQueryCommand(this.xWindow, false, false);
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ String sQuery = sqlQueryComposer.getQuery();
+ m_reportDocument.setCommand(sQuery);
+ }
+ else
+ {
+ bQueryCreated = true;
+ }
}
else
{
@@ -284,24 +291,25 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
String sQueryName = CurDBCommandFieldSelection.getSelectedCommandName();
DBMetaData.CommandObject oCommand = recordParser.getQueryByName(sQueryName);
bHasEscapeProcessing = recordParser.hasEscapeProcessing(oCommand.getPropertySet());
- String sCommand = (String) oCommand.getPropertySet().getPropertyValue("Command");
+ String sCommand = (String) oCommand.getPropertySet().getPropertyValue(PropertyNames.COMMAND);
if (bHasEscapeProcessing)
{
- // String sCommand = (String) oCommand.xPropertySet.getPropertyValue("Command");
- bQueryCreated = (!sCommand.equals(""));
- sqlQueryComposer.m_xQueryAnalyzer.setQuery(sCommand);
- sqlQueryComposer.prependSortingCriteria();
-// TODO: check with query
- m_reportDocument.setCommandType(CommandType.COMMAND);
- m_reportDocument.setCommand(sqlQueryComposer.getQuery());
- bQueryCreated = true;
+ // String sCommand = (String) oCommand.xPropertySet.getPropertyValue(PropertyNames.COMMAND);
+ bQueryCreated = (!sCommand.equals(PropertyNames.EMPTY_STRING));
+ if (m_reportDocument instanceof ReportTextImplementation)
+ {
+ sqlQueryComposer.m_xQueryAnalyzer.setQuery(sCommand);
+ sqlQueryComposer.prependSortingCriteria();
+ m_reportDocument.setCommandType(CommandType.COMMAND);
+ m_reportDocument.setCommand(sqlQueryComposer.getQuery());
+ }
}
else
{
m_reportDocument.setCommandType(CommandType.COMMAND);
m_reportDocument.setCommand(sCommand);
- bQueryCreated = true;
}
+ bQueryCreated = true;
}
catch (Exception e)
{
@@ -329,7 +337,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
},
new Object[]
{
- new Integer(16), sShowBinaryFields, new Integer(95), new Integer(162), new Integer(1), new Integer(210)
+ 16, sShowBinaryFields, 95, 162, 1, 210
});
}
// CurReportDocument.getDoc().xProgressBar.setValue(40);
@@ -398,12 +406,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
{
return false;
}
- if (e.hasMoreElements())
- {
- return true;
+ return e.hasMoreElements();
}
- return false;
- }
/**
* Return the path to the "com.sun.reportdesigner" extension
@@ -416,8 +420,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
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;
+ return xProvider.getPackageLocation("com.sun.reportdesigner");
}
private static XLogger m_xLogger;
@@ -463,10 +466,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
{
XMultiServiceFactory.class
});
- m_reportDocument = (IReportDocument) aMethod.invoke(a, new Object[]
- {
- xMSF
- });
+ m_reportDocument = (IReportDocument) aMethod.invoke(a, xMSF
+ );
}
catch (Exception e)
{
@@ -569,7 +570,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
public boolean getReportResources(boolean bgetProgressResourcesOnly)
{
sMsgWizardName = super.m_oResource.getResText(UIConsts.RID_REPORT);
- if (bgetProgressResourcesOnly == false)
+ if (!bgetProgressResourcesOnly)
{
sShowBinaryFields = m_oResource.getResText(UIConsts.RID_REPORT + 60);
slblTables = m_oResource.getResText(UIConsts.RID_FORM + 6);
@@ -589,7 +590,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
public static String getBlindTextNote(Object _aDocument, Resource _oResource)
{
- String sBlindTextNote = "";
+ String sBlindTextNote = PropertyNames.EMPTY_STRING;
if (_aDocument instanceof ReportTextImplementation)
{
sBlindTextNote = _oResource.getResText(UIConsts.RID_REPORT + 75);
@@ -619,7 +620,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
bEnabled = true;
}
- Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled));
+ Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled));
}
}
catch (com.sun.star.uno.Exception exception)
@@ -631,8 +632,8 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
private void enableWizardSteps(String[] NewItems)
{
boolean bEnabled = NewItems.length > 0;
- setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled));
- setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled));
+ setControlProperty("btnWizardNext", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled));
+ setControlProperty("btnWizardFinish", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled));
enableRoadmapItems(bEnabled); // Note: Performancewise this could be improved
}
@@ -698,7 +699,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
m_nID = 1;
if (sIncSuffix != null)
{
- if ((!sIncSuffix.equals("")) && (!sIncSuffix.equals("_")))
+ if ((!sIncSuffix.equals(PropertyNames.EMPTY_STRING)) && (!sIncSuffix.equals("_")))
{
String sID = JavaTools.ArrayoutofString(sIncSuffix, "_")[1];
m_nID = Integer.parseInt(sID);
@@ -717,7 +718,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
else
{
boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
- Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled));
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, bEnabled);
}
}
@@ -732,7 +733,7 @@ public class ReportWizard extends DatabaseObjectWizard implements XTextListener,
else
{
boolean bEnabled = (CurGroupFieldSelection.getSelectedFieldNames().length > 0);
- Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled));
+ Helper.setUnoPropertyValue(getRoadmapItemByID(SOGROUPPAGE), PropertyNames.PROPERTY_ENABLED, bEnabled);
}
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
index 6a90214696a5..0b55936da3fb 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/ReportBuilderImplementation.java
@@ -33,7 +33,6 @@ 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;
@@ -60,6 +59,7 @@ 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.common.PropertyNames;
import com.sun.star.wizards.report.IReportBuilderLayouter;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
import com.sun.star.wizards.report.IReportDocument;
@@ -78,23 +78,24 @@ import java.util.logging.Logger;
public class ReportBuilderImplementation extends ReportImplementationHelper
implements IReportDocument, IReportDefinitionReadAccess
{
- private Resource m_resource;
- private XDatabaseDocumentUI m_documentUI;
+ private Resource m_resource;
+ private XDatabaseDocumentUI m_documentUI;
private static final int MAXIMUM_GROUPCOUNT = 4;
+ private String[] groupNames = null;
- private ReportBuilderImplementation( XMultiServiceFactory _serviceFactory )
+ private ReportBuilderImplementation(XMultiServiceFactory _serviceFactory)
{
// creates an access to the ReportBuilder Extension
super(_serviceFactory, ReportLayouter.SOOPTLANDSCAPE);
}
- public static IReportDocument create( XMultiServiceFactory i_serviceFactory )
+ public static IReportDocument create(XMultiServiceFactory i_serviceFactory)
{
- return new ReportBuilderImplementation( i_serviceFactory );
+ return new ReportBuilderImplementation(i_serviceFactory);
}
- public void initialize( final XDatabaseDocumentUI i_documentUI, final Resource i_resource )
+ public void initialize(final XDatabaseDocumentUI i_documentUI, final Resource i_resource)
{
m_documentUI = i_documentUI;
m_resource = i_resource;
@@ -106,12 +107,11 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
public XWindowPeer getWizardParent()
{
- final XWindowPeer aWindowPeer = UnoRuntime.queryInterface( XWindowPeer.class, getFrame().getComponentWindow() );
- return aWindowPeer;
+ return UnoRuntime.queryInterface(XWindowPeer.class, getFrame().getComponentWindow());
}
private XFrame m_xFrame = null;
// private ReportBuilderLayouter m_aReportBuilderLayouter = null;
- private String m_sReportBuilderLayoutName = "";
+ private String m_sReportBuilderLayoutName = PropertyNames.EMPTY_STRING;
/**
* Get access to the current ReportLayouter, which depends on the name.
@@ -120,8 +120,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
*/
private IReportBuilderLayouter getReportBuilderLayouter()
{
- final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) getLayoutMap().get(m_sReportBuilderLayoutName);
- return aReportBuilderLayouter;
+ return (IReportBuilderLayouter) getLayoutMap().get(m_sReportBuilderLayoutName);
}
private Object m_aReportDocument;
private XPropertySet m_documentDefinition;
@@ -139,15 +138,18 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
try
{
NamedValueCollection creationArgs = new NamedValueCollection();
- creationArgs.put( "DocumentServiceName", "com.sun.star.report.ReportDefinition" );
- creationArgs.put( "Mode", "remote" );
+ creationArgs.put("DocumentServiceName", "com.sun.star.report.ReportDefinition");
+ creationArgs.put("Mode", "remote");
- XComponent[] docDefinition = new XComponent[] { null };
+ XComponent[] docDefinition = new XComponent[]
+ {
+ null
+ };
XComponent reportDefinitionComp = m_documentUI.createComponentWithArguments(
- DatabaseObject.REPORT, creationArgs.getPropertyValues(), docDefinition );
+ DatabaseObject.REPORT, creationArgs.getPropertyValues(), docDefinition);
- m_documentDefinition = UnoRuntime.queryInterface( XPropertySet.class, docDefinition[0] );
- m_reportDocument = UnoRuntime.queryInterface( XReportDefinition.class, reportDefinitionComp );
+ m_documentDefinition = UnoRuntime.queryInterface(XPropertySet.class, docDefinition[0]);
+ m_reportDocument = UnoRuntime.queryInterface(XReportDefinition.class, reportDefinitionComp);
}
catch (com.sun.star.uno.Exception e)
{
@@ -164,8 +166,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
private XModeSelector getModeSelector()
{
final XController xController = getReportDefinition().getCurrentController();
- final XModeSelector xModeSelector = UnoRuntime.queryInterface( XModeSelector.class, xController );
- return xModeSelector;
+ return UnoRuntime.queryInterface(XModeSelector.class, xController);
}
private void switchOffAddFieldWindow()
@@ -209,11 +210,11 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
try
{
final XController xController = getReportDefinition().getCurrentController();
- final XDispatchProvider xDP = UnoRuntime.queryInterface( XDispatchProvider.class, xController );
+ 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 );
+ 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();
@@ -273,14 +274,14 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
return;
}
- final XCommandProcessor xProcessor = UnoRuntime.queryInterface( XCommandProcessor.class, m_documentDefinition );
+ 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 );
+ aNameContainer.insertByHierarchicalName(Name, m_documentDefinition);
}
public boolean liveupdate_addGroupNametoDocument(String[] GroupNames, String CurGroupTitle, Vector GroupFieldVector, ArrayList ReportPath, int iSelCount)
@@ -366,19 +367,19 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
{
try
{
- if ( m_documentDefinition != null )
+ 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 );
+ XModifiable documentModify = UnoRuntime.queryInterface(XModifiable.class, m_reportDocument);
+ documentModify.setModified(false);
// actually close
- XSubDocument subComponent = UnoRuntime.queryInterface( XSubDocument.class, m_documentDefinition );
+ XSubDocument subComponent = UnoRuntime.queryInterface(XSubDocument.class, m_documentDefinition);
subComponent.close();
}
}
- catch ( Exception ex )
+ catch (Exception ex)
{
- Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex);
}
m_documentDefinition = null;
m_reportDocument = null;
@@ -407,15 +408,15 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
{
}
- private XComponent loadReport( final String i_reportName )
+ private XComponent loadReport(final String i_reportName)
{
try
{
- return m_documentUI.loadComponent( DatabaseObject.REPORT, i_reportName, false );
+ return m_documentUI.loadComponent(DatabaseObject.REPORT, i_reportName, false);
}
- catch ( Exception ex )
+ catch (Exception ex)
{
- Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@@ -428,19 +429,19 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
aCommand.Name = "open";
try
{
- final Object result = commandProcessor.execute( aCommand, commandProcessor.createCommandIdentifier(), null );
- return UnoRuntime.queryInterface( XComponent.class, result );
+ final Object result = commandProcessor.execute(aCommand, commandProcessor.createCommandIdentifier(), null);
+ return UnoRuntime.queryInterface(XComponent.class, result);
}
- catch ( Exception ex )
+ catch (Exception ex)
{
- Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, 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 )
+ public void createAndOpenReportDocument(String i_name, boolean i_asTemplate, boolean i_openForEditing)
{
- if ( 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?
@@ -449,13 +450,13 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
return;
}
- if ( i_asTemplate )
+ 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 );
+ loadReport(i_name);
}
else
{
@@ -466,8 +467,10 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
closeReportDefinition();
// store the generated report
- if ( getRecordParser().storeDatabaseDocumentToTempPath( document, i_name ) )
- getRecordParser().addReportDocument( document, false );
+ if (getRecordParser().storeDatabaseDocumentToTempPath(document, i_name))
+ {
+ getRecordParser().addReportDocument(document, false);
+ }
}
dispose();
@@ -509,10 +512,17 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
public void setSorting(String[][] _aSortFieldNames)
{
getRecordParser().setSortFieldNames(_aSortFieldNames);
+ if (groupNames != null)
+ {
+ getRecordParser().prependSortFieldNames(groupNames);
+ }
+ getReportBuilderLayouter().insertSortingNames(_aSortFieldNames);
+ getReportBuilderLayouter().layout();
}
public void setGrouping(String[] _aGroupFieldNames)
{
+ groupNames = _aGroupFieldNames;
getRecordParser().prependSortFieldNames(_aGroupFieldNames);
getReportBuilderLayouter().insertGroupNames(_aGroupFieldNames);
@@ -532,12 +542,12 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
try
{
// Check general availability of office paths
- m_aReportPath = FileAccess.getOfficePaths( getMSF(), "Template", "share", "/wizard" );
- FileAccess.combinePaths( getMSF(), m_aReportPath, "/wizard/report" );
+ m_aReportPath = FileAccess.getOfficePaths(getMSF(), "Template", "share", "/wizard");
+ FileAccess.combinePaths(getMSF(), m_aReportPath, "/wizard/report");
}
- catch ( NoValidPathException ex )
+ catch (NoValidPathException ex)
{
- Logger.getLogger( ReportBuilderImplementation.class.getName() ).log( Level.SEVERE, null, ex );
+ Logger.getLogger(ReportBuilderImplementation.class.getName()).log(Level.SEVERE, null, ex);
}
}
return m_aReportPath;
@@ -545,7 +555,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
public String getContentPath()
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public int getDefaultPageOrientation()
@@ -573,8 +583,7 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
Object[] aParams = new Object[2];
aParams[0] = this;
aParams[1] = m_resource;
- final IReportBuilderLayouter aReportBuilderLayouter = (IReportBuilderLayouter) cTor.newInstance(aParams);
- return aReportBuilderLayouter;
+ return (IReportBuilderLayouter) cTor.newInstance(aParams);
}
catch (Exception e)
{
@@ -727,7 +736,6 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
getReportDefinition().setCommandType(_nCommand);
}
-
public void checkInvariants() throws java.lang.Exception
{
final String sDefaultHeaderLayoutPath = getDefaultHeaderLayout();
@@ -737,12 +745,9 @@ public class ReportBuilderImplementation extends ReportImplementationHelper
}
FileAccess aAccess = new FileAccess(getGlobalMSF());
- if (! aAccess.exists(sDefaultHeaderLayoutPath, true))
+ 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
index ccb74ebf6f07..02ad2438bb59 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarSingleColumn.java
@@ -28,6 +28,7 @@
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XGroup;
import com.sun.star.report.XSection;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
@@ -52,8 +53,7 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 81);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 81);
}
protected void insertDetailFields()
@@ -98,7 +98,7 @@ public class ColumnarSingleColumn extends ReportBuilderLayouter
doNotBreakInTable(xSection);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
index 2dc468fb09e7..51c14c42a536 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarThreeColumns.java
@@ -51,8 +51,7 @@ public class ColumnarThreeColumns extends ColumnarTwoColumns
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 83);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 83);
}
protected void insertDetailFields()
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
index d79713524021..9dd9bb78201c 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ColumnarTwoColumns.java
@@ -28,6 +28,7 @@
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XGroup;
import com.sun.star.report.XSection;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
@@ -52,8 +53,7 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 82);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 82);
}
protected void insertDetailFields()
@@ -130,7 +130,7 @@ public class ColumnarTwoColumns extends ReportBuilderLayouter
doNotBreakInTable(xSection);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
index 55fdafe6c79a..12999090e646 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/DesignTemplate.java
@@ -41,6 +41,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
/**
*
@@ -180,7 +181,7 @@ public class DesignTemplate
// is aObj a textfield
// m_aDetailLabel_FD
// m_aDetailTextField_FD
- XFixedText aFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aObj);
+ XFixedText aFixedText = UnoRuntime.queryInterface(XFixedText.class, aObj);
if (aFixedText != null &&
m_aDetailLabel == null)
{
@@ -188,7 +189,7 @@ public class DesignTemplate
}
else
{
- XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj);
+ XFormattedField aFormattedField = UnoRuntime.queryInterface(XFormattedField.class, aObj);
if (aFormattedField != null &&
m_aDetailTextField == null)
{
@@ -217,7 +218,7 @@ public class DesignTemplate
try
{
Object aGroup = xGroups.getByIndex(nGroup);
- XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup);
+ XGroup xGroup = UnoRuntime.queryInterface(XGroup.class, aGroup);
XSection xGroupSection = xGroup.getHeader();
final int nCount = xGroupSection.getCount();
@@ -226,7 +227,7 @@ public class DesignTemplate
try
{
Object aObj = xGroupSection.getByIndex(i);
- XFixedText aFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aObj);
+ XFixedText aFixedText = UnoRuntime.queryInterface(XFixedText.class, aObj);
// is aObj a label
// is aObj a textfield
if (aFixedText != null &&
@@ -236,7 +237,7 @@ public class DesignTemplate
}
else
{
- XFormattedField aFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, aObj);
+ XFormattedField aFormattedField = UnoRuntime.queryInterface(XFormattedField.class, aObj);
if (aFormattedField != null &&
m_aGroupTextField[nGroup] == null)
{
@@ -316,11 +317,11 @@ public class DesignTemplate
m_xGlobalMSF = _xMSF;
m_sFilename = _sPath;
final Object aObj = _xMSF.createInstance("com.sun.star.report.ReportDefinition");
- m_xReportDefinition = (XReportDefinition) UnoRuntime.queryInterface(XReportDefinition.class, aObj);
+ m_xReportDefinition = UnoRuntime.queryInterface(XReportDefinition.class, aObj);
PropertyValue[] aLoadProps = new PropertyValue[2];
- aLoadProps[0] = Properties.createProperty("URL", _sPath);
- aLoadProps[1] = Properties.createProperty("ReadOnly", Boolean.TRUE);
+ aLoadProps[0] = Properties.createProperty(PropertyNames.URL, _sPath);
+ aLoadProps[1] = Properties.createProperty(PropertyNames.READ_ONLY, Boolean.TRUE);
m_xReportDefinition.load(aLoadProps);
analyseReportDefinition();
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
index 9fd891a446f2..3fa72ca047b2 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsAbove.java
@@ -29,6 +29,7 @@
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XGroup;
import com.sun.star.report.XSection;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
@@ -53,8 +54,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 85);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 85);
}
protected void insertDetailFields()
@@ -159,7 +159,7 @@ public class InBlocksLabelsAbove extends ColumnarTwoColumns
doNotBreakInTable(xSection);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
index c03cf7cec909..34c2f9c10280 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/InBlocksLabelsLeft.java
@@ -29,6 +29,7 @@
package com.sun.star.wizards.reportbuilder.layout;
import com.sun.star.awt.Rectangle;
+import com.sun.star.report.XGroup;
import com.sun.star.report.XSection;
import com.sun.star.wizards.common.Resource;
import com.sun.star.wizards.report.IReportDefinitionReadAccess;
@@ -53,8 +54,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns
public String getLocalizedName()
{
- final String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 84);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 84);
}
protected void insertDetailFields()
@@ -126,7 +126,7 @@ public class InBlocksLabelsLeft extends ColumnarTwoColumns
doNotBreakInTable(xSection);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
// we won't extra field titles
}
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
index 0c2e5af3bd36..8d27f9e6507b 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/ReportBuilderLayouter.java
@@ -1,5 +1,4 @@
-/*
- ************************************************************************
+/************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -72,6 +71,8 @@ import com.sun.star.wizards.report.IReportDefinitionReadAccess;
import com.sun.star.wizards.ui.UIConsts;
import java.util.HashMap;
import java.util.Locale;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* This class is abstract and more like a helper for create different layouts for Report Builder Wizard.
@@ -83,6 +84,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
private IReportDefinitionReadAccess m_xReportDefinitionReadAccess;
private Resource m_aResource;
+ private String[][] m_aSortNames;
/**
* dispose the ReportBuilderLayouter
@@ -91,7 +93,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
closeDesignTemplate();
m_xReportDefinitionReadAccess = null;
- // m_xReportBuilderLayouter = null;
+ // m_xReportBuilderLayouter = null;
}
/**
@@ -148,11 +150,11 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
insertPageFooter();
clearGroups();
- insertGroups();
+ int lastGroupPostion = insertGroups();
clearDetails();
// clearFieldTitles();
- insertDetailFieldTitles();
+ insertDetailFieldTitles(lastGroupPostion);
insertDetailFields();
}
catch (java.lang.ArrayIndexOutOfBoundsException e)
@@ -163,13 +165,13 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
throw e;
}
- catch (Exception e)
+ catch (Exception ex)
{
- // Exception not set. Not from interest here.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
// -------------------------------------------------------------------------
+
/**
* Remove all Groups
*/
@@ -183,13 +185,14 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
xGroups.removeByIndex(0);
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // Exception not set. Not from interest here.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
// -------------------------------------------------------------------------
+
/**
* Remove all fields
* @param _xSectionToClear
@@ -206,13 +209,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aObj = _xSectionToClear.getByIndex(0);
- final XShape aShape = (XShape) UnoRuntime.queryInterface(XShape.class, aObj);
+ final XShape aShape = UnoRuntime.queryInterface(XShape.class, aObj);
_xSectionToClear.remove(aShape);
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // Exception not set.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -226,6 +228,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// public void clearFieldTitles()
// {
// }
+
/**
*
* @param _nGroupCount
@@ -291,7 +294,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// get all Page Styles
final Object aPageStylesObj = xNameAccess.getByName(_sStyleName);
- final XNameAccess xContainer = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, aPageStylesObj);
+ final XNameAccess xContainer = UnoRuntime.queryInterface(XNameAccess.class, aPageStylesObj);
// step over all Page Styles, search the one which is in use
final String[] aElementNames = xContainer.getElementNames();
@@ -299,7 +302,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
final String sName = aElementNames[i];
final Object aObj = xContainer.getByName(sName);
- final XStyle xStyle = (XStyle) UnoRuntime.queryInterface(XStyle.class, aObj);
+ final XStyle xStyle = UnoRuntime.queryInterface(XStyle.class, aObj);
if (xStyle.isInUse())
{
aUsedStyle = xStyle;
@@ -307,10 +310,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // TODO: Exception not set.
- e.printStackTrace();
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
return aUsedStyle;
}
@@ -352,6 +354,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return m_nPageWidth;
}
// -------------------------------------------------------------------------
+
/**
* Stores the Group names. To insert/create a report with such group names, call layout()
* @param _aGroupNames
@@ -361,6 +364,11 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
m_aGroupNames = _aGroupNames;
}
+ public void insertSortingNames(String[][] _aSortFieldNames)
+ {
+ m_aSortNames = _aSortFieldNames;
+ }
+
protected void copyGroupProperties(int _nGroup)
{
if (getDesignTemplate() != null)
@@ -368,103 +376,111 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
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)
+ if (_nGroup < xForeignGroups.getCount())
{
- final XGroups xGroups = getReportDefinition().getGroups();
- Object aGroup = xGroups.getByIndex(_nGroup);
- XGroup xGroup = (XGroup) UnoRuntime.queryInterface(XGroup.class, aGroup);
- XSection xGroupSection = xGroup.getHeader();
+ XGroup xForeignGroup = UnoRuntime.queryInterface(XGroup.class, xForeignGroups.getByIndex(_nGroup));
+ XSection xForeignGroupSection = xForeignGroup.getHeader();
- // copy Properties
- copyProperties(xForeignGroupSection, xGroupSection);
+ if (xForeignGroupSection != null)
+ {
+ final XGroups xGroups = getReportDefinition().getGroups();
+ Object aGroup = xGroups.getByIndex(_nGroup);
+ XGroup xGroup = UnoRuntime.queryInterface(XGroup.class, aGroup);
+ XSection xGroupSection = xGroup.getHeader();
+
+ // copy Properties
+ copyProperties(xForeignGroupSection, xGroupSection);
+ }
}
}
- catch (Exception e)
+ catch (Exception ex)
{
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
// -------------------------------------------------------------------------
- protected void insertGroups()
- {
- if (m_aGroupNames == null)
- {
- return;
- }
+ protected int insertGroups()
+ {
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;
+ int lastGroupPosition = -1;
- for (int i = 0; i < m_aGroupNames.length; i++)
+ if (m_aGroupNames != null)
{
- final XGroup xGroup = xGroups.createGroup();
- aLastGroup = xGroup;
+ final int nLeftPageIndent = getLeftPageIndent();
+ final int nLabelWidth = getMaxLabelWidth(); // 3000;
+ final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent() - getLeftGroupIndent(getCountOfGroups());
+ final int nFieldWidth = nUsablePageWidth - nLabelWidth;
- // 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);
+ XGroup aLastGroup = null;
+ // after done with all groups, we need access to the last group, for set property 'KeepTogether' so we remember it.
- try
+ for (int i = 0; i < m_aGroupNames.length; i++)
{
- // 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);
+ lastGroupPosition = i;
+ final XGroup xGroup = xGroups.createGroup();
+ aLastGroup = 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);
+ xGroup.setExpression(m_aGroupNames[i]);
+ xGroup.setHeaderOn(true);
- // 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);
+ try
+ {
+ 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);
+ aRect = insertLabel(xGroupSection, getTitleFromFieldName(m_aGroupNames[i]), aRect, nLabelWidth, aSO);
+ final String sGroupName = convertToFieldName(m_aGroupNames[i]);
+ aSO = getDesignTemplate().getGroupTextField(i);
+ aRect = insertFormattedField(xGroupSection, sGroupName, aRect, nFieldWidth, aSO);
+ int height = aRect.Height;
+
+ // draw a line under the label/formattedfield
+ aRect.X = nLeftPageIndent + getLeftGroupIndent(i);
+ aRect.Y = aRect.Height;
+ final int nLineWidth = getPageWidth() - getRightPageIndent() - aRect.X;
+ final int nLineHeight = LayoutConstants.LineHeight;
+ insertHorizontalLine(xGroupSection, aRect, nLineWidth, nLineHeight);
+ xGroupSection.setHeight(height + nLineHeight);
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
+ }
}
- catch (com.sun.star.uno.Exception e)
+
+ // hold the inner group together
+ if (aLastGroup != null)
{
- // TODO: Exception not set.
+ doNotBreakInTable(aLastGroup);
}
}
-
- // hold the inner group together
- if (aLastGroup != null)
+ if (m_aSortNames != null)
{
- doNotBreakInTable(aLastGroup);
+ for (String[] sortFieldName : m_aSortNames)
+ {
+ try
+ {
+ final XGroup xGroup = xGroups.createGroup();
+ xGroup.setExpression(sortFieldName[0]);
+ xGroup.setSortAscending(PropertyNames.ASC.equals(sortFieldName[1]));
+ xGroup.setHeaderOn(false);
+ int nCount = xGroups.getCount();
+ xGroups.insertByIndex(nCount, xGroup);
+ }
+ catch (java.lang.Exception ex)
+ {
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
}
+ return lastGroupPosition;
}
// -------------------------------------------------------------------------
@@ -487,10 +503,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return m_aFieldTitleNames[i];
}
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
- protected int getTypeFromFieldName(String _sField)
+ protected int getTypeFromFieldName(String _sField)
{
for (int i = 0; i < m_aFieldNames.length; i++)
{
@@ -514,6 +530,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return false;
}
// -------------------------------------------------------------------------
+
/**
* Helper to get all field names without the names which are already in the group names
* @param _aList
@@ -542,7 +559,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
for (int i = 0; i < _aList.length; i++)
{
final String sField = _aList[i];
- if (listContains(m_aGroupNames, sField) == true)
+ if (listContains(m_aGroupNames, sField))
{
continue;
}
@@ -578,8 +595,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
return getNamesWithoutGroupNames(m_aFieldNames, m_aFieldTitleNames);
}
// -------------------------------------------------------------------------
- abstract protected void insertDetailFieldTitles();
+
+ abstract protected void insertDetailFieldTitles(int lastGroupPostion);
// -------------------------------------------------------------------------
+
/**
* Give a list off all field names to insert the field names, call layout()
* @param _aFieldNames
@@ -627,12 +646,14 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
copyProperties(xForeignSection, xSection);
}
}
- catch (Exception e)
+ catch (Exception ex)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
// -------------------------------------------------------------------------
+
protected Rectangle insertLabel(XSection _xSection, String _sLabel, Rectangle _aRect, int _nWidth, SectionObject _aSO)
{
if (_xSection != null)
@@ -640,7 +661,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText");
- final XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
+ final XFixedText xFixedText = UnoRuntime.queryInterface(XFixedText.class, aFixedText);
int nHeight = LayoutConstants.LabelHeight; // default height of label is fixed.
@@ -678,15 +699,15 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
xFixedText.setHeight(nHeight);
_xSection.add(xFixedText);
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // TODO: Exception not set.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
return _aRect;
}
// -------------------------------------------------------------------------
+
protected String convertToFieldName(String _sElementName)
{
final StringBuffer aDataField = new StringBuffer(32);
@@ -694,17 +715,18 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
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.substring(7, nCloseBrace).trim();
}
return _sName;
}
// -------------------------------------------------------------------------
+
/**
* Insert a already formatted field name into a given section
*
@@ -732,9 +754,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
int nHeight = LayoutConstants.FormattedFieldHeight;
int nType = getTypeFromFieldName(convertFromFieldName(_sFormattedfield));
- if (nType == DataType.BINARY ||
- nType == DataType.VARBINARY ||
- nType == DataType.LONGVARBINARY)
+ if (nType == DataType.BINARY
+ || nType == DataType.VARBINARY
+ || nType == DataType.LONGVARBINARY)
{
aField = getMSFofReportDefinition().createInstance("com.sun.star.report.ImageControl");
nHeight = LayoutConstants.BinaryHeight;
@@ -744,20 +766,21 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
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);
+ final 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
+ // 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)
{
@@ -772,12 +795,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
_aRect.X += _nWidth;
xReportControlModel.setHeight(nHeight);
- if (nType == DataType.BINARY ||
- nType == DataType.VARBINARY ||
- nType == DataType.LONGVARBINARY)
+ 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);
+ final XImageControl xImageControl = UnoRuntime.queryInterface(XImageControl.class, xReportControlModel);
if (xImageControl != null)
{
// xImageControl.setScaleImage(true);
@@ -795,19 +818,19 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// xReportControlModel.???
// }
}
- catch (com.sun.star.beans.UnknownPropertyException e)
+ catch (com.sun.star.beans.UnknownPropertyException ex)
{
- // seems we not able to set ParaAdjust
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
// spezial case rpt:now() (default date format)
if (_sFormattedfield.equals("rpt:now()"))
{
- final XFormattedField xFormattedField = (XFormattedField) UnoRuntime.queryInterface(XFormattedField.class, xReportControlModel);
+ final XFormattedField xFormattedField = UnoRuntime.queryInterface(XFormattedField.class, xReportControlModel);
XNumberFormatsSupplier x = xFormattedField.getFormatsSupplier();
XNumberFormats xFormats = x.getNumberFormats();
- XNumberFormatTypes x3 = (XNumberFormatTypes) UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats);
+ XNumberFormatTypes x3 = UnoRuntime.queryInterface(XNumberFormatTypes.class, xFormats);
Locale.getDefault();
com.sun.star.lang.Locale aLocale = new com.sun.star.lang.Locale();
aLocale.Country = Locale.getDefault().getCountry();
@@ -819,10 +842,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
_xSection.add(xReportControlModel);
}
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // TODO: Exception not set.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
return _aRect;
@@ -845,12 +867,12 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
if (m_xMSF == null)
{
- final XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, getReportDefinition());
- m_xMSF = xMSF;
+ m_xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, getReportDefinition());
}
return m_xMSF;
}
// -------------------------------------------------------------------------
+
protected Rectangle insertVerticalLine(XSection _xSection, Rectangle _aRect, int _nWidth, int _nHeight)
{
return insertLine(_xSection, _aRect, _nWidth, _nHeight, 1);
@@ -868,7 +890,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
try
{
final Object aFixedLine = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedLine");
- final XFixedLine xFixedLine = (XFixedLine) UnoRuntime.queryInterface(XFixedLine.class, aFixedLine);
+ final XFixedLine xFixedLine = UnoRuntime.queryInterface(XFixedLine.class, aFixedLine);
xFixedLine.setOrientation(_nOrientation);
// TODO: line width is fixed
@@ -882,15 +904,15 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
xFixedLine.setHeight(_nHeight);
_xSection.add(xFixedLine);
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception ex)
{
- // TODO: Exception not set.
- int dummy = 0;
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
return _aRect;
}
// -------------------------------------------------------------------------
+
protected void clearReportHeader()
{
XSection xSection;
@@ -902,9 +924,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
emptySection(xSection);
}
}
- catch (com.sun.star.container.NoSuchElementException e)
+ catch (com.sun.star.container.NoSuchElementException ex)
{
- // Exception not set. Not really from interest.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, ex);
}
}
@@ -930,6 +952,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
else
@@ -953,7 +976,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.container.NoSuchElementException e)
{
- // Exception not set. Not really from interest.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -979,6 +1002,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
else
@@ -989,6 +1013,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
// -------------------------------------------------------------------------
+
protected void clearPageHeader()
{
XSection xSection;
@@ -1002,7 +1027,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.container.NoSuchElementException e)
{
- // Exception not set. Not really from interest.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -1017,7 +1042,6 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// // DebugHelper.writeInfo("Date: " + aBuf.toString());
// return aBuf.toString();
// }
-
// protected String getCurrentDate()
// {
// Calendar aCalendar = Calendar.getInstance();
@@ -1060,7 +1084,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.container.NoSuchElementException e)
{
- // Exception not set. Should not from interest here.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
@@ -1108,49 +1132,49 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
// XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface(XControlContainer.class, aControlContainer);
final Object aFixedTextModel = getGlobalMSF().createInstance("com.sun.star.awt.UnoControlFixedTextModel");
- final XControlModel xFixedTextModel = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel);
+ final XControlModel xFixedTextModel = UnoRuntime.queryInterface(XControlModel.class, aFixedTextModel);
final PropertySetHelper aPropertySetHelper = new PropertySetHelper(xFixedTextModel);
// aPropertySetHelper.showProperties();
- aPropertySetHelper.setPropertyValueDontThrow("FontDescriptor", _aFont);
+ aPropertySetHelper.setPropertyValueDontThrow(PropertyNames.FONT_DESCRIPTOR, _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);
+ final XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, aUnoCtrlFixedText);
xWindow.setVisible(false);
- final XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, aUnoCtrlFixedText);
+ final XControl xControl = UnoRuntime.queryInterface(XControl.class, aUnoCtrlFixedText);
xControl.setModel(xFixedTextModel);
- final com.sun.star.awt.XFixedText xFixedText = (com.sun.star.awt.XFixedText) UnoRuntime.queryInterface(com.sun.star.awt.XFixedText.class, aUnoCtrlFixedText);
+ final com.sun.star.awt.XFixedText xFixedText = UnoRuntime.queryInterface(com.sun.star.awt.XFixedText.class, aUnoCtrlFixedText);
xFixedText.setText(_sText);
- final XLayoutConstrains xLayoutConstraints = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, aUnoCtrlFixedText);
+ final XLayoutConstrains xLayoutConstraints = UnoRuntime.queryInterface(XLayoutConstrains.class, aUnoCtrlFixedText);
final Size aSizeInPixel = xLayoutConstraints.getPreferredSize();
- final XWindowPeer xPeerOfReportDefinition = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, getReportDefinition().getCurrentController().getFrame().getComponentWindow());
+ final XWindowPeer xPeerOfReportDefinition = UnoRuntime.queryInterface(XWindowPeer.class, getReportDefinition().getCurrentController().getFrame().getComponentWindow());
xControl.createPeer(null, xPeerOfReportDefinition);
final XWindowPeer x = xControl.getPeer();
- final XUnitConversion xConversion = (XUnitConversion) UnoRuntime.queryInterface(XUnitConversion.class, x);
+ final XUnitConversion xConversion = UnoRuntime.queryInterface(XUnitConversion.class, x);
aSizeMM_100TH = xConversion.convertSizeToLogic(aSizeInPixel, com.sun.star.util.MeasureUnit.MM_100TH);
// xToolkit.createScreenCompatibleDevice(_nWidth, _nWidth).
// XWindow x = getReportDefinition().getCurrentController().getFrame().getContainerWindow();
// Object aObj = _xSection.getParent();
// we don't need the created objects any longer
- final XComponent xFixedTextDeleter = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFixedText);
+ final XComponent xFixedTextDeleter = UnoRuntime.queryInterface(XComponent.class, xFixedText);
xFixedTextDeleter.dispose();
- final XComponent xFixedTextModelDeleter = (XComponent) UnoRuntime.queryInterface(XComponent.class, aFixedTextModel);
+ final XComponent xFixedTextModelDeleter = UnoRuntime.queryInterface(XComponent.class, aFixedTextModel);
xFixedTextModelDeleter.dispose();
}
catch (Exception e)
{
- // TODO: Exception not set.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
return aSizeMM_100TH;
}
@@ -1161,24 +1185,24 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
{
return m_sTableName;
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
protected String getUserNameFromConfiguration()
{
- String sFirstName = "";
- String sLastName = "";
+ String sFirstName = PropertyNames.EMPTY_STRING;
+ String sLastName = PropertyNames.EMPTY_STRING;
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)
+ catch (Exception e)
{
- exception.printStackTrace(System.out);
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
- return sFirstName + " " + sLastName;
+ return sFirstName + PropertyNames.SPACE + sLastName;
}
/**
@@ -1188,8 +1212,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
*/
private void copyProperties(Object _aFrom, Object _aTo)
{
- XPropertySet xFrom = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aFrom);
- XPropertySet xTo = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _aTo);
+ XPropertySet xFrom = UnoRuntime.queryInterface(XPropertySet.class, _aFrom);
+ XPropertySet xTo = UnoRuntime.queryInterface(XPropertySet.class, _aTo);
XPropertySetInfo xForeignPropInfo = xFrom.getPropertySetInfo();
@@ -1210,6 +1234,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
}
@@ -1230,7 +1255,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
while (xEnum.hasMoreElements())
{
Object aEnumObj = xEnum.nextElement();
- XReportComponent aComponent = (XReportComponent) UnoRuntime.queryInterface(XReportComponent.class, aEnumObj);
+ XReportComponent aComponent = UnoRuntime.queryInterface(XReportComponent.class, aEnumObj);
// XCloneable aClone = (XCloneable)UnoRuntime.queryInterface(XCloneable.class, aEnumObj);
if (aComponent != null)
@@ -1238,14 +1263,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
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();
+ XShape aShape = UnoRuntime.queryInterface(XShape.class, aClone);
// normally 'createClone' will create a real clone of the component,
// but there seems some problems, we have to controll.
@@ -1260,9 +1278,10 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
- // String sName = xForeignSection.getName();
- // int dummy = 0;
+ // String sName = xForeignSection.getName();
+ // int dummy = 0;
}
protected void insertPageHeader()
@@ -1287,9 +1306,9 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
+ }
}
- return;
- }
else
{
// we won't a page header
@@ -1364,7 +1383,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.uno.Exception e)
{
- // TODO: Exception not set.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
}
@@ -1390,6 +1409,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (Exception e)
{
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
else
@@ -1423,8 +1443,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
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 String sNoLastUnusedQuotes = sPageCount.replaceAll(" & \\\"\\\"", PropertyNames.EMPTY_STRING);
+ final String sNoFirstUnusedQuotes = sNoLastUnusedQuotes.replaceAll("\\\"\\\" & ", PropertyNames.EMPTY_STRING);
final int nUsablePageWidth = getPageWidth() - getLeftPageIndent() - getRightPageIndent();
@@ -1445,17 +1465,16 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
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 = insertFormattedField(xSection, "rpt:" + sNoFirstUnusedQuotes, aRect, nUsablePageWidth, 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.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
}
@@ -1574,7 +1593,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
if (m_aFixedTextHelper == null)
{
final Object aFixedText = getMSFofReportDefinition().createInstance("com.sun.star.report.FixedText");
- m_aFixedTextHelper = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, aFixedText);
+ m_aFixedTextHelper = UnoRuntime.queryInterface(XFixedText.class, aFixedText);
}
m_aFixedTextHelper.setLabel(_sLabel);
@@ -1595,7 +1614,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
catch (com.sun.star.uno.Exception e)
{
- // TODO: Exception not set.
+ Logger.getLogger(ReportBuilderLayouter.class.getName()).log(Level.SEVERE, null, e);
}
}
return nWidth;
@@ -1623,7 +1642,7 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
String sDefaultHeaderLayout = m_xReportDefinitionReadAccess.getDefaultHeaderLayout();
loadAndSetBackgroundTemplate(sDefaultHeaderLayout);
- // copy all functions from the design template to the current report definition
+ // copy all functions from the design template to the current report definition
// XFunctions xOtherFunctions = m_xDesignTemplate.getReportDefinition().getFunctions();
// final int nFunctionCount = xOtherFunctions.getCount();
// for (int i=0;i<nFunctionCount;i++)
@@ -1678,8 +1697,8 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
closeDesignTemplate();
String sName = FileAccess.getFilename(LayoutTemplatePath);
- if (sName.toLowerCase().equals("default.otr_") ||
- LayoutTemplatePath.equals("DefaultLayoutOfHeaders"))
+ if (sName.toLowerCase().equals("default.otr_")
+ || LayoutTemplatePath.equals("DefaultLayoutOfHeaders"))
{
// this is the default layout, we don't want to have a layout for this.
}
@@ -1690,4 +1709,3 @@ abstract public class ReportBuilderLayouter implements IReportBuilderLayouter
}
}
}
-
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
index 8df754795e63..6830d56b5107 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionEmptyObject.java
@@ -44,8 +44,7 @@ public class SectionEmptyObject extends SectionObject
public static SectionObject create()
{
- SectionEmptyObject a = new SectionEmptyObject();
- return a;
+ return new SectionEmptyObject();
}
public FontDescriptor getFontDescriptor()
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
index ae3766fd3391..9780a1350681 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionLabel.java
@@ -48,8 +48,7 @@ public class SectionLabel extends SectionObject
public static SectionObject create(XFixedText _aFixedText)
{
- final SectionLabel a = new SectionLabel(_aFixedText);
- return a;
+ return new SectionLabel(_aFixedText);
}
/**
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
index 797ac097f915..106b2a341d17 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionObject.java
@@ -65,14 +65,12 @@ abstract public class SectionObject
public int getHeight(int _nDefault)
{
- final int nHeight = getPropertySetHelper().getPropertyValueAsInteger(PropertyNames.PROPERTY_HEIGHT, _nDefault);
- return nHeight;
+ return getPropertySetHelper().getPropertyValueAsInteger(PropertyNames.PROPERTY_HEIGHT, _nDefault);
}
public float getCharWeight(float _nDefault)
{
- final float fCharWeight = (float) getPropertySetHelper().getPropertyValueAsDouble("CharWeight", _nDefault);
- return fCharWeight;
+ return(float) getPropertySetHelper().getPropertyValueAsDouble("CharWeight", _nDefault);
}
public void setFontToBold()
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
index 2a11fcd56f04..fc17ba0ab5aa 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/SectionTextField.java
@@ -46,8 +46,7 @@ public class SectionTextField extends SectionObject
public static SectionObject create(XFormattedField _aFormattedField)
{
- SectionTextField a = new SectionTextField(_aFormattedField);
- return a;
+ return new SectionTextField(_aFormattedField);
}
public FontDescriptor getFontDescriptor()
diff --git a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
index 0fe168b28263..c2d85fb58e61 100644
--- a/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
+++ b/wizards/com/sun/star/wizards/reportbuilder/layout/Tabular.java
@@ -55,8 +55,7 @@ public class Tabular extends ReportBuilderLayouter
public String getLocalizedName()
{
- String sLocalizedName = getResource().getResText(UIConsts.RID_REPORT + 80);
- return sLocalizedName;
+ return getResource().getResText(UIConsts.RID_REPORT + 80);
}
protected void insertDetailFields()
@@ -92,60 +91,59 @@ public class Tabular extends ReportBuilderLayouter
xSection.setHeight(nHeight);
}
- protected void insertDetailFieldTitles()
+ protected void insertDetailFieldTitles(int lastGroupPostion)
{
final String[] aFieldTitleNames = getFieldTitleNames();
- if (aFieldTitleNames == null)
+ if (aFieldTitleNames == null || aFieldTitleNames.length == 0)
{
return;
}
- if (aFieldTitleNames.length == 0)
- {
- return;
- }
- final int nGroups = getReportDefinition().getGroups().getCount();
try
{
- XSection xSection = null;
SectionObject aSO = null;
- if (nGroups == 0)
+ final XGroups xGroups = getReportDefinition().getGroups();
+ final XGroup xGroup;
+ if (lastGroupPostion == -1)
{
// Spezial case, there is no Group.
- final XGroups xGroups = getReportDefinition().getGroups();
- final XGroup xGroup = xGroups.createGroup();
+ 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();
+ xGroup = UnoRuntime.queryInterface(XGroup.class, xGroups.getByIndex(lastGroupPostion));
// We don't need to copy the GroupProperties, because this is done in the insertGroup() member function
// copyGroupProperties(0);
- aSO = getDesignTemplate().getGroupLabel(nGroups - 1);
+ aSO = getDesignTemplate().getGroupLabel(lastGroupPostion);
}
+ XSection xSection = xGroup.getHeader();
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
+ if (lastGroupPostion == -1)
+ {
+ xSection.setHeight(0); // group height + a little empty line)
+ aRect.Y = 0;
+ }
+ else
+ {
+ aRect.Y = xSection.getHeight() + LayoutConstants.LineHeight;
+ }
+
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));
+ xSection.setHeight(xSection.getHeight() + aSO.getHeight(LayoutConstants.LabelHeight));
}
catch (com.sun.star.uno.Exception e)
{
diff --git a/wizards/com/sun/star/wizards/table/CGCategory.java b/wizards/com/sun/star/wizards/table/CGCategory.java
index ea74b33f09ad..228891c12927 100644
--- a/wizards/com/sun/star/wizards/table/CGCategory.java
+++ b/wizards/com/sun/star/wizards/table/CGCategory.java
@@ -75,9 +75,8 @@ public class CGCategory
{
try
{
- xNameAccessTablesNode = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xNameAccessCurBusinessNode.getByName("Tables"));
- String[] sTableNames = Configuration.getNodeDisplayNames(xNameAccessTablesNode);
- return sTableNames;
+ xNameAccessTablesNode = UnoRuntime.queryInterface(XNameAccess.class, xNameAccessCurBusinessNode.getByName("Tables"));
+ return Configuration.getNodeDisplayNames(xNameAccessTablesNode);
}
catch (Exception e)
{
diff --git a/wizards/com/sun/star/wizards/table/CallTableWizard.java b/wizards/com/sun/star/wizards/table/CallTableWizard.java
index af685eadf343..e3c5c690fad3 100644
--- a/wizards/com/sun/star/wizards/table/CallTableWizard.java
+++ b/wizards/com/sun/star/wizards/table/CallTableWizard.java
@@ -30,6 +30,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
/** This class capsulates the class, that implements the minimal component, a
* factory for creating the service (<CODE>__getServiceFactory</CODE>).
@@ -80,15 +81,15 @@ public class CallTableWizard
{
super();
m_serviceFactory = i_serviceFactory;
- registerProperty( "Command", (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) );
- registerProperty( "CommandType", PropertyAttribute.READONLY );
+ registerProperty( PropertyNames.COMMAND, (short)( PropertyAttribute.READONLY | PropertyAttribute.MAYBEVOID ) );
+ registerProperty( PropertyNames.COMMAND_TYPE, PropertyAttribute.READONLY );
}
public void trigger( String sEvent )
{
try
{
- if ( sEvent.compareTo("start") == 0 )
+ if ( sEvent.compareTo(PropertyNames.START) == 0 )
{
TableWizard CurTableWizard = new TableWizard( m_serviceFactory, m_wizardContext );
Command = CurTableWizard.startTableWizard();
@@ -166,7 +167,7 @@ public class CallTableWizard
try
{
- byteReturn = new String("" + this.hashCode()).getBytes();
+ byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
}
catch (Exception exception)
{
diff --git a/wizards/com/sun/star/wizards/table/FieldDescription.java b/wizards/com/sun/star/wizards/table/FieldDescription.java
index f816b03e8f8c..95e556f920b7 100644
--- a/wizards/com/sun/star/wizards/table/FieldDescription.java
+++ b/wizards/com/sun/star/wizards/table/FieldDescription.java
@@ -40,7 +40,7 @@ import com.sun.star.wizards.common.PropertyNames;
public class FieldDescription
{
- private String tablename = "";
+ private String tablename = PropertyNames.EMPTY_STRING;
// String fieldname;
private String keyname;
private XNameAccess xNameAccessTableNode;
@@ -132,7 +132,7 @@ public class FieldDescription
{
try
{
- xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, _xNameAccessFieldNode);
+ xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _xNameAccessFieldNode);
// Integer Index = (Integer) xPropertySet.getPropertyValue("Index");
if (propertyexists(PropertyNames.PROPERTY_NAME))
{
@@ -140,22 +140,22 @@ public class FieldDescription
}
if (propertyexists("Type"))
{
- aPropertyValues.addElement(Properties.createProperty("Type", (Integer) xPropertySet.getPropertyValue("Type")));
+ aPropertyValues.addElement(Properties.createProperty("Type", xPropertySet.getPropertyValue("Type")));
}
if (propertyexists("Scale"))
{
- aPropertyValues.addElement(Properties.createProperty("Scale", (Integer) xPropertySet.getPropertyValue("Scale")));
+ aPropertyValues.addElement(Properties.createProperty("Scale", xPropertySet.getPropertyValue("Scale")));
// Scale =
}
if (propertyexists("Precision"))
{
- aPropertyValues.addElement(Properties.createProperty("Precision", (Integer) xPropertySet.getPropertyValue("Precision")));
+ aPropertyValues.addElement(Properties.createProperty("Precision", 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");
+ aPropertyValues.addElement(Properties.createProperty("DefaultValue", xPropertySet.getPropertyValue("DefaultValue")));// DefaultValue = (Boolean) xPropertySet.getPropertyValue("DefaultValue");
+ //Type = 4; // TODO wo ist der Fehler?(Integer) xPropertySet.getPropertyValue("Type");
}
}
catch (Exception e)
diff --git a/wizards/com/sun/star/wizards/table/FieldFormatter.java b/wizards/com/sun/star/wizards/table/FieldFormatter.java
index 43349d71376f..d19a6e0eb21d 100644
--- a/wizards/com/sun/star/wizards/table/FieldFormatter.java
+++ b/wizards/com/sun/star/wizards/table/FieldFormatter.java
@@ -84,7 +84,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- UIConsts.INTEGERS[8], sFieldNames, new Integer(91), new Integer(27), IFieldFormatStep, new Short(curtabindex++), new Integer(90)
+ UIConsts.INTEGERS[8], sFieldNames, 91, 27, IFieldFormatStep, new Short(curtabindex++), 90
});
try
@@ -96,7 +96,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- new Integer(133), "HID:WIZARDS_HID_DLGTABLE_LB_SELFIELDNAMES", new Integer(92), new Integer(37), IFieldFormatStep, new Short(curtabindex++), new Integer(62)
+ 133, "HID:WIZARDS_HID_DLGTABLE_LB_SELFIELDNAMES", 92, 37, IFieldFormatStep, new Short(curtabindex++), 62
});
}
catch (Exception e)
@@ -110,21 +110,21 @@ public class FieldFormatter implements XItemListener
btnShiftUp = CurUnoDialog.insertButton("btnShiftUp", "shiftFieldNameUp", this,
new String[]
{
- PropertyNames.PROPERTY_ENABLED, "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.FALSE, oFontDesc, new Integer(14), "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDUP", String.valueOf((char) 8743), new Integer(158), new Integer(139), IFieldFormatStep, new Short(curtabindex++), new Integer(14)
+ Boolean.FALSE, oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDUP", String.valueOf((char) 8743), 158, 139, IFieldFormatStep, new Short(curtabindex++), 14
});
btnShiftDown = CurUnoDialog.insertButton("btnShiftDown", "shiftFieldNameDown", this,
new String[]
{
- PropertyNames.PROPERTY_ENABLED, "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.FALSE, oFontDesc, new Integer(14), "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDDOWN", String.valueOf((char) 8744), new Integer(158), new Integer(156), IFieldFormatStep, new Short(curtabindex++), new Integer(14)
+ Boolean.FALSE, oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMOVEFIELDDOWN", String.valueOf((char) 8744), 158, 156, IFieldFormatStep, new Short(curtabindex++), 14
});
oFontDesc = new FontDescriptor();
oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD;
@@ -132,31 +132,31 @@ public class FieldFormatter implements XItemListener
btnminus = CurUnoDialog.insertButton("btnminus", "removeFieldName", this,
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- oFontDesc, new Integer(14), "HID:WIZARDS_HID_DLGTABLE_CMDMINUS", "-", new Integer(118), new Integer(175), IFieldFormatStep, new Short(curtabindex++), new Integer(14)
+ oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDMINUS", "-", 118, 175, IFieldFormatStep, new Short(curtabindex++), 14
});
btnplus = CurUnoDialog.insertButton("btnplus", "addFieldName", this,
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- oFontDesc, new Integer(14), "HID:WIZARDS_HID_DLGTABLE_CMDPLUS", "+", new Integer(137), new Integer(175), IFieldFormatStep, new Short(curtabindex++), new Integer(14)
+ oFontDesc, 14, "HID:WIZARDS_HID_DLGTABLE_CMDPLUS", "+", 137, 175, IFieldFormatStep, new Short(curtabindex++), 14
});
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "ColDescriptorHeader",
new String[]
{
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Integer(8), sfieldinfo, new Integer(0), new Integer(158), new Integer(27), IFieldFormatStep, new Short(curtabindex++), new Integer(165)
+ 8, sfieldinfo, 0, 158, 27, IFieldFormatStep, new Short(curtabindex++), 165
});
@@ -167,7 +167,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- UIConsts.INTEGERS[8], sFieldName, new Integer(158), new Integer(39), IFieldFormatStep, new Short(curtabindex++), new Integer(94)
+ UIConsts.INTEGERS[8], sFieldName, 158, 39, IFieldFormatStep, new Short(curtabindex++), 94
});
txtfieldname = CurUnoDialog.insertTextField("txtfieldname", MODIFYFIELDNAME, this,
@@ -177,7 +177,7 @@ public class FieldFormatter implements XItemListener
},
new Object[]
{
- UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_COLNAME", new Integer(274), new Integer(37), IFieldFormatStep, new Short(curtabindex++), "", new Integer(50)
+ UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_COLNAME", 274, 37, IFieldFormatStep, new Short(curtabindex++), PropertyNames.EMPTY_STRING, 50
});
txtfieldname.addTextListener(CurUnoDialog);
CurUnoDialog.getPeerConfiguration().setAccessibleName(btnplus, sbtnplushelptext);
@@ -195,10 +195,10 @@ public class FieldFormatter implements XItemListener
}, // PropertyNames.PROPERTY_HELPURL
new Object[]
{
- new Integer(85), new Integer(158), new Integer(49), IFieldFormatStep, new Short(curtabindex++), new Integer(166), new Integer(50)
+ 85, 158, 49, IFieldFormatStep, new Short(curtabindex++), 166, 50
}); //, "HID:WIZARDS_HID_DLGTABLE_COLMODIFIER"
curTableDescriptor = _curTableDescriptor;
- Helper.setUnoPropertyValue(oColumnDescriptorModel, "ActiveConnection", _curTableDescriptor.DBConnection);
+ Helper.setUnoPropertyValue(oColumnDescriptorModel, PropertyNames.ACTIVE_CONNECTION, _curTableDescriptor.DBConnection);
txtfieldname.setMaxTextLen((short) this.curTableDescriptor.getMaxColumnNameLength());
}
else
@@ -210,8 +210,8 @@ public class FieldFormatter implements XItemListener
CurUnoDialog.repaintDialogStep();
}
}
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", _fieldnames);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, _fieldnames);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
@@ -224,7 +224,7 @@ public class FieldFormatter implements XItemListener
{
boolean benableShiftUpButton = false;
boolean benableShiftDownButton = false;
- boolean bfieldnameisselected = Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems") != null;
+ boolean bfieldnameisselected = Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS) != null;
int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames);
boolean blistispopulated = (ilistcount > 0);
if (bfieldnameisselected)
@@ -233,20 +233,20 @@ public class FieldFormatter implements XItemListener
benableShiftUpButton = (iselpos != 0);
benableShiftDownButton = (iselpos != ilistcount - 1);
}
- Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftUp), PropertyNames.PROPERTY_ENABLED, new Boolean(benableShiftUpButton));
- Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftDown), PropertyNames.PROPERTY_ENABLED, new Boolean(benableShiftDownButton));
- Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(blistispopulated));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftUp), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableShiftUpButton));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnShiftDown), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableShiftDownButton));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(blistispopulated));
CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, blistispopulated);
}
public void addFieldName()
{
- String snewfieldname = Desktop.getUniqueName(xlstFieldNames.getItems(), suntitled, "");
+ String snewfieldname = Desktop.getUniqueName(xlstFieldNames.getItems(), suntitled, PropertyNames.EMPTY_STRING);
short icount = xlstFieldNames.getItemCount();
if (CurUnoDialog.verifyfieldcount(icount))
{
xlstFieldNames.addItem(snewfieldname, icount);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
{
icount
});
@@ -262,7 +262,7 @@ public class FieldFormatter implements XItemListener
public void removeFieldName()
{
- String[] fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
+ String[] fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST);
short ipos = UnoDialog.getSelectedItemPos(xlstFieldNames);
String fieldname = fieldnames[ipos];
xlstFieldNames.removeItems(ipos, (short) 1);
@@ -270,7 +270,7 @@ public class FieldFormatter implements XItemListener
int ilistcount = /* xlstFieldNames.getItemCount();*/ UnoDialog.getListBoxItemCount(xlstFieldNames);
if ((ipos) < ilistcount)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
{
ipos
});
@@ -280,14 +280,14 @@ public class FieldFormatter implements XItemListener
if (ilistcount > -1)
{
ipos = (short) ((short) ilistcount - (short) 1);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
{
ipos
});
}
}
curTableDescriptor.dropColumnbyName(fieldname);
- fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
+ fieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST);
boolean benable = ((ipos > -1) && (ipos < fieldnames.length));
if (benable)
{
@@ -297,11 +297,11 @@ public class FieldFormatter implements XItemListener
}
else
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", "");
- Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(benable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(txtfieldname), "Text", PropertyNames.EMPTY_STRING);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable));
CurUnoDialog.setcompleted(TableWizard.SOFIELDSFORMATPAGE, benable);
}
- Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, new Boolean(benable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(btnminus), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benable));
CurUnoDialog.setControlVisible("oColumnDescriptor", benable);
CurUnoDialog.repaintDialogStep();
}
@@ -323,8 +323,8 @@ public class FieldFormatter implements XItemListener
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[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, fieldnames);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
{
ipos
});
@@ -336,10 +336,10 @@ public class FieldFormatter implements XItemListener
{
short ipos = xlstFieldNames.getSelectedItemPos();
String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, -1);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", snewlist);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist);
if ((ipos - 1) > -1)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
{
(short) (ipos - 1)
});
@@ -352,10 +352,10 @@ public class FieldFormatter implements XItemListener
{
short ipos = xlstFieldNames.getSelectedItemPos();
String[] snewlist = shiftArrayItem(xlstFieldNames.getItems(), ipos, 1);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList", snewlist);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST, snewlist);
if ((ipos + 1) < xlstFieldNames.getItemCount())
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.SELECTED_ITEMS, new short[]
{
(short) (ipos + 1)
});
@@ -379,7 +379,7 @@ public class FieldFormatter implements XItemListener
public boolean updateColumnofColumnDescriptor()
{
Object oColumn = Helper.getUnoPropertyValue(oColumnDescriptorModel, "Column");
- XPropertySet xColPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oColumn);
+ XPropertySet xColPropertySet = UnoRuntime.queryInterface(XPropertySet.class, oColumn);
if (xColPropertySet != null)
{
curTableDescriptor.modifyColumn(txtfieldname.getText(), xColPropertySet);
@@ -401,8 +401,7 @@ public class FieldFormatter implements XItemListener
public XPropertySet clonePropertySet(XPropertySet _xPropertySet)
{
- XPropertySet xlocpropertyset = null;
- return xlocpropertyset;
+ return null;
}
public void itemStateChanged(ItemEvent arg0)
@@ -415,13 +414,13 @@ public class FieldFormatter implements XItemListener
public boolean iscompleted()
{
- String[] sfieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
+ String[] sfieldnames = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST);
return sfieldnames.length > 0;
}
public String[] getFieldNames()
{
- return (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), "StringItemList");
+ return (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xlstFieldNames), PropertyNames.STRING_ITEM_LIST);
}
/* (non-Javadoc)
diff --git a/wizards/com/sun/star/wizards/table/Finalizer.java b/wizards/com/sun/star/wizards/table/Finalizer.java
index 340dd5d2dc7b..dd6933385927 100644
--- a/wizards/com/sun/star/wizards/table/Finalizer.java
+++ b/wizards/com/sun/star/wizards/table/Finalizer.java
@@ -83,7 +83,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], slblTableName, new Integer(97), new Integer(25), IFINALSTEP, new Integer(220)
+ UIConsts.INTEGERS[8], slblTableName, 97, 25, IFINALSTEP, 220
});
txtTableName = CurUnoDialog.insertTextField("txtTableName", SETCOMPLETIONFLAG, this,
new String[]
@@ -92,7 +92,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_TXT_NAME", new Integer(97), new Integer(35), IFINALSTEP, new Short(curtabindex++), "", new Integer(223)
+ UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGTABLE_TXT_NAME", 97, 35, IFINALSTEP, new Short(curtabindex++), PropertyNames.EMPTY_STRING, 223
});
txtTableName.addTextListener(CurUnoDialog);
txtTableName.setMaxTextLen((short) this.curtabledescriptor.getMaxTableNameLength());
@@ -103,7 +103,7 @@ public class Finalizer
if (sCatalogNames.length > 0)
{
bsupportsCatalogs = true;
- String sCatalog = "";
+ String sCatalog = PropertyNames.EMPTY_STRING;
try
{
sCatalog = curtabledescriptor.DBConnection.getCatalog();
@@ -119,7 +119,7 @@ public class Finalizer
},
new Object[]
{
- new Integer(8), slblCatalog, new Integer(nListBoxPosX), new Integer(52), IFINALSTEP, new Short(curtabindex++), new Integer(120)
+ 8, slblCatalog, new Integer(nListBoxPosX), 52, IFINALSTEP, new Short(curtabindex++), 120
});
try
@@ -127,18 +127,18 @@ public class Finalizer
xCatalogListBox = CurUnoDialog.insertListBox("lstCatalog", null, null,
new String[]
{
- "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.TRUE, new Integer(12), "HID:WIZARDS_HID_DLGTABLE_LST_CATALOG", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sCatalogNames, new Short(curtabindex++), new Integer(80)
+ Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LST_CATALOG", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), 62, IFINALSTEP, sCatalogNames, new Short(curtabindex++), 80
});
int isel = JavaTools.FieldInList(sCatalogNames, sCatalog);
if (isel < 0)
{
isel = 0;
}
- CurUnoDialog.setControlProperty("lstCatalog", "SelectedItems", new short[]
+ CurUnoDialog.setControlProperty("lstCatalog", PropertyNames.SELECTED_ITEMS, new short[]
{
(short) isel
});
@@ -158,7 +158,7 @@ public class Finalizer
if (sSchemaNames.length > 0)
{
bsupportsSchemata = true;
- String sSchema = "";
+ String sSchema = PropertyNames.EMPTY_STRING;
try
{
sSchema = (String) curtabledescriptor.getDataSourcePropertySet().getPropertyValue("User");
@@ -174,7 +174,7 @@ public class Finalizer
},
new Object[]
{
- new Integer(8), slblSchema, new Integer(nListBoxPosX), new Integer(52), IFINALSTEP, new Short(curtabindex++), new Integer(80)
+ 8, slblSchema, new Integer(nListBoxPosX), 52, IFINALSTEP, new Short(curtabindex++), 80
});
try
@@ -182,18 +182,18 @@ public class Finalizer
xSchemaListBox = CurUnoDialog.insertListBox("lstSchema", null, null,
new String[]
{
- "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.TRUE, new Integer(12), "HID:WIZARDS_HID_DLGTABLE_LST_SCHEMA", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), new Integer(62), IFINALSTEP, sSchemaNames, new Short(curtabindex++), new Integer(80)
+ Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LST_SCHEMA", new Short(UnoDialog.getListBoxLineCount()), new Integer(nListBoxPosX), 62, IFINALSTEP, sSchemaNames, new Short(curtabindex++), 80
});
int isel = JavaTools.FieldInList(sSchemaNames, sSchema);
if (isel < 0)
{
isel = 0;
}
- CurUnoDialog.setControlProperty("lstSchema", "SelectedItems", new short[]
+ CurUnoDialog.setControlProperty("lstSchema", PropertyNames.SELECTED_ITEMS, new short[]
{
(short) isel
});
@@ -214,7 +214,7 @@ public class Finalizer
},
new Object[]
{
- new Integer(16), sCongratulations, Boolean.TRUE, new Integer(97), new Integer(62), IFINALSTEP, new Short(curtabindex++), new Integer(226)
+ 16, sCongratulations, Boolean.TRUE, 97, 62, IFINALSTEP, new Short(curtabindex++), 226
});
}
else
@@ -228,7 +228,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], slblProceed, new Integer(97), new Integer(82 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), new Integer(227)
+ UIConsts.INTEGERS[8], slblProceed, 97, new Integer(82 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), 227
});
optWorkWithTable = CurUnoDialog.insertRadioButton("optWorkWithTable", null,
new String[]
@@ -237,7 +237,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_WORKWITHTABLE", sWorkWithTable, new Integer(101), new Integer(97 + ndiffPosY), new Short((short) 1), IFINALSTEP, new Short(curtabindex++), new Integer(177)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_WORKWITHTABLE", sWorkWithTable, 101, new Integer(97 + ndiffPosY), new Short((short) 1), IFINALSTEP, new Short(curtabindex++), 177
});
optModifyTable = CurUnoDialog.insertRadioButton("optModifyTable", null,
new String[]
@@ -246,7 +246,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_MODIFYTABLE", sModifyTable, new Integer(101), new Integer(109 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), new Integer(177)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_MODIFYTABLE", sModifyTable, 101, new Integer(109 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), 177
});
optStartFormWizard = CurUnoDialog.insertRadioButton("optStartFormWizard", null,
new String[]
@@ -255,7 +255,7 @@ public class Finalizer
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_STARTFORMWIZARD", sStartFormWizard, new Integer(101), new Integer(121 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), new Integer(177)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_STARTFORMWIZARD", sStartFormWizard, 101, new Integer(121 + ndiffPosY), IFINALSTEP, new Short(curtabindex++), 177
});
}
catch (SQLException e)
@@ -302,7 +302,7 @@ public class Finalizer
public void setTableName(String _tablename)
{
- if (txtTableName.getText().equals(""))
+ if (txtTableName.getText().equals(PropertyNames.EMPTY_STRING))
{
String ssuffix = Desktop.getIncrementSuffix(curtabledescriptor.getTableNamesAsNameAccess(), getComposedTableName(_tablename));
txtTableName.setText(_tablename + ssuffix);
@@ -317,7 +317,7 @@ public class Finalizer
public String getTableName(String _firsttablename)
{
- if (txtTableName.getText().equals(""))
+ if (txtTableName.getText().equals(PropertyNames.EMPTY_STRING))
{
setTableName(_firsttablename);
}
@@ -332,7 +332,7 @@ public class Finalizer
}
else
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
}
@@ -344,7 +344,7 @@ public class Finalizer
}
else
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
}
diff --git a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
index a4a896752dd2..6246b3ef037f 100644
--- a/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
+++ b/wizards/com/sun/star/wizards/table/PrimaryKeyHandler.java
@@ -90,7 +90,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- new Integer(40), sExplanations, Boolean.TRUE, new Integer(91), new Integer(27), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(233)
+ 40, sExplanations, Boolean.TRUE, 91, 27, IPRIMEKEYSTEP, new Short(curtabindex++), 233
});
chkcreatePrimaryKey = CurUnoDialog.insertCheckBox("chkcreatePrimaryKey", SPRIMEKEYMODE, this,
@@ -100,7 +100,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CHK_USEPRIMEKEY", screatePrimaryKey, new Integer(97), new Integer(70), new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(160)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CHK_USEPRIMEKEY", screatePrimaryKey, 97, 70, new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), 160
});
optAddAutomatically = CurUnoDialog.insertRadioButton("optAddAutomatically", SPRIMEKEYMODE, this,
@@ -110,7 +110,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_AUTOMATIC", sAddAutomatically, new Integer(106), new Integer(82), new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_AUTOMATIC", sAddAutomatically, 106, 82, new Short((short) 1), IPRIMEKEYSTEP, new Short(curtabindex++), 200
});
optUseExisting = CurUnoDialog.insertRadioButton("optUseExisting", SPRIMEKEYMODE, this,
@@ -120,7 +120,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
}, //94
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SINGLE", sUseExisting, new Integer(106), new Integer(104), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SINGLE", sUseExisting, 106, 104, IPRIMEKEYSTEP, new Short(curtabindex++), 200
});
optUseSeveral = CurUnoDialog.insertRadioButton("optUseSeveral", SPRIMEKEYMODE, this,
@@ -130,7 +130,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SEVERAL", sUseSeveral, new Integer(106), new Integer(132), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(200)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPT_PK_SEVERAL", sUseSeveral, 106, 132, IPRIMEKEYSTEP, new Short(curtabindex++), 200
});
chkApplyAutoValueAutomatic = CurUnoDialog.insertCheckBox("chkApplyAutoValueAutomatic", SPRIMEKEYMODE, this,
@@ -140,7 +140,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
}, //107
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE_AUTOMATIC", sApplyAutoValue, new Integer(116), new Integer(92), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(68)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE_AUTOMATIC", sApplyAutoValue, 116, 92, IPRIMEKEYSTEP, new Short(curtabindex++), 68
});
lblPrimeFieldName = CurUnoDialog.insertLabel("lblPrimeFieldName",
@@ -150,7 +150,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
},
new Object[]
{
- Boolean.FALSE, UIConsts.INTEGERS[8], slblPrimeFieldName, new Integer(116), new Integer(117), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(46)
+ Boolean.FALSE, UIConsts.INTEGERS[8], slblPrimeFieldName, 116, 117, IPRIMEKEYSTEP, new Short(curtabindex++), 46
});
lstSinglePrimeKey = CurUnoDialog.insertListBox("lstSinglePrimeKey", "onPrimeKeySelected", null, this,
@@ -171,14 +171,14 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
{
Boolean.TRUE,
Boolean.FALSE,
- new Integer(12),
+ 12,
"HID:WIZARDS_HID_DLGTABLE_LB_PK_FIELDNAME",
Short.valueOf(UnoDialog.getListBoxLineCount()),
- new Integer(162),
- new Integer(115),
+ 162,
+ 115,
IPRIMEKEYSTEP,
new Short(curtabindex++),
- new Integer(80)
+ 80
});
chkApplyAutoValueExisting = CurUnoDialog.insertCheckBox("chkApplyAutoValueExisting", SPRIMEKEYMODE, this,
@@ -188,7 +188,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
}, //107
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE", sApplyAutoValue, new Integer(248), new Integer(117), IPRIMEKEYSTEP, new Short(curtabindex++), new Integer(66)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_CK_PK_AUTOVALUE", sApplyAutoValue, 248, 117, IPRIMEKEYSTEP, new Short(curtabindex++), 66
});
curPrimaryKeySelection = new FieldSelection(CurUnoDialog, IPRIMEKEYSTEP.intValue(), 116, 142, 208, 47, slblAvailableFields, slblSelPrimaryFields, 41234, false);
curPrimaryKeySelection.addFieldSelectionListener(this);
@@ -210,7 +210,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
}
}
String selfield = lstSinglePrimeKey.getSelectedItem();
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), "StringItemList", fieldnames);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), PropertyNames.STRING_ITEM_LIST, fieldnames);
if (selfield != null)
{
if (JavaTools.FieldInList(fieldnames, selfield) > -1)
@@ -260,16 +260,16 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
public void togglePrimeKeyFields()
{
boolean bdoEnable = (this.chkcreatePrimaryKey.getState() == 1);
- Helper.setUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, new Boolean(bAutoPrimaryKeysupportsAutoIncrmentation && bdoEnable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(optUseExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(optUseSeveral), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bAutoPrimaryKeysupportsAutoIncrmentation && bdoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optUseExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(optUseSeveral), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoEnable));
//toggle subcontrols of the radiobuttons...
toggleAutomaticAutoValueCheckBox();
boolean benableSinglePrimekeyControls = bdoEnable && optUseExisting.getState();
toggleSinglePrimeKeyFields(benableSinglePrimekeyControls);
boolean benableSeveralPrimekeyControls = bdoEnable && optUseSeveral.getState();
- curPrimaryKeySelection.toggleListboxControls(new Boolean(benableSeveralPrimekeyControls));
+ curPrimaryKeySelection.toggleListboxControls(Boolean.valueOf(benableSeveralPrimekeyControls));
// toggle the following steps of the dialog...
if (!bdoEnable)
{
@@ -354,7 +354,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
String selfieldname = lstSinglePrimeKey.getSelectedItem();
boolean bdoenable = isAutoIncrementatable(selfieldname);
CurUnoDialog.setcompleted(TableWizard.SOPRIMARYKEYPAGE, lstSinglePrimeKey.getSelectedItemPos() != -1);
- Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable));
XPropertySet xColPropertySet = curTableDescriptor.getByName(selfieldname);
boolean bIsAutoIncremented = ((Boolean) xColPropertySet.getPropertyValue("IsAutoIncrement")).booleanValue();
if (bIsAutoIncremented)
@@ -378,7 +378,7 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
{
boolean bisAutomaticMode = AnyConverter.toBoolean(Helper.getUnoPropertyValue(UnoDialog.getModel(optAddAutomatically), PropertyNames.PROPERTY_ENABLED));
boolean bdoenable = bAutoPrimaryKeysupportsAutoIncrmentation && optAddAutomatically.getState() && bisAutomaticMode;
- Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueAutomatic), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable));
}
catch (IllegalArgumentException e)
{
@@ -388,17 +388,17 @@ public class PrimaryKeyHandler implements XFieldSelectionListener
private void toggleSinglePrimeKeyFields(boolean _bdoenable)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(lblPrimeFieldName), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lblPrimeFieldName), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(lstSinglePrimeKey), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable));
boolean bdoenableAutoValueCheckBox = (isAutoIncrementatable(lstSinglePrimeKey.getSelectedItem()) && _bdoenable);
- Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenableAutoValueCheckBox));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(chkApplyAutoValueExisting), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenableAutoValueCheckBox));
}
private void toggleSeveralPrimeKeyFields()
{
boolean bdoEnable = (this.optUseSeveral.getState());
- curPrimaryKeySelection.toggleListboxControls(new Boolean(bdoEnable));
+ curPrimaryKeySelection.toggleListboxControls(Boolean.valueOf(bdoEnable));
}
public String[] getPrimaryKeyFields(TableDescriptor _curtabledescriptor)
diff --git a/wizards/com/sun/star/wizards/table/ScenarioSelector.java b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
index 9ad0506064bb..3ee366eb761a 100644
--- a/wizards/com/sun/star/wizards/table/ScenarioSelector.java
+++ b/wizards/com/sun/star/wizards/table/ScenarioSelector.java
@@ -26,6 +26,7 @@
************************************************************************/
package com.sun.star.wizards.table;
+import java.util.ArrayList;
import java.util.Vector;
import com.sun.star.awt.ItemEvent;
@@ -104,7 +105,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- new Integer(32), sExplanation, Boolean.TRUE, new Integer(91), new Integer(27), IMAINSTEP, new Short(pretabindex++), new Integer(233)
+ 32, sExplanation, Boolean.TRUE, 91, 27, IMAINSTEP, new Short(pretabindex++), 233
});
lblCategories = CurUnoDialog.insertLabel("lblCategories",
@@ -114,7 +115,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- new Integer(8), sCategories, new Integer(91), new Integer(60), IMAINSTEP, new Short(pretabindex++), new Integer(100)
+ 8, sCategories, 91, 60, IMAINSTEP, new Short(pretabindex++), 100
});
optBusiness = CurTableWizardUnoDialog.insertRadioButton("optBusiness", SELECTCATEGORY, this,
@@ -124,7 +125,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTBUSINESS", sBusiness, new Integer(98), new Integer(70), new Short((short) 1), IMAINSTEP, new Short(pretabindex++), new Integer(78)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTBUSINESS", sBusiness, 98, 70, new Short((short) 1), IMAINSTEP, new Short(pretabindex++), 78
});
optPrivate = CurTableWizardUnoDialog.insertRadioButton("optPrivate", SELECTCATEGORY, this,
@@ -134,7 +135,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTPRIVATE", sPrivate, new Integer(182), new Integer(70), IMAINSTEP, new Short(pretabindex++), new Integer(90)
+ UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGTABLE_OPTPRIVATE", sPrivate, 182, 70, IMAINSTEP, new Short(pretabindex++), 90
});
CurUnoDialog.insertLabel("lblTableNames",
@@ -144,7 +145,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- new Integer(8), sTableNames, new Integer(91), new Integer(82), IMAINSTEP, new Short(pretabindex++), new Integer(80)
+ 8, sTableNames, 91, 82, IMAINSTEP, new Short(pretabindex++), 80
});
try
@@ -156,7 +157,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
},
new Object[]
{
- Boolean.TRUE, new Integer(12), "HID:WIZARDS_HID_DLGTABLE_LBTABLES", new Short(UnoDialog.getListBoxLineCount()), new Integer(91), new Integer(92), IMAINSTEP, new Short(pretabindex++), getListboxWidth()
+ Boolean.TRUE, 12, "HID:WIZARDS_HID_DLGTABLE_LBTABLES", new Short(UnoDialog.getListBoxLineCount()), 91, 92, IMAINSTEP, new Short(pretabindex++), getListboxWidth()
});
}
catch (Exception e)
@@ -196,7 +197,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
public void initializeTable(int _iTable)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[]
{
(short) _iTable
});
@@ -207,8 +208,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
public String[] getSelectedFieldNames()
{
String[] displayfieldnames = super.getSelectedFieldNames();
- Vector<String> afieldnameVector = new Vector<String>();
- int a = 0;
+ ArrayList<String> afieldnameVector = new ArrayList<String>();
for (int i = 0; i < displayfieldnames.length; i++)
{
try
@@ -216,8 +216,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(displayfieldnames[i]);
if (ofielddescription != null)
{
- afieldnameVector.addElement(ofielddescription.getName());
- a++;
+ afieldnameVector.add(ofielddescription.getName());
}
}
catch (RuntimeException e)
@@ -225,9 +224,8 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
e.printStackTrace(System.out);
}
}
- String[] fieldnames = new String[a];
- afieldnameVector.toArray(fieldnames);
- return fieldnames;
+ String[] fieldnames = new String[afieldnameVector.size()];
+ return afieldnameVector.toArray(fieldnames);
}
public boolean iscompleted()
@@ -266,7 +264,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
{
for (int i = 0; i < CurTableWizardUnoDialog.fielditems.size(); i++)
{
- String stablename = "";
+ String stablename = PropertyNames.EMPTY_STRING;
try
{
FieldDescription ofielddescription = (FieldDescription) CurTableWizardUnoDialog.fielditems.get(fieldnames[i]);
@@ -276,7 +274,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
{
e.printStackTrace(System.out);
}
- if (!stablename.equals(""))
+ if (!stablename.equals(PropertyNames.EMPTY_STRING))
{
return stablename;
}
@@ -347,7 +345,7 @@ public class ScenarioSelector extends FieldSelection implements XItemListener, X
if (iduplicate != -1)
{
XNameAccess xNameAccessFieldNode;
- String sdisplayname = Desktop.getUniqueName(NewItems, NewItems[iduplicate], "");
+ String sdisplayname = Desktop.getUniqueName(NewItems, NewItems[iduplicate], PropertyNames.EMPTY_STRING);
FieldDescription curfielddescription = new FieldDescription(xMSF, aLocale, this, sdisplayname, NewItems[iduplicate], imaxcolumnchars);
CurTableWizardUnoDialog.fielditems.put(sdisplayname, curfielddescription);
NewItems[iduplicate] = sdisplayname;
diff --git a/wizards/com/sun/star/wizards/table/TableWizard.java b/wizards/com/sun/star/wizards/table/TableWizard.java
index ebcb28ca48b1..d5f4c706b174 100644
--- a/wizards/com/sun/star/wizards/table/TableWizard.java
+++ b/wizards/com/sun/star/wizards/table/TableWizard.java
@@ -53,7 +53,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener,
ScenarioSelector curScenarioSelector;
FieldFormatter curFieldFormatter;
PrimaryKeyHandler curPrimaryKeyHandler;
- String sMsgWizardName = "";
+ String sMsgWizardName = PropertyNames.EMPTY_STRING;
public Hashtable fielditems;
int wizardmode;
String tablename;
@@ -66,7 +66,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener,
public static final int SOFIELDSFORMATPAGE = 2;
public static final int SOPRIMARYKEYPAGE = 3;
public static final int SOFINALPAGE = 4;
- private String sMsgColumnAlreadyExists = "";
+ private String sMsgColumnAlreadyExists = PropertyNames.EMPTY_STRING;
String WizardHeaderText[] = new String[8];
private String m_tableName;
@@ -79,16 +79,16 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener,
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
- PropertyNames.PROPERTY_HEIGHT, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_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)
+ 218, Boolean.TRUE, "DialogTable", 102, 41, 1, new Short((short) 0), sTitle, 330
});
drawNaviBar();
fielditems = new Hashtable();
//TODO if reportResouces cannot be gotten dispose officedocument
- if (getTableResources() == true)
+ if (getTableResources())
{
setRightPaneHeaders(m_oResource, UIConsts.RID_TABLE + 8, 4);
}
@@ -325,15 +325,15 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener,
Object oFormWizard = this.xMSF.createInstance("com.sun.star.wizards.form.CallFormWizard");
NamedValueCollection wizardContext = new NamedValueCollection();
- wizardContext.put( "ActiveConnection", curTableDescriptor.DBConnection );
+ wizardContext.put( PropertyNames.ACTIVE_CONNECTION, curTableDescriptor.DBConnection );
wizardContext.put( "DataSource", curTableDescriptor.getDataSource() );
- wizardContext.put( "CommandType", CommandType.TABLE );
- wizardContext.put( "Command", scomposedtablename );
+ wizardContext.put( PropertyNames.COMMAND_TYPE, CommandType.TABLE );
+ wizardContext.put( PropertyNames.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");
+ xJobExecutor.trigger(PropertyNames.START);
}
catch (Exception e)
{
@@ -387,7 +387,7 @@ public class TableWizard extends DatabaseObjectWizard implements XTextListener,
{
jexception.printStackTrace(System.out);
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public boolean getTableResources()
diff --git a/wizards/com/sun/star/wizards/text/TextDocument.java b/wizards/com/sun/star/wizards/text/TextDocument.java
index 4fe2e9f0d710..6e873c049167 100644
--- a/wizards/com/sun/star/wizards/text/TextDocument.java
+++ b/wizards/com/sun/star/wizards/text/TextDocument.java
@@ -74,6 +74,7 @@ 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.common.PropertyNames;
import com.sun.star.wizards.document.OfficeDocument;
public class TextDocument
@@ -111,7 +112,7 @@ public class TextDocument
xFrame = OfficeDocument.createNewFrame(xMSF, listener);
xTextDocument = loadAsPreview(_sPreviewURL, true);
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument);
if (bShowStatusIndicator)
{
@@ -126,10 +127,10 @@ public class TextDocument
this.xMSF = xMSF;
XDesktop xDesktop = Desktop.getDesktop(xMSF);
- XFramesSupplier xFrameSupplier = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
+ XFramesSupplier xFrameSupplier = UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
xFrame = xFrameSupplier.getActiveFrame();
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
- xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
+ xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent);
if (bShowStatusIndicator)
{
@@ -152,7 +153,7 @@ public class TextDocument
{
m_identifier = _identifier;
}
- };
+ }
// creates an instance of TextDocument containing a blank text document
public TextDocument(XMultiServiceFactory xMSF, ModuleIdentifier _moduleIdentifier, boolean bShowStatusIndicator)
@@ -162,19 +163,19 @@ public class TextDocument
try
{
// create the empty document, and set its module identifier
- xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,
+ xTextDocument = UnoRuntime.queryInterface(XTextDocument.class,
xMSF.createInstance("com.sun.star.text.TextDocument"));
- XLoadable xLoadable = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, xTextDocument);
+ XLoadable xLoadable = UnoRuntime.queryInterface(XLoadable.class, xTextDocument);
xLoadable.initNew();
- XModule xModule = (XModule) UnoRuntime.queryInterface(XModule.class,
+ XModule xModule = UnoRuntime.queryInterface(XModule.class,
xTextDocument);
xModule.setIdentifier(_moduleIdentifier.getIdentifier());
// load the document into a blank frame
XDesktop xDesktop = Desktop.getDesktop(xMSF);
- XComponentLoader xLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xDesktop);
+ XComponentLoader xLoader = UnoRuntime.queryInterface(XComponentLoader.class, xDesktop);
PropertyValue[] loadArgs = new PropertyValue[]
{
new PropertyValue("Model", -1, xTextDocument, com.sun.star.beans.PropertyState.DIRECT_VALUE)
@@ -183,7 +184,7 @@ public class TextDocument
// remember some things for later usage
xFrame = xTextDocument.getCurrentController().getFrame();
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument);
}
catch (Exception e)
{
@@ -203,21 +204,21 @@ public class TextDocument
{
this.xMSF = xMSF;
xFrame = _textDocument.getCurrentController().getFrame();
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, _textDocument);
- xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, _textDocument);
+ xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent);
//PosSize = xFrame.getComponentWindow().getPosSize();
if (bshowStatusIndicator)
{
- XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
+ XStatusIndicatorFactory xStatusIndicatorFactory = UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
xProgressBar = xStatusIndicatorFactory.createStatusIndicator();
- xProgressBar.start("", 100);
+ xProgressBar.start(PropertyNames.EMPTY_STRING, 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);
+ xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
+ xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
- XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale");
xText = xTextDocument.getText();
@@ -225,21 +226,21 @@ public class TextDocument
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);
+ xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
+ xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
m_xDocProps = xDocPropsSuppl.getDocumentProperties();
CharLocale = (Locale) Helper.getUnoStructValue((Object) xComponent, "CharLocale");
- xStorable = (XStorable) UnoRuntime.queryInterface(XStorable.class, xTextDocument);
+ xStorable = UnoRuntime.queryInterface(XStorable.class, xTextDocument);
xText = xTextDocument.getText();
}
private void showStatusIndicator()
{
- XStatusIndicatorFactory xStatusIndicatorFactory = (XStatusIndicatorFactory) UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
+ XStatusIndicatorFactory xStatusIndicatorFactory = UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
xProgressBar = xStatusIndicatorFactory.createStatusIndicator();
- xProgressBar.start("", 100);
+ xProgressBar.start(PropertyNames.EMPTY_STRING, 100);
xProgressBar.setValue(5);
}
@@ -248,7 +249,7 @@ public class TextDocument
PropertyValue loadValues[] = new PropertyValue[3];
// open document in the Preview mode
loadValues[0] = new PropertyValue();
- loadValues[0].Name = "ReadOnly";
+ loadValues[0].Name = PropertyNames.READ_ONLY;
loadValues[0].Value = Boolean.TRUE;
loadValues[1] = new PropertyValue();
loadValues[1].Name = "AsTemplate";
@@ -262,7 +263,7 @@ public class TextDocument
{
try
{
- XModifiable xModi = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, xTextDocument);
+ XModifiable xModi = UnoRuntime.queryInterface(XModifiable.class, xTextDocument);
xModi.setModified(false);
}
catch (PropertyVetoException e1)
@@ -273,7 +274,7 @@ public class TextDocument
Object oDoc = OfficeDocument.load(xFrame, sDefaultTemplate, "_self", loadValues);
xTextDocument = (com.sun.star.text.XTextDocument) oDoc;
DocSize = getPageSize();
- xMSFDoc = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
ViewHandler myViewHandler = new ViewHandler(xMSFDoc, xTextDocument);
try
@@ -296,12 +297,12 @@ public class TextDocument
{
try
{
- XStyleFamiliesSupplier xStyleFamiliesSupplier = (XStyleFamiliesSupplier) com.sun.star.uno.UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ XStyleFamiliesSupplier xStyleFamiliesSupplier = 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"));
+ xPageStyleCollection = UnoRuntime.queryInterface(com.sun.star.container.XNameContainer.class, xNameAccess.getByName("PageStyles"));
+ XStyle xPageStyle = UnoRuntime.queryInterface(XStyle.class, xPageStyleCollection.getByName("First Page"));
return (Size) Helper.getUnoPropertyValue(xPageStyle, "Size");
}
@@ -321,23 +322,22 @@ public class TextDocument
xFrame = OfficeDocument.createNewFrame(xMSF, listener);
Object oDoc = OfficeDocument.load(xFrame, URL, "_self", xArgs);
xTextDocument = (XTextDocument) oDoc;
- xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);
+ 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);
+ xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
+ xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
+ xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
- XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = 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;
+ XSimpleText xText = UnoRuntime.queryInterface(XSimpleText.class, oCursorContainer);
+ return xText.createTextCursor();
}
// Todo: This method is unsecure because the last index is not necessarily the last section
@@ -356,7 +356,7 @@ public class TextDocument
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());
+ XTextViewCursorSupplier xViewCursor = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
XTextViewCursor xTextViewCursor = xViewCursor.getViewCursor();
xTextViewCursor.gotoStart(false);
int iFirstPos = xTextViewCursor.getPosition().X;
@@ -365,14 +365,14 @@ public class TextDocument
iScale = (iLastPos - iFirstPos) / iScaleLen;
xTextCursor.gotoStart(false);
xTextCursor.gotoEnd(true);
- xTextCursor.setString("");
+ xTextCursor.setString(PropertyNames.EMPTY_STRING);
unlockallControllers();
return iScale;
}
public void unlockallControllers()
{
- while (xTextDocument.hasControllersLocked() == true)
+ while (xTextDocument.hasControllersLocked())
{
xTextDocument.unlockControllers();
}
@@ -380,7 +380,7 @@ public class TextDocument
public void refresh()
{
- XRefreshable xRefreshable = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, xTextDocument);
+ XRefreshable xRefreshable = UnoRuntime.queryInterface(XRefreshable.class, xTextDocument);
xRefreshable.refresh();
}
@@ -396,10 +396,10 @@ public class TextDocument
try
{
Object uD = Configuration.getConfigurationRoot(xMSF, "/org.openoffice.UserProfile/Data", false);
- XNameAccess xNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, uD);
+ XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, uD);
Object gn = xNA.getByName("givenname");
Object sn = xNA.getByName("sn");
- String fullname = (String) gn + " " + (String) sn;
+ String fullname = gn + PropertyNames.SPACE + sn;
Calendar cal = new GregorianCalendar();
int year = cal.get(Calendar.YEAR);
@@ -413,12 +413,12 @@ public class TextDocument
int ff = du.getFormat(NumberFormatIndex.DATE_SYS_DDMMYY);
String myDate = du.format(ff, currentDate);
- XDocumentPropertiesSupplier xDocPropsSuppl = (XDocumentPropertiesSupplier) UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
+ XDocumentPropertiesSupplier xDocPropsSuppl = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, xTextDocument);
XDocumentProperties xDocProps2 = xDocPropsSuppl.getDocumentProperties();
xDocProps2.setAuthor(fullname);
xDocProps2.setModifiedBy(fullname);
String description = xDocProps2.getDescription();
- description = description + " " + TemplateDescription;
+ description = description + PropertyNames.SPACE + TemplateDescription;
description = JavaTools.replaceSubString(description, WizardName, "<wizard_name>");
description = JavaTools.replaceSubString(description, myDate, "<current_date>");
xDocProps2.setDescription(description);
@@ -449,7 +449,7 @@ public class TextDocument
{
try
{
- XTextContent xTextContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextContent);
+ XTextContent xTextContent = UnoRuntime.queryInterface(XTextContent.class, oTextContent);
xText.removeTextContent(xTextContent);
return true;
}
@@ -469,11 +469,11 @@ public class TextDocument
*/
public static int getPageCount(Object model)
{
- XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, model);
+ XModel xModel = UnoRuntime.queryInterface(XModel.class, model);
XController xController = xModel.getCurrentController();
- XTextViewCursorSupplier xTextVCS = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
+ XTextViewCursorSupplier xTextVCS = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
XTextViewCursor xTextVC = xTextVCS.getViewCursor();
- XPageCursor xPC = (XPageCursor) UnoRuntime.queryInterface(XPageCursor.class, xTextVC);
+ XPageCursor xPC = UnoRuntime.queryInterface(XPageCursor.class, xTextVC);
xPC.jumpToLastPage();
return xPC.getPage();
}
diff --git a/wizards/com/sun/star/wizards/text/TextFieldHandler.java b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
index e25227516058..78de28073f37 100644
--- a/wizards/com/sun/star/wizards/text/TextFieldHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextFieldHandler.java
@@ -65,12 +65,12 @@ public class TextFieldHandler
public TextFieldHandler(XMultiServiceFactory xMSF, XTextDocument xTextDocument)
{
this.xMSFDoc = xMSF;
- xTextFieldsSupplier = (XTextFieldsSupplier) UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument);
+ xTextFieldsSupplier = UnoRuntime.queryInterface(XTextFieldsSupplier.class, xTextDocument);
}
public void refreshTextFields()
{
- XRefreshable xUp = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, xTextFieldsSupplier.getTextFields());
+ XRefreshable xUp = UnoRuntime.queryInterface(XRefreshable.class, xTextFieldsSupplier.getTextFields());
xUp.refresh();
}
@@ -82,21 +82,20 @@ public class TextFieldHandler
Object oTextField = Helper.getUnoPropertyValue(xTextRange, "TextField");
if (com.sun.star.uno.AnyConverter.isVoid(oTextField))
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
else
{
- XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
+ XDependentTextField xDependent = UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
XPropertySet xMaster = xDependent.getTextFieldMaster();
- String UserFieldContent = (String) xMaster.getPropertyValue("Content");
- return UserFieldContent;
+ return (String) xMaster.getPropertyValue("Content");
}
}
catch (com.sun.star.uno.Exception exception)
{
exception.printStackTrace(System.out);
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public void insertUserField(XTextCursor xTextCursor, String FieldName, String FieldTitle)
@@ -104,12 +103,12 @@ public class TextFieldHandler
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);
+ XDependentTextField xDepField = UnoRuntime.queryInterface(XDependentTextField.class, xField);
+ XTextContent xFieldContent = 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 xComponent = UnoRuntime.queryInterface(XComponent.class, oMaster);
xComponent.dispose();
}
XPropertySet xPSet = createUserField(FieldName, FieldTitle);
@@ -138,7 +137,7 @@ public class TextFieldHandler
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);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oMaster);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, FieldName);
xPSet.setPropertyValue("Content", FieldTitle);
@@ -160,7 +159,7 @@ public class TextFieldHandler
while (xEnum.hasMoreElements())
{
Object oTextField = xEnum.nextElement();
- XDependentTextField xDependent = (XDependentTextField) UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
+ XDependentTextField xDependent = UnoRuntime.queryInterface(XDependentTextField.class, oTextField);
XPropertySet xPropertySet = xDependent.getTextFieldMaster();
if (xPropertySet.getPropertySetInfo().hasPropertyByName(_PropertyName))
{
@@ -235,16 +234,16 @@ public class TextFieldHandler
while (xEnum.hasMoreElements())
{
Object oTextField = xEnum.nextElement();
- XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
+ XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
if (xSI.supportsService("com.sun.star.text.TextField.ExtendedUser"))
{
- XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
+ XUpdatable xUp = UnoRuntime.queryInterface(XUpdatable.class, oTextField);
xUp.update();
}
if (xSI.supportsService("com.sun.star.text.TextField.User"))
{
- XUpdatable xUp = (XUpdatable) UnoRuntime.queryInterface(XUpdatable.class, oTextField);
+ XUpdatable xUp = UnoRuntime.queryInterface(XUpdatable.class, oTextField);
xUp.update();
}
}
@@ -270,11 +269,11 @@ public class TextFieldHandler
while (xEnum.hasMoreElements())
{
Object oTextField = xEnum.nextElement();
- XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
+ XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
if (xSI.supportsService("com.sun.star.text.TextField.DateTime"))
{
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oTextField);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oTextField);
xPSet.setPropertyValue("IsFixed", Boolean.FALSE);
xPSet.setPropertyValue("DateTimeValue", dt);
}
@@ -294,11 +293,11 @@ public class TextFieldHandler
while (xEnum.hasMoreElements())
{
Object oTextField = xEnum.nextElement();
- XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oTextField);
+ XServiceInfo xSI = 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));
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oTextField);
+ xPSet.setPropertyValue("IsFixed", Boolean.valueOf(_bSetFixed));
}
}
}
diff --git a/wizards/com/sun/star/wizards/text/TextFrameHandler.java b/wizards/com/sun/star/wizards/text/TextFrameHandler.java
index 562444a1ad84..babaf21120e3 100644
--- a/wizards/com/sun/star/wizards/text/TextFrameHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextFrameHandler.java
@@ -39,12 +39,11 @@ public class TextFrameHandler
public static XTextFrame getFrameByName(String sFrameName, XTextDocument xTD) throws NoSuchElementException, WrappedTargetException
{
- XTextFramesSupplier xFrameSupplier = (XTextFramesSupplier) UnoRuntime.queryInterface(XTextFramesSupplier.class, xTD);
+ XTextFramesSupplier xFrameSupplier = 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 UnoRuntime.queryInterface(XTextFrame.class, oTextFrame);
}
return null;
}
diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.java b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
index 42fd75879c3c..b20d016f8ee8 100644
--- a/wizards/com/sun/star/wizards/text/TextSectionHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.java
@@ -43,6 +43,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
public class TextSectionHandler
{
@@ -58,7 +59,7 @@ public class TextSectionHandler
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
xText = xTextDocument.getText();
- xTextSectionsSupplier = (XTextSectionsSupplier) UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDocument);
+ xTextSectionsSupplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, xTextDocument);
}
public void removeTextSectionbyName(String SectionName)
@@ -66,7 +67,7 @@ public class TextSectionHandler
try
{
XNameAccess xAllTextSections = xTextSectionsSupplier.getTextSections();
- if (xAllTextSections.hasByName(SectionName) == true)
+ if (xAllTextSections.hasByName(SectionName))
{
Object oTextSection = xTextSectionsSupplier.getTextSections().getByName(SectionName);
removeTextSection(oTextSection);
@@ -88,7 +89,7 @@ public class TextSectionHandler
{
try
{
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
Object oTextSection = xAllTextSections.getByIndex(xAllTextSections.getCount() - 1);
removeTextSection(oTextSection);
}
@@ -102,7 +103,7 @@ public class TextSectionHandler
{
try
{
- XTextContent xTextContentTextSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, _oTextSection);
+ XTextContent xTextContentTextSection = UnoRuntime.queryInterface(XTextContent.class, _oTextSection);
xText.removeTextContent(xTextContentTextSection);
}
catch (Exception exception)
@@ -115,12 +116,12 @@ public class TextSectionHandler
{
try
{
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ XIndexAccess xAllTextSections = 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);
+ XTextContent xTextContentTextSection = UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
+ XPropertySet xTextSectionPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
boolean bRemoveTextSection = (!AnyConverter.toBoolean(xTextSectionPropertySet.getPropertyValue("IsVisible")));
if (bRemoveTextSection)
{
@@ -138,12 +139,12 @@ public class TextSectionHandler
{
try
{
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ XIndexAccess xAllTextSections = 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);
+ XTextContent xTextContentTextSection = UnoRuntime.queryInterface(XTextContent.class, xAllTextSections.getByIndex(i));
+ XPropertySet xTextSectionPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xTextContentTextSection);
xText.removeTextContent(xTextContentTextSection);
}
}
@@ -158,10 +159,10 @@ public class TextSectionHandler
try
{
Object oTextSection;
- XIndexAccess xAllTextSections = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
+ XIndexAccess xAllTextSections = UnoRuntime.queryInterface(XIndexAccess.class, xTextSectionsSupplier.getTextSections());
int iSectionCount = xAllTextSections.getCount();
SectionFileLink oSectionLink = new SectionFileLink();
- oSectionLink.FileURL = "";
+ oSectionLink.FileURL = PropertyNames.EMPTY_STRING;
for (int i = 0; i < iSectionCount; i++)
{
oTextSection = xAllTextSections.getByIndex(i);
@@ -170,7 +171,7 @@ public class TextSectionHandler
"FileLink", "LinkRegion"
}, new Object[]
{
- oSectionLink, ""
+ oSectionLink, PropertyNames.EMPTY_STRING
});
}
}
@@ -183,13 +184,13 @@ public class TextSectionHandler
public void breakLinkOfTextSection(Object oTextSection)
{
SectionFileLink oSectionLink = new SectionFileLink();
- oSectionLink.FileURL = "";
+ oSectionLink.FileURL = PropertyNames.EMPTY_STRING;
Helper.setUnoPropertyValues(oTextSection, new String[]
{
"FileLink", "LinkRegion"
}, new Object[]
{
- oSectionLink, ""
+ oSectionLink, PropertyNames.EMPTY_STRING
});
}
@@ -217,7 +218,7 @@ public class TextSectionHandler
{
oSectionLink, SectionName
});
- XNamed xSectionName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextSection);
+ XNamed xSectionName = UnoRuntime.queryInterface(XNamed.class, oTextSection);
String NewSectionName = xSectionName.getName();
if (NewSectionName.compareTo(SectionName) != 0)
{
@@ -251,14 +252,14 @@ public class TextSectionHandler
try
{
Object xTextSection;
- if (xTextSectionsSupplier.getTextSections().hasByName(sectionName) == true)
+ if (xTextSectionsSupplier.getTextSections().hasByName(sectionName))
{
xTextSection = xTextSectionsSupplier.getTextSections().getByName(sectionName);
}
else
{
xTextSection = xMSFDoc.createInstance("com.sun.star.text.TextSection");
- XTextContent xTextContentSection = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextSection);
+ XTextContent xTextContentSection = UnoRuntime.queryInterface(XTextContent.class, xTextSection);
position.getText().insertTextContent(position, xTextContentSection, false);
}
linkSectiontoTemplate(xTextSection, templateName, sectionName);
diff --git a/wizards/com/sun/star/wizards/text/TextStyleHandler.java b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
index e6c952e65785..e9f6cd737e7d 100644
--- a/wizards/com/sun/star/wizards/text/TextStyleHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextStyleHandler.java
@@ -36,6 +36,7 @@ import com.sun.star.text.XTextDocument;
import com.sun.star.uno.AnyConverter;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
+import com.sun.star.wizards.common.PropertyNames;
public class TextStyleHandler
{
@@ -49,21 +50,21 @@ public class TextStyleHandler
{
this.xMSFDoc = xMSF;
this.xTextDocument = xTextDocument;
- xStyleFamiliesSupplier = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
+ xStyleFamiliesSupplier = UnoRuntime.queryInterface(XStyleFamiliesSupplier.class, xTextDocument);
}
public void loadStyleTemplates(String sTemplateUrl, String OptionString)
{
try
{
- XStyleLoader xStyleLoader = (XStyleLoader) UnoRuntime.queryInterface(XStyleLoader.class, xStyleFamiliesSupplier.getStyleFamilies());
+ XStyleLoader xStyleLoader = UnoRuntime.queryInterface(XStyleLoader.class, xStyleFamiliesSupplier.getStyleFamilies());
com.sun.star.beans.PropertyValue[] StyleOptions = xStyleLoader.getStyleLoaderOptions();
- String CurOptionName = "";
+ String CurOptionName = PropertyNames.EMPTY_STRING;
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));
+ StyleOptions[i].Value = Boolean.valueOf((CurOptionName.compareTo(OptionString) == 0) || (CurOptionName.compareTo("OverwriteStyles") == 0));
}
xStyleLoader.loadStylesFromURL(sTemplateUrl, StyleOptions);
}
@@ -79,10 +80,10 @@ public class TextStyleHandler
{
XPropertySet xPropertySet = null;
Object oStyleFamily = xStyleFamiliesSupplier.getStyleFamilies().getByName(sStyleFamily);
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oStyleFamily);
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oStyleFamily);
if (xNameAccess.hasByName(sStyleName))
{
- xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xNameAccess.getByName(sStyleName));
+ xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xNameAccess.getByName(sStyleName));
}
return xPropertySet;
}
@@ -97,7 +98,7 @@ public class TextStyleHandler
{
try
{
- _xPropPageStyle.setPropertyValue("IsLandscape", new Boolean(_bIsLandscape));
+ _xPropPageStyle.setPropertyValue("IsLandscape", Boolean.valueOf(_bIsLandscape));
Size aPageSize = (Size) AnyConverter.toObject(Size.class, _xPropPageStyle.getPropertyValue("Size"));
int nPageWidth = aPageSize.Width;
int nPageHeight = aPageSize.Height;
diff --git a/wizards/com/sun/star/wizards/text/TextTableHandler.java b/wizards/com/sun/star/wizards/text/TextTableHandler.java
index d3646a7cfa37..ab7e46a62c0a 100644
--- a/wizards/com/sun/star/wizards/text/TextTableHandler.java
+++ b/wizards/com/sun/star/wizards/text/TextTableHandler.java
@@ -69,9 +69,9 @@ public class TextTableHandler
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);
+ xTextTablesSupplier = UnoRuntime.queryInterface(XTextTablesSupplier.class, xTextDocument);
+ xSimpleText = UnoRuntime.queryInterface(XSimpleText.class, xTextDocument.getText());
+ XNumberFormatsSupplier xNumberFormatsSupplier = UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
aCharLocale = (Locale) Helper.getUnoStructValue((Object) xTextDocument, "CharLocale");
oNumberFormatter = new NumberFormatter(xNumberFormatsSupplier, aCharLocale);
}
@@ -95,7 +95,7 @@ public class TextTableHandler
if (xAllTextTables.hasByName(_sTableName))
{
Object oTable = xAllTextTables.getByName(_sTableName);
- xTextTable = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oTable);
+ xTextTable = UnoRuntime.queryInterface(XTextTable.class, oTable);
}
}
catch (Exception exception)
@@ -109,11 +109,10 @@ public class TextTableHandler
{
try
{
- XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
+ XIndexAccess xAllTextTables = 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;
+ return UnoRuntime.queryInterface(XTextTable.class, oTable);
}
catch (Exception exception)
{
@@ -127,7 +126,7 @@ public class TextTableHandler
try
{
com.sun.star.uno.XInterface xTextTable = (XInterface) xMSFDoc.createInstance("com.sun.star.text.TextTable");
- XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, xTextTable);
+ XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, xTextTable);
if (xTextCursor == null)
{
xTextCursor = xTextDocument.getText().createTextCursor();
@@ -145,7 +144,7 @@ public class TextTableHandler
{
try
{
- XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
+ XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
int TextTableCount = xAllTextTables.getCount();
for (int i = TextTableCount - 1; i >= 0; i--)
{
@@ -162,7 +161,7 @@ public class TextTableHandler
{
try
{
- XIndexAccess xAllTextTables = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
+ XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, xTextTablesSupplier.getTextTables());
Object oTextTable = xAllTextTables.getByIndex(xAllTextTables.getCount() - 1);
removeTextTable(oTextTable);
}
@@ -176,7 +175,7 @@ public class TextTableHandler
{
try
{
- XTextContent xTextContentTable = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, oTextTable);
+ XTextContent xTextContentTable = UnoRuntime.queryInterface(XTextContent.class, oTextTable);
xTextDocument.getText().removeTextContent(xTextContentTable);
}
catch (Exception exception)
@@ -190,7 +189,7 @@ public class TextTableHandler
try
{
XNameAccess xAllTextTables = xTextTablesSupplier.getTextTables();
- if (xAllTextTables.hasByName(TableName) == true)
+ if (xAllTextTables.hasByName(TableName))
{
removeTextTable(xAllTextTables.getByName(TableName));
}
@@ -209,7 +208,7 @@ public class TextTableHandler
if (xTextTableNames.hasByName(OldTableName))
{
Object oTextTable = xTextTableNames.getByName(OldTableName);
- XNamed xTextTableName = (XNamed) UnoRuntime.queryInterface(XNamed.class, oTextTable);
+ XNamed xTextTableName = UnoRuntime.queryInterface(XNamed.class, oTextTable);
xTextTableName.setName(NewTableName);
}
}
@@ -236,10 +235,10 @@ public class TextTableHandler
{
XFrame xFrame = this.xTextDocument.getCurrentController().getFrame();
int ColCount = xTextTable.getColumns().getCount();
- XCellRange xCellRange = (XCellRange) UnoRuntime.queryInterface(XCellRange.class, xTextTable);
+ 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());
+ XSelectionSupplier xSelection = UnoRuntime.queryInterface(XSelectionSupplier.class, xTextDocument.getCurrentController());
xSelection.select(xLocCellRange);
Desktop.dispatchURL(_xMSF, ".Uno:DistributeColumns", xFrame);
Desktop.dispatchURL(_xMSF, ".Uno:SetOptimalColumnWidth", xFrame);
diff --git a/wizards/com/sun/star/wizards/text/ViewHandler.java b/wizards/com/sun/star/wizards/text/ViewHandler.java
index e29ad10cfbb1..d234f26e2bfe 100644
--- a/wizards/com/sun/star/wizards/text/ViewHandler.java
+++ b/wizards/com/sun/star/wizards/text/ViewHandler.java
@@ -59,26 +59,26 @@ public class ViewHandler
{
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);
+ xTextViewCursorSupplier = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xTextDocument.getCurrentController());
+ xViewSettingsSupplier = UnoRuntime.queryInterface(XViewSettingsSupplier.class, xTextDocument.getCurrentController());
+ 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 xPageCursor = UnoRuntime.queryInterface(XPageCursor.class, xTextViewCursorSupplier.getViewCursor());
+ XTextCursor xViewTextCursor = 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);
+ XNameAccess xName = 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());
+ XIndexAccess xAllTextTables = UnoRuntime.queryInterface(XIndexAccess.class, oTextTableHandler.xTextTablesSupplier.getTextTables());
+ XTextContent xTextTable = UnoRuntime.queryInterface(XTextContent.class, xAllTextTables.getByIndex(0));
+ XTextRange xRange = UnoRuntime.queryInterface(XTextRange.class, xTextTable.getAnchor().getText());
xViewTextCursor.gotoRange(xRange, false);
// if (xPageCursor.getPage() == (short) 1) {
// Helper.setUnoPropertyValue(xTextTable, "PageDescName", "First Page");
diff --git a/wizards/com/sun/star/wizards/ui/AggregateComponent.java b/wizards/com/sun/star/wizards/ui/AggregateComponent.java
index 69583f14c8bd..aeebc069addc 100644
--- a/wizards/com/sun/star/wizards/ui/AggregateComponent.java
+++ b/wizards/com/sun/star/wizards/ui/AggregateComponent.java
@@ -26,6 +26,7 @@
************************************************************************/
package com.sun.star.wizards.ui;
+import java.util.ArrayList;
import java.util.Vector;
import com.sun.star.wizards.common.*;
import com.sun.star.wizards.db.*;
@@ -44,7 +45,6 @@ public class AggregateComponent extends ControlScroller
{
"SUM", "AVG", "MIN", "MAX"
};
- ;
QueryMetaData CurDBMetaData;
XButton optDetailQuery;
XButton optSummaryQuery;
@@ -79,7 +79,6 @@ public class AggregateComponent extends ControlScroller
{
curHelpID = _firstHelpID;
this.CurDBMetaData = _CurDBMetaData;
- ;
Count = 1;
optDetailQuery = CurUnoDialog.insertRadioButton("optDetailQuery", 0, new ActionListenerImpl(),
new String[]
@@ -88,7 +87,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- new Integer(8), HelpIds.getHelpIdString(curHelpID), soptDetailQuery, new Integer(_iPosX), new Integer(iCompPosY - 42), new Short((short) 1), IStep, new Short(curtabindex++), new Integer(iCompWidth)
+ 8, HelpIds.getHelpIdString(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(),
@@ -98,7 +97,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- new Integer(16), HelpIds.getHelpIdString(curHelpID + 1), soptSummaryQuery, Boolean.TRUE, new Integer(_iPosX), new Integer(iCompPosY - 32), IStep, new Short(curtabindex++), new Integer(iCompWidth)
+ 16, HelpIds.getHelpIdString(curHelpID + 1), soptSummaryQuery, Boolean.TRUE, new Integer(_iPosX), new Integer(iCompPosY - 32), IStep, new Short(curtabindex++), new Integer(iCompWidth)
});
CurUnoDialog.insertLabel("lblAggregate",
new String[]
@@ -107,7 +106,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- new Integer(8), slblAggregate, new Integer(iCompPosX + 5), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), new Integer(90)
+ 8, slblAggregate, new Integer(iCompPosX + 5), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90
});
CurUnoDialog.insertLabel("lblFieldnames",
new String[]
@@ -116,7 +115,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- new Integer(8), slblFieldNames, new Integer(iCompPosX + 101), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), new Integer(90)
+ 8, slblFieldNames, new Integer(iCompPosX + 101), new Integer(iCompPosY - 10), IStep, new Short(curtabindex++), 90
});
this.setTotalFieldCount(1);
FontDescriptor oFontDescriptor = new FontDescriptor();
@@ -127,20 +126,20 @@ public class AggregateComponent extends ControlScroller
CurUnoDialog.insertButton("btnplus", SOADDROW, new ActionListenerImpl(),
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- oFontDescriptor, new Integer(14), HelpIds.getHelpIdString(lastHelpIndex + 1), "+", new Integer(_iPosX + iCompWidth - 36), new Integer(iButtonPosY), IStep, new Short((curtabindex++)), new Integer(16)
+ oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 1), "+", new Integer(_iPosX + iCompWidth - 36), new Integer(iButtonPosY), IStep, new Short((curtabindex++)), 16
});
CurUnoDialog.insertButton("btnminus", SOREMOVEROW, new ActionListenerImpl(),
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- oFontDescriptor, new Integer(14), HelpIds.getHelpIdString(lastHelpIndex + 2), "-", new Integer(_iPosX + iCompWidth - 16), new Integer(iButtonPosY), IStep, new Short(curtabindex++), new Integer(16)
+ oFontDescriptor, 14, HelpIds.getHelpIdString(lastHelpIndex + 2), "-", new Integer(_iPosX + iCompWidth - 16), new Integer(iButtonPosY), IStep, new Short(curtabindex++), 16
});
CurDBMetaData.Type = getQueryType();
}
@@ -280,14 +279,14 @@ public class AggregateComponent extends ControlScroller
ControlRow curcontrolrow = null;
boolean biscomplete = true;
CurDBMetaData.Type = getQueryType();
- CurUnoDialog.setControlProperty("btnminus", PropertyNames.PROPERTY_ENABLED, new Boolean((super.getTotalFieldCount() > 0) && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)));
+ CurUnoDialog.setControlProperty("btnminus", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf((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", PropertyNames.PROPERTY_ENABLED, new Boolean(biscomplete && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)));
+ CurUnoDialog.setControlProperty("btnplus", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(biscomplete && (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)));
togglefollowingDialogSteps();
}
@@ -295,8 +294,8 @@ public class AggregateComponent extends ControlScroller
{
CurDBMetaData.Type = getQueryType();
boolean benableComponent = isAggregateComponentEnabled();
- CurUnoDialog.setControlProperty("lblAggregate", PropertyNames.PROPERTY_ENABLED, new Boolean(benableComponent));
- CurUnoDialog.setControlProperty("lblFieldnames", PropertyNames.PROPERTY_ENABLED, new Boolean(benableComponent));
+ CurUnoDialog.setControlProperty("lblAggregate", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableComponent));
+ CurUnoDialog.setControlProperty("lblFieldnames", PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(benableComponent));
toggleButtons();
super.toggleComponent(benableComponent);
super.toggleControls(benableComponent);
@@ -370,11 +369,10 @@ public class AggregateComponent extends ControlScroller
CurDBMetaData.Type = getQueryType();
if (CurDBMetaData.Type == QueryMetaData.QueryType.SOSUMMARYQUERY)
{
- Vector aggregatevector = new Vector();
+ ArrayList<String[]> aggregatevector = new ArrayList<String[]>();
PropertyValue[][] aggregatelist = this.getScrollFieldValues();
PropertyValue[] currowproperties;
PropertyValue curaggregateproperty;
- int a = 0;
if (CurDBMetaData.AggregateFieldNames != null)
{
for (int i = 0; i < aggregatelist.length; i++)
@@ -390,12 +388,11 @@ public class AggregateComponent extends ControlScroller
curaggregatename[0] = CurDBMetaData.NumericFieldNames[iselfield[0]];
curaggregatename[1] = this.sFunctionOperators[iselfunction[0]];
aggregatevector.add(curaggregatename);
- a++;
}
}
}
}
- CurDBMetaData.AggregateFieldNames = new String[a][2];
+ CurDBMetaData.AggregateFieldNames = new String[aggregatevector.size()][2];
aggregatevector.toArray(CurDBMetaData.AggregateFieldNames);
}
@@ -407,7 +404,7 @@ public class AggregateComponent extends ControlScroller
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)));
+ CurUnoDialog.vetoableChange(new java.beans.PropertyChangeEvent(CurUnoDialog, "Steps", 1, 2));
return new String[][]
{
};
@@ -528,11 +525,11 @@ public class AggregateComponent extends ControlScroller
xFunctionListBox = CurUnoDialog.insertListBox(getFunctionControlName(index), 1, null, new ItemListenerImpl(),
new String[]
{
- "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "StringItemList", PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ "Dropdown", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.STRING_ITEM_LIST, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.TRUE, new Integer(12), HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 4), new Integer(ypos), UIConsts.INVISIBLESTEP, sFunctions, new Short(curtabindex++), new Integer(88)
+ Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 4), new Integer(ypos), UIConsts.INVISIBLESTEP, sFunctions, new Short(curtabindex++), 88
});
xFieldListBox = CurUnoDialog.insertListBox(getFieldsControlName(index), 1, null, new ItemListenerImpl(),
@@ -542,7 +539,7 @@ public class AggregateComponent extends ControlScroller
},
new Object[]
{
- Boolean.TRUE, new Integer(12), HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 98), new Integer(ypos), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(86)
+ Boolean.TRUE, 12, HelpIds.getHelpIdString(_curHelpID++), new Integer(iCompPosX + 98), new Integer(ypos), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 86
});
lastHelpIndex = _curHelpID - 1;
}
@@ -570,13 +567,13 @@ public class AggregateComponent extends ControlScroller
private void insertFieldNames()
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xFieldListBox), "StringItemList", CurDBMetaData.NumericFieldNames);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xFieldListBox), PropertyNames.STRING_ITEM_LIST, CurDBMetaData.NumericFieldNames);
}
private boolean isComplete()
{
- boolean bfieldnameisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFieldListBox), "SelectedItems") != null);
- boolean bfunctionisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFunctionListBox), "SelectedItems") != null);
+ boolean bfieldnameisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFieldListBox), PropertyNames.SELECTED_ITEMS) != null);
+ boolean bfunctionisselected = (Helper.getUnoArrayPropertyValue(UnoDialog.getModel(xFunctionListBox), PropertyNames.SELECTED_ITEMS) != null);
return (bfieldnameisselected && bfunctionisselected);
}
diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java
index 41062757f0cf..e85343f42464 100644
--- a/wizards/com/sun/star/wizards/ui/ButtonList.java
+++ b/wizards/com/sun/star/wizards/ui/ButtonList.java
@@ -135,7 +135,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
new Object[]
{
Integer.valueOf(imageTextHeight),
- "",
+ PropertyNames.EMPTY_STRING,
"(1)",
Integer.valueOf(nXPos),
Integer.valueOf(nYPos),
@@ -190,7 +190,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
lblCounter = dialog.insertLabel(m_aControlName + "_lblCounter", pNames1, new Object[]
{
Integer.valueOf(LINE_HEIGHT),
- "",
+ PropertyNames.EMPTY_STRING,
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,
@@ -199,7 +199,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
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(lblCounter), PropertyNames.PROPERTY_ALIGN, new Short((short) 1));
Helper.setUnoPropertyValue(getModel(btnBack), PropertyNames.PROPERTY_LABEL, "<");
Helper.setUnoPropertyValue(getModel(btnNext), PropertyNames.PROPERTY_LABEL, ">");
@@ -219,7 +219,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
for (int c = 0; c < cols; c++)
{
XButton aButton = createButton(dialog, r, c);
- XControl aControl = (XControl)UnoRuntime.queryInterface(XControl.class, aButton);
+ XControl aControl = UnoRuntime.queryInterface(XControl.class, aButton);
m_aButtons[r * cols + c] = aControl;
}
}
@@ -238,7 +238,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
XButton aButton = dialog.insertImageButton(sButtonName, this,
new String[]
{
- /* "Border", */
+ /* PropertyNames.PROPERTY_BORDER, */
/* "BackgroundColor", */
PropertyNames.PROPERTY_HEIGHT,
PropertyNames.PROPERTY_HELPURL,
@@ -269,7 +269,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
m_aButtonWidth
});
- XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, aButton);
+ XWindow win = UnoRuntime.queryInterface(XWindow.class, aButton);
win.setEnable(true);
win.setVisible(true);
return aButton;
@@ -277,14 +277,12 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
private int getButtonPosX(int _col)
{
- final int nXPos = pos.Width + _col * (m_aButtonSize.Width + gap.Width) + gap.Width;
- return nXPos;
+ return pos.Width + _col * (m_aButtonSize.Width + gap.Width) + gap.Width;
}
private int getButtonPosY(int _row)
{
- final int nYPos = pos.Height + _row * (m_aButtonSize.Height + gap.Height) + gap.Height;
- return nYPos;
+ return pos.Height + _row * (m_aButtonSize.Height + gap.Height) + gap.Height;
}
private void refreshImages()
@@ -308,7 +306,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
{
if (oResources.length == 1)
{
- Helper.setUnoPropertyValue(m_aButtons[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, (String) oResources[0]);
+ Helper.setUnoPropertyValue(m_aButtons[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, oResources[0]);
}
else if (oResources.length == 2)
{
@@ -350,7 +348,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
private transient java.util.ArrayList<XItemListener> m_aItemListenerList;
private void setVisible(Object control, boolean visible)
{
- final XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, control);
+ final XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, control);
xWindow.setVisible(visible);
}
@@ -675,7 +673,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
private void refreshImageText()
{
Object item = m_nCurrentSelection >= 0 ? getListModel().getElementAt(m_nCurrentSelection) : null;
- final String sText = " " + renderer.render(item);
+ final String sText = PropertyNames.SPACE + renderer.render(item);
Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, sText);
}
@@ -719,8 +717,8 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
private void enableButtons()
{
- enable(btnNext, new Boolean(pageStart + rows * cols < listModel.getSize()));
- enable(btnBack, new Boolean(pageStart > 0));
+ enable(btnNext, Boolean.valueOf(pageStart + rows * cols < listModel.getSize()));
+ enable(btnBack, Boolean.valueOf(pageStart > 0));
}
private void enable(Object control, Boolean enable)
@@ -730,12 +728,12 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
private Object getModel(Object control)
{
- return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel();
+ return UnoRuntime.queryInterface(XControl.class, control).getModel();
}
private void setBorder(Object control, Short border)
{
- Helper.setUnoPropertyValue(getModel(control), "Border", border);
+ Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_BORDER, border);
//XWindowPeer peer = ((XControl)UnoRuntime.queryInterface(XControl.class,control)).getPeer();
//peer.invalidate(InvalidateStyle.CHILDREN);
}
@@ -770,7 +768,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
// @Override
public String render(Object counter)
{
- return "" + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max;
+ return PropertyNames.EMPTY_STRING + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max;
}
}
@@ -891,9 +889,9 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
}
// check which Button is pressed.
- String sControlName = aHelper.getPropertyValueAsString(PropertyNames.PROPERTY_NAME, "");
+ String sControlName = aHelper.getPropertyValueAsString(PropertyNames.PROPERTY_NAME, PropertyNames.EMPTY_STRING);
final String sButton = sControlName.substring(7 + m_aControlName.length());
- int nButton = new Integer(sButton).intValue();
+ int nButton = Integer.parseInt(sButton);
// int image = getImageFromEvent(event);
int index = getIndexFor(nButton);
diff --git a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
index 5a2457a18d76..14a5f88796ba 100644
--- a/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/CommandFieldSelection.java
@@ -63,7 +63,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
{
- short[] SelItems = (short[]) CurUnoDialog.getControlProperty(sTableListBoxName, "SelectedItems");
+ short[] SelItems = (short[]) CurUnoDialog.getControlProperty(sTableListBoxName, PropertyNames.SELECTED_ITEMS);
if (SelItems.length > 0)
{
iOldSelPos = m_iSelPos;
@@ -142,7 +142,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
},
new Object[]
{
- Boolean.FALSE, new Integer(8), _reslblTables, new Integer(95), new Integer(27), IStep, new Short((short) 3), LabelWidth
+ Boolean.FALSE, 8, _reslblTables, 95, 27, IStep, new Short((short) 3), LabelWidth
});
// DropDown Listbox TableNames
xTableListBox = CurUnoDialog.insertListBox(sTableListBoxName, 0, null, new ItemListenerImpl(),
@@ -152,7 +152,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
},
new Object[]
{
- Boolean.TRUE, Boolean.FALSE, new Integer(12), HelpIds.getHelpIdString(super.FirstHelpIndex - 1), new Short(UnoDialog.getListBoxLineCount()), new Integer(95), new Integer(37), IStep, new Short((short) 4), getListboxWidth()
+ Boolean.TRUE, Boolean.FALSE, 12, HelpIds.getHelpIdString(super.FirstHelpIndex - 1), new Short(UnoDialog.getListBoxLineCount()), 95, 37, IStep, new Short((short) 4), getListboxWidth()
});
// XWindow xTableListBoxWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xTableListBox);
fillupCommandListBox();
@@ -187,7 +187,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
}
else
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
}
@@ -205,7 +205,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
private short getselectedItemPos()
{
- short[] iSelPoses = ((short[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems"));
+ short[] iSelPoses = ((short[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS));
if (iSelPoses.length > 0)
{
return iSelPoses[0];
@@ -214,7 +214,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
{
if (this.bpreselectCommand)
{
- String[] sItemList = ((String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList"));
+ String[] sItemList = ((String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST));
if (sItemList.length > 0)
{
return (short) 0;
@@ -229,10 +229,10 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
try
{
boolean binitialize = false;
- String curCommandName = "";
+ String curCommandName = PropertyNames.EMPTY_STRING;
//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");
+ // String[] sLocList = (String[]) CurUnoDialog.getControlProperty(sTableListBoxName, PropertyNames.STRING_ITEM_LIST);
final String sSelectedTableName = xTableListBox.getItem(iSelPos);
if (!bgetQueries)
{
@@ -245,14 +245,14 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
if (sSelectedTableName.startsWith(sTablePrefix))
{
CurDBMetaData.setCommandType(CommandType.TABLE);
- curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sTablePrefix);
+ curCommandName = JavaTools.replaceSubString(sSelectedTableName, PropertyNames.EMPTY_STRING, sTablePrefix);
CurDBMetaData.setTableByName(curCommandName);
binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.TABLE, AppendMode);
}
else
{
CurDBMetaData.setCommandType(CommandType.QUERY);
- curCommandName = JavaTools.replaceSubString(sSelectedTableName, "", sQueryPrefix);
+ curCommandName = JavaTools.replaceSubString(sSelectedTableName, PropertyNames.EMPTY_STRING, sQueryPrefix);
CurDBMetaData.setQueryByName(curCommandName);
binitialize = CurDBMetaData.getFieldNamesOfCommand(curCommandName, CommandType.QUERY, AppendMode);
}
@@ -304,7 +304,7 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
ContentList = setPrefixinArray(ContentList, sTablePrefix, 0, CurDBMetaData.getTableNames().length);
}
java.util.Arrays.sort(ContentList, this);
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList", ContentList);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST, ContentList);
short iSelPos = getselectedItemPos();
if (bpreselectCommand)
{
@@ -320,9 +320,9 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
else
{
emptyFieldsListBoxes();
- iSelArray = new short[] { (short) iSelPos };
+ iSelArray = new short[] {iSelPos};
}
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", iSelArray);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, iSelArray);
toggleCommandListBox(true);
if (bgetFields)
{
@@ -366,8 +366,8 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
public void toggleCommandListBox(boolean _bdoenable)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable));
- Helper.setUnoPropertyValue(UnoDialog.getModel(xlblTable), PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xlblTable), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable));
}
public String getSelectedCommandName()
@@ -404,10 +404,10 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
{
try
{
- if (Properties.hasPropertyValue(_aPropertyValue, "CommandType"))
+ if (Properties.hasPropertyValue(_aPropertyValue, PropertyNames.COMMAND_TYPE))
{
- int nCommandType = AnyConverter.toInt(Properties.getPropertyValue(_aPropertyValue, "CommandType"));
- String sCommand = AnyConverter.toString(Properties.getPropertyValue(_aPropertyValue, "Command"));
+ int nCommandType = AnyConverter.toInt(Properties.getPropertyValue(_aPropertyValue, PropertyNames.COMMAND_TYPE));
+ String sCommand = AnyConverter.toString(Properties.getPropertyValue(_aPropertyValue, PropertyNames.COMMAND));
if (sCommand != null)
{
preselectCommand(sCommand, nCommandType, _bReadOnly);
@@ -424,12 +424,12 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
{
if (_selitem.length() > 0)
{
- String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList");
+ String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST);
String sPrefix = getCommandPrefix(_nCommandType);
short iselpos = (short) JavaTools.FieldInList(sitems, sPrefix + _selitem);
if (iselpos > -1)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[]
{
iselpos
});
@@ -438,13 +438,13 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
}
else
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[]
{
});
}
if (_bReadOnly)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "ReadOnly", new Boolean(_selitem.length() > 0));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.READ_ONLY, Boolean.valueOf(_selitem.length() > 0));
}
}
@@ -452,22 +452,22 @@ public class CommandFieldSelection extends FieldSelection implements Comparator
{
if (_selitem.length() > 0)
{
- String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), "StringItemList");
+ String[] sitems = (String[]) Helper.getUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.STRING_ITEM_LIST);
short iselpos = (short) JavaTools.FieldInList(sitems, getTablePrefix() + _selitem);
if (iselpos > -1)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] { iselpos });
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[] { iselpos });
}
this.fillUpFieldsListbox();
}
else
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "SelectedItems", new short[] {} );
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.SELECTED_ITEMS, new short[] {} );
this.fillUpFieldsListbox();
}
if (_bReadOnly)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), "ReadOnly", new Boolean(_selitem.length() > 0));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xTableListBox), PropertyNames.READ_ONLY, Boolean.valueOf(_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
index b2a736fcfb0a..59b01fee772b 100644
--- a/wizards/com/sun/star/wizards/ui/ControlScroller.java
+++ b/wizards/com/sun/star/wizards/ui/ControlScroller.java
@@ -26,8 +26,6 @@
************************************************************************/
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;
@@ -118,7 +116,7 @@ public abstract class ControlScroller
oImgControl = CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlImageControlModel", "imgBackground" + sIncSuffix,
new String[]
{
- "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
@@ -130,11 +128,11 @@ public abstract class ControlScroller
new AdjustmentListenerImpl(),
new String[]
{
- "Border", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Short((short) 0), new Boolean(true), new Integer(ScrollHeight), HelpIds.getHelpIdString(curHelpIndex), new Integer(ScrollBarOrientation.VERTICAL), new Integer(iCompPosX + iCompWidth - iScrollBarWidth - 1), new Integer(iCompPosY + 1), IStep, new Integer(iScrollBarWidth)
+ new Short((short) 0), Boolean.TRUE, new Integer(ScrollHeight), HelpIds.getHelpIdString(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;
@@ -158,7 +156,7 @@ public abstract class ControlScroller
protected void setScrollBarOrientationHorizontal()
{
- Helper.setUnoPropertyValue(xScrollBar, "Orientation", new Integer(ScrollBarOrientation.HORIZONTAL));
+ Helper.setUnoPropertyValue(xScrollBar, PropertyNames.ORIENTATION, new Integer(ScrollBarOrientation.HORIZONTAL));
}
/**
@@ -173,7 +171,7 @@ public abstract class ControlScroller
ntotfieldcount = _ntotfieldcount;
setCurFieldCount();
nscrollvalue = 0;
- Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("ScrollValue"), new Integer(nscrollvalue));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "ScrollValue", new Integer(nscrollvalue));
if (ntotfieldcount > nblockincrement)
{
Helper.setUnoPropertyValues(UnoDialog.getModel(xScrollBar), new String[]
@@ -245,7 +243,7 @@ public abstract class ControlScroller
{
if (_nscrollvalue >= 0)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("ScrollValue"), new Integer(_nscrollvalue));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "ScrollValue", new Integer(_nscrollvalue));
scrollControls();
}
}
@@ -301,7 +299,7 @@ public abstract class ControlScroller
protected void toggleComponent(boolean _bdoenable)
{
boolean bdoenable = _bdoenable && (ntotfieldcount > nblockincrement);
- CurUnoDialog.setControlProperty("TitleScrollBar" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(bdoenable));
+ CurUnoDialog.setControlProperty("TitleScrollBar" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bdoenable));
}
protected void toggleControls(boolean _bdoenable)
@@ -312,7 +310,7 @@ public abstract class ControlScroller
for (int m = 0; m < curproperties.length; m++)
{
PropertyValue curproperty = curproperties[m];
- CurUnoDialog.setControlProperty(curproperty.Name, PropertyNames.PROPERTY_ENABLED, new Boolean(_bdoenable));
+ CurUnoDialog.setControlProperty(curproperty.Name, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bdoenable));
}
}
@@ -326,7 +324,7 @@ public abstract class ControlScroller
protected void setLineIncrementation(int _nlineincrement)
{
this.nlineincrement = _nlineincrement;
- Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), new String("LineIncrement"), new Integer(nlineincrement));
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xScrollBar), "LineIncrement", new Integer(nlineincrement));
}
@@ -343,7 +341,7 @@ public abstract class ControlScroller
PropertyNames.PROPERTY_ENABLED, "BlockIncrement", "ScrollValueMax"
}, new Object[]
{
- new Boolean(ntotfieldcount > nblockincrement), new Integer(nblockincrement), new Integer(ntotfieldcount - nblockincrement)
+ Boolean.valueOf(ntotfieldcount > nblockincrement), new Integer(nblockincrement), new Integer(ntotfieldcount - nblockincrement)
});
}
@@ -397,12 +395,10 @@ public abstract class ControlScroller
{
if (guiRow + nscrollvalue < scrollfields.size())
{
- PropertyValue pv = fieldInfo(
+ return 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
{
@@ -453,7 +449,7 @@ public abstract class ControlScroller
{
Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname));
String propertyname = UnoDialog.getDisplayProperty(oControlModel);
- if (propertyname != "")
+ if (!propertyname.equals(PropertyNames.EMPTY_STRING))
{
CurUnoDialog.setControlProperty(controlname, propertyname, newvalue);
}
@@ -463,7 +459,7 @@ public abstract class ControlScroller
{
Object oControlModel = UnoDialog.getModel(CurUnoDialog.xDlgContainer.getControl(controlname));
String propertyname = UnoDialog.getDisplayProperty(oControlModel);
- if (propertyname != "")
+ if (!propertyname.equals(PropertyNames.EMPTY_STRING))
{
return CurUnoDialog.getControlProperty(controlname, propertyname);
}
diff --git a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
index 341ab73828c5..1bf70e77faa6 100644
--- a/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/DBLimitedFieldSelection.java
@@ -30,6 +30,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
/**
* @author Administrator
@@ -90,7 +91,7 @@ public abstract class DBLimitedFieldSelection
protected void moveupSelectedItems(int CurIndex, boolean bDoEnable)
{
// short iNextItemPos;
- if ((bDoEnable == false) && (MAXSELINDEX > CurIndex))
+ if ((!bDoEnable) && (MAXSELINDEX > CurIndex))
{
for (int i = CurIndex; i < MAXSELINDEX; i++)
{
@@ -112,17 +113,14 @@ public abstract class DBLimitedFieldSelection
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];
- }
+ System.arraycopy(_FieldNames, 0, ViewFieldNames, 1, FieldCount);
return ViewFieldNames;
}
protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String[] _SelFieldNames, int curindex)
{
short[] SelList = null;
- Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "StringItemList", _AllFieldNames);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.STRING_ITEM_LIST, _AllFieldNames);
if (_SelFieldNames != null)
{
if (curindex < _SelFieldNames.length)
@@ -136,22 +134,22 @@ public abstract class DBLimitedFieldSelection
{
SelList = new short[] { (short) (0) };
}
- Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.SELECTED_ITEMS, SelList);
return;
}
}
SelList = new short[] { (short) (0) };
- Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.SELECTED_ITEMS, SelList);
}
protected void initializeListBox(XListBox xListBox, String[] _AllFieldNames, String _SelFieldName)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "StringItemList", _AllFieldNames);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.STRING_ITEM_LIST, _AllFieldNames);
short[] SelList = null;
int index = JavaTools.FieldInList(_AllFieldNames, _SelFieldName);
SelList = new short[] { (short) (index) };
- Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), "SelectedItems", SelList);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(xListBox), PropertyNames.SELECTED_ITEMS, SelList);
}
}
diff --git a/wizards/com/sun/star/wizards/ui/DocumentPreview.java b/wizards/com/sun/star/wizards/ui/DocumentPreview.java
index 173fae87f01b..db7a3fd959fc 100644
--- a/wizards/com/sun/star/wizards/ui/DocumentPreview.java
+++ b/wizards/com/sun/star/wizards/ui/DocumentPreview.java
@@ -37,6 +37,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
/**
* @author rpiterman
@@ -75,7 +76,7 @@ public class DocumentPreview
{
//((XWindow)UnoRuntime.queryInterface(XWindow.class,control)).addPaintListener(this);
- xControl = (XControl) UnoRuntime.queryInterface(XControl.class, control);
+ 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);
@@ -98,7 +99,7 @@ public class DocumentPreview
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);
+ XComponentLoader xCompLoader = UnoRuntime.queryInterface(XComponentLoader.class, xFrame);
xFrame.activate();
return xComponent = xCompLoader.loadComponentFromURL(url, "_self", 0, loadArgs);
}
@@ -115,7 +116,7 @@ public class DocumentPreview
{
if (xFrame != null)
{
- ((XCloseable) UnoRuntime.queryInterface(XCloseable.class, xFrame)).close(false);
+ UnoRuntime.queryInterface(XCloseable.class, xFrame).close(false);
}
}
@@ -126,7 +127,7 @@ public class DocumentPreview
case PREVIEW_MODE:
return setDocument(url, new String[]
{
- "Preview", "ReadOnly"
+ "Preview", PropertyNames.READ_ONLY
}, new Object[]
{
Boolean.TRUE, Boolean.TRUE
@@ -148,11 +149,11 @@ public class DocumentPreview
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);
+ XWindow controlWindow = 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);
+ XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, toolkit);
WindowDescriptor aDescriptor = new WindowDescriptor();
aDescriptor.Type = WindowClass.SIMPLE;
@@ -163,9 +164,9 @@ public class DocumentPreview
aDescriptor.WindowAttributes = VclWindowPeerAttribute.CLIPCHILDREN | WindowAttribute.SHOW;
XWindowPeer xPeer = xToolkit.createWindow(aDescriptor);
- xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xPeer);
+ xWindow = UnoRuntime.queryInterface(XWindow.class, xPeer);
Object frame = xmsf.createInstance("com.sun.star.frame.Frame");
- xFrame = (XFrame) UnoRuntime.queryInterface(XFrame.class, frame);
+ xFrame = UnoRuntime.queryInterface(XFrame.class, frame);
// XFrame xF = (XFrame) UnoRuntime.queryInterface(XFrame.class, Desktop.getDesktop(xmsf));
// xFrame = xF.findFrame("_blank", 0);
xFrame.initialize(xWindow);
diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java
index 6ec242243adb..9083b13ec49f 100644
--- a/wizards/com/sun/star/wizards/ui/FieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java
@@ -210,7 +210,7 @@ public class FieldSelection
SelListBoxPosX = new Integer(cmdShiftButtonPosX.intValue() + cmdButtonWidth + cmdButtonHoriDist);
IStep = new Integer(_iStep);
- if (bshowFourButtons == true)
+ if (bshowFourButtons)
{
ShiftButtonCount = 4;
}
@@ -230,7 +230,7 @@ public class FieldSelection
},
new Object[]
{
- new Integer(8), slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), new Integer(109)
+ 8, slblFields, new Integer(CompPosX), new Integer(CompPosY), IStep, new Short(curtabindex), 109
});
// Listbox 'Available fields'
@@ -251,10 +251,10 @@ public class FieldSelection
},
new Object[]
{
- Boolean.FALSE, new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
+ Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 1), ">", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
});
- if (bshowFourButtons == true)
+ if (bshowFourButtons)
{
btnmoveall = CurUnoDialog.insertButton("cmdMoveAll" + sIncSuffix, SOCMDMOVEALL, new ActionListenerImpl(),
new String[]
@@ -263,7 +263,7 @@ public class FieldSelection
},
new Object[]
{
- new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 2), ">>", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
+ 14, HelpIds.getHelpIdString(_FirstHelpIndex + 2), ">>", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
});
}
Object btnremoveselected = CurUnoDialog.insertButton("cmdRemoveSelected" + sIncSuffix, SOCMDREMOVESEL, new ActionListenerImpl(),
@@ -273,10 +273,10 @@ public class FieldSelection
},
new Object[]
{
- Boolean.FALSE, new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
+ Boolean.FALSE, 14, HelpIds.getHelpIdString(_FirstHelpIndex + 3), "<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
});
- if (bshowFourButtons == true)
+ if (bshowFourButtons)
{
btnremoveall = CurUnoDialog.insertButton("cmdRemoveAll" + sIncSuffix, SOCMDREMOVEALL, new ActionListenerImpl(),
new String[]
@@ -285,7 +285,7 @@ public class FieldSelection
},
new Object[]
{
- new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 4), "<<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
+ 14, HelpIds.getHelpIdString(_FirstHelpIndex + 4), "<<", cmdShiftButtonPosX, ShiftButtonPosY[a++], IStep, new Short(curtabindex++), CmdButtonWidth
});
}
@@ -300,7 +300,7 @@ public class FieldSelection
},
new Object[]
{
- new Integer(8), slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth
+ 8, slblSelFields, SelListBoxPosX, new Integer(CompPosY), IStep, new Short(curtabindex++), ListBoxWidth
});
// ListBox 'Fields in the form'
@@ -317,27 +317,27 @@ public class FieldSelection
Object btnmoveup = CurUnoDialog.insertButton("cmdMoveUp" + sIncSuffix, SOCMDMOVEUP, new ActionListenerImpl(),
new String[]
{
- PropertyNames.PROPERTY_ENABLED, "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.FALSE, oFontDesc, new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 6), String.valueOf((char) 8743), cmdMoveButtonPosX, MoveButtonPosY[0], IStep, new Short(curtabindex++), CmdButtonWidth
+ Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_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[]
{
- PropertyNames.PROPERTY_ENABLED, "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_ENABLED, PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.FALSE, oFontDesc, new Integer(14), HelpIds.getHelpIdString(_FirstHelpIndex + 7), String.valueOf((char) 8744), cmdMoveButtonPosX, MoveButtonPosY[1], IStep, new Short(curtabindex++), CmdButtonWidth
+ Boolean.FALSE, oFontDesc, 14, HelpIds.getHelpIdString(_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, "", "~"));
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(xFieldsListBox, JavaTools.replaceSubString(slblFields, PropertyNames.EMPTY_STRING, "~"));
+ CurUnoDialog.getPeerConfiguration().setAccessibleName(xSelectedFieldsListBox, JavaTools.replaceSubString(slblSelFields, PropertyNames.EMPTY_STRING, "~"));
if (btnmoveall != null)
{
CurUnoDialog.getPeerConfiguration().setAccessibleName(btnmoveall, AccessTextMoveAll);
@@ -402,7 +402,7 @@ public class FieldSelection
String NeighborItem = NewItemList[iSelIndex + iNeighbor];
NewItemList[iSelIndex + iNeighbor] = CurItem;
NewItemList[iSelIndex] = NeighborItem;
- CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", NewItemList);
+ CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, NewItemList);
xSelectedFieldsListBox.selectItem(CurItem, true);
if (xFieldSelection != null)
{
@@ -427,7 +427,7 @@ public class FieldSelection
CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable);
CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, BDoEnable);
- if (BDoEnable.booleanValue() == true)
+ if (BDoEnable.booleanValue())
{
toggleListboxButtons((short) - 1, (short) - 1);
}
@@ -466,11 +466,11 @@ public class FieldSelection
bmoveUpenabled = ((iSelIndices[0] > 0) && (iSelIndices.length == 1));
bmoveDownenabled = (((iSelIndices[SelListBoxSelLength - 1]) < (short) (SelectCount - 1)) && (iSelIndices.length == 1));
}
- CurUnoDialog.setControlProperty("cmdRemoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(SelectCount >= 1));
- CurUnoDialog.setControlProperty("cmdRemoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(bSelectSelected));
+ CurUnoDialog.setControlProperty("cmdRemoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(SelectCount >= 1));
+ CurUnoDialog.setControlProperty("cmdRemoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bSelectSelected));
toggleMoveButtons((FieldCount >= 1), bIsFieldSelected);
- CurUnoDialog.setControlProperty("cmdMoveUp" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(bmoveUpenabled));
- CurUnoDialog.setControlProperty("cmdMoveDown" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(bmoveDownenabled));
+ CurUnoDialog.setControlProperty("cmdMoveUp" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bmoveUpenabled));
+ CurUnoDialog.setControlProperty("cmdMoveDown" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bmoveDownenabled));
}
catch (Exception exception)
{
@@ -482,8 +482,8 @@ public class FieldSelection
{
boolean btoggleMoveAll = (((xFieldsListBox.getItemCount() + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveAll));
boolean btoggleMoveSelected = (((xFieldsListBox.getSelectedItems().length + xSelectedFieldsListBox.getItemCount()) < maxfieldcount) && (_btoggleMoveSelected));
- CurUnoDialog.setControlProperty("cmdMoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(btoggleMoveAll));
- CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, new Boolean(btoggleMoveSelected));
+ CurUnoDialog.setControlProperty("cmdMoveAll" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(btoggleMoveAll));
+ CurUnoDialog.setControlProperty("cmdMoveSelected" + sIncSuffix, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(btoggleMoveSelected));
}
public void setMultipleMode(boolean _bisMultiple)
@@ -497,10 +497,10 @@ public class FieldSelection
try
{
toggleListboxControls(Boolean.FALSE);
- CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", new String[]
+ CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, new String[]
{
});
- CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, "StringItemList", new String[]
+ CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, new String[]
{
});
}
@@ -670,14 +670,14 @@ public class FieldSelection
public String[] getSelectedFieldNames()
{
- return (String[]) CurUnoDialog.getControlProperty("lstSelFields" + sIncSuffix, "StringItemList");
+ return (String[]) CurUnoDialog.getControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST);
}
public void setSelectedFieldNames(String[] _sfieldnames)
{
- CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", _sfieldnames);
+ CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, _sfieldnames);
String[] sleftboxfieldnames = JavaTools.removefromList(xFieldsListBox.getItems(), _sfieldnames);
- CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, "StringItemList", sleftboxfieldnames);
+ CurUnoDialog.setControlProperty("lstFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, sleftboxfieldnames);
}
public void setModified(boolean _bModified)
@@ -692,6 +692,6 @@ public class FieldSelection
public void changeSelectedFieldNames(String[] _sfieldnames)
{
- CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, "StringItemList", _sfieldnames);
+ CurUnoDialog.setControlProperty("lstSelFields" + sIncSuffix, PropertyNames.STRING_ITEM_LIST, _sfieldnames);
}
}
diff --git a/wizards/com/sun/star/wizards/ui/FilterComponent.java b/wizards/com/sun/star/wizards/ui/FilterComponent.java
index 8dfc12e21fb3..8c8ee10a1a83 100644
--- a/wizards/com/sun/star/wizards/ui/FilterComponent.java
+++ b/wizards/com/sun/star/wizards/ui/FilterComponent.java
@@ -113,6 +113,7 @@ public class FilterComponent
final int SO_FOURTHBOOLFIELDNAME = 256 + 4;
int SO_BOOLEANLIST[] =
+
{
SO_FIRSTBOOLFIELDNAME, SO_SECONDBOOLFIELDNAME, SO_THIRDBOOLFIELDNAME, SO_FOURTHBOOLFIELDNAME
};
@@ -127,7 +128,7 @@ public class FilterComponent
public void itemStateChanged(com.sun.star.awt.ItemEvent EventObject)
{
int iKey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
- String sControlName = "";
+ String sControlName = PropertyNames.EMPTY_STRING;
switch (iKey)
{
case SO_FIRSTFIELDNAME:
@@ -136,7 +137,7 @@ public class FilterComponent
case SO_FOURTHFIELDNAME:
sControlName = getControlName(EventObject.Source);
String sControlNameSuffix = sIncSuffix + "_" + getIndexNumber(sControlName);
- XListBox xCurFieldListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName));
+ XListBox xCurFieldListBox = UnoRuntime.queryInterface(XListBox.class, CurUnoDialog.xDlgContainer.getControl(sControlName));
String CurDisplayFieldName = xCurFieldListBox.getSelectedItem();
FieldColumn CurFieldColumn = new FieldColumn(oQueryMetaData, CurDisplayFieldName);
@@ -197,8 +198,7 @@ public class FilterComponent
public static String getIndexNumber(String _sStr)
{
- String sLastNumber = _sStr.substring(_sStr.length() - 1, _sStr.length());
- return sLastNumber;
+ return _sStr.substring(_sStr.length() - 1, _sStr.length());
}
/**
@@ -222,16 +222,15 @@ public class FilterComponent
{
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(PropertyNames.PROPERTY_NAME));
- return sName;
+ XControl xControl = UnoRuntime.queryInterface(XControl.class, _oSourceevent);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel());
+ return AnyConverter.toString(xPSet.getPropertyValue(PropertyNames.PROPERTY_NAME));
}
catch (Exception e)
{
e.printStackTrace(System.out);
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public PropertyValue[][] getFilterConditions()
@@ -245,20 +244,19 @@ public class FilterComponent
try
{
final String serviceName = "com.sun.star.beans.PropertyBag";
- final XPropertyContainer column = (XPropertyContainer) UnoRuntime.queryInterface(XPropertyContainer.class, oQueryMetaData.xMSF.createInstance(serviceName));
+ final XPropertyContainer column = UnoRuntime.queryInterface(XPropertyContainer.class, oQueryMetaData.xMSF.createInstance(serviceName));
column.addProperty("Type", PropertyAttribute.BOUND, DataType.VARCHAR);
- column.addProperty(PropertyNames.PROPERTY_NAME, PropertyAttribute.BOUND, "");
+ column.addProperty(PropertyNames.PROPERTY_NAME, PropertyAttribute.BOUND, PropertyNames.EMPTY_STRING);
column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), null);
final XPropertySet columnSet = UnoRuntime.queryInterface(XPropertySet.class, column);
if (composer.getQuery().length() == 0)
{
- final String fromClause = composer.getFromClause();
StringBuilder sql = new StringBuilder();
sql.append(composer.getSelectClause(true));
sql.append(' ');
- sql.append(fromClause);
+ sql.append(composer.getFromClause());
composer.getQueryComposer().setElementaryQuery(sql.toString());
}
composer.getQueryComposer().setStructuredFilter(new PropertyValue[][]
@@ -267,39 +265,36 @@ public class FilterComponent
for (int i = 0; i < RowCount; i++)
{
ControlRow currentControlRow = oControlRows[i];
- if (currentControlRow.isEnabled())
+ if (currentControlRow.isEnabled() && currentControlRow.isConditionComplete())
{
- if (currentControlRow.isConditionComplete())
+ String sFieldName = currentControlRow.getSelectedFieldName();
+ int nOperator = (int) currentControlRow.getSelectedOperator();
+ FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName);
+ columnSet.setPropertyValue(PropertyNames.PROPERTY_NAME, aFieldColumn.getFieldName());
+ columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type"));
+ Object value = currentControlRow.getValue();
+ switch (aFieldColumn.getFieldType())
{
- String sFieldName = currentControlRow.getSelectedFieldName();
- int nOperator = (int) currentControlRow.getSelectedOperator();
- FieldColumn aFieldColumn = oQueryMetaData.getFieldColumnByDisplayName(sFieldName);
- columnSet.setPropertyValue(PropertyNames.PROPERTY_NAME, aFieldColumn.getFieldName());
- columnSet.setPropertyValue("Type", aFieldColumn.getXColumnPropertySet().getPropertyValue("Type"));
- Object value = currentControlRow.getValue();
- switch (aFieldColumn.getFieldType())
- {
- case DataType.TIMESTAMP:
- case DataType.DATE:
- value = ((Double) value) - oQueryMetaData.getNullDateCorrection();
- break;
- }
- column.removeProperty("Value");
- final short operator = currentControlRow.getSelectedOperator();
- if ((operator == SQLFilterOperator.SQLNULL)
- || (operator == SQLFilterOperator.NOT_SQLNULL)
- || AnyConverter.isVoid(value))
- {
- column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), new String());
- value = new Any(new Type(TypeClass.VOID), null);
- }
- else
- {
- column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), value);
- }
- columnSet.setPropertyValue("Value", value);
- composer.getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL, nOperator);
+ case DataType.TIMESTAMP:
+ case DataType.DATE:
+ value = ((Double) value) - oQueryMetaData.getNullDateCorrection();
+ break;
+ }
+ column.removeProperty("Value");
+ final short operator = currentControlRow.getSelectedOperator();
+ if ((operator == SQLFilterOperator.SQLNULL)
+ || (operator == SQLFilterOperator.NOT_SQLNULL)
+ || AnyConverter.isVoid(value))
+ {
+ column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), "");
+ value = new Any(new Type(TypeClass.VOID), null);
+ }
+ else
+ {
+ column.addProperty("Value", (short) (PropertyAttribute.MAYBEVOID | PropertyAttribute.REMOVABLE), value);
}
+ columnSet.setPropertyValue("Value", value);
+ composer.getQueryComposer().appendFilterByColumn(columnSet, getfilterstate() == this.SOI_MATCHALL, nOperator);
}
}
filterconditions = composer.getNormalizedStructuredFilter();
@@ -342,9 +337,9 @@ public class FilterComponent
FieldName = _filtercondition.Name;
}
String sreturn = JavaTools.replaceSubString(_BaseString, FieldName, "<FIELDNAME>");
- String soperator = sLogicOperators[_filtercondition.Handle-1];
+ String soperator = sLogicOperators[_filtercondition.Handle - 1];
sreturn = JavaTools.replaceSubString(sreturn, soperator, "<LOGICOPERATOR>");
- String sDisplayValue = "";
+ String sDisplayValue = PropertyNames.EMPTY_STRING;
if ((_filtercondition.Handle != SQLFilterOperator.SQLNULL)
&& (_filtercondition.Handle != SQLFilterOperator.NOT_SQLNULL)
&& !AnyConverter.isVoid(_filtercondition.Value))
@@ -358,14 +353,14 @@ public class FilterComponent
{
e.printStackTrace(System.out);
}
- return "";
+ return PropertyNames.EMPTY_STRING;
}
private int getfilterstate()
{
boolean bisany = true;
int ifilterstate = SOI_MATCHALL;
- bisany = (this.optMatchAny.getState()) == true;
+ bisany = (this.optMatchAny.getState());
if (bisany)
{
ifilterstate = SOI_MATCHANY;
@@ -566,7 +561,7 @@ public class FilterComponent
m_bEnabled = _bEnabled;
// Label Field
- ControlElements[0] = (XInterface) CurUnoDialog.insertLabel("lblFieldNames" + sCompSuffix,
+ ControlElements[0] = CurUnoDialog.insertLabel("lblFieldNames" + sCompSuffix,
new String[]
{
PropertyNames.PROPERTY_ENABLED,
@@ -591,7 +586,7 @@ public class FilterComponent
});
// Label Operator
- ControlElements[1] = (XInterface) CurUnoDialog.insertLabel("lblOperators" + sCompSuffix,
+ ControlElements[1] = CurUnoDialog.insertLabel("lblOperators" + sCompSuffix,
new String[]
{
PropertyNames.PROPERTY_ENABLED,
@@ -616,7 +611,7 @@ public class FilterComponent
});
// Label Value
- ControlElements[2] = (XInterface) CurUnoDialog.insertLabel("lblValue" + sCompSuffix,
+ ControlElements[2] = CurUnoDialog.insertLabel("lblValue" + sCompSuffix,
new String[]
{
PropertyNames.PROPERTY_ENABLED,
@@ -641,7 +636,7 @@ public class FilterComponent
});
// Listbox Fields
- ControlElements[SOLSTFIELDNAME] = (XInterface) CurUnoDialog.insertListBox("lstFieldName" + sCompSuffix, SO_FIELDNAMELIST[Index], null, new ItemListenerImpl(),
+ ControlElements[SOLSTFIELDNAME] = CurUnoDialog.insertListBox("lstFieldName" + sCompSuffix, SO_FIELDNAMELIST[Index], null, new ItemListenerImpl(),
new String[]
{
PropertyNames.PROPERTY_ENABLED,
@@ -670,7 +665,7 @@ public class FilterComponent
});
// Listbox Operators
- ControlElements[SOLSTOPERATOR] = (XInterface) CurUnoDialog.insertListBox("lstOperator" + sCompSuffix, SO_CONDITIONLIST[Index], null, new ItemListenerImpl(),
+ ControlElements[SOLSTOPERATOR] = CurUnoDialog.insertListBox("lstOperator" + sCompSuffix, SO_CONDITIONLIST[Index], null, new ItemListenerImpl(),
new String[]
{
PropertyNames.PROPERTY_ENABLED,
@@ -681,7 +676,7 @@ public class FilterComponent
PropertyNames.PROPERTY_POSITION_X,
PropertyNames.PROPERTY_POSITION_Y,
PropertyNames.PROPERTY_STEP,
- "StringItemList",
+ PropertyNames.STRING_ITEM_LIST,
PropertyNames.PROPERTY_TABINDEX,
PropertyNames.PROPERTY_WIDTH
},
@@ -699,7 +694,7 @@ public class FilterComponent
Short.valueOf(curtabindex++),
Integer.valueOf(nOperatorWidth)
});
- ControlElements[SOTXTVALUE] = (XInterface) CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SO_TEXTFIELDLIST[Index], new TextListenerImpl(),
+ ControlElements[SOTXTVALUE] = CurUnoDialog.insertFormattedField("txtValue" + sCompSuffix, SO_TEXTFIELDLIST[Index], new TextListenerImpl(),
new String[]
{
PropertyNames.PROPERTY_ENABLED,
@@ -737,11 +732,11 @@ public class FilterComponent
{
try
{
- short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems"));
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), PropertyNames.SELECTED_ITEMS));
if (SelFields.length > 0)
{
int nSelOperator = getSelectedOperator();
- // short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
+ // short[] SelOperator = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), PropertyNames.SELECTED_ITEMS));
if (nSelOperator == com.sun.star.sdb.SQLFilterOperator.SQLNULL
|| /* is null */ nSelOperator == com.sun.star.sdb.SQLFilterOperator.NOT_SQLNULL) /* is not null */
@@ -764,7 +759,7 @@ public class FilterComponent
if (!AnyConverter.isVoid(oValue))
{
String sValue = (String.valueOf(oValue));
- return (!sValue.equals(""));
+ return (!sValue.equals(PropertyNames.EMPTY_STRING));
}
}
}
@@ -781,9 +776,9 @@ public class FilterComponent
{
try
{
- XListBox xFieldsListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTFIELDNAME]);
+ XListBox xFieldsListBox = UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTFIELDNAME]);
xFieldsListBox.selectItem(_filtercondition.Name, true);
- XListBox xOperatorListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTOPERATOR]);
+ XListBox xOperatorListBox = UnoRuntime.queryInterface(XListBox.class, ControlElements[SOLSTOPERATOR]);
xOperatorListBox.selectItemPos((short) (_filtercondition.Handle - 1), true);
if (AnyConverter.isString(_filtercondition.Value))
@@ -791,8 +786,8 @@ public class FilterComponent
String sValue = AnyConverter.toString(_filtercondition.Value);
if (sValue.indexOf("{D '") > -1)
{
- sValue = JavaTools.replaceSubString(sValue, "", "{D '");
- sValue = JavaTools.replaceSubString(sValue, "", "' }");
+ sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "{D '");
+ sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "' }");
try
{
oQueryMetaData.getNumberFormatter().convertStringToNumber(iDateFormat, sValue);
@@ -804,8 +799,8 @@ public class FilterComponent
}
else if (sValue.indexOf("{T '") > -1)
{
- sValue = JavaTools.replaceSubString(sValue, "", "{T '");
- sValue = JavaTools.replaceSubString(sValue, "", "' }");
+ sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "{T '");
+ sValue = JavaTools.replaceSubString(sValue, PropertyNames.EMPTY_STRING, "' }");
try
{
oQueryMetaData.getNumberFormatter().convertStringToNumber(iTimeFormat, sValue);
@@ -839,7 +834,7 @@ public class FilterComponent
protected void setFieldNames(String[] _FieldNames)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "StringItemList", _FieldNames);
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), PropertyNames.STRING_ITEM_LIST, _FieldNames);
FieldNames = _FieldNames;
}
@@ -870,7 +865,7 @@ public class FilterComponent
};
try
{
- iselected = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
+ iselected = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), PropertyNames.SELECTED_ITEMS));
}
catch (Exception e)
{
@@ -878,7 +873,7 @@ public class FilterComponent
}
if ((iselected.length) == 0)
{
- Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
@@ -894,7 +889,7 @@ public class FilterComponent
{
try
{
- short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), "SelectedItems"));
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTFIELDNAME]), PropertyNames.SELECTED_ITEMS));
return FieldNames[SelFields[0]];
}
catch (Exception exception)
@@ -910,7 +905,7 @@ public class FilterComponent
{
try
{
- short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), "SelectedItems"));
+ short[] SelFields = (short[]) AnyConverter.toArray(Helper.getUnoPropertyValue(UnoDialog.getModel(ControlElements[SOLSTOPERATOR]), PropertyNames.SELECTED_ITEMS));
switch (SelFields[0])
{
case 0:
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java
index 9d42aa45599e..02e7668db727 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.java
+++ b/wizards/com/sun/star/wizards/ui/ImageList.java
@@ -97,7 +97,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
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 static final Integer BACKGROUND_COLOR = 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;
@@ -163,7 +163,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
new String[]
{
"BackgroundColor",
- "Border",
+ PropertyNames.PROPERTY_BORDER,
PropertyNames.PROPERTY_HEIGHT,
PropertyNames.PROPERTY_POSITION_X,
PropertyNames.PROPERTY_POSITION_Y,
@@ -202,7 +202,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
grbxSelectedImage = dialog.insertLabel(name + "_grbxSelected", new String[]
{
"BackgroundColor",
- "Border",
+ PropertyNames.PROPERTY_BORDER,
PropertyNames.PROPERTY_HEIGHT,
PropertyNames.PROPERTY_POSITION_X,
PropertyNames.PROPERTY_POSITION_Y,
@@ -215,14 +215,14 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
new Short((short) 1),
new Integer(imageSize.Height + (selectionGap.Height * 2)),
//height
- new Integer(0), //posx
- new Integer(0), //posy
+ 0, //posx
+ 0, //posy
step,
Boolean.TRUE,
new Integer(selectionWidth)
});
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, grbxSelectedImage);
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, grbxSelectedImage);
xWindow.addMouseListener(new OMouseListener());
final String[] pNames1 = new String[]
@@ -240,7 +240,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
lblImageText = dialog.insertLabel(name + "_imageText", pNames1, new Object[]
{
new Integer(imageTextHeight),
- "",
+ PropertyNames.EMPTY_STRING,
new Integer(pos.Width + 1),
new Integer(pos.Height + (imageSize.Height + gap.Height) * rows + gap.Height),
step,
@@ -252,7 +252,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
if (showButtons)
{
- final Integer btnSize = new Integer(14);
+ final Integer btnSize = 14;
btnBack = dialog.insertButton(name + "_btnBack", "prevPage", this, pNames1, new Object[]
{
@@ -281,7 +281,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
lblCounter = dialog.insertLabel(name + "_lblCounter", pNames1, new Object[]
{
new Integer(LINE_HEIGHT),
- "",
+ PropertyNames.EMPTY_STRING,
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,
@@ -290,7 +290,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
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(lblCounter), PropertyNames.PROPERTY_ALIGN, new Short((short) 1));
Helper.setUnoPropertyValue(getModel(btnBack), PropertyNames.PROPERTY_LABEL, "<");
Helper.setUnoPropertyValue(getModel(btnNext), PropertyNames.PROPERTY_LABEL, ">");
@@ -331,7 +331,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
private Integer m_imageHeight, m_imageWidth;
private final static String[] IMAGE_PROPS = new String[]
{
- "Border",
+ PropertyNames.PROPERTY_BORDER,
"BackgroundColor",
PropertyNames.PROPERTY_HEIGHT,
PropertyNames.PROPERTY_HELPURL,
@@ -366,7 +366,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
m_imageWidth
});
- XWindow win = (XWindow) UnoRuntime.queryInterface(XWindow.class, image);
+ XWindow win = UnoRuntime.queryInterface(XWindow.class, image);
win.addMouseListener(uiEventListener);
win.addKeyListener(imageKeyListener);
//uiEventListener.add(imageName,EventNames.EVENT_MOUSE_ENTERED,METHOD_MOUSE_ENTER_IMAGE);
@@ -408,7 +408,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
{
if (oResources.length == 1)
{
- Helper.setUnoPropertyValue(m_aImages[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, (String) oResources[0]);
+ Helper.setUnoPropertyValue(m_aImages[i].getModel(), PropertyNames.PROPERTY_IMAGEURL, oResources[0]);
}
else if (oResources.length == 2)
{
@@ -500,7 +500,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
private void setVisible(Object control, boolean visible)
{
- ((XWindow) UnoRuntime.queryInterface(XWindow.class, control)).setVisible(visible);
+ UnoRuntime.queryInterface(XWindow.class, control).setVisible(visible);
}
/**
@@ -818,7 +818,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
private void refreshImageText()
{
Object item = selected >= 0 ? getListModel().getElementAt(selected) : null;
- Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, " " + renderer.render(item));
+ Helper.setUnoPropertyValue(getModel(lblImageText), PropertyNames.PROPERTY_LABEL, PropertyNames.SPACE + renderer.render(item));
}
/**
@@ -861,8 +861,8 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
private void enableButtons()
{
- enable(btnNext, new Boolean(pageStart + rows * cols < listModel.getSize()));
- enable(btnBack, new Boolean(pageStart > 0));
+ enable(btnNext, Boolean.valueOf(pageStart + rows * cols < listModel.getSize()));
+ enable(btnBack, Boolean.valueOf(pageStart > 0));
}
private void enable(Object control, Boolean enable)
@@ -872,7 +872,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
private Object getModel(Object control)
{
- return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel();
+ return UnoRuntime.queryInterface(XControl.class, control).getModel();
}
/*
@@ -894,7 +894,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
*/
private void setBorder(Object control, Short border)
{
- Helper.setUnoPropertyValue(getModel(control), "Border", border);
+ Helper.setUnoPropertyValue(getModel(control), PropertyNames.PROPERTY_BORDER, border);
//XWindowPeer peer = ((XControl)UnoRuntime.queryInterface(XControl.class,control)).getPeer();
//peer.invalidate(InvalidateStyle.CHILDREN);
}
@@ -945,7 +945,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
public String render(Object counter)
{
- return "" + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max;
+ return PropertyNames.EMPTY_STRING + ((Counter) counter).start + ".." + ((Counter) counter).end + "/" + ((Counter) counter).max;
}
}
@@ -1081,7 +1081,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
{
Helper.setUnoPropertyValue(m_aImages[image].getModel(), "Tabstop",
Boolean.TRUE);
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, m_aImages[image]);
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, m_aImages[image]);
xWindow.setFocus();
}
diff --git a/wizards/com/sun/star/wizards/ui/PathSelection.java b/wizards/com/sun/star/wizards/ui/PathSelection.java
index 6b50127017e1..fbeb54f84f35 100755
--- a/wizards/com/sun/star/wizards/ui/PathSelection.java
+++ b/wizards/com/sun/star/wizards/ui/PathSelection.java
@@ -41,9 +41,9 @@ public class PathSelection
XMultiServiceFactory xMSF;
int iDialogType;
int iTransferMode;
- public String sDefaultDirectory = "";
- public String sDefaultName = "";
- public String sDefaultFilter = "";
+ public String sDefaultDirectory = PropertyNames.EMPTY_STRING;
+ public String sDefaultName = PropertyNames.EMPTY_STRING;
+ public String sDefaultFilter = PropertyNames.EMPTY_STRING;
public boolean usedPathPicker = false;
public XPathSelectionListener xAction;
public XTextComponent xSaveTextBox;
@@ -81,7 +81,7 @@ public class PathSelection
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ Boolean.valueOf(Enabled), 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[]
@@ -89,16 +89,16 @@ public class PathSelection
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ Boolean.valueOf(Enabled), 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", PropertyNames.READ_ONLY, Boolean.TRUE);
CurUnoDialog.setControlProperty("txtSavePath", PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
CurUnoDialog.insertButton("cmdSelectPath", "triggerPathPicker", this, new String[]
{
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
}, 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)
+ Boolean.valueOf(Enabled), 14, BtnHelpURL, "...", new Integer(XPos + Width - 16), new Integer(YPos + 9), new Integer(DialogStep), new Short((short) (CurTabIndex + 2)), 16
});
}
diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.java b/wizards/com/sun/star/wizards/ui/PeerConfig.java
index 19617b593bd6..1fed4a961f7a 100644
--- a/wizards/com/sun/star/wizards/ui/PeerConfig.java
+++ b/wizards/com/sun/star/wizards/ui/PeerConfig.java
@@ -115,7 +115,7 @@ public class PeerConfig implements XWindowListener
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());
+ 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]);
@@ -129,7 +129,7 @@ public class PeerConfig implements XWindowListener
for (int i = 0; i < this.aImageUrlTasks.size(); i++)
{
ImageUrlTask aImageUrlTask = (ImageUrlTask) aImageUrlTasks.elementAt(i);
- String sImageUrl = "";
+ String sImageUrl = PropertyNames.EMPTY_STRING;
if (AnyConverter.isInt(aImageUrlTask.oResource))
{
sImageUrl = oUnoDialog.getWizardImageUrl(((Integer) aImageUrlTask.oResource).intValue(), ((Integer) aImageUrlTask.oHCResource).intValue());
@@ -138,7 +138,7 @@ public class PeerConfig implements XWindowListener
{
sImageUrl = oUnoDialog.getImageUrl(((String) aImageUrlTask.oResource), ((String) aImageUrlTask.oHCResource));
}
- if (!sImageUrl.equals(""))
+ if (!sImageUrl.equals(PropertyNames.EMPTY_STRING))
{
Helper.setUnoPropertyValue(aImageUrlTask.oModel, PropertyNames.PROPERTY_IMAGEURL, sImageUrl);
}
@@ -167,7 +167,7 @@ public class PeerConfig implements XWindowListener
*/
public void setAccessibleName(Object oAPIControl, String _saccessname)
{
- XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oAPIControl);
+ XControl xControl = UnoRuntime.queryInterface(XControl.class, oAPIControl);
setPeerProperties(xControl, new String[]
{
"AccessibleName"
@@ -196,7 +196,7 @@ public class PeerConfig implements XWindowListener
*/
public void setPeerProperties(Object oAPIControl, String[] _propnames, Object[] _propvalues)
{
- XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oAPIControl);
+ XControl xControl = UnoRuntime.queryInterface(XControl.class, oAPIControl);
setPeerProperties(xControl, _propnames, _propvalues);
}
diff --git a/wizards/com/sun/star/wizards/ui/SortingComponent.java b/wizards/com/sun/star/wizards/ui/SortingComponent.java
index 3b57ca3f670a..50ffa59a254c 100644
--- a/wizards/com/sun/star/wizards/ui/SortingComponent.java
+++ b/wizards/com/sun/star/wizards/ui/SortingComponent.java
@@ -61,10 +61,10 @@ public class SortingComponent
public void itemStateChanged(ItemEvent EventObject)
{
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(false));
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.FALSE);
int ikey = CurUnoDialog.getControlKey(EventObject.Source, CurUnoDialog.ControlList);
enableNextSortListBox(ikey);
- Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, new Boolean(true));
+ Helper.setUnoPropertyValue(CurUnoDialog.xDialogModel, PropertyNames.PROPERTY_ENABLED, Boolean.TRUE);
}
public void disposing(com.sun.star.lang.EventObject eventObject)
@@ -97,21 +97,21 @@ public class SortingComponent
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[]
+ CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lblSort" + Integer.toString(i + 1), new String[]
{
- PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- new Boolean(bDoEnable), new Integer(8), sSortHeader[i], new Integer(0), ICompPosX, new Integer(iCurPosY), IStep, new Short(curtabindex++), ICompWidth
+ Boolean.valueOf(bDoEnable), 8, sSortHeader[i], 0, ICompPosX, new Integer(iCurPosY), IStep, new Short(curtabindex++), ICompWidth
});
HIDString = HelpIds.getHelpIdString(FirstHelpIndex);
- xSortListBox[i] = CurUnoDialog.insertListBox("lstSort" + new Integer(i + 1).toString(), SOSORTLST[i], null, new ItemListenerImpl(), new String[]
+ xSortListBox[i] = CurUnoDialog.insertListBox("lstSort" + Integer.toString(i + 1), SOSORTLST[i], null, new ItemListenerImpl(), new String[]
{
"Dropdown", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "LineCount", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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
+ true, bDoEnable, 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 = HelpIds.getHelpIdString(FirstHelpIndex + 1);
@@ -120,7 +120,7 @@ public class SortingComponent
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_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
+ bDoEnable, 10, HIDString, sSortAscend[i], IOptButtonPosX, new Integer(iCurPosY + 10), new Short((short) 1), IStep, new Short(curtabindex++), PropertyNames.ASC, IOptButtonWidth
}); //, new Short((short) (18+i*4))
HIDString = HelpIds.getHelpIdString(FirstHelpIndex + 2);
@@ -129,7 +129,7 @@ public class SortingComponent
PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Tag", PropertyNames.PROPERTY_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
+ bDoEnable, 10, HIDString, sSortDescend[i], IOptButtonPosX, new Integer(iCurPosY + 24), new Short((short) 0), IStep, new Short(curtabindex++), "DESC", IOptButtonWidth
}); //, new Short((short) (19+i*4))
iCurPosY = iCurPosY + 36;
FirstHelpIndex += 3;
@@ -165,10 +165,7 @@ public class SortingComponent
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];
- }
+ System.arraycopy(_FieldNames, 0, ViewFieldNames, 1, FieldCount);
short[] SelList = null;
for (int i = 0; i < 4; i++)
{
@@ -186,8 +183,8 @@ public class SortingComponent
(short) 0
};
}
- CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), "StringItemList", ViewFieldNames);
- CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 1).toString(), "SelectedItems", SelList);
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 1), PropertyNames.STRING_ITEM_LIST, ViewFieldNames);
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 1), PropertyNames.SELECTED_ITEMS, SelList);
toggleSortListBox(i, (i <= _SortFieldNames.length));
}
}
@@ -211,7 +208,7 @@ public class SortingComponent
*/
public void setReadOnly(int _index, boolean _breadonly)
{
- CurUnoDialog.setControlProperty("lstSort" + new Integer(_index + 1).toString(), "ReadOnly", new Boolean(_breadonly));
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(_index + 1), PropertyNames.READ_ONLY, Boolean.valueOf(_breadonly));
}
/**
@@ -261,12 +258,12 @@ public class SortingComponent
ArrayList<String> SortDescriptions = new ArrayList<String>();
for (int i = 0; i <= MaxSortIndex; i++)
{
- if (!((Boolean) CurUnoDialog.getControlProperty("lstSort" + (i + 1), "ReadOnly")))
+ if (!((Boolean) CurUnoDialog.getControlProperty("lstSort" + (i + 1), PropertyNames.READ_ONLY)))
{
CurFieldName = xSortListBox[i].getSelectedItem();
SortDescriptions.add(CurFieldName);
- iCurState = ((Short) CurUnoDialog.getControlProperty("optAscend" + new Integer(i + 1).toString(), PropertyNames.PROPERTY_STATE)).shortValue();
- SortFieldNames.add(new String[]{CurFieldName,iCurState == 1 ? "ASC" :"DESC" });
+ iCurState = ((Short) CurUnoDialog.getControlProperty("optAscend" + Integer.toString(i + 1), PropertyNames.PROPERTY_STATE)).shortValue();
+ SortFieldNames.add(new String[]{CurFieldName,iCurState == 1 ? PropertyNames.ASC :"DESC" });
}
}
// When searching for a duplicate entry we can neglect wether the entries are to be sorted ascending or descending
@@ -276,7 +273,7 @@ public class SortingComponent
{
String sLocSortCriteriaisduplicate = JavaTools.replaceSubString(sSortCriteriaisduplicate, SortFieldNames.get(iduplicate)[0], "<FIELDNAME>");
CurUnoDialog.showMessageBox("WarningBox", VclWindowPeerAttribute.OK, sLocSortCriteriaisduplicate);
- CurUnoDialog.vetoableChange(new PropertyChangeEvent(CurUnoDialog, "Steps", new Integer(1), new Integer(2)));
+ CurUnoDialog.vetoableChange(new PropertyChangeEvent(CurUnoDialog, "Steps", 1, 2));
CurUnoDialog.setFocus("lstSort" + (iduplicate + 1));
return new String[][]
{
@@ -303,7 +300,7 @@ public class SortingComponent
toggleSortListBox(i, (false));
if (i < MaxSortIndex)
{
- CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[]
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 2), PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
@@ -319,22 +316,22 @@ public class SortingComponent
private void moveupSortItems(int CurIndex, boolean bDoEnable)
{
short iNextItemPos;
- if ((bDoEnable == false) && (MAXSORTCRITERIAINDEX > CurIndex))
+ if ((!bDoEnable) && (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[]
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 1), PropertyNames.SELECTED_ITEMS, new short[]
{
iNextItemPos
});
- CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[]
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 2), PropertyNames.SELECTED_ITEMS, new short[]
{
});
toggleSortListBox(i, true);
- CurUnoDialog.setControlProperty("lstSort" + new Integer(i + 2).toString(), "SelectedItems", new short[]
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(i + 2), PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
@@ -357,13 +354,13 @@ public class SortingComponent
{
if (CurIndex < xSortListBox.length)
{
- CurUnoDialog.setControlProperty("lblSort" + new Integer(CurIndex + 1).toString(), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
- CurUnoDialog.setControlProperty("lstSort" + new Integer(CurIndex + 1).toString(), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
- CurUnoDialog.setControlProperty("optAscend" + new Integer(CurIndex + 1).toString(), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
- CurUnoDialog.setControlProperty("optDescend" + new Integer(CurIndex + 1).toString(), PropertyNames.PROPERTY_ENABLED, new Boolean(bDoEnable));
- if (bDoEnable == false)
+ CurUnoDialog.setControlProperty("lblSort" + Integer.toString(CurIndex + 1), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable));
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(CurIndex + 1), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable));
+ CurUnoDialog.setControlProperty("optAscend" + Integer.toString(CurIndex + 1), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable));
+ CurUnoDialog.setControlProperty("optDescend" + Integer.toString(CurIndex + 1), PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bDoEnable));
+ if (!bDoEnable)
{
- CurUnoDialog.setControlProperty("lstSort" + new Integer(CurIndex + 1).toString(), "SelectedItems", new short[]
+ CurUnoDialog.setControlProperty("lstSort" + Integer.toString(CurIndex + 1), PropertyNames.SELECTED_ITEMS, new short[]
{
0
});
diff --git a/wizards/com/sun/star/wizards/ui/TitlesComponent.java b/wizards/com/sun/star/wizards/ui/TitlesComponent.java
index ef9a568d2e01..4858c22a221d 100644
--- a/wizards/com/sun/star/wizards/ui/TitlesComponent.java
+++ b/wizards/com/sun/star/wizards/ui/TitlesComponent.java
@@ -55,14 +55,14 @@ public class TitlesComponent extends ControlScroller
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- new Integer(8), _slblColumnNames, new Integer(iLabelPosX), new Integer(iCompPosY - 10), IStep, new Integer(60)
+ 8, _slblColumnNames, new Integer(iLabelPosX), new Integer(iCompPosY - 10), IStep, 60
});
CurUnoDialog.insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", "lblColumnTitles", new String[]
{
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
}, new Object[]
{
- new Integer(8), _slblColumnTitles, new Integer(90), new Integer(iCompPosY - 10), IStep, new Integer(152)
+ 8, _slblColumnTitles, 90, new Integer(iCompPosY - 10), IStep, 152
});
}
@@ -111,7 +111,7 @@ public class TitlesComponent extends ControlScroller
},
new Object[]
{
- new Integer(16), new Boolean(true), new Integer(iLabelPosX), new Integer(_iCompPosY + 1), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(30)
+ 16, Boolean.TRUE, new Integer(iLabelPosX), new Integer(_iCompPosY + 1), UIConsts.INVISIBLESTEP, new Short(curtabindex++), 30
});
xTextComponent = CurUnoDialog.insertTextField(stextfieldname, 0, null,
@@ -121,7 +121,7 @@ public class TitlesComponent extends ControlScroller
},
new Object[]
{
- new Integer(12), HelpIds.getHelpIdString(curHelpIndex++), new Integer(iLabelPosX + 30), new Integer(_iCompPosY), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(iCompWidth - 90 - 20)
+ 12, HelpIds.getHelpIdString(curHelpIndex++), new Integer(iLabelPosX + 30), new Integer(_iCompPosY), UIConsts.INVISIBLESTEP, new Short(curtabindex++), new Integer(iCompWidth - 90 - 20)
});
}
}
diff --git a/wizards/com/sun/star/wizards/ui/UIConsts.java b/wizards/com/sun/star/wizards/ui/UIConsts.java
index 3115413035b6..9b1c547dbd9e 100644
--- a/wizards/com/sun/star/wizards/ui/UIConsts.java
+++ b/wizards/com/sun/star/wizards/ui/UIConsts.java
@@ -19,7 +19,7 @@ public interface UIConsts
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 Integer INVISIBLESTEP = 99;
public static final String INFOIMAGEURL = "private:resource/dbu/image/19205";
public static final String INFOIMAGEURL_HC = "private:resource/dbu/image/19230";
/**
@@ -27,12 +27,12 @@ public interface UIConsts
* 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);
+ public static final Integer INTEGER_8 = 8;
+ public static final Integer INTEGER_12 = 12;
+ public static final Integer INTEGER_14 = 14;
+ public static final Integer INTEGER_16 = 16;
+ public static final Integer INTEGER_40 = 40;
+ public static final Integer INTEGER_50 = 50;
/**Steps of the QueryWizard
*
*/
@@ -46,7 +46,7 @@ public interface UIConsts
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)
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
};
class CONTROLTYPE
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.java b/wizards/com/sun/star/wizards/ui/UnoDialog.java
index e372a843a56a..7149503dfd6d 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.java
@@ -82,19 +82,19 @@ public class UnoDialog implements EventNames
this.xMSF = xMSF;
ControlList = new Hashtable();
xDialogModel = (XInterface) xMSF.createInstance("com.sun.star.awt.UnoControlDialogModel");
- XMultiPropertySet xMultiPSetDlg = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, xDialogModel);
+ XMultiPropertySet xMultiPSetDlg = UnoRuntime.queryInterface(XMultiPropertySet.class, xDialogModel);
xMultiPSetDlg.setPropertyValues(PropertyNames, PropertyValues);
- MSFDialogModel = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, xDialogModel);
+ MSFDialogModel = 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 = UnoRuntime.queryInterface(XControl.class, xUnoDialog);
+ 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);
+ xPSetDlg = UnoRuntime.queryInterface(XPropertySet.class, xDialogModel);
+ xDlgContainer = UnoRuntime.queryInterface(XControlContainer.class, xUnoDialog);
+ xDlgNames = 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);
+ xComponent = UnoRuntime.queryInterface(XComponent.class, xUnoDialog);
+ xWindow = UnoRuntime.queryInterface(XWindow.class, xUnoDialog);
// setPeerConfiguration(); // LLA: will be done, if really used!
}
@@ -107,9 +107,9 @@ public class UnoDialog implements EventNames
public int getControlKey(Object EventObject, Hashtable ControlList)
{
int iKey;
- XControl xContrl = (XControl) UnoRuntime.queryInterface(XControl.class, EventObject);
+ XControl xContrl = UnoRuntime.queryInterface(XControl.class, EventObject);
XControlModel xControlModel = xContrl.getModel();
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
try
{
String sName = (String) xPSet.getPropertyValue(PropertyNames.PROPERTY_NAME);
@@ -142,7 +142,7 @@ public class UnoDialog implements EventNames
{
if (m_xDlgNameAccess == null)
{
- m_xDlgNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, xDialogModel);
+ m_xDlgNameAccess = UnoRuntime.queryInterface(XNameAccess.class, xDialogModel);
}
return m_xDlgNameAccess;
}
@@ -152,12 +152,12 @@ public class UnoDialog implements EventNames
{
if (PropertyValue != null)
{
- if (getDlgNameAccess().hasByName(ControlName) == false)
+ if (!getDlgNameAccess().hasByName(ControlName))
{
return;
}
Object xControlModel = getDlgNameAccess().getByName(ControlName);
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
if (AnyConverter.isArray(PropertyValue))
{
com.sun.star.uno.Type seqType = new com.sun.star.uno.Type(PropertyValue.getClass());
@@ -187,12 +187,12 @@ public class UnoDialog implements EventNames
{
if (PropertyValues != null)
{
- if (getDlgNameAccess().hasByName(ControlName) == false)
+ if (!getDlgNameAccess().hasByName(ControlName))
{
return;
}
Object xControlModel = getDlgNameAccess().getByName(ControlName);
- XMultiPropertySet xMultiPSet = (XMultiPropertySet) UnoRuntime.queryInterface(XMultiPropertySet.class, xControlModel);
+ XMultiPropertySet xMultiPSet = UnoRuntime.queryInterface(XMultiPropertySet.class, xControlModel);
xMultiPSet.setPropertyValues(PropertyNames, PropertyValues);
}
}
@@ -207,12 +207,8 @@ public class UnoDialog implements EventNames
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;
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
+ return xPSet.getPropertyValue(PropertyName);
}
catch (com.sun.star.uno.Exception exception)
{ // com.sun.star.container.NoSuchElementException, com.sun.star.beans.UnknownPropertyException,
@@ -226,7 +222,7 @@ public class UnoDialog implements EventNames
try
{
Object xControlModel = getDlgNameAccess().getByName(ControlName);
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xControlModel);
Property[] allProps = xPSet.getPropertySetInfo().getProperties();
for (int i = 0; i < allProps.length; i++)
{
@@ -243,20 +239,19 @@ public class UnoDialog implements EventNames
public double getMAPConversionFactor(String ControlName)
{
XControl xControl2 = xDlgContainer.getControl(ControlName);
- XView xView = (XView) UnoRuntime.queryInterface(XView.class, xControl2);
+ XView xView = UnoRuntime.queryInterface(XView.class, xControl2);
Size aSize = xView.getSize();
double dblMAPWidth = (double) (((Integer) Helper.getUnoPropertyValue(xControl2.getModel(), PropertyNames.PROPERTY_WIDTH)).intValue());
- double dblFactor = (((double) (aSize.Width)) / dblMAPWidth);
- return dblFactor;
+ return (((double) (aSize.Width)) / dblMAPWidth);
}
public Size getpreferredLabelSize(String LabelName, String sLabel)
{
XControl xControl2 = xDlgContainer.getControl(LabelName);
- XFixedText xFixedText = (XFixedText) UnoRuntime.queryInterface(XFixedText.class, xControl2);
+ XFixedText xFixedText = UnoRuntime.queryInterface(XFixedText.class, xControl2);
String OldText = xFixedText.getText();
xFixedText.setText(sLabel);
- XLayoutConstrains xLayoutConstrains = (XLayoutConstrains) UnoRuntime.queryInterface(XLayoutConstrains.class, xControl2);
+ XLayoutConstrains xLayoutConstrains = UnoRuntime.queryInterface(XLayoutConstrains.class, xControl2);
Size aSize = xLayoutConstrains.getPreferredSize();
xFixedText.setText(OldText);
return aSize;
@@ -277,19 +272,19 @@ public class UnoDialog implements EventNames
// 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");
+ final String[] fieldnames = (String[]) Helper.getUnoPropertyValue(getModel(_xListBox), PropertyNames.STRING_ITEM_LIST);
return fieldnames.length;
}
public static short getSelectedItemPos(XListBox _xListBox)
{
- short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), "SelectedItems");
+ short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), PropertyNames.SELECTED_ITEMS);
return ipos[0];
}
public static boolean isListBoxSelected(XListBox _xListBox)
{
- short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), "SelectedItems");
+ short ipos[] = (short[]) Helper.getUnoPropertyValue(getModel(_xListBox), PropertyNames.SELECTED_ITEMS);
return ipos.length > 0;
}
@@ -307,10 +302,10 @@ public class UnoDialog implements EventNames
try
{
Object oFixedText = insertControlModel("com.sun.star.awt.UnoControlFixedTextModel", sName, sPropNames, oPropValues);
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oFixedText);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oFixedText);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
- Object oLabel = xDlgContainer.getControl(new String(sName));
- return (XFixedText) UnoRuntime.queryInterface(XFixedText.class, oLabel);
+ Object oLabel = xDlgContainer.getControl(sName);
+ return UnoRuntime.queryInterface(XFixedText.class, oLabel);
}
catch (java.lang.Exception ex)
{
@@ -334,10 +329,10 @@ public class UnoDialog implements EventNames
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);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oButtonModel);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
- Object objectButton = xDlgContainer.getControl(new String(sName));
- XButton xButton = (XButton) UnoRuntime.queryInterface(XButton.class, objectButton);
+ Object objectButton = xDlgContainer.getControl(sName);
+ XButton xButton = UnoRuntime.queryInterface(XButton.class, objectButton);
if (xActionListener != null)
{
xButton.addActionListener(xActionListener);
@@ -353,10 +348,10 @@ public class UnoDialog implements EventNames
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);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oButtonModel);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
- Object objectCheckBox = xDlgContainer.getControl(new String(sName));
- XCheckBox xCheckBox = (XCheckBox) UnoRuntime.queryInterface(XCheckBox.class, objectCheckBox);
+ Object objectCheckBox = xDlgContainer.getControl(sName);
+ XCheckBox xCheckBox = UnoRuntime.queryInterface(XCheckBox.class, objectCheckBox);
if (xItemListener != null)
{
xCheckBox.addItemListener(xItemListener);
@@ -371,10 +366,10 @@ public class UnoDialog implements EventNames
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);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oNumericFieldModel);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
- Object objectNumericField = xDlgContainer.getControl(new String(sName));
- XTextComponent xNumericField = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, objectNumericField);
+ Object objectNumericField = xDlgContainer.getControl(sName);
+ XTextComponent xNumericField = UnoRuntime.queryInterface(XTextComponent.class, objectNumericField);
if (xTextListener != null)
{
xNumericField.addTextListener(xTextListener);
@@ -391,10 +386,10 @@ public class UnoDialog implements EventNames
try
{
Object oScrollModel = insertControlModel("com.sun.star.awt.UnoControlScrollBarModel", sName, sProperties, sValues);
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oScrollModel);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oScrollModel);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
- Object oScrollBar = xDlgContainer.getControl(new String(sName));
- XScrollBar xScrollBar = (XScrollBar) UnoRuntime.queryInterface(XScrollBar.class, oScrollBar);
+ Object oScrollBar = xDlgContainer.getControl(sName);
+ XScrollBar xScrollBar = UnoRuntime.queryInterface(XScrollBar.class, oScrollBar);
if (xAdjustmentListener != null)
{
xScrollBar.addAdjustmentListener(xAdjustmentListener);
@@ -415,14 +410,12 @@ public class UnoDialog implements EventNames
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;
+ return insertEditField("com.sun.star.awt.UnoControlEditModel", sName, iControlKey, xTextListener, sProperties, sValues);
}
public XTextComponent insertFormattedField(String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)
{
- XTextComponent xTextBox = insertEditField("com.sun.star.awt.UnoControlFormattedFieldModel", sName, iControlKey, xTextListener, sProperties, sValues);
- return xTextBox;
+ return insertEditField("com.sun.star.awt.UnoControlFormattedFieldModel", sName, iControlKey, xTextListener, sProperties, sValues);
}
public XTextComponent insertEditField(String ServiceName, String sName, int iControlKey, XTextListener xTextListener, String[] sProperties, Object[] sValues)
@@ -430,10 +423,10 @@ public class UnoDialog implements EventNames
try
{
XInterface xTextModel = insertControlModel(ServiceName, sName, sProperties, sValues);
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTextModel);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xTextModel);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
- XControl xTextField = xDlgContainer.getControl(new String(sName));
- XTextComponent xTextBox = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xTextField);
+ XControl xTextField = xDlgContainer.getControl(sName);
+ XTextComponent xTextBox = UnoRuntime.queryInterface(XTextComponent.class, xTextField);
if (xTextListener != null)
{
xTextBox.addTextListener(xTextListener);
@@ -452,10 +445,10 @@ public class UnoDialog implements EventNames
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);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xListBoxModel);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
- XControl xControlListBox = xDlgContainer.getControl(new String(sName));
- XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, xControlListBox);
+ XControl xControlListBox = xDlgContainer.getControl(sName);
+ XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, xControlListBox);
if (xItemListener != null)
{
xListBox.addItemListener(xItemListener);
@@ -472,17 +465,17 @@ public class UnoDialog implements EventNames
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);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, xComboBoxModel);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
- XControl xControlComboBox = xDlgContainer.getControl(new String(sName));
- XComboBox xComboBox = (XComboBox) UnoRuntime.queryInterface(XComboBox.class, xControlComboBox);
+ XControl xControlComboBox = xDlgContainer.getControl(sName);
+ 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 xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox);
xTextComponent.addTextListener(xTextListener);
}
if (xActionListener != null)
@@ -517,7 +510,7 @@ public class UnoDialog implements EventNames
try
{
XRadioButton xRadioButton = insertRadioButton(sName, iControlKey, sProperties, sValues);
- XButton xButton = (com.sun.star.awt.XButton) UnoRuntime.queryInterface(XButton.class, xRadioButton);
+ XButton xButton = UnoRuntime.queryInterface(XButton.class, xRadioButton);
if (xActionListener != null)
{
xButton.addActionListener(xActionListener);
@@ -544,11 +537,10 @@ public class UnoDialog implements EventNames
try
{
XInterface oRadioButtonModel = insertControlModel("com.sun.star.awt.UnoControlRadioButtonModel", sName, sProperties, sValues);
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRadioButtonModel);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oRadioButtonModel);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, sName);
- XControl xControlRadioButton = xDlgContainer.getControl(new String(sName));
- XRadioButton xRadioButton = (XRadioButton) UnoRuntime.queryInterface(XRadioButton.class, xControlRadioButton);
- return xRadioButton;
+ XControl xControlRadioButton = xDlgContainer.getControl(sName);
+ return UnoRuntime.queryInterface(XRadioButton.class, xControlRadioButton);
}
catch (com.sun.star.uno.Exception exception)
{
@@ -619,7 +611,7 @@ public class UnoDialog implements EventNames
try
{
int ncurstep = AnyConverter.toInt(Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_STEP));
- Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, new Integer(99));
+ Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, 99);
Helper.setUnoPropertyValue(xDialogModel, PropertyNames.PROPERTY_STEP, new Integer(ncurstep));
}
catch (com.sun.star.uno.Exception exception)
@@ -647,7 +639,7 @@ public class UnoDialog implements EventNames
public void setFocus(String ControlName)
{
Object oFocusControl = xDlgContainer.getControl(ControlName);
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oFocusControl);
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, oFocusControl);
xWindow.setFocus();
}
@@ -697,11 +689,11 @@ public class UnoDialog implements EventNames
public static void deselectListBox(XInterface _xBasisListBox)
{
Object oListBoxModel = getModel(_xBasisListBox);
- Object sList = Helper.getUnoPropertyValue(oListBoxModel, "StringItemList");
- Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", new String[]
+ Object sList = Helper.getUnoPropertyValue(oListBoxModel, PropertyNames.STRING_ITEM_LIST);
+ Helper.setUnoPropertyValue(oListBoxModel, PropertyNames.STRING_ITEM_LIST, new String[]
{
});
- Helper.setUnoPropertyValue(oListBoxModel, "StringItemList", sList);
+ Helper.setUnoPropertyValue(oListBoxModel, PropertyNames.STRING_ITEM_LIST, sList);
}
public void calculateDialogPosition(Rectangle FramePosSize)
@@ -735,10 +727,10 @@ public class UnoDialog implements EventNames
{
createWindowPeer();
}
- xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer);
+ 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);
+ this.BisHighContrastModeActivated = Boolean.valueOf(this.isHighContrastModeActivated());
+ xDialog = UnoRuntime.queryInterface(XDialog.class, xUnoDialog);
return xDialog.execute();
}
@@ -749,8 +741,8 @@ public class UnoDialog implements EventNames
{
createWindowPeer();
}
- XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer);
- xDialog = (XDialog) UnoRuntime.queryInterface(XDialog.class, xUnoDialog);
+ XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xWindowPeer);
+ xDialog = UnoRuntime.queryInterface(XDialog.class, xUnoDialog);
this.xWindow.setVisible(true);
}
@@ -774,7 +766,7 @@ public class UnoDialog implements EventNames
*/
public short executeDialog(XInterface xComponent) throws com.sun.star.uno.Exception
{
- XFrame frame = (XFrame) UnoRuntime.queryInterface(XFrame.class, xComponent);
+ XFrame frame = UnoRuntime.queryInterface(XFrame.class, xComponent);
if (frame != null)
{
XWindow w = frame.getComponentWindow();
@@ -801,17 +793,17 @@ public class UnoDialog implements EventNames
public void setAutoMnemonic(String ControlName, boolean bValue)
{
Object oControl = xDlgContainer.getControl(ControlName);
- xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oControl);
+ 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));
+ XVclWindowPeer xVclWindowPeer = UnoRuntime.queryInterface(XVclWindowPeer.class, xControl.getPeer());
+ xVclWindowPeer.setProperty("AutoMnemonics", Boolean.valueOf(bValue));
}
public void modifyFontWeight(String ControlName, float FontWeight)
{
FontDescriptor oFontDesc = new FontDescriptor();
oFontDesc.Weight = FontWeight;
- setControlProperty(ControlName, "FontDescriptor", oFontDesc);
+ setControlProperty(ControlName, PropertyNames.FONT_DESCRIPTOR, oFontDesc);
}
/**
@@ -828,10 +820,10 @@ public class UnoDialog implements EventNames
Object tk = xMSF.createInstance("com.sun.star.awt.Toolkit");
if (parentPeer == null)
{
- parentPeer = ((XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk)).getDesktopWindow();
+ parentPeer = UnoRuntime.queryInterface(XToolkit.class, tk).getDesktopWindow();
}
- XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, tk);
- xReschedule = (XReschedule) UnoRuntime.queryInterface(XReschedule.class, xToolkit);
+ XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, tk);
+ xReschedule = UnoRuntime.queryInterface(XReschedule.class, xToolkit);
// TEUER!
xControl.createPeer(xToolkit, parentPeer);
xWindowPeer = xControl.getPeer();
@@ -855,7 +847,7 @@ public class UnoDialog implements EventNames
public void deletefirstListboxEntry(String ListBoxName, String DelEntryName)
{
XControl xListControl = xDlgContainer.getControl(ListBoxName);
- XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, xListControl);
+ XListBox xListBox = UnoRuntime.queryInterface(XListBox.class, xListControl);
String FirstItem = xListBox.getItem((short) 0);
if (FirstItem.equals(DelEntryName))
{
@@ -863,7 +855,7 @@ public class UnoDialog implements EventNames
xListBox.removeItems((short) 0, (short) 1);
if (SelPos > 0)
{
- setControlProperty(ListBoxName, "SelectedItems", new short[SelPos]);
+ setControlProperty(ListBoxName, PropertyNames.SELECTED_ITEMS, new short[SelPos]);
xListBox.selectItemPos((short) (SelPos - 1), true);
}
}
@@ -872,17 +864,16 @@ public class UnoDialog implements EventNames
public void setPeerProperty(String ControlName, String PropertyName, Object PropertyValue)
{
Object oControl = xDlgContainer.getControl(ControlName);
- XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, oControl);
+ XControl xControl = UnoRuntime.queryInterface(XControl.class, oControl);
XWindowPeer xControlPeer = xControl.getPeer();
- XVclWindowPeer xVclWindowPeer = (XVclWindowPeer) UnoRuntime.queryInterface(XVclWindowPeer.class, xControlPeer);
+ 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;
+ XControl xControl = UnoRuntime.queryInterface(XControl.class, control);
+ return xControl.getModel();
}
public static void setEnabled(Object control, boolean enabled)
@@ -902,7 +893,7 @@ public class UnoDialog implements EventNames
*/
public static int getControlModelType(Object oControlModel)
{
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oControlModel);
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oControlModel);
if (xServiceInfo.supportsService("com.sun.star.awt.UnoControlFixedTextModel"))
{
return UIConsts.CONTROLTYPE.FIXEDTEXT;
@@ -988,7 +979,7 @@ public class UnoDialog implements EventNames
*/
public static String getDisplayProperty(Object oControlModel)
{
- XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, oControlModel);
+ XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, oControlModel);
int itype = getControlModelType(oControlModel);
return getDisplayProperty(itype);
}
@@ -1000,7 +991,7 @@ public class UnoDialog implements EventNames
*/
public static String getDisplayProperty(int itype)
{
- // String propertyname = "";
+ // String propertyname = PropertyNames.EMPTY_STRING;
switch (itype)
{
case UIConsts.CONTROLTYPE.FIXEDTEXT:
@@ -1036,9 +1027,9 @@ public class UnoDialog implements EventNames
case UIConsts.CONTROLTYPE.PATTERNFIELD:
return "Text";
case UIConsts.CONTROLTYPE.LISTBOX:
- return "SelectedItems";
+ return PropertyNames.SELECTED_ITEMS;
default:
- return "";
+ return PropertyNames.EMPTY_STRING;
}
}
@@ -1075,7 +1066,7 @@ public class UnoDialog implements EventNames
int nBlue = getBlueColorShare(nUIColor);
int nLuminance = ((nBlue * 28 + nGreen * 151 + nRed * 77) / 256);
boolean bisactivated = (nLuminance <= 25);
- BisHighContrastModeActivated = new Boolean(bisactivated);
+ BisHighContrastModeActivated = Boolean.valueOf(bisactivated);
return bisactivated;
}
else
@@ -1091,9 +1082,9 @@ public class UnoDialog implements EventNames
public static int getRedColorShare(int _nColor)
{
- int nRed = (int) _nColor / 65536;
+ int nRed = _nColor / 65536;
int nRedModulo = _nColor % 65536;
- int nGreen = (int) (nRedModulo / 256);
+ int nGreen = nRedModulo / 256;
int nGreenModulo = (nRedModulo % 256);
int nBlue = nGreenModulo;
return nRed;
@@ -1101,17 +1092,17 @@ public class UnoDialog implements EventNames
public static int getGreenColorShare(int _nColor)
{
- int nRed = (int) _nColor / 65536;
+ int nRed = _nColor / 65536;
int nRedModulo = _nColor % 65536;
- int nGreen = (int) (nRedModulo / 256);
+ int nGreen = nRedModulo / 256;
return nGreen;
}
public static int getBlueColorShare(int _nColor)
{
- int nRed = (int) _nColor / 65536;
+ int nRed = _nColor / 65536;
int nRedModulo = _nColor % 65536;
- int nGreen = (int) (nRedModulo / 256);
+ int nGreen = nRedModulo / 256;
int nGreenModulo = (nRedModulo % 256);
int nBlue = nGreenModulo;
return nBlue;
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog2.java b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
index 0769e1d23b38..a938b16213f5 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog2.java
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog2.java
@@ -134,7 +134,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames
}
if (textChanged != null)
{
- XTextComponent xTextComponent = (XTextComponent) UnoRuntime.queryInterface(XTextComponent.class, xComboBox);
+ XTextComponent xTextComponent = UnoRuntime.queryInterface(XTextComponent.class, xComboBox);
xTextComponent.addTextListener((XTextListener) guiEventListener);
guiEventListener.add(sName, EVENT_TEXT_CHANGED, textChanged, eventTarget);
}
@@ -186,7 +186,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames
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);
+ return UnoRuntime.queryInterface(XControl.class, oTitledBox);
}
public XTextComponent insertTextField(String sName, String sTextChanged, Object eventTarget, String[] sPropNames, Object[] oPropValues)
@@ -209,11 +209,11 @@ public class UnoDialog2 extends UnoDialog implements EventNames
XControl xImgControl = insertImage(Desktop.getUniqueName(getDlgNameAccess(), "imgHint"),
new String[]
{
- "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_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)
+ new Short((short) 0), 10, UIConsts.INFOIMAGEURL, new Integer(_posx), new Integer(_posy), Boolean.FALSE, new Integer(_iStep), 10
});
super.getPeerConfiguration().setImageUrl(getModel(xImgControl), UIConsts.INFOIMAGEURL, UIConsts.INFOIMAGEURL_HC);
return xImgControl;
@@ -307,25 +307,25 @@ public class UnoDialog2 extends UnoDialog implements EventNames
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);
+ return 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);
+ return 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);
+ return 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);
+ return UnoRuntime.queryInterface(XControl.class, oGroupBox);
}
public Object insertControlModel2(String serviceName, String componentName, String[] sPropNames, Object[] oPropValues)
@@ -347,8 +347,7 @@ public class UnoDialog2 extends UnoDialog implements EventNames
{
ex.printStackTrace();
}
- final Object aObj = xDlgContainer.getControl(componentName);
- return aObj;
+ return xDlgContainer.getControl(componentName);
}
private void setControlPropertiesDebug(Object model, String[] names, Object[] values)
@@ -369,13 +368,12 @@ public class UnoDialog2 extends UnoDialog implements EventNames
public String translateURL(String relativeURL)
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
public static Object getControlModel(Object unoControl)
{
- Object obj = ((XControl) UnoRuntime.queryInterface(XControl.class, unoControl)).getModel();
- return obj;
+ return UnoRuntime.queryInterface(XControl.class, unoControl).getModel();
}
public int showMessageBox(String windowServiceName, int windowAttribute, String MessageText)
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java
index c03ceb2dc257..5273994741c6 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.java
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java
@@ -109,7 +109,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
{
try
{
- XTopWindow top = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class, xWindow);
+ XTopWindow top = UnoRuntime.queryInterface(XTopWindow.class, xWindow);
if (top != null)
{
top.toFront();
@@ -178,12 +178,12 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
public void setRoadmapInteractive(boolean _bInteractive)
{
- Helper.setUnoPropertyValue(oRoadmap, "Activated", new Boolean(_bInteractive));
+ Helper.setUnoPropertyValue(oRoadmap, "Activated", Boolean.valueOf(_bInteractive));
}
public void setRoadmapComplete(boolean bComplete)
{
- Helper.setUnoPropertyValue(oRoadmap, "Complete", new Boolean(bComplete));
+ Helper.setUnoPropertyValue(oRoadmap, "Complete", Boolean.valueOf(bComplete));
}
public boolean isRoadmapComplete()
@@ -247,25 +247,25 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
new Object[]
{
new Integer(iDialogHeight - 26),
- new Integer(0),
- new Integer(0),
- new Integer(0),
+ 0,
+ 0,
+ 0,
new Short((short)0),
Boolean.TRUE,
- new Integer(85)
+ 85
});
- XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap);
+ XPropertySet xPSet = UnoRuntime.queryInterface(XPropertySet.class, oRoadmap);
xPSet.setPropertyValue(PropertyNames.PROPERTY_NAME, "rdmNavi");
- xSSFRoadmap = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmap);
- xIndexContRoadmap = (XIndexContainer) UnoRuntime.queryInterface(XIndexContainer.class, oRoadmap);
+ xSSFRoadmap = UnoRuntime.queryInterface(XSingleServiceFactory.class, oRoadmap);
+ xIndexContRoadmap = 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 = UnoRuntime.queryInterface(XItemEventBroadcaster.class, xRoadmapControl);
xRoadmapBroadcaster.addItemListener((XItemListener) getGuiEventListener());
// xRoadmapControl = this.xDlgContainer.getControl("rdmNavi");
@@ -310,11 +310,10 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
{
Object oRoadmapItem = xSSFRoadmap.createInstance();
Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_LABEL, _sLabel);
- Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, new Boolean(_bEnabled));
+ Helper.setUnoPropertyValue(oRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(_bEnabled));
Helper.setUnoPropertyValue(oRoadmapItem, "ID", new Integer(_CurItemID));
xIndexContRoadmap.insertByIndex(Index, oRoadmapItem);
- int NextIndex = Index + 1;
- return NextIndex;
+ return Index + 1;
}
catch (com.sun.star.uno.Exception exception)
{
@@ -454,7 +453,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
Integer IButtonWidth = new Integer(iButtonWidth);
int iButtonHeight = 14;
Integer IButtonHeight = new Integer(iButtonHeight);
- Integer ICurStep = new Integer(0);
+ Integer ICurStep = 0;
int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_HEIGHT)).intValue();
int iDialogWidth = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_WIDTH)).intValue();
int iHelpPosX = 8;
@@ -467,21 +466,21 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnNaviSep",
new String[]
{
- PropertyNames.PROPERTY_HEIGHT, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Integer(1), new Integer(0), new Integer(0), new Integer(iDialogHeight - 26), ICurStep, new Integer(iDialogWidth)
+ 1, 0, 0, new Integer(iDialogHeight - 26), ICurStep, new Integer(iDialogWidth)
});
insertControlModel("com.sun.star.awt.UnoControlFixedLineModel", "lnRoadSep",
new String[]
{
- PropertyNames.PROPERTY_HEIGHT, "Orientation", PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.ORIENTATION, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Integer(iBtnPosY - 6), new Integer(1), new Integer(85), new Integer(0), ICurStep, new Integer(1)
+ new Integer(iBtnPosY - 6), 1, 85, 0, ICurStep, 1
});
String[] propNames = new String[]
@@ -496,30 +495,30 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
},
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
+ 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, HelpIds.getHelpIdString(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
+ false, IButtonHeight, HelpIds.getHelpIdString(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, HelpIds.getHelpIdString(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
+ true, IButtonHeight, HelpIds.getHelpIdString(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, HelpIds.getHelpIdString(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
+ true, IButtonHeight, HelpIds.getHelpIdString(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, HelpIds.getHelpIdString(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
+ true, IButtonHeight, HelpIds.getHelpIdString(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);
@@ -588,7 +587,7 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
XInterface xRoadmapItem = getRoadmapItemByID(_nStep);
if (xRoadmapItem != null)
{
- Helper.setUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED, new Boolean(bEnabled));
+ Helper.setUnoPropertyValue(xRoadmapItem, PropertyNames.PROPERTY_ENABLED, Boolean.valueOf(bEnabled));
}
}
@@ -747,11 +746,11 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
insertLabel("lblQueryTitle" + String.valueOf(i),
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ oFontDesc, 16, sRightPaneHeaders[i], Boolean.TRUE, 91, 8, new Integer(i + 1), new Short((short) 12), 212
});
}
}
diff --git a/wizards/com/sun/star/wizards/ui/event/AbstractListener.java b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
index bbe9cee2eb86..464282a56f7d 100644
--- a/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
+++ b/wizards/com/sun/star/wizards/ui/event/AbstractListener.java
@@ -128,7 +128,7 @@ public class AbstractListener
*/
public static String getEventSourceName(EventObject eventObject)
{
- XControl xControl = (XControl) UnoRuntime.queryInterface(XControl.class, eventObject.Source);
+ XControl xControl = UnoRuntime.queryInterface(XControl.class, eventObject.Source);
return (String) Helper.getUnoPropertyValue(xControl.getModel(), PropertyNames.PROPERTY_NAME, String.class);
}
}
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.java b/wizards/com/sun/star/wizards/ui/event/DataAware.java
index 62eaaf657447..7da0981104ba 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.java
@@ -320,11 +320,11 @@ public abstract class DataAware {
ex2.printStackTrace();
} catch (NullPointerException npe) {
if (getMethod.getReturnType().equals(String.class))
- return "";
+ return PropertyNames.EMPTY_STRING;
if (getMethod.getReturnType().equals(Short.class))
return new Short((short) 0);
if (getMethod.getReturnType().equals(Integer.class))
- return new Integer(0);
+ return 0;
if (getMethod.getReturnType().equals(short[].class))
return new short[0];
}
@@ -347,7 +347,7 @@ public abstract class DataAware {
*/
public void set(Object value, Object target) {
try {
- setMethod.invoke(target, new Object[] {value});
+ setMethod.invoke(target, value);
} catch (IllegalAccessException ex1) {
ex1.printStackTrace();
} catch (InvocationTargetException ex2) {
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
index 119b2b6e1e51..7d0d4194f892 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
+++ b/wizards/com/sun/star/wizards/ui/event/DataAwareFields.java
@@ -312,11 +312,11 @@ public class DataAwareFields
if (convertTo.equals(Boolean.class))
{
- return (s != null && !s.equals("") && s.equals("true")) ? Boolean.TRUE : Boolean.FALSE;
+ return (s != null && !s.equals(PropertyNames.EMPTY_STRING) && s.equals("true")) ? Boolean.TRUE : Boolean.FALSE;
}
else if (convertTo.equals(Integer.class))
{
- if (s == null || s.equals(""))
+ if (s == null || s.equals(PropertyNames.EMPTY_STRING))
{
return Any.VOID;
}
@@ -327,7 +327,7 @@ public class DataAwareFields
}
else if (convertTo.equals(Double.class))
{
- if (s == null || s.equals(""))
+ if (s == null || s.equals(PropertyNames.EMPTY_STRING))
{
return Any.VOID;
}
@@ -352,7 +352,7 @@ public class DataAwareFields
{
try
{
- field.set(target, value == null || (value.equals(Any.VOID)) ? "" : value.toString());
+ field.set(target, value == null || (value.equals(Any.VOID)) ? PropertyNames.EMPTY_STRING : value.toString());
}
catch (IllegalAccessException ex)
{
@@ -380,7 +380,7 @@ public class DataAwareFields
{
if (field.getType().equals(String.class))
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
if (field.getType().equals(Short.class))
{
@@ -388,7 +388,7 @@ public class DataAwareFields
}
if (field.getType().equals(Integer.class))
{
- return new Integer(0);
+ return 0;
}
if (field.getType().equals(short[].class))
{
@@ -460,7 +460,7 @@ public class DataAwareFields
}
else if (value instanceof String)
{
- return ((String) value).equals(TRUE);
+ return value.equals(TRUE);
}
else if (value instanceof short[])
{
diff --git a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
index b2dc75f22f48..73980b9afdd1 100644
--- a/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
+++ b/wizards/com/sun/star/wizards/ui/event/ListModelBinder.java
@@ -34,6 +34,7 @@ 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;
+import com.sun.star.wizards.common.PropertyNames;
/**
* @author rpiterman
@@ -52,7 +53,7 @@ public class ListModelBinder implements ListDataListener
{
if (item == null)
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
else
{
@@ -63,7 +64,7 @@ public class ListModelBinder implements ListDataListener
public ListModelBinder(Object unoListBox, ListModel listModel_)
{
- unoList = (XListBox) UnoRuntime.queryInterface(XListBox.class, unoListBox);
+ unoList = UnoRuntime.queryInterface(XListBox.class, unoListBox);
unoListModel = UnoDataAware.getModel(unoListBox);
setListModel(listModel_);
}
@@ -99,7 +100,7 @@ public class ListModelBinder implements ListDataListener
protected void remove(short i1, short i2)
{
- unoList.removeItems((short) i1, (short) (i2 - i1 + 1));
+ unoList.removeItems(i1, (short) (i2 - i1 + 1));
}
protected void insert(short i)
@@ -119,12 +120,12 @@ public class ListModelBinder implements ListDataListener
protected short[] getSelectedItems()
{
- return (short[]) Helper.getUnoPropertyValue(unoListModel, "SelectedItems");
+ return (short[]) Helper.getUnoPropertyValue(unoListModel, PropertyNames.SELECTED_ITEMS);
}
protected void setSelectedItems(short[] selected)
{
- Helper.setUnoPropertyValue(unoListModel, "SelectedItems", selected);
+ Helper.setUnoPropertyValue(unoListModel, PropertyNames.SELECTED_ITEMS, selected);
}
/* (non-Javadoc)
@@ -179,8 +180,8 @@ public class ListModelBinder implements ListDataListener
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[]
+ XListBox xlist = UnoRuntime.queryInterface(XListBox.class, list);
+ Helper.setUnoPropertyValue(UnoDataAware.getModel(list), PropertyNames.STRING_ITEM_LIST, new String[]
{
});
for (short i = 0; i < items.length; i++)
@@ -194,8 +195,8 @@ public class ListModelBinder implements ListDataListener
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[]
+ XComboBox xComboBox = UnoRuntime.queryInterface(XComboBox.class, list);
+ Helper.setUnoPropertyValue(UnoDataAware.getModel(list), PropertyNames.STRING_ITEM_LIST, new String[]
{
});
for (short i = 0; i < items.length; i++)
diff --git a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
index 86c50b13ce02..2f86de798bfd 100644
--- a/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
+++ b/wizards/com/sun/star/wizards/ui/event/MethodInvocation.java
@@ -28,7 +28,6 @@ package com.sun.star.wizards.ui.event;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import com.sun.star.wizards.common.PropertyNames;
/**
* Encapsulate a Method invocation.
@@ -87,10 +86,8 @@ public class MethodInvocation
{
if (mWithParam)
{
- return mMethod.invoke(mObject, new Object[]
- {
- (Object) param
- });
+ return mMethod.invoke(mObject, (Object) param
+ );
}
else
{
diff --git a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
index 7dddea572503..ed8bf03642a4 100644
--- a/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/RadioDataAware.java
@@ -47,7 +47,7 @@ public class RadioDataAware extends DataAware
radioButtons = new XRadioButton[radioButs.length];
for (int i = 0; i < radioButs.length; i++)
{
- radioButtons[i] = (XRadioButton) UnoRuntime.queryInterface(XRadioButton.class, radioButs[i]);
+ radioButtons[i] = UnoRuntime.queryInterface(XRadioButton.class, radioButs[i]);
}
}
@@ -89,7 +89,7 @@ public class RadioDataAware extends DataAware
{
final RadioDataAware da = new RadioDataAware(data,
field
- ? DataAwareFields.getFieldValueFor(data, dataProp, new Integer(0))
+ ? DataAwareFields.getFieldValueFor(data, dataProp, 0)
: new DataAware.PropertyValue(dataProp, data), buttons);
XItemListener xil = UnoDataAware.itemListener(da, listener);
for (int i = 0; i < da.radioButtons.length; i++)
diff --git a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
index 8a9c2200d76d..e6c23226d0e7 100644
--- a/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/SimpleDataAware.java
@@ -69,7 +69,7 @@ public class SimpleDataAware extends DataAware
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.equals(PropertyNames.EMPTY_STRING)) return Boolean.FALSE;
else return Boolean.TRUE;
}
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
index b8024fb4f9c9..f97ae8f24577 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.java
@@ -126,7 +126,7 @@ public class UnoDataAware extends DataAware
{
return ((short[]) value).length != 0 ? Boolean.TRUE : Boolean.FALSE;
}
- else if (value.equals(""))
+ else if (value.equals(PropertyNames.EMPTY_STRING))
{
return Boolean.FALSE;
}
@@ -152,7 +152,7 @@ public class UnoDataAware extends DataAware
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);
+ XTextComponent text = UnoRuntime.queryInterface(XTextComponent.class, unoText);
final UnoDataAware uda = new UnoDataAware(data,
field
? DataAwareFields.getFieldValueFor(data, prop, value)
@@ -179,17 +179,17 @@ public class UnoDataAware extends DataAware
public static UnoDataAware attachEditControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
{
- return attachTextControl(data, prop, unoControl, listener, "Text", field, "");
+ return attachTextControl(data, prop, unoControl, listener, "Text", field, PropertyNames.EMPTY_STRING);
}
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));
+ return attachTextControl(data, prop, unoControl, listener, "Date", field, 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));
+ return attachTextControl(data, prop, unoControl, listener, "Time", field, 0);
}
public static UnoDataAware attachNumericControl(Object data, String prop, Object unoControl, Listener listener, boolean field)
@@ -199,7 +199,7 @@ public class UnoDataAware extends DataAware
public static UnoDataAware attachCheckBox(Object data, String prop, Object checkBox, final Listener listener, boolean field)
{
- XCheckBox xcheckBox = ((XCheckBox) UnoRuntime.queryInterface(XCheckBox.class, checkBox));
+ XCheckBox xcheckBox = UnoRuntime.queryInterface(XCheckBox.class, checkBox);
final UnoDataAware uda = new UnoDataAware(data,
field
? DataAwareFields.getFieldValueFor(data, prop, new Short((short) 0))
@@ -232,26 +232,26 @@ public class UnoDataAware extends DataAware
public static UnoDataAware attachLabel(Object data, String prop, Object label, final Listener listener, boolean field)
{
return new UnoDataAware(data,
- field ? DataAwareFields.getFieldValueFor(data, prop, "")
+ field ? DataAwareFields.getFieldValueFor(data, prop, PropertyNames.EMPTY_STRING)
: new DataAware.PropertyValue(prop, data),
label, PropertyNames.PROPERTY_LABEL);
}
public static UnoDataAware attachListBox(Object data, String prop, Object listBox, final Listener listener, boolean field)
{
- XListBox xListBox = (XListBox) UnoRuntime.queryInterface(XListBox.class, listBox);
+ 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");
+ listBox, PropertyNames.SELECTED_ITEMS);
xListBox.addItemListener(itemListener(uda, listener));
return uda;
}
public static Object getModel(Object control)
{
- return ((XControl) UnoRuntime.queryInterface(XControl.class, control)).getModel();
+ return UnoRuntime.queryInterface(XControl.class, control).getModel();
}
public static void setEnabled(Object control, boolean enabled)
diff --git a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java
index 70c40fbc6072..f31294a190b5 100644
--- a/wizards/com/sun/star/wizards/web/BackgroundsDialog.java
+++ b/wizards/com/sun/star/wizards/web/BackgroundsDialog.java
@@ -33,6 +33,7 @@ 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.PropertyNames;
import com.sun.star.wizards.common.SystemDialog;
import com.sun.star.wizards.ui.ImageList;
import com.sun.star.wizards.web.data.CGImage;
@@ -127,7 +128,7 @@ public class BackgroundsDialog extends ImageListDialog
{
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);
+ Object o = Configuration.addConfigNode(configView, PropertyNames.EMPTY_STRING + i);
Configuration.set(s, "Href", o);
Configuration.commit(configView);
}
@@ -172,7 +173,7 @@ public class BackgroundsDialog extends ImageListDialog
public String render(Object object)
{
- return object == null ? "" : FileAccess.getPathFilename(fileAccess.getPath((String) object, null));
+ return object == null ? PropertyNames.EMPTY_STRING : FileAccess.getPathFilename(fileAccess.getPath((String) object, null));
}
}
diff --git a/wizards/com/sun/star/wizards/web/CallWizard.java b/wizards/com/sun/star/wizards/web/CallWizard.java
index 4fab3ea43bf9..6cabc6f145d1 100644
--- a/wizards/com/sun/star/wizards/web/CallWizard.java
+++ b/wizards/com/sun/star/wizards/web/CallWizard.java
@@ -38,6 +38,7 @@ 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.PropertyNames;
import com.sun.star.wizards.common.Resource;
/**
@@ -107,7 +108,7 @@ public class CallWizard
*/
public void trigger(String str)
{
- if (str.equalsIgnoreCase("start"))
+ if (str.equalsIgnoreCase(PropertyNames.START))
{
if (webWizard == null)
{
@@ -226,7 +227,7 @@ public class CallWizard
try
{
- byteReturn = ("" + this.hashCode()).getBytes();
+ byteReturn = (PropertyNames.EMPTY_STRING + this.hashCode()).getBytes();
}
catch (Exception exception)
{
@@ -284,7 +285,7 @@ public class CallWizard
{
XMultiServiceFactory xmsf = Desktop.connect(ConnectStr);
CallWizard.WizardImplementation ww = new CallWizard.WizardImplementation(xmsf);
- ww.trigger("start");
+ ww.trigger(PropertyNames.START);
}
catch (Exception exception)
diff --git a/wizards/com/sun/star/wizards/web/FTPDialog.java b/wizards/com/sun/star/wizards/web/FTPDialog.java
index f958d9016833..f707690394ea 100644
--- a/wizards/com/sun/star/wizards/web/FTPDialog.java
+++ b/wizards/com/sun/star/wizards/web/FTPDialog.java
@@ -153,16 +153,16 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
//Resources Object
private FTPDialogResources resources;
private List dataAware = new Vector();
- public String username = "";
- public String password = "";
+ public String username = PropertyNames.EMPTY_STRING;
+ public String password = PropertyNames.EMPTY_STRING;
/**
* The ftp host name
*/
- public String host = "";
+ public String host = PropertyNames.EMPTY_STRING;
/**
* The ftp directory.
*/
- private String dir = "";
+ private String dir = PropertyNames.EMPTY_STRING;
/**
* the ftp publish object which contains the
* data for this dialog.
@@ -198,11 +198,11 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
- "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.TRUE, new Integer(160), HelpIds.getHelpIdString(HID_FTP), Boolean.TRUE, "FTPDialog", new Integer(167), new Integer(82), resources.resFTPDialog_title, new Integer(222)
+ Boolean.TRUE, 160, HelpIds.getHelpIdString(HID_FTP), Boolean.TRUE, "FTPDialog", 167, 82, resources.resFTPDialog_title, 222
});
//add controls to dialog
@@ -235,13 +235,13 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
PROPNAMES_LABEL,
new Object[]
{
- INTEGERS[8], resources.resln1_value, "ln1", INTEGERS[6], INTEGERS[6], new Short((short) 0), new Integer(210)
+ INTEGERS[8], resources.resln1_value, "ln1", INTEGERS[6], INTEGERS[6], new Short((short) 0), 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)
+ INTEGERS[8], resources.reslblFTPAddress_value, "lblFTPAddress", INTEGER_12, 20, new Short((short) 1), 95
});
txtHost = insertTextField("txtHost", "disconnect",
new String[]
@@ -250,13 +250,13 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID_FTP_SERVER), "txtIP", new Integer(110), new Integer(18), new Short((short) 2), new Integer(106)
+ INTEGER_12, HelpIds.getHelpIdString(HID_FTP_SERVER), "txtIP", 110, 18, new Short((short) 2), 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)
+ INTEGERS[8], resources.reslblUsername_value, "lblUsername", INTEGER_12, 36, new Short((short) 3), 85
});
txtUsername = insertTextField("txtUsername", "disconnect",
new String[]
@@ -265,13 +265,13 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
},
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID_FTP_USERNAME), "txtUsername", new Integer(110), new Integer(34), new Short((short) 4), new Integer(106)
+ INTEGER_12, HelpIds.getHelpIdString(HID_FTP_USERNAME), "txtUsername", 110, 34, new Short((short) 4), 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)
+ INTEGERS[8], resources.reslblPassword_value, "lblPassword", INTEGER_12, 52, new Short((short) 5), 85
});
txtPassword = insertTextField("txtPassword", "disconnect",
new String[]
@@ -280,43 +280,43 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
},
new Object[]
{
- new Short((short) 42), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_PASS), "txtPassword", new Integer(110), new Integer(50), new Short((short) 6), new Integer(106)
+ new Short((short) 42), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_PASS), "txtPassword", 110, 50, new Short((short) 6), 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)
+ INTEGERS[8], resources.resln2_value, "ln2", INTEGERS[6], 68, new Short((short) 7), 210
});
btnTestConnection = insertButton("btnConnect", "connect",
PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID_FTP_TEST), resources.resbtnConnect_value, "btnConnect", INTEGER_12, new Integer(80), new Short((short) 8), INTEGER_50
+ INTEGER_14, HelpIds.getHelpIdString(HID_FTP_TEST), resources.resbtnConnect_value, "btnConnect", INTEGER_12, 80, new Short((short) 8), INTEGER_50
});
imgStatus = insertImage("imgStatus",
new String[]
{
- "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", "Tabstop", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", "Tabstop", PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Short((short) 0), INTEGER_14, new Integer(68), new Integer(80), Boolean.FALSE, Boolean.FALSE, INTEGER_14
+ new Short((short) 0), INTEGER_14, 68, 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)
+ INTEGERS[8], resources.resFTPDisconnected, "lblStatus", 86, 82, new Short((short) 9), 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)
+ INTEGERS[8], resources.resln3_value, "ln3", INTEGERS[6], 100, new Short((short) 10), 210
});
txtDir = insertTextField("txtDir",
@@ -326,34 +326,34 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
},
new Object[]
{
- new Boolean(false), INTEGER_12, HelpIds.getHelpIdString(HID_FTP_TXT_PATH), "txtDir", INTEGER_12, new Integer(113), new Short((short) 11), resources.restxtDir_value, new Integer(184)
+ Boolean.FALSE, INTEGER_12, HelpIds.getHelpIdString(HID_FTP_TXT_PATH), "txtDir", INTEGER_12, 113, new Short((short) 11), resources.restxtDir_value, 184
});
btnDir = insertButton("btnDir", "chooseDirectory",
PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID_FTP_BTN_PATH), resources.resbtnDir_value, "btnDir", new Integer(199), new Integer(112), new Short((short) 12), INTEGER_16
+ INTEGER_14, HelpIds.getHelpIdString(HID_FTP_BTN_PATH), resources.resbtnDir_value, "btnDir", 199, 112, new Short((short) 12), INTEGER_16
});
btnOK = insertButton("btnOK", null,
PROPNAMES_BUTTON2,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(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
+ INTEGER_14, HelpIds.getHelpIdString(HID_FTP_OK), resources.resbtnOK_value, "btnOK", 165, 142, new Short((short) PushButtonType.OK_value), new Short((short) 13), INTEGER_50
});
btnCancel = insertButton("btnCancel",
null, PROPNAMES_BUTTON2,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(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
+ INTEGER_14, HelpIds.getHelpIdString(HID_FTP_CANCEL), resources.resbtnCancel_value, "btnCancel", 113, 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
+ INTEGER_14, PropertyNames.EMPTY_STRING, resources.resbtnHelp_value, "btnHelp", 57, 142, new Short((short) PushButtonType.HELP_value), new Short((short) 15), INTEGER_50
});
}
@@ -379,8 +379,8 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
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;
+ username = publish.cp_Username == null ? PropertyNames.EMPTY_STRING : publish.cp_Username;
+ password = publish.password == null ? PropertyNames.EMPTY_STRING : publish.password;
dir = extractDir(publish.cp_URL);
setLabel(STATUS_UNKONWN);
@@ -419,7 +419,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
{
if (ftpUrl == null || ftpUrl.length() < 6)
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
String url = ftpUrl.substring(6);
int i = url.indexOf("/");
@@ -469,11 +469,11 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
/**
* @param s
- * @return true if the string is null or "".
+ * @return true if the string is null or PropertyNames.EMPTY_STRING.
*/
private final boolean isEmpty(String s)
{
- return (s == null) || (s.equals(""));
+ return (s == null) || (s.equals(PropertyNames.EMPTY_STRING));
}
/**
@@ -573,7 +573,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
* 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.
+ * I get the PropertyNames.PROPERTY_TITLE property of this content.
* @param acountUrl
* @throws Exception
*/
@@ -592,7 +592,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
ucb.executeCommand(content, "open", aArg);
//get the title property of the content.
- Object obj = ucb.getContentProperty(content, "Title", String.class);
+ Object obj = ucb.getContentProperty(content, PropertyNames.PROPERTY_TITLE, String.class);
}
@@ -708,10 +708,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
private String imageUrl(String s)
{
- String t = imagesDirectory + s;
- //System.out.println(t);
- return t;
-
+ return imagesDirectory + s;
}
/**
@@ -724,7 +721,7 @@ public class FTPDialog extends UnoDialog2 implements UIConsts, WWHID
public void chooseDirectory()
{
SystemDialog sd = SystemDialog.createOfficeFolderDialog(xMSF);
- String newUrl = sd.callFolderDialog(resources.resFTPDirectory, "", getFullUrl());
+ String newUrl = sd.callFolderDialog(resources.resFTPDirectory, PropertyNames.EMPTY_STRING, getFullUrl());
if (newUrl != null)
{
/* if the user chose a local directory,
diff --git a/wizards/com/sun/star/wizards/web/IconsDialog.java b/wizards/com/sun/star/wizards/web/IconsDialog.java
index 6228180a75f4..83be292e79b8 100644
--- a/wizards/com/sun/star/wizards/web/IconsDialog.java
+++ b/wizards/com/sun/star/wizards/web/IconsDialog.java
@@ -32,6 +32,7 @@ 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.common.PropertyNames;
import com.sun.star.wizards.ui.ImageList;
import com.sun.star.wizards.web.data.CGIconSet;
@@ -79,7 +80,7 @@ public class IconsDialog extends ImageListDialog implements ImageList.IImageRend
resources.resCounter
});
- htmlexpDirectory = FileAccess.getOfficePath(xmsf, "Gallery", "share", "");
+ htmlexpDirectory = FileAccess.getOfficePath(xmsf, "Gallery", "share", PropertyNames.EMPTY_STRING);
set = set_;
objects = new Integer[set.getSize() * icons.length];
for (int i = 0; i < objects.length; i++)
@@ -174,7 +175,7 @@ public class IconsDialog extends ImageListDialog implements ImageList.IImageRend
{
if (object == null)
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
int i = ((Number) object).intValue();
int iset = getIconsetNum(i);
diff --git a/wizards/com/sun/star/wizards/web/ImageListDialog.java b/wizards/com/sun/star/wizards/web/ImageListDialog.java
index df4f4142f858..3943271408fe 100644
--- a/wizards/com/sun/star/wizards/web/ImageListDialog.java
+++ b/wizards/com/sun/star/wizards/web/ImageListDialog.java
@@ -133,11 +133,11 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
- "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.TRUE, new Integer(dialogHeight), HelpIds.getHelpIdString(hid), Boolean.TRUE, "imgDialog", new Integer(59), new Integer(24), INTEGERS[1], resources[RES_TITLE], new Integer(dialogWidth)
+ Boolean.TRUE, new Integer(dialogHeight), HelpIds.getHelpIdString(hid), Boolean.TRUE, "imgDialog", 59, 24, INTEGERS[1], resources[RES_TITLE], new Integer(dialogWidth)
});
//Set member- FontDescriptors...
fontDescriptor1.Weight = 150;
@@ -153,19 +153,19 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts
PROPNAMES,
new Object[]
{
- Boolean.TRUE, INTEGER_14, HelpIds.getHelpIdString(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
+ Boolean.TRUE, INTEGER_14, HelpIds.getHelpIdString(hid + 3), resources[RES_OK], "btnOK", iButtonsX, 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, HelpIds.getHelpIdString(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
+ Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(hid + 4), resources[RES_CANCEL], "btnCancel", iButtonsX, 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
+ Boolean.FALSE, INTEGER_14, PropertyNames.EMPTY_STRING, resources[RES_HELP], "CommandButton3", iButtonsX, 71, new Short((short) com.sun.star.awt.PushButtonType.HELP_value), new Short((short) 9), INTEGER_50
});
if (showOtherButton)
@@ -202,17 +202,17 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts
/*lblContainer = insertLabel("lblContainer",
new String[] {PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH},
- new Object[] { new Integer(176),"lblContainer",new Integer(6),new Integer(17),new Short((short)5),new Integer(214)}
+ new Object[] { 176,"lblContainer",6,17,new Short((short)5),214}
);*/
lblTitle = insertLabel("lblTitle",
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- fontDescriptor1, INTEGERS[8], resources[RES_LABEL], "lblTitle", INTEGERS[6], INTEGERS[6], INTEGERS[1], new Short((short) 4), new Integer(216)
+ fontDescriptor1, INTEGERS[8], resources[RES_LABEL], "lblTitle", INTEGERS[6], INTEGERS[6], INTEGERS[1], new Short((short) 4), 216
});
}
@@ -275,9 +275,9 @@ public abstract class ImageListDialog extends UnoDialog2 implements UIConsts
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);
+ String s = JavaTools.replaceSubString(template, PropertyNames.EMPTY_STRING + ((Counter) counter).start, START);
+ s = JavaTools.replaceSubString(s, PropertyNames.EMPTY_STRING + ((Counter) counter).end, END);
+ s = JavaTools.replaceSubString(s, PropertyNames.EMPTY_STRING + ((Counter) counter).max, TOTAL);
return s;
}
}
diff --git a/wizards/com/sun/star/wizards/web/LogTaskListener.java b/wizards/com/sun/star/wizards/web/LogTaskListener.java
index e384e12737cb..b98ac5261e7a 100644
--- a/wizards/com/sun/star/wizards/web/LogTaskListener.java
+++ b/wizards/com/sun/star/wizards/web/LogTaskListener.java
@@ -28,6 +28,7 @@
package com.sun.star.wizards.web;
+import com.sun.star.wizards.common.PropertyNames;
import java.io.PrintStream;
import com.sun.star.wizards.ui.event.TaskEvent;
@@ -91,7 +92,7 @@ public class LogTaskListener implements TaskListener, ErrorHandler
*/
public boolean error(Exception ex, Object arg, int ix, int i)
{
- System.out.println("" + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage());
+ System.out.println(PropertyNames.EMPTY_STRING + arg + "//" + ix + "//Exception: " + ex.getLocalizedMessage());
ex.printStackTrace();
return true;
}
diff --git a/wizards/com/sun/star/wizards/web/Process.java b/wizards/com/sun/star/wizards/web/Process.java
index d1ae8e23763e..f861a82865e3 100644
--- a/wizards/com/sun/star/wizards/web/Process.java
+++ b/wizards/com/sun/star/wizards/web/Process.java
@@ -43,6 +43,7 @@ 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.PropertyNames;
import com.sun.star.wizards.common.UCB;
import com.sun.star.wizards.ui.event.Task;
import com.sun.star.wizards.web.data.CGContent;
@@ -163,13 +164,12 @@ public class Process implements WebWizardConst, ProcessErrors
{
}
int publish = countPublish();
- int taskSteps =
+ return
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;
}
/**
@@ -240,8 +240,7 @@ public class Process implements WebWizardConst, ProcessErrors
{
try
{
- String s = FileAccess.getOfficePath(xmsf, "Temp", "", "");
- return s;
+ return FileAccess.getOfficePath(xmsf, "Temp", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
}
catch (Exception e)
{
@@ -308,7 +307,7 @@ public class Process implements WebWizardConst, ProcessErrors
//2. background image
String background = settings.cp_DefaultSession.cp_Design.cp_BackgroundImage;
- if (background != null && !background.equals(""))
+ if (background != null && !background.equals(PropertyNames.EMPTY_STRING))
{
sourceDir = FileAccess.getParentDir(background);
filename = background.substring(sourceDir.length());
@@ -354,7 +353,7 @@ public class Process implements WebWizardConst, ProcessErrors
catch (Exception ex)
{
//error in copying media
- error(ex, "", ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL);
+ error(ex, PropertyNames.EMPTY_STRING, ERROR_PUBLISH_MEDIA, ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
@@ -435,7 +434,7 @@ public class Process implements WebWizardConst, ProcessErrors
}
catch (Exception ex)
{
- error(ex, "", ERROR_GENERATE_XSLT, ErrorHandler.ERROR_PROCESS_FATAL);
+ error(ex, PropertyNames.EMPTY_STRING, ERROR_GENERATE_XSLT, ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
@@ -519,7 +518,7 @@ public class Process implements WebWizardConst, ProcessErrors
for (Iterator i = templates.keySet().iterator(); i.hasNext();)
{
- String key = "";
+ String key = PropertyNames.EMPTY_STRING;
key = (String) i.next();
@@ -586,7 +585,7 @@ public class Process implements WebWizardConst, ProcessErrors
* faileure here is fatal.
*/
contentDir = fileAccess.createNewDir(dir, content.cp_Name);
- if (contentDir == null || contentDir.equals(""))
+ if (contentDir == null || contentDir.equals(PropertyNames.EMPTY_STRING))
{
throw new IOException("Directory " + dir + " could not be created.");
}
@@ -697,7 +696,7 @@ public class Process implements WebWizardConst, ProcessErrors
* the copyExporter does not change
* the extension of the target...
*/
- String destExt = (exporter.cp_Extension.equals("")
+ String destExt = (exporter.cp_Extension.equals(PropertyNames.EMPTY_STRING)
? FileAccess.getExtension(docFilename)
: exporter.cp_Extension);
diff --git a/wizards/com/sun/star/wizards/web/StatusDialog.java b/wizards/com/sun/star/wizards/web/StatusDialog.java
index c765e2410312..c0e6b08f6cff 100644
--- a/wizards/com/sun/star/wizards/web/StatusDialog.java
+++ b/wizards/com/sun/star/wizards/web/StatusDialog.java
@@ -84,11 +84,11 @@ public class StatusDialog extends UnoDialog2 implements TaskListener
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
- "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_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)
+ Boolean.FALSE, new Integer(6 + 25 + (b ? 27 : 7)), hid, Boolean.TRUE, "StatusDialog", 102, 52, 0, res[0], new Integer(width)
});
short tabstop = 1;
@@ -100,7 +100,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener
},
new Object[]
{
- new Integer(8), taskName, new Integer(6), new Integer(6), new Short(tabstop++), new Integer(width * 2 / 3)
+ 8, taskName, 6, 6, new Short(tabstop++), new Integer(width * 2 / 3)
});
lblCounter = insertLabel("lblCounter",
new String[]
@@ -109,7 +109,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener
},
new Object[]
{
- new Integer(8), "", new Integer(width * 2 / 3), new Integer(6), new Short(tabstop++), new Integer(width / 3 - 4)
+ 8, PropertyNames.EMPTY_STRING, new Integer(width * 2 / 3), 6, new Short(tabstop++), new Integer(width / 3 - 4)
});
progressBar = insertProgressBar("progress",
new String[]
@@ -118,7 +118,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener
},
new Object[]
{
- new Integer(10), new Integer(6), new Integer(16), new Short(tabstop++), new Integer(width - 12)
+ 10, 6, 16, new Short(tabstop++), new Integer(width - 12)
});
@@ -131,7 +131,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener
},
new Object[]
{
- new Integer(14), res[1], new Integer(width / 2 - 20), new Integer(6 + 25 + 7), new Short(tabstop++), new Integer(40)
+ 14, res[1], new Integer(width / 2 - 20), new Integer(6 + 25 + 7), new Short(tabstop++), 40
});
}
@@ -245,7 +245,7 @@ public class StatusDialog extends UnoDialog2 implements TaskListener
try
{
this.parent = parent_;
- Helper.setUnoPropertyValue(this.xDialogModel, "Title", title);
+ Helper.setUnoPropertyValue(this.xDialogModel, PropertyNames.PROPERTY_TITLE, title);
try
{
//TODO change this to another execute dialog method.
diff --git a/wizards/com/sun/star/wizards/web/StylePreview.java b/wizards/com/sun/star/wizards/web/StylePreview.java
index 93507929d84b..c6c095eb9388 100644
--- a/wizards/com/sun/star/wizards/web/StylePreview.java
+++ b/wizards/com/sun/star/wizards/web/StylePreview.java
@@ -28,6 +28,7 @@ package com.sun.star.wizards.web;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.wizards.common.FileAccess;
+import com.sun.star.wizards.common.PropertyNames;
import com.sun.star.wizards.web.data.CGStyle;
/**
@@ -98,7 +99,7 @@ public class StylePreview
String css = FileAccess.connectURLs(wwRoot, "styles/" + style.cp_CssHref);
- if (background == null || background.equals(""))
+ if (background == null || background.equals(PropertyNames.EMPTY_STRING))
{
//delete the background image
if (fileAccess.exists(backgroundFilename, false))
@@ -137,7 +138,7 @@ public class StylePreview
*/
private String createTempDir(XMultiServiceFactory xmsf) throws Exception
{
- String tempPath = FileAccess.getOfficePath(xmsf, "Temp", "", "");
+ String tempPath = FileAccess.getOfficePath(xmsf, "Temp", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
String s = fileAccess.createNewDir(tempPath, "wwiz");
fileAccess.createNewDir(s, "images");
return s;
diff --git a/wizards/com/sun/star/wizards/web/TOCPreview.java b/wizards/com/sun/star/wizards/web/TOCPreview.java
index 1fb70a11d4b5..bd7f84527343 100644
--- a/wizards/com/sun/star/wizards/web/TOCPreview.java
+++ b/wizards/com/sun/star/wizards/web/TOCPreview.java
@@ -35,6 +35,7 @@ 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.PropertyNames;
import com.sun.star.wizards.common.UCB;
import com.sun.star.wizards.ui.event.Task;
import com.sun.star.wizards.web.data.CGLayout;
@@ -101,7 +102,7 @@ public class TOCPreview
{
Document doc = (Document) settings.cp_DefaultSession.createDOM();
CGLayout layout = settings.cp_DefaultSession.getLayout();
- Task task = new Task("", "", 10000);
+ Task task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 10000);
Process.generate(xmsf, layout, doc, fileAccess, tempDir, task);
Process.copyLayoutFiles(ucb, fileAccess, settings, layout, tempDir);
xDispatch.dispatch(openHyperlink, loadArgs); //Dispatch.dispatch(openHyperlink, loadArgs);
@@ -110,7 +111,7 @@ public class TOCPreview
private PropertyValue[] loadArgs(String url)
{
PropertyValue pv = new PropertyValue();
- pv.Name = "URL";
+ pv.Name = PropertyNames.URL;
pv.Value = url;
return new PropertyValue[]
{
diff --git a/wizards/com/sun/star/wizards/web/WWD_Events.java b/wizards/com/sun/star/wizards/web/WWD_Events.java
index 26f518c4e6c8..b37e0fff39e6 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Events.java
+++ b/wizards/com/sun/star/wizards/web/WWD_Events.java
@@ -67,10 +67,10 @@ 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 PropertyNames.EMPTY_STRING - 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 = "";
+ protected String currentSession = PropertyNames.EMPTY_STRING;
/**
* He - my constructor !
@@ -81,11 +81,11 @@ public abstract class WWD_Events extends WWD_Startup
{
super(xmsf);
Create c = new Create();
- XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkFTP);
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, chkFTP);
xWindow.addKeyListener(c);
- xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkLocalDir);
+ xWindow = UnoRuntime.queryInterface(XWindow.class, chkLocalDir);
xWindow.addKeyListener(c);
- xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, chkZip);
+ xWindow = UnoRuntime.queryInterface(XWindow.class, chkZip);
xWindow.addKeyListener(c);
}
@@ -106,11 +106,11 @@ public abstract class WWD_Events extends WWD_Startup
{
if ((old == 1))
{
- String sessionToLoad = "";
- short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems");
+ String sessionToLoad = PropertyNames.EMPTY_STRING;
+ short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS);
if (s.length == 0 || s[0] == 0)
{
- sessionToLoad = "";
+ sessionToLoad = PropertyNames.EMPTY_STRING;
}
else
{
@@ -135,7 +135,7 @@ public abstract class WWD_Events extends WWD_Startup
*/
public void sessionSelected()
{
- short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems");
+ short[] s = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS);
setEnabled(btnDelSession, s.length > 0 && s[0] > 0);
}
@@ -148,18 +148,18 @@ public abstract class WWD_Events extends WWD_Startup
{
final StatusDialog sd = getStatusDialog();
- final Task task = new Task("LoadDocs", "", 10);
+ final Task task = new Task("LoadDocs", PropertyNames.EMPTY_STRING, 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);
+ Helper.setUnoPropertyValue(getModel(lstDocuments), PropertyNames.SELECTED_ITEMS, EMPTY_SHORT_ARRAY);
+ Helper.setUnoPropertyValue(getModel(lstDocuments), PropertyNames.STRING_ITEM_LIST, EMPTY_STRING_ARRAY);
Object view = null;
- if (sessionToLoad.equals(""))
+ if (sessionToLoad.equals(PropertyNames.EMPTY_STRING))
{
view = Configuration.getConfigurationRoot(xMSF, CONFIG_PATH + "/DefaultSession", false);
}
@@ -175,7 +175,7 @@ public abstract class WWD_Events extends WWD_Startup
task.setMax(session.cp_Content.cp_Documents.getSize() * 5 + 7);
task.advance(true);
- if (sessionToLoad.equals(""))
+ if (sessionToLoad.equals(PropertyNames.EMPTY_STRING))
{
setSaveSessionName(session);
}
@@ -212,7 +212,7 @@ public abstract class WWD_Events extends WWD_Startup
*/
public void delSession()
{
- short[] selected = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems");
+ short[] selected = (short[]) Helper.getUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS);
if (selected.length == 0)
{
return;
@@ -254,7 +254,7 @@ public abstract class WWD_Events extends WWD_Startup
{
Helper.setUnoPropertyValue(getModel(btnDelSession), PropertyNames.PROPERTY_ENABLED, Boolean.FALSE); // select...
}
- Helper.setUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems", nextSelected);
+ Helper.setUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS, nextSelected);
//ListModelBinder.fillComboBox(cbSaveSettings, settings.savedSessions.items(), null);
@@ -310,7 +310,7 @@ public abstract class WWD_Events extends WWD_Startup
{
fillExportList(settings.getExporters(doc.appType));
}
- else; // do nothing
+
selectedDoc = s;
@@ -332,7 +332,7 @@ public abstract class WWD_Events extends WWD_Startup
{
return;
}
- final Task task = new Task("", "", files.length * 5);
+ final Task task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, files.length * 5);
/*
* If more than a certain number
@@ -455,7 +455,7 @@ public abstract class WWD_Events extends WWD_Startup
{
if (background == null)
{
- background = "";
+ background = PropertyNames.EMPTY_STRING;
}
settings.cp_DefaultSession.cp_Design.cp_BackgroundImage = (String) background;
refreshStylePreview();
@@ -543,7 +543,7 @@ public abstract class WWD_Events extends WWD_Startup
*/
public void setPublishLocalDir()
{
- String dir = showFolderDialog("Local destination directory", "", settings.cp_DefaultSession.cp_OutDirectory);
+ String dir = showFolderDialog("Local destination directory", PropertyNames.EMPTY_STRING, settings.cp_DefaultSession.cp_OutDirectory);
//if ok was pressed...
setPublishUrl(LOCAL_PUBLISHER, dir, 0);
@@ -898,7 +898,7 @@ public abstract class WWD_Events extends WWD_Startup
}
else
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
}
@@ -965,7 +965,7 @@ public abstract class WWD_Events extends WWD_Startup
*/
final CGPublish p = getPublisher(FTP_PUBLISHER);
// if ftp is checked, and no proxies are set, and password is empty...
- if (p.cp_Publish && (!proxies) && (p.password == null || p.password.equals("")))
+ if (p.cp_Publish && (!proxies) && (p.password == null || p.password.equals(PropertyNames.EMPTY_STRING)))
{
if (showFTPDialog(p))
{
@@ -1036,7 +1036,7 @@ public abstract class WWD_Events extends WWD_Startup
}
else
{
- settings.cp_LastSavedSession = "";
+ settings.cp_LastSavedSession = PropertyNames.EMPTY_STRING;
}
try
{
@@ -1204,7 +1204,7 @@ public abstract class WWD_Events extends WWD_Startup
//if (xCloseable != null)
// xCloseable.close(false);
- XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, myFrame);
+ XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, myFrame);
if (xCloseable != null)
{
xCloseable.close(false);
@@ -1301,6 +1301,6 @@ public abstract class WWD_Events extends WWD_Startup
task.advance(false);
}
}
- };
+ }
}
diff --git a/wizards/com/sun/star/wizards/web/WWD_General.java b/wizards/com/sun/star/wizards/web/WWD_General.java
index fd716e1b9c06..cb109fd01668 100644
--- a/wizards/com/sun/star/wizards/web/WWD_General.java
+++ b/wizards/com/sun/star/wizards/web/WWD_General.java
@@ -64,7 +64,7 @@ public abstract class WWD_General extends WebWizardDialog
StatusDialog statusDialog = new StatusDialog(xMSF, StatusDialog.STANDARD_WIDTH, resources.resLoadingSession, false, new String[]
{
- resources.prodName, "", "", "", "", ""
+ resources.prodName, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING
}, HelpIds.getHelpIdString(HID0_STATUS_DIALOG));
try
{
@@ -302,7 +302,7 @@ public abstract class WWD_General extends WebWizardDialog
public boolean checkSaveSession()
{
return (!isSaveSession() ||
- !getSessionSaveName().equals(""));
+ !getSessionSaveName().equals(PropertyNames.EMPTY_STRING));
}
@@ -317,7 +317,7 @@ public abstract class WWD_General extends WebWizardDialog
if (p.cp_Publish)
{
String url = (String) Helper.getUnoPropertyValue(getModel(text), property);
- if ((url == null) || (url.equals("")))
+ if ((url == null) || (url.equals(PropertyNames.EMPTY_STRING)))
{
throw new IllegalArgumentException();
}
diff --git a/wizards/com/sun/star/wizards/web/WWD_Startup.java b/wizards/com/sun/star/wizards/web/WWD_Startup.java
index 2a250c84c266..c3bae2a10bc4 100644
--- a/wizards/com/sun/star/wizards/web/WWD_Startup.java
+++ b/wizards/com/sun/star/wizards/web/WWD_Startup.java
@@ -254,7 +254,7 @@ public abstract class WWD_Startup extends WWD_General
this.buildStep7(proxies, exclamationURL);
buildStepX();
- this.xMSF = xMSF;
+ this.xMSF = xmsf;
XDesktop xDesktop = Desktop.getDesktop(xMSF);
myFrame = OfficeDocument.createNewFrame(xMSF, this);
Object doc = OfficeDocument.createNewDocument(myFrame, "swriter", false, true);
@@ -265,7 +265,7 @@ public abstract class WWD_Startup extends WWD_General
ilLayouts.setListModel(settings.cp_Layouts);
ilLayouts.create(this);
- checkContent(settings.cp_DefaultSession.cp_Content, new Task("", "", 99999), this.xControl);
+ checkContent(settings.cp_DefaultSession.cp_Content, new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 99999), this.xControl);
//saved sessions, styles, combobox save session.
// also set the chosen saved session...
@@ -388,7 +388,7 @@ public abstract class WWD_Startup extends WWD_General
private XFrame getFrame(Object model)
{
- XModel xmodel = (XModel) UnoRuntime.queryInterface(XModel.class, model);
+ XModel xmodel = UnoRuntime.queryInterface(XModel.class, model);
return xmodel.getCurrentController().getFrame();
}
@@ -412,7 +412,7 @@ public abstract class WWD_Startup extends WWD_General
//XWindow xContainerWindow = myFrame.getContainerWindow();
XWindow xContainerWindow = myFrame.getComponentWindow();
- XWindowPeer xWindowPeer = (XWindowPeer) UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
+ XWindowPeer xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xContainerWindow);
createWindowPeer(xWindowPeer);
@@ -548,7 +548,7 @@ public abstract class WWD_Startup extends WWD_General
protected void selectSession()
{
int selectedSession = 0;
- if (settings.cp_LastSavedSession != null && !settings.cp_LastSavedSession.equals(""))
+ if (settings.cp_LastSavedSession != null && !settings.cp_LastSavedSession.equals(PropertyNames.EMPTY_STRING))
{
Object ses = settings.cp_SavedSessions.getElement(settings.cp_LastSavedSession);
@@ -557,7 +557,7 @@ public abstract class WWD_Startup extends WWD_General
selectedSession = settings.cp_SavedSessions.getIndexOf(ses);
}
}
- Helper.setUnoPropertyValue(getModel(lstLoadSettings), "SelectedItems", new short[]
+ Helper.setUnoPropertyValue(getModel(lstLoadSettings), PropertyNames.SELECTED_ITEMS, new short[]
{
(short) selectedSession
});
@@ -595,7 +595,7 @@ public abstract class WWD_Startup extends WWD_General
//page 2 : document properties
- docListDA = (UnoDataAware) UnoDataAware.attachListBox(this, "SelectedDoc", lstDocuments, null, false);
+ docListDA = UnoDataAware.attachListBox(this, "SelectedDoc", lstDocuments, null, false);
docListDA.disableControls(new Object[]
{
/*btnDocDown, btnDocUp, */
@@ -682,8 +682,8 @@ public abstract class WWD_Startup extends WWD_General
});
pubAware.add(uda);
pubAware.add(
- isLabel ? UnoDataAware.attachLabel(p, "URL", textbox, checkPublish, false)
- : UnoDataAware.attachEditControl(p, "URL", textbox, checkPublish, false));
+ isLabel ? UnoDataAware.attachLabel(p, PropertyNames.URL, textbox, checkPublish, false)
+ : UnoDataAware.attachEditControl(p, PropertyNames.URL, textbox, checkPublish, false));
}
@@ -806,7 +806,7 @@ public abstract class WWD_Startup extends WWD_General
catch (FileNotFoundException ex)
{
- int relocate = SystemDialog.showMessageBox(xMSF, xC.getPeer(), "WarningBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, getFileAccess().getPath(doc.cp_URL, "") + "\n\n" + resources.resSpecifyNewFileLocation);
+ int relocate = SystemDialog.showMessageBox(xMSF, xC.getPeer(), "WarningBox", VclWindowPeerAttribute.YES_NO + VclWindowPeerAttribute.DEF_NO, getFileAccess().getPath(doc.cp_URL, PropertyNames.EMPTY_STRING) + "\n\n" + resources.resSpecifyNewFileLocation);
if (relocate == 2)
{
@@ -831,7 +831,7 @@ public abstract class WWD_Startup extends WWD_General
//file is a directory
AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),
JavaTools.replaceSubString(resources.resErrIsDirectory,
- getFileAccess().getPath(doc.cp_URL, ""),
+ getFileAccess().getPath(doc.cp_URL, PropertyNames.EMPTY_STRING),
"%FILENAME"),
ErrorHandler.ERROR_PROCESS_FATAL);
return false;
@@ -842,7 +842,7 @@ public abstract class WWD_Startup extends WWD_General
exp.printStackTrace();
AbstractErrorHandler.showMessage(xMSF, xControl.getPeer(),
JavaTools.replaceSubString(resources.resErrDocValidate,
- getFileAccess().getPath(doc.cp_URL, ""),
+ getFileAccess().getPath(doc.cp_URL, PropertyNames.EMPTY_STRING),
"%FILENAME"), ErrorHandler.ERROR_PROCESS_FATAL);
return false;
}
@@ -907,7 +907,7 @@ public abstract class WWD_Startup extends WWD_General
void updateBackgroundText()
{
String bg = settings.cp_DefaultSession.cp_Design.cp_BackgroundImage;
- if (bg == null || bg.equals(""))
+ if (bg == null || bg.equals(PropertyNames.EMPTY_STRING))
{
bg = resources.resBackgroundNone;
}
@@ -922,7 +922,7 @@ public abstract class WWD_Startup extends WWD_General
{
String iconset = settings.cp_DefaultSession.cp_Design.cp_IconSet;
String iconsetName;
- if (iconset == null || iconset.equals(""))
+ if (iconset == null || iconset.equals(PropertyNames.EMPTY_STRING))
{
iconsetName = resources.resIconsetNone;
}
diff --git a/wizards/com/sun/star/wizards/web/WebWizardDialog.java b/wizards/com/sun/star/wizards/web/WebWizardDialog.java
index e9d1d2fd7a87..7191e65bedb8 100644
--- a/wizards/com/sun/star/wizards/web/WebWizardDialog.java
+++ b/wizards/com/sun/star/wizards/web/WebWizardDialog.java
@@ -196,16 +196,16 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
};
private static String[] PROPNAMES_TXT_2 = new String[]
{
- PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ReadOnly", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.READ_ONLY, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
};
private static String[] PROPNAMES_TITLE = new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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
+ private static Integer INTEGER_91 = 91;
+ private static Integer INTEGER_97 = 97;
+ private static Integer INTEGER_103 = 103;
+ private static Integer INTEGER_169 = 169; //Resources Object
WebWizardDialogResources resources;
public WebWizardDialog(XMultiServiceFactory xmsf)
@@ -219,11 +219,11 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
Helper.setUnoPropertyValues(xDialogModel,
new String[]
{
- "Closeable", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, "Moveable", PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Title", PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_CLOSEABLE, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_MOVEABLE, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TITLE, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- Boolean.TRUE, new Integer(210), HelpIds.getHelpIdString(HID0_WEBWIZARD), Boolean.TRUE, "WebWizardDialog", new Integer(102), new Integer(52), INTEGERS[1], new Short((short) 6), resources.resWebWizardDialog_title, new Integer(330)
+ Boolean.TRUE, 210, HelpIds.getHelpIdString(HID0_WEBWIZARD), Boolean.TRUE, "WebWizardDialog", 102, 52, INTEGERS[1], new Short((short) 6), resources.resWebWizardDialog_title, 330
});
//Set member- FontDescriptors...
@@ -254,7 +254,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
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)
+ fontDescriptor4, INTEGER_16, resources.reslbIntroTitle_value, Boolean.TRUE, "lbIntroTitle", 91, INTEGERS[8], INTEGERS[1], new Short(tabIndex++), 232
});
lblIntroduction = insertLabel("lblIntroduction",
new String[]
@@ -263,14 +263,14 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
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)
+ 119, resources.reslblIntroduction_value, Boolean.TRUE, "lblIntroduction", 97, 28, INTEGERS[1], new Short(tabIndex++), 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)
+ INTEGERS[2], PropertyNames.EMPTY_STRING, "lnLoadSettings", 91, 147, INTEGERS[1], new Short(tabIndex++), 234
});
lblLoadSettings = insertLabel("lblLoadSettings",
new String[]
@@ -279,7 +279,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- INTEGERS[8], resources.reslblLoadSettings_value, Boolean.TRUE, "lblLoadSettings", new Integer(97), new Integer(153), INTEGERS[1], new Short(tabIndex++), new Integer(226)
+ INTEGERS[8], resources.reslblLoadSettings_value, Boolean.TRUE, "lblLoadSettings", 97, 153, INTEGERS[1], new Short(tabIndex++), 226
});
lstLoadSettings = insertListBox("lstLoadSettings", null, LSTLOADSETTINGS_ITEM_CHANGED,
new String[]
@@ -288,7 +288,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID1_LST_SESSIONS), new Short((short) 14), "lstLoadSettings", new Integer(97), new Integer(165), INTEGERS[1], new Short(tabIndex++), new Integer(173)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID1_LST_SESSIONS), new Short((short) 14), "lstLoadSettings", 97, 165, INTEGERS[1], new Short(tabIndex++), 173
});
btnDelSession = insertButton("btnDelSession", BTNDELSESSION_ACTION_PERFORMED,
new String[]
@@ -297,7 +297,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(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
+ Boolean.FALSE, INTEGER_14, HelpIds.getHelpIdString(HID1_BTN_DEL_SES), new Short(com.sun.star.awt.ImageAlign.LEFT), resources.resbtnDelSession_value, "btnDelSession", 274, 164, INTEGERS[1], new Short(tabIndex++), INTEGER_50
});
}
@@ -309,13 +309,13 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
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)
+ fontDescriptor4, INTEGER_16, resources.reslblContentTitle_value, Boolean.TRUE, "lblContentTitle", 91, INTEGERS[8], INTEGERS[2], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblSiteContent_value, "lblSiteContent", 97, 28, INTEGERS[2], new Short(tabIndex++), 105
});
lstDocuments = insertListBox("lstDocuments", null, null,
new String[]
@@ -324,44 +324,44 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- new Integer(123), HelpIds.getHelpIdString(HID2_LST_DOCS), new Short((short) 9), "lstDocuments", new Integer(97), new Integer(38), INTEGERS[2], new Short(tabIndex++), new Integer(103)
+ 123, HelpIds.getHelpIdString(HID2_LST_DOCS), new Short((short) 9), "lstDocuments", 97, 38, INTEGERS[2], new Short(tabIndex++), 103
});
btnAddDoc = insertButton("btnAddDoc", BTNADDDOC_ACTION_PERFORMED,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_ADD_DOC), resources.resbtnAddDoc_value, "btnAddDoc", new Integer(97), new Integer(165), INTEGERS[2], new Short(tabIndex++), INTEGER_50
+ INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_ADD_DOC), resources.resbtnAddDoc_value, "btnAddDoc", 97, 165, INTEGERS[2], new Short(tabIndex++), INTEGER_50
});
btnRemoveDoc = insertButton("btnRemoveDoc", BTNREMOVEDOC_ACTION_PERFORMED,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_REM_DOC), resources.resbtnRemoveDoc_value, "btnRemoveDoc", new Integer(150), new Integer(165), INTEGERS[2], new Short(tabIndex++), INTEGER_50
+ INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_REM_DOC), resources.resbtnRemoveDoc_value, "btnRemoveDoc", 150, 165, INTEGERS[2], new Short(tabIndex++), INTEGER_50
});
btnDocUp = insertButton("btnDocUp", BTNDOCUP_ACTION_PERFORMED,
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_UP), resources.resbtnDocUp_value, "btnDocUp", new Integer(205), new Integer(87), INTEGERS[2], new Short(tabIndex++), new Integer(18)
+ fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_UP), resources.resbtnDocUp_value, "btnDocUp", 205, 87, INTEGERS[2], new Short(tabIndex++), 18
});
btnDocDown = insertButton("btnDocDown", BTNDOCDOWN_ACTION_PERFORMED,
new String[]
{
- "FontDescriptor", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.FONT_DESCRIPTOR, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_DOWN), resources.resbtnDocDown_value, "btnDocDown", new Integer(205), new Integer(105), INTEGERS[2], new Short(tabIndex++), new Integer(18)
+ fontDescriptor7, INTEGER_14, HelpIds.getHelpIdString(HID2_BTN_DOC_DOWN), resources.resbtnDocDown_value, "btnDocDown", 205, 105, INTEGERS[2], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblDocExportFormat_value, "lblDocExportFormat", 235, 28, INTEGERS[2], new Short(tabIndex++), 89
});
lstDocTargetType = insertListBox("lstDocTargetType", null, null,
new String[]
@@ -370,7 +370,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID2_LST_DOC_EXPORT), new Short((short) 14), "lstDocTargetType", new Integer(235), new Integer(38), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID2_LST_DOC_EXPORT), new Short((short) 14), "lstDocTargetType", 235, 38, INTEGERS[2], new Short(tabIndex++), 89
});
@@ -380,25 +380,25 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
PROPNAMES_LBL,
new Object[]
{
- INTEGERS[8], resources.reslnDocsInfo_value, "lnDocsInfo", new Integer(235), new Integer(66), INTEGERS[2], new Short(tabIndex++), new Integer(90)
+ INTEGERS[8], resources.reslnDocsInfo_value, "lnDocsInfo", 235, 66, INTEGERS[2], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblDocTitle_value, "lblDocTitle", 235, 78, INTEGERS[2], new Short(tabIndex++), 89
});
txtDocTitle = insertTextField("txtDocTitle", null,
PROPNAMES_TXT,
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_TITLE), "txtDocTitle", new Integer(235), new Integer(88), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_TITLE), "txtDocTitle", 235, 88, INTEGERS[2], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblDocInfo_value, "lblDocInfo", 235, 103, INTEGERS[2], new Short(tabIndex++), 89
});
txtDocInfo = insertTextField("txtDocInfo", null,
new String[]
@@ -407,19 +407,19 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- INTEGER_40, HelpIds.getHelpIdString(HID2_TXT_DOC_DESC), Boolean.TRUE, "txtDocInfo", new Integer(235), new Integer(113), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ INTEGER_40, HelpIds.getHelpIdString(HID2_TXT_DOC_DESC), Boolean.TRUE, "txtDocInfo", 235, 113, INTEGERS[2], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblDocAuthor_value, "lblDocAuthor", 235, 155, INTEGERS[2], new Short(tabIndex++), 89
});
txtDocAuthor = insertTextField("txtDocAuthor", null,
PROPNAMES_TXT,
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_AUTHOR), "txtDocAuthor", new Integer(235), new Integer(165), INTEGERS[2], new Short(tabIndex++), new Integer(89)
+ INTEGER_12, HelpIds.getHelpIdString(HID2_TXT_DOC_AUTHOR), "txtDocAuthor", 235, 165, INTEGERS[2], new Short(tabIndex++), 89
});
}
@@ -429,13 +429,13 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
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)
+ fontDescriptor4, INTEGER_16, resources.reslblLayoutTitle_value, Boolean.TRUE, "lblLayoutTitle", 91, INTEGERS[8], INTEGERS[3], new Short((short) 29), 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)
+ INTEGERS[8], resources.reslblLayouts_value, "lblLayouts", 97, 28, INTEGERS[3], new Short((short) 30), 206
});
}
@@ -446,7 +446,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
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)
+ fontDescriptor4, INTEGER_16, resources.reslblLayout2Title_value, Boolean.TRUE, "lblLayout2Title", 91, INTEGERS[8], INTEGERS[4], new Short((short) 33), 232
});
lnDisplay = insertLabel("lblDisplay",
new String[]
@@ -455,86 +455,86 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
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)
+ INTEGER_16, resources.reslblDisplay_value, Boolean.TRUE, "lblDisplay", 97, 28, INTEGERS[4], new Short((short) 34), 226
});
chkDocFilename = insertCheckBox("chkDocFilename", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FILENAME), resources.reschkDocFilename_value, "chkDocFilename", 103, 50, new Short((short) 0), INTEGERS[4], new Short((short) 35), 99
});
chbDocDesc = insertCheckBox("chbDocDesc", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_DESCRIPTION), resources.reschbDocDesc_value, "chbDocDesc", 103, 60, new Short((short) 0), INTEGERS[4], new Short((short) 36), 99
});
chbDocAuthor = insertCheckBox("chbDocAuthor", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_AUTHOR), resources.reschbDocAuthor_value, "chbDocAuthor", 103, 70, new Short((short) 0), INTEGERS[4], new Short((short) 37), 99
});
chkDocCreated = insertCheckBox("chkDocCreated", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_CR_DATE), resources.reschkDocCreated_value, "chkDocCreated", 103, 80, new Short((short) 0), INTEGERS[4], new Short((short) 38), 99
});
chkDocChanged = insertCheckBox("chkDocChanged", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_UP_DATE), resources.reschkDocChanged_value, "chkDocChanged", 103, 90, new Short((short) 0), INTEGERS[4], new Short((short) 39), 99
});
chkDocFormat = insertCheckBox("chkDocFormat", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_FORMAT), resources.reschkDocFormat_value, "chkDocFormat", 200, 50, new Short((short) 0), INTEGERS[4], new Short((short) 40), 110
});
chkDocFormatIcon = insertCheckBox("chkDocFormatIcon", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_F_ICON), resources.reschkDocFormatIcon_value, "chkDocFormatIcon", 200, 60, new Short((short) 0), INTEGERS[4], new Short((short) 41), 110
});
chkDocPages = insertCheckBox("chkDocPages", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_PAGES), resources.reschkDocPages_value, "chkDocPages", 200, 70, new Short((short) 0), INTEGERS[4], new Short((short) 42), 110
});
chkDocSize = insertCheckBox("chkDocSize", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID4_CHK_DISPLAY_SIZE), resources.reschkDocSize_value, "chkDocSize", 200, 80, new Short((short) 0), INTEGERS[4], new Short((short) 43), 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)
+ INTEGERS[8], resources.reslblOptimizeFor_value, "lblOptimizeFor", 97, 113, INTEGERS[4], new Short((short) 44), 226
});
optOptimize640x480 = insertRadioButton("optOptimize640x480", null,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_640), resources.resoptOptimize640x480_value, "optOptimize640x480", new Integer(103), new Integer(133), INTEGERS[4], new Short((short) 45), new Integer(44)
+ INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_640), resources.resoptOptimize640x480_value, "optOptimize640x480", 103, 133, INTEGERS[4], new Short((short) 45), 44
});
optOptimize800x600 = insertRadioButton("optOptimize800x600", null,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_800), resources.resoptOptimize800x600_value, "optOptimize800x600", new Integer(103), new Integer(146), INTEGERS[4], new Short((short) 46), new Integer(44)
+ INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_800), resources.resoptOptimize800x600_value, "optOptimize800x600", 103, 146, INTEGERS[4], new Short((short) 46), 44
});
optOptimize1024x768 = insertRadioButton("optOptimize1024x768", null,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_1024), resources.resoptOptimize1024x768_value, "optOptimize1024x768", new Integer(103), new Integer(158), INTEGERS[4], new Short((short) 47), new Integer(44)
+ INTEGERS[10], HelpIds.getHelpIdString(HID4_GRP_OPTIMAIZE_1024), resources.resoptOptimize1024x768_value, "optOptimize1024x768", 103, 158, INTEGERS[4], new Short((short) 47), 44
});
}
@@ -544,13 +544,13 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
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)
+ fontDescriptor4, INTEGER_16, resources.reslblStyleTitle_value, Boolean.TRUE, "lblStyleTitle", 91, INTEGERS[8], INTEGERS[5], new Short((short) 50), 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)
+ INTEGERS[8], resources.reslblStyle_value, "lblStyle", 97, 28, INTEGERS[5], new Short((short) 51), 80
});
lstStyles = insertListBox("lstStyles", null, LSTSTYLES_ITEM_CHANGED,
new String[]
@@ -559,48 +559,48 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID5_LST_STYLES), new Short((short) 14), "lstStyles", new Integer(179), new Integer(26), INTEGERS[5], new Short((short) 52), new Integer(145)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID5_LST_STYLES), new Short((short) 14), "lstStyles", 179, 26, INTEGERS[5], new Short((short) 52), 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)
+ INTEGERS[8], resources.reslblBackground, "lblBackground", 97, 46, INTEGERS[5], new Short((short) 51), 70
});
txtBackground = insertLabel("txtBackground",
new String[]
{
- "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ new Short((short) 1), INTEGER_12, resources.resBackgroundNone, "txtBackground", 179, 44, INTEGERS[5], new Short((short) 52), 90
});
btnBackgrounds = insertButton("btnBackgrounds", BTNBACKGROUNDS_ACTION_PERFORMED, PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_BACKGND), resources.resBtnChooseBackground, "btnBackgrounds", new Integer(274), new Integer(43), INTEGERS[5], new Short((short) 53), INTEGER_50
+ INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_BACKGND), resources.resBtnChooseBackground, "btnBackgrounds", 274, 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)
+ INTEGERS[8], resources.reslblIconset, "lblIconset", 97, 64, INTEGERS[5], new Short((short) 51), 70
});
txtIconset = insertLabel("txtIconset",
new String[]
{
- "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ new Short((short) 1), INTEGER_12, resources.resIconsetNone, "txtIconset", 179, 62, INTEGERS[5], new Short((short) 52), 90
});
btnIconSets = insertButton("btnIconSets", BTNICONSETS_ACTION_PERFORMED,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_ICONS), resources.resBtnChooseIconset, "btnIconSets", new Integer(274), new Integer(61), INTEGERS[5], new Short((short) 54), INTEGER_50
+ INTEGER_14, HelpIds.getHelpIdString(HID5_BTN_ICONS), resources.resBtnChooseIconset, "btnIconSets", 274, 61, INTEGERS[5], new Short((short) 54), INTEGER_50
});
insertLabel("lblIconsetInfo",
new String[]
@@ -609,7 +609,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- INTEGER_16, resources.reslblIconSetInfo, Boolean.TRUE, "lblIconsetInfo", new Integer(179), new Integer(78), INTEGERS[5], new Short((short) 51), new Integer(145)
+ INTEGER_16, resources.reslblIconSetInfo, Boolean.TRUE, "lblIconsetInfo", 179, 78, INTEGERS[5], new Short((short) 51), 145
});
@@ -620,7 +620,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
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)
+ 0, Boolean.FALSE, 78, PropertyNames.EMPTY_STRING, "imgPreview", 91, 100, Boolean.FALSE, INTEGERS[5], new Short((short) 55), 232
});
}
@@ -632,19 +632,19 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
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)
+ fontDescriptor4, INTEGERS[8], resources.reslblTitleGeneralPage_value, Boolean.TRUE, "lblTitleGeneralPage", 90, INTEGERS[9], INTEGERS[6], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblSiteTitle_value, "lblSiteTitle", 97, 28, INTEGERS[6], new Short(tabIndex++), 80
});
txtSiteTitle = insertTextField("txtSiteTitle", null,
PROPNAMES_TXT,
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_TITLE), "txtSiteTitle", new Integer(179), new Integer(26), INTEGERS[6], new Short(tabIndex++), new Integer(145)
+ INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_TITLE), "txtSiteTitle", 179, 26, INTEGERS[6], new Short(tabIndex++), 145
});
@@ -652,7 +652,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
PROPNAMES_LBL,
new Object[]
{
- INTEGERS[9], resources.reslblMetaData, "FixedLineMetaData", new Integer(97), new Integer(56), INTEGERS[6], new Short(tabIndex++), new Integer(228)
+ INTEGERS[9], resources.reslblMetaData, "FixedLineMetaData", 97, 56, INTEGERS[6], new Short(tabIndex++), 228
});
@@ -660,35 +660,35 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
PROPNAMES_LBL,
new Object[]
{
- INTEGERS[8], resources.reslblSiteDesc_value, "lblSiteDesc", new Integer(103), new Integer(72), INTEGERS[6], new Short(tabIndex++), new Integer(80)
+ INTEGERS[8], resources.reslblSiteDesc_value, "lblSiteDesc", 103, 72, INTEGERS[6], new Short(tabIndex++), 80
});
txtSiteDesc = insertTextField("txtSiteDesc", null,
PROPNAMES_TXT,
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_DESC), "txtSiteDesc", new Integer(179), new Integer(70), INTEGERS[6], new Short(tabIndex++), new Integer(145)
+ INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_DESC), "txtSiteDesc", 179, 70, INTEGERS[6], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblEmail_value, "lblEmail", 103, 90, INTEGERS[6], new Short(tabIndex++), 80
});
txtEmail = insertTextField("txtEmail", null, PROPNAMES_TXT,
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_EMAIL), "txtEmail", new Integer(179), new Integer(87), INTEGERS[6], new Short(tabIndex++), new Integer(145)
+ INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_EMAIL), "txtEmail", 179, 87, INTEGERS[6], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblCopyright_value, "lblCopyright", 103, 108, INTEGERS[6], new Short(tabIndex++), 80
});
txtCopyright = insertTextField("txtCopyright", null, PROPNAMES_TXT,
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_COPYRIGHT), "txtCopyright", new Integer(179), new Integer(106), INTEGERS[6], new Short(tabIndex++), new Integer(145)
+ INTEGER_12, HelpIds.getHelpIdString(HID6_TXT_SITE_COPYRIGHT), "txtCopyright", 179, 106, INTEGERS[6], new Short(tabIndex++), 145
});
@@ -696,7 +696,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
PROPNAMES_LBL,
new Object[]
{
- INTEGERS[8], resources.reslblSiteCreated_value, "lblSiteCreated", new Integer(103), new Integer(126), INTEGERS[6], new Short(tabIndex++), new Integer(80)
+ INTEGERS[8], resources.reslblSiteCreated_value, "lblSiteCreated", 103, 126, INTEGERS[6], new Short(tabIndex++), 80
});
dateSiteCreated = insertDateField("dateSiteCreated", null,
new String[]
@@ -705,13 +705,13 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_CREATED), "dateSiteCreated", new Integer(179), new Integer(124), INTEGERS[6], new Short(tabIndex++), new Integer(49)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_CREATED), "dateSiteCreated", 179, 124, INTEGERS[6], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblSiteUpdated_value, "lblSiteUpdated", 103, 144, INTEGERS[6], new Short(tabIndex++), 80
});
dateSiteUpdate = insertDateField("dateSiteUpdate", null,
@@ -721,7 +721,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_UPDATED), "dateSiteUpdate", new Integer(179), new Integer(142), INTEGERS[6], new Short(tabIndex++), new Integer(49)
+ Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID6_DATE_SITE_UPDATED), "dateSiteUpdate", 179, 142, INTEGERS[6], new Short(tabIndex++), 49
});
@@ -736,92 +736,92 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
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)
+ fontDescriptor4, INTEGER_16, resources.reslblTitlePublish_value, Boolean.TRUE, "lblTitlePublish", 91, INTEGERS[8], INTEGERS[7], new Short(tabIndex++), 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)
+ INTEGERS[9], resources.resFixedLine1_value, "FixedLine1", 97, 28, INTEGERS[7], new Short(tabIndex++), 228
});
btnPreview = insertButton("btnPreview", BTNPREVIEW_ACTION_PERFORMED,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_PREVIEW), resources.resbtnPreview_value, "btnPreview", new Integer(103), new Integer(40), INTEGERS[7], new Short(tabIndex++), INTEGER_50
+ INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_PREVIEW), resources.resbtnPreview_value, "btnPreview", 103, 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)
+ INTEGERS[9], resources.reslblCreateSite_value, "lblCreateSite", 97, 56, INTEGERS[7], new Short(tabIndex++), 228
});
chkLocalDir = insertCheckBox("chkLocalDir", CHKLOCALDIR_ITEM_CHANGED,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_LOCAL), resources.reschkLocalDir_value, "chkLocalDir", 103, 68, new Short((short) 0), INTEGERS[7], new Short(tabIndex++), 215
});
txtLocalDir = insertTextField("txtLocalDir", null,
PROPNAMES_TXT,
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_LOCAL), "txtLocalDir", new Integer(113), new Integer(78), INTEGERS[7], new Short(tabIndex++), new Integer(190)
+ INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_LOCAL), "txtLocalDir", 113, 78, INTEGERS[7], new Short(tabIndex++), 190
});
btnLocalDir = insertButton("btnLocalDir", BTNLOCALDIR_ACTION_PERFORMED,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_LOCAL), resources.resbtnLocalDir_value, "btnLocalDir", new Integer(308), new Integer(77), INTEGERS[7], new Short(tabIndex++), INTEGER_16
+ INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_LOCAL), resources.resbtnLocalDir_value, "btnLocalDir", 308, 77, INTEGERS[7], new Short(tabIndex++), INTEGER_16
});
chkZip = insertCheckBox("chkZip", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[9], HelpIds.getHelpIdString(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)
+ INTEGERS[9], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_ZIP), resources.reschkZip_value, "chkZip", 103, 96, new Short((short) 0), INTEGERS[7], new Short(tabIndex++), 215
});
txtZip = insertTextField("txtZip", null,
PROPNAMES_TXT,
new Object[]
{
- INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_ZIP), "txtZip", new Integer(113), new Integer(108), INTEGERS[7], new Short(tabIndex++), new Integer(190)
+ INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_ZIP), "txtZip", 113, 108, INTEGERS[7], new Short(tabIndex++), 190
});
btnZip = insertButton("btnZip", BTNZIP_ACTION_PERFORMED,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_ZIP), resources.resbtnZip_value, "btnZip", new Integer(308), new Integer(107), INTEGERS[7], new Short(tabIndex++), INTEGER_16
+ INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_ZIP), resources.resbtnZip_value, "btnZip", 308, 107, INTEGERS[7], new Short(tabIndex++), INTEGER_16
});
chkFTP = insertCheckBox("chkFTP", null,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[8], HelpIds.getHelpIdString(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)
+ INTEGERS[8], HelpIds.getHelpIdString(HID7_CHK_PUBLISH_FTP), resources.reschkFTP_value, "chkFTP", 103, 124, new Short((short) 0), INTEGERS[7], new Short(tabIndex++), 215
});
- Integer FTP_STEP = disableFTP ? new Integer(99) : INTEGERS[7];
+ Integer FTP_STEP = disableFTP ? 99 : INTEGERS[7];
lblFTP = insertLabel("lblFTP",
new String[]
{
- "Border", PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
},
new Object[]
{
- new Short((short) 1), INTEGER_12, "txtFTP", new Integer(113), new Integer(134), FTP_STEP, new Short(tabIndex++), new Integer(156)
+ new Short((short) 1), INTEGER_12, "txtFTP", 113, 134, FTP_STEP, new Short(tabIndex++), 156
});
btnFTP = insertButton("btnFTP", BTNFTP_ACTION_PERFORMED,
PROPNAMES_BUTTON,
new Object[]
{
- INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_FTP), resources.resbtnFTP_value, "btnFTP", new Integer(274), new Integer(133), FTP_STEP, new Short(tabIndex++), INTEGER_50
+ INTEGER_14, HelpIds.getHelpIdString(HID7_BTN_FTP), resources.resbtnFTP_value, "btnFTP", 274, 133, FTP_STEP, new Short(tabIndex++), INTEGER_50
});
if (disableFTP)
@@ -830,11 +830,11 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
insertImage("imgFTPDisabled",
new String[]
{
- "BackgroundColor", "Border", PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH
+ "BackgroundColor", PropertyNames.PROPERTY_BORDER, PropertyNames.PROPERTY_ENABLED, PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_NAME, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_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)
+ new Integer(-1), new Short((short) 0), Boolean.FALSE, 10, exclamationURL, "imgFTPDisabled", 115, 135, Boolean.FALSE, INTEGERS[7], new Short(tabIndex++), 8
});
insertLabel("lblFTPDisabled",
new String[]
@@ -843,9 +843,9 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
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)
+ new Integer(-1), INTEGER_8, resources.reslblFTPDisabled, Boolean.TRUE, "lblFTPDisabled", 125, 136, INTEGERS[7], new Short(tabIndex++), 226
});
- //FTP_STEP = new Integer(99);
+ //FTP_STEP = 99;
}
//else
@@ -853,19 +853,19 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
PROPNAMES_TXT,
new Object[]
{
- INTEGERS[2], "", "lnSaveSetting", new Integer(97), new Integer(151), INTEGERS[7], new Short(tabIndex++), new Integer(228)
+ INTEGERS[2], PropertyNames.EMPTY_STRING, "lnSaveSetting", 97, 151, INTEGERS[7], new Short(tabIndex++), 228
});
chkSaveSettings = insertCheckBox("chkSaveSettings", CHKSAVESETTINGS_ITEM_CHANGED,
PROPNAMES_CHKBOX,
new Object[]
{
- INTEGERS[9], HelpIds.getHelpIdString(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)
+ INTEGERS[9], HelpIds.getHelpIdString(HID7_CHK_SAVE), resources.reschkSaveSettings_value, "chkSaveSettings", 97, 157, new Short((short) 1), INTEGERS[7], new Short(tabIndex++), 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)
+ INTEGERS[8], resources.reslblSaveSettings_value, "lblSaveSettings", 107, 169, INTEGERS[7], new Short(tabIndex++), 45
});
cbSaveSettings = insertComboBox("txtSaveSettings", TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED, TXTSAVESETTINGS_TEXT_CHANGED,
new String[]
@@ -874,7 +874,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
},
new Object[]
{
- Boolean.TRUE, Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_SAVE), new Short((short) 14), "txtSaveSettings", new Integer(179), new Integer(167), INTEGERS[7], new Short(tabIndex++), new Integer(145)
+ Boolean.TRUE, Boolean.TRUE, INTEGER_12, HelpIds.getHelpIdString(HID7_TXT_SAVE), new Short((short) 14), "txtSaveSettings", 179, 167, INTEGERS[7], new Short(tabIndex++), 145
});
}
@@ -900,8 +900,8 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
/*for (int i = 0; i<8; i++)
imgIconsPrev[i] = insertImage("imgIconPrev" + i,
- new String[] { "BackgroundColor","Border",PropertyNames.PROPERTY_HEIGHT,PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, "Tabstop", PropertyNames.PROPERTY_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)});
+ new String[] { "BackgroundColor",PropertyNames.PROPERTY_BORDER,PropertyNames.PROPERTY_HEIGHT,PropertyNames.PROPERTY_IMAGEURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, "ScaleImage", PropertyNames.PROPERTY_STEP, "Tabstop", PropertyNames.PROPERTY_WIDTH},
+ new Object[] { new Integer(-1), new Short((short)0),14,"file:///c:/bludisk.gif", new Integer(97 + i * 20 + 7 ),147,Boolean.FALSE,INTEGERS[5],Boolean.FALSE,14});
*/
}
@@ -926,7 +926,7 @@ public abstract class WebWizardDialog extends WizardDialog implements WebWizardC
public String render(Object listItem)
{
- return listItem == null ? "" : ((CGLayout) listItem).cp_Name;
+ return listItem == null ? PropertyNames.EMPTY_STRING : ((CGLayout) listItem).cp_Name;
}
}
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGDesign.java b/wizards/com/sun/star/wizards/web/data/CGDesign.java
index 00c1ea10b949..4644eb96899f 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDesign.java
+++ b/wizards/com/sun/star/wizards/web/data/CGDesign.java
@@ -72,7 +72,7 @@ public class CGDesign extends ConfigGroup implements XMLProvider
public void setStyle(short[] newStyle)
{
- Object o = ((CGStyle) ((CGSettings) root).cp_Styles.getElementAt(newStyle[0]));
+ Object o = ((CGSettings) root).cp_Styles.getElementAt(newStyle[0]);
cp_Style = (String) ((CGSettings) root).cp_Styles.getKey(o);
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGDocument.java b/wizards/com/sun/star/wizards/web/data/CGDocument.java
index 765e49d1f6ee..e3612acf88f3 100644
--- a/wizards/com/sun/star/wizards/web/data/CGDocument.java
+++ b/wizards/com/sun/star/wizards/web/data/CGDocument.java
@@ -72,20 +72,20 @@ 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_Title = PropertyNames.EMPTY_STRING;
+ public String cp_Description = PropertyNames.EMPTY_STRING;
public String cp_URL;
- public String cp_Author = "";
+ public String cp_Author = PropertyNames.EMPTY_STRING;
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 String localFilename = PropertyNames.EMPTY_STRING;
+ public String urlFilename = PropertyNames.EMPTY_STRING;
+ public String title = PropertyNames.EMPTY_STRING;
+ public String description = PropertyNames.EMPTY_STRING;
+ public String author = PropertyNames.EMPTY_STRING;
public DateTime createDate;
public DateTime updateDate;
public int sizeBytes = -1;
@@ -124,7 +124,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
cp_URL = getSettings().getFileAccess(xmsf).getURL(url);
if (task == null)
{
- task = new Task("", "", 5);
+ task = new Task(PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING, 5);
}
validate(xmsf, task);
}
@@ -159,7 +159,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
task.advance(true); //2
- String path = getSettings().getFileAccess(xmsf).getPath(cp_URL, "");
+ String path = getSettings().getFileAccess(xmsf).getPath(cp_URL, PropertyNames.EMPTY_STRING);
localFilename = FileAccess.getFilename(path, File.separator);
/* if the type is a star office convertable document
@@ -177,8 +177,8 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
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();
+ XComponent component = UnoRuntime.queryInterface(XComponentLoader.class, desktop).loadComponentFromURL(cp_URL, "_default", 0, props);
+ xProps = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, component).getDocumentProperties();
}
task.advance(true); //4
@@ -202,23 +202,23 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
valid = true;
- if (cp_Title.equals(""))
+ if (cp_Title.equals(PropertyNames.EMPTY_STRING))
{
cp_Title = title;
}
- if (cp_Title.equals(""))
+ if (cp_Title.equals(PropertyNames.EMPTY_STRING))
{
cp_Title = localFilename;
}
- if (cp_Description.equals(""))
+ if (cp_Description.equals(PropertyNames.EMPTY_STRING))
{
cp_Description = description;
}
- if (cp_Author.equals(""))
+ if (cp_Author.equals(PropertyNames.EMPTY_STRING))
{
cp_Author = author;
}
- if (cp_Exporter == null || cp_Exporter.equals(""))
+ if (cp_Exporter == null || cp_Exporter.equals(PropertyNames.EMPTY_STRING))
{
cp_Exporter = (String) getSettings().cp_Exporters.getKey(
getSettings().getExporters(appType)[0]);
@@ -237,19 +237,19 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
}
String media = (mediaDesc == null)
- ? "" : (String) Properties.getPropertyValue(mediaDescriptor, PropertyNames.PROPERTY_NAME);
+ ? PropertyNames.EMPTY_STRING : (String) Properties.getPropertyValue(mediaDescriptor, PropertyNames.PROPERTY_NAME);
appType = getDocType(media);
//System.out.println(appType);
isSOOpenable =
- (appType == TypeDetection.WRITER_DOC || appType == TypeDetection.CALC_DOC || appType == TypeDetection.IMPRESS_DOC || appType == TypeDetection.DRAW_DOC) || appType == TypeDetection.HTML_DOC;
+ (appType.equals(TypeDetection.WRITER_DOC) || appType.equals(TypeDetection.CALC_DOC) || appType.equals(TypeDetection.IMPRESS_DOC) || appType.equals(TypeDetection.DRAW_DOC)) || appType.equals(TypeDetection.HTML_DOC);
// String[] parts = media.split("_"); // line removed because of compatibility to JDK13
String[] parts = JavaTools.ArrayoutofString(media, "_");
- isSODocument = parts.length < 2 ? false : isSOOpenable && (parts[1].startsWith("Star"));
+ isSODocument = parts.length >= 2 && isSOOpenable && (parts[1].startsWith("Star"));
}
@@ -260,7 +260,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
*/
private String getDocType(String media)
{
- if (media.equals(""))
+ if (media.equals(PropertyNames.EMPTY_STRING))
{
return TypeDetection.NO_TYPE;
}
@@ -317,16 +317,16 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
},
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) : "",
+ d.cp_DisplayTitle ? cp_Title : PropertyNames.EMPTY_STRING,
+ d.cp_DisplayDescription ? cp_Description : PropertyNames.EMPTY_STRING,
+ d.cp_DisplayAuthor ? cp_Author : PropertyNames.EMPTY_STRING,
+ d.cp_DisplayFileFormat ? getTargetTypeName(exp) : PropertyNames.EMPTY_STRING,
+ d.cp_DisplayFilename ? localFilename : PropertyNames.EMPTY_STRING,
+ d.cp_DisplayCreateDate ? createDate() : PropertyNames.EMPTY_STRING,
+ d.cp_DisplayUpdateDate ? updateDate() : PropertyNames.EMPTY_STRING,
+ d.cp_DisplayPages && (pages > -1) ? PropertyNames.EMPTY_STRING + pages() : PropertyNames.EMPTY_STRING, //TODO when do i calculate pages?
+ d.cp_DisplaySize ? sizeKB() : PropertyNames.EMPTY_STRING,//TODO when do i calculate size?
+ d.cp_DisplayFormatIcon ? getIcon(exp) : PropertyNames.EMPTY_STRING,
dirName, urlFilename
});
}
@@ -335,7 +335,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
{
if (this.updateDate == null)
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
return getSettings().formatter.formatCreated(this.updateDate);
}
@@ -344,7 +344,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
{
if (this.createDate == null)
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
return getSettings().formatter.formatCreated(this.createDate);
}
@@ -353,7 +353,7 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
{
if (sizeBytes == -1)
{
- return "";
+ return PropertyNames.EMPTY_STRING;
}
else
{
@@ -363,8 +363,8 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
private String pages()
{
- return pages == -1 ? ""
- : JavaTools.replaceSubString(pagesTemplate(), "" + pages, "%NUMBER");
+ return pages == -1 ? PropertyNames.EMPTY_STRING
+ : JavaTools.replaceSubString(pagesTemplate(), PropertyNames.EMPTY_STRING + pages, "%NUMBER");
}
private String pagesTemplate()
@@ -373,26 +373,26 @@ public class CGDocument extends ConfigSetItem implements XMLProvider
switch (pagesType)
{
case PAGE_TYPE_UNKNOWN:
- return "";
+ return PropertyNames.EMPTY_STRING;
case PAGE_TYPE_PAGE:
return getSettings().resources[CGSettings.RESOURCE_PAGES_TEMPLATE];
case PAGE_TYPE_SLIDE:
return getSettings().resources[CGSettings.RESOURCE_SLIDES_TEMPLATE];
default:
- return "";
+ return PropertyNames.EMPTY_STRING;
}
}
private String getTargetTypeName(CGExporter exp)
{
- return (exp.targetTypeName.equals(""))
+ return (exp.targetTypeName.equals(PropertyNames.EMPTY_STRING))
? (String) Properties.getPropertyValue(mediaDescriptor, "UIName")
: exp.targetTypeName;
}
private String getIcon(CGExporter exporter)
{
- return exporter.cp_Icon.equals("") ? getIcon(this.appType) : exporter.cp_Icon;
+ return exporter.cp_Icon.equals(PropertyNames.EMPTY_STRING) ? getIcon(this.appType) : exporter.cp_Icon;
}
private String getIcon(String appType)
diff --git a/wizards/com/sun/star/wizards/web/data/CGExporter.java b/wizards/com/sun/star/wizards/web/data/CGExporter.java
index c23073fbed01..0ee8ec894dc0 100644
--- a/wizards/com/sun/star/wizards/web/data/CGExporter.java
+++ b/wizards/com/sun/star/wizards/web/data/CGExporter.java
@@ -27,6 +27,7 @@
package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.ConfigSet;
+import com.sun.star.wizards.common.PropertyNames;
public class CGExporter extends ConfigSetItem
{
@@ -42,7 +43,7 @@ public class CGExporter extends ConfigSetItem
public String cp_TargetType;
public boolean cp_Binary;
public int cp_PageType;
- public String targetTypeName = "";
+ public String targetTypeName = PropertyNames.EMPTY_STRING;
public ConfigSet cp_Arguments = new ConfigSet(CGArgument.class);
public String toString()
@@ -52,6 +53,6 @@ public class CGExporter extends ConfigSetItem
public boolean supports(String mime)
{
- return (cp_SupportedMimeTypes.equals("") || cp_SupportedMimeTypes.indexOf(mime) > -1);
+ return (cp_SupportedMimeTypes.equals(PropertyNames.EMPTY_STRING) || cp_SupportedMimeTypes.indexOf(mime) > -1);
}
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGPublish.java b/wizards/com/sun/star/wizards/web/data/CGPublish.java
index 1a3746a3873d..51e53fca6da6 100644
--- a/wizards/com/sun/star/wizards/web/data/CGPublish.java
+++ b/wizards/com/sun/star/wizards/web/data/CGPublish.java
@@ -27,6 +27,7 @@
package com.sun.star.wizards.web.data;
import com.sun.star.wizards.common.ConfigGroup;
+import com.sun.star.wizards.common.PropertyNames;
/**
*
@@ -82,13 +83,13 @@ public class CGPublish extends ConfigGroup
catch (Exception e)
{
e.printStackTrace();
- return "";
+ return PropertyNames.EMPTY_STRING;
}
}
private String ftpURL()
{
return "ftp://" + cp_Username +
- ((password != null && password.length() > 0) ? ":" + password : "") + "@" + cp_URL.substring(7);
+ ((password != null && password.length() > 0) ? ":" + password : PropertyNames.EMPTY_STRING) + "@" + cp_URL.substring(7);
}
}
diff --git a/wizards/com/sun/star/wizards/web/data/CGSettings.java b/wizards/com/sun/star/wizards/web/data/CGSettings.java
index ecc538b9fa83..60e711c3c2ae 100644
--- a/wizards/com/sun/star/wizards/web/data/CGSettings.java
+++ b/wizards/com/sun/star/wizards/web/data/CGSettings.java
@@ -83,8 +83,8 @@ public class CGSettings extends ConfigGroup
xmsf = xmsf_;
try
{
- soTemplateDir = FileAccess.getOfficePath(xmsf, "Config", "", "");
- soGalleryDir = FileAccess.getOfficePath(xmsf, "Gallery", "share", "");
+ soTemplateDir = FileAccess.getOfficePath(xmsf, "Config", PropertyNames.EMPTY_STRING, PropertyNames.EMPTY_STRING);
+ soGalleryDir = FileAccess.getOfficePath(xmsf, "Gallery", "share", PropertyNames.EMPTY_STRING);
root = this;
formatter = new Formatter(xmsf, document);
resources = resources_;
@@ -124,7 +124,7 @@ public class CGSettings extends ConfigGroup
}
}
}
- return (CGExporter[]) v.toArray(EMPTY_ARRAY_1);
+ return (CGExporter[]) v.toArray(new CGExporter[v.size()]);
}
/**
@@ -141,7 +141,7 @@ public class CGSettings extends ConfigGroup
private void calcExportersTargetTypeNames(XMultiServiceFactory xmsf) throws Exception
{
Object typeDetect = xmsf.createInstance("com.sun.star.document.TypeDetection");
- XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
+ XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, typeDetect);
for (int i = 0; i < cp_Exporters.getSize(); i++)
{
calcExporterTargetTypeName(xNameAccess, (CGExporter) cp_Exporters.getElementAt(i));
@@ -152,7 +152,7 @@ public class CGSettings extends ConfigGroup
throws NoSuchElementException,
WrappedTargetException
{
- if (!exporter.cp_TargetType.equals(""))
+ if (!exporter.cp_TargetType.equals(PropertyNames.EMPTY_STRING))
{
exporter.targetTypeName =
(String) Properties.getPropertyValue(
diff --git a/wizards/com/sun/star/wizards/web/data/CGStyle.java b/wizards/com/sun/star/wizards/web/data/CGStyle.java
index e6258d8c5fe1..c268e568ae03 100644
--- a/wizards/com/sun/star/wizards/web/data/CGStyle.java
+++ b/wizards/com/sun/star/wizards/web/data/CGStyle.java
@@ -26,6 +26,8 @@
************************************************************************/
package com.sun.star.wizards.web.data;
+import com.sun.star.wizards.common.PropertyNames;
+
public class CGStyle extends ConfigSetItem
{
@@ -42,7 +44,7 @@ public class CGStyle extends ConfigSetItem
public String getBackgroundUrl()
{
- if (cp_BackgroundImage == null || cp_BackgroundImage.equals(""))
+ if (cp_BackgroundImage == null || cp_BackgroundImage.equals(PropertyNames.EMPTY_STRING))
{
return null;
}
diff --git a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java
index 97b1109add01..4f35c69e935b 100644
--- a/wizards/com/sun/star/wizards/web/export/AbstractExporter.java
+++ b/wizards/com/sun/star/wizards/web/export/AbstractExporter.java
@@ -73,7 +73,7 @@ public abstract class AbstractExporter implements Exporter
{
props.put("FilterData", filterData);
}
- XStorable xs = ((XStorable) UnoRuntime.queryInterface(XStorable.class, officeDocument));
+ XStorable xs = UnoRuntime.queryInterface(XStorable.class, officeDocument);
PropertyValue[] o = props.getProperties();
xs.storeToURL(targetUrl, o);
}
@@ -110,7 +110,7 @@ public abstract class AbstractExporter implements Exporter
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());
+ document = UnoRuntime.queryInterface(XComponentLoader.class, desktop).loadComponentFromURL(doc.cp_URL, "_blank", 0, props.getProperties());
}
catch (com.sun.star.lang.IllegalArgumentException iaex)
{
@@ -134,7 +134,7 @@ public abstract class AbstractExporter implements Exporter
(XComponent) UnoRuntime.queryInterface(XComponent.class, doc));*/
try
{
- XCloseable xc = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, doc);
+ XCloseable xc = UnoRuntime.queryInterface(XCloseable.class, doc);
xc.close(false);
}
catch (Exception ex)
diff --git a/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java b/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java
index 698bf7f44c53..474ec34e3980 100644
--- a/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java
+++ b/wizards/com/sun/star/wizards/web/export/ImpressHTMLExporter.java
@@ -42,9 +42,9 @@ import com.sun.star.wizards.web.data.CGSession;
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);
+ private static final Integer SMALL_IMAGE = 512;
+ private static final Integer MEDIUM_IMAGE = 640;
+ private static final Integer LARGE_IMAGE = 800;
public boolean export(CGDocument source, String targetDirectory, XMultiServiceFactory xmsf, Task task) throws IOException
{
diff --git a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
index 7b3514a850ef..74a5b8073af6 100644
--- a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
+++ b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
@@ -133,8 +133,8 @@ public:
sal_Bool bReadOnly, const ::rtl::OUString& sODFVersion, bool bHasDocumentSignature);
~DigitalSignaturesDialog();
- // Initialize the dialog and the security environment, returns sal_True on success
- sal_Bool Init( const rtl::OUString& rTokenName );
+ // Initialize the dialog and the security environment, returns TRUE on success
+ sal_Bool Init();
// Set the storage which should be signed or verified
void SetStorage( const cssu::Reference < css::embed::XStorage >& rxStore );
diff --git a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
index 9e416fe37d0f..d0d3bbe8d012 100644
--- a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
+++ b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
@@ -133,10 +133,9 @@ public:
XMLSignatureHelper(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& mrCtx );
~XMLSignatureHelper();
- // Initialize the security context with given crypto token.
- // Empty string means default crypto token.
- // Returns true for success.
- bool Init( const rtl::OUString& rTokenPath );
+ // Initialize the security context with default crypto token.
+ // Returns true for success.
+ bool Init();
// Set UriBinding to create input streams to open files.
// Default implementation is capable to open files from disk.
diff --git a/xmlsecurity/prj/build.lst b/xmlsecurity/prj/build.lst
index f6d9305ec5ad..422f4a43b65d 100644
--- a/xmlsecurity/prj/build.lst
+++ b/xmlsecurity/prj/build.lst
@@ -1,4 +1,4 @@
-xs xmlsecurity : TRANSLATIONS:translations xmloff unotools offapi unoil svx MOZ:moz LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt NULL
+xs xmlsecurity : TRANSLATIONS:translations xmloff unotools offapi unoil svx MOZ:moz LIBXMLSEC:libxmlsec NSS:nss LIBXSLT:libxslt NEON:neon NULL
xs xmlsecurity usr1 - all xs_mkout NULL
xs xmlsecurity\inc nmake - all xs_inc NULL
xs xmlsecurity\source\framework nmake - all xs_fw xs_inc NULL
@@ -9,3 +9,4 @@ xs xmlsecurity\source\helper nmake - al
xs xmlsecurity\source\dialogs nmake - all xs_dialogs xs_inc NULL
xs xmlsecurity\source\component nmake - all xs_component xs_inc NULL
xs xmlsecurity\util nmake - all xs_util xs_fw xs_xmlsec xs_nss xs_mscrypt xs_helper xs_dialogs xs_component NULL
+xs xmlsecurity\qa\certext nmake - all xs_certext xs_util NULL
diff --git a/xmlsecurity/qa/certext/SanCertExt.cxx b/xmlsecurity/qa/certext/SanCertExt.cxx
new file mode 100644
index 000000000000..11d3fa62d5a5
--- /dev/null
+++ b/xmlsecurity/qa/certext/SanCertExt.cxx
@@ -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.
+*
+************************************************************************/
+
+#include "precompiled_xmlsecurity.hxx"
+#include "sal/config.h"
+#include "test/officeconnection.hxx"
+
+#include <com/sun/star/security/XSanExtension.hpp>
+#include <com/sun/star/security/ExtAltNameType.hpp>
+#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
+#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
+#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
+#include <com/sun/star/security/XCertificate.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+
+#include "cppuhelper/bootstrap.hxx"
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
+#include "sal/types.h"
+#include "comphelper/sequence.hxx"
+#include <rtl/ustring.hxx>
+
+#include <neon/ne_ssl.h>
+
+using namespace com::sun::star;
+
+#define OID_SUBJECT_ALTERNATIVE_NAME "2.5.29.17"
+#define SEINITIALIZER_COMPONENT "com.sun.star.xml.crypto.SEInitializer"
+
+
+namespace {
+
+ class Test: public CppUnit::TestFixture {
+
+ private:
+ static uno::Sequence< security::CertAltNameEntry > altNames;
+ static bool runOnce;
+
+ uno::Reference< xml::crypto::XSecurityEnvironment > initUno();
+ void init();
+ rtl::OString getB64CertFromFile(const char filename[]);
+ test::OfficeConnection connection_;
+
+ public:
+
+ Test();
+
+ ~Test();
+
+ virtual void setUp();
+
+ virtual void tearDown();
+
+ void test_Others();
+
+ void test_RFC822();
+
+ void test_DNS();
+
+ void test_Direcory();
+
+ void test_URI();
+
+ void test_IP();
+
+ void test_RID();
+
+ void test_EDI();
+
+ void test_X400();
+
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(test_Others);
+ CPPUNIT_TEST(test_RFC822);
+ CPPUNIT_TEST(test_DNS);
+ CPPUNIT_TEST(test_Direcory);
+ CPPUNIT_TEST(test_URI);
+ CPPUNIT_TEST(test_IP);
+ CPPUNIT_TEST(test_RID);
+ CPPUNIT_TEST(test_EDI);
+ CPPUNIT_TEST(test_X400);
+ CPPUNIT_TEST_SUITE_END();
+ };
+
+ uno::Sequence< security::CertAltNameEntry > Test::altNames;
+ bool Test::runOnce = false;
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+ Test::Test()
+ {
+ if (runOnce)
+ return;
+ runOnce = true;
+ connection_.setUp();
+ init();
+ }
+
+ Test::~Test()
+ {
+ if (runOnce)
+ {
+ connection_.tearDown();
+ runOnce = false;
+ }
+ }
+
+
+ uno::Reference< xml::crypto::XSecurityEnvironment > Test::initUno()
+ {
+ uno::Reference< uno::XComponentContext > context(connection_.getComponentContext(), uno::UNO_QUERY_THROW);
+ uno::Reference< lang::XMultiServiceFactory > factory(context->getServiceManager(), uno::UNO_QUERY_THROW);
+ uno::Reference< xml::crypto::XSEInitializer > xSEInitializer(factory->createInstance(
+ rtl::OUString::createFromAscii( SEINITIALIZER_COMPONENT )), uno::UNO_QUERY_THROW);
+ uno::Reference< xml::crypto::XXMLSecurityContext > xSecurityContext(
+ xSEInitializer->createSecurityContext(rtl::OUString()));
+ return xSecurityContext->getSecurityEnvironment();
+ }
+
+
+ void Test::init()
+ {
+ uno::Reference< xml::crypto::XSecurityEnvironment > xSecurityEnv = initUno();
+ rtl::OString b64Cert(getB64CertFromFile("User_35_Root_11.crt"));
+ uno::Reference< security::XCertificate > xCert = xSecurityEnv->createCertificateFromAscii(
+ rtl::OStringToOUString( b64Cert, RTL_TEXTENCODING_ASCII_US ) );
+ uno::Sequence< uno::Reference< security::XCertificateExtension > > extensions = xCert->getExtensions();
+ for (sal_Int32 i = 0 ; i < extensions.getLength(); i++)
+ {
+ uno::Reference< security::XCertificateExtension >element = extensions[i];
+ rtl::OString aId ( (const sal_Char *)element->getExtensionId().getArray(), element->getExtensionId().getLength());
+ if (aId.equals(OID_SUBJECT_ALTERNATIVE_NAME))
+ {
+ uno::Reference< security::XSanExtension > sanExtension ( element, uno::UNO_QUERY );
+ altNames = sanExtension->getAlternativeNames();
+ break;
+ }
+ }
+ }
+
+ rtl::OString Test::getB64CertFromFile(const char filename[])
+ {
+ ne_ssl_certificate* cert = ne_ssl_cert_read(filename);
+ char* certExportB64 = ne_ssl_cert_export(cert);
+ rtl::OString certB64( certExportB64 );
+ return certB64;
+ }
+
+
+ void Test::setUp() {
+ }
+
+ void Test::tearDown() {
+ }
+
+ void Test::test_Others() {
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
+ for(int n = 1; n < altNames.getLength(); n++)
+ {
+ if (altNames[n].Type == security::ExtAltNameType_OTHER_NAME)
+ {
+ ::com::sun::star::beans::NamedValue otherNameProp;
+ if (altNames[n].Value >>= otherNameProp)
+ {
+ CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("1.2.3.4"), otherNameProp.Name);
+ uno::Sequence< sal_Int8 > ipAddress;
+ otherNameProp.Value >>= ipAddress;
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( ipAddress.getLength() > 0 ) );
+ }
+ }
+ }
+ }
+
+ void Test::test_RFC822() {
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
+ for(int n = 1; n < altNames.getLength(); n++)
+ {
+ if (altNames[n].Type == security::ExtAltNameType_RFC822_NAME)
+ {
+ rtl::OUString value;
+ altNames[n].Value >>= value;
+ CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("my@other.address"), value);
+ }
+ }
+ }
+
+ void Test::test_DNS() {
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
+ for(int n = 1; n < altNames.getLength(); n++)
+ {
+ if (altNames[n].Type == security::ExtAltNameType_DNS_NAME)
+ {
+ rtl::OUString value;
+ altNames[n].Value >>= value;
+ CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("alt.openoffice.org"), value);
+ }
+ }
+ }
+
+ void Test::test_Direcory() {
+ // Not implemented
+ }
+
+ void Test::test_URI() {
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
+ for(int n = 1; n < altNames.getLength(); n++)
+ {
+ if (altNames[n].Type == security::ExtAltNameType_URL)
+ {
+ rtl::OUString value;
+ altNames[n].Value >>= value;
+ CPPUNIT_ASSERT_EQUAL( rtl::OUString::createFromAscii("http://my.url.here/"), value);
+ }
+ }
+ }
+
+ void Test::test_IP() {
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
+ for(int n = 1; n < altNames.getLength(); n++)
+ {
+ if (altNames[n].Type == security::ExtAltNameType_IP_ADDRESS)
+ {
+ uno::Sequence< sal_Int8 > ipAddress;
+ altNames[n].Value >>= ipAddress;
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( ipAddress.getLength() > 0 ) );
+ }
+ }
+
+ }
+
+ void Test::test_RID() {
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( altNames.getLength() > 0 ) );
+ for(int n = 1; n < altNames.getLength(); n++)
+ {
+ if (altNames[n].Type == security::ExtAltNameType_REGISTERED_ID)
+ {
+ rtl::OUString value;
+ altNames[n].Value >>= value;
+ CPPUNIT_ASSERT( rtl::OUString::createFromAscii("1.2.3.4").equals(value));
+ }
+ }
+ }
+
+ void Test::test_EDI() {
+ // Not implemented
+ }
+
+ void Test::test_X400() {
+ // Not implemented
+ }
+}
+CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmlsecurity/qa/certext/User_35_Root_11.crt b/xmlsecurity/qa/certext/User_35_Root_11.crt
new file mode 100644
index 000000000000..6902605756af
--- /dev/null
+++ b/xmlsecurity/qa/certext/User_35_Root_11.crt
@@ -0,0 +1,64 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 4130 (0x1022)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=Root 11
+ Validity
+ Not Before: Nov 8 10:51:39 2010 GMT
+ Not After : Nov 8 10:51:39 2011 GMT
+ Subject: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=User 35
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:9b:36:00:64:f3:ce:93:97:62:19:fa:78:d9:6f:
+ 92:6a:b9:d2:9a:4e:06:2c:02:52:cd:93:50:84:28:
+ 19:42:a2:4a:34:e2:cd:e6:b0:39:7a:c8:4d:84:bc:
+ 71:51:ed:5d:6c:7e:f9:cc:01:5a:4b:73:50:a9:3b:
+ 5d:ad:cc:89:f7:dc:e0:dd:0a:ff:48:01:a9:34:19:
+ c0:6a:ee:4b:20:f4:cf:3c:94:c1:ae:88:0f:c9:42:
+ 1a:a6:47:31:fe:37:04:00:bb:ec:07:5f:cb:ee:70:
+ c4:c7:7c:6f:ee:03:19:76:de:0b:df:d0:48:91:67:
+ 55:9b:90:91:f4:ce:56:04:d5
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage:
+ Digital Signature, Non Repudiation, Key Encipherment
+ X509v3 Subject Key Identifier:
+ 91:47:AC:29:95:5D:EF:72:14:8F:82:45:07:E2:94:49:75:C6:7D:73
+ X509v3 Authority Key Identifier:
+ keyid:E8:6A:BB:C2:90:EA:6C:70:22:3E:F6:F6:48:1B:03:E6:BE:B7:A6:55
+
+ X509v3 Subject Alternative Name:
+ DNS:alt.openoffice.org, IP Address:192.168.7.1, IP Address:13:0:0:0:0:0:0:17, email:my@other.address, Registered ID:1.2.3.4, othername:<unsupported>, DirName:/C=DE/O=OpenOffice.org/OU=Development/CN=User 32 Root 11, URI:http://my.url.here/
+ Signature Algorithm: sha1WithRSAEncryption
+ 6e:80:e6:1e:86:3d:d2:65:a6:17:fa:80:2d:2e:dc:85:32:05:
+ a1:69:82:e1:79:d1:dc:de:69:cd:9e:f0:cc:90:75:a9:45:ee:
+ 73:46:fe:29:69:c0:99:bb:fc:3a:db:c0:5f:69:c6:b7:ea:9a:
+ 63:b2:8e:29:2c:a5:5a:88:88:94:75:4b:ab:0a:72:f6:3a:aa:
+ 5d:6b:3a:5c:b6:9b:57:f5:c1:51:af:df:3c:a6:8a:a3:da:70:
+ 66:61:49:12:06:78:98:9f:bc:78:3c:43:6d:08:94:aa:32:b6:
+ f3:cc:af:0d:29:fe:96:47:7d:fe:4a:61:48:90:11:0b:bd:0f:
+ a0:fd
+-----BEGIN CERTIFICATE-----
+MIIDajCCAtOgAwIBAgICECIwDQYJKoZIhvcNAQEFBQAwYDELMAkGA1UEBhMCREUx
+EDAOBgNVBAgTB0hhbWJ1cmcxFzAVBgNVBAoTDk9wZW5PZmZpY2Uub3JnMRQwEgYD
+VQQLEwtEZXZlbG9wbWVudDEQMA4GA1UEAxMHUm9vdCAxMTAeFw0xMDExMDgxMDUx
+MzlaFw0xMTExMDgxMDUxMzlaMGAxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdIYW1i
+dXJnMRcwFQYDVQQKEw5PcGVuT2ZmaWNlLm9yZzEUMBIGA1UECxMLRGV2ZWxvcG1l
+bnQxEDAOBgNVBAMTB1VzZXIgMzUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
+AJs2AGTzzpOXYhn6eNlvkmq50ppOBiwCUs2TUIQoGUKiSjTizeawOXrITYS8cVHt
+XWx++cwBWktzUKk7Xa3Miffc4N0K/0gBqTQZwGruSyD0zzyUwa6ID8lCGqZHMf43
+BAC77Adfy+5wxMd8b+4DGXbeC9/QSJFnVZuQkfTOVgTVAgMBAAGjggExMIIBLTAL
+BgNVHQ8EBAMCBeAwHQYDVR0OBBYEFJFHrCmVXe9yFI+CRQfilEl1xn1zMB8GA1Ud
+IwQYMBaAFOhqu8KQ6mxwIj729kgbA+a+t6ZVMIHdBgNVHREEgdUwgdKCEmFsdC5v
+cGVub2ZmaWNlLm9yZ4cEwKgHAYcQABMAAAAAAAAAAAAAAAAAF4EQbXlAb3RoZXIu
+YWRkcmVzc4gDKgMEoB4GAyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKkWDBW
+MQswCQYDVQQGEwJERTEXMBUGA1UEChMOT3Blbk9mZmljZS5vcmcxFDASBgNVBAsT
+C0RldmVsb3BtZW50MRgwFgYDVQQDEw9Vc2VyIDMyIFJvb3QgMTGGE2h0dHA6Ly9t
+eS51cmwuaGVyZS8wDQYJKoZIhvcNAQEFBQADgYEAboDmHoY90mWmF/qALS7chTIF
+oWmC4XnR3N5pzZ7wzJB1qUXuc0b+KWnAmbv8OtvAX2nGt+qaY7KOKSylWoiIlHVL
+qwpy9jqqXWs6XLabV/XBUa/fPKaKo9pwZmFJEgZ4mJ+8eDxDbQiUqjK288yvDSn+
+lkd9/kphSJARC70PoP0=
+-----END CERTIFICATE-----
diff --git a/extensions/source/svg/makefile.mk b/xmlsecurity/qa/certext/export.map
index c46aede54920..3308588ef6f8 100644
--- a/extensions/source/svg/makefile.mk
+++ b/xmlsecurity/qa/certext/export.map
@@ -1,7 +1,7 @@
#*************************************************************************
#
# 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
@@ -25,43 +25,10 @@
#
#*************************************************************************
-PRJ=..$/..
-PRJNAME=extensions
-TARGET=svg
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings ----------------------------------
-
-.INCLUDE : $(PRJ)$/util$/makefile.pmk
-
-# --- Files -------------------------------------
-
-SLOFILES= $(SLO)$/svgprinter.obj \
- $(SLO)$/svguno.obj \
- $(SLO)$/svgwriter.obj \
- $(SLO)$/svgaction.obj
-
-# --- Library -----------------------------------
-
-SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
-SHL1IMPLIB=i$(SHL1TARGET)
-
-SHL1VERSIONMAP=$(SOLARENV)/src/component.map
-SHL1DEF=$(MISC)$/$(SHL1TARGET).def
-DEF1NAME=$(SHL1TARGET)
-
-SHL1STDLIBS=\
- $(XMLOFFLIB) \
- $(VCLLIB) \
- $(TOOLSLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB)
-
-SHL1LIBS= $(SLB)$/$(TARGET).lib
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
+UDK_3_0_0 {
+ global:
+ cppunitTestPlugIn;
+ local:
+ *;
+};
diff --git a/xmlsecurity/qa/certext/makefile.mk b/xmlsecurity/qa/certext/makefile.mk
new file mode 100644
index 000000000000..8cf90b4b4750
--- /dev/null
+++ b/xmlsecurity/qa/certext/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.
+#
+#***********************************************************************/
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../..
+PRJNAME = xmlsecurity
+TARGET = qa_certext
+
+ENABLE_EXCEPTIONS = TRUE
+
+.INCLUDE: settings.mk
+.INCLUDE : $(PRJ)$/util$/target.pmk
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLOFILES)
+SHL1RPATH = NONE
+SHL1STDLIBS = $(CPPUNITLIB) \
+ $(SALLIB) \
+ $(NEON3RDLIB) \
+ $(CPPULIB) \
+ $(XMLOFFLIB) \
+ $(CPPUHELPERLIB) \
+ $(SVLLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(TESTLIB)
+
+SHL1TARGET = qa_CertExt
+SHL1VERSIONMAP = $(PRJ)/qa/certext/export.map
+DEF1NAME = $(SHL1TARGET)
+
+SLOFILES = $(SLO)/SanCertExt.obj
+
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : cpptest
+
+cpptest : $(SHL1TARGETN)
+
+CPPTEST_LIBRARY = $(SHL1TARGETN)
+
+.END \ No newline at end of file
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 89401fab3b1e..cd6a451b1109 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -221,7 +221,7 @@ sal_Bool DocumentDigitalSignatures::ImplViewSignatures(
sal_Bool bChanges = sal_False;
DigitalSignaturesDialog aSignaturesDialog(
NULL, mxCtx, eMode, bReadOnly, m_sODFVersion, m_bHasDocumentSignature);
- bool bInit = aSignaturesDialog.Init( rtl::OUString() );
+ bool bInit = aSignaturesDialog.Init();
DBG_ASSERT( bInit, "Error initializing security context!" );
if ( bInit )
{
@@ -277,7 +277,7 @@ DocumentDigitalSignatures::ImplVerifySignatures(
XMLSignatureHelper aSignatureHelper( mxCtx );
- bool bInit = aSignatureHelper.Init( rtl::OUString() );
+ bool bInit = aSignatureHelper.Init();
DBG_ASSERT( bInit, "Error initializing security context!" );
@@ -380,7 +380,7 @@ void DocumentDigitalSignatures::manageTrustedSources( ) throw (RuntimeException
Reference< dcss::xml::crypto::XSecurityEnvironment > xSecEnv;
XMLSignatureHelper aSignatureHelper( mxCtx );
- if ( aSignatureHelper.Init( rtl::OUString() ) )
+ if ( aSignatureHelper.Init() )
xSecEnv = aSignatureHelper.GetSecurityEnvironment();
MacroSecurity aDlg( NULL, mxCtx, xSecEnv );
@@ -392,7 +392,7 @@ void DocumentDigitalSignatures::showCertificate(
{
XMLSignatureHelper aSignatureHelper( mxCtx );
- bool bInit = aSignatureHelper.Init( rtl::OUString() );
+ bool bInit = aSignatureHelper.Init();
DBG_ASSERT( bInit, "Error initializing security context!" );
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index d9def4cb80bb..ac9cd08082ff 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -259,9 +259,9 @@ DigitalSignaturesDialog::~DigitalSignaturesDialog()
{
}
-sal_Bool DigitalSignaturesDialog::Init( const rtl::OUString& rTokenName )
+sal_Bool DigitalSignaturesDialog::Init()
{
- bool bInit = maSignatureHelper.Init( rTokenName );
+ bool bInit = maSignatureHelper.Init();
DBG_ASSERT( bInit, "Error initializing security context!" );
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index 4e74ffd8877b..22a41bb3f4df 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -70,11 +70,9 @@ XMLSignatureHelper::XMLSignatureHelper( const uno::Reference< uno::XComponentCon
XMLSignatureHelper::~XMLSignatureHelper()
{
- if ( mxSEInitializer.is() && mxSecurityContext.is() )
- mxSEInitializer->freeSecurityContext( mxSecurityContext );
}
-bool XMLSignatureHelper::Init( const rtl::OUString& rTokenPath )
+bool XMLSignatureHelper::Init()
{
DBG_ASSERT( !mxSEInitializer.is(), "XMLSignatureHelper::Init - mxSEInitializer already set!" );
DBG_ASSERT( !mxSecurityContext.is(), "XMLSignatureHelper::Init - mxSecurityContext already set!" );
@@ -82,7 +80,7 @@ bool XMLSignatureHelper::Init( const rtl::OUString& rTokenPath )
ImplCreateSEInitializer();
if ( mxSEInitializer.is() )
- mxSecurityContext = mxSEInitializer->createSecurityContext( rTokenPath );
+ mxSecurityContext = mxSEInitializer->createSecurityContext( ::rtl::OUString() );
return mxSecurityContext.is();
}
@@ -402,7 +400,6 @@ sal_Int32 XMLSignatureHelper::GetSecurityEnvironmentNumber()
return (mxSecurityContext.is()?(mxSecurityContext->getSecurityEnvironmentNumber()): 0);
}
-
IMPL_LINK( XMLSignatureHelper, SignatureCreationResultListener, XMLSignatureCreationResult*, pResult )
{
maCreationResults.insert( maCreationResults.begin() + maCreationResults.size(), *pResult );
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
index 9a073f141cd5..fed623cb22b1 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
@@ -32,6 +32,7 @@
#include <xmlsecurity/xmlsignaturehelper.hxx>
#include <xmlsignaturehelper2.hxx>
+#include <tools/solar.h>
#include <unotools/streamhelper.hxx>
#include <com/sun/star/embed/XStorage.hpp>
diff --git a/xmlsecurity/source/xmlsec/makefile.mk b/xmlsecurity/source/xmlsec/makefile.mk
index 44b668b84765..36b30f4f25a3 100644
--- a/xmlsecurity/source/xmlsec/makefile.mk
+++ b/xmlsecurity/source/xmlsec/makefile.mk
@@ -49,11 +49,11 @@ CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS)
.ENDIF
.IF "$(CRYPTO_ENGINE)" == "mscrypto"
-CDEFS += -DXMLSEC_CRYPTO_MSCRYPTO -DXMLSEC_NO_XSLT
-.ELSE
-CDEFS += -DXMLSEC_CRYPTO_NSS -DXMLSEC_NO_XSLT
+CDEFS += -DXMLSEC_CRYPTO_MSCRYPTO
.ENDIF
+CDEFS += -DXMLSEC_NO_XSLT
+
# --- Files --------------------------------------------------------
SLOFILES = \
$(SLO)$/biginteger.obj \
diff --git a/xmlsecurity/source/xmlsec/mscrypt/makefile.mk b/xmlsecurity/source/xmlsec/mscrypt/makefile.mk
index 20153edf18e6..2287266de3fa 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/makefile.mk
+++ b/xmlsecurity/source/xmlsec/mscrypt/makefile.mk
@@ -63,7 +63,8 @@ SLOFILES = \
$(SLO)$/xmlsignature_mscryptimpl.obj \
$(SLO)$/x509certificate_mscryptimpl.obj \
$(SLO)$/seinitializer_mscryptimpl.obj \
- $(SLO)$/xsec_mscrypt.obj
+ $(SLO)$/xsec_mscrypt.obj \
+ $(SLO)$/sanextension_mscryptimpl.obj
.ENDIF
diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx
new file mode 100644
index 000000000000..9c47a853d470
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlsecurity.hxx"
+#include <sal/config.h>
+#include <rtl/uuid.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/security/ExtAltNameType.hpp>
+#include <com/sun/star/security/CertAltNameEntry.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/sequence.hxx>
+
+
+#ifndef _SANEXTENSION_MSCRYPTIMPL_HXX_
+#include "sanextension_mscryptimpl.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::security ;
+using ::rtl::OUString ;
+
+using ::com::sun::star::security::XCertificateExtension ;
+
+
+SanExtensionImpl :: SanExtensionImpl() :
+ m_critical( sal_False )
+{
+}
+
+SanExtensionImpl :: ~SanExtensionImpl() {
+}
+
+
+//Methods from XCertificateExtension
+sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_critical ;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_xExtnId ;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_xExtnValue ;
+}
+
+//Methods from XSanExtension
+::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL SanExtensionImpl :: getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ){
+
+ if (!m_Entries.hasElements())
+ {
+ CERT_ALT_NAME_INFO *subjectName;
+ DWORD size;
+ CryptDecodeObjectEx(X509_ASN_ENCODING, X509_ALTERNATE_NAME, (unsigned char*) m_xExtnValue.getArray(), m_xExtnValue.getLength(), CRYPT_DECODE_ALLOC_FLAG | CRYPT_DECODE_NOCOPY_FLAG, NULL,&subjectName, &size);
+
+ CertAltNameEntry* arrCertAltNameEntry = new CertAltNameEntry[subjectName->cAltEntry];
+
+ for (unsigned int i = 0; i < (unsigned int)subjectName->cAltEntry; i++){
+ PCERT_ALT_NAME_ENTRY pEntry = &subjectName->rgAltEntry[i];
+
+ switch(pEntry->dwAltNameChoice) {
+ case CERT_ALT_NAME_OTHER_NAME :
+ {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_OTHER_NAME;
+ PCERT_OTHER_NAME pOtherName = pEntry->pOtherName;
+
+ ::com::sun::star::beans::NamedValue otherNameProp;
+ otherNameProp.Name = ::rtl::OUString::createFromAscii(pOtherName->pszObjId);
+
+ Sequence< sal_Int8 > otherName( pOtherName->Value.cbData ) ;
+ for( unsigned int n = 0; n < (unsigned int) pOtherName->Value.cbData ; n ++ )
+ otherName[n] = *( pOtherName->Value.pbData + n ) ;
+
+ otherNameProp.Value <<= otherName;
+
+ arrCertAltNameEntry[i].Value <<= otherNameProp;
+ break;
+ }
+ case CERT_ALT_NAME_RFC822_NAME :
+ arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Unicode*)pEntry->pwszRfc822Name);
+ break;
+ case CERT_ALT_NAME_DNS_NAME :
+ arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Unicode*)pEntry->pwszDNSName);
+ break;
+ case CERT_ALT_NAME_DIRECTORY_NAME :
+ {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME;
+ break;
+ }
+ case CERT_ALT_NAME_URL :
+ arrCertAltNameEntry[i].Type = ExtAltNameType_URL;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Unicode*)pEntry->pwszURL);
+ break;
+ case CERT_ALT_NAME_IP_ADDRESS :
+ {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_IP_ADDRESS;
+
+ Sequence< sal_Int8 > ipAddress( pEntry->IPAddress.cbData ) ;
+ for( unsigned int n = 0; n < pEntry->IPAddress.cbData ; n ++ )
+ ipAddress[n] = *( pEntry->IPAddress.pbData + n ) ;
+
+ arrCertAltNameEntry[i].Value <<= ipAddress;
+ break;
+ }
+ case CERT_ALT_NAME_REGISTERED_ID :
+ arrCertAltNameEntry[i].Type = ExtAltNameType_REGISTERED_ID;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString::createFromAscii(pEntry->pszRegisteredID);
+ break;
+ }
+ }
+ m_Entries = ::comphelper::arrayToSequence< com::sun::star::security::CertAltNameEntry >(arrCertAltNameEntry, subjectName->cAltEntry);
+
+ delete [] arrCertAltNameEntry;
+ }
+
+ return m_Entries;
+}
+
+//Helper method
+void SanExtensionImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) {
+ m_critical = critical ;
+ m_xExtnId = extnId ;
+ m_xExtnValue = extnValue ;
+}
+
+void SanExtensionImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) {
+ unsigned int i ;
+ if( value != NULL && vlen != 0 ) {
+ Sequence< sal_Int8 > extnv( vlen ) ;
+ for( i = 0; i < vlen ; i ++ )
+ extnv[i] = *( value + i ) ;
+
+ m_xExtnValue = extnv ;
+ } else {
+ m_xExtnValue = Sequence<sal_Int8>();
+ }
+
+ if( id != NULL && idlen != 0 ) {
+ Sequence< sal_Int8 > extnId( idlen ) ;
+ for( i = 0; i < idlen ; i ++ )
+ extnId[i] = *( id + i ) ;
+
+ m_xExtnId = extnId ;
+ } else {
+ m_xExtnId = Sequence<sal_Int8>();
+ }
+
+ m_critical = critical ;
+}
+
+void SanExtensionImpl :: extractCertExt () {
+}
+
diff --git a/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx
new file mode 100644
index 000000000000..0fb3616486be
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _SANEXTENSION_MSCRYPTIMPL_HXX_
+#define _SANEXTENSION_MSCRYPTIMPL_HXX_
+
+#ifdef _MSC_VER
+#pragma warning(push,1)
+#endif
+#include "Windows.h"
+#include "WinCrypt.h"
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include "com/sun/star/uno/SecurityException.hpp"
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/security/XCertificateExtension.hpp>
+#include <com/sun/star/security/XSanExtension.hpp>
+#include <com/sun/star/security/CertAltNameEntry.hpp>
+
+class SanExtensionImpl : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::security::XSanExtension >
+{
+ private :
+ sal_Bool m_critical ;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ;
+
+ ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries;
+
+ public :
+ SanExtensionImpl() ;
+ virtual ~SanExtensionImpl() ;
+
+ //Methods from XCertificateExtension
+ virtual sal_Bool SAL_CALL isCritical() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ //Methods from XSanExtension
+
+ virtual ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ //Helper method
+ void setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) ;
+
+ void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ;
+
+ void extractCertExt() ;
+} ;
+
+#endif // _CERTIFICATEEXTENSION_XMLSECIMPL_HXX_
+
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
index 8f0b7c7a9979..c35cd7621a79 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
@@ -57,6 +57,9 @@
#include <list>
#include "xmlsec/xmlsec.h"
+#include "sal/types.h"
+
+
class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper4<
::com::sun::star::xml::crypto::XSecurityEnvironment ,
::com::sun::star::lang::XInitialization ,
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index d5ab2898ee5a..2f6f6f4cc6d5 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -32,6 +32,7 @@
#include <rtl/uuid.h>
#include "x509certificate_mscryptimpl.hxx"
#include "certificateextension_xmlsecimpl.hxx"
+#include "sanextension_mscryptimpl.hxx"
#include "oid.hxx"
@@ -387,7 +388,13 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl :: getVersion() throw ( ::com::su
for( unsigned int i = 0; i < m_pCertContext->pCertInfo->cExtension; i++ ) {
pExtn = &(m_pCertContext->pCertInfo->rgExtension[i]) ;
- xExtn = new CertificateExtension_XmlSecImpl() ;
+
+ ::rtl::OUString objId = ::rtl::OUString::createFromAscii( pExtn->pszObjId );
+
+ if ( objId.equalsAscii("2.5.29.17") )
+ xExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ;
+ else
+ xExtn = new CertificateExtension_XmlSecImpl() ;
if( xExtn == NULL )
throw RuntimeException() ;
diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
new file mode 100644
index 000000000000..93a17e3514b7
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
@@ -0,0 +1,276 @@
+ /*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include <precompiled_xmlsecurity.hxx>
+
+#include <osl/time.h>
+#include <rtl/random.h>
+#include <rtl/ref.hxx>
+
+#include "ciphercontext.hxx"
+
+using namespace ::com::sun::star;
+
+uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANISM_TYPE nNSSCipherID, const uno::Sequence< ::sal_Int8 >& aKey, const uno::Sequence< ::sal_Int8 >& aInitializationVector, bool bEncryption, bool bW3CPadding )
+{
+ ::rtl::Reference< OCipherContext > xResult = new OCipherContext;
+
+ xResult->m_pSlot = PK11_GetBestSlot( nNSSCipherID, NULL );
+ if ( xResult->m_pSlot )
+ {
+ SECItem aKeyItem = { siBuffer, const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aKey.getConstArray() ) ), aKey.getLength() };
+ xResult->m_pSymKey = PK11_ImportSymKey( xResult->m_pSlot, nNSSCipherID, PK11_OriginDerive, bEncryption ? CKA_ENCRYPT : CKA_DECRYPT, &aKeyItem, NULL );
+ if ( xResult->m_pSymKey )
+ {
+ SECItem aIVItem = { siBuffer, const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aInitializationVector.getConstArray() ) ), aInitializationVector.getLength() };
+ xResult->m_pSecParam = PK11_ParamFromIV( nNSSCipherID, &aIVItem );
+ if ( xResult->m_pSecParam )
+ {
+ xResult->m_pContext = PK11_CreateContextBySymKey( nNSSCipherID, bEncryption ? CKA_ENCRYPT : CKA_DECRYPT, xResult->m_pSymKey, xResult->m_pSecParam);
+ if ( xResult->m_pContext )
+ {
+ xResult->m_bEncryption = bEncryption;
+ xResult->m_bW3CPadding = bW3CPadding;
+ xResult->m_bPadding = bW3CPadding || ( PK11_GetPadMechanism( nNSSCipherID ) == nNSSCipherID );
+ xResult->m_nBlockSize = PK11_GetBlockSize( nNSSCipherID, xResult->m_pSecParam );
+ if ( xResult->m_nBlockSize <= SAL_MAX_INT8 )
+ return xResult.get();
+ }
+ }
+ }
+ }
+
+ return uno::Reference< xml::crypto::XCipherContext >();
+}
+
+void OCipherContext::Dispose()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_pContext )
+ {
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ }
+
+ if ( m_pSecParam )
+ {
+ SECITEM_FreeItem( m_pSecParam, PR_TRUE );
+ m_pSecParam = NULL;
+ }
+
+ if ( m_pSymKey )
+ {
+ PK11_FreeSymKey( m_pSymKey );
+ m_pSymKey = NULL;
+ }
+
+ if ( m_pSlot )
+ {
+ PK11_FreeSlot( m_pSlot );
+ m_pSlot = NULL;
+ }
+
+ m_bDisposed = true;
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( const uno::Sequence< ::sal_Int8 >& aData )
+ throw ( lang::IllegalArgumentException, lang::DisposedException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_bBroken )
+ throw uno::RuntimeException();
+
+ if ( m_bDisposed )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aToConvert;
+ if ( aData.getLength() )
+ {
+ sal_Int32 nOldLastBlockLen = m_aLastBlock.getLength();
+ OSL_ENSURE( nOldLastBlockLen <= m_nBlockSize, "Unexpected last block size!" );
+
+ sal_Int32 nAvailableData = nOldLastBlockLen + aData.getLength();
+ sal_Int32 nToConvertLen = nAvailableData;
+ if ( m_bEncryption || !m_bW3CPadding )
+ {
+ if ( nAvailableData % m_nBlockSize == 0 )
+ nToConvertLen = nAvailableData;
+ else if ( nAvailableData < m_nBlockSize )
+ nToConvertLen = 0;
+ else
+ nToConvertLen = nAvailableData - nAvailableData % m_nBlockSize;
+ }
+ else
+ {
+ // decryption with W3C padding needs at least one block for finalizing
+ if ( nAvailableData < m_nBlockSize * 2 )
+ nToConvertLen = 0;
+ else
+ nToConvertLen = nAvailableData - nAvailableData % m_nBlockSize - m_nBlockSize;
+ }
+
+ aToConvert.realloc( nToConvertLen );
+ if ( nToConvertLen == 0 )
+ {
+ m_aLastBlock.realloc( nOldLastBlockLen + aData.getLength() );
+ rtl_copyMemory( m_aLastBlock.getArray() + nOldLastBlockLen, aData.getConstArray(), aData.getLength() );
+ // aToConvert stays empty
+ }
+ else if ( nToConvertLen < nOldLastBlockLen )
+ {
+ rtl_copyMemory( aToConvert.getArray(), m_aLastBlock.getConstArray(), nToConvertLen );
+ rtl_copyMemory( m_aLastBlock.getArray(), m_aLastBlock.getConstArray() + nToConvertLen, nOldLastBlockLen - nToConvertLen );
+ m_aLastBlock.realloc( nOldLastBlockLen - nToConvertLen + aData.getLength() );
+ rtl_copyMemory( m_aLastBlock.getArray() + nOldLastBlockLen - nToConvertLen, aData.getConstArray(), aData.getLength() );
+ }
+ else
+ {
+ rtl_copyMemory( aToConvert.getArray(), m_aLastBlock.getConstArray(), nOldLastBlockLen );
+ if ( nToConvertLen > nOldLastBlockLen )
+ rtl_copyMemory( aToConvert.getArray() + nOldLastBlockLen, aData.getConstArray(), nToConvertLen - nOldLastBlockLen );
+ m_aLastBlock.realloc( nAvailableData - nToConvertLen );
+ rtl_copyMemory( m_aLastBlock.getArray(), aData.getConstArray() + nToConvertLen - nOldLastBlockLen, nAvailableData - nToConvertLen );
+ }
+ }
+
+ uno::Sequence< sal_Int8 > aResult;
+ OSL_ENSURE( aToConvert.getLength() % m_nBlockSize == 0, "Unexpected size of the data to encrypt!" );
+ if ( aToConvert.getLength() )
+ {
+ int nResultLen = 0;
+ aResult.realloc( aToConvert.getLength() + m_nBlockSize );
+ if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength(), const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( aToConvert.getConstArray() ) ), aToConvert.getLength() ) != SECSuccess )
+ {
+ m_bBroken = true;
+ Dispose();
+ throw uno::RuntimeException();
+ }
+
+ m_nConverted += aToConvert.getLength();
+ aResult.realloc( nResultLen );
+ }
+
+ return aResult;
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDispose()
+ throw (lang::DisposedException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_bBroken )
+ throw uno::RuntimeException();
+
+ if ( m_bDisposed )
+ throw lang::DisposedException();
+
+ OSL_ENSURE( m_nBlockSize <= SAL_MAX_INT8, "Unexpected block size!" );
+ OSL_ENSURE( m_nConverted % m_nBlockSize == 0, "Unexpected amount of bytes is already converted!" );
+ sal_Int32 nSizeForPadding = ( m_nConverted + m_aLastBlock.getLength() ) % m_nBlockSize;
+
+ // if it is decryption, the amount of data should be rounded to the block size even in case of padding
+ if ( ( !m_bPadding || !m_bEncryption ) && nSizeForPadding )
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The data should contain complete blocks only." ) ), uno::Reference< uno::XInterface >() );
+
+ if ( m_bW3CPadding && m_bEncryption )
+ {
+ // in this case the last block should be smaller than standtard block
+ // it will be increased with the padding
+ OSL_ENSURE( m_aLastBlock.getLength() < m_nBlockSize, "Unexpected size of cashed incomplete last block!" );
+
+ // W3CPadding handling for encryption
+ sal_Int32 nPaddingSize = m_nBlockSize - nSizeForPadding;
+ sal_Int32 nOldLastBlockLen = m_aLastBlock.getLength();
+ m_aLastBlock.realloc( nOldLastBlockLen + nPaddingSize );
+
+ if ( nPaddingSize > 1 )
+ {
+ TimeValue aTime;
+ osl_getSystemTime( &aTime );
+ rtlRandomPool aRandomPool = rtl_random_createPool();
+ rtl_random_addBytes( aRandomPool, &aTime, 8 );
+ rtl_random_getBytes( aRandomPool, m_aLastBlock.getArray() + nOldLastBlockLen, nPaddingSize - 1 );
+ rtl_random_destroyPool ( aRandomPool );
+ }
+ m_aLastBlock[m_aLastBlock.getLength() - 1] = static_cast< sal_Int8 >( nPaddingSize );
+ }
+
+ // finally should the last block be smaller than two standard blocks
+ OSL_ENSURE( m_aLastBlock.getLength() < m_nBlockSize * 2 , "Unexpected size of cashed incomplete last block!" );
+
+ uno::Sequence< sal_Int8 > aResult;
+ if ( m_aLastBlock.getLength() )
+ {
+ int nPrefResLen = 0;
+ aResult.realloc( m_aLastBlock.getLength() + m_nBlockSize );
+ if ( PK11_CipherOp( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nPrefResLen, aResult.getLength(), const_cast< unsigned char* >( reinterpret_cast< const unsigned char* >( m_aLastBlock.getConstArray() ) ), m_aLastBlock.getLength() ) != SECSuccess )
+ {
+ m_bBroken = true;
+ Dispose();
+ throw uno::RuntimeException();
+ }
+
+ aResult.realloc( nPrefResLen );
+ m_aLastBlock.realloc( 0 );
+ }
+
+ sal_Int32 nPrefixLen = aResult.getLength();
+ aResult.realloc( nPrefixLen + m_nBlockSize * 2 );
+ unsigned nFinalLen = 0;
+ if ( PK11_DigestFinal( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() + nPrefixLen ), &nFinalLen, aResult.getLength() - nPrefixLen ) != SECSuccess )
+ {
+ m_bBroken = true;
+ Dispose();
+ throw uno::RuntimeException();
+ }
+
+ aResult.realloc( nPrefixLen + nFinalLen );
+
+ if ( m_bW3CPadding && !m_bEncryption )
+ {
+ // W3CPadding handling for decryption
+ // aResult should have anough data, since we let m_aLastBlock be big enough in case of decryption
+ OSL_ENSURE( aResult.getLength() >= m_nBlockSize, "Not enough data to handle the padding!" );
+
+ sal_Int8 nBytesToRemove = aResult[aResult.getLength() - 1];
+ if ( nBytesToRemove <= 0 || nBytesToRemove > aResult.getLength() )
+ {
+ m_bBroken = true;
+ Dispose();
+ throw uno::RuntimeException();
+ }
+
+ aResult.realloc( aResult.getLength() - nBytesToRemove );
+ }
+
+ Dispose();
+
+ return aResult;
+}
+
diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx
new file mode 100644
index 000000000000..1574a6238bd4
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _CIPHERCONTEXT_HXX
+#define _CIPHERCONTEXT_HXX
+
+#include <com/sun/star/xml/crypto/XCipherContext.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+#include <pk11pub.h>
+
+class OCipherContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XCipherContext >
+{
+private:
+ ::osl::Mutex m_aMutex;
+
+ PK11SlotInfo* m_pSlot;
+ PK11SymKey* m_pSymKey;
+ SECItem* m_pSecParam;
+ PK11Context* m_pContext;
+
+ sal_Int32 m_nBlockSize;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aLastBlock;
+
+ bool m_bEncryption;
+ bool m_bPadding;
+ bool m_bW3CPadding;
+ sal_Int64 m_nConverted;
+
+ bool m_bDisposed;
+ bool m_bBroken;
+
+ void Dispose();
+
+ OCipherContext()
+ : m_pSlot( NULL )
+ , m_pSymKey( NULL )
+ , m_pSecParam( NULL )
+ , m_pContext( NULL )
+ , m_nBlockSize( 0 )
+ , m_bEncryption( false )
+ , m_bPadding( false )
+ , m_bW3CPadding( false )
+ , m_nConverted( 0 )
+ , m_bDisposed( false )
+ , m_bBroken( false )
+ {}
+
+public:
+
+ virtual ~OCipherContext()
+ {
+ Dispose();
+ }
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > Create( CK_MECHANISM_TYPE nNSSCipherID, const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aKey, const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aInitializationVector, bool bEncryption, bool bW3CPadding );
+
+ // XCipherContext
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL convertWithCipherContext( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeCipherContextAndDispose( ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
diff --git a/xmlsecurity/source/xmlsec/nss/digestcontext.cxx b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
new file mode 100644
index 000000000000..4b3a0d094bd9
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include <precompiled_xmlsecurity.hxx>
+
+#include <pk11pub.h>
+#include "digestcontext.hxx"
+
+using namespace ::com::sun::star;
+
+ODigestContext::~ODigestContext()
+{
+ if ( m_pContext )
+ {
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ }
+}
+
+void SAL_CALL ODigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& aData )
+ throw (lang::DisposedException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_bBroken )
+ throw uno::RuntimeException();
+
+ if ( m_bDisposed )
+ throw lang::DisposedException();
+
+ if ( !m_b1KData || m_nDigested < 1024 )
+ {
+ uno::Sequence< sal_Int8 > aToDigest = aData;
+ if ( m_b1KData && m_nDigested + aData.getLength() > 1024 )
+ aToDigest.realloc( 1024 - m_nDigested );
+
+ if ( PK11_DigestOp( m_pContext, reinterpret_cast< const unsigned char* >( aToDigest.getConstArray() ), aToDigest.getLength() ) != SECSuccess )
+ {
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ m_bBroken = true;
+ throw uno::RuntimeException();
+ }
+
+ m_nDigested += aToDigest.getLength();
+ }
+}
+
+uno::Sequence< ::sal_Int8 > SAL_CALL ODigestContext::finalizeDigestAndDispose()
+ throw (lang::DisposedException, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( m_bBroken )
+ throw uno::RuntimeException();
+
+ if ( m_bDisposed )
+ throw lang::DisposedException();
+
+ uno::Sequence< sal_Int8 > aResult( m_nDigestLength );
+ unsigned int nResultLen = 0;
+ if ( PK11_DigestFinal( m_pContext, reinterpret_cast< unsigned char* >( aResult.getArray() ), &nResultLen, aResult.getLength() ) != SECSuccess )
+ {
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ m_bBroken = true;
+ throw uno::RuntimeException();
+ }
+
+ PK11_DestroyContext( m_pContext, PR_TRUE );
+ m_pContext = NULL;
+ m_bDisposed = true;
+
+ aResult.realloc( nResultLen );
+ return aResult;
+}
+
diff --git a/extensions/source/svg/svgwriter.hxx b/xmlsecurity/source/xmlsec/nss/digestcontext.hxx
index 2622f83f0182..8f9ef475a485 100644
--- a/extensions/source/svg/svgwriter.hxx
+++ b/xmlsecurity/source/xmlsec/nss/digestcontext.hxx
@@ -1,4 +1,3 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -26,38 +25,44 @@
*
************************************************************************/
-#ifndef _SVGWRITER_HXX
-#define _SVGWRITER_HXX
+#ifndef _DIGESTCONTEXT_HXX
+#define _DIGESTCONTEXT_HXX
-#include "svgcom.hxx"
+#include <com/sun/star/xml/crypto/XDigestContext.hpp>
-// -------------
-// - SVGWriter -
-// -------------
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
-class SVGWriter : public NMSP_CPPU::OWeakObject, NMSP_SVG::XSVGWriter
+class ODigestContext : public cppu::WeakImplHelper1< ::com::sun::star::xml::crypto::XDigestContext >
{
private:
+ ::osl::Mutex m_aMutex;
- REF( NMSP_LANG::XMultiServiceFactory ) mxFact;
+ PK11Context* m_pContext;
+ sal_Int32 m_nDigestLength;
+ bool m_b1KData;
+ sal_Int32 m_nDigested;
- SVGWriter();
+ bool m_bDisposed;
+ bool m_bBroken;
public:
+ ODigestContext( PK11Context* pContext, sal_Int32 nDigestLength, bool b1KData )
+ : m_pContext( pContext )
+ , m_nDigestLength( nDigestLength )
+ , m_b1KData( b1KData )
+ , m_nDigested( 0 )
+ , m_bDisposed( false )
+ , m_bBroken( false )
+ {}
- SVGWriter( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr );
- virtual ~SVGWriter();
+ virtual ~ODigestContext();
- // XInterface
- virtual ANY SAL_CALL queryInterface( const NMSP_UNO::Type & rType ) throw( NMSP_UNO::RuntimeException );
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
- // XSVGWriter
- virtual void SAL_CALL write( const REF( NMSP_SAX::XDocumentHandler )& rxDocHandler,
- const SEQ( sal_Int8 )& rMtfSeq ) throw( NMSP_UNO::RuntimeException );
+ // XDigestContext
+ virtual void SAL_CALL updateDigest( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aData ) throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeDigestAndDispose() throw (::com::sun::star::lang::DisposedException, ::com::sun::star::uno::RuntimeException);
};
#endif
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/nss/makefile.mk b/xmlsecurity/source/xmlsec/nss/makefile.mk
index de6a059573a2..ce088e2bb3dc 100644
--- a/xmlsecurity/source/xmlsec/nss/makefile.mk
+++ b/xmlsecurity/source/xmlsec/nss/makefile.mk
@@ -41,12 +41,6 @@ ENABLE_EXCEPTIONS = TRUE
CFLAGS+=-DSYSTEM_LIBXML $(LIBXML_CFLAGS)
.ENDIF
-.IF "$(CRYPTO_ENGINE)" != "nss"
-LIBTARGET=NO
-.ENDIF
-
-.IF "$(CRYPTO_ENGINE)" == "nss"
-
.IF "$(WITH_MOZILLA)" == "NO" || "$(ENABLE_NSS_MODULE)"!="YES"
.IF "$(SYSTEM_MOZILLA)" != "YES"
@all:
@@ -93,7 +87,11 @@ $(MOZ_INC)$/profile \
-I$(MOZ_INC)$/embed_base
.ENDIF
-CDEFS += -DXMLSEC_CRYPTO_NSS -DXMLSEC_NO_XSLT
+.IF "$(CRYPTO_ENGINE)" == "nss"
+CDEFS += -DXMLSEC_CRYPTO_NSS
+.ENDIF
+
+CDEFS += -DXMLSEC_NO_XSLT
# --- Files --------------------------------------------------------
@@ -109,17 +107,22 @@ SOLARINC += -I$(NSS_INC)
.ENDIF
SLOFILES = \
+ $(SLO)$/nssinitializer.obj \
+ $(SLO)$/digestcontext.obj \
+ $(SLO)$/ciphercontext.obj \
+ $(SLO)$/xsec_nss.obj
+
+.IF "$(CRYPTO_ENGINE)" == "nss"
+SLOFILES += \
$(SLO)$/securityenvironment_nssimpl.obj \
+ $(SLO)$/seinitializer_nssimpl.obj \
$(SLO)$/xmlencryption_nssimpl.obj \
$(SLO)$/xmlsecuritycontext_nssimpl.obj \
$(SLO)$/xmlsignature_nssimpl.obj \
$(SLO)$/x509certificate_nssimpl.obj \
- $(SLO)$/seinitializer_nssimpl.obj \
- $(SLO)$/xsec_nss.obj \
- $(SLO)$/secerror.obj
-
+ $(SLO)$/sanextension_nssimpl.obj \
+ $(SLO)$/secerror.obj
-
.ENDIF
# --- Targets ------------------------------------------------------
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
new file mode 100644
index 000000000000..ded32952d410
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -0,0 +1,521 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlsecurity.hxx"
+
+/*
+ * Turn off DEBUG Assertions
+ */
+#ifdef _DEBUG
+ #define _DEBUG_WAS_DEFINED _DEBUG
+ #undef _DEBUG
+#else
+ #undef _DEBUG_WAS_DEFINED
+#endif
+
+/*
+ * and turn off the additional virtual methods which are part of some interfaces when compiled
+ * with debug
+ */
+#ifdef DEBUG
+ #define DEBUG_WAS_DEFINED DEBUG
+ #undef DEBUG
+#else
+ #undef DEBUG_WAS_DEFINED
+#endif
+
+
+#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
+#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/CipherID.hpp>
+
+#include <sal/types.h>
+#include <rtl/instance.hxx>
+#include <rtl/bootstrap.hxx>
+#include <rtl/string.hxx>
+#include <rtl/strbuf.hxx>
+#include <osl/file.hxx>
+#include <osl/thread.h>
+#include <tools/debug.hxx>
+#include <rtl/logfile.hxx>
+
+#include "seinitializer_nssimpl.hxx"
+#include "../diagnose.hxx"
+
+#include "securityenvironment_nssimpl.hxx"
+#include "digestcontext.hxx"
+#include "ciphercontext.hxx"
+
+#include <nspr.h>
+#include <cert.h>
+#include <nss.h>
+#include <pk11pub.h>
+#include <secmod.h>
+#include <nssckbi.h>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = css::uno;
+namespace cssl = css::lang;
+namespace cssxc = css::xml::crypto;
+
+using namespace xmlsecurity;
+using namespace com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OString;
+
+#define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.NSSInitializer_NssImpl"
+
+#define ROOT_CERTS "Root Certs for OpenOffice.org"
+
+extern "C" void nsscrypto_finalize();
+
+
+namespace
+{
+
+bool nsscrypto_initialize( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF, bool & out_nss_init );
+
+struct InitNSSInitialize
+{
+ css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
+
+ InitNSSInitialize( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF )
+ : mxMSF( xMSF )
+ {
+ }
+
+ bool * operator()()
+ {
+ static bool bInitialized = false;
+ bool bNSSInit = false;
+ bInitialized = nsscrypto_initialize( mxMSF, bNSSInit );
+ if (bNSSInit)
+ atexit(nsscrypto_finalize );
+ return & bInitialized;
+ }
+};
+
+struct GetNSSInitStaticMutex
+{
+ ::osl::Mutex* operator()()
+ {
+ static ::osl::Mutex aNSSInitMutex;
+ return &aNSSInitMutex;
+ }
+};
+
+void deleteRootsModule()
+{
+ SECMODModule *RootsModule = 0;
+ SECMODModuleList *list = SECMOD_GetDefaultModuleList();
+ SECMODListLock *lock = SECMOD_GetDefaultModuleListLock();
+ SECMOD_GetReadLock(lock);
+
+ while (!RootsModule && list)
+ {
+ SECMODModule *module = list->module;
+
+ for (int i=0; i < module->slotCount; i++)
+ {
+ PK11SlotInfo *slot = module->slots[i];
+ if (PK11_IsPresent(slot))
+ {
+ if (PK11_HasRootCerts(slot))
+ {
+ xmlsec_trace("The root certifificates module \"%s"
+ "\" is already loaded: \n%s",
+ module->commonName, module->dllName);
+
+ RootsModule = SECMOD_ReferenceModule(module);
+ break;
+ }
+ }
+ }
+ list = list->next;
+ }
+ SECMOD_ReleaseReadLock(lock);
+
+ if (RootsModule)
+ {
+ PRInt32 modType;
+ if (SECSuccess == SECMOD_DeleteModule(RootsModule->commonName, &modType))
+ {
+ xmlsec_trace("Deleted module \"%s\".", RootsModule->commonName);
+ }
+ else
+ {
+ xmlsec_trace("Failed to delete \"%s\" : \n%s",
+ RootsModule->commonName, RootsModule->dllName);
+ }
+ SECMOD_DestroyModule(RootsModule);
+ RootsModule = 0;
+ }
+}
+
+::rtl::OString getMozillaCurrentProfile( const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF )
+{
+ ::rtl::OString sResult;
+ // first, try to get the profile from "MOZILLA_CERTIFICATE_FOLDER"
+ char* pEnv = getenv( "MOZILLA_CERTIFICATE_FOLDER" );
+ if ( pEnv )
+ {
+ sResult = ::rtl::OString( pEnv );
+ RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using env MOZILLA_CERTIFICATE_FOLDER: %s", sResult.getStr() );
+ }
+ else
+ {
+ mozilla::MozillaProductType productTypes[4] = {
+ mozilla::MozillaProductType_Thunderbird,
+ mozilla::MozillaProductType_Mozilla,
+ mozilla::MozillaProductType_Firefox,
+ mozilla::MozillaProductType_Default };
+ int nProduct = 4;
+
+ uno::Reference<uno::XInterface> xInstance = rxMSF->createInstance(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
+ OSL_ENSURE( xInstance.is(), "failed to create instance" );
+
+ uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap
+ = uno::Reference<mozilla::XMozillaBootstrap>(xInstance,uno::UNO_QUERY);
+ OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" );
+
+ if (xMozillaBootstrap.is())
+ {
+ for (int i=0; i<nProduct; i++)
+ {
+ ::rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
+
+ if (profile != NULL && profile.getLength()>0)
+ {
+ ::rtl::OUString sProfilePath = xMozillaBootstrap->getProfilePath( productTypes[i], profile );
+ sResult = ::rtl::OUStringToOString( sProfilePath, osl_getThreadTextEncoding() );
+ RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using Mozilla Profile: %s", sResult.getStr() );
+ }
+ }
+ }
+
+ RTL_LOGFILE_PRODUCT_TRACE( "XMLSEC: No Mozilla Profile found!" );
+ }
+
+ return sResult;
+}
+
+//Older versions of Firefox (FF), for example FF2, and Thunderbird (TB) 2 write
+//the roots certificate module (libnssckbi.so), which they use, into the
+//profile. This module will then already be loaded during NSS_Init (and the
+//other init functions). This fails in two cases. First, FF3 was used to create
+//the profile, or possibly used that profile before, and second the profile was
+//used on a different platform.
+//
+//Then one needs to add the roots module oneself. This should be done with
+//SECMOD_LoadUserModule rather then SECMOD_AddNewModule. The latter would write
+//the location of the roots module to the profile, which makes FF2 and TB2 use
+//it instead of there own module.
+//
+//When using SYSTEM_MOZILLA then the libnss3.so lib is typically found in
+///usr/lib. This folder may, however, NOT contain the roots certificate
+//module. That is, just providing the library name in SECMOD_LoadUserModule or
+//SECMOD_AddNewModule will FAIL to load the mozilla unless the LD_LIBRARY_PATH
+//contains an FF or TB installation.
+//ATTENTION: DO NOT call this function directly instead use initNSS
+//return true - whole initialization was successful
+//param out_nss_init = true: at least the NSS initialization (NSS_InitReadWrite
+//was successful and therefor NSS_Shutdown should be called when terminating.
+bool nsscrypto_initialize( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF, bool & out_nss_init )
+{
+ bool return_value = true;
+
+ // this method must be called only once, no need for additional lock
+ rtl::OString sCertDir;
+
+ (void) xMSF;
+#ifdef XMLSEC_CRYPTO_NSS
+ if ( xMSF.is() )
+ sCertDir = getMozillaCurrentProfile( xMSF );
+#endif
+ xmlsec_trace( "Using profile: %s", sCertDir.getStr() );
+
+ PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ;
+
+ // there might be no profile
+ if ( sCertDir.getLength() > 0 )
+ {
+ if( NSS_InitReadWrite( sCertDir.getStr() ) != SECSuccess )
+ {
+ xmlsec_trace("Initializing NSS with profile failed.");
+ char * error = NULL;
+
+ PR_GetErrorText(error);
+ if (error)
+ xmlsec_trace("%s",error);
+ return false ;
+ }
+ }
+ else
+ {
+ xmlsec_trace("Initializing NSS without profile.");
+ if ( NSS_NoDB_Init(NULL) != SECSuccess )
+ {
+ xmlsec_trace("Initializing NSS without profile failed.");
+ char * error = NULL;
+ PR_GetErrorText(error);
+ if (error)
+ xmlsec_trace("%s",error);
+ return false ;
+ }
+ }
+ out_nss_init = true;
+
+#ifdef XMLSEC_CRYPTO_NSS
+#if defined SYSTEM_MOZILLA
+ if (!SECMOD_HasRootCerts())
+ {
+#endif
+ deleteRootsModule();
+
+#if defined SYSTEM_MOZILLA
+ OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("libnssckbi"SAL_DLLEXTENSION));
+#else
+ OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("${OOO_BASE_DIR}/program/libnssckbi"SAL_DLLEXTENSION));
+#endif
+ ::rtl::Bootstrap::expandMacros(rootModule);
+
+ OUString rootModulePath;
+ if (::osl::File::E_None == ::osl::File::getSystemPathFromFileURL(rootModule, rootModulePath))
+ {
+ ::rtl::OString ospath = ::rtl::OUStringToOString(rootModulePath, osl_getThreadTextEncoding());
+ ::rtl::OStringBuffer pkcs11moduleSpec;
+ pkcs11moduleSpec.append("name=\"");
+ pkcs11moduleSpec.append(ROOT_CERTS);
+ pkcs11moduleSpec.append("\" library=\"");
+ pkcs11moduleSpec.append(ospath.getStr());
+ pkcs11moduleSpec.append("\"");
+
+ SECMODModule * RootsModule =
+ SECMOD_LoadUserModule(
+ const_cast<char*>(pkcs11moduleSpec.makeStringAndClear().getStr()),
+ 0, // no parent
+ PR_FALSE); // do not recurse
+
+ if (RootsModule)
+ {
+
+ bool found = RootsModule->loaded;
+
+ SECMOD_DestroyModule(RootsModule);
+ RootsModule = 0;
+ if (found)
+ xmlsec_trace("Added new root certificate module "
+ "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
+ else
+ {
+ xmlsec_trace("FAILED to load the new root certificate module "
+ "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
+ return_value = false;
+ }
+ }
+ else
+ {
+ xmlsec_trace("FAILED to add new root certifice module: "
+ "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
+ return_value = false;
+
+ }
+ }
+ else
+ {
+ xmlsec_trace("Adding new root certificate module failed.");
+ return_value = false;
+ }
+#if SYSTEM_MOZILLA
+ }
+#endif
+#endif
+
+ return return_value;
+}
+
+
+// must be extern "C" because we pass the function pointer to atexit
+extern "C" void nsscrypto_finalize()
+{
+ SECMODModule *RootsModule = SECMOD_FindModule(ROOT_CERTS);
+
+ if (RootsModule)
+ {
+
+ if (SECSuccess == SECMOD_UnloadUserModule(RootsModule))
+ {
+ xmlsec_trace("Unloaded module \""ROOT_CERTS"\".");
+ }
+ else
+ {
+ xmlsec_trace("Failed unloadeding module \""ROOT_CERTS"\".");
+ }
+ SECMOD_DestroyModule(RootsModule);
+ }
+ else
+ {
+ xmlsec_trace("Unloading module \""ROOT_CERTS
+ "\" failed because it was not found.");
+ }
+ PK11_LogoutAll();
+ NSS_Shutdown();
+}
+} // namespace
+
+ONSSInitializer::ONSSInitializer(
+ const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF)
+ :mxMSF( rxMSF )
+{
+}
+
+ONSSInitializer::~ONSSInitializer()
+{
+}
+
+bool ONSSInitializer::initNSS( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF )
+{
+ return *rtl_Instance< bool, InitNSSInitialize, ::osl::MutexGuard, GetNSSInitStaticMutex >
+ ::create( InitNSSInitialize( xMSF ), GetNSSInitStaticMutex() );
+}
+
+css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer::getDigestContext( ::sal_Int32 nDigestID, const css::uno::Sequence< css::beans::NamedValue >& aParams )
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ SECOidTag nNSSDigestID = SEC_OID_UNKNOWN;
+ sal_Int32 nDigestLength = 0;
+ bool b1KData = false;
+ if ( nDigestID == css::xml::crypto::DigestID::SHA256
+ || nDigestID == css::xml::crypto::DigestID::SHA256_1K )
+ {
+ nNSSDigestID = SEC_OID_SHA256;
+ nDigestLength = 32;
+ b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA256_1K );
+ }
+ else if ( nDigestID == css::xml::crypto::DigestID::SHA1
+ || nDigestID == css::xml::crypto::DigestID::SHA1_1K )
+ {
+ nNSSDigestID = SEC_OID_SHA1;
+ nDigestLength = 20;
+ b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA1_1K );
+ }
+ else
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected digest requested." ) ), css::uno::Reference< css::uno::XInterface >(), 1 );
+
+ if ( aParams.getLength() )
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments provided for digest creation." ) ), css::uno::Reference< css::uno::XInterface >(), 2 );
+
+ css::uno::Reference< css::xml::crypto::XDigestContext > xResult;
+ if( initNSS( mxMSF ) )
+ {
+ PK11Context* pContext = PK11_CreateDigestContext( nNSSDigestID );
+ if ( pContext && PK11_DigestBegin( pContext ) == SECSuccess )
+ xResult = new ODigestContext( pContext, nDigestLength, b1KData );
+ }
+
+ return xResult;
+}
+
+css::uno::Reference< css::xml::crypto::XCipherContext > SAL_CALL ONSSInitializer::getCipherContext( ::sal_Int32 nCipherID, const css::uno::Sequence< ::sal_Int8 >& aKey, const css::uno::Sequence< ::sal_Int8 >& aInitializationVector, ::sal_Bool bEncryption, const css::uno::Sequence< css::beans::NamedValue >& aParams )
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ CK_MECHANISM_TYPE nNSSCipherID = 0;
+ bool bW3CPadding = false;
+ if ( nCipherID == css::xml::crypto::CipherID::AES_CBC_W3C_PADDING )
+ {
+ nNSSCipherID = CKM_AES_CBC;
+ bW3CPadding = true;
+
+ if ( aKey.getLength() != 16 && aKey.getLength() != 24 && aKey.getLength() != 32 )
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected key length." ) ), css::uno::Reference< css::uno::XInterface >(), 2 );
+
+ if ( aParams.getLength() )
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments provided for cipher creation." ) ), css::uno::Reference< css::uno::XInterface >(), 5 );
+ }
+ else
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected cipher requested." ) ), css::uno::Reference< css::uno::XInterface >(), 1 );
+
+ css::uno::Reference< css::xml::crypto::XCipherContext > xResult;
+ if( initNSS( mxMSF ) )
+ {
+ if ( aInitializationVector.getLength() != PK11_GetIVLength( nNSSCipherID ) )
+ throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected length of initialization vector." ) ), css::uno::Reference< css::uno::XInterface >(), 3 );
+
+ xResult = OCipherContext::Create( nNSSCipherID, aKey, aInitializationVector, bEncryption, bW3CPadding );
+ }
+
+ return xResult;
+}
+
+rtl::OUString ONSSInitializer_getImplementationName ()
+ throw (cssu::RuntimeException)
+{
+
+ return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
+}
+
+sal_Bool SAL_CALL ONSSInitializer_supportsService( const rtl::OUString& ServiceName )
+ throw (cssu::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( NSS_SERVICE_NAME ));
+}
+
+cssu::Sequence< rtl::OUString > SAL_CALL ONSSInitializer_getSupportedServiceNames( )
+ throw (cssu::RuntimeException)
+{
+ cssu::Sequence < rtl::OUString > aRet(1);
+ rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( NSS_SERVICE_NAME ) );
+ return aRet;
+}
+
+cssu::Reference< cssu::XInterface > SAL_CALL ONSSInitializer_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > & rSMgr)
+ throw( cssu::Exception )
+{
+ return (cppu::OWeakObject*) new ONSSInitializer( rSMgr );
+}
+
+/* XServiceInfo */
+rtl::OUString SAL_CALL ONSSInitializer::getImplementationName()
+ throw (cssu::RuntimeException)
+{
+ return ONSSInitializer_getImplementationName();
+}
+sal_Bool SAL_CALL ONSSInitializer::supportsService( const rtl::OUString& rServiceName )
+ throw (cssu::RuntimeException)
+{
+ return ONSSInitializer_supportsService( rServiceName );
+}
+cssu::Sequence< rtl::OUString > SAL_CALL ONSSInitializer::getSupportedServiceNames( )
+ throw (cssu::RuntimeException)
+{
+ return ONSSInitializer_getSupportedServiceNames();
+}
+
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx
new file mode 100644
index 000000000000..6e7fed190d60
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef _NSSINITIALIZER_HXX
+#define _NSSINITIALIZER_HXX
+
+#include <com/sun/star/xml/crypto/XDigestContextSupplier.hpp>
+#include <com/sun/star/xml/crypto/XCipherContextSupplier.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <cppuhelper/implbase3.hxx>
+
+#define NSS_SERVICE_NAME "com.sun.star.xml.crypto.NSSInitializer"
+
+class ONSSInitializer : public cppu::WeakImplHelper3
+<
+ ::com::sun::star::xml::crypto::XDigestContextSupplier,
+ ::com::sun::star::xml::crypto::XCipherContextSupplier,
+ ::com::sun::star::lang::XServiceInfo
+>
+{
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+
+ ONSSInitializer()
+ {}
+
+public:
+ ONSSInitializer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF );
+ virtual ~ONSSInitializer();
+
+ bool initNSS( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &xMSF );
+
+ /* XDigestContextSupplier */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > SAL_CALL getDigestContext( ::sal_Int32 nDigestID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aParams ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ /* XCipherContextSupplier */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > SAL_CALL getCipherContext( ::sal_Int32 nCipherID, const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aKey, const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aInitializationVector, ::sal_Bool bEncryption, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aParams ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ /* XServiceInfo */
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (::com::sun::star::uno::RuntimeException);
+};
+
+rtl::OUString ONSSInitializer_getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL ONSSInitializer_supportsService( const rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL ONSSInitializer_getSupportedServiceNames()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL ONSSInitializer_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr )
+ throw ( ::com::sun::star::uno::Exception );
+
+#endif
+
diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
new file mode 100644
index 000000000000..2c66321121db
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
@@ -0,0 +1,244 @@
+/*************************************************************************
+*
+* 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.
+*
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_xmlsecurity.hxx"
+#include <sal/config.h>
+#include <rtl/uuid.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/security/ExtAltNameType.hpp>
+#include <com/sun/star/security/CertAltNameEntry.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <comphelper/sequence.hxx>
+#include <seccomon.h>
+#include <cert.h>
+#include <certt.h>
+#include <secitem.h>
+#include <secport.h>
+
+
+#ifndef _SANEXTENSION_NSSIMPL_HXX_
+#include "sanextension_nssimpl.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno ;
+using namespace ::com::sun::star::security ;
+using ::rtl::OUString ;
+
+using ::com::sun::star::security::XCertificateExtension ;
+
+
+SanExtensionImpl :: SanExtensionImpl() :
+m_critical( sal_False )
+{
+}
+
+SanExtensionImpl :: ~SanExtensionImpl() {
+}
+
+
+//Methods from XCertificateExtension
+sal_Bool SAL_CALL SanExtensionImpl :: isCritical() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_critical ;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_xExtnId ;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL SanExtensionImpl :: getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) {
+ return m_xExtnValue ;
+}
+
+namespace {
+ // Helper functions from nss/lib/certdb/genname.c
+ static int GetNamesLength(CERTGeneralName *names)
+ {
+ int length = 0;
+ CERTGeneralName *first;
+
+ first = names;
+ if (names != NULL) {
+ do {
+ length++;
+ names = CERT_GetNextGeneralName(names);
+ } while (names != first);
+ }
+ return length;
+ }
+
+}
+
+//Methods from XSanExtension
+::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL SanExtensionImpl :: getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ){
+
+ if (!m_Entries.hasElements())
+ {
+ SECItem item;
+
+ item.type = siDERCertBuffer;
+ item.data = (unsigned char*) m_xExtnValue.getArray();
+ item.len = m_xExtnValue.getLength();
+
+ PRArenaPool *arena;
+ CERTGeneralName *nameList;
+ arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+
+ if (!arena)
+ return m_Entries;
+
+ nameList = CERT_DecodeAltNameExtension(arena, &item);
+
+ CERTGeneralName* current = nameList;
+
+ int size = GetNamesLength(nameList);
+ CertAltNameEntry* arrCertAltNameEntry = new CertAltNameEntry[size];
+ for(int i = 0; i < size ; i++){
+ switch (current->type) {
+ case certOtherName: {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_OTHER_NAME;
+ ::com::sun::star::beans::PropertyValue otherNameProp;
+ otherNameProp.Name = ::rtl::OUString::createFromAscii(CERT_GetOidString(&current->name.OthName.oid));
+
+ Sequence< sal_Int8 > otherName( current->name.OthName.name.len ) ;
+ for( unsigned int r = 0; r < current->name.OthName.name.len ; r ++ )
+ otherName[r] = *( current->name.OthName.name.data + r ) ;
+
+ otherNameProp.Value <<= otherName;
+
+ arrCertAltNameEntry[i].Value <<= otherNameProp;
+ break;
+ }
+ case certRFC822Name:
+ arrCertAltNameEntry[i].Type = ExtAltNameType_RFC822_NAME;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US);
+ break;
+ case certDNSName:
+ arrCertAltNameEntry[i].Type = ExtAltNameType_DNS_NAME;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US);
+ break;
+ case certX400Address: {
+ // unsupported
+ arrCertAltNameEntry[i].Type = ExtAltNameType_X400_ADDRESS;
+ break;
+ }
+ case certDirectoryName: {
+ // unsupported
+ arrCertAltNameEntry[i].Type = ExtAltNameType_DIRECTORY_NAME;
+ break;
+ }
+ case certEDIPartyName: {
+ // unsupported
+ arrCertAltNameEntry[i].Type = ExtAltNameType_EDI_PARTY_NAME;
+ break;
+ }
+ case certURI:
+ arrCertAltNameEntry[i].Type = ExtAltNameType_URL;
+ arrCertAltNameEntry[i].Value <<= ::rtl::OUString((const sal_Char*)current->name.other.data, current->name.other.len, RTL_TEXTENCODING_ASCII_US);
+ break;
+ case certIPAddress: {
+ arrCertAltNameEntry[i].Type = ExtAltNameType_IP_ADDRESS;
+
+ Sequence< sal_Int8 > ipAddress( current->name.other.len ) ;
+ for( unsigned int r = 0; r < current->name.other.len ; r ++ )
+ ipAddress[r] = *( current->name.other.data + r ) ;
+
+ arrCertAltNameEntry[i].Value <<= ipAddress;
+ break;
+ }
+ case certRegisterID:
+ arrCertAltNameEntry[i].Type = ExtAltNameType_REGISTERED_ID;
+
+
+ rtl::OString nssOid = ::rtl::OString(CERT_GetOidString(&current->name.other));
+ rtl::OString unoOid = removeOIDFromString(nssOid);
+ arrCertAltNameEntry[i].Value <<= rtl::OStringToOUString( unoOid, RTL_TEXTENCODING_ASCII_US );
+ break;
+ }
+ current = CERT_GetNextGeneralName(current);
+ }
+
+ m_Entries = ::comphelper::arrayToSequence< com::sun::star::security::CertAltNameEntry >(arrCertAltNameEntry, size);
+
+ delete [] arrCertAltNameEntry;
+
+ PORT_FreeArena(arena, PR_FALSE);
+
+
+ }
+
+ return m_Entries;
+}
+
+::rtl::OString SanExtensionImpl :: removeOIDFromString( const ::rtl::OString &oidString)
+ {
+ ::rtl::OString objID;
+ ::rtl::OString oid("OID.");
+ if (oidString.match(oid))
+ objID = oidString.copy(oid.getLength());
+ else
+ objID = oidString;
+ return objID;
+
+ }
+//Helper method
+void SanExtensionImpl :: setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) {
+ m_critical = critical ;
+ m_xExtnId = extnId ;
+ m_xExtnValue = extnValue ;
+}
+
+void SanExtensionImpl :: setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) {
+ unsigned int i ;
+ if( value != NULL && vlen != 0 ) {
+ Sequence< sal_Int8 > extnv( vlen ) ;
+ for( i = 0; i < vlen ; i ++ )
+ extnv[i] = *( value + i ) ;
+
+ m_xExtnValue = extnv ;
+ } else {
+ m_xExtnValue = Sequence<sal_Int8>();
+ }
+
+ if( id != NULL && idlen != 0 ) {
+ Sequence< sal_Int8 > extnId( idlen ) ;
+ for( i = 0; i < idlen ; i ++ )
+ extnId[i] = *( id + i ) ;
+
+ m_xExtnId = extnId ;
+ } else {
+ m_xExtnId = Sequence<sal_Int8>();
+ }
+
+ m_critical = critical ;
+}
+
+void SanExtensionImpl :: extractCertExt () {
+}
+
diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx
new file mode 100644
index 000000000000..88425aa8d125
--- /dev/null
+++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef _SANEXTENSION_NSSIMPL_HXX_
+#define _SANEXTENSION_NSSIMPL_HXX_
+
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Exception.hpp>
+#include "com/sun/star/uno/SecurityException.hpp"
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/security/XCertificateExtension.hpp>
+#include <com/sun/star/security/XSanExtension.hpp>
+#include <com/sun/star/security/CertAltNameEntry.hpp>
+
+class SanExtensionImpl : public ::cppu::WeakImplHelper1<
+ ::com::sun::star::security::XSanExtension >
+{
+ private :
+ sal_Bool m_critical ;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnId ;
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_xExtnValue ;
+ ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > m_Entries;
+
+ ::rtl::OString removeOIDFromString( const ::rtl::OString &oid);
+
+ public :
+ SanExtensionImpl() ;
+ virtual ~SanExtensionImpl() ;
+
+ //Methods from XCertificateExtension
+ virtual sal_Bool SAL_CALL isCritical() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionId() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getExtensionValue() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ //Methods from XSanExtension
+
+ virtual ::com::sun::star::uno::Sequence< com::sun::star::security::CertAltNameEntry > SAL_CALL getAlternativeNames() throw( ::com::sun::star::uno::RuntimeException ) ;
+
+ //Helper method
+ void setCertExtn( ::com::sun::star::uno::Sequence< sal_Int8 > extnId, ::com::sun::star::uno::Sequence< sal_Int8 > extnValue, sal_Bool critical ) ;
+
+ void setCertExtn( unsigned char* value, unsigned int vlen, unsigned char* id, unsigned int idlen, sal_Bool critical ) ;
+
+ void extractCertExt() ;
+} ;
+
+#endif // _CERTIFICATEEXTENSION_XMLSECIMPL_HXX_
+
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index a6a1af956728..ab08a5fd9938 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -89,7 +89,29 @@ extern X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* ) ;
struct UsageDescription
{
SECCertificateUsage usage;
- char const * const description;
+ char const* description;
+
+ UsageDescription()
+ : usage( certificateUsageCheckAllUsages )
+ , description( NULL )
+ {}
+
+ UsageDescription( SECCertificateUsage i_usage, char const* i_description )
+ : usage( i_usage )
+ , description( i_description )
+ {}
+
+ UsageDescription( const UsageDescription& aDescription )
+ : usage( aDescription.usage )
+ , description( aDescription.description )
+ {}
+
+ UsageDescription& operator =( const UsageDescription& aDescription )
+ {
+ usage = aDescription.usage;
+ description = aDescription.description;
+ return *this;
+ }
};
@@ -868,14 +890,12 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert,
// certificateUsageAnyCA
// certificateUsageProtectedObjectSigner
- UsageDescription arUsages[] =
- {
- {certificateUsageSSLClient, "certificateUsageSSLClient" },
- {certificateUsageSSLServer, "certificateUsageSSLServer" },
- {certificateUsageSSLCA, "certificateUsageSSLCA" },
- {certificateUsageEmailSigner, "certificateUsageEmailSigner"}, //only usable for end certs
- {certificateUsageEmailRecipient, "certificateUsageEmailRecipient"}
- };
+ UsageDescription arUsages[5];
+ arUsages[0] = UsageDescription( certificateUsageSSLClient, "certificateUsageSSLClient" );
+ arUsages[1] = UsageDescription( certificateUsageSSLServer, "certificateUsageSSLServer" );
+ arUsages[2] = UsageDescription( certificateUsageSSLCA, "certificateUsageSSLCA" );
+ arUsages[3] = UsageDescription( certificateUsageEmailSigner, "certificateUsageEmailSigner" );
+ arUsages[4] = UsageDescription( certificateUsageEmailRecipient, "certificateUsageEmailRecipient" );
int numUsages = SAL_N_ELEMENTS(arUsages);
for (int i = 0; i < numUsages; i++)
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
index 5bb2a9ecb567..1e521cf272fd 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
@@ -50,339 +50,45 @@
#undef DEBUG_WAS_DEFINED
#endif
-
#include <sal/types.h>
-#include "rtl/instance.hxx"
-#include "rtl/bootstrap.hxx"
-#include "rtl/string.hxx"
-#include "rtl/strbuf.hxx"
-#include "osl/file.hxx"
-#include "osl/thread.h"
+#include <rtl/bootstrap.hxx>
+#include <rtl/string.hxx>
+#include <rtl/strbuf.hxx>
+#include <osl/file.hxx>
+#include <osl/thread.h>
#include <tools/debug.hxx>
#include <rtl/logfile.hxx>
#include "seinitializer_nssimpl.hxx"
-#include "../diagnose.hxx"
-
#include "securityenvironment_nssimpl.hxx"
-#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
-#include "nspr.h"
-#include "cert.h"
-#include "nss.h"
-#include "secmod.h"
-#include "nssckbi.h"
+#include <nspr.h>
+#include <cert.h>
+#include <nss.h>
+#include <pk11pub.h>
+#include <secmod.h>
+#include <nssckbi.h>
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
+namespace css = ::com::sun::star;
+namespace cssu = css::uno;
+namespace cssl = css::lang;
+namespace cssxc = css::xml::crypto;
-using namespace xmlsecurity;
using namespace com::sun::star;
using ::rtl::OUString;
using ::rtl::OString;
-#define SERVICE_NAME "com.sun.star.xml.crypto.SEInitializer"
+#define SE_SERVICE_NAME "com.sun.star.xml.crypto.SEInitializer"
#define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.SEInitializer_NssImpl"
#define SECURITY_ENVIRONMENT "com.sun.star.xml.crypto.SecurityEnvironment"
#define SECURITY_CONTEXT "com.sun.star.xml.crypto.XMLSecurityContext"
-
-#define ROOT_CERTS "Root Certs for OpenOffice.org"
-
-
-extern "C" void nsscrypto_finalize();
-
-
-namespace
-{
-
-bool nsscrypto_initialize( const char * sProfile, bool & out_nss_init);
-
-struct InitNSSInitialize
-{
- //path to the database folder
- const OString m_sProfile;
- InitNSSInitialize(const OString & sProfile): m_sProfile(sProfile) {};
- bool * operator()()
- {
- static bool bInitialized = false;
- bool bNSSInit = false;
- bInitialized = nsscrypto_initialize(m_sProfile.getStr(), bNSSInit);
- if (bNSSInit)
- atexit(nsscrypto_finalize );
- return & bInitialized;
-
- }
-};
-
-bool * initNSS(const OString & sProfile)
-{
- return rtl_Instance< bool, InitNSSInitialize,
- ::osl::MutexGuard, ::osl::GetGlobalMutex >::create(
- InitNSSInitialize(sProfile), ::osl::GetGlobalMutex());
-}
-
-void deleteRootsModule()
-{
- SECMODModule *RootsModule = 0;
- SECMODModuleList *list = SECMOD_GetDefaultModuleList();
- SECMODListLock *lock = SECMOD_GetDefaultModuleListLock();
- SECMOD_GetReadLock(lock);
-
- while (!RootsModule && list)
- {
- SECMODModule *module = list->module;
-
- for (int i=0; i < module->slotCount; i++)
- {
- PK11SlotInfo *slot = module->slots[i];
- if (PK11_IsPresent(slot))
- {
- if (PK11_HasRootCerts(slot))
- {
- xmlsec_trace("The root certifificates module \"%s"
- "\" is already loaded: \n%s",
- module->commonName, module->dllName);
-
- RootsModule = SECMOD_ReferenceModule(module);
- break;
- }
- }
- }
- list = list->next;
- }
- SECMOD_ReleaseReadLock(lock);
-
- if (RootsModule)
- {
- PRInt32 modType;
- if (SECSuccess == SECMOD_DeleteModule(RootsModule->commonName, &modType))
- {
- xmlsec_trace("Deleted module \"%s\".", RootsModule->commonName);
- }
- else
- {
- xmlsec_trace("Failed to delete \"%s\" : \n%s",
- RootsModule->commonName, RootsModule->dllName);
- }
- SECMOD_DestroyModule(RootsModule);
- RootsModule = 0;
- }
-}
-
-//Older versions of Firefox (FF), for example FF2, and Thunderbird (TB) 2 write
-//the roots certificate module (libnssckbi.so), which they use, into the
-//profile. This module will then already be loaded during NSS_Init (and the
-//other init functions). This fails in two cases. First, FF3 was used to create
-//the profile, or possibly used that profile before, and second the profile was
-//used on a different platform.
-//
-//Then one needs to add the roots module oneself. This should be done with
-//SECMOD_LoadUserModule rather then SECMOD_AddNewModule. The latter would write
-//the location of the roots module to the profile, which makes FF2 and TB2 use
-//it instead of there own module.
-//
-//When using SYSTEM_MOZILLA then the libnss3.so lib is typically found in
-///usr/lib. This folder may, however, NOT contain the roots certificate
-//module. That is, just providing the library name in SECMOD_LoadUserModule or
-//SECMOD_AddNewModule will FAIL to load the mozilla unless the LD_LIBRARY_PATH
-//contains an FF or TB installation.
-//ATTENTION: DO NOT call this function directly instead use initNSS
-//return true - whole initialization was successful
-//param out_nss_init = true: at least the NSS initialization (NSS_InitReadWrite
-//was successful and therefor NSS_Shutdown should be called when terminating.
-bool nsscrypto_initialize( const char* token, bool & out_nss_init )
-{
- bool return_value = true;
-
- xmlsec_trace("Using profile: %s", token);
-
- PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ;
-
- //token may be an empty string
- if (token != NULL && strlen(token) > 0)
- {
- if( NSS_InitReadWrite( token ) != SECSuccess )
- {
- xmlsec_trace("Initializing NSS with profile failed.");
- char * error = NULL;
-
- PR_GetErrorText(error);
- if (error)
- xmlsec_trace("%s",error);
- return false ;
- }
- }
- else
- {
- xmlsec_trace("Initializing NSS without profile.");
- if ( NSS_NoDB_Init(NULL) != SECSuccess )
- {
- xmlsec_trace("Initializing NSS without profile failed.");
- char * error = NULL;
- PR_GetErrorText(error);
- if (error)
- xmlsec_trace("%s",error);
- return false ;
- }
- }
- out_nss_init = true;
-
-#if defined SYSTEM_MOZILLA
- if (!SECMOD_HasRootCerts())
- {
-#endif
- deleteRootsModule();
-
-#if defined SYSTEM_MOZILLA
- OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("libnssckbi"SAL_DLLEXTENSION));
-#else
- OUString rootModule(RTL_CONSTASCII_USTRINGPARAM("${OOO_BASE_DIR}/program/libnssckbi"SAL_DLLEXTENSION));
-#endif
- ::rtl::Bootstrap::expandMacros(rootModule);
-
- OUString rootModulePath;
- if (::osl::File::E_None == ::osl::File::getSystemPathFromFileURL(rootModule, rootModulePath))
- {
- ::rtl::OString ospath = ::rtl::OUStringToOString(rootModulePath, osl_getThreadTextEncoding());
- ::rtl::OStringBuffer pkcs11moduleSpec;
- pkcs11moduleSpec.append("name=\"");
- pkcs11moduleSpec.append(ROOT_CERTS);
- pkcs11moduleSpec.append("\" library=\"");
- pkcs11moduleSpec.append(ospath.getStr());
- pkcs11moduleSpec.append("\"");
-
- SECMODModule * RootsModule =
- SECMOD_LoadUserModule(
- const_cast<char*>(pkcs11moduleSpec.makeStringAndClear().getStr()),
- 0, // no parent
- PR_FALSE); // do not recurse
-
- if (RootsModule)
- {
-
- bool found = RootsModule->loaded;
-
- SECMOD_DestroyModule(RootsModule);
- RootsModule = 0;
- if (found)
- xmlsec_trace("Added new root certificate module "
- "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
- else
- {
- xmlsec_trace("FAILED to load the new root certificate module "
- "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
- return_value = false;
- }
- }
- else
- {
- xmlsec_trace("FAILED to add new root certifice module: "
- "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
- return_value = false;
-
- }
- }
- else
- {
- xmlsec_trace("Adding new root certificate module failed.");
- return_value = false;
- }
-#if SYSTEM_MOZILLA
- }
-#endif
-
- return return_value;
-}
-
-
-// must be extern "C" because we pass the function pointer to atexit
-extern "C" void nsscrypto_finalize()
-{
- SECMODModule *RootsModule = SECMOD_FindModule(ROOT_CERTS);
-
- if (RootsModule)
- {
-
- if (SECSuccess == SECMOD_UnloadUserModule(RootsModule))
- {
- xmlsec_trace("Unloaded module \""ROOT_CERTS"\".");
- }
- else
- {
- xmlsec_trace("Failed unloadeding module \""ROOT_CERTS"\".");
- }
- SECMOD_DestroyModule(RootsModule);
- }
- else
- {
- xmlsec_trace("Unloading module \""ROOT_CERTS
- "\" failed because it was not found.");
- }
- PK11_LogoutAll();
- NSS_Shutdown();
-}
-
-
-bool getMozillaCurrentProfile(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF,
- rtl::OUString& profilePath)
-{
- /*
- * first, try to get the profile from "MOZILLA_CERTIFICATE_FOLDER"
- */
- char * env = getenv("MOZILLA_CERTIFICATE_FOLDER");
- if (env)
- {
- profilePath = rtl::OUString::createFromAscii( env );
- RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using env MOZILLA_CERTIFICATE_FOLDER: %s", rtl::OUStringToOString( profilePath, RTL_TEXTENCODING_ASCII_US ).getStr() );
- return true;
- }
- else
- {
- mozilla::MozillaProductType productTypes[4] = {
- mozilla::MozillaProductType_Thunderbird,
- mozilla::MozillaProductType_Mozilla,
- mozilla::MozillaProductType_Firefox,
- mozilla::MozillaProductType_Default };
-
- uno::Reference<uno::XInterface> xInstance = rxMSF->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.mozilla.MozillaBootstrap")) );
- OSL_ENSURE( xInstance.is(), "failed to create instance" );
-
- uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap
- = uno::Reference<mozilla::XMozillaBootstrap>(xInstance,uno::UNO_QUERY);
- OSL_ENSURE( xMozillaBootstrap.is(), "failed to create instance" );
-
- if (xMozillaBootstrap.is())
- {
int nProduct = 4;
- for (int i=0; i<nProduct; i++)
- {
- ::rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
-
- if (profile != NULL && profile.getLength()>0)
- {
- profilePath = xMozillaBootstrap->getProfilePath(productTypes[i],profile);
- RTL_LOGFILE_PRODUCT_TRACE1( "XMLSEC: Using Mozilla Profile: %s", rtl::OUStringToOString( profilePath, RTL_TEXTENCODING_ASCII_US ).getStr() );
- return true;
- }
- }
- }
-
- RTL_LOGFILE_PRODUCT_TRACE( "XMLSEC: No Mozilla Profile found!" );
- return false;
- }
-}
-
-} // namespace
-
SEInitializer_NssImpl::SEInitializer_NssImpl(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF)
- :mxMSF( rxMSF )
+ const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF )
{
+ mxMSF = rxMSF;
}
SEInitializer_NssImpl::~SEInitializer_NssImpl()
@@ -391,36 +97,13 @@ SEInitializer_NssImpl::~SEInitializer_NssImpl()
/* XSEInitializer */
cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
- SEInitializer_NssImpl::createSecurityContext(
- const rtl::OUString& sCertDB )
+ SEInitializer_NssImpl::createSecurityContext( const ::rtl::OUString& )
throw (cssu::RuntimeException)
{
CERTCertDBHandle *pCertHandle = NULL ;
- rtl::OString sCertDir;
- if( sCertDB.getLength() )
- {
- sCertDir = rtl::OUStringToOString(sCertDB, RTL_TEXTENCODING_ASCII_US);
- }
- else
- {
- static rtl::OString* pDefaultCertDir = NULL;
- if ( !pDefaultCertDir )
- {
- pDefaultCertDir = new rtl::OString;
- rtl::OUString ouCertDir;
-
- if ( getMozillaCurrentProfile(mxMSF, ouCertDir) )
- *pDefaultCertDir = rtl::OUStringToOString(ouCertDir, RTL_TEXTENCODING_ASCII_US);
- }
- sCertDir = *pDefaultCertDir;
-
- }
-
- if( ! *initNSS( sCertDir.getStr() ) )
- {
+ if( !initNSS( mxMSF ) )
return NULL;
- }
pCertHandle = CERT_GetDefaultCertDB() ;
@@ -477,18 +160,18 @@ rtl::OUString SEInitializer_NssImpl_getImplementationName ()
sal_Bool SAL_CALL SEInitializer_NssImpl_supportsService( const rtl::OUString& ServiceName )
throw (cssu::RuntimeException)
{
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ));
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SE_SERVICE_NAME )) || ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( NSS_SERVICE_NAME ));
}
cssu::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl_getSupportedServiceNames( )
throw (cssu::RuntimeException)
{
- cssu::Sequence < rtl::OUString > aRet(1);
+ cssu::Sequence < rtl::OUString > aRet(2);
rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
+ pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SE_SERVICE_NAME ) );
+ pArray[1] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( NSS_SERVICE_NAME ) );
return aRet;
}
-#undef SERVICE_NAME
cssu::Reference< cssu::XInterface > SAL_CALL SEInitializer_NssImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > & rSMgr)
throw( cssu::Exception )
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
index 6012a0317c5b..776c2ffd4a78 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
@@ -31,46 +31,28 @@
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <cppuhelper/implbase2.hxx>
+
+#include <cppuhelper/implbase1.hxx>
#include <libxml/tree.h>
-class SEInitializer_NssImpl : public cppu::WeakImplHelper2
+#include "nssinitializer.hxx"
+
+class SEInitializer_NssImpl : public cppu::ImplInheritanceHelper1
<
- com::sun::star::xml::crypto::XSEInitializer,
- com::sun::star::lang::XServiceInfo
+ ONSSInitializer,
+ ::com::sun::star::xml::crypto::XSEInitializer
>
-/****** SEInitializer_NssImpl.hxx/CLASS SEInitializer_NssImpl ***********
- *
- * NAME
- * SEInitializer_NssImpl -- Class to initialize a Security Context
- * instance
- *
- * FUNCTION
- * Use this class to initialize a XmlSec based Security Context
- * instance. After this instance is used up, use this class to free this
- * instance.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
{
-private:
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
-
public:
- SEInitializer_NssImpl(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF);
+ SEInitializer_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF );
virtual ~SEInitializer_NssImpl();
/* XSEInitializer */
- virtual com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLSecurityContext >
- SAL_CALL createSecurityContext( const rtl::OUString& certDB )
- throw (com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::crypto::XXMLSecurityContext >
+ SAL_CALL createSecurityContext( const ::rtl::OUString& )
+ throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL freeSecurityContext( const com::sun::star::uno::Reference<
com::sun::star::xml::crypto::XXMLSecurityContext >& securityContext )
@@ -78,27 +60,27 @@ public:
/* XServiceInfo */
virtual rtl::OUString SAL_CALL getImplementationName( )
- throw (com::sun::star::uno::RuntimeException);
+ throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
- throw (com::sun::star::uno::RuntimeException);
+ throw (::com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw (::com::sun::star::uno::RuntimeException);
};
rtl::OUString SEInitializer_NssImpl_getImplementationName()
- throw ( com::sun::star::uno::RuntimeException );
+ throw ( ::com::sun::star::uno::RuntimeException );
sal_Bool SAL_CALL SEInitializer_NssImpl_supportsService( const rtl::OUString& ServiceName )
- throw ( com::sun::star::uno::RuntimeException );
+ throw ( ::com::sun::star::uno::RuntimeException );
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl_getSupportedServiceNames( )
- throw ( com::sun::star::uno::RuntimeException );
+ throw ( ::com::sun::star::uno::RuntimeException );
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-SAL_CALL SEInitializer_NssImpl_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr)
- throw ( com::sun::star::uno::Exception );
+com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL SEInitializer_NssImpl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+ throw ( ::com::sun::star::uno::Exception );
#endif
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index 3fe691f4acda..c1ef726d5204 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -46,6 +46,9 @@
#include "certificateextension_xmlsecimpl.hxx"
+#ifndef _SANEXTENSION_NSSIMPL_HXX_
+#include "sanextension_nssimpl.hxx"
+#endif
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::security ;
@@ -120,13 +123,13 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s
//Convert the time to readable local time
PR_ExplodeTime( notBefore, PR_LocalTimeParameters, &explTime ) ;
- dateTime.HundredthSeconds = explTime.tm_usec / 1000 ;
- dateTime.Seconds = explTime.tm_sec ;
- dateTime.Minutes = explTime.tm_min ;
- dateTime.Hours = explTime.tm_hour ;
- dateTime.Day = explTime.tm_mday ;
- dateTime.Month = explTime.tm_month+1 ;
- dateTime.Year = explTime.tm_year ;
+ dateTime.HundredthSeconds = static_cast< sal_Int16 >( explTime.tm_usec / 1000 );
+ dateTime.Seconds = static_cast< sal_Int16 >( explTime.tm_sec );
+ dateTime.Minutes = static_cast< sal_Int16 >( explTime.tm_min );
+ dateTime.Hours = static_cast< sal_Int16 >( explTime.tm_hour );
+ dateTime.Day = static_cast< sal_Int16 >( explTime.tm_mday );
+ dateTime.Month = static_cast< sal_Int16 >( explTime.tm_month+1 );
+ dateTime.Year = static_cast< sal_Int16 >( explTime.tm_year );
return dateTime ;
} else {
@@ -149,13 +152,13 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s
//Convert the time to readable local time
PR_ExplodeTime( notAfter, PR_LocalTimeParameters, &explTime ) ;
- dateTime.HundredthSeconds = explTime.tm_usec / 1000 ;
- dateTime.Seconds = explTime.tm_sec ;
- dateTime.Minutes = explTime.tm_min ;
- dateTime.Hours = explTime.tm_hour ;
- dateTime.Day = explTime.tm_mday ;
- dateTime.Month = explTime.tm_month+1 ;
- dateTime.Year = explTime.tm_year ;
+ dateTime.HundredthSeconds = static_cast< sal_Int16 >( explTime.tm_usec / 1000 );
+ dateTime.Seconds = static_cast< sal_Int16 >( explTime.tm_sec );
+ dateTime.Minutes = static_cast< sal_Int16 >( explTime.tm_min );
+ dateTime.Hours = static_cast< sal_Int16 >( explTime.tm_hour );
+ dateTime.Day = static_cast< sal_Int16 >( explTime.tm_mday );
+ dateTime.Month = static_cast< sal_Int16 >( explTime.tm_month+1 );
+ dateTime.Year = static_cast< sal_Int16 >( explTime.tm_year );
return dateTime ;
} else {
@@ -198,12 +201,27 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s
Sequence< Reference< XCertificateExtension > > xExtns( len ) ;
for( extns = m_pCert->extensions, len = 0; *extns != NULL; extns ++, len ++ ) {
- pExtn = new CertificateExtension_XmlSecImpl() ;
+ const SECItem id = (*extns)->id;
+ ::rtl::OString oidString(CERT_GetOidString(&id));
+
+ // remove "OID." prefix if existing
+ ::rtl::OString objID;
+ ::rtl::OString oid("OID.");
+ if (oidString.match(oid))
+ objID = oidString.copy(oid.getLength());
+ else
+ objID = oidString;
+
+ if ( objID.equals("2.5.29.17") )
+ pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ;
+ else
+ pExtn = new CertificateExtension_XmlSecImpl() ;
+
if( (*extns)->critical.data == NULL )
crit = sal_False ;
else
crit = ( (*extns)->critical.data[0] == 0xFF ) ? sal_True : sal_False ;
- pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (*extns)->id.data, (*extns)->id.len, crit ) ;
+ pExtn->setCertExtn( (*extns)->value.data, (*extns)->value.len, (unsigned char*)objID.getStr(), objID.getLength(), crit ) ;
xExtns[len] = pExtn ;
}
@@ -227,7 +245,12 @@ sal_Int16 SAL_CALL X509Certificate_NssImpl :: getVersion() throw ( ::com::sun::s
pExtn = NULL ;
for( extns = m_pCert->extensions; *extns != NULL; extns ++ ) {
if( SECITEM_CompareItem( &idItem, &(*extns)->id ) == SECEqual ) {
- pExtn = new CertificateExtension_XmlSecImpl() ;
+ const SECItem id = (*extns)->id;
+ ::rtl::OString objId(CERT_GetOidString(&id));
+ if ( objId.equals("OID.2.5.29.17") )
+ pExtn = (CertificateExtension_XmlSecImpl*) new SanExtensionImpl() ;
+ else
+ pExtn = new CertificateExtension_XmlSecImpl() ;
if( (*extns)->critical.data == NULL )
crit = sal_False ;
else
diff --git a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx
index 466652ab25bb..171c7bc365a3 100644
--- a/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xsec_nss.cxx
@@ -57,21 +57,41 @@ void* SAL_CALL nss_component_getFactory( const sal_Char* pImplName , void* pServ
void* pRet = 0;
Reference< XSingleServiceFactory > xFactory ;
- if( pImplName != NULL && pServiceManager != NULL ) {
- if( XMLSignature_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ if( pImplName != NULL && pServiceManager != NULL )
+ {
+#ifdef XMLSEC_CRYPTO_NSS
+ if( SEInitializer_NssImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
+ xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ SEInitializer_NssImpl_createInstance, SEInitializer_NssImpl_getSupportedServiceNames() ) );
+ }
+ else if( XMLSignature_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = XMLSignature_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
- } else if( XMLSecurityContext_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ }
+ else if( XMLSecurityContext_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = XMLSecurityContext_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
- } else if( SecurityEnvironment_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ }
+ else if( SecurityEnvironment_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = SecurityEnvironment_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
- } else if( XMLEncryption_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ }
+ else if( XMLEncryption_NssImpl::impl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = XMLEncryption_NssImpl::impl_createFactory( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
- } else if( SEInitializer_NssImpl_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) ) {
+ }
+#else
+ if( ONSSInitializer_getImplementationName().equals( OUString::createFromAscii( pImplName ) ) )
+ {
xFactory = Reference< XSingleServiceFactory >( createSingleFactory(
reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
OUString::createFromAscii( pImplName ),
- SEInitializer_NssImpl_createInstance, SEInitializer_NssImpl_getSupportedServiceNames() ) );
+ ONSSInitializer_createInstance, ONSSInitializer_getSupportedServiceNames() ) );
}
+#endif
}
if( xFactory.is() ) {
diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
index 54a55cfc1c0c..7d09ac0af1dd 100644
--- a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
+++ b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
@@ -94,9 +94,7 @@ Reference< XInterface > SerialNumberAdapterImpl_createInstance(
extern "C"
{
-#if defined( XMLSEC_CRYPTO_NSS )
extern void* nss_component_getFactory( const sal_Char*, void*, void* );
-#endif
#if defined( XMLSEC_CRYPTO_MSCRYPTO )
extern void* mscrypt_component_getFactory( const sal_Char*, void*, void* );
@@ -141,11 +139,9 @@ void* SAL_CALL component_getFactory( const sal_Char* pImplName , void* pServiceM
xFactory->acquire() ;
pRet = xFactory.get() ;
} else {
-#if defined( XMLSEC_CRYPTO_NSS )
pRet = nss_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ;
if( pRet != NULL )
return pRet ;
-#endif
#if defined( XMLSEC_CRYPTO_MSCRYPTO )
pRet = mscrypt_component_getFactory( pImplName, pServiceManager, pRegistryKey ) ;
diff --git a/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt b/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt
index 7061a98fa15f..f6c52e5ac22f 100755
--- a/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt
+++ b/xmlsecurity/test_docs/CAs/Root_11/demoCA/index.txt
@@ -32,3 +32,4 @@ V 350113102213Z 101E unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/C
V 350113102601Z 101F unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=\x00U\x00s\x00e\x00r\x00 \x003\x000\x00<\x00 \x00>\x00#\x00;\x00 \x00"\x00+\x00"
V 350113102847Z 1020 unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=\x00U\x00s\x00e\x00r\x00 \x003\x001\x00 \x00\\x00"\x00a\x00,\x00b\x00"\x00+\x00C\x00N\x00=\x00U\x00S\x00,\x00 \x00>\x00 \x00\\x00\\x00d\x00e\x00 \x00<
V 350113104059Z 1021 unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=\x00U\x00s\x00e\x00r\x00 \x001\x004\x00 \x00"\x00,\x00m\x00i\x00d\x00d\x00l\x00e\x00 \x00q\x00u\x00o\x00t\x00e
+V 111108105139Z 1022 unknown /C=DE/ST=Hamburg/O=OpenOffice.org/OU=Development/CN=User 35
diff --git a/xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem b/xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem
new file mode 100644
index 000000000000..6902605756af
--- /dev/null
+++ b/xmlsecurity/test_docs/CAs/Root_11/demoCA/newcerts/1022.pem
@@ -0,0 +1,64 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 4130 (0x1022)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=Root 11
+ Validity
+ Not Before: Nov 8 10:51:39 2010 GMT
+ Not After : Nov 8 10:51:39 2011 GMT
+ Subject: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=User 35
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:9b:36:00:64:f3:ce:93:97:62:19:fa:78:d9:6f:
+ 92:6a:b9:d2:9a:4e:06:2c:02:52:cd:93:50:84:28:
+ 19:42:a2:4a:34:e2:cd:e6:b0:39:7a:c8:4d:84:bc:
+ 71:51:ed:5d:6c:7e:f9:cc:01:5a:4b:73:50:a9:3b:
+ 5d:ad:cc:89:f7:dc:e0:dd:0a:ff:48:01:a9:34:19:
+ c0:6a:ee:4b:20:f4:cf:3c:94:c1:ae:88:0f:c9:42:
+ 1a:a6:47:31:fe:37:04:00:bb:ec:07:5f:cb:ee:70:
+ c4:c7:7c:6f:ee:03:19:76:de:0b:df:d0:48:91:67:
+ 55:9b:90:91:f4:ce:56:04:d5
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage:
+ Digital Signature, Non Repudiation, Key Encipherment
+ X509v3 Subject Key Identifier:
+ 91:47:AC:29:95:5D:EF:72:14:8F:82:45:07:E2:94:49:75:C6:7D:73
+ X509v3 Authority Key Identifier:
+ keyid:E8:6A:BB:C2:90:EA:6C:70:22:3E:F6:F6:48:1B:03:E6:BE:B7:A6:55
+
+ X509v3 Subject Alternative Name:
+ DNS:alt.openoffice.org, IP Address:192.168.7.1, IP Address:13:0:0:0:0:0:0:17, email:my@other.address, Registered ID:1.2.3.4, othername:<unsupported>, DirName:/C=DE/O=OpenOffice.org/OU=Development/CN=User 32 Root 11, URI:http://my.url.here/
+ Signature Algorithm: sha1WithRSAEncryption
+ 6e:80:e6:1e:86:3d:d2:65:a6:17:fa:80:2d:2e:dc:85:32:05:
+ a1:69:82:e1:79:d1:dc:de:69:cd:9e:f0:cc:90:75:a9:45:ee:
+ 73:46:fe:29:69:c0:99:bb:fc:3a:db:c0:5f:69:c6:b7:ea:9a:
+ 63:b2:8e:29:2c:a5:5a:88:88:94:75:4b:ab:0a:72:f6:3a:aa:
+ 5d:6b:3a:5c:b6:9b:57:f5:c1:51:af:df:3c:a6:8a:a3:da:70:
+ 66:61:49:12:06:78:98:9f:bc:78:3c:43:6d:08:94:aa:32:b6:
+ f3:cc:af:0d:29:fe:96:47:7d:fe:4a:61:48:90:11:0b:bd:0f:
+ a0:fd
+-----BEGIN CERTIFICATE-----
+MIIDajCCAtOgAwIBAgICECIwDQYJKoZIhvcNAQEFBQAwYDELMAkGA1UEBhMCREUx
+EDAOBgNVBAgTB0hhbWJ1cmcxFzAVBgNVBAoTDk9wZW5PZmZpY2Uub3JnMRQwEgYD
+VQQLEwtEZXZlbG9wbWVudDEQMA4GA1UEAxMHUm9vdCAxMTAeFw0xMDExMDgxMDUx
+MzlaFw0xMTExMDgxMDUxMzlaMGAxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdIYW1i
+dXJnMRcwFQYDVQQKEw5PcGVuT2ZmaWNlLm9yZzEUMBIGA1UECxMLRGV2ZWxvcG1l
+bnQxEDAOBgNVBAMTB1VzZXIgMzUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
+AJs2AGTzzpOXYhn6eNlvkmq50ppOBiwCUs2TUIQoGUKiSjTizeawOXrITYS8cVHt
+XWx++cwBWktzUKk7Xa3Miffc4N0K/0gBqTQZwGruSyD0zzyUwa6ID8lCGqZHMf43
+BAC77Adfy+5wxMd8b+4DGXbeC9/QSJFnVZuQkfTOVgTVAgMBAAGjggExMIIBLTAL
+BgNVHQ8EBAMCBeAwHQYDVR0OBBYEFJFHrCmVXe9yFI+CRQfilEl1xn1zMB8GA1Ud
+IwQYMBaAFOhqu8KQ6mxwIj729kgbA+a+t6ZVMIHdBgNVHREEgdUwgdKCEmFsdC5v
+cGVub2ZmaWNlLm9yZ4cEwKgHAYcQABMAAAAAAAAAAAAAAAAAF4EQbXlAb3RoZXIu
+YWRkcmVzc4gDKgMEoB4GAyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKkWDBW
+MQswCQYDVQQGEwJERTEXMBUGA1UEChMOT3Blbk9mZmljZS5vcmcxFDASBgNVBAsT
+C0RldmVsb3BtZW50MRgwFgYDVQQDEw9Vc2VyIDMyIFJvb3QgMTGGE2h0dHA6Ly9t
+eS51cmwuaGVyZS8wDQYJKoZIhvcNAQEFBQADgYEAboDmHoY90mWmF/qALS7chTIF
+oWmC4XnR3N5pzZ7wzJB1qUXuc0b+KWnAmbv8OtvAX2nGt+qaY7KOKSylWoiIlHVL
+qwpy9jqqXWs6XLabV/XBUa/fPKaKo9pwZmFJEgZ4mJ+8eDxDbQiUqjK288yvDSn+
+lkd9/kphSJARC70PoP0=
+-----END CERTIFICATE-----
diff --git a/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial b/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial
index c7781419a38b..b70608fe859d 100755
--- a/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial
+++ b/xmlsecurity/test_docs/CAs/Root_11/demoCA/serial
@@ -1 +1 @@
-1022
+1023
diff --git a/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg b/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg
index 8bf98da50e74..9d98db508b63 100755
--- a/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg
+++ b/xmlsecurity/test_docs/CAs/Root_11/openssl.cfg
@@ -178,13 +178,16 @@ authorityKeyIdentifier=keyid,issuer
# An alternative to produce certificates that aren't
# deprecated according to PKIX.
# subjectAltName=email:move
-subjectAltName=dirName:dn_subjectAlt
-# Copy subject details
-# issuerAltName=issuer:copy
-
-
-[dn_subjectAlt]
-CN=User 14 Root 11
+subjectAltName=DNS:alt.openoffice.org,IP:192.168.7.1,IP:13::17,email:my@other.address,RID:1.2.3.4,otherName:1.2.3.4;UTF8:some other identifier,dirName:dir_sect,URI:http://my.url.here/
+# Copy subject details
+# issuerAltName=issuer:copy
+
+
+[dir_sect]
+C=DE
+O=OpenOffice.org
+OU=Development
+CN=User 32 Root 11
[ v3_req ]
diff --git a/xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt b/xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt
new file mode 100644
index 000000000000..6902605756af
--- /dev/null
+++ b/xmlsecurity/test_docs/certs/end_certs/User_35_Root_11.crt
@@ -0,0 +1,64 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 4130 (0x1022)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=Root 11
+ Validity
+ Not Before: Nov 8 10:51:39 2010 GMT
+ Not After : Nov 8 10:51:39 2011 GMT
+ Subject: C=DE, ST=Hamburg, O=OpenOffice.org, OU=Development, CN=User 35
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:9b:36:00:64:f3:ce:93:97:62:19:fa:78:d9:6f:
+ 92:6a:b9:d2:9a:4e:06:2c:02:52:cd:93:50:84:28:
+ 19:42:a2:4a:34:e2:cd:e6:b0:39:7a:c8:4d:84:bc:
+ 71:51:ed:5d:6c:7e:f9:cc:01:5a:4b:73:50:a9:3b:
+ 5d:ad:cc:89:f7:dc:e0:dd:0a:ff:48:01:a9:34:19:
+ c0:6a:ee:4b:20:f4:cf:3c:94:c1:ae:88:0f:c9:42:
+ 1a:a6:47:31:fe:37:04:00:bb:ec:07:5f:cb:ee:70:
+ c4:c7:7c:6f:ee:03:19:76:de:0b:df:d0:48:91:67:
+ 55:9b:90:91:f4:ce:56:04:d5
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage:
+ Digital Signature, Non Repudiation, Key Encipherment
+ X509v3 Subject Key Identifier:
+ 91:47:AC:29:95:5D:EF:72:14:8F:82:45:07:E2:94:49:75:C6:7D:73
+ X509v3 Authority Key Identifier:
+ keyid:E8:6A:BB:C2:90:EA:6C:70:22:3E:F6:F6:48:1B:03:E6:BE:B7:A6:55
+
+ X509v3 Subject Alternative Name:
+ DNS:alt.openoffice.org, IP Address:192.168.7.1, IP Address:13:0:0:0:0:0:0:17, email:my@other.address, Registered ID:1.2.3.4, othername:<unsupported>, DirName:/C=DE/O=OpenOffice.org/OU=Development/CN=User 32 Root 11, URI:http://my.url.here/
+ Signature Algorithm: sha1WithRSAEncryption
+ 6e:80:e6:1e:86:3d:d2:65:a6:17:fa:80:2d:2e:dc:85:32:05:
+ a1:69:82:e1:79:d1:dc:de:69:cd:9e:f0:cc:90:75:a9:45:ee:
+ 73:46:fe:29:69:c0:99:bb:fc:3a:db:c0:5f:69:c6:b7:ea:9a:
+ 63:b2:8e:29:2c:a5:5a:88:88:94:75:4b:ab:0a:72:f6:3a:aa:
+ 5d:6b:3a:5c:b6:9b:57:f5:c1:51:af:df:3c:a6:8a:a3:da:70:
+ 66:61:49:12:06:78:98:9f:bc:78:3c:43:6d:08:94:aa:32:b6:
+ f3:cc:af:0d:29:fe:96:47:7d:fe:4a:61:48:90:11:0b:bd:0f:
+ a0:fd
+-----BEGIN CERTIFICATE-----
+MIIDajCCAtOgAwIBAgICECIwDQYJKoZIhvcNAQEFBQAwYDELMAkGA1UEBhMCREUx
+EDAOBgNVBAgTB0hhbWJ1cmcxFzAVBgNVBAoTDk9wZW5PZmZpY2Uub3JnMRQwEgYD
+VQQLEwtEZXZlbG9wbWVudDEQMA4GA1UEAxMHUm9vdCAxMTAeFw0xMDExMDgxMDUx
+MzlaFw0xMTExMDgxMDUxMzlaMGAxCzAJBgNVBAYTAkRFMRAwDgYDVQQIEwdIYW1i
+dXJnMRcwFQYDVQQKEw5PcGVuT2ZmaWNlLm9yZzEUMBIGA1UECxMLRGV2ZWxvcG1l
+bnQxEDAOBgNVBAMTB1VzZXIgMzUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
+AJs2AGTzzpOXYhn6eNlvkmq50ppOBiwCUs2TUIQoGUKiSjTizeawOXrITYS8cVHt
+XWx++cwBWktzUKk7Xa3Miffc4N0K/0gBqTQZwGruSyD0zzyUwa6ID8lCGqZHMf43
+BAC77Adfy+5wxMd8b+4DGXbeC9/QSJFnVZuQkfTOVgTVAgMBAAGjggExMIIBLTAL
+BgNVHQ8EBAMCBeAwHQYDVR0OBBYEFJFHrCmVXe9yFI+CRQfilEl1xn1zMB8GA1Ud
+IwQYMBaAFOhqu8KQ6mxwIj729kgbA+a+t6ZVMIHdBgNVHREEgdUwgdKCEmFsdC5v
+cGVub2ZmaWNlLm9yZ4cEwKgHAYcQABMAAAAAAAAAAAAAAAAAF4EQbXlAb3RoZXIu
+YWRkcmVzc4gDKgMEoB4GAyoDBKAXDBVzb21lIG90aGVyIGlkZW50aWZpZXKkWDBW
+MQswCQYDVQQGEwJERTEXMBUGA1UEChMOT3Blbk9mZmljZS5vcmcxFDASBgNVBAsT
+C0RldmVsb3BtZW50MRgwFgYDVQQDEw9Vc2VyIDMyIFJvb3QgMTGGE2h0dHA6Ly9t
+eS51cmwuaGVyZS8wDQYJKoZIhvcNAQEFBQADgYEAboDmHoY90mWmF/qALS7chTIF
+oWmC4XnR3N5pzZ7wzJB1qUXuc0b+KWnAmbv8OtvAX2nGt+qaY7KOKSylWoiIlHVL
+qwpy9jqqXWs6XLabV/XBUa/fPKaKo9pwZmFJEgZ4mJ+8eDxDbQiUqjK288yvDSn+
+lkd9/kphSJARC70PoP0=
+-----END CERTIFICATE-----
diff --git a/xmlsecurity/util/makefile.mk b/xmlsecurity/util/makefile.mk
index ff5a952fc2e4..de84faa27bcd 100644
--- a/xmlsecurity/util/makefile.mk
+++ b/xmlsecurity/util/makefile.mk
@@ -81,10 +81,10 @@ SHL2LIBS= \
.IF "$(CRYPTO_ENGINE)" == "mscrypto"
SHL2LIBS += \
$(SLB)$/xs_mscrypt.lib
-.ELSE
+.ENDIF
+
SHL2LIBS += \
$(SLB)$/xs_nss.lib
-.ENDIF
.ENDIF
@@ -118,19 +118,22 @@ SHL2STDLIBS += $(MOZ_NSS_LIBS)
.IF "$(CRYPTO_ENGINE)" == "mscrypto"
SHL2STDLIBS+= $(MSCRYPTOLIBS)
+# SHL2STDLIBS+= $(XMLSECLIB) $(LIBXML2LIB) $(NSS3LIB) $(NSPR4LIB) $(PLC4LIB)
+SHL2STDLIBS+= $(NSS3LIB) $(NSPR4LIB)
.ELSE
SHL2STDLIBS+= $(NSSCRYPTOLIBS)
.ENDIF
+
SHL2IMPLIB = $(SHL2TARGET)
SHL2DEF = $(MISC)$/$(SHL2TARGET).def
DEF2NAME = $(SHL2TARGET)
.IF "$(CRYPTO_ENGINE)" == "mscrypto"
DEF2EXPORTFILE = exports_xsmscrypt.dxp
-.ELSE
-DEF2EXPORTFILE = exports_xsnss.dxp
.ENDIF
+DEF2EXPORTFILE = exports_xsnss.dxp
+
SRSFILELIST= \
$(SRS)$/component.srs \
$(SRS)$/dialogs.srs
diff --git a/xmlsecurity/util/xsec_xmlsec.component b/xmlsecurity/util/xsec_xmlsec.component
index de991899f026..df4c2a7b26ee 100644
--- a/xmlsecurity/util/xsec_xmlsec.component
+++ b/xmlsecurity/util/xsec_xmlsec.component
@@ -32,6 +32,7 @@
<service name="com.sun.star.security.SerialNumberAdapter"/>
</implementation>
<implementation name="com.sun.star.xml.security.bridge.xmlsec.SEInitializer_NssImpl">
+ <service name="com.sun.star.xml.crypto.NSSInitializer"/>
<service name="com.sun.star.xml.crypto.SEInitializer"/>
</implementation>
<implementation name="com.sun.star.xml.security.bridge.xmlsec.SecurityEnvironment_NssImpl">
diff --git a/xmlsecurity/util/xsec_xmlsec.windows.component b/xmlsecurity/util/xsec_xmlsec.windows.component
index fb11cc6e9d36..7b4ef87a9480 100644
--- a/xmlsecurity/util/xsec_xmlsec.windows.component
+++ b/xmlsecurity/util/xsec_xmlsec.windows.component
@@ -31,6 +31,9 @@
<implementation name="com.sun.star.security.SerialNumberAdapter">
<service name="com.sun.star.security.SerialNumberAdapter"/>
</implementation>
+ <implementation name="com.sun.star.xml.security.bridge.xmlsec.NSSInitializer_NssImpl">
+ <service name="com.sun.star.xml.crypto.NSSInitializer"/>
+ </implementation>
<implementation name="com.sun.star.xml.security.bridge.xmlsec.SEInitializer_MSCryptImpl">
<service name="com.sun.star.xml.crypto.SEInitializer"/>
</implementation>