summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UnoControls/source/controls/makefile.mk3
-rwxr-xr-xaccessibility/prj/build.lst6
-rw-r--r--accessibility/source/extended/accessiblelistbox.cxx26
-rw-r--r--accessibility/source/extended/accessibletablistbox.cxx14
-rw-r--r--accessibility/source/standard/vclxaccessiblebox.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessibletoolboxitem.cxx8
-rw-r--r--accessibility/workben/TODO13
-rw-r--r--accessibility/workben/makefile9
-rw-r--r--accessibility/workben/makefile.in32
-rw-r--r--accessibility/workben/makefile.mk40
-rw-r--r--accessibility/workben/org/openoffice/accessibility/Makefile6
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java724
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java187
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/Makefile13
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java356
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java446
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile15
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java104
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java271
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common65
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk86
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/makefile.common3
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/makefile.mk88
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/manifest3
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java188
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java200
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java123
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java251
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java157
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java126
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile71
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java249
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common66
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk82
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java229
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java149
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java153
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java158
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java182
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java194
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/Makefile13
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java90
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java344
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainerWindow.java35
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java181
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java301
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ServiceInterfaceView.java150
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java233
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java195
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java501
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java151
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common76
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk82
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java156
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/Makefile13
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java242
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java213
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java170
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java156
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common65
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk82
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java122
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/Connector.java50
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/InformationWriter.java421
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/Makefile69
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java125
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java263
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java169
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/Options.java106
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/SimpleOffice.java413
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/makefile.common67
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/makefile.mk86
-rw-r--r--automation/source/communi/communi.cxx2
-rw-r--r--automation/source/server/server.cxx2
-rw-r--r--automation/source/testtool/makefile.mk5
-rw-r--r--automation/source/testtool/tcommuni.cxx1
-rw-r--r--automation/source/testtool/testtool.ini2
-rw-r--r--automation/util/makefile.mk4
-rwxr-xr-xautomation/util/manually_added_ids.hid5
-rw-r--r--basctl/inc/basidesh.hrc9
-rw-r--r--basctl/sdi/baside.sdi6
-rw-r--r--basctl/sdi/makefile.mk4
-rw-r--r--basctl/source/basicide/baside2.cxx14
-rw-r--r--basctl/source/basicide/baside2.hxx1
-rw-r--r--basctl/source/basicide/baside3.cxx408
-rw-r--r--basctl/source/basicide/basides3.cxx10
-rw-r--r--basctl/source/basicide/basidesh.src42
-rw-r--r--basctl/source/basicide/brkdlg.src8
-rw-r--r--basctl/source/inc/baside3.hxx5
-rw-r--r--basctl/source/inc/basidesh.hxx3
-rw-r--r--basctl/uiconfig/basicide/toolbar/dialogbar.xml5
-rw-r--r--basctl/uiconfig/basicide/toolbar/macrobar.xml6
-rw-r--r--basctl/util/makefile.mk1
-rw-r--r--bean/com/sun/star/beans/makefile.mk3
-rw-r--r--bean/com/sun/star/comp/beans/makefile.mk3
-rw-r--r--bean/util/makefile.mk3
-rwxr-xr-xcrashrep/source/unx/makefile.mk2
-rw-r--r--embedserv/source/inprocserv/makefile.mk12
-rw-r--r--extensions/source/abpilot/makefile.mk1
-rw-r--r--extensions/source/abpilot/typeselectionpage.cxx3
-rw-r--r--extensions/source/activex/main/SOActiveX.h2
-rw-r--r--extensions/source/config/ldap/ldapaccess.cxx89
-rw-r--r--extensions/source/config/ldap/ldapaccess.hxx35
-rw-r--r--extensions/source/config/ldap/ldapuserprof.cxx6
-rw-r--r--extensions/source/config/ldap/ldapuserprofilebe.cxx29
-rw-r--r--extensions/source/config/ldap/makefile.mk1
-rw-r--r--extensions/source/dbpilots/listcombowizard.cxx3
-rw-r--r--extensions/source/ole/oleobjw.hxx6
-rw-r--r--extensions/source/oooimprovecore/makefile.mk4
-rw-r--r--extensions/source/oooimprovement/config.cxx2
-rw-r--r--extensions/source/oooimprovement/config.hxx2
-rw-r--r--extensions/source/oooimprovement/corecontroller.cxx12
-rw-r--r--extensions/source/oooimprovement/corecontroller.hxx4
-rw-r--r--extensions/source/oooimprovement/errormail.cxx6
-rw-r--r--extensions/source/oooimprovement/invite_job.cxx16
-rw-r--r--extensions/source/oooimprovement/invite_job.hxx4
-rw-r--r--extensions/source/oooimprovement/makefile.mk4
-rw-r--r--extensions/source/oooimprovement/myconfigurationhelper.cxx27
-rw-r--r--extensions/source/oooimprovement/myconfigurationhelper.hxx34
-rw-r--r--extensions/source/oooimprovement/soaprequest.cxx19
-rw-r--r--extensions/source/plugin/aqua/macmgr.cxx49
-rw-r--r--extensions/source/plugin/aqua/makefile.mk1
-rw-r--r--extensions/source/plugin/base/makefile.mk1
-rw-r--r--extensions/source/plugin/base/manager.cxx38
-rw-r--r--extensions/source/plugin/inc/plugin/impl.hxx3
-rw-r--r--extensions/source/plugin/inc/plugin/unx/plugcon.hxx6
-rw-r--r--extensions/source/plugin/unx/unxmgr.cxx2
-rw-r--r--extensions/source/plugin/util/makefile.mk4
-rw-r--r--extensions/source/plugin/win/winmgr.cxx2
-rw-r--r--extensions/source/propctrlr/browserlistbox.cxx69
-rw-r--r--extensions/source/propctrlr/browserlistbox.hxx1
-rw-r--r--extensions/source/propctrlr/eformspropertyhandler.cxx12
-rw-r--r--extensions/source/propctrlr/eformspropertyhandler.hxx2
-rw-r--r--extensions/source/propctrlr/eventhandler.cxx41
-rw-r--r--extensions/source/propctrlr/eventhandler.hxx8
-rw-r--r--extensions/source/propctrlr/formbrowsertools.cxx15
-rw-r--r--extensions/source/propctrlr/formbrowsertools.hxx1
-rw-r--r--extensions/source/propctrlr/makefile.mk1
-rw-r--r--extensions/source/propctrlr/propcontroller.cxx7
-rw-r--r--extensions/source/propctrlr/propcontroller.hxx1
-rw-r--r--extensions/source/propctrlr/standardcontrol.hxx28
-rw-r--r--extensions/source/scanner/sanedlg.cxx13
-rw-r--r--extensions/source/scanner/scanunx.cxx9
-rw-r--r--extensions/util/hidother.src570
-rw-r--r--forms/qa/integration/forms/TestSkeleton.java50
-rw-r--r--forms/qa/makefile.mk9
-rw-r--r--forms/source/component/FormComponent.cxx4
-rw-r--r--forms/source/xforms/model_ui.cxx11
-rw-r--r--forms/source/xforms/xpathlib/xpathlib.cxx2
-rw-r--r--forms/util/makefile.mk18
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/makefile.mk4
-rw-r--r--package/inc/ZipEntry.hxx4
-rw-r--r--package/inc/ZipFile.hxx15
-rw-r--r--package/inc/ZipPackage.hxx50
-rw-r--r--package/inc/ZipPackageBuffer.hxx2
-rw-r--r--package/inc/ZipPackageFolder.hxx2
-rw-r--r--package/inc/zipfileaccess.hxx6
-rw-r--r--package/source/manifest/ManifestDefines.hxx7
-rw-r--r--package/source/manifest/ManifestExport.cxx47
-rw-r--r--package/source/manifest/makefile.mk4
-rw-r--r--package/source/xstor/makefile.mk4
-rw-r--r--package/source/xstor/owriteablestream.cxx9
-rw-r--r--package/source/xstor/xstorage.cxx8
-rw-r--r--package/source/zipapi/XUnbufferedStream.cxx13
-rw-r--r--package/source/zipapi/XUnbufferedStream.hxx13
-rw-r--r--package/source/zipapi/ZipFile.cxx91
-rw-r--r--package/source/zipapi/ZipOutputStream.cxx8
-rw-r--r--package/source/zipapi/makefile.mk3
-rw-r--r--package/source/zippackage/ZipPackage.cxx657
-rw-r--r--package/source/zippackage/ZipPackageEntry.cxx14
-rw-r--r--package/source/zippackage/ZipPackageEntry.hxx1
-rw-r--r--package/source/zippackage/ZipPackageFolder.cxx77
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx45
-rw-r--r--package/source/zippackage/ZipPackageStream.hxx8
-rw-r--r--package/source/zippackage/makefile.mk4
-rw-r--r--package/source/zippackage/zipfileaccess.cxx37
-rw-r--r--package/util/makefile.mk4
-rw-r--r--setup_native/prj/build.lst8
-rw-r--r--setup_native/prj/d.lst13
-rw-r--r--setup_native/registry/data/org/openoffice/Office/Jobs.xcu78
-rw-r--r--setup_native/registry/data/org/openoffice/Office/makefile.mk79
-rw-r--r--setup_native/scripts/fake-db.spec1
-rw-r--r--setup_native/scripts/mac_install.script10
-rw-r--r--setup_native/scripts/makefile.mk6
-rw-r--r--setup_native/scripts/osx_install_languagepack.applescript115
-rw-r--r--setup_native/scripts/osx_install_patch.applescript113
-rw-r--r--setup_native/scripts/source/getuid.c27
-rwxr-xr-xsetup_native/source/java/javaversion.dat26
-rw-r--r--setup_native/source/java/javaversion2.dat26
-rw-r--r--setup_native/source/mac/Info.plist.langpack36
-rw-r--r--setup_native/source/mac/macinstall.ulf68
-rw-r--r--setup_native/source/mac/makefile.mk65
-rw-r--r--setup_native/source/mac/ooo3_installer.icnsbin0 -> 49809 bytes
-rw-r--r--setup_native/source/packinfo/spellchecker_selection.txt4
-rw-r--r--setup_native/source/registration/com/sun/star/registration/Registration.java342
-rw-r--r--setup_native/source/registration/com/sun/star/registration/makefile.mk59
-rw-r--r--setup_native/source/registration/com/sun/star/registration/manifest2
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/BrowserSupport.java205
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/Installer.java947
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java194
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/RegistrationData.java473
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/RegistrationDocument.java374
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/Registry.java558
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/ServiceTag.java640
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/SolarisServiceTag.java68
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java159
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/SunConnection.java296
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java380
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/SystemEnvironment.java341
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/Util.java297
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java145
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/makefile.mk83
-rw-r--r--setup_native/source/registration/com/sun/star/servicetag/resources/product_registration.xsd301
-rw-r--r--setup_native/source/win32/customactions/indexingfilter/makefile.mk1
-rw-r--r--setup_native/source/win32/customactions/javafilter/makefile.mk1
-rw-r--r--setup_native/source/win32/customactions/languagepacks/makefile.mk1
-rwxr-xr-xsetup_native/source/win32/customactions/patch/makefile.mk1
-rw-r--r--setup_native/source/win32/customactions/quickstarter/makefile.mk1
-rw-r--r--setup_native/source/win32/customactions/regactivex/makefile.mk1
-rw-r--r--setup_native/source/win32/customactions/regpatchactivex/makefile.mk6
-rw-r--r--setup_native/source/win32/customactions/relnotes/makefile.mk1
-rw-r--r--setup_native/source/win32/customactions/shellextensions/makefile.mk1
-rw-r--r--setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx20
-rw-r--r--setup_native/source/win32/customactions/tools/makefile.mk1
-rw-r--r--wizards/com/sun/star/wizards/ui/WizardDialog.java19
-rw-r--r--wizards/source/euro/Init.xba65
-rw-r--r--wizards/source/euro/euro.src17
-rw-r--r--wizards/source/importwizard/ImportDialog.xdl2
-rw-r--r--wizards/source/schedule/LocalHolidays.xba4
-rw-r--r--xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx25
-rw-r--r--xmlsecurity/inc/xmlsecurity/documentsignaturehelper.hxx29
-rw-r--r--xmlsecurity/inc/xmlsecurity/global.hrc2
-rw-r--r--xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx7
-rw-r--r--xmlsecurity/prj/build.lst2
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx159
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.hxx24
-rw-r--r--xmlsecurity/source/dialogs/certificateviewer.cxx18
-rw-r--r--xmlsecurity/source/dialogs/dialogs.hrc1
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx397
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc (renamed from setup_native/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java)95
-rw-r--r--xmlsecurity/source/dialogs/digitalsignaturesdialog.src19
-rw-r--r--xmlsecurity/source/dialogs/resourcemanager.cxx320
-rw-r--r--xmlsecurity/source/dialogs/resourcemanager.hxx10
-rw-r--r--xmlsecurity/source/helper/documentsignaturehelper.cxx750
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper.cxx8
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper2.cxx35
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx102
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx6
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx139
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx96
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx8
-rw-r--r--xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx248
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx19
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx3
-rw-r--r--xmlsecurity/util/makefile.mk2
255 files changed, 14845 insertions, 7788 deletions
diff --git a/UnoControls/source/controls/makefile.mk b/UnoControls/source/controls/makefile.mk
index 0255791fa293..bccdd5704bae 100644
--- a/UnoControls/source/controls/makefile.mk
+++ b/UnoControls/source/controls/makefile.mk
@@ -33,6 +33,7 @@ PRJ=..$/..
PRJNAME=UnoControls
TARGET=controls
ENABLE_EXCEPTIONS=TRUE
+.IF "$(L10N_framework)"==""
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
@@ -47,4 +48,6 @@ SLOFILES=\
$(SLO)$/statusindicator.obj
# --- Targets ------------------------------------------------------
+.ENDIF # L10N_framework
+
.INCLUDE : target.mk
diff --git a/accessibility/prj/build.lst b/accessibility/prj/build.lst
index 2288410ffba8..351473e38450 100755
--- a/accessibility/prj/build.lst
+++ b/accessibility/prj/build.lst
@@ -9,3 +9,9 @@ ac accessibility\source\helper nmake - all ac_h
ac accessibility\source\standard nmake - all ac_standard ac_helper ac_inc NULL
ac accessibility\source\extended nmake - all ac_extended ac_inc NULL
ac accessibility\util nmake - all ac_util ac_helper ac_standard ac_extended NULL
+ac accessibility\workben\org\openoffice\accessibility\awb nmake - all ac_awb_main ac_awb_misc ac_awb_canvas ac_awb_view ac_awb_tree NULL
+ac accessibility\workben\org\openoffice\accessibility\misc nmake - all ac_awb_misc NULL
+ac accessibility\workben\org\openoffice\accessibility\awb\canvas nmake - all ac_awb_canvas ac_awb_tree NULL
+ac accessibility\workben\org\openoffice\accessibility\awb\tree nmake - all ac_awb_tree ac_awb_misc NULL
+ac accessibility\workben\org\openoffice\accessibility\awb\view nmake - all ac_awb_view ac_awb_view_text NULL
+ac accessibility\workben\org\openoffice\accessibility\awb\view\text nmake - all ac_awb_view_text NULL
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index f75f9a1b265f..2db3debe33a4 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -132,6 +132,32 @@ namespace accessibility
}
}
break;
+
+ // --> OD 2009-04-01 #i92103#
+ case VCLEVENT_LISTBOX_ENTRY_EXPANDED :
+ case VCLEVENT_LISTBOX_ENTRY_COLLAPSED :
+ {
+ SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
+ {
+ AccessibleListBoxEntry* pAccListBoxEntry =
+ new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ Reference< XAccessible > xChild = pAccListBoxEntry;
+ const short nAccEvent =
+ ( rVclWindowEvent.GetId() == VCLEVENT_LISTBOX_ENTRY_EXPANDED )
+ ? AccessibleEventId::LISTBOX_ENTRY_EXPANDED
+ : AccessibleEventId::LISTBOX_ENTRY_COLLAPSED;
+ uno::Any aListBoxEntry;
+ aListBoxEntry <<= xChild;
+ NotifyAccessibleEvent( nAccEvent, Any(), aListBoxEntry );
+ if ( getListBox() && getListBox()->HasFocus() )
+ {
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), aListBoxEntry );
+ }
+ }
+ break;
+ }
+ // <--
}
default:
VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
diff --git a/accessibility/source/extended/accessibletablistbox.cxx b/accessibility/source/extended/accessibletablistbox.cxx
index 42fba56981e5..2912056827b4 100644
--- a/accessibility/source/extended/accessibletablistbox.cxx
+++ b/accessibility/source/extended/accessibletablistbox.cxx
@@ -107,7 +107,7 @@ namespace accessibility
sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount()
throw ( uno::RuntimeException )
{
- return 1; // no header, only table
+ return 2; // header and table
}
// -----------------------------------------------------------------------------
@@ -125,11 +125,17 @@ namespace accessibility
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
- if ( nChildIndex != 0 )
- // only one child
+ if ( nChildIndex < 0 || nChildIndex > 1 )
throw IndexOutOfBoundsException();
- Reference< XAccessible > xRet = implGetFixedChild( ::svt::BBINDEX_TABLE );
+ Reference< XAccessible > xRet;
+ if (nChildIndex == 0)
+ {
+ //! so far the actual implementation object only supports column headers
+ xRet = implGetFixedChild( ::svt::BBINDEX_COLUMNHEADERBAR );
+ }
+ else if (nChildIndex == 1)
+ xRet = implGetFixedChild( ::svt::BBINDEX_TABLE );
if ( !xRet.is() )
throw RuntimeException();
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index bc6e77ab6191..ad1f4ab2e01b 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -155,7 +155,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
// combobox, however, we have to help the list with providing
// the text of the currently selected item.
VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
- if (pList != NULL)
+ if (pList != NULL && m_xText.is())
{
Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
if ( xText.is() )
diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
index f89dbe1767c3..76507d22e3cf 100644
--- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
@@ -47,6 +47,7 @@
#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/unohelp2.hxx>
+#include <vcl/help.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/helper/externallock.hxx>
#include <unotools/accessiblestatesethelper.hxx>
@@ -618,9 +619,12 @@ awt::FontDescriptor SAL_CALL VCLXAccessibleToolBoxItem::getFontMetrics( const Re
::rtl::OUString sRet;
if ( m_pToolBox )
{
- sRet = m_pToolBox->GetQuickHelpText( m_nItemId );
+ if ( Help::IsExtHelpEnabled() )
+ sRet = m_pToolBox->GetHelpText( m_nItemId );
+ else
+ sRet = m_pToolBox->GetQuickHelpText( m_nItemId );
if ( !sRet.getLength() )
- // no quick help text set, so use item text
+ // no help text set, so use item text
sRet = m_pToolBox->GetItemText( m_nItemId );
}
return sRet;
diff --git a/accessibility/workben/TODO b/accessibility/workben/TODO
new file mode 100644
index 000000000000..6fdfd5cb81aa
--- /dev/null
+++ b/accessibility/workben/TODO
@@ -0,0 +1,13 @@
+This is a unsorted list of TODO's and idea regarding the Accessibility Workbench
+
+* increase repaint performance
+* fix paint problems in ObjectViewContainer for e.g. File menu
+* change package structure to be flat (apps don't need deep package names)
+* add ant build script(s)
+* evaluate TreeTable as enhanced overview
+* add error panel and a bunch of consistency checks
+* add focus tracking mode
+* evaluate drawing transparent frames at screen coordinates of an object
+* enhance text view (colors)
+* add table view
+* more generic view loading (Class.forName())
diff --git a/accessibility/workben/makefile b/accessibility/workben/makefile
new file mode 100644
index 000000000000..4bd7c05e44dd
--- /dev/null
+++ b/accessibility/workben/makefile
@@ -0,0 +1,9 @@
+all:
+ cd source/org/openoffice/accessibility ; $(MAKE) all
+
+ROOT=source
+SUBDIRS=source/org/openoffice/accessibility
+include source/makefile.in
+
+run: all
+ $(JAVA) -classpath $(CLASSPATH) org.openoffice.accessibility.awb.AccessibilityWorkBench
diff --git a/accessibility/workben/makefile.in b/accessibility/workben/makefile.in
new file mode 100644
index 000000000000..ad97448e7780
--- /dev/null
+++ b/accessibility/workben/makefile.in
@@ -0,0 +1,32 @@
+PRJ=$(ROOT)/..
+SETTINGS=$(OO_SDK_HOME)/settings
+include $(SETTINGS)/settings.mk
+include $(SETTINGS)/std.mk
+include $(SETTINGS)/dk.mk
+
+OUT_COMP_JAVA = $(OUT_CLASS)/$(patsubst .,/,$(PACKAGE))
+JAVAC=$(JAVA_HOME)/bin/javac
+JAVA=$(JAVA_HOME)/bin/java
+CLASS_FILES = $(patsubst %.java, %.class, $(JAVAFILES))
+CLASSPATH = $(subst $(EMPTYSTRING) $(PATH_SEPARATOR),$(PATH_SEPARATOR),$(OFFICE_CLASSES_DIR)/jurt.jar\
+ $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/unoil.jar\
+ $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/ridl.jar\
+ $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/sandbox.jar\
+ $(PATH_SEPARATOR)$(OFFICE_CLASSES_DIR)/juh.jar\
+ $(PATH_SEPARATOR)$(OUT_COMP_JAVA)\
+ $(PATH_SEPARATOR).\
+ $(PATH_SEPARATOR)$(ROOT)\
+ )
+
+subdirs:
+ $(foreach dir,$(SUBDIRS), cd $(dir);$(MAKE);cd ..;)
+
+clean:
+ -rm *.class *.jar
+ $(foreach dir,$(SUBDIRS), cd $(dir);$(MAKE) clean ; cd ..;)
+
+
+%.class : %.java
+ $(JAVAC) -classpath $(CLASSPATH) $<
+
+.PHONY: all package clean subdirs
diff --git a/accessibility/workben/makefile.mk b/accessibility/workben/makefile.mk
new file mode 100644
index 000000000000..33c1e2a0ef5e
--- /dev/null
+++ b/accessibility/workben/makefile.mk
@@ -0,0 +1,40 @@
+# copied from settings.mk
+SOLARBINDIR=$(SOLARVERSION)$/$(INPATH)$/bin$(UPDMINOREXT)
+
+# Please modify the following lines to match your environment:
+# If you use the run: target at the end of the file, then adapt pipe name
+PIPE_NAME = $(USER)
+
+# The following variables probably don't need to be changed.
+JAVA = java
+# The JAR_PATH points to the jar files of your local office installation.
+JAR_PATH = $(SOLARBINDIR)$/
+
+
+# The rest of this makefile should not need to be touched.
+
+JAR_FILES = \
+ unoil.jar \
+ sandbox.jar \
+ ridl.jar \
+ jurt.jar \
+ juh.jar \
+ java_uno.jar
+
+
+JAVA_CLASSPATHS := \
+ ..$/$(INPATH)$/class \
+ $(foreach,i,$(JAR_FILES) $(JAR_PATH)$i) \
+ $(CLASSPATH)
+
+CLASSPATH !:=$(JAVA_CLASSPATHS:t$(PATH_SEPERATOR))
+
+all:
+ build
+
+# Example of how to run the work bench.
+run:
+ +$(JAVA) -classpath "$(CLASSPATH)" org/openoffice/accessibility/awb/AccessibilityWorkBench -p $(PIPE_NAME)
+
+runjar:
+ +$(JAVA) -classpath "$(CLASSPATH)" -jar AccessibilityWorkBench.jar -p $(PIPE_NAME)
diff --git a/accessibility/workben/org/openoffice/accessibility/Makefile b/accessibility/workben/org/openoffice/accessibility/Makefile
new file mode 100644
index 000000000000..a6db6a05ab4b
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/Makefile
@@ -0,0 +1,6 @@
+all : subdirs
+
+ROOT=../../../
+SUBDIRS=misc awb
+include $(ROOT)/makefile.in
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java b/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java
new file mode 100644
index 000000000000..fd1d0e1fa13d
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java
@@ -0,0 +1,724 @@
+/*************************************************************************
+ *
+ * $RCSfile: AccessibilityWorkBench.java,v $
+ *
+ * $Revision: 1.3 $
+ *
+ * last change: $Author: obr $ $Date: 2008/05/14 13:21:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb;
+
+import java.awt.Cursor;
+import java.awt.GridBagConstraints;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.event.TreeWillExpandListener;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XTerminateListener;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.UnoRuntime;
+
+import org.openoffice.accessibility.misc.MessageArea;
+import org.openoffice.accessibility.misc.Options;
+import org.openoffice.accessibility.misc.OfficeConnection;
+import org.openoffice.accessibility.misc.SimpleOffice;
+import org.openoffice.accessibility.awb.canvas.Canvas;
+import org.openoffice.accessibility.awb.tree.AccessibilityTree;
+import org.openoffice.accessibility.awb.tree.AccessibilityModel;
+import org.openoffice.accessibility.awb.tree.DynamicAccessibilityModel;
+import org.openoffice.accessibility.awb.view.ObjectViewContainer;
+import org.openoffice.accessibility.awb.view.ObjectViewContainerWindow;
+
+
+
+/** This class manages the GUI of the work bench.
+ @see AccessibilityTreeModel
+ for the implementation of the tree view on the left side which also
+ manages the registration of accessibility listeners.
+ @see Canvas
+ for the graphical view of the accessible objects.
+*/
+public class AccessibilityWorkBench
+ extends JFrame
+ implements XTerminateListener,
+ ActionListener,
+ TreeSelectionListener
+{
+ public static final String msVersion = "v1.9";
+ public String msOptionsFileName = ".AWBrc";
+
+ public static void main (String args[])
+ {
+ String sPipeName = System.getenv( "USER" );
+
+ for (int i=0; i<args.length; i++)
+ {
+ if (args[i].equals ("-h") || args[i].equals ("--help") || args[i].equals ("-?"))
+ {
+ System.out.println ("usage: AccessibilityWorkBench <option>*");
+ System.out.println ("options:");
+ System.out.println (" -p <pipe-name> name of the pipe to use to connect to OpenOffice.org.");
+ System.out.println (" Defaults to $USER.");
+ System.exit (0);
+ }
+ else if (args[i].equals ("-p"))
+ {
+ sPipeName = args[++i];
+ }
+ }
+
+ saWorkBench = new AccessibilityWorkBench (sPipeName);
+ }
+
+
+
+
+ /** Return the one instance of the AccessibilityWorkBench
+ @return
+ Returns null when the AccessibilityWorkBench could not be
+ created successfully.
+ */
+ public static AccessibilityWorkBench Instance ()
+ {
+ return saWorkBench;
+ }
+
+
+
+ /** Create an accessibility work bench that listens at the specified
+ port to Office applications.
+ */
+ private AccessibilityWorkBench (String sPipeName)
+ {
+ mbInitialized = false;
+
+ OfficeConnection.SetPipeName (sPipeName);
+ Options.Instance().Load (msOptionsFileName);
+ Layout ();
+
+ MessageArea.println (System.getProperty ("os.name") + " / "
+ + System.getProperty ("os.arch") + " / "
+ + System.getProperty ("os.version"));
+ MessageArea.println ("Using pipe name " + sPipeName);
+
+ maTree.addTreeSelectionListener (this);
+
+ addWindowListener (new WindowAdapter ()
+ { public void windowClosing (WindowEvent e) {Quit();} }
+ );
+
+ OfficeConnection.Instance().AddConnectionListener (this);
+ Initialize ();
+ }
+
+
+
+
+ /** Create and arrange the widgets of the GUI.
+ */
+ public void Layout ()
+ {
+ setSize (new java.awt.Dimension (800,600));
+
+ JScrollPane aScrollPane;
+ GridBagConstraints constraints;
+
+ // Create new layout.
+ java.awt.GridBagLayout aLayout = new java.awt.GridBagLayout ();
+ getContentPane().setLayout (aLayout);
+
+ // Accessible Tree.
+ javax.swing.tree.TreeModel treeModel = new DynamicAccessibilityModel();
+ maTree = new AccessibilityTree(treeModel);
+ // Add the model as tree listeners to be able to populate/clear the
+ // child lists on demand.
+ maTree.addTreeExpansionListener((TreeExpansionListener) treeModel);
+ maTree.addTreeWillExpandListener((TreeWillExpandListener) treeModel);
+
+ JScrollPane aTreeScrollPane = new JScrollPane(
+ maTree,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ aTreeScrollPane.setPreferredSize (new java.awt.Dimension (400,300));
+
+ // Object view shows details about the currently selected accessible
+ // object.
+ maObjectViewContainer = new ObjectViewContainer ();
+ JScrollPane aObjectViewContainerScrollPane = new JScrollPane(
+ maObjectViewContainer,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ aObjectViewContainerScrollPane.setPreferredSize (
+ new java.awt.Dimension (400,300));
+ JButton aCornerButton = new JButton ("CreateNewViewWindow");
+ aCornerButton.addActionListener (this);
+ aObjectViewContainerScrollPane.setCorner (
+ JScrollPane.LOWER_RIGHT_CORNER,
+ aCornerButton);
+
+ // Split pane for tree view and object view.
+ JSplitPane aLeftViewSplitPane = new JSplitPane (
+ JSplitPane.VERTICAL_SPLIT,
+ aTreeScrollPane,
+ aObjectViewContainerScrollPane
+ );
+ aLeftViewSplitPane.setDividerLocation (300);
+ aLeftViewSplitPane.setContinuousLayout (true);
+
+ // Canvas.
+ maCanvas = new Canvas ();
+ maCanvas.SetTree (maTree);
+ JScrollPane aScrolledCanvas = new JScrollPane(maCanvas,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ aScrolledCanvas.getViewport().setBackground (java.awt.Color.RED);
+ aScrolledCanvas.setPreferredSize (new java.awt.Dimension(600,400));
+
+ // Split pane for tree view and canvas.
+ JSplitPane aViewSplitPane = new JSplitPane (
+ JSplitPane.HORIZONTAL_SPLIT,
+ aLeftViewSplitPane,
+ aScrolledCanvas
+ );
+ aViewSplitPane.setOneTouchExpandable(true);
+ aViewSplitPane.setDividerLocation (400);
+ aViewSplitPane.setContinuousLayout (true);
+
+ // Split pane for the three views at the top and the message area.
+ MessageArea.Instance().setPreferredSize (new java.awt.Dimension(600,50));
+ JSplitPane aSplitPane = new JSplitPane (
+ JSplitPane.VERTICAL_SPLIT,
+ aViewSplitPane,
+ MessageArea.Instance());
+ aSplitPane.setOneTouchExpandable(true);
+ aSplitPane.setContinuousLayout (true);
+ addGridElement (aSplitPane, 0,0, 2,1, 3,3,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH);
+
+ // Button bar.
+ maButtonBar = new javax.swing.JPanel();
+ java.awt.GridBagLayout aButtonLayout = new java.awt.GridBagLayout ();
+ maButtonBar.setLayout (new java.awt.FlowLayout());
+ addGridElement (maButtonBar, 0,3, 2,1, 1,0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL);
+
+ // Buttons.
+ // maConnectButton = createButton ("Connect", "connect");
+ // maUpdateButton = createButton ("Update", "update");
+ // maShapesButton = createButton ("Expand Shapes", "shapes");
+ maExpandButton = createButton ("Expand All", "expand");
+ maQuitButton = createButton ("Quit", "quit");
+ UpdateButtonStates ();
+
+ setJMenuBar (CreateMenuBar ());
+
+ setTitle("Accessibility Workbench " + msVersion);
+
+ setVisible (true);
+ pack ();
+ aSplitPane.setDividerLocation (1.0);
+ validate ();
+ repaint();
+ }
+
+
+
+
+ /** Shortcut method for adding an object to a GridBagLayout.
+ */
+ void addGridElement (JComponent object,
+ int x, int y,
+ int width, int height,
+ int weightx, int weighty,
+ int anchor, int fill)
+ {
+ GridBagConstraints constraints = new GridBagConstraints ();
+ constraints.gridx = x;
+ constraints.gridy = y;
+ constraints.gridwidth = width;
+ constraints.gridheight = height;
+ constraints.weightx = weightx;
+ constraints.weighty = weighty;
+ constraints.anchor = anchor;
+ constraints.fill = fill;
+ getContentPane().add (object, constraints);
+ }
+
+
+
+
+ /** Create a new button and place at the right most position into the
+ button bar.
+ */
+ public JButton createButton (String title, String command)
+ {
+ JButton aButton = new JButton (title);
+ aButton.setEnabled (false);
+ aButton.setActionCommand (command);
+ aButton.addActionListener (this);
+
+ maButtonBar.add (aButton);
+ return aButton;
+ }
+
+
+
+
+ /** Create a menu bar for the application.
+ @return
+ Returns the new menu bar. The returned reference is also
+ remembered in the data member <member>maMenuBar</member>.
+ */
+ javax.swing.JMenuBar CreateMenuBar()
+ {
+ // Menu bar.
+ maMenuBar = new JMenuBar ();
+
+ // File menu.
+ JMenu aFileMenu = new JMenu ("File");
+ maMenuBar.add (aFileMenu);
+ JMenuItem aItem;
+ aItem = new JMenuItem ("Quit");
+ aFileMenu.add (aItem);
+ aItem.addActionListener (this);
+
+ // View menu.
+ JMenu aViewMenu = new JMenu ("View");
+ maMenuBar.add (aViewMenu);
+ ButtonGroup aGroup = new ButtonGroup ();
+ int nZoomMode = Options.GetInteger ("ZoomMode", Canvas.WHOLE_SCREEN);
+ JRadioButtonMenuItem aRadioButton = new JRadioButtonMenuItem (
+ "Whole Screen", nZoomMode==Canvas.WHOLE_SCREEN);
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("200%", nZoomMode==200);
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("100%", nZoomMode==100);
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("50%", nZoomMode==50);
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("25%", nZoomMode==25);
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("10%", nZoomMode==10);
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+
+ // Options menu.
+ JMenu aOptionsMenu = new JMenu ("Options");
+ maMenuBar.add (aOptionsMenu);
+ JCheckBoxMenuItem aCBItem;
+ aCBItem = new JCheckBoxMenuItem ("Show Descriptions",
+ Options.GetBoolean("ShowDescriptions"));
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ aCBItem = new JCheckBoxMenuItem ("Show Names",
+ Options.GetBoolean ("ShowNames"));
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ aCBItem = new JCheckBoxMenuItem ("Show Text",
+ Options.GetBoolean ("ShowText"));
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ aCBItem = new JCheckBoxMenuItem ("Antialiased Rendering",
+ Options.GetBoolean ("Antialiasing"));
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ // Help menu.
+ JMenu aHelpMenu = new JMenu ("Help");
+ maMenuBar.add (aHelpMenu);
+
+ aItem = new JMenuItem ("Help");
+ aHelpMenu.add (aItem);
+ aItem.addActionListener (this);
+
+ aItem = new JMenuItem ("News");
+ aHelpMenu.add (aItem);
+ aItem.addActionListener (this);
+
+ aItem = new JMenuItem ("About");
+ aHelpMenu.add (aItem);
+ aItem.addActionListener (this);
+
+ return maMenuBar;
+ }
+
+
+
+
+ /** Initialize the AWB. This includes clearing the canvas, add
+ listeners, creation of a new tree model for the tree list box and
+ the update of the button states.
+
+ This method may be called any number of times. Note that all
+ actions will be carried out every time. The main purpose of a
+ second call is that of a re-initialization after a reconnect.
+ */
+ protected void Initialize ()
+ {
+ maCanvas.SetTree (maTree);
+
+ SimpleOffice aOffice = SimpleOffice.Instance ();
+ if (aOffice != null)
+ {
+ // Add terminate listener.
+ if (aOffice.GetDesktop() != null)
+ aOffice.GetDesktop().addTerminateListener (this);
+
+ }
+
+ mbInitialized = true;
+ UpdateButtonStates ();
+ }
+
+
+
+
+ /** Update the states of the buttons according to the internal state of
+ the AWB.
+ */
+ protected void UpdateButtonStates ()
+ {
+ // maConnectButton.setEnabled (mbInitialized);
+ maQuitButton.setEnabled (true);
+ // maUpdateButton.setEnabled (mbInitialized);
+ maExpandButton.setEnabled (mbInitialized);
+ // maShapesButton.setEnabled (mbInitialized);
+ }
+
+
+
+ /** Callback for GUI actions from the buttons.
+ */
+ public void actionPerformed (ActionEvent aEvent)
+ {
+ String sCommand = aEvent.getActionCommand();
+ if (sCommand.equals("connect"))
+ {
+ SimpleOffice.Clear();
+ Initialize ();
+ }
+ else if (sCommand.equals("quit"))
+ {
+ Quit ();
+ }
+ else if (sCommand.equals("update"))
+ {
+// maTree.Dispose();
+ Initialize ();
+ }
+ else if (sCommand.equals("shapes"))
+ {
+ Cursor aCursor = getCursor();
+ setCursor (new Cursor (Cursor.WAIT_CURSOR));
+ // maTree.expandShapes();
+ setCursor (aCursor);
+ }
+ else if (sCommand.equals("expand"))
+ {
+ Cursor aCursor = getCursor();
+ setCursor (new Cursor (Cursor.WAIT_CURSOR));
+
+ for (int i=0; i<maTree.getRowCount(); i++)
+ maTree.expandRow (i);
+ // maAccessibilityTree.expandAll();
+ setCursor (aCursor);
+ }
+ else if (sCommand.equals ("Quit"))
+ {
+ System.out.println ("exiting");
+ System.exit (0);
+ }
+ else if (sCommand.equals ("Show Descriptions"))
+ {
+ Options.SetBoolean ("ShowDescriptions",
+ ((JCheckBoxMenuItem)aEvent.getSource()).getState());
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("Show Names"))
+ {
+ Options.SetBoolean ("ShowNames",
+ ((JCheckBoxMenuItem)aEvent.getSource()).getState());
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("Show Text"))
+ {
+ Options.SetBoolean ("ShowText",
+ ((JCheckBoxMenuItem)aEvent.getSource()).getState());
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("Antialiased Rendering"))
+ {
+ Options.SetBoolean ("Antialiasing",
+ ((JCheckBoxMenuItem)aEvent.getSource()).getState());
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("Help"))
+ {
+ HelpWindow.Instance().loadFile ("help.html");
+ }
+ else if (sCommand.equals ("News"))
+ {
+ try{
+ HelpWindow.Instance().loadFile ("news.html");
+ } catch (Exception ex) {}
+ }
+ else if (sCommand.equals ("About"))
+ {
+ HelpWindow.Instance().loadFile ("about.html");
+ }
+ else if (sCommand.equals ("Whole Screen"))
+ {
+ Options.SetInteger ("ZoomMode", Canvas.WHOLE_SCREEN);
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("200%"))
+ {
+ Options.SetInteger ("ZoomMode", 200);
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("100%"))
+ {
+ Options.SetInteger ("ZoomMode", 100);
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("50%"))
+ {
+ Options.SetInteger ("ZoomMode", 50);
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("25%"))
+ {
+ Options.SetInteger ("ZoomMode", 25);
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("10%"))
+ {
+ Options.SetInteger ("ZoomMode", 10);
+ maCanvas.repaint();
+ }
+ else if (sCommand.equals ("<connected>"))
+ {
+ Connected ();
+ }
+ else if (sCommand.equals ("CreateNewViewWindow"))
+ {
+ TreePath aSelectionPath = maTree.getSelectionPath();
+ if (aSelectionPath != null)
+ {
+ javax.swing.tree.TreeNode aSelectedNode =
+ (javax.swing.tree.TreeNode)aSelectionPath.getLastPathComponent();
+ if (aSelectedNode instanceof XAccessible) {
+ new ObjectViewContainerWindow (((XAccessible) aSelectedNode).getAccessibleContext());
+ }
+ }
+ }
+ else
+ {
+ System.err.println("unknown command " + sCommand);
+ }
+ }
+
+
+
+
+ /** TreeSelectionListener
+ Tell the object view and the canvas about the selected object.
+ */
+ public void valueChanged (TreeSelectionEvent aEvent) {
+
+ if (aEvent.isAddedPath()) {
+ Cursor aCursor = getCursor();
+ setCursor (new Cursor (Cursor.WAIT_CURSOR));
+
+ javax.swing.tree.TreePath aPath = aEvent.getPath();
+ maTree.scrollPathToVisible (aPath);
+ Object aObject = aPath.getLastPathComponent();
+ if (aObject instanceof XAccessible) {
+ XAccessible xAccessible = (XAccessible) aObject;
+ if (maObjectViewContainer != null) {
+ ((AccessibilityModel) maTree.getModel()).addEventListener((TreeNode) aObject, maObjectViewContainer);
+ maObjectViewContainer.SetObject (xAccessible.getAccessibleContext());
+ }
+ }
+ if (maCanvas != null)
+ maCanvas.SelectObject ((TreeNode) aObject);
+ setCursor (aCursor);
+ } else {
+ if (maObjectViewContainer != null) {
+ ((AccessibilityModel) maTree.getModel()).removeEventListener((TreeNode) aEvent.getPath().getLastPathComponent(), maObjectViewContainer);
+ maObjectViewContainer.SetObject (null);
+ }
+ if (maCanvas != null)
+ maCanvas.SelectObject (null);
+ }
+ }
+
+
+
+
+ // XEventListener
+ public void disposing (EventObject aSourceObj)
+ {
+ XFrame xFrame = (XFrame)UnoRuntime.queryInterface(
+ XFrame.class, aSourceObj.Source);
+
+ if( xFrame != null )
+ System.out.println("frame disposed");
+ else
+ System.out.println("controller disposed");
+ }
+
+
+
+
+ // XTerminateListener
+ public void queryTermination(final EventObject aEvent) throws com.sun.star.frame.TerminationVetoException
+ {
+ System.out.println ("Terminate Event : " + aEvent);
+ }
+
+
+
+
+ // XTerminateListener
+ public void notifyTermination(final EventObject aEvent)
+ {
+ System.out.println ("Notifiy Termination Event : " + aEvent);
+ }
+
+
+ /** Called after the AWB is connected to an Office application.
+ */
+ private void Connected ()
+ {
+ // Clear the tree and by expanding the root node initiate the
+ // scanning and insertion of nodes for the top-level windows.
+// maTree.Clear();
+// maTree.collapseRow (0);
+// maTree.expandRow (0);
+
+ // Register the top window listener.
+ XExtendedToolkit xToolkit =
+ SimpleOffice.Instance().GetExtendedToolkit();
+ if (xToolkit != null)
+ {
+ maTree.setToolkit(xToolkit);
+ }
+ }
+
+
+ /** Called when shutting down the AWB tool.
+ */
+ private void Quit ()
+ {
+// maTree.Dispose();
+ System.exit (0);
+ }
+
+ /// The Singleton Workbench object.
+ private static AccessibilityWorkBench
+ saWorkBench = null;
+
+ private JPanel maMainPanel;
+ private JPanel maButtonBar;
+ private Canvas maCanvas;
+ private AccessibilityTree maTree;
+ private ObjectViewContainer maObjectViewContainer;
+ private JButton
+ maConnectButton,
+ maQuitButton,
+ maUpdateButton,
+ maExpandButton,
+ maShapesButton;
+ private JMenuBar maMenuBar;
+ private boolean mbInitialized;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java b/accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java
new file mode 100644
index 000000000000..2f9671d191e5
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/HelpWindow.java
@@ -0,0 +1,187 @@
+package org.openoffice.accessibility.awb;
+
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JEditorPane;
+import javax.swing.JButton;
+import java.net.URL;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.event.HyperlinkEvent;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.io.File;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.event.ActionListener;
+import java.util.LinkedList;
+
+public class HelpWindow
+ implements ActionListener
+{
+ public static synchronized HelpWindow Instance ()
+ {
+ if (maInstance == null)
+ maInstance = new HelpWindow();
+ return maInstance;
+ }
+
+ public void loadFile (String sFilename)
+ {
+ File aFile = new File (sFilename);
+ try
+ {
+ loadURL (aFile.toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ e.printStackTrace (System.err);
+ }
+ }
+ public void loadURL (String sURL)
+ {
+ try
+ {
+ loadURL (new URL (sURL));
+ }
+ catch (MalformedURLException e)
+ {
+ e.printStackTrace (System.err);
+ }
+ }
+
+
+
+
+ public void loadURL (URL aURL)
+ {
+ maHistory.addLast (aURL);
+ selectHistoryPage (maHistory.size()-1);
+ maFrame.toFront ();
+ }
+
+
+
+
+ private HelpWindow ()
+ {
+ try
+ {
+ maCurrentHistoryEntry = -1;
+ maHistory = new LinkedList();
+
+ maFrame = new JFrame ();
+ maFrame.addWindowListener (new WindowAdapter ()
+ {
+ public void windowClosing (WindowEvent e)
+ {
+ maInstance = null;
+ }
+ });
+ maContent = createContentWidget();
+
+ maFrame.getContentPane().setLayout (new GridBagLayout());
+ GridBagConstraints aConstraints = new GridBagConstraints ();
+ aConstraints.gridx = 0;
+ aConstraints.gridy = 0;
+ aConstraints.gridwidth = 3;
+ aConstraints.weightx = 1;
+ aConstraints.weighty = 1;
+ aConstraints.fill = GridBagConstraints.BOTH;
+ maFrame.getContentPane().add (new JScrollPane (maContent), aConstraints);
+
+ aConstraints = new GridBagConstraints();
+ aConstraints.gridx = 0;
+ aConstraints.gridy = 1;
+ maPrevButton = new JButton ("Prev");
+ maFrame.getContentPane().add (maPrevButton, aConstraints);
+ maPrevButton.addActionListener (this);
+
+ aConstraints = new GridBagConstraints();
+ aConstraints.gridx = 1;
+ aConstraints.gridy = 1;
+ maNextButton = new JButton ("Next");
+ maFrame.getContentPane().add (maNextButton, aConstraints);
+ maNextButton.addActionListener (this);
+
+ aConstraints = new GridBagConstraints();
+ aConstraints.gridx = 2;
+ aConstraints.gridy = 1;
+ aConstraints.anchor = GridBagConstraints.EAST;
+ JButton aButton = new JButton ("Close");
+ maFrame.getContentPane().add (aButton, aConstraints);
+ aButton.addActionListener (this);
+
+ maFrame.setSize (600,400);
+ maFrame.setVisible (true);
+ }
+ catch (Exception e)
+ {}
+ }
+
+ public void actionPerformed (java.awt.event.ActionEvent e)
+ {
+ if (e.getActionCommand().equals("Prev"))
+ {
+ selectHistoryPage (maCurrentHistoryEntry - 1);
+ }
+ else if (e.getActionCommand().equals("Next"))
+ {
+ selectHistoryPage (maCurrentHistoryEntry + 1);
+ }
+ else if (e.getActionCommand().equals("Close"))
+ {
+ maFrame.dispose ();
+ maInstance = null;
+ }
+ }
+
+ private JEditorPane createContentWidget ()
+ {
+ JEditorPane aContent = new JEditorPane ();
+ aContent.setEditable (false);
+ aContent.addHyperlinkListener (new HyperlinkListener()
+ {
+ public void hyperlinkUpdate (HyperlinkEvent e)
+ {
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
+ HelpWindow.Instance().loadURL (e.getURL());
+ }
+ });
+ return aContent;
+ }
+
+ private void selectHistoryPage (int i)
+ {
+ if (i < 0)
+ i = 0;
+ else if (i >= maHistory.size()-1)
+ i = maHistory.size()-1;
+ if (i != maCurrentHistoryEntry)
+ {
+ URL aURL = (URL)maHistory.get (i);
+ try
+ {
+ maContent.setPage (aURL);
+ }
+ catch (java.io.IOException ex)
+ {
+ ex.printStackTrace(System.err);
+ }
+
+ maCurrentHistoryEntry = i;
+ }
+
+ maPrevButton.setEnabled (maCurrentHistoryEntry > 0);
+ maNextButton.setEnabled (maCurrentHistoryEntry < maHistory.size()-1);
+ }
+
+ private static HelpWindow maInstance = null;
+ private JFrame maFrame;
+ private JEditorPane maContent;
+ private LinkedList maHistory;
+ private int maCurrentHistoryEntry;
+ private JButton maPrevButton;
+ private JButton maNextButton;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/Makefile
new file mode 100644
index 000000000000..d38799bed109
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/Makefile
@@ -0,0 +1,13 @@
+# $Id: Makefile,v 1.1 2003/06/13 16:30:18 af Exp $
+
+all : package
+
+ROOT=../../../..
+PACKAGE = org.openoffice.accessibility.awb
+SUBDIRS = canvas event tree view
+
+include makefile.common
+
+include $(ROOT)/makefile.in
+
+package: subdirs $(CLASS_FILES)
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java
new file mode 100644
index 000000000000..9edf5dd928ae
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java
@@ -0,0 +1,356 @@
+/*************************************************************************
+ *
+ * $RCSfile: Canvas.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.canvas;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Toolkit;
+import java.awt.geom.Rectangle2D;
+import java.util.Iterator;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JViewport;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.tree.TreePath;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+
+import org.openoffice.accessibility.misc.Options;
+
+/** This canvas displays accessible objects graphically. Each accessible
+ object with graphical representation is represented by an
+ CanvasShape object and has to be added by the
+ <member>addAccessible</member> member function.
+
+ <p>The canvas listens to selection events of the associated JTree and
+ highlights the first selected node of that tree.</p>
+*/
+public class Canvas
+ extends JPanel
+{
+ // This constant can be passed to SetZoomMode to always show the whole screen.
+ public static final int WHOLE_SCREEN = -1;
+
+ public Canvas ()
+ {
+ super (true);
+ maShapeList = new ShapeContainer (this);
+ maMouseObserver = new MouseObserver (this);
+ maTree = null;
+ mnHOffset = 0;
+ mnVOffset = 0;
+ mnScale = 1;
+ maLastWidgetSize = new Dimension (0,0);
+ }
+
+
+
+ /** Tell the canvas which tree to use to highlight accessible
+ objects and to observe for changes in the tree structure.
+ */
+ public void SetTree (javax.swing.JTree aTree)
+ {
+ if (aTree != maTree)
+ {
+ maTree = aTree;
+ maShapeList.SetTree (maTree);
+ maMouseObserver.SetTree (maTree);
+ }
+ }
+
+
+
+
+ private void Clear ()
+ {
+ maShapeList.Clear();
+ }
+
+
+
+
+ public Iterator GetShapeIterator ()
+ {
+ return maShapeList.GetIterator();
+ }
+
+
+
+
+ public void paintComponent (Graphics g)
+ {
+ synchronized (g)
+ {
+ super.paintComponent (g);
+
+ Graphics2D g2 = (Graphics2D)g;
+ if (Options.GetBoolean("Antialiasing"))
+ g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ else
+ g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_OFF);
+
+ setupTransformation ();
+ g2.translate (mnHOffset, mnVOffset);
+ g2.scale (mnScale, mnScale);
+
+ // Draw the screen representation to give a hint of the location of the
+ // accessible object on the screen.
+ Dimension aScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Rectangle2D.Double aScreen = new Rectangle2D.Double (
+ 0,
+ 0,
+ aScreenSize.getWidth(),
+ aScreenSize.getHeight());
+ // Fill the screen rectangle and draw a frame arround it to increase its visibility.
+ g2.setColor (new Color (250,240,230));
+ g2.fill (aScreen);
+ g2.setColor (Color.BLACK);
+ g2.draw (aScreen);
+
+ synchronized (maShapeList)
+ {
+ Iterator aShapeIterator = maShapeList.GetIterator();
+ boolean bShowDescriptions = Options.GetBoolean ("ShowDescriptions");
+ boolean bShowNames = Options.GetBoolean ("ShowNames");
+ boolean bShowText = Options.GetBoolean ("ShowText");
+ while (aShapeIterator.hasNext())
+ {
+ CanvasShape aCanvasShape =
+ (CanvasShape)aShapeIterator.next();
+ try
+ {
+ aCanvasShape.paint (
+ g2,
+ bShowDescriptions, bShowNames, bShowText);
+ }
+ catch (Exception aException)
+ {
+ System.err.println ("caught exception while painting a shape:"
+ + aException);
+ aException.printStackTrace (System.err);
+ }
+ }
+ }
+
+ // Paint highlighted frame around active object as the last thing.
+ if (maActiveObject != null)
+ maActiveObject.paint_highlight (g2);
+ }
+ }
+
+
+
+
+ /** Set up the transformation so that the graphical display can show a
+ centered representation of the whole screen.
+ */
+ private void setupTransformation ()
+ {
+ // Turn off scrollbars when showing the whole screen. Otherwise show them when needed.
+ JViewport aViewport = (JViewport)getParent();
+ JScrollPane aScrollPane = (JScrollPane)aViewport.getParent();
+ int nZoomMode = Options.GetInteger ("ZoomMode", WHOLE_SCREEN);
+ if (nZoomMode == WHOLE_SCREEN)
+ {
+ if (aScrollPane.getHorizontalScrollBarPolicy()
+ != JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)
+ aScrollPane.setHorizontalScrollBarPolicy (
+ JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ if (aScrollPane.getVerticalScrollBarPolicy()
+ != JScrollPane.VERTICAL_SCROLLBAR_NEVER)
+ aScrollPane.setVerticalScrollBarPolicy (
+ JScrollPane.VERTICAL_SCROLLBAR_NEVER);
+ }
+ else
+ {
+ if (aScrollPane.getHorizontalScrollBarPolicy()
+ != JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED)
+ aScrollPane.setHorizontalScrollBarPolicy (
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ if (aScrollPane.getVerticalScrollBarPolicy()
+ != JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED)
+ aScrollPane.setVerticalScrollBarPolicy (
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+ }
+
+ Dimension aScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension aWidgetSize = aViewport.getSize();
+ {
+ if ((aScreenSize.getWidth() > 0) && (aScreenSize.getHeight() > 0))
+ {
+ if (nZoomMode == WHOLE_SCREEN)
+ {
+ // Calculate the scales that would map the screen onto the
+ // widget in both of the coordinate axes and select the
+ // smaller
+ // of the two: it maps the screen onto the widget in both
+ // axes at the same time.
+ double nHScale = (aWidgetSize.getWidth() - 10)
+ / aScreenSize.getWidth();
+ double nVScale = (aWidgetSize.getHeight() - 10)
+ / aScreenSize.getHeight();
+ if (nHScale < nVScale)
+ mnScale = nHScale;
+ else
+ mnScale = nVScale;
+ }
+ else
+ {
+ mnScale = nZoomMode / 100.0;
+ }
+
+ // Calculate offsets that center the scaled screen inside
+ // the widget.
+ mnHOffset = (aWidgetSize.getWidth()
+ - mnScale*aScreenSize.getWidth()) / 2.0;
+ mnVOffset = (aWidgetSize.getHeight()
+ - mnScale*aScreenSize.getHeight()) / 2.0;
+ if (mnHOffset < 0)
+ mnHOffset = 0;
+ if (mnVOffset < 0)
+ mnVOffset = 0;
+
+ setPreferredSize (new Dimension (
+ (int)(2*mnHOffset + mnScale * aScreenSize.getWidth()),
+ (int)(2*mnVOffset + mnScale * aScreenSize.getHeight())));
+ revalidate ();
+ }
+ else
+ {
+ // In case of a degenerate (not yet initialized?) screen size
+ // use some meaningless default values.
+ mnScale = 1;
+ mnHOffset = 0;
+ mnVOffset = 0;
+ }
+ }
+ maLastWidgetSize = aWidgetSize;
+ }
+
+
+
+ protected boolean HighlightObject (CanvasShape aNewActiveObject)
+ {
+ if (aNewActiveObject != maActiveObject)
+ {
+ if (maActiveObject != null)
+ maActiveObject.Highlight (false);
+
+ maActiveObject = aNewActiveObject;
+ if (maActiveObject != null)
+ {
+ /* if (maTree != null)
+ {
+ TreePath aPath = new TreePath (
+ maActiveObject.GetNode().GetPath());
+ maTree.scrollPathToVisible (aPath);
+ maTree.setSelectionPath (aPath);
+ maTree.repaint ();
+ }
+ */
+ maActiveObject.Highlight (true);
+ }
+ repaint ();
+ return true;
+ }
+ else
+ return false;
+ }
+
+
+
+
+ /** Called when the selection of the tree changes. Highlight the
+ corresponding graphical representation of the object.
+ */
+ public void SelectObject (javax.swing.tree.TreeNode aNode)
+ {
+ CanvasShape aCanvasShape = maShapeList.Get (aNode);
+ HighlightObject (aCanvasShape);
+ }
+
+
+
+
+ private int
+ mnXAnchor,
+ mnYAnchor,
+ maResizeFlag;
+ private double
+ mnHOffset,
+ mnVOffset,
+ mnScale;
+ private CanvasShape maActiveObject;
+ private javax.swing.JTree maTree;
+ // The size of the widget at the last call of setupTransformation()
+ private Dimension maLastWidgetSize;
+ private ShapeContainer maShapeList;
+ private MouseObserver maMouseObserver;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java
new file mode 100644
index 000000000000..5b1b2fb1f4e2
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java
@@ -0,0 +1,446 @@
+/*************************************************************************
+ *
+ * $RCSfile: CanvasShape.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.canvas;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+
+
+import com.sun.star.accessibility.*;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.UnoRuntime;
+
+
+class CanvasShape implements XAccessibleEventListener
+{
+ public final Color maHighlightColor = Color.red;
+ public final Color maSelectionColor = Color.green;
+ public final Color maFocusColor = Color.blue;
+
+ public CanvasShape (javax.swing.tree.TreeNode aNode, Canvas aCanvas)
+ {
+ maNode = aNode;
+ msName = "<no name>";
+ msDescription = "<no description>";
+ maShape = new Rectangle2D.Double (-10,-10,10,10);
+ maPosition = new Point (-10,-10);
+ maSize = new Dimension (10,10);
+ maFgColor = java.awt.Color.black;
+ maBgColor = Color.blue;
+ mnRole = -1;
+ mbHighlighted = false;
+ mbSelected = false;
+ mbFocused = false;
+ maCanvas = aCanvas;
+
+ Update ();
+ }
+
+
+
+
+ public javax.swing.tree.TreePath getNodePath (javax.swing.tree.TreeNode node)
+ {
+ javax.swing.tree.TreeNode parent = node.getParent();
+ return (parent != null) ?
+ getNodePath(parent).pathByAddingChild(node) :
+ new javax.swing.tree.TreePath(node);
+ }
+
+ public javax.swing.tree.TreePath getNodePath ()
+ {
+ return getNodePath(maNode);
+ }
+
+
+
+ /** Update the data obtained from the <type>AccessibilityNode</type>
+ object.
+ */
+ public void Update ()
+ {
+ if (maNode instanceof XAccessible) {
+ mxContext = ((XAccessible) maNode).getAccessibleContext();
+ mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface(
+ XAccessibleComponent.class, mxContext);
+ }
+
+ if (mxContext != null)
+ {
+ msName = mxContext.getAccessibleName();
+ msDescription = mxContext.getAccessibleDescription();
+ mnRole = mxContext.getAccessibleRole();
+
+ // Extract the selected and focused flag.
+ XAccessibleStateSet xStateSet = mxContext.getAccessibleStateSet ();
+ if (xStateSet != null)
+ {
+ mbSelected = xStateSet.contains (AccessibleStateType.SELECTED);
+ mbFocused = xStateSet.contains (AccessibleStateType.FOCUSED);
+ }
+ }
+
+ UpdateGeometry ();
+
+ if (mxComponent != null)
+ {
+ // Note: alpha values in office 0..255 have to be mapped to
+ // 255..0 in Java
+ Color aCol = new Color (mxComponent.getForeground(), true);
+ maFgColor = new Color (aCol.getRed (),
+ aCol.getGreen (),
+ aCol.getBlue (),
+ 0xff - aCol.getAlpha ());
+ aCol = new Color (mxComponent.getBackground(), true);
+ maBgColor = new Color (aCol.getRed (),
+ aCol.getGreen (),
+ aCol.getBlue (),
+ 0xff - aCol.getAlpha ());
+ }
+ }
+
+
+
+ public void UpdateGeometry ()
+ {
+ if (mxComponent != null)
+ {
+ com.sun.star.awt.Point aLocationOnScreen =
+ mxComponent.getLocationOnScreen();
+ com.sun.star.awt.Size aSizeOnScreen = mxComponent.getSize();
+ maPosition = new Point (
+ aLocationOnScreen.X,
+ aLocationOnScreen.Y);
+ maSize = new Dimension (
+ aSizeOnScreen.Width,
+ aSizeOnScreen.Height);
+ }
+ }
+
+
+
+ /** Paint the object into the specified canvas. It is transformed
+ according to the specified offset and scale.
+ */
+ public void paint (
+ Graphics2D g,
+ boolean bShowDescription,
+ boolean bShowName,
+ boolean bShowText)
+ {
+ try{
+ // Transform the object's position and size according to the
+ // specified offset and scale.
+ Point aLocation = new Point();
+ maShape = new Rectangle2D.Double (
+ maPosition.x,
+ maPosition.y,
+ maSize.width,
+ maSize.height);
+ maTransformation = g.getTransform();
+
+ // Fill the object's bounding box with its background color if it
+ // has no children.
+ if (mxContext.getAccessibleChildCount() == 0)
+ {
+ g.setColor (maBgColor);
+ g.fill (maShape);
+ }
+
+ // Remove alpha channel from color before drawing the frame.
+ Color color = maFgColor;
+ if (maFgColor.getAlpha()<128)
+ color = new Color (maFgColor.getRed(), maFgColor.getGreen(), maFgColor.getBlue());
+ g.setColor (color);
+ g.draw (maShape);
+
+ if (mbFocused)
+ {
+ g.setColor (maFocusColor);
+ for (int x=0; x<=2; x++)
+ for (int y=0; y<=2; y++)
+ g.fill (
+ new Rectangle2D.Double (
+ maShape.x + x/2.0 * maShape.width-3,
+ maShape.y + y/2.0 * maShape.height-3,
+ 6,
+ 6));
+ }
+ if (mbSelected)
+ {
+ g.setColor (maSelectionColor);
+ for (int x=0; x<=2; x++)
+ for (int y=0; y<=2; y++)
+ g.draw (
+ new Rectangle2D.Double (
+ maShape.x + x/2.0 * maShape.width-2,
+ maShape.y + y/2.0 * maShape.height-2,
+ 4,
+ 4));
+ }
+
+ // Write the object's text OR name and description.
+ g.setColor (maFgColor);
+ if (bShowName)
+ paintName (g);
+ if (bShowDescription)
+ paintDescription (g);
+ if (bShowText)
+ paintText (g);
+ }
+ catch (Exception e)
+ { // don't care
+ }
+ }
+
+
+ public void paint_highlight (Graphics2D g)
+ {
+ if (mbHighlighted)
+ g.setColor (maHighlightColor);
+ else
+ g.setColor (maFgColor);
+ g.draw (maShape);
+ }
+
+
+
+
+ private void paintName (Graphics2D g)
+ {
+ g.drawString ("Name: " + msName,
+ (float)maShape.x+5,
+ (float)maShape.y+15);
+ }
+
+
+
+ private void paintDescription (Graphics2D g)
+ {
+ g.drawString ("Description: " + msDescription,
+ (float)maShape.x+5,
+ (float)maShape.y+35);
+ }
+
+
+
+
+ private void paintText (Graphics2D g)
+ {
+ XAccessibleText xText = null;
+ // get XAccessibleText
+ xText = (XAccessibleText)UnoRuntime.queryInterface(
+ XAccessibleText.class, mxContext);
+
+ // Draw every character in the text string.
+ if (xText != null)
+ {
+ String sText = xText.getText();
+ try
+ {
+ for(int i = 0; i < sText.length(); i++)
+ {
+ com.sun.star.awt.Rectangle aRect =
+ xText.getCharacterBounds(i);
+
+ double x = maShape.x + aRect.X;
+ double y = maShape.y + aRect.Y + aRect.Height;
+
+ g.drawString (sText.substring(i, i+1), (float)x, (float)y);
+ }
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {}
+ }
+ }
+
+
+ /** Compute whether the specified point lies inside the object's
+ bounding box.
+ */
+ public boolean Contains (int x, int y)
+ {
+ Point2D aPosition = new Point2D.Double (x,y);
+ try
+ {
+ maTransformation.inverseTransform (aPosition, aPosition);
+ // System.out.println ("transformed "+x+","+y+" to "+aPosition);
+ }
+ catch (NoninvertibleTransformException aException)
+ {
+ return false;
+ }
+ return (maShape.contains (aPosition));
+ }
+
+ public void Highlight (boolean bFlag)
+ {
+ mbHighlighted = bFlag;
+ }
+
+ public boolean IsHighlighted ()
+ {
+ return mbHighlighted;
+ }
+
+ public Rectangle GetBBox ()
+ {
+ return new Rectangle (maPosition, maSize);
+ }
+
+ public Point getOrigin ()
+ {
+ return maPosition;
+ }
+
+ public Dimension GetSize ()
+ {
+ return maSize;
+ }
+
+ public int getRole ()
+ {
+ return mnRole;
+ }
+
+ public XAccessibleContext getContext ()
+ {
+ return mxContext;
+ }
+
+ public XAccessibleComponent getComponent ()
+ {
+ return mxComponent;
+ }
+
+ public String toString ()
+ {
+ return ">"+msName+", "+msDescription+" +"+maPosition.x+"+"+maPosition.y
+ +"x"+maSize.width+"x"+maSize.height+"<";
+ }
+
+ /** */
+ public void notifyEvent(com.sun.star.accessibility.AccessibleEventObject aEvent) {
+ try {
+ switch (aEvent.EventId) {
+ case AccessibleEventId.BOUNDRECT_CHANGED:
+ case AccessibleEventId.VISIBLE_DATA_CHANGED:
+ UpdateGeometry ();
+ maCanvas.repaint();
+ break;
+ default:
+ break;
+ }
+ } catch (Exception aException) {
+ System.err.println ("caught exception while updating a shape:"
+ + aException);
+ aException.printStackTrace (System.err);
+ }
+ }
+
+ /** Callback for disposing events.
+ */
+ public void disposing (com.sun.star.lang.EventObject e)
+ {
+ System.out.println ("Disposing");
+ }
+
+
+
+
+ private Canvas
+ maCanvas;
+ private javax.swing.tree.TreeNode
+ maNode;
+ private XAccessibleContext
+ mxContext;
+ private XAccessibleComponent
+ mxComponent;
+ private String
+ msDescription,
+ msName;
+ private Rectangle2D.Double maShape;
+ private AffineTransform maTransformation;
+ private Point maPosition;
+ private Dimension
+ maTransformedSize,
+ maSize;
+ private Color
+ maFgColor,
+ maBgColor;
+ private boolean
+ // Highlighting objects is an internal concept. Corresponds to selection in the tree view.
+ mbHighlighted,
+ // Set when the accessible object is selected.
+ mbSelected,
+ // Set when the accessible object is focused.
+ mbFocused;
+ private int
+ mnRole;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile
new file mode 100644
index 000000000000..8d9688433ff9
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Makefile
@@ -0,0 +1,15 @@
+# $Id: Makefile,v 1.1 2003/06/13 16:30:21 af Exp $
+
+all : package
+
+ROOT=../../../../..
+PACKAGE = org.openoffice.accessibility.awb.canvas
+SUBDIRS =
+include makefile.common
+
+include $(ROOT)/makefile.in
+
+
+package : $(CLASS_FILES)
+
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java
new file mode 100644
index 000000000000..3e7e2807906d
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/MouseObserver.java
@@ -0,0 +1,104 @@
+package org.openoffice.accessibility.awb.canvas;
+
+import java.awt.Dimension;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.util.Iterator;
+import javax.swing.tree.TreePath;
+
+
+/** Observe the mouse and highlight shapes of the canvas when clicked.
+*/
+public class MouseObserver
+ implements MouseListener,
+ MouseMotionListener
+{
+ public MouseObserver (Canvas aCanvas)
+ {
+ maCanvas = aCanvas;
+ maCanvas.addMouseListener (this);
+ maCanvas.addMouseMotionListener (this);
+ }
+
+
+ public void SetTree (javax.swing.JTree aTree)
+ {
+ maTree = aTree;
+ }
+
+ public void mouseClicked (MouseEvent e)
+ {}
+
+ public void mousePressed (MouseEvent e)
+ {
+ CanvasShape aObjectUnderMouse = FindCanvasShapeUnderMouse (e);
+ maTree.clearSelection();
+ if (aObjectUnderMouse != null)
+ {
+ TreePath aPath = aObjectUnderMouse.getNodePath();
+ if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0)
+ maTree.expandPath (aPath);
+ // Selecting the entry will eventually highlight the shape.
+ maTree.setSelectionPath (aPath);
+ maTree.makeVisible (aPath);
+ }
+ }
+
+ public void mouseReleased (MouseEvent e)
+ {}
+
+ public void mouseEntered (MouseEvent e)
+ {}
+
+ public void mouseExited (MouseEvent e)
+ {}
+
+ public void mouseDragged (MouseEvent e)
+ {
+ }
+
+ public void mouseMoved (MouseEvent e)
+ {
+ if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0)
+ maCanvas.HighlightObject (FindCanvasShapeUnderMouse (e));
+ }
+
+
+ /** Search for the smallest shape that contains the mouse position.
+ */
+ protected CanvasShape FindCanvasShapeUnderMouse (MouseEvent e)
+ {
+ Dimension aSmallestSize = null;
+ Iterator maShapeIterator = maCanvas.GetShapeIterator();
+ CanvasShape aShapeUnderMouse = null;
+ while (maShapeIterator.hasNext())
+ {
+ CanvasShape aShape = (CanvasShape)maShapeIterator.next();
+ if (aShape != null)
+ if (aShape.Contains (e.getX(),e.getY()))
+ {
+ if (aShapeUnderMouse == null)
+ {
+ aSmallestSize = aShape.GetSize();
+ aShapeUnderMouse = aShape;
+ }
+ else
+ {
+ Dimension aSize = aShape.GetSize();
+ if (aSize.getWidth()<aSmallestSize.getWidth()
+ || aSize.getHeight()<aSmallestSize.getHeight())
+ {
+ aSmallestSize = aSize;
+ aShapeUnderMouse = aShape;
+ }
+ }
+ }
+ }
+ return aShapeUnderMouse;
+ }
+
+ private Canvas maCanvas;
+ private javax.swing.JTree maTree;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java b/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java
new file mode 100644
index 000000000000..fd99d5601cc0
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * $RCSfile: ShapeContainer.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.canvas;
+
+import java.awt.Rectangle;
+import java.util.Iterator;
+import javax.swing.event.TreeModelListener;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.event.TreeWillExpandListener;
+import javax.swing.event.TreeExpansionEvent;
+import javax.swing.event.TreeModelEvent;
+import javax.swing.tree.TreeNode;
+
+import com.sun.star.accessibility.XAccessibleEventBroadcaster;
+
+/** Each canvas has a shape container that is responsible for maintaining
+ a collection of shapes that are displayed by the canvas.
+*/
+public class ShapeContainer
+ implements TreeModelListener,
+ TreeExpansionListener,
+ TreeWillExpandListener
+{
+ public ShapeContainer (Canvas aCanvas)
+ {
+ maShapeList = new java.util.Hashtable();
+ maBoundingBox = new Rectangle (0,0,100,100);
+ maCanvas = aCanvas;
+ maTree = null;
+ }
+
+
+
+
+ public synchronized void SetTree (javax.swing.JTree aTree)
+ {
+ if (aTree != maTree)
+ {
+ if (maTree != null)
+ {
+ maTree.getModel().removeTreeModelListener (this);
+ maTree.removeTreeExpansionListener (this);
+ maTree.removeTreeWillExpandListener (this);
+ }
+
+ Clear();
+
+ maTree = aTree;
+
+ maTree.getModel().addTreeModelListener (this);
+ maTree.addTreeExpansionListener (this);
+ maTree.addTreeWillExpandListener (this);
+ }
+ }
+
+
+
+
+ public synchronized boolean AddNode (TreeNode aNode)
+ {
+ CanvasShape aShape = (CanvasShape)maShapeList.get (aNode);
+ if (aShape == null)
+ {
+ aShape = new CanvasShape (aNode, maCanvas);
+
+ if (aNode instanceof XAccessibleEventBroadcaster)
+ ((XAccessibleEventBroadcaster) aNode).addEventListener(aShape);
+
+ // Update bounding box that includes all objects.
+ if (maShapeList.size() == 0)
+ maBoundingBox = aShape.GetBBox();
+ else
+ maBoundingBox = maBoundingBox.union (aShape.GetBBox());
+
+ maShapeList.put (aNode, aShape);
+
+ maCanvas.repaint();
+
+ return true;
+ }
+ else
+ return false;
+ }
+
+
+ /**
+ */
+ public synchronized boolean RemoveNode (TreeNode aNode)
+ {
+ CanvasShape aShape = (CanvasShape)maShapeList.get (aNode);
+ if (aShape != null)
+ {
+ if (aNode instanceof XAccessibleEventBroadcaster)
+ ((XAccessibleEventBroadcaster) aNode).removeEventListener(aShape);
+
+ maShapeList.remove (aNode);
+ maCanvas.SelectObject (null);
+ maCanvas.repaint ();
+ return true;
+ }
+ else
+ return false;
+ }
+
+
+
+
+ public synchronized void Clear ()
+ {
+ maShapeList.clear ();
+ }
+
+
+
+
+ public Iterator GetIterator ()
+ {
+ return maShapeList.values().iterator ();
+ }
+
+
+
+
+ public CanvasShape Get (TreeNode aNode)
+ {
+ if (aNode != null) {
+ return (CanvasShape)maShapeList.get (aNode);
+ }
+ return null;
+ }
+
+
+ private void PrintMessage (String aMessage, java.util.EventObject aEvent)
+ {
+ // System.out.println ("ShapeContainer: " + aMessage + ": " + aEvent);
+ }
+
+ public void treeNodesChanged (TreeModelEvent aEvent)
+ {
+ PrintMessage ("treeNodesChanged", aEvent);
+ }
+ public void treeNodesInserted (TreeModelEvent aEvent)
+ {
+ PrintMessage ("treeNodesInserted", aEvent);
+ Object[] aNewNodes = aEvent.getChildren();
+ for (int i=0; i<aNewNodes.length; i++)
+ AddNode ((TreeNode)aNewNodes[i]);
+ }
+ public void treeNodesRemoved (TreeModelEvent aEvent)
+ {
+ PrintMessage ("treeNodesRemoved", aEvent);
+ Object[] aOldNodes = aEvent.getChildren();
+ for (int i=0; i<aOldNodes.length; i++)
+ RemoveNode ((TreeNode)aOldNodes[i]);
+ }
+ public void treeStructureChanged (TreeModelEvent aEvent)
+ {
+ PrintMessage ("treeStructureChanged", aEvent);
+ TreeNode aNode = (TreeNode)aEvent.getTreePath().getLastPathComponent();
+ RemoveAllChildren(aNode);
+ AddAllChildren(aNode);
+ }
+
+ public void treeWillExpand (TreeExpansionEvent aEvent)
+ {
+ PrintMessage ("treeWillExpand", aEvent);
+ }
+ public void treeWillCollapse (TreeExpansionEvent aEvent)
+ {
+ PrintMessage ("treeWillCollapse", aEvent);
+ TreeNode aNode = (TreeNode)aEvent.getPath().getLastPathComponent();
+ RemoveAllChildren (aNode);
+ }
+ public void treeExpanded (TreeExpansionEvent aEvent)
+ {
+ PrintMessage ("treeExpanded", aEvent);
+ TreeNode aNode = (TreeNode)aEvent.getPath().getLastPathComponent();
+ AddAllChildren (aNode);
+ }
+ public void treeCollapsed (TreeExpansionEvent aEvent)
+ {
+ PrintMessage ("treeCollapsed", aEvent);
+ }
+
+ private void AddAllChildren (TreeNode aNode) {
+ java.util.Enumeration aChildList = aNode.children();
+ while (aChildList.hasMoreElements()) {
+ TreeNode aChild = (TreeNode) aChildList.nextElement();
+ if (aChild != null) {
+ AddAllChildren (aChild);
+ AddNode (aChild);
+ }
+ }
+ }
+
+ private void RemoveAllChildren (TreeNode aNode) {
+ java.util.Enumeration aChildList = aNode.children();
+ while (aChildList.hasMoreElements()) {
+ TreeNode aChild = (TreeNode) aChildList.nextElement();
+ if (aChild != null) {
+ RemoveAllChildren (aChild);
+ RemoveNode (aChild);
+ }
+ }
+ }
+
+
+ private java.util.Hashtable maShapeList;
+ private Rectangle maBoundingBox;
+ private Canvas maCanvas;
+ private javax.swing.JTree maTree;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common
new file mode 100644
index 000000000000..3b7262a8489d
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.common,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar
+JAVAFILES = \
+ CanvasShape.java \
+ Canvas.java \
+ MouseObserver.java \
+ ShapeContainer.java
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk
new file mode 100644
index 000000000000..6e3ef06aab8b
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJNAME = awb
+PRJ = ..$/..$/..$/..$/..$/..
+TARGET = awb_canvas
+PACKAGE = org$/openoffice$/accessibility$/awb$/canvas
+
+USE_JAVAVER:=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(JAVAVER:s/.//)" >= "140"
+
+.INCLUDE : makefile.common
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+#JARTARGET = $(TARGET).jar
+#JARCOMPRESS = TRUE
+JARCLASSDIRS = $(PACKAGE) org/openoffice/java/accessibility/awb
+#CUSTOMMANIFESTFILE = manifest
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/makefile.common
new file mode 100644
index 000000000000..80633d7e66ea
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/makefile.common
@@ -0,0 +1,3 @@
+JAVAFILES = \
+ AccessibilityWorkBench.java \
+ HelpWindow.java
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk
new file mode 100644
index 000000000000..eb744d465cfb
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk
@@ -0,0 +1,88 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJNAME = awb
+PRJ = ..$/..$/..$/..$/..
+TARGET = java_awb
+PACKAGE = org$/openoffice$/accessibility$/awb
+
+USE_JAVAVER:=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(JAVAVER:s/.//)" >= "140"
+JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar
+
+.INCLUDE : makefile.common
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+JARCLASSDIRS = $(PACKAGE) \
+ org$/openoffice$/accessibility$/misc
+CUSTOMMANIFESTFILE = manifest
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/manifest b/accessibility/workben/org/openoffice/accessibility/awb/manifest
new file mode 100644
index 000000000000..951f9ec3128f
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/manifest
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: org.openoffice.accessibility.awb.AccessibilityWorkBench
+Class-Path: classes.jar sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar xt.jar jaxp.jar
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java
new file mode 100644
index 000000000000..6bdb5976f843
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * $RCSfile: AccessibilityModel.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.tree;
+
+import javax.swing.SwingUtilities;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.MutableTreeNode;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XTopWindow;
+import com.sun.star.awt.XTopWindowListener;
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEventBroadcaster;
+import com.sun.star.accessibility.XAccessibleEventListener;
+
+/**
+ *
+ */
+public abstract class AccessibilityModel extends javax.swing.tree.DefaultTreeModel {
+
+ protected java.util.Hashtable nodeList;
+ protected static DefaultMutableTreeNode disconnectedRootNode =
+ new DefaultMutableTreeNode("<not connected>");
+
+ /** Creates a new instance of AccessibilityModel */
+ public AccessibilityModel() {
+ super(disconnectedRootNode, false);
+ nodeList = new java.util.Hashtable();
+ }
+
+ /* Convenience method that creates a new Toolkit node from xToolkit
+ * and sets as the new root object of the tree.
+ */
+ public synchronized void setRoot(XExtendedToolkit xToolkit) {
+ if (xToolkit != null) {
+ try {
+ // remove old root node as topwindow listener
+ if (getRoot() instanceof ToolkitNode) {
+ ToolkitNode tn = (ToolkitNode) getRoot();
+ if (tn.xToolkit != null) {
+ tn.xToolkit.removeTopWindowListener(tn);
+ }
+ }
+ nodeList.clear();
+ setRoot(new ToolkitNode(xToolkit, this));
+ xToolkit.addTopWindowListener((ToolkitNode) getRoot());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ // FIXME: error message !
+ }
+ }
+ }
+
+ /* Appends the new child to parent's child list */
+ public void addNodeInto(MutableTreeNode newChild, MutableTreeNode parent) {
+ int index = parent.getChildCount();
+ if (newChild != null && newChild.getParent() == parent) {
+ index -= 1;
+ }
+ insertNodeInto(newChild, parent, index);
+ }
+
+ /** Adds listener to the listener chain of node */
+ public static void addEventListener(TreeNode node, XAccessibleEventListener listener) {
+ if (node instanceof AccessibilityNode) {
+ ((AccessibilityNode) node).addEventListener(listener);
+ }
+ }
+
+ /** Removes listener from the listener chain of node */
+ public static void removeEventListener(TreeNode node, XAccessibleEventListener listener) {
+ if (node instanceof AccessibilityNode) {
+ ((AccessibilityNode) node).removeEventListener(listener);
+ }
+ }
+
+ protected abstract AccessibilityNode createWindowNode(XAccessible xAccessible,
+ XAccessibleContext xAccessibleContext);
+ protected abstract AccessibilityNode createNode(XAccessible xAccessible);
+
+ /** Adds xAccessible,node to the internal hashtable */
+ public AccessibilityNode putNode(XAccessible xAccessible, AccessibilityNode node) {
+ if (xAccessible != null) {
+ String oid = UnoRuntime.generateOid(xAccessible);
+ java.lang.ref.WeakReference ref = (java.lang.ref.WeakReference)
+ nodeList.put(oid, new java.lang.ref.WeakReference(node));
+ if (ref != null) {
+ return (AccessibilityNode) ref.get();
+ }
+ }
+ return null;
+ }
+
+ /** Returns the AccessibilityNode for xAccessible */
+ public AccessibilityNode findNode(XAccessible xAccessible) {
+ if (xAccessible != null) {
+ String oid = UnoRuntime.generateOid(xAccessible);
+ java.lang.ref.WeakReference ref =
+ (java.lang.ref.WeakReference) nodeList.get(oid);
+ if (ref != null) {
+ return (AccessibilityNode) ref.get();
+ }
+ }
+ return null;
+ }
+
+ /** Removes the AccessibilityNode for xAccessible from the internal hashtable */
+ public AccessibilityNode removeNode(XAccessible xAccessible) {
+ if (xAccessible != null) {
+ String oid = UnoRuntime.generateOid(xAccessible);
+ java.lang.ref.WeakReference ref =
+ (java.lang.ref.WeakReference) nodeList.remove(oid);
+ if (ref != null) {
+ return (AccessibilityNode) ref.get();
+ }
+ }
+ return null;
+ }
+
+ public AccessibilityNode removeNode(Object o) {
+ if (o instanceof XAccessible) {
+ return removeNode((XAccessible) o);
+ }
+ return null;
+ }
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java
new file mode 100644
index 000000000000..36c5d71b240e
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * $RCSfile: AccessibilityNode.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.tree;
+
+import org.openoffice.accessibility.misc.AccessibleEventMulticaster;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.SwingUtilities;
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEventBroadcaster;
+import com.sun.star.accessibility.XAccessibleEventListener;
+
+import com.sun.star.uno.UnoRuntime;
+
+class AccessibilityNode extends DefaultMutableTreeNode implements XAccessible,
+ XAccessibleEventListener, XAccessibleEventBroadcaster {
+
+ protected AccessibilityModel treeModel;
+ protected XAccessibleContext unoAccessibleContext;
+
+ private XAccessibleEventListener listener;
+
+ public AccessibilityNode(AccessibilityModel treeModel) {
+ this.treeModel = treeModel;
+ }
+
+ protected void finalize() throws java.lang.Throwable {
+ if (userObject != null) {
+ treeModel.removeNode(userObject);
+ }
+ }
+
+ /** Sets the XAccessibleContext object of this node */
+ public void setAccessibleContext(XAccessibleContext xAccessibleContext) {
+ unoAccessibleContext = xAccessibleContext;
+ }
+
+ /** Returns the XAccessibleContext object of this node */
+ public XAccessibleContext getAccessibleContext() {
+ return unoAccessibleContext;
+ }
+
+ /** Attaches or Detaches the itself as listener to unoAccessibleContext */
+ protected void setAttached(boolean attach) {
+ XAccessibleContext xAccessibleContext = unoAccessibleContext;
+ if (xAccessibleContext != null) {
+ try {
+ XAccessibleEventBroadcaster xAccessibleEventBroadcaster =
+ (XAccessibleEventBroadcaster) UnoRuntime.queryInterface(
+ XAccessibleEventBroadcaster.class, xAccessibleContext);
+ if (xAccessibleEventBroadcaster != null) {
+ if (attach) {
+ xAccessibleEventBroadcaster.addEventListener(this);
+ } else {
+ xAccessibleEventBroadcaster.removeEventListener(this);
+ }
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ // FIXME: error message !
+ }
+ }
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ XAccessibleEventListener listener = this.listener;
+ if (listener != null) {
+ listener.disposing(eventObject);
+ }
+
+ treeModel.removeNode(userObject);
+ userObject = null;
+ unoAccessibleContext = null;
+ // FIXME: mark the object as being disposed in the tree view !
+ }
+
+ protected void handleChildRemoved(XAccessible xAccessible) {
+ final AccessibilityNode node = treeModel.findNode(xAccessible);
+ if (node != null) {
+ SwingUtilities.invokeLater(new java.lang.Runnable() {
+ public void run() {
+ treeModel.removeNodeFromParent(node);
+ }
+ });
+ }
+ }
+
+ protected void handleChildAdded(XAccessible xAccessible) {
+ final AccessibilityNode parent = this;
+ final AccessibilityNode node = treeModel.createNode(xAccessible);
+ if (node != null) {
+ SwingUtilities.invokeLater(new java.lang.Runnable() {
+ public void run() {
+ try {
+ XAccessibleContext xAC = node.getAccessibleContext();
+ if (xAC != null) {
+ treeModel.insertNodeInto(node, parent,
+ xAC.getAccessibleIndexInParent());
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ // FIXME: output
+ }
+ }
+ });
+ }
+ }
+
+ public void notifyEvent(AccessibleEventObject accessibleEventObject) {
+ if (accessibleEventObject.EventId == AccessibleEventId.CHILD) {
+ XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(
+ XAccessible.class, accessibleEventObject.OldValue);
+ if (xAccessible != null) {
+ handleChildRemoved(xAccessible);
+ }
+
+ xAccessible = (XAccessible) UnoRuntime.queryInterface(
+ XAccessible.class, accessibleEventObject.NewValue);
+ if (xAccessible != null) {
+ handleChildAdded(xAccessible);
+ }
+ }
+
+ XAccessibleEventListener listener = this.listener;
+ if (listener != null) {
+ listener.notifyEvent(accessibleEventObject);
+ }
+ }
+
+ public synchronized void addEventListener(com.sun.star.accessibility.XAccessibleEventListener xAccessibleEventListener) {
+ listener = AccessibleEventMulticaster.add(listener, xAccessibleEventListener);
+ }
+
+ public synchronized void removeEventListener(com.sun.star.accessibility.XAccessibleEventListener xAccessibleEventListener) {
+ listener = AccessibleEventMulticaster.remove(listener, xAccessibleEventListener);
+ }
+}
+
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java
new file mode 100644
index 000000000000..f7e71d21574e
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * $RCSfile: AccessibilityTree.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.tree;
+
+import org.openoffice.accessibility.misc.NameProvider;
+
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+
+/**
+ *
+ */
+public class AccessibilityTree extends javax.swing.JTree {
+
+ /** Creates a new instance of AccessibilityTree */
+ public AccessibilityTree(javax.swing.tree.TreeModel model) {
+ super(model);
+ // always show handles to indicate expandable / collapsable
+ showsRootHandles = true;
+ }
+
+ public void setToolkit(XExtendedToolkit xToolkit) {
+ AccessibilityModel model = (AccessibilityModel) getModel();
+ if (model != null) {
+ // hide the root node when connected
+ setRootVisible(xToolkit == null);
+ // update the root node
+ model.setRoot(xToolkit);
+ model.reload();
+ }
+ }
+
+ public String convertValueToText(Object value, boolean selected,
+ boolean expanded, boolean leaf, int row, boolean hasFocus) {
+
+ if (value instanceof DefaultMutableTreeNode) {
+ DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
+
+ Object userObject = node.getUserObject();
+ if (userObject != null && userObject instanceof XAccessible) {
+ XAccessible xAccessible = (XAccessible) userObject;
+ try {
+ XAccessibleContext xAC = xAccessible.getAccessibleContext();
+ if (xAC != null) {
+ String name = xAC.getAccessibleName();
+ if (name.length() == 0) {
+ name = new String ("<no name>");
+ }
+ value = name + " / " + NameProvider.getRoleName(xAC.getAccessibleRole());
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ value = "???";
+ }
+ }
+ }
+
+ return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
+ }
+
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java
new file mode 100644
index 000000000000..acecd0100a2e
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * $RCSfile: AccessibilityTreeModel.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc.,y October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.tree;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+import org.openoffice.accessibility.misc.OfficeConnection;
+import org.openoffice.accessibility.awb.event.EventQueue;
+
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+
+
+public class AccessibilityTreeModel
+ extends DefaultTreeModel
+{
+ public AccessibilityTreeModel ()
+ {
+ super (null);
+ setAsksAllowsChildren (false);
+
+ SetRootNode();
+ }
+
+
+
+ /** Release all resources.
+ */
+ synchronized public void Dispose ()
+ {
+ Clear ();
+ }
+
+
+
+ /** Calls to this method are dispatched to the given node but are
+ observed for exceptions.
+ */
+ synchronized public boolean isLeaf (Object aObject)
+ {
+ boolean bIsLeaf = true;
+
+ if (aObject != null)
+ {
+ AccessibilityNode aNode = (AccessibilityNode)aObject;
+ try
+ {
+ bIsLeaf = aNode.isLeaf();
+ }
+ catch (DisposedException aException)
+ {
+ System.out.println ("node is disposed. removing it");
+ /* TreeNode aParent = aNode.GetParent();
+ int nIndexInParent = aParent.getIndex (aNode);
+ aNode.removeFromParent ();
+ System.out.println ("" + aParent + " # " + aNode + " # "+ nIndexInParent);
+ nodesWereRemoved (
+ aParent, new int[]{nIndexInParent}, new
+ Object[]{aNode});
+ */
+ }
+ catch (Exception aException)
+ {
+ System.err.println ("caught exception in AccessibilityTreeModel.isLeaf():"
+ + aException);
+ aException.printStackTrace (System.err);
+ }
+ }
+
+ return bIsLeaf;
+ }
+
+
+
+
+ synchronized public int getChildCount (Object aObject)
+ {
+ AccessibilityNode aNode = (AccessibilityNode)aObject;
+ return aNode.getChildCount();
+ }
+
+
+
+
+ /** Return the requested child of aParent. If that child is not yet
+ known to the parent then try to create it.
+ */
+ synchronized public Object getChild (Object aParent, final int nIndex)
+ {
+ AccessibilityNode aChild = null;
+
+ final AccessibilityNode aParentNode = (AccessibilityNode)aParent;
+
+ // Try to get an existing child from the super class object.
+ aChild = aParentNode.GetChildNoCreate (nIndex);
+
+ // When the requested child does not yet exist and this node is not a
+ // special node then create a new node.
+ if (aChild == null)
+ {
+ aChild = aParentNode.CreateChild (nIndex);
+ aParentNode.SetChild ((AccessibilityNode)aChild, nIndex);
+ /* EventQueue.Instance().AddEvent (new Runnable() { public void run() {
+ AccessibilityTreeModel.this.nodeWasInserted (
+ aParentNode, nIndex);
+ }});
+ */ }
+
+ return aChild;
+ }
+
+
+ synchronized public void nodeWasInserted (AccessibilityNode aParent, int nIndex)
+ {
+ nodesWereInserted (aParent, new int[]{nIndex});
+ nodeStructureChanged (aParent);
+
+ }
+
+
+
+
+ /** Clear the tree so that afterwards it has only the root node.
+ */
+ public void Clear ()
+ {
+ AccessibilityNode aRoot = (AccessibilityNode)getRoot();
+ aRoot.RemoveAllChildren();
+ SetRootNode();
+ nodeStructureChanged (aRoot);
+ }
+
+
+
+
+ private void SetRootNode ()
+ {
+ OfficeConnection aConnection = OfficeConnection.Instance();
+ AccessibilityNode aRoot;
+ if (aConnection!=null && aConnection.IsValid())
+ aRoot = new AccessibilityNode ("<connected>");
+ else
+ aRoot = new AccessibilityNode ("<not connected>");
+ setRoot (aRoot);
+ }
+
+
+
+
+ /** Add a new child to the root node.
+ */
+ public synchronized void AddTopLevelNode (AccessibilityNode aNode)
+ {
+ if (aNode != null)
+ {
+ if ( ! OfficeConnection.Instance().IsValid())
+ {
+ setRoot (null);
+ }
+
+ AccessibilityNode aRoot = (AccessibilityNode)getRoot();
+ if (aRoot == null)
+ {
+ aRoot = new AccessibilityNode ("<connected>");
+ setRoot (aRoot);
+ }
+
+ aNode.SetParent (aRoot);
+ aRoot.Append (aNode);
+ nodesWereInserted (aRoot, new int[]{aRoot.getIndex (aNode)});
+ }
+ }
+
+
+
+
+ /** Remove a node that is a direct child of the root.
+ */
+ public synchronized void RemoveTopLevelNode (AccessibilityNode aNode)
+ {
+ AccessibilityNode aRoot = (AccessibilityNode)getRoot();
+ if (aRoot != null)
+ {
+ int nIndex = aRoot.getIndex (aNode);
+ aRoot.Remove (aNode);
+ nodesWereRemoved (aRoot, new int[]{nIndex}, new Object[]{aNode});
+ }
+ }
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java
new file mode 100644
index 000000000000..0f5626852238
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * $RCSfile: DynamicAccessibilityModel.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.tree;
+
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.MutableTreeNode;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.event.TreeWillExpandListener;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+
+/**
+ *
+ */
+public class DynamicAccessibilityModel extends AccessibilityModel implements TreeExpansionListener, TreeWillExpandListener {
+
+ /* Creates a AccessibilityNode object for a window */
+ protected AccessibilityNode createWindowNode(XAccessible xAccessible,
+ XAccessibleContext xAccessibleContext) {
+ if (xAccessible != null) {
+ // Some objects inherit XAccessible, but should not appear in
+ // the hierarchy as toplevels (like sub-menus), so they don't
+ // return an accessible context.
+ if (xAccessibleContext != null) {
+ AccessibilityNode node = new AccessibilityNode(this);
+ node.setUserObject(xAccessible);
+ node.setAccessibleContext(xAccessibleContext);
+ putNode(xAccessible, node);
+ return node;
+ }
+ }
+ return null;
+ }
+
+ /* Creates a DynamicAccessibilityNode object */
+ protected AccessibilityNode createNode(XAccessible xAccessible) {
+ if (xAccessible != null) {
+ try {
+ // Some objects inherit XAccessible, but should not appear in
+ // the hierarchy as toplevels (like sub-menus), so they don't
+ // return an accessible context.
+ XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext();
+ if (xAccessibleContext != null) {
+ AccessibilityNode node = new DynamicAccessibilityNode(this);
+ node.setUserObject(xAccessible);
+ node.setAccessibleContext(xAccessibleContext);
+ putNode(xAccessible, node);
+ return node;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ return null;
+ }
+
+ public void treeCollapsed(javax.swing.event.TreeExpansionEvent treeExpansionEvent) {
+ TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent();
+ if (node instanceof DynamicAccessibilityNode) {
+ DynamicAccessibilityNode dynode = (DynamicAccessibilityNode) node;
+ dynode.clear();
+ }
+ }
+
+ public void treeExpanded(javax.swing.event.TreeExpansionEvent treeExpansionEvent) {
+ TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent();
+ if (node instanceof AccessibilityNode) {
+ // Calling oneway methods from an UNO thread may cause
+ // deadlocks, so adding the listeners here.
+ for (java.util.Enumeration e = node.children(); e.hasMoreElements(); ) {
+ ((AccessibilityNode) e.nextElement()).setAttached(true);
+ }
+ }
+ }
+
+ public void treeWillCollapse(javax.swing.event.TreeExpansionEvent treeExpansionEvent)
+ throws javax.swing.tree.ExpandVetoException {
+ TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent();
+ if (node instanceof AccessibilityNode) {
+ // Calling oneway methods from an UNO thread may cause
+ // deadlocks, so adding the listeners here.
+ for (java.util.Enumeration e = node.children(); e.hasMoreElements(); ) {
+ ((AccessibilityNode) e.nextElement()).setAttached(false);
+ }
+ }
+ }
+
+ public void treeWillExpand(javax.swing.event.TreeExpansionEvent treeExpansionEvent)
+ throws javax.swing.tree.ExpandVetoException {
+ TreeNode node = (TreeNode) treeExpansionEvent.getPath().getLastPathComponent();
+ if (node instanceof DynamicAccessibilityNode) {
+ DynamicAccessibilityNode dynode = (DynamicAccessibilityNode) node;
+ dynode.populate();
+ }
+ }
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java
new file mode 100644
index 000000000000..ff6f5ddd45ea
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * $RCSfile: DynamicAccessibilityNode.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:40 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.tree;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+
+/*
+ * This class is dynamic in the way that it does not contain any children
+ * until the node is going to be expanded. It also releases all children
+ * as soon as the node is collapsed again.
+ */
+class DynamicAccessibilityNode extends AccessibilityNode {
+
+ public DynamicAccessibilityNode(AccessibilityModel treeModel) {
+ super(treeModel);
+ }
+
+ // Populates the child list. Called by AccessibilityMode.treeWillExpand().
+ protected void populate() {
+ try {
+ XAccessibleContext xAC = getAccessibleContext();
+ if (xAC != null) {
+ int n = xAC.getAccessibleChildCount();
+ for (int i=0; i<n; i++) {
+ XAccessible xAccessible = xAC.getAccessibleChild(i);
+ AccessibilityNode node = treeModel.findNode(xAccessible);
+ if (node == null) {
+ node = treeModel.createNode(xAccessible);
+ }
+ if (node != null) {
+ // NOTE: do not send any tree notifications here !
+ add(node);
+ }
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ // This should never happen since we previously checked the child
+ // count.
+ // FIXME: error message
+ } catch (com.sun.star.uno.RuntimeException e) {
+ // FIXME: error message
+ }
+ }
+
+ // Clears the child list. Called by AccessibilityModel.treeCollapsed().
+ protected void clear() {
+ removeAllChildren();
+ }
+
+ /* This is called whenever the node is painted, no matter if collapsed
+ * or expanded. Making this a "life" value seems to be appropriate.
+ */
+ public boolean isLeaf() {
+ try {
+ XAccessibleContext xAC = getAccessibleContext();
+ if (xAC != null) {
+ return xAC.getAccessibleChildCount() == 0;
+ }
+ return true;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return true;
+ }
+ }
+
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile
new file mode 100644
index 000000000000..8166c0b91312
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile
@@ -0,0 +1,71 @@
+#*************************************************************************
+#
+# $RCSfile: Makefile,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+all : package
+
+ROOT=../../../../..
+PACKAGE = org.openoffice.accessibility.awb.tree
+SUBDIRS =
+include makefile.common
+
+include $(ROOT)/makefile.in
+
+
+package : $(CLASS_FILES)
+
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java b/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java
new file mode 100644
index 000000000000..30a6f578f06e
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java
@@ -0,0 +1,249 @@
+/*************************************************************************
+ *
+ * $RCSfile: ToolkitNode.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:41 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.tree;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XTopWindow;
+
+import com.sun.star.uno.UnoRuntime;
+
+import javax.swing.SwingUtilities;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+/**
+ *
+ */
+public class ToolkitNode extends DefaultMutableTreeNode
+ implements com.sun.star.awt.XTopWindowListener {
+
+ protected XExtendedToolkit xToolkit;
+
+ private AccessibilityModel treeModel;
+
+ /** Creates a new instance of TopWindowListener */
+ public ToolkitNode(XExtendedToolkit xToolkit, AccessibilityModel treeModel) {
+ super("<connected>");
+ this.xToolkit = xToolkit;
+ this.treeModel = treeModel;
+
+ // Initially fill the child list
+ try {
+ for (int i=0,j=xToolkit.getTopWindowCount(); i<j; i++) {
+ XTopWindow xTopWindow = xToolkit.getTopWindow(i);
+ if (xTopWindow != null) {
+ AccessibilityNode an = getTopWindowNode(xTopWindow);
+ if (an != null) {
+ add(an);
+ // Calling oneway methods from an UNO thread may cause
+ // deadlocks, so adding the listeners here.
+ an.setAttached(true);
+ }
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ // This should never happen since we properly check the count
+ // before - anyway returning what we got so far.
+ }
+ }
+
+ /** Returns an AccessibilityNode if xAccessible has a valid toplevel */
+ private AccessibilityNode getTopWindowNode(XAccessible xAccessible) {
+ XAccessibleContext xAC = xAccessible.getAccessibleContext();
+ if (xAC != null) {
+ short role = xAC.getAccessibleRole();
+ if ((role == AccessibleRole.FRAME) || (role == AccessibleRole.DIALOG) || (role == AccessibleRole.WINDOW)) {
+ return treeModel.createWindowNode(xAccessible, xAC);
+ }
+ }
+ return null;
+ }
+
+ /** Returns an AccessibilityNode if xAccessible has a valid toplevel */
+ private AccessibilityNode getTopWindowNode(XAccessible xAccessible, XAccessibleContext xAC) {
+ if (xAC != null) {
+ short role = xAC.getAccessibleRole();
+ if ((role == AccessibleRole.FRAME) || (role == AccessibleRole.DIALOG) || (role == AccessibleRole.WINDOW)) {
+ AccessibilityNode parent = treeModel.createWindowNode(xAccessible, xAC);
+ if (parent != null) {
+ try {
+ int n = xAC.getAccessibleChildCount();
+ for (int i=0; i<n; i++) {
+ AccessibilityNode child = treeModel.createNode(xAC.getAccessibleChild(i));
+ if (child != null) {
+ parent.add(child);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+
+ }
+ }
+ return parent;
+ }
+ }
+ return null;
+ }
+
+ /** Returns the XAccessible interface corresponding to the toplevel window */
+ private AccessibilityNode getTopWindowNode(XTopWindow w) {
+ XAccessible xAccessible = (XAccessible)
+ UnoRuntime.queryInterface(XAccessible.class, w);
+ if (xAccessible != null) {
+ // XTopWindows usually have an accessible parent, which is the
+ // native container window ..
+ XAccessibleContext xAC = xAccessible.getAccessibleContext();
+ if (xAC != null) {
+ XAccessible xParent = xAC.getAccessibleParent();
+ if (xParent != null) {
+ AccessibilityNode parent = getTopWindowNode(xParent);
+ AccessibilityNode child = treeModel.createNode(xAccessible);
+ if (parent != null && child != null) {
+ parent.add(child);
+ }
+ return parent;
+ } else {
+ return getTopWindowNode(xAccessible, xAC);
+ }
+ }
+ }
+ return null;
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ // FIXME : message
+ // prevent setRoot from removing this as event listener
+ xToolkit = null;
+ treeModel.setRoot(treeModel.disconnectedRootNode);
+ }
+
+ public void windowActivated(com.sun.star.lang.EventObject eventObject) {
+ }
+
+ public void windowClosed(com.sun.star.lang.EventObject eventObject) {
+ XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(
+ XAccessible.class, eventObject.Source);
+ if (xAccessible != null) {
+ AccessibilityNode node = treeModel.findNode(xAccessible);
+
+ // The object implementing XTopWindow is often not the toplevel
+ // accessible object.
+ if (node != null && node.getParent() != this) {
+ node = (AccessibilityNode) node.getParent();
+ }
+
+ if (node != null) {
+ final AccessibilityNode an = node;
+ Runnable removeRun = new Runnable() {
+ public void run() {
+ try {
+ treeModel.removeNodeFromParent(an);
+ // Calling oneway methods from an UNO thread may cause
+ // deadlocks, so removing the listeners here.
+ an.setAttached(false);
+ } catch (IllegalArgumentException e) {
+ // for some toplevel we get more than one event -
+ // ignoring
+ }
+ }
+ };
+ SwingUtilities.invokeLater(removeRun);
+ }
+ }
+ }
+
+ public void windowClosing(com.sun.star.lang.EventObject eventObject) {
+ }
+
+ public void windowDeactivated(com.sun.star.lang.EventObject eventObject) {
+ }
+
+ public void windowMinimized(com.sun.star.lang.EventObject eventObject) {
+ }
+
+ public void windowNormalized(com.sun.star.lang.EventObject eventObject) {
+ }
+
+ public void windowOpened(com.sun.star.lang.EventObject eventObject) {
+ final XTopWindow xTopWindow = (XTopWindow) UnoRuntime.queryInterface(
+ XTopWindow.class, eventObject.Source);
+ if (xTopWindow != null) {
+ final ToolkitNode tn = this;
+ Runnable addNodeRun = new Runnable() {
+ public void run() {
+ // Note: UNO does not allow to make synchronous callbacks
+ // to oneway calls, so we have to fetch the node here.
+ AccessibilityNode an = getTopWindowNode(xTopWindow);
+ if (an != null) {
+ treeModel.addNodeInto(an, tn);
+ // Calling oneway methods from an UNO thread may cause
+ // deadlocks, so adding the listeners here.
+ an.setAttached(true);
+ }
+ }
+ };
+ SwingUtilities.invokeLater(addNodeRun);
+ }
+ }
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common
new file mode 100644
index 000000000000..7a0813b099db
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common
@@ -0,0 +1,66 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.common,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar
+JAVAFILES = \
+ AccessibilityModel.java \
+ AccessibilityNode.java \
+ AccessibilityTree.java \
+ DynamicAccessibilityModel.java \
+ DynamicAccessibilityNode.java \
+ ToolkitNode.java
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk
new file mode 100644
index 000000000000..7867cf1cc672
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJNAME = awb
+PRJ = ..$/..$/..$/..$/..$/..
+TARGET = java_tree
+PACKAGE = org$/openoffice$/accessibility$/awb$/tree
+
+USE_JAVAVER:=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(JAVAVER:s/.//)" >= "140"
+
+.INCLUDE : makefile.common
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java
new file mode 100644
index 000000000000..7d3da7c0ac16
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * $RCSfile: ComponentView.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.Color;
+import java.awt.Dimension;
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+import javax.swing.JLabel;
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.uno.UnoRuntime;
+
+import org.openoffice.accessibility.misc.NameProvider;
+
+/** The <type>ContextView</type> class displays information accessible over
+ the <type>XAccessibleContext</type> interface. This includes name,
+ description, and role.
+*/
+public class ComponentView
+ extends ObjectView
+{
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ if (UnoRuntime.queryInterface(
+ XAccessibleComponent.class, xContext) != null)
+ return new ComponentView (aContainer);
+ else
+ return null;
+ }
+
+ public ComponentView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ ViewGridLayout aLayout = new ViewGridLayout (this);
+
+ maRelativeLocationLabel = aLayout.AddLabeledEntry ("Relative Location: ");
+ maAbsoluteLocationLabel = aLayout.AddLabeledEntry ("Location on Screen: ");
+ maSizeLabel = aLayout.AddLabeledEntry ("Size");
+ maBoundingBoxLabel = aLayout.AddLabeledEntry ("Bounding Box: ");
+ maConsistencyLabel = aLayout.AddLabeledEntry ("Consistent: ");
+ maForegroundColorLabel = aLayout.AddLabeledEntry ("Foreground Color: ");
+ maBackgroundColorLabel = aLayout.AddLabeledEntry ("Background Color: ");
+ }
+
+
+ public void SetObject (XAccessibleContext xContext)
+ {
+ mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface(
+ XAccessibleComponent.class, xContext);
+ super.SetObject (xContext);
+ }
+
+ public void Update ()
+ {
+ if (mxContext == null)
+ {
+ maRelativeLocationLabel.setText ("<null object>");
+ maAbsoluteLocationLabel.setText ("<null object>");
+ maSizeLabel.setText ("<null object>");
+ maBoundingBoxLabel.setText ("<null object>");
+ maConsistencyLabel.setText ("<null object>");
+ maForegroundColorLabel.setText ("<null object>");
+ maBackgroundColorLabel.setText ("<null object>");
+ }
+ else
+ {
+ com.sun.star.awt.Point aLocation = mxComponent.getLocation();
+ maRelativeLocationLabel.setText (
+ aLocation.X + ", " + aLocation.Y);
+ com.sun.star.awt.Point aLocationOnScreen =
+ mxComponent.getLocationOnScreen();
+ maAbsoluteLocationLabel.setText (
+ aLocationOnScreen.X + ", " + aLocationOnScreen.Y);
+ com.sun.star.awt.Size aSize = mxComponent.getSize();
+ maSizeLabel.setText (
+ aSize.Width + ", " + aSize.Height);
+ com.sun.star.awt.Rectangle aBBox = mxComponent.getBounds();
+ maBoundingBoxLabel.setText (
+ aBBox.X + ", " + aBBox.Y + ","
+ + aBBox.Width + ", " + aBBox.Height);
+ int nColor = mxComponent.getForeground();
+ maForegroundColorLabel.setText (
+ "R"+ (nColor>>16&0xff)
+ + "G" + (nColor>>8&0xff)
+ + "B" + (nColor>>0&0xff)
+ + "A" + (nColor>>24&0xff));
+ nColor = mxComponent.getBackground();
+ maBackgroundColorLabel.setText (
+ "R"+ (nColor>>16&0xff)
+ + "G" + (nColor>>8&0xff)
+ + "B" + (nColor>>0&0xff)
+ + "A" + (nColor>>24&0xff));
+
+ // Check consistency of coordinates.
+ String sConsistency = new String ();
+ if (aBBox.X!=aLocation.X || aBBox.Y!=aLocation.Y)
+ sConsistency += (sConsistency.length()!=0?", ":"") +
+ "Bounding box conflicts with relative location";
+ if (aBBox.Width!=aSize.Width || aBBox.Height!=aSize.Height)
+ sConsistency += (sConsistency.length()!=0?", ":"") +
+ "Bounding box conflicts with size";
+ XAccessible xParent = mxContext.getAccessibleParent();
+ XAccessibleComponent xParentComponent =
+ (XAccessibleComponent)UnoRuntime.queryInterface(
+ XAccessibleComponent.class, xParent);
+ if (xParentComponent == null)
+ {
+ if (aLocation.X != aLocationOnScreen.X
+ || aLocation.Y != aLocationOnScreen.Y)
+ sConsistency += (sConsistency.length()!=0?", ":"") +
+ "location on screen does not equal "
+ + "relative location without parent";
+ }
+ else
+ {
+ com.sun.star.awt.Point aParentLocationOnScreen =
+ xParentComponent.getLocationOnScreen();
+ if (aLocation.X+aParentLocationOnScreen.X
+ != aLocationOnScreen.X
+ || aLocation.Y+aParentLocationOnScreen.Y
+ != aLocationOnScreen.Y)
+ sConsistency += (sConsistency.length()!=0?", ":"") +
+ "location on screen does not match "
+ + "relative location";
+ }
+ if (sConsistency.length() == 0)
+ sConsistency += "yes";
+ else
+ maConsistencyLabel.setBackground (GetContainer().GetErrorColor());
+ maConsistencyLabel.setText (sConsistency);
+ }
+ }
+
+ public String GetTitle ()
+ {
+ return ("Component");
+ }
+
+ /** Listen for changes regarding displayed values.
+ */
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId.BOUNDRECT_CHANGED :
+ case AccessibleEventId.VISIBLE_DATA_CHANGED :
+ Update ();
+ }
+ }
+
+ private XAccessibleComponent mxComponent;
+ private JLabel
+ maRelativeLocationLabel,
+ maAbsoluteLocationLabel,
+ maSizeLabel,
+ maBoundingBoxLabel,
+ maConsistencyLabel,
+ maForegroundColorLabel,
+ maBackgroundColorLabel;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java
new file mode 100644
index 000000000000..16d51b6edd97
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * $RCSfile: ContextView.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.Color;
+import java.awt.Dimension;
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessibleContext;
+
+import org.openoffice.accessibility.misc.NameProvider;
+
+/** The <type>ContextView</type> class displays information accessible over
+ the <type>XAccessibleContext</type> interface. This includes name,
+ description, and role.
+*/
+public class ContextView
+ extends ObjectView
+ implements ActionListener
+{
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ if (xContext != null)
+ return new ContextView (aContainer);
+ else
+ return null;
+ }
+
+ public ContextView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ ViewGridLayout aLayout = new ViewGridLayout (this);
+ maNameLabel = aLayout.AddLabeledString ("Name:");
+ maDescriptionLabel = aLayout.AddLabeledString ("Description:");
+ maRoleLabel = aLayout.AddLabeledEntry ("Role:");
+ }
+
+ public void Update ()
+ {
+ if (mxContext == null)
+ {
+ maNameLabel.setText ("<null object>");
+ maDescriptionLabel.setText ("<null object>");
+ maRoleLabel.setText ("<null object>");
+ }
+ else
+ {
+ maNameLabel.setText (mxContext.getAccessibleName());
+ maDescriptionLabel.setText (mxContext.getAccessibleDescription());
+ maRoleLabel.setText (NameProvider.getRoleName (mxContext.getAccessibleRole()));
+ }
+ }
+
+ public String GetTitle ()
+ {
+ return ("Context");
+ }
+
+ /** Listen for changes regarding displayed values.
+ */
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId.NAME_CHANGED :
+ case AccessibleEventId.DESCRIPTION_CHANGED :
+ Update ();
+ }
+ }
+
+ public void actionPerformed (ActionEvent aEvent)
+ {
+ }
+
+
+ private JLabel
+ maNameLabel,
+ maDescriptionLabel,
+ maRoleLabel;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java
new file mode 100644
index 000000000000..b60404f22efd
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * $RCSfile: EditableTextView.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:33 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import javax.swing.JButton;
+
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEditableText;
+import com.sun.star.uno.UnoRuntime;
+
+import org.openoffice.accessibility.awb.view.text.TextDialogFactory;
+
+
+public class EditableTextView
+ extends ObjectView
+ implements ActionListener
+{
+ /** Create a EditableTextView when the given object supports the
+ XAccessibleEditableText interface.
+ */
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ XAccessibleEditableText xEditableText =
+ (XAccessibleEditableText)UnoRuntime.queryInterface(
+ XAccessibleEditableText.class, xContext);
+ if (xEditableText != null)
+ return new EditableTextView (aContainer);
+ else
+ return null;
+ }
+
+ public EditableTextView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ JButton aButton = new JButton ("cut...");
+ aButton.setFont (ViewGridLayout.GetFont());
+ aButton.addActionListener (this);
+ add (aButton);
+ aButton = new JButton ("paste...");
+ aButton.setFont (ViewGridLayout.GetFont());
+ aButton.addActionListener (this);
+ add (aButton);
+ aButton = new JButton ("edit...");
+ aButton.setFont (ViewGridLayout.GetFont());
+ aButton.addActionListener (this);
+ add (aButton);
+ aButton = new JButton ("format...");
+ aButton.setFont (ViewGridLayout.GetFont());
+ aButton.addActionListener (this);
+ add (aButton);
+ }
+
+
+ /** Additionally to the context store a reference to the
+ XAccessibleEditableText interface.
+ */
+ public void SetObject (XAccessibleContext xObject)
+ {
+ mxEditableText = (XAccessibleEditableText)UnoRuntime.queryInterface(
+ XAccessibleEditableText.class, xObject);
+ super.SetObject (xObject);
+ }
+
+ public String GetTitle ()
+ {
+ return ("Editable Text");
+ }
+
+ synchronized public void Destroy ()
+ {
+ mxEditableText = null;
+ super.Destroy();
+ }
+
+ public void actionPerformed (ActionEvent aEvent)
+ {
+ String sCommand = aEvent.getActionCommand();
+ if (sCommand.equals ("cut..."))
+ TextDialogFactory.CreateCutDialog (mxContext);
+ else if (sCommand.equals ("past..."))
+ TextDialogFactory.CreatePasteDialog (mxContext);
+ else if (sCommand.equals ("edit..."))
+ TextDialogFactory.CreateEditDialog (mxContext);
+ else if (sCommand.equals ("format..."))
+ TextDialogFactory.CreateFormatDialog (mxContext);
+ }
+
+ private XAccessibleEditableText mxEditableText;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java
new file mode 100644
index 000000000000..e01f665b5e22
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * $RCSfile: EventMonitorView.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:33 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.BorderLayout;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessibleContext;
+
+import org.openoffice.accessibility.misc.NameProvider;
+
+
+/** A simple event monitor that shows all events sent to one accessible
+ object.
+*/
+class EventMonitorView
+ extends ObjectView
+{
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ if (xContext != null)
+ return new EventMonitorView (aContainer);
+ else
+ return null;
+ }
+
+ public EventMonitorView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+ Layout();
+ }
+
+ public String GetTitle ()
+ {
+ return "Event Monitor";
+ }
+
+ /** Create and arrange the widgets for this view.
+ */
+ private void Layout ()
+ {
+ setLayout (new GridBagLayout ());
+
+ maText = new JTextArea();
+ maText.setBackground (new Color (255,250,240));
+ maText.setFont (new Font ("Helvetica", Font.PLAIN, 9));
+
+ maScrollPane = new JScrollPane (maText,
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ maScrollPane.setPreferredSize (new Dimension (300,80));
+
+ GridBagConstraints aConstraints = new GridBagConstraints ();
+ aConstraints.weightx = 1;
+ aConstraints.fill = GridBagConstraints.HORIZONTAL;
+ add (maScrollPane, aConstraints);
+ }
+
+
+ public void Update ()
+ {
+ }
+
+
+ private void UpdateVerticalScrollBar ()
+ {
+ JScrollBar sb = maScrollPane.getVerticalScrollBar();
+ if (sb != null)
+ {
+ int nScrollBarValue = sb.getMaximum() - sb.getVisibleAmount() - 1;
+ sb.setValue (nScrollBarValue);
+ }
+ }
+
+
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ maText.append (NameProvider.getEventName (aEvent.EventId) + " : "
+ + aEvent.OldValue.toString()
+ + " -> "
+ + aEvent.NewValue.toString() + "\n");
+ UpdateVerticalScrollBar();
+ }
+
+ private JTextArea maText;
+ private JScrollPane maScrollPane;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java
new file mode 100644
index 000000000000..6f3f850aeb14
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * $RCSfile: FocusView.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.uno.UnoRuntime;
+
+public class FocusView
+ extends ObjectView
+ implements ActionListener
+{
+ /** Create a FocusView when the given object supports the
+ XAccessibleComponent interface.
+ */
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ XAccessibleComponent xComponent = (XAccessibleComponent)UnoRuntime.queryInterface(
+ XAccessibleComponent.class, xContext);
+ if (xComponent != null)
+ return new FocusView (aContainer);
+ else
+ return null;
+ }
+
+ public FocusView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ setLayout (new GridBagLayout());
+ GridBagConstraints aConstraints = new GridBagConstraints ();
+
+ maFocused = new JLabel ();
+ maFocused.setFont (GetContainer().GetViewFont());
+ aConstraints.gridy = 0;
+ aConstraints.weightx = 1;
+ aConstraints.fill = GridBagConstraints.HORIZONTAL;
+ add (maFocused, aConstraints);
+
+ maGrabFocus = new JButton ("grabFocus");
+ maGrabFocus.setFont (GetContainer().GetViewFont());
+ aConstraints.gridy = 1;
+ aConstraints.fill = GridBagConstraints.NONE;
+ aConstraints.anchor = GridBagConstraints.WEST;
+ add (maGrabFocus, aConstraints);
+
+ maGrabFocus.addActionListener (this);
+ }
+
+ /** Additionally to the context store a reference to the
+ XAccessibleComponent interface.
+ */
+ public void SetObject (XAccessibleContext xObject)
+ {
+ mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface(
+ XAccessibleComponent.class, xObject);
+ super.SetObject (xObject);
+ }
+
+ synchronized public void Destroy ()
+ {
+ super.Destroy();
+ maGrabFocus.removeActionListener (this);
+ }
+
+ synchronized public void Update ()
+ {
+ if (mxContext == null)
+ {
+ maFocused.setText ("<null object>");
+ maGrabFocus.setEnabled (false);
+ }
+ else
+ {
+ XAccessibleStateSet aStateSet = mxContext.getAccessibleStateSet();
+ if (aStateSet.contains(AccessibleStateType.FOCUSED))
+ maFocused.setText ("focused");
+ else
+ maFocused.setText ("not focused");
+ if (maGrabFocus != null)
+ maGrabFocus.setEnabled (true);
+ }
+ }
+
+ public String GetTitle ()
+ {
+ return ("Focus");
+ }
+
+ synchronized public void actionPerformed (ActionEvent aEvent)
+ {
+ if (aEvent.getActionCommand().equals("grabFocus"))
+ {
+ mxComponent.grabFocus();
+ }
+ }
+
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ System.out.println (aEvent);
+ if (aEvent.EventId == AccessibleEventId.STATE_CHANGED)
+ Update ();
+ }
+
+ private JLabel maFocused;
+ private JButton maGrabFocus;
+ private XAccessibleComponent mxComponent;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java b/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java
new file mode 100644
index 000000000000..590d17c94954
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * $RCSfile: LayoutManager.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:34 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.Point;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.event.MouseEvent;
+import javax.swing.JComponent;
+
+class LayoutManager
+ implements MouseListener,
+ MouseMotionListener
+{
+ public LayoutManager (JComponent aLayoutedComponent)
+ {
+ maLayoutedComponent = aLayoutedComponent;
+ maDraggedView = null;
+ mbInsertionPending = false;
+ }
+
+ public void mouseClicked (MouseEvent aEvent)
+ {
+ System.out.println (aEvent);
+ }
+ public void mousePressed (MouseEvent aEvent)
+ {
+ mnOldY = aEvent.getPoint().y;
+ }
+ public void mouseReleased (MouseEvent aEvent)
+ {
+ if (mbInsertionPending)
+ {
+ InsertView (maDraggedView, aEvent.getPoint().y);
+ mbInsertionPending = false;
+ maDraggedView = null;
+ }
+ }
+ public void mouseEntered (MouseEvent aEvent)
+ {
+ }
+ public void mouseExited (MouseEvent aEvent)
+ {
+ if (mbInsertionPending)
+ {
+ InsertView (maDraggedView, mnOldY);
+ mbInsertionPending = false;
+ maDraggedView = null;
+ }
+ }
+ public void mouseDragged (MouseEvent aEvent)
+ {
+ int dy = mnOldY - aEvent.getPoint().y;
+ GridBagLayout aLayout = (GridBagLayout)maLayoutedComponent.getLayout();
+ if ( ! mbInsertionPending && dy != 0)
+ {
+ maDraggedView = RemoveView (mnOldY);
+ if (maDraggedView != null)
+ mbInsertionPending = true;
+ }
+ }
+ public void mouseMoved (MouseEvent aEvent)
+ {
+ }
+
+
+
+
+ private ObjectView RemoveView (int y)
+ {
+ ObjectView aView = null;
+ GridBagLayout aLayout = (GridBagLayout)maLayoutedComponent.getLayout();
+
+ Point aGridLocation = aLayout.location (10,y);
+ Component[] aComponentList = maLayoutedComponent.getComponents();
+ System.out.println ("removing view at " + aGridLocation);
+ for (int i=0; i<aComponentList.length && aView==null; i++)
+ {
+ GridBagConstraints aConstraints = aLayout.getConstraints (
+ aComponentList[i]);
+ if (aConstraints.gridy == aGridLocation.y)
+ aView = (ObjectView)aComponentList[i];
+ }
+ maNormalCursor = maLayoutedComponent.getCursor();
+ if (aView != null)
+ {
+ System.out.println ("removing view at " + aGridLocation.y);
+ maLayoutedComponent.setCursor (new Cursor (Cursor.MOVE_CURSOR));
+ maLayoutedComponent.remove (aView);
+ maLayoutedComponent.validate();
+ maLayoutedComponent.repaint();
+ }
+
+ return aView;
+ }
+
+ private void InsertView (ObjectView aView, int y)
+ {
+ if (aView != null)
+ {
+ GridBagLayout aLayout = (GridBagLayout)maLayoutedComponent.getLayout();
+ Point aGridLocation = aLayout.location (0,y);
+ Component[] aComponentList = maLayoutedComponent.getComponents();
+ System.out.println ("new position is " + aGridLocation.y);
+ for (int i=0; i<aComponentList.length; i++)
+ {
+ GridBagConstraints aConstraints = aLayout.getConstraints (
+ aComponentList[i]);
+ if (aConstraints.gridy >= aGridLocation.y)
+ {
+ if (aConstraints.gridy == aGridLocation.y)
+ maLayoutedComponent.add (maDraggedView, aConstraints);
+ aConstraints.gridy += 1;
+ aLayout.setConstraints (aComponentList[i], aConstraints);
+ }
+ }
+ maLayoutedComponent.validate();
+ maLayoutedComponent.repaint();
+ }
+ maLayoutedComponent.setCursor (maNormalCursor);
+ }
+
+
+
+
+ private JComponent maLayoutedComponent;
+ private ObjectView maDraggedView;
+ private int mnOldY;
+ private boolean mbInsertionPending;
+ private Cursor maNormalCursor;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/view/Makefile
new file mode 100644
index 000000000000..2e4eb1566afd
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/Makefile
@@ -0,0 +1,13 @@
+# $Id: Makefile,v 1.1 2003/06/13 16:30:34 af Exp $
+
+all : package
+
+ROOT=../../../../..
+PACKAGE = org.openoffice.accessibility.awb.view
+SUBDIRS = text
+include makefile.common
+
+include $(ROOT)/makefile.in
+
+
+package : $(CLASS_FILES)
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java
new file mode 100644
index 000000000000..3c1b8e90ff26
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectView.java
@@ -0,0 +1,90 @@
+package org.openoffice.accessibility.awb.view;
+
+import javax.swing.JPanel;
+
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessibleContext;
+
+/** This is the base class for all object views that can be placed inside an
+ object view container.
+
+ <p>When provided with a new accessible object the container will call
+ the Create method to create a new instance when certain conditions are
+ met. It then calls SetObject to pass the object to the instance.
+ Finally it calls Update.</p>
+
+ <p>The SetObject and Update methods may be called for a new object
+ without calling Create first. In this way an existing instance is
+ recycled.</p>
+*/
+abstract public class ObjectView
+ extends JPanel
+{
+ /** This factory method creates a new instance of the (derived) class
+ when the given accessible object supports all necessary features.
+ In the ususal case this will be the support of a specific
+ accessibility interface.
+ */
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ return null;
+ }
+
+ public ObjectView (ObjectViewContainer aContainer)
+ {
+ maContainer = aContainer;
+ mxContext = null;
+ }
+
+ /** Call this when you want the object to be destroyed. Release all
+ resources when called.
+ */
+ public void Destroy ()
+ {
+ }
+
+ /** Tell the view to display information for a new accessible object.
+ @param xObject
+ The given object may be null. A typical behaviour in this case
+ would be to display a blank area. But is also possible to show
+ information about the last object.
+ */
+ public void SetObject (XAccessibleContext xContext)
+ {
+ mxContext = xContext;
+ Update ();
+ }
+
+
+ /** This is a request of a repaint with the current state of the current
+ object. The current object may or may not be the same as the one
+ when Update() was called the last time.
+ */
+ public void Update ()
+ {
+ }
+
+
+ /** Return a string that is used as a title of an enclosing frame.
+ */
+ abstract public String GetTitle ();
+
+
+ public ObjectViewContainer GetContainer ()
+ {
+ return maContainer;
+ }
+
+
+ /** Implement this method if you are interested in accessible events.
+ */
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {}
+
+ /// Reference to the current object to display information about.
+ protected XAccessibleContext mxContext;
+
+ protected ObjectViewContainer maContainer;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java
new file mode 100644
index 000000000000..e5eeec95b41a
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java
@@ -0,0 +1,344 @@
+/*************************************************************************
+ *
+ * $RCSfile: ObjectViewContainer.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obr $ $Date: 2003/09/19 09:21:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.Insets;
+
+import java.util.Vector;
+
+import java.lang.reflect.Method;
+import java.lang.NoSuchMethodException;
+import java.lang.IllegalAccessException;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JPanel;
+import javax.swing.JTree;
+import javax.swing.BorderFactory;
+import javax.swing.border.Border;
+import javax.swing.border.BevelBorder;
+import javax.swing.SwingUtilities;
+
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleEventBroadcaster;
+import com.sun.star.accessibility.XAccessibleEventListener;
+import com.sun.star.accessibility.XAccessibleSelection;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.UnoRuntime;
+
+import org.openoffice.accessibility.awb.view.ObjectView;
+
+
+
+/** This container of specialized object views displays information about
+ one accessible object.
+ In this it plays several roles:
+ 1. Object container.
+ 2. Accessibility event dispatcher.
+ 3. Object view class registration manager.
+ 4. Swing widget.
+*/
+public class ObjectViewContainer
+ extends JPanel
+ implements XAccessibleEventListener
+{
+ public ObjectViewContainer ()
+ {
+ maFont = new Font ("Dialog", Font.PLAIN, 11);
+ maViewTemplates = new Vector ();
+ maViewBorder = BorderFactory.createBevelBorder (BevelBorder.RAISED);
+ GridBagLayout aLayout = new GridBagLayout ();
+ setLayout (aLayout);
+ // maLayoutManager = new LayoutManager (this);
+ maLayoutManager = null;
+
+ RegisterView (ContextView.class);
+ RegisterView (ComponentView.class);
+ RegisterView (ParentView.class);
+ RegisterView (StateSetView.class);
+ RegisterView (FocusView.class);
+ RegisterView (TextView.class);
+ RegisterView (EditableTextView.class);
+ RegisterView (TableView.class);
+ RegisterView (SelectionView.class);
+ RegisterView (ServiceInterfaceView.class);
+ RegisterView (EventMonitorView.class);
+
+ mxContext = null;
+
+ // addMouseListener (maLayoutManager);
+ // addMouseMotionListener (maLayoutManager);
+ }
+
+
+
+ /** Remove all existing views and create new ones according to the
+ interfaces supported by the given object.
+ */
+ public synchronized void SetObject (XAccessibleContext xContext)
+ {
+ // Call Destroy at all views to give them a chance to release their
+ // resources.
+ int n = getComponentCount();
+ for (int i=0; i<n; i++)
+ ((ObjectView)getComponent(i)).Destroy();
+ // Remove existing views.
+ removeAll ();
+
+ mxContext = xContext;
+
+ // Add new views.
+ for (int i=0; i<maViewTemplates.size(); i++)
+ {
+ try
+ {
+ Class aViewClass = (Class)maViewTemplates.elementAt (i);
+ Method aCreateMethod = aViewClass.getDeclaredMethod (
+ "Create", new Class[] {
+ ObjectViewContainer.class,
+ XAccessibleContext.class});
+ if (aCreateMethod != null)
+ {
+ ObjectView aView = (ObjectView)
+ aCreateMethod.invoke (
+ null, new Object[] {this, xContext});
+ Add (aView);
+ }
+ }
+ catch (NoSuchMethodException e)
+ {System.err.println ("Caught exception while creating view "
+ + i + " : " + e);}
+ catch (IllegalAccessException e)
+ {System.err.println ("Caught exception while creating view "
+ + i + " : " + e);}
+ catch (InvocationTargetException e)
+ {System.err.println ("Caught exception while creating view "
+ + i + " : " + e);}
+ }
+
+ UpdateLayoutManager ();
+
+ // Now set the object at all views.
+ n = getComponentCount();
+ for (int i=0; i<n; i++)
+ ((ObjectView)getComponent(i)).SetObject (xContext);
+
+ setPreferredSize (getLayout().preferredLayoutSize (this));
+ ((GridBagLayout) getLayout()).invalidateLayout(this);
+ validate();
+ }
+
+
+
+
+ /** Add the given class to the list of classes which will be
+ instantiated the next time an accessible object is set.
+ */
+ public void RegisterView (Class aObjectViewClass)
+ {
+ maViewTemplates.addElement (aObjectViewClass);
+ }
+
+
+
+
+ /** Replace one view class with another.
+ */
+ public void ReplaceView (Class aObjectViewClass, Class aSubstitution)
+ {
+ int nIndex = maViewTemplates.indexOf (aObjectViewClass);
+ if (nIndex >= 0)
+ maViewTemplates.setElementAt (aSubstitution, nIndex);
+ }
+
+
+ /** Return a font that should be used for widgets in the views.
+ */
+ public Font GetViewFont ()
+ {
+ return maFont;
+ }
+
+ public Color GetErrorColor ()
+ {
+ return new Color (255,80,50);
+ }
+
+ /** Add an object view and place it below all previously added views.
+ @param aView
+ This argument may be null. In this case nothing happens.
+ */
+ private void Add (ObjectView aView)
+ {
+ if (aView != null)
+ {
+ GridBagConstraints constraints = new GridBagConstraints ();
+ constraints.gridx = 0;
+ constraints.gridy = getComponentCount();
+ constraints.gridwidth = 1;
+ constraints.gridheight = 1;
+ constraints.weightx = 1;
+ constraints.weighty = 0;
+ constraints.ipadx = 2;
+ constraints.ipady = 5;
+ constraints.insets = new Insets (5,5,5,5);
+ constraints.anchor = GridBagConstraints.NORTH;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+
+ aView.setBorder (
+ BorderFactory.createTitledBorder (
+ maViewBorder, aView.GetTitle()));
+
+ add (aView, constraints);
+ }
+ }
+
+ /** Update the layout manager by setting the vertical weight of the
+ bottom entry to 1 and so make it strech to over the available
+ space.
+
+ */
+ private void UpdateLayoutManager ()
+ {
+ // Adapt the layout manager.
+ if (getComponentCount() > 1000)
+ {
+ Component aComponent = getComponent (getComponentCount()-1);
+ GridBagLayout aLayout = (GridBagLayout)getLayout();
+ GridBagConstraints aConstraints = aLayout.getConstraints (aComponent);
+ aConstraints.weighty = 1;
+ aLayout.setConstraints (aComponent, aConstraints);
+ }
+ }
+
+
+
+
+ /** Put the event just received into the event queue which will deliver
+ it soon asynchronuously to the DispatchEvent method.
+ */
+ public void notifyEvent (final AccessibleEventObject aEvent)
+ {
+ SwingUtilities.invokeLater(
+ new Runnable()
+ {
+ public void run()
+ {
+ DispatchEvent (aEvent);
+ }
+ }
+ );
+ }
+
+
+
+
+ /** Forward accessibility events to all views without them being
+ registered as event listeners each on their own.
+ */
+ private void DispatchEvent (AccessibleEventObject aEvent)
+ {
+ int n = getComponentCount();
+ for (int i=0; i<n; i++)
+ ((ObjectView)getComponent(i)).notifyEvent (aEvent);
+ }
+
+
+
+ /** When the object is disposed that is displayed by the views of this
+ container then tell all views about this.
+ */
+ public void disposing (EventObject aEvent)
+ {
+ mxContext = null;
+ SwingUtilities.invokeLater(
+ new Runnable()
+ {
+ public void run()
+ {
+ SetObject (null);
+ }
+ }
+ );
+ }
+
+
+
+
+ /// The current accessible context display by the views.
+ private XAccessibleContext mxContext;
+
+ /// Observe this tree for selection changes and notify them to all
+ /// children.
+ private JTree maTree;
+ private Border maViewBorder;
+ /// List of view templates which are instantiated when new object is set.
+ private Vector maViewTemplates;
+ private Font maFont;
+ private LayoutManager maLayoutManager;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainerWindow.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainerWindow.java
new file mode 100644
index 000000000000..8db9af4f46ca
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainerWindow.java
@@ -0,0 +1,35 @@
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.BorderLayout;
+import javax.swing.JFrame;
+import com.sun.star.accessibility.XAccessibleContext;
+
+
+/** Top level window that creates a single object view container. This
+ container shows information about a specific accessible object and is
+ not affected by the selection of the accessbility tree widget.
+*/
+public class ObjectViewContainerWindow
+ extends JFrame
+{
+ public ObjectViewContainerWindow (XAccessibleContext xContext)
+ {
+ setSize (new java.awt.Dimension (300,600));
+
+ maContainer = new ObjectViewContainer ();
+ maContainer.SetObject (xContext);
+ getContentPane().add (maContainer, BorderLayout.CENTER);
+
+ pack ();
+ setVisible (true);
+ }
+
+ /** Set the object that is displayed in this window.
+ */
+ public void SetObject (XAccessibleContext xContext)
+ {
+ maContainer.SetObject (xContext);
+ }
+
+ private ObjectViewContainer maContainer;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java
new file mode 100644
index 000000000000..a6fb52a40ecb
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * $RCSfile: ParentView.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.lang.Integer;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+import org.openoffice.accessibility.misc.NameProvider;
+
+
+/** Show informations related to the parent/child relationship.
+*/
+public class ParentView
+ extends ObjectView
+{
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ if (xContext != null)
+ return new ParentView (aContainer);
+ else
+ return null;
+ }
+
+ public ParentView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ ViewGridLayout aLayout = new ViewGridLayout (this);
+ maParentLabel = aLayout.AddLabeledEntry ("Has parent: ");
+ maIndexLabel = aLayout.AddLabeledEntry ("Index in parent: ");
+ maValidLabel = aLayout.AddLabeledEntry ("Parent/Child relationship valid: ");
+ maChildrenLabel = aLayout.AddLabeledEntry ("Child count: ");
+ }
+
+ public void Update ()
+ {
+ if (mxContext == null)
+ {
+ maParentLabel.setText ("<null object>");
+ maIndexLabel.setText ("<null object>");
+ maValidLabel.setText ("<null object>");
+ maChildrenLabel.setText ("<null object>");
+ }
+ else
+ {
+ XAccessible xParent = mxContext.getAccessibleParent();
+ int nIndex = mxContext.getAccessibleIndexInParent();
+ maIndexLabel.setText (Integer.toString(nIndex));
+ if (xParent != null)
+ {
+ maParentLabel.setText ("yes");
+ XAccessibleContext xParentContext =
+ xParent.getAccessibleContext();
+ if (xParentContext != null)
+ {
+ try
+ {
+ XAccessible xChild =
+ xParentContext.getAccessibleChild(nIndex);
+ if (xChild != mxContext)
+ maValidLabel.setText ("yes");
+ else
+ {
+ maValidLabel.setText ("no");
+ maValidLabel.setBackground (GetContainer().GetErrorColor());
+ }
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ maValidLabel.setText ("no: invalid index in parent");
+ maValidLabel.setBackground (GetContainer().GetErrorColor());
+ }
+ }
+ else
+ {
+ maValidLabel.setText ("no: parent has no context");
+ maValidLabel.setBackground (GetContainer().GetErrorColor());
+ }
+ }
+ else
+ maParentLabel.setText ("no");
+ maChildrenLabel.setText (Integer.toString(mxContext.getAccessibleChildCount()));
+ }
+ }
+
+ public String GetTitle ()
+ {
+ return ("Parent");
+ }
+
+
+ /** Listen for changes regarding displayed values.
+ */
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ switch (aEvent.EventId)
+ {
+ default:
+ Update ();
+ }
+ }
+
+
+ private JLabel
+ maParentLabel,
+ maIndexLabel,
+ maValidLabel,
+ maChildrenLabel;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java
new file mode 100644
index 000000000000..5967e4ae1ad4
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java
@@ -0,0 +1,301 @@
+/*************************************************************************
+ *
+ * $RCSfile: SelectionView.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:36 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.util.Vector;
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JOptionPane;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JToggleButton;
+import javax.swing.ListSelectionModel;
+
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleSelection;
+import com.sun.star.accessibility.XAccessibleStateSet;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+
+/** Display a list of children and select/deselect buttons
+*/
+class SelectionView
+ extends ObjectView
+ implements ActionListener
+{
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ XAccessibleSelection xSelection = (XAccessibleSelection)UnoRuntime.queryInterface(
+ XAccessibleSelection.class, xContext);
+ if (xSelection != null)
+ return new SelectionView(aContainer);
+ else
+ return null;
+ }
+
+ public SelectionView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+ Layout();
+ }
+
+ public String GetTitle ()
+ {
+ return "Selection";
+ }
+
+ /** Create and arrange the widgets for this view.
+ */
+ private void Layout ()
+ {
+ setLayout (new GridBagLayout());
+
+ GridBagConstraints aConstraints = new GridBagConstraints();
+
+ // Label that shows whether the selection is multi selectable.
+ aConstraints.gridx = 0;
+ aConstraints.gridy = 0;
+ aConstraints.anchor = GridBagConstraints.WEST;
+ maTypeLabel = new JLabel ();
+ maTypeLabel.setFont (maContainer.GetViewFont());
+ add (maTypeLabel, aConstraints);
+
+ // the JListBox
+ maChildrenSelector = new JPanel ();
+ maChildrenSelector.setPreferredSize (new Dimension (100,100));
+ maChildrenSelector.setLayout (
+ new BoxLayout (maChildrenSelector, BoxLayout.Y_AXIS));
+
+ aConstraints.gridx = 0;
+ aConstraints.gridwidth = 4;
+ aConstraints.gridy = 1;
+ aConstraints.fill = GridBagConstraints.HORIZONTAL;
+ add (new JScrollPane (maChildrenSelector,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),
+ aConstraints);
+
+ JButton aButton;
+ aButton = new JButton( "Select all" );
+ aButton.setFont (maContainer.GetViewFont());
+ aButton.setActionCommand( "Select all" );
+ aButton.addActionListener( this );
+ aConstraints.gridx = 0;
+ aConstraints.gridwidth = 1;
+ aConstraints.gridy = 2;
+ aConstraints.fill = GridBagConstraints.NONE;
+ aConstraints.anchor = GridBagConstraints.WEST;
+ add (aButton, aConstraints);
+
+ aButton = new JButton( "Clear Selection" );
+ aButton.setFont (maContainer.GetViewFont());
+ aButton.setActionCommand( "Clear Selection" );
+ aButton.addActionListener( this );
+ aConstraints.gridx = 1;
+ aConstraints.gridy = 2;
+ aConstraints.weightx = 1;
+ add (aButton, aConstraints);
+
+ setSize (getPreferredSize());
+ }
+
+
+ public void SetObject (XAccessibleContext xContext)
+ {
+ mxSelection = (XAccessibleSelection)UnoRuntime.queryInterface(
+ XAccessibleSelection.class, xContext);
+ super.SetObject (xContext);
+ }
+
+
+ public void Update ()
+ {
+ maChildrenSelector.removeAll ();
+
+ // Determine whether multi selection is possible.
+ XAccessibleStateSet aStateSet = mxContext.getAccessibleStateSet();
+ boolean bMultiSelectable = false;
+ if (aStateSet!=null && aStateSet.contains(
+ AccessibleStateType.MULTI_SELECTABLE))
+ {
+ bMultiSelectable = true;
+ maTypeLabel.setText ("multi selectable");
+ }
+ else
+ {
+ maTypeLabel.setText ("single selectable");
+ }
+
+ if (mxContext.getAccessibleRole() != AccessibleRole.TABLE)
+ {
+ int nCount = mxContext.getAccessibleChildCount();
+ for (int i=0; i<nCount; i++)
+ {
+ try
+ {
+ XAccessible xChild = mxContext.getAccessibleChild(i);
+ XAccessibleContext xChildContext = xChild.getAccessibleContext();
+
+ String sName = i + " " + xChildContext.getAccessibleName();
+ JToggleButton aChild;
+ aChild = new JCheckBox (sName);
+ aChild.setFont (maContainer.GetViewFont());
+
+ XAccessibleStateSet aChildStateSet =
+ mxContext.getAccessibleStateSet();
+ aChild.setSelected (aChildStateSet!=null
+ && aChildStateSet.contains(AccessibleStateType.SELECTED));
+
+ aChild.addActionListener (this);
+ maChildrenSelector.add (aChild);
+
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ }
+ }
+ }
+ }
+
+
+ void SelectAll()
+ {
+ mxSelection.selectAllAccessibleChildren();
+ }
+
+ void ClearSelection()
+ {
+ mxSelection.clearAccessibleSelection();
+ }
+
+
+
+ /** Call the function associated with the pressed button.
+ */
+ public void actionPerformed (ActionEvent aEvent)
+ {
+ String sCommand = aEvent.getActionCommand();
+
+ if (sCommand.equals ("Clear Selection"))
+ ClearSelection();
+ else if (sCommand.equals ("Select all"))
+ SelectAll();
+ else
+ {
+ // Extract the child index from the widget text.
+ String[] aWords = sCommand.split (" ");
+ int nIndex = Integer.parseInt(aWords[0]);
+ try
+ {
+ if (((JToggleButton)aEvent.getSource()).isSelected())
+ mxSelection.selectAccessibleChild (nIndex);
+ else
+ mxSelection.deselectAccessibleChild (nIndex);
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ System.err.println (
+ "caught exception while changing selection: " + e);
+ }
+ }
+ }
+
+
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId.SELECTION_CHANGED:
+ case AccessibleEventId.STATE_CHANGED:
+ case AccessibleEventId.CHILD:
+ Update ();
+ }
+ }
+
+ private JPanel maChildrenSelector;
+ private XAccessibleSelection mxSelection;
+ private JLabel maTypeLabel;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ServiceInterfaceView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ServiceInterfaceView.java
new file mode 100644
index 000000000000..7c41ff01c97e
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ServiceInterfaceView.java
@@ -0,0 +1,150 @@
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.GridLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.lang.Integer;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+
+import org.openoffice.accessibility.misc.NameProvider;
+
+
+/** Show all supported services and interfaces.
+*/
+public class ServiceInterfaceView
+ extends ObjectView
+{
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ if (xContext != null)
+ return new ServiceInterfaceView (aContainer);
+ else
+ return null;
+ }
+
+
+
+
+ public ServiceInterfaceView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ maImplementationNameRoot = new DefaultMutableTreeNode ("Implementation Name");
+ maServiceRoot = new DefaultMutableTreeNode ("Supported Services");
+ maInterfaceRoot = new DefaultMutableTreeNode ("Supported Interfaces");
+ maTree = new JTree (new DefaultMutableTreeNode[]
+ {maServiceRoot,maInterfaceRoot});
+ JScrollPane aScrollPane = new JScrollPane (
+ maTree,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+
+ setMinimumSize (new Dimension(300,200));
+ setLayout (new GridLayout (1,1));
+ add (aScrollPane);
+ }
+
+
+
+
+ public void Update ()
+ {
+ DefaultTreeModel aModel = (DefaultTreeModel)maTree.getModel();
+
+ // Clear old tree.
+ DefaultMutableTreeNode aRoot =(DefaultMutableTreeNode)aModel.getRoot();
+ aRoot.removeAllChildren();
+
+ // Create the new tree.
+ CreateImplementationNameTree ();
+ CreateServiceTree ();
+ CreateInterfaceTree ();
+ aRoot.add (maImplementationNameRoot);
+ aRoot.add (maServiceRoot);
+ aRoot.add (maInterfaceRoot);
+ aModel.setRoot (aRoot);
+
+ // Expand whole tree.
+ for (int i=0; i<maTree.getRowCount(); i++)
+ maTree.expandRow (i);
+ }
+
+ private void CreateImplementationNameTree ()
+ {
+ XServiceInfo xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface(
+ XServiceInfo.class, mxContext);
+ maImplementationNameRoot.removeAllChildren();
+ if (xServiceInfo != null)
+ {
+ maImplementationNameRoot.add (
+ new DefaultMutableTreeNode (
+ (xServiceInfo!=null
+ ? xServiceInfo.getImplementationName()
+ : "<XServiceInfo not supported>")));
+ }
+ }
+
+ private void CreateServiceTree ()
+ {
+ XServiceInfo xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface(
+ XServiceInfo.class, mxContext);
+ maServiceRoot.removeAllChildren();
+ if (xServiceInfo != null)
+ {
+ String[] aServiceNames = xServiceInfo.getSupportedServiceNames();
+ int nCount = aServiceNames.length;
+ for (int i=0; i<nCount; i++)
+ maServiceRoot.add (
+ new DefaultMutableTreeNode (aServiceNames[i]));
+ }
+ else
+ maServiceRoot.add (
+ new DefaultMutableTreeNode("XServiceInfo not supported"));
+ }
+
+ private void CreateInterfaceTree ()
+ {
+ XTypeProvider xTypeProvider = (XTypeProvider)UnoRuntime.queryInterface(
+ XTypeProvider.class, mxContext);
+ maInterfaceRoot.removeAllChildren();
+ if (xTypeProvider != null)
+ {
+ Type[] aTypes = xTypeProvider.getTypes();
+ int nCount = aTypes.length;
+ for (int i=0; i<nCount; i++)
+ maInterfaceRoot.add (
+ new DefaultMutableTreeNode (aTypes[i].getTypeName()));
+ }
+ else
+ maInterfaceRoot.add (
+ new DefaultMutableTreeNode("XTypeProvider not supported"));
+ }
+
+ public String GetTitle ()
+ {
+ return ("Supported Services and Interfaces");
+ }
+
+
+ private JTree maTree;
+ private DefaultMutableTreeNode maImplementationNameRoot;
+ private DefaultMutableTreeNode maServiceRoot;
+ private DefaultMutableTreeNode maInterfaceRoot;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java
new file mode 100644
index 000000000000..a0d6e289156d
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * $RCSfile: StateSetView.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+
+
+
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleStateSet;
+
+import org.openoffice.accessibility.misc.NameProvider;
+
+public class StateSetView
+ extends ObjectView
+{
+ /** Create a FocusView when the given object supports the
+ XAccessibleComponent interface.
+ */
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ ObjectView aView = null;
+ if (xContext != null)
+ aView = new StateSetView (aContainer);
+
+ return aView;
+ }
+
+ public StateSetView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+ setPreferredSize (new Dimension(300,110));
+ setMinimumSize (new Dimension(200,80));
+ }
+
+ public String GetTitle ()
+ {
+ return ("StateSet");
+ }
+
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ if (aEvent.EventId == AccessibleEventId.STATE_CHANGED)
+ Update();
+ }
+
+
+ public void Update ()
+ {
+ repaint ();
+ }
+
+ public void paintChildren (Graphics g)
+ {
+ if (g != null)
+ synchronized (g)
+ {
+ super.paintChildren (g);
+
+ // Calculcate the are inside the border.
+ Insets aInsets = getInsets ();
+ Dimension aSize = getSize();
+ Rectangle aWidgetArea = new Rectangle (
+ aInsets.left,
+ aInsets.top,
+ aSize.width-aInsets.left-aInsets.right,
+ aSize.height-aInsets.top-aInsets.bottom);
+
+ PaintAllStates ((Graphics2D)g, aWidgetArea);
+ }
+ }
+
+ private void PaintAllStates (Graphics2D g, Rectangle aWidgetArea)
+ {
+ Color aTextColor = g.getColor();
+
+ g.setRenderingHint (
+ RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
+ XAccessibleStateSet xStateSet = ( mxContext != null ) ? mxContext.getAccessibleStateSet() : null;
+ if (xStateSet != null)
+ {
+ short aStates[] = xStateSet.getStates ();
+ final int nMaxStateIndex = AccessibleStateType.VISIBLE;//MANAGES_DESCENDANTS;
+ int nStateWidth = (aWidgetArea.width-12) / (nMaxStateIndex+1);
+ AffineTransform aTransform = g.getTransform ();
+ g.setColor (aTextColor);
+ int y = aWidgetArea.y+aWidgetArea.height - 25;
+ double nTextRotation = -0.9;//-java.lang.Math.PI/2;
+ double nScale = 0.6;
+
+ // Create a shape for the boxes.
+ int nBoxWidth = 8;
+ Rectangle aCheckBox = new Rectangle (-nBoxWidth/2,0,nBoxWidth,nBoxWidth);
+
+ // For each state draw a box, fill it appropriately, and draw
+ // thre states name.
+ for (short i=0; i<=nMaxStateIndex; i++)
+ {
+ int x = nStateWidth + i * nStateWidth;
+ String sStateName = NameProvider.getStateName (i);
+ if (sStateName == null)
+ sStateName = new String ("<unknown state " + i + ">");
+ boolean bStateSet = xStateSet.contains (i);
+ g.setTransform (aTransform);
+ g.translate (x,y);
+ if (bStateSet)
+ {
+ switch (i)
+ {
+ case AccessibleStateType.INVALID:
+ case AccessibleStateType.DEFUNC:
+ g.setColor (saInvalidColor);
+ break;
+ case AccessibleStateType.FOCUSED:
+ g.setColor (saFocusColor);
+ break;
+ case AccessibleStateType.SELECTED:
+ g.setColor (saSelectionColor);
+ break;
+ case AccessibleStateType.EDITABLE:
+ g.setColor (saEditColor);
+ break;
+ default:
+ g.setColor (saDefaultColor);
+ break;
+ }
+ g.fill (aCheckBox);
+ g.setColor (aTextColor);
+ }
+ g.draw (aCheckBox);
+ g.rotate (nTextRotation);
+ g.scale (nScale, nScale);
+ g.translate (2,-2);
+ g.drawString (sStateName, 0,0);
+ }
+
+ // Draw string of set states.
+ String sStates = new String ();
+ for (int i=0; i<aStates.length; i++)
+ {
+ if (i > 0)
+ sStates = sStates + ", ";
+ sStates = sStates + NameProvider.getStateName(aStates[i]);
+ }
+ g.setTransform (aTransform);
+ g.translate (10,aWidgetArea.y+aWidgetArea.height-3);
+ g.scale (0.9,0.9);
+ g.drawString (sStates,0,0);
+ }
+ }
+
+ static private Color
+ saInvalidColor = new Color (255,0,255),
+ saFocusColor = new Color (100,100,255),
+ saSelectionColor = Color.GREEN,
+ saDefaultColor = new Color (90,90,90),
+ saEditColor = new Color (240,240,0);
+}
+
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java
new file mode 100644
index 000000000000..ad185ce86f7b
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * $RCSfile: TableView.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.lang.Integer;
+import java.lang.StringBuffer;
+
+import javax.swing.JLabel;
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleTable;
+import com.sun.star.uno.UnoRuntime;
+
+
+
+/** The <type>ContextView</type> class displays information accessible over
+ the <type>XAccessibleContext</type> interface. This includes name,
+ description, and role.
+*/
+public class TableView
+ extends ObjectView
+{
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ if (UnoRuntime.queryInterface(
+ XAccessibleTable.class, xContext) != null)
+ return new TableView (aContainer);
+ else
+ return null;
+ }
+
+ public TableView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ ViewGridLayout aLayout = new ViewGridLayout (this);
+
+ maRowCountLabel = aLayout.AddLabeledEntry ("Row Count: ");
+ maColumnCountLabel = aLayout.AddLabeledEntry ("Column Count: ");
+ maCellCountLabel = aLayout.AddLabeledEntry ("Cell Count: ");
+ maSelectedRowsLabel = aLayout.AddLabeledEntry ("Selected Rows: ");
+ maSelectedColumnsLabel = aLayout.AddLabeledEntry ("Selected Columns: ");
+ }
+
+
+ public void SetObject (XAccessibleContext xContext)
+ {
+ mxTable = (XAccessibleTable)UnoRuntime.queryInterface(
+ XAccessibleTable.class, xContext);
+ super.SetObject (xContext);
+ }
+
+
+ public void Update ()
+ {
+ if (mxTable == null)
+ {
+ maRowCountLabel.setText ("<null object>");
+ maColumnCountLabel.setText ("<null object>");
+ maCellCountLabel.setText ("<null object>");
+ maSelectedRowsLabel.setText ("<null object>");
+ maSelectedColumnsLabel.setText ("<null object>");
+ }
+ else
+ {
+ int nRowCount = mxTable.getAccessibleRowCount();
+ int nColumnCount = mxTable.getAccessibleColumnCount();
+ maRowCountLabel.setText (Integer.toString (nRowCount));
+ maColumnCountLabel.setText (Integer.toString (nColumnCount));
+ maCellCountLabel.setText (Integer.toString (nRowCount*nColumnCount));
+
+ StringBuffer sList = new StringBuffer();
+ int[] aSelected = mxTable.getSelectedAccessibleRows();
+ boolean bFirst = true;
+ for (int i=0; i<aSelected.length; i++)
+ {
+ if ( ! bFirst)
+ {
+ sList.append (", ");
+ bFirst = false;
+ }
+ sList.append (Integer.toString(aSelected[i]));
+ }
+ maSelectedRowsLabel.setText (sList.toString());
+ sList = new StringBuffer();
+ aSelected = mxTable.getSelectedAccessibleColumns();
+ bFirst = true;
+ for (int i=0; i<aSelected.length; i++)
+ {
+ if ( ! bFirst)
+ {
+ sList.append (", ");
+ bFirst = false;
+ }
+ sList.append (Integer.toString(aSelected[i]));
+ }
+ maSelectedColumnsLabel.setText (sList.toString());
+ }
+ }
+
+
+
+
+ public String GetTitle ()
+ {
+ return ("Table");
+ }
+
+
+
+
+ /** Listen for changes regarding displayed values.
+ */
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId.TABLE_MODEL_CHANGED :
+ case AccessibleEventId.SELECTION_CHANGED:
+ Update ();
+ }
+ }
+
+ private XAccessibleTable mxTable;
+ private JLabel
+ maRowCountLabel,
+ maColumnCountLabel,
+ maCellCountLabel,
+ maSelectedRowsLabel,
+ maSelectedColumnsLabel;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java b/accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java
new file mode 100644
index 000000000000..56f4c8758e61
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java
@@ -0,0 +1,501 @@
+/*************************************************************************
+ *
+ * $RCSfile: TextView.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obr $ $Date: 2008/05/14 13:21:35 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSpinner;
+import javax.swing.JTree;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.MutableTreeNode;
+
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.AccessibleTextType;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.accessibility.TextSegment;
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleMultiLineText;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.uno.UnoRuntime;
+
+import org.openoffice.accessibility.awb.view.text.CaretSpinnerModel;
+import org.openoffice.accessibility.awb.view.text.TextDialogFactory;
+
+
+public class TextView
+ extends ObjectView
+ implements ActionListener
+{
+
+ /** Create a TextView when the given object supports the
+ XAccessibleText interface.
+ */
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ XAccessibleText xText = (XAccessibleText)UnoRuntime.queryInterface(
+ XAccessibleText.class, xContext);
+ if (xText != null)
+ return new TextView (aContainer);
+ else
+ return null;
+ }
+
+
+ public TextView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ ViewGridLayout aLayout = new ViewGridLayout (this);
+
+ maTextLabel = aLayout.AddLabeledString ("Text: ");
+ maCharacterArrayLabel = aLayout.AddLabeledEntry ("Characters: ");
+ maCharacterCountLabel = aLayout.AddLabeledEntry ("Character Count: ");
+ maSelectionLabel = aLayout.AddLabeledEntry ("Selection: ");
+ maBoundsLabel = aLayout.AddLabeledEntry ("Bounds Test: ");
+ maCaretPositionSpinner = (JSpinner)aLayout.AddLabeledComponent (
+ "Caret position:", new JSpinner());
+ Dimension aSize = maCaretPositionSpinner.getSize();
+ maCaretPositionSpinner.setPreferredSize (new Dimension (100,20));
+ maCaretLineNoLabel = aLayout.AddLabeledEntry ("Line number at caret: ");
+ maCaretLineTextLabel = aLayout.AddLabeledEntry ("Text of line at caret: ");
+ maLineNoFromCaretPosLabel = aLayout.AddLabeledEntry ("Line number at index of caret: ");
+ maLineTextFromCaretPosLabel = aLayout.AddLabeledEntry ("Text of line at index of caret: ");
+
+ JPanel aButtonPanel = new JPanel ();
+ aLayout.AddComponent (aButtonPanel);
+
+ JButton aButton = new JButton ("select...");
+ aButton.setFont (aLayout.GetFont());
+ aButton.addActionListener (this);
+ aButtonPanel.add (aButton);
+
+ aButton = new JButton ("copy...");
+ aButton.setFont (aLayout.GetFont());
+ aButton.addActionListener (this);
+ aButtonPanel.add (aButton);
+
+ // A tree that holds the text broken down into various segments.
+ maTree = new JTree ();
+ aLayout.AddComponent (new JScrollPane (
+ maTree,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
+ }
+
+
+ /** Additionally to the context store a reference to the
+ XAccessibleText interface.
+ */
+ public void SetObject (XAccessibleContext xObject)
+ {
+ mxText = (XAccessibleText)UnoRuntime.queryInterface(
+ XAccessibleText.class, xObject);
+ maCaretSpinnerModel = new CaretSpinnerModel(mxText);
+ maCaretPositionSpinner.setModel (maCaretSpinnerModel);
+ super.SetObject (xObject);
+ }
+
+ synchronized public void Destroy ()
+ {
+ mxText = null;
+ super.Destroy();
+ }
+
+ synchronized public void Update ()
+ {
+ maCaretPositionSpinner.setEnabled (mxText != null);
+ DefaultMutableTreeNode aRoot = new DefaultMutableTreeNode ("Text Segments");
+ if (mxText == null)
+ {
+ maTextLabel.setText ("<null object>");
+ maCharacterArrayLabel.setText ("<null object>");
+ maCharacterCountLabel.setText ("<null object>");
+ maSelectionLabel.setText ("<null object>");
+ maBoundsLabel.setText ("<null object>");
+ maCaretLineNoLabel.setText ("<null object>");
+ maCaretLineTextLabel.setText ("<null object>");
+ maLineNoFromCaretPosLabel.setText ("<null object>");
+ maLineTextFromCaretPosLabel.setText ("<null object>");
+ }
+ else
+ {
+ maTextLabel.setText (mxText.getText());
+ maCharacterArrayLabel.setText (GetCharacterArray());
+ maCharacterCountLabel.setText (
+ Integer.toString(mxText.getCharacterCount()));
+ // Selection.
+ maSelectionLabel.setText (
+ "[" + mxText.getSelectionStart()
+ + "," + mxText.getSelectionEnd()
+ + "] \"" + mxText.getSelectedText() + "\"");
+
+ // Character bounds.
+ maBoundsLabel.setText (GetTextBoundsString());
+
+ // Caret position.
+ maCaretPositionSpinner.setValue (new Integer (mxText.getCaretPosition()));
+
+ // Multi line methods.
+ XAccessibleMultiLineText xMultiText = (XAccessibleMultiLineText)
+ UnoRuntime.queryInterface( XAccessibleMultiLineText.class, mxText );
+
+ if( null != xMultiText ) {
+ try {
+ maCaretLineNoLabel.setText ( Integer.toString( xMultiText.getNumberOfLineWithCaret() ) );
+ TextSegment ts = xMultiText.getTextAtLineWithCaret();
+ maCaretLineTextLabel.setText ( "[" + ts.SegmentStart
+ + "," + ts.SegmentEnd
+ + "] \"" + ts.SegmentText + "\"");
+ maLineNoFromCaretPosLabel.setText ( Integer.toString( xMultiText.getLineNumberAtIndex( mxText.getCaretPosition() ) ) );
+ ts = xMultiText.getTextAtLineNumber(xMultiText.getLineNumberAtIndex( mxText.getCaretPosition() ) );
+ maLineTextFromCaretPosLabel.setText ( "[" + ts.SegmentStart
+ + "," + ts.SegmentEnd
+ + "] \"" + ts.SegmentText + "\"");
+ } catch( IndexOutOfBoundsException e) {
+ }
+ }
+
+ // Text segments.
+ aRoot.add (CreateNode ("Character", AccessibleTextType.CHARACTER));
+ aRoot.add (CreateNode ("Word", AccessibleTextType.WORD));
+ aRoot.add (CreateNode ("Sentence", AccessibleTextType.SENTENCE));
+ aRoot.add (CreateNode ("Paragraph", AccessibleTextType.PARAGRAPH));
+ aRoot.add (CreateNode ("Line", AccessibleTextType.LINE));
+ aRoot.add (CreateNode ("Attribute", AccessibleTextType.ATTRIBUTE_RUN));
+ aRoot.add (CreateNode ("Glyph", AccessibleTextType.GLYPH));
+ }
+ ((DefaultTreeModel)maTree.getModel()).setRoot (aRoot);
+ }
+
+ public String GetTitle ()
+ {
+ return ("Text");
+ }
+
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ System.out.println (aEvent);
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId.CARET_CHANGED :
+ maCaretSpinnerModel.Update();
+ Update ();
+ break;
+
+ case AccessibleEventId.TEXT_CHANGED :
+ case AccessibleEventId.TEXT_SELECTION_CHANGED:
+ Update ();
+ break;
+ }
+ }
+
+ public void actionPerformed (ActionEvent aEvent)
+ {
+ String sCommand = aEvent.getActionCommand();
+ if (sCommand.equals ("select..."))
+ TextDialogFactory.CreateSelectionDialog (mxContext);
+ else if (sCommand.equals ("copy..."))
+ TextDialogFactory.CreateCopyDialog (mxContext);
+ }
+
+
+
+ /** Create a string that is a list of all characters returned by the
+ getCharacter() method.
+ */
+ private String GetCharacterArray ()
+ {
+ // Do not show more than 30 characters.
+ int nCharacterCount = mxText.getCharacterCount();
+ int nMaxDisplayCount = 30;
+
+ // build up string
+ StringBuffer aCharacterArray = new StringBuffer();
+ int nIndex = 0;
+ try
+ {
+ while (nIndex<nCharacterCount && nIndex<nMaxDisplayCount)
+ {
+ aCharacterArray.append (mxText.getCharacter (nIndex));
+ if (nIndex < nCharacterCount-1)
+ aCharacterArray.append (",");
+ nIndex ++;
+ }
+ if (nMaxDisplayCount < nCharacterCount)
+ aCharacterArray.append (", ...");
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ aCharacterArray.append ("; Index Out Of Bounds at index " + nIndex);
+ }
+
+ return aCharacterArray.toString();
+ }
+
+
+
+ /** Iterate over all characters and translate their positions
+ back and forth.
+ */
+ private String GetTextBoundsString ()
+ {
+ StringBuffer aBuffer = new StringBuffer ();
+ try
+ {
+ // Iterate over all characters in the text.
+ int nCount = mxText.getCharacterCount();
+ for (int i=0; i<nCount; i++)
+ {
+ // Get bounds for this character.
+ Rectangle aBBox = mxText.getCharacterBounds (i);
+
+ // get the character by 'clicking' into the middle of
+ // the bounds
+ Point aMiddle = new Point();
+ aMiddle.X = aBBox.X + (aBBox.Width / 2) - 1;
+ aMiddle.Y = aBBox.Y + (aBBox.Height / 2) - 1;
+ int nIndex = mxText.getIndexAtPoint (aMiddle);
+
+ // get the character, or a '#' for an illegal index
+ if ((nIndex >= 0) && (nIndex < mxText.getCharacter(i)))
+ aBuffer.append (mxText.getCharacter(nIndex));
+ else
+ aBuffer.append ('#');
+ }
+ }
+ catch (IndexOutOfBoundsException aEvent)
+ {
+ // Ignore errors.
+ }
+
+ return aBuffer.toString();
+ }
+
+
+
+
+ private final static int BEFORE = -1;
+ private final static int AT = 0;
+ private final static int BEHIND = +1;
+
+ private MutableTreeNode CreateNode (String sTitle, short nTextType)
+ {
+ DefaultMutableTreeNode aNode = new DefaultMutableTreeNode (sTitle);
+
+ aNode.add (CreateSegmentNode ("Before", nTextType, BEFORE));
+ aNode.add (CreateSegmentNode ("At", nTextType, AT));
+ aNode.add (CreateSegmentNode ("Behind", nTextType, BEHIND));
+
+ return aNode;
+ }
+
+ private MutableTreeNode CreateSegmentNode (String sTitle, short nTextType, int nWhere)
+ {
+ TextSegment aSegment;
+ int nTextLength = mxText.getCharacterCount();
+ DefaultMutableTreeNode aNode = new DefaultMutableTreeNode (sTitle);
+ for (int nIndex=0; nIndex<=nTextLength; /* empty */)
+ {
+ aSegment = GetTextSegment (nIndex, nTextType, nWhere);
+ DefaultMutableTreeNode aSegmentNode = new DefaultMutableTreeNode (
+ new StringBuffer (
+ Integer.toString (nIndex) + " -> "
+ + Integer.toString (aSegment.SegmentStart) + " - "
+ + Integer.toString (aSegment.SegmentEnd) + " : "
+ + aSegment.SegmentText.toString()));
+ aNode.add (aSegmentNode);
+ if (nTextType == AccessibleTextType.ATTRIBUTE_RUN)
+ AddAttributeNodes (aSegmentNode, aSegment);
+ if (aSegment.SegmentEnd > nIndex)
+ nIndex = aSegment.SegmentEnd;
+ else
+ nIndex ++;
+ }
+
+ return aNode;
+ }
+
+
+ private TextSegment GetTextSegment (int nIndex, short nTextType, int nWhere)
+ {
+ TextSegment aSegment;
+
+ try
+ {
+ switch (nWhere)
+ {
+ case BEFORE:
+ aSegment = mxText.getTextBeforeIndex (nIndex, nTextType);
+ break;
+
+ case AT:
+ aSegment = mxText.getTextAtIndex (nIndex, nTextType);
+ break;
+
+ case BEHIND:
+ aSegment = mxText.getTextBehindIndex (nIndex, nTextType);
+ break;
+
+ default:
+ aSegment = new TextSegment();
+ aSegment.SegmentText = new String ("unknown position " + nWhere);
+ aSegment.SegmentStart = nIndex;
+ aSegment.SegmentStart = nIndex+1;
+ break;
+ }
+ }
+ catch (IndexOutOfBoundsException aException)
+ {
+ aSegment = new TextSegment ();
+ aSegment.SegmentText = new String ("Invalid index at ") + nIndex + " : "
+ + aException.toString();
+ aSegment.SegmentStart = nIndex;
+ aSegment.SegmentEnd = nIndex+1;
+ }
+ catch (IllegalArgumentException aException)
+ {
+ aSegment = new TextSegment ();
+ aSegment.SegmentText = new String ("Illegal argument at ") + nIndex + " : "
+ + aException.toString();
+ aSegment.SegmentStart = nIndex;
+ aSegment.SegmentEnd = nIndex+1;
+ }
+
+ return aSegment;
+ }
+
+
+ /** Add to the given node one node for every attribute of the given segment.
+ */
+ private void AddAttributeNodes (
+ DefaultMutableTreeNode aNode,
+ TextSegment aSegment)
+ {
+ try
+ {
+ PropertyValue[] aValues = mxText.getCharacterAttributes (
+ aSegment.SegmentStart, aAttributeList);
+ for (int i=0; i<aValues.length; i++)
+ aNode.add (new DefaultMutableTreeNode (
+ aValues[i].Name + ": " + aValues[i].Value));
+ }
+ catch (IndexOutOfBoundsException aException)
+ {
+ aNode.add (new DefaultMutableTreeNode (
+ "caught IndexOutOfBoundsException while retrieveing attributes"));
+ }
+ }
+
+ private XAccessibleText mxText;
+ private JLabel
+ maTextLabel,
+ maCharacterArrayLabel,
+ maCharacterCountLabel,
+ maSelectionLabel,
+ maBoundsLabel,
+ maCaretLineNoLabel,
+ maCaretLineTextLabel,
+ maLineNoFromCaretPosLabel,
+ maLineTextFromCaretPosLabel;
+
+ private JSpinner maCaretPositionSpinner;
+ private JTree maTree;
+ private CaretSpinnerModel maCaretSpinnerModel;
+
+ private static String[] aAttributeList = new String[] {
+ "CharBackColor",
+ "CharColor",
+ "CharEscapement",
+ "CharHeight",
+ "CharPosture",
+ "CharStrikeout",
+ "CharUnderline",
+ "CharWeight",
+ "ParaAdjust",
+ "ParaBottomMargin",
+ "ParaFirstLineIndent",
+ "ParaLeftMargin",
+ "ParaLineSpacing",
+ "ParaRightMargin",
+ "ParaTabStops"};
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java b/accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java
new file mode 100644
index 000000000000..e4f020a51455
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * $RCSfile: ViewGridLayout.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:38 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+
+
+/** This class is a convenience class for views to use the GridBagLayout.
+*/
+class ViewGridLayout
+{
+ public ViewGridLayout (JComponent aComponent)
+ {
+ maComponent = aComponent;
+ maComponent.setLayout (new GridBagLayout());
+ maComponent.setMinimumSize (new Dimension (300,30));
+ maComponent.setMaximumSize (new Dimension (300,1000));
+ mnCurrentLine = 0;
+ }
+
+ public JLabel AddLabeledEntry (String sTitle)
+ {
+ return (JLabel)AddLabeledComponent (sTitle, new JLabel (""));
+ }
+
+ public JLabel AddLabeledString (String sTitle)
+ {
+ JLabel aLabel = AddLabeledEntry (sTitle);
+ aLabel.setBackground (new Color(220,220,220));
+ aLabel.setOpaque (true);
+ return aLabel;
+ }
+
+ public JComponent AddLabeledComponent (String sTitle, JComponent aComponent)
+ {
+ GridBagConstraints constraints = new GridBagConstraints ();
+ constraints.gridx = 0;
+ constraints.anchor = GridBagConstraints.WEST;
+ constraints.fill = GridBagConstraints.NONE;
+ constraints.gridy = mnCurrentLine;
+
+ JLabel aLabel = new JLabel(sTitle);
+ aLabel.setFont (saFont);
+ maComponent.add (aLabel, constraints);
+ constraints.gridx = 1;
+ constraints.weightx = 1;
+ constraints.fill = GridBagConstraints.NONE;
+ aComponent.setFont (saFont);
+ maComponent.add (aComponent, constraints);
+
+ mnCurrentLine += 1;
+
+ return aComponent;
+ }
+
+ public JComponent AddComponent (JComponent aComponent)
+ {
+ GridBagConstraints constraints = new GridBagConstraints ();
+ constraints.gridx = 0;
+ constraints.gridwidth = 2;
+ constraints.weightx = 1;
+ constraints.anchor = GridBagConstraints.WEST;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+ constraints.gridy = mnCurrentLine;
+
+ maComponent.add (aComponent, constraints);
+
+ mnCurrentLine += 1;
+
+ return aComponent;
+ }
+
+ static public Font GetFont ()
+ {
+ return saFont;
+ }
+
+ static private Font saFont;
+ private int mnCurrentLine;
+ private JComponent maComponent;
+
+ static
+ {
+ saFont = new Font ("Dialog", Font.PLAIN, 11);
+ }
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common
new file mode 100644
index 000000000000..d4929e3f1cd8
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common
@@ -0,0 +1,76 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.common,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar
+JAVAFILES = \
+ ComponentView.java \
+ ContextView.java \
+ EditableTextView.java \
+ EventMonitorView.java \
+ FocusView.java \
+ LayoutManager.java \
+ ObjectView.java \
+ ObjectViewContainer.java \
+ ObjectViewContainerWindow.java \
+ ParentView.java \
+ SelectionView.java \
+ ServiceInterfaceView.java \
+ StateSetView.java \
+ TableView.java \
+ TextView.java \
+ ViewGridLayout.java
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk
new file mode 100644
index 000000000000..c8ddd587635a
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJNAME = awb
+PRJ = ..$/..$/..$/..$/..$/..
+TARGET = awb_view
+PACKAGE = org$/openoffice$/accessibility$/awb$/view
+
+USE_JAVAVER:=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(JAVAVER:s/.//)" >= "140"
+
+.INCLUDE : makefile.common
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java
new file mode 100644
index 000000000000..6289697ee375
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * $RCSfile: CaretSpinnerModel.java,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obr $ $Date: 2008/05/14 13:21:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view.text;
+
+import java.lang.Integer;
+import java.util.Vector;
+import javax.swing.SpinnerModel;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+
+/** A simple model for JSpinner objects that clips the spinner values to valid
+ text indices.
+*/
+public class CaretSpinnerModel
+ implements SpinnerModel
+{
+ public CaretSpinnerModel (XAccessibleText xText)
+ {
+ mxText = xText;
+ maListeners = new Vector ();
+ }
+
+ public void addChangeListener (ChangeListener aListener)
+ {
+ if (aListener != null)
+ maListeners.add (aListener);
+ }
+
+ public void removeChangeListener (ChangeListener aListener)
+ {
+ maListeners.removeElement (aListener);
+ }
+
+ public Object getNextValue ()
+ {
+ if (mxText != null)
+ {
+ int nPosition = mxText.getCaretPosition();
+ if (nPosition+1 <= mxText.getCharacterCount())
+ return new Integer (nPosition+1);
+ }
+ return null;
+ }
+
+ public Object getPreviousValue ()
+ {
+ if (mxText != null)
+ {
+ int nPosition = mxText.getCaretPosition();
+ if (nPosition > 0)
+ return new Integer (nPosition-1);
+ }
+ return null;
+ }
+
+ public Object getValue ()
+ {
+ if (mxText != null)
+ return new Integer (mxText.getCaretPosition());
+ else
+ return null;
+ }
+
+ public void setValue (Object aValue)
+ {
+ if (mxText != null)
+ if (aValue instanceof Integer)
+ {
+ try
+ {
+ if( ((Integer)aValue).intValue() != mxText.getCaretPosition() )
+ mxText.setCaretPosition (((Integer)aValue).intValue());
+ }
+ catch (IndexOutOfBoundsException aException)
+ {
+ }
+ }
+ }
+
+ /** Call this method when the caret position has changes so that the model
+ can inform its listeners about it.
+ */
+ public void Update ()
+ {
+ ChangeEvent aEvent = new ChangeEvent (this);
+ for (int i=0; i<maListeners.size(); i++)
+ ((ChangeListener)maListeners.elementAt(i)).stateChanged (aEvent);
+ }
+
+ private XAccessibleText mxText;
+ private Integer maValue;
+ private Vector maListeners;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/Makefile b/accessibility/workben/org/openoffice/accessibility/awb/view/text/Makefile
new file mode 100644
index 000000000000..c58899a09f6e
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/Makefile
@@ -0,0 +1,13 @@
+# $Id: Makefile,v 1.1 2003/06/13 16:30:41 af Exp $
+
+all : package
+
+ROOT=../../../../..
+PACKAGE = org.openoffice.accessibility.awb.view.text
+SUBDIRS =
+include makefile.common
+
+include $(ROOT)/makefile.in
+
+
+package : $(CLASS_FILES)
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java
new file mode 100644
index 000000000000..420119515a41
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * $RCSfile: TextActionDialog.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view.text;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.FlowLayout;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.text.JTextComponent;
+
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.accessibility.XAccessibleEditableText;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.uno.UnoRuntime;
+
+
+/**
+ * Display a dialog with a text field and a pair of cancel/do-it buttons
+ */
+class TextActionDialog
+ extends JDialog
+ implements ActionListener
+{
+ public TextActionDialog (
+ XAccessibleContext xContext,
+ String sExplanation,
+ String sTitle)
+ {
+ super();// AccessibilityWorkBench.Instance() );
+
+ mxContext = xContext;
+ msTitle = sTitle;
+ msExplanation = sExplanation;
+ Layout ();
+ setSize (350, 225);
+
+ }
+
+
+ /** build dialog */
+ protected void Layout()
+ {
+ setTitle (msTitle);
+
+ // vertical stacking of the elements
+ Container aContent = getContentPane();
+ // aContent.setLayout( new BorderLayout() );
+
+ // Label with explanation.
+ if (msExplanation.length() > 0)
+ aContent.add (new JLabel (msExplanation), BorderLayout.NORTH);
+
+ // the text field
+ maText = new JTextArea();
+ maText.setLineWrap (true);
+ maText.setEditable (false);
+ aContent.add (maText, BorderLayout.CENTER);
+
+ XAccessibleText xText = (XAccessibleText)UnoRuntime.queryInterface(
+ XAccessibleText.class, mxContext);
+ String sText = xText.getText();
+ maText.setText (sText);
+ maText.setRows (sText.length() / 40 + 1);
+ maText.setColumns (Math.min (Math.max (40, sText.length()), 20));
+
+ JPanel aButtons = new JPanel();
+ aButtons.setLayout (new FlowLayout());
+ maIndexToggle = new JCheckBox ("reverse selection");
+ aButtons.add (maIndexToggle);
+
+ JButton aActionButton = new JButton (msTitle);
+ aActionButton.setActionCommand ("Action");
+ aActionButton.addActionListener (this);
+ aButtons.add (aActionButton);
+
+ JButton aCancelButton = new JButton ("cancel");
+ aCancelButton.setActionCommand ("Cancel");
+ aCancelButton.addActionListener (this);
+ aButtons.add (aCancelButton);
+
+ // add Panel with buttons
+ aContent.add (aButtons, BorderLayout.SOUTH);
+ }
+
+ protected void Cancel()
+ {
+ hide();
+ dispose();
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ String sCommand = e.getActionCommand();
+
+ if( "Cancel".equals( sCommand ) )
+ Cancel();
+ else if( "Action".equals( sCommand ) )
+ Action();
+ }
+
+
+ protected int GetSelectionStart()
+ {
+ return GetSelection(true);
+ }
+ protected int GetSelectionEnd()
+ {
+ return GetSelection(false);
+ }
+ private int GetSelection (boolean bStart)
+ {
+ if (bStart ^ maIndexToggle.isSelected())
+ return maText.getSelectionStart();
+ else
+ return maText.getSelectionEnd();
+ }
+
+
+
+ protected void Action ()
+ {
+ String sError = null;
+ boolean bSuccess = true;
+ try
+ {
+ XAccessibleText xText =
+ (XAccessibleText)UnoRuntime.queryInterface(
+ XAccessibleText.class, mxContext);
+ if (xText != null)
+ bSuccess = bSuccess && TextAction (xText);
+
+ XAccessibleEditableText xEditableText =
+ (XAccessibleEditableText)UnoRuntime.queryInterface(
+ XAccessibleEditableText.class, mxContext);
+ if (xEditableText != null)
+ bSuccess = bSuccess && EditableTextAction (xEditableText);
+
+ if ( ! bSuccess)
+ sError = "Can't execute";
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ sError = "Index out of bounds";
+ }
+
+ if (sError != null)
+ JOptionPane.showMessageDialog (
+ this,// AccessibilityWorkBench.Instance(),
+ sError,
+ msTitle,
+ JOptionPane.ERROR_MESSAGE);
+
+ Cancel();
+ }
+
+ /** override this for dialog-specific action */
+ boolean TextAction (XAccessibleText xText)
+ throws IndexOutOfBoundsException
+ {
+ return true;
+ }
+
+ boolean EditableTextAction (XAccessibleEditableText xText)
+ throws IndexOutOfBoundsException
+ {
+ return true;
+ }
+
+ private XAccessibleContext mxContext;
+ protected JTextArea maText;
+ private String msTitle;
+ private String msExplanation;
+ private JCheckBox maIndexToggle;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java
new file mode 100644
index 000000000000..36d81162462c
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * $RCSfile: TextAttributeDialog.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view.text;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import javax.swing.BoxLayout;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JColorChooser;
+import javax.swing.JPanel;
+import javax.swing.text.JTextComponent;
+
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEditableText;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.uno.UnoRuntime;
+
+
+class TextAttributeDialog
+ extends TextActionDialog
+{
+ public TextAttributeDialog (XAccessibleContext xContext)
+ {
+ super (xContext,
+ "Choose attributes, select text, and press 'Set':",
+ "set");
+ }
+
+ protected void Layout ()
+ {
+ super.Layout ();
+
+ maForeground = Color.black;
+ maBackground = Color.white;
+
+ JPanel aPanel = new JPanel();
+ aPanel.setLayout (new BoxLayout (aPanel, BoxLayout.Y_AXIS));
+
+ maBoldCheckBox = new JCheckBox ("bold");
+ maUnderlineCheckBox = new JCheckBox ("underline");
+ maItalicsCheckBox = new JCheckBox ("italics");
+
+ JButton aForegroundButton = new JButton ("Foreground",
+ new TextAttributeDialog.ColorIcon(true));
+ aForegroundButton.addActionListener (new ActionListener()
+ {
+ public void actionPerformed (ActionEvent aEvent)
+ {
+ maForeground = JColorChooser.showDialog (
+ TextAttributeDialog.this,
+ "Select Foreground Color",
+ maForeground);
+ }
+ } );
+
+ JButton aBackgroundButton = new JButton("Background",
+ new TextAttributeDialog.ColorIcon(false));
+ aBackgroundButton.addActionListener (new ActionListener()
+ {
+ public void actionPerformed (ActionEvent eEvent)
+ {
+ maBackground = JColorChooser.showDialog(
+ TextAttributeDialog.this,
+ "Select Background Color",
+ maBackground);
+ }
+ } );
+
+ aPanel.add (maBoldCheckBox);
+ aPanel.add (maUnderlineCheckBox);
+ aPanel.add (maItalicsCheckBox);
+ aPanel.add (aForegroundButton);
+ aPanel.add (aBackgroundButton);
+
+ getContentPane().add (aPanel, BorderLayout.WEST);
+ }
+
+
+ /** edit the text */
+ boolean EditableTextAction (XAccessibleEditableText xText)
+ throws IndexOutOfBoundsException
+ {
+ PropertyValue[] aSequence = new PropertyValue[6];
+ aSequence[0] = new PropertyValue();
+ aSequence[0].Name = "CharWeight";
+ aSequence[0].Value = new Integer (maBoldCheckBox.isSelected() ? 150 : 100);
+ aSequence[1] = new PropertyValue();
+ aSequence[1].Name = "CharUnderline";
+ aSequence[1].Value = new Integer (maUnderlineCheckBox.isSelected() ? 1 : 0);
+ aSequence[2] = new PropertyValue();
+ aSequence[2].Name = "CharBackColor";
+ aSequence[2].Value = new Integer (maBackground.getRGB());
+ aSequence[3] = new PropertyValue();
+ aSequence[3].Name = "CharColor";
+ aSequence[3].Value = new Integer (maForeground.getRGB());
+ aSequence[4] = new PropertyValue();
+ aSequence[4].Name = "CharPosture";
+ aSequence[4].Value = new Integer (maItalicsCheckBox.isSelected() ? 1 : 0);
+ aSequence[5] = new PropertyValue();
+ aSequence[5].Name = "CharBackTransparent";
+ aSequence[5].Value = new Boolean (false);
+
+ return xText.setAttributes (
+ GetSelectionStart(),
+ GetSelectionEnd(),
+ aSequence);
+ }
+
+ class ColorIcon
+ implements Icon
+ {
+ public ColorIcon(boolean bWhich) { bForeground = bWhich; }
+ public int getIconHeight() { return nHeight; }
+ public int getIconWidth() { return nWidth; }
+ public void paintIcon (Component c, Graphics g, int x, int y)
+ {
+ g.setColor( getColor() );
+ g.fillRect( x, y, nHeight, nWidth );
+ g.setColor( c.getForeground() );
+ g.drawRect( x, y, nHeight, nWidth );
+ }
+ Color getColor()
+ {
+ if (bForeground)
+ return maForeground;
+ else
+ return maBackground;
+ }
+
+ private static final int nHeight = 16;
+ private static final int nWidth = 16;
+ private boolean bForeground;
+ }
+
+
+
+
+ private JCheckBox
+ maBoldCheckBox,
+ maUnderlineCheckBox,
+ maItalicsCheckBox;
+ private Color
+ maForeground,
+ maBackground;
+
+}
+
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java
new file mode 100644
index 000000000000..397c3f8b1877
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * $RCSfile: TextDialogFactory.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view.text;
+
+import javax.swing.JDialog;
+import javax.swing.text.JTextComponent;
+
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEditableText;
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.uno.UnoRuntime;
+
+
+/** Factory for dialogs of the text views.
+*/
+public class TextDialogFactory
+{
+ static public JDialog CreateSelectionDialog (XAccessibleContext xContext)
+ {
+ JDialog aDialog = new TextActionDialog(
+ xContext,
+ "Select range:",
+ "select")
+ {
+ boolean TextAction (XAccessibleText xText)
+ throws IndexOutOfBoundsException
+ {
+ return xText.setSelection(
+ GetSelectionStart(),
+ GetSelectionEnd() );
+ }
+ };
+ if (aDialog != null)
+ aDialog.show();
+ return aDialog;
+ }
+
+ static public JDialog CreateCopyDialog (XAccessibleContext xContext)
+ {
+ JDialog aDialog = new TextActionDialog(
+ xContext,
+ "Select range and copy:",
+ "copy")
+ {
+ boolean TextAction (XAccessibleText xText)
+ throws IndexOutOfBoundsException
+ {
+ return xText.copyText(
+ GetSelectionStart(),
+ GetSelectionEnd());
+ }
+ };
+ if (aDialog != null)
+ aDialog.show();
+ return aDialog;
+ }
+ static public JDialog CreateCutDialog (XAccessibleContext xContext)
+ {
+ JDialog aDialog = new TextActionDialog(
+ xContext,
+ "Select range and cut:",
+ "cut")
+ {
+ boolean EditableTextAction (XAccessibleEditableText xText)
+ throws IndexOutOfBoundsException
+ {
+ return xText.cutText(
+ GetSelectionStart(),
+ GetSelectionEnd() );
+ }
+ };
+ if (aDialog != null)
+ aDialog.show();
+ return aDialog;
+ }
+ static public JDialog CreatePasteDialog (XAccessibleContext xContext)
+ {
+ JDialog aDialog = new TextActionDialog (
+ xContext,
+ "Place Caret and paste:",
+ "paste")
+ {
+ boolean EditableTextAction (XAccessibleEditableText xText)
+ throws IndexOutOfBoundsException
+ {
+ return xText.pasteText(maText.getCaretPosition());
+ }
+ };
+ if (aDialog != null)
+ aDialog.show();
+ return aDialog;
+ }
+ static public JDialog CreateEditDialog (XAccessibleContext xContext)
+ {
+ JDialog aDialog = new TextEditDialog (
+ xContext,
+ "Edit text:",
+ "edit");
+ if (aDialog != null)
+ aDialog.show();
+ return aDialog;
+ }
+ static public JDialog CreateFormatDialog (XAccessibleContext xContext)
+ {
+ JDialog aDialog = new TextAttributeDialog (xContext);
+ if (aDialog != null)
+ aDialog.show();
+ return aDialog;
+ }
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java
new file mode 100644
index 000000000000..55dfea6fb0b2
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * $RCSfile: TextEditDialog.java,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: af $ $Date: 2003/06/13 16:30:43 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.awb.view.text;
+
+import javax.swing.text.JTextComponent;
+
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEditableText;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.uno.UnoRuntime;
+
+
+class TextEditDialog
+ extends TextActionDialog
+{
+ public TextEditDialog (
+ XAccessibleContext xContext,
+ String sExplanation,
+ String sTitle )
+ {
+ super (xContext, sExplanation, sTitle);
+ }
+
+ protected void Layout()
+ {
+ super.Layout();
+ maText.setEditable (true);
+ }
+
+
+ /** edit the text */
+ boolean EditableTextAction (XAccessibleEditableText xText)
+ {
+ return UpdateText (xText, maText.getText());
+ }
+
+
+ /** update the text */
+ boolean UpdateText (XAccessibleEditableText xText, String sNew)
+ {
+ boolean bResult = false;
+
+ String sOld = xText.getText();
+
+ // false alarm? Early out if no change was done!
+ if ( ! sOld.equals (sNew))
+ {
+
+ // Get the minimum length of both strings.
+ int nMinLength = sOld.length();
+ if (sNew.length() < nMinLength)
+ nMinLength = sNew.length();
+
+ // Count equal characters from front and end.
+ int nFront = 0;
+ while ((nFront < nMinLength) &&
+ (sNew.charAt(nFront) == sOld.charAt(nFront)))
+ nFront++;
+ int nBack = 0;
+ while ((nBack < nMinLength) &&
+ (sNew.charAt(sNew.length()-nBack-1) ==
+ sOld.charAt(sOld.length()-nBack-1) ))
+ nBack++;
+ if (nFront + nBack > nMinLength)
+ nBack = nMinLength - nFront;
+
+ // so... the first nFront and the last nBack characters are the
+ // same. Change the others!
+ String sDel = sOld.substring (nFront, sOld.length() - nBack);
+ String sIns = sNew.substring (nFront, sNew.length() - nBack);
+
+ System.out.println ("edit text: " +
+ sOld.substring(0, nFront) +
+ " [ " + sDel + " -> " + sIns + " ] " +
+ sOld.substring(sOld.length() - nBack));
+
+ try
+ {
+ // edit the text, and use
+ // (set|insert|delete|replace)Text as needed
+ if( nFront+nBack == 0 )
+ bResult = xText.setText( sIns );
+ else if( sDel.length() == 0 )
+ bResult = xText.insertText( sIns, nFront );
+ else if( sIns.length() == 0 )
+ bResult = xText.deleteText( nFront, sOld.length()-nBack );
+ else
+ bResult = xText.replaceText(nFront, sOld.length()-nBack,sIns);
+ }
+ catch( IndexOutOfBoundsException aException)
+ {
+ }
+ }
+
+ return bResult;
+ }
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common
new file mode 100644
index 000000000000..32655a0c6a6f
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.common,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar
+JAVAFILES = \
+ CaretSpinnerModel.java \
+ TextActionDialog.java \
+ TextEditDialog.java \
+ TextAttributeDialog.java \
+ TextDialogFactory.java
diff --git a/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk
new file mode 100644
index 000000000000..05f5b3a99c35
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJNAME = awb
+PRJ = ..$/..$/..$/..$/..$/..$/..
+TARGET = awb_view_text
+PACKAGE = org$/openoffice$/accessibility$/awb$/view$/text
+
+USE_JAVAVER:=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(JAVAVER:s/.//)" >= "140"
+
+.INCLUDE : makefile.common
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java b/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java
new file mode 100644
index 000000000000..f9212e05a35c
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * $RCSfile: AccessibleEventMulticaster.java,v $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+package org.openoffice.accessibility.misc;
+
+import com.sun.star.lang.EventObject;
+
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessibleEventBroadcaster;
+import com.sun.star.accessibility.XAccessibleEventListener;
+
+/**
+ *
+ */
+public class AccessibleEventMulticaster implements XAccessibleEventListener {
+
+ private final XAccessibleEventListener a;
+ private final XAccessibleEventListener b;
+
+ /** Creates a new instance of AccessibleEventMulticaster */
+ protected AccessibleEventMulticaster(XAccessibleEventListener a,
+ XAccessibleEventListener b) {
+ this.a = a;
+ this.b = b;
+ }
+
+ protected XAccessibleEventListener remove(XAccessibleEventListener l) {
+ if (l == a)
+ return b;
+ if (l == b)
+ return a;
+ XAccessibleEventListener a2 = remove(a, l);
+ XAccessibleEventListener b2 = remove(b, l);
+ if (a2 == a && b2 == b) {
+ return this; // not found
+ }
+ return add(a2, b2);
+ }
+
+ public void notifyEvent(AccessibleEventObject accessibleEventObject) {
+ a.notifyEvent(accessibleEventObject);
+ b.notifyEvent(accessibleEventObject);
+ }
+
+ public void disposing(EventObject eventObject) {
+ a.disposing(eventObject);
+ b.disposing(eventObject);
+ }
+
+ public static XAccessibleEventListener add(XAccessibleEventListener a, XAccessibleEventListener b) {
+ if (a == null)
+ return b;
+ if (b == null)
+ return a;
+ return new AccessibleEventMulticaster(a,b);
+ }
+
+ public static XAccessibleEventListener remove(XAccessibleEventListener l, XAccessibleEventListener oldl) {
+ if (l == oldl || l == null) {
+ return null;
+ } else if (l instanceof AccessibleEventMulticaster) {
+ return ((AccessibleEventMulticaster) l).remove(oldl);
+ } else {
+ return l;
+ }
+ }
+
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/Connector.java b/accessibility/workben/org/openoffice/accessibility/misc/Connector.java
new file mode 100644
index 000000000000..de188676e224
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/Connector.java
@@ -0,0 +1,50 @@
+package org.openoffice.accessibility.misc;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.Vector;
+
+
+/** Wait for an Office application and connect to it.
+*/
+public class Connector
+ extends TimerTask
+{
+ final public static long snDelay = 3000;
+
+ public Connector ()
+ {
+ maTimer = new Timer (true);
+ maListeners = new Vector();
+ run ();
+ }
+
+ public void AddConnectionListener (ActionListener aListener)
+ {
+ SimpleOffice aOffice = SimpleOffice.Instance();
+ if (aOffice!=null && aOffice.IsConnected())
+ aListener.actionPerformed (
+ new ActionEvent (aOffice,0,"<connected>"));
+ maListeners.add (aListener);
+ }
+
+ public void run ()
+ {
+ SimpleOffice aOffice = SimpleOffice.Instance();
+ if (aOffice!=null && !aOffice.IsConnected())
+ if ( ! aOffice.Connect())
+ maTimer.schedule (this, snDelay);
+ else
+ {
+ ActionEvent aEvent = new ActionEvent (aOffice,0,"<connected>");
+ for (int i=0; i<maListeners.size(); i++)
+ ((ActionListener)maListeners.elementAt(i)).actionPerformed(
+ aEvent);
+ }
+ }
+
+ Timer maTimer;
+ Vector maListeners;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/InformationWriter.java b/accessibility/workben/org/openoffice/accessibility/misc/InformationWriter.java
new file mode 100644
index 000000000000..fbd1455cd295
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/InformationWriter.java
@@ -0,0 +1,421 @@
+package org.openoffice.accessibility.misc;
+
+import java.lang.Thread;
+import java.io.PrintStream;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.XWindow;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertySetInfo;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XChild;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XEnumeration;
+
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XTasksSupplier;
+import com.sun.star.frame.XTask;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XServiceName;
+import com.sun.star.lang.XTypeProvider;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.Type;
+
+import com.sun.star.drawing.XDrawView;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapeDescriptor;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleRelationSet;
+import com.sun.star.accessibility.XAccessibleStateSet;
+
+public class InformationWriter
+{
+ public InformationWriter (PrintStream aOut)
+ {
+ maOut = aOut;
+ }
+
+ public void drawPageTest (XInterface xPage)
+ {
+ try
+ {
+ printProperty (xPage, "BorderBottom ", "BorderBottom");
+ printProperty (xPage, "BorderLeft ", "BorderLeft");
+ printProperty (xPage, "BorderRight ", "BorderRight");
+ printProperty (xPage, "BorderTop ", "BorderTop");
+ printProperty (xPage, "Height ", "Height");
+ printProperty (xPage, "Width ", "Width");
+ printProperty (xPage, "Number ", "Number");
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception while testing draw page:" + e);
+ }
+ }
+
+ public void printProperty (XInterface xObject, String prefix, String name)
+ {
+ try
+ {
+ XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xObject);
+ maOut.println (prefix +
+ xPropertySet.getPropertyValue (name));
+ }
+ catch (Exception e)
+ {
+ maOut.println ("caught exception while getting property "
+ + name + " : " + e);
+ }
+ }
+
+
+
+ public void showShapes (XDrawPage xPage)
+ {
+ try
+ {
+ XIndexAccess xShapeList = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xPage);
+
+ maOut.println ("There are " + xShapeList.getCount()
+ + " shapes");
+ for (int i=0; i<xShapeList.getCount(); i++)
+ {
+ XShape xShape = (XShape) UnoRuntime.queryInterface(
+ XShape.class, xShapeList.getByIndex (i));
+
+ XShapeDescriptor xShapeDescriptor =
+ (XShapeDescriptor) UnoRuntime.queryInterface(
+ XShapeDescriptor.class, xShape);
+ String sName = xShapeDescriptor.getShapeType ();
+ maOut.println (" shape " + i + " : " + sName);
+
+ XPropertySet xPropertySet =
+ (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xShape);
+ Integer nZOrder =
+ (Integer) xPropertySet.getPropertyValue ("ZOrder");
+ maOut.println (" zorder = " + nZOrder);
+ }
+ }
+ catch (Exception e)
+ {
+ maOut.println ("caught exception in showShapes: " + e);
+ }
+ }
+
+
+
+
+ /** @descr Print all available services of the given object to the
+ standard output.
+ */
+ public void showServices (XInterface xObject)
+ {
+ try
+ {
+ maOut.println ("Services:");
+ XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface (
+ XMultiServiceFactory.class,
+ xObject
+ );
+ if (xMSF == null)
+ maOut.println (" object does not support interface XMultiServiceFactory");
+ else
+ {
+ String[] sServiceNames = xMSF.getAvailableServiceNames ();
+ maOut.println (" object can create "
+ + sServiceNames.length + " services");
+ for (int i=0; i<sServiceNames.length; i++)
+ maOut.println (" service " + i + " : " + sServiceNames[i]);
+ }
+ }
+ catch (Exception e)
+ {
+ maOut.println ("caught exception in showServices : " + e);
+ }
+ }
+
+ /** @descr Print the service and implementation name of the given
+ object.
+ */
+ public void showInfo (XInterface xObject)
+ {
+ try
+ {
+ System.out.println ("Info:");
+ // Use interface XServiceName to retrieve name of (main) service.
+ XServiceName xSN = (XServiceName) UnoRuntime.queryInterface (
+ XServiceName.class, xObject);
+ if (xSN == null)
+ maOut.println (" interface XServiceName not supported");
+ else
+ {
+ maOut.println (" Service name : " + xSN.getServiceName ());
+ }
+
+ // Use interface XServiceInfo to retrieve information about
+ // supported services.
+ XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface (
+ XServiceInfo.class, xObject);
+ if (xSI == null)
+ maOut.println (" interface XServiceInfo not supported");
+ else
+ {
+ maOut.println (" Implementation name : "
+ + xSI.getImplementationName ());
+ }
+ }
+ catch (Exception e)
+ {
+ maOut.println ("caught exception in showInfo : " + e);
+ }
+ }
+
+
+
+
+ /** @descr Print information about supported interfaces.
+ */
+ public void showInterfaces (XInterface xObject)
+ {
+ try
+ {
+ maOut.println ("Interfaces:");
+ // Use interface XTypeProvider to retrieve a list of supported
+ // interfaces.
+ XTypeProvider xTP = (XTypeProvider) UnoRuntime.queryInterface (
+ XTypeProvider.class, xObject);
+ if (xTP == null)
+ maOut.println (" interface XTypeProvider not supported");
+ else
+ {
+ Type[] aTypeList = xTP.getTypes ();
+ maOut.println (" object supports " + aTypeList.length
+ + " interfaces");
+ for (int i=0; i<aTypeList.length; i++)
+ maOut.println (" " + i + " : "
+ + aTypeList[i].getTypeName());
+ }
+ }
+ catch (Exception e)
+ {
+ maOut.println ("caught exception in showInterfaces : " + e);
+ }
+ }
+
+
+ /** @descr Print information concerning the accessibility of the given
+ object.
+ */
+ public boolean showAccessibility (XInterface xObject, int depth)
+ {
+ try
+ {
+ // Create indentation string.
+ String sIndent = "";
+ while (depth-- > 0)
+ sIndent += " ";
+
+ // Get XAccessibleContext object if given object does not
+ // already support this interface.
+ XAccessibleContext xContext
+ = (XAccessibleContext) UnoRuntime.queryInterface (
+ XAccessibleContext.class, xObject);
+ if (xContext == null)
+ {
+ XAccessible xAccessible
+ = (XAccessible) UnoRuntime.queryInterface (
+ XAccessible.class, xObject);
+ if (xAccessible == null)
+ {
+ maOut.println (sIndent + "given object " + xObject
+ + " is not accessible");
+ return false;
+ }
+ else
+ xContext = xAccessible.getAccessibleContext();
+ }
+
+ // Print information about the accessible context.
+ if (xContext != null)
+ {
+ maOut.println (sIndent + "Name : "
+ + xContext.getAccessibleName());
+ maOut.println (sIndent + "Description : "
+ + xContext.getAccessibleDescription());
+ maOut.println (sIndent + "Role : "
+ + xContext.getAccessibleRole());
+ String sHasParent;
+ if (xContext.getAccessibleParent() != null)
+ {
+ maOut.println (sIndent + "Has parent : yes");
+ maOut.println (sIndent + "Parent index : "
+ + xContext.getAccessibleIndexInParent());
+ }
+ else
+ maOut.println (sIndent + "Has parent : no");
+ maOut.println (sIndent + "Child count : "
+ + xContext.getAccessibleChildCount());
+ maOut.print (sIndent + "Relation set : ");
+ XAccessibleRelationSet xRelationSet
+ = xContext.getAccessibleRelationSet();
+ if (xRelationSet != null)
+ {
+ maOut.print (xRelationSet.getRelationCount() + " (");
+ for (int i=0; i<xRelationSet.getRelationCount(); i++)
+ {
+ if (i > 0)
+ maOut.print (", ");
+ maOut.print (xRelationSet.getRelation(i).toString());
+ }
+ maOut.println (")");
+ }
+ else
+ maOut.println ("no relation set");
+
+ maOut.print (sIndent + "State set : ");
+ XAccessibleStateSet xStateSet =
+ xContext.getAccessibleStateSet();
+ if (xStateSet != null)
+ {
+ XIndexAccess xStates =
+ (XIndexAccess) UnoRuntime.queryInterface (
+ XIndexAccess.class, xStateSet);
+ maOut.print (xStates.getCount() + " (");
+ for (int i=0; i<xStates.getCount(); i++)
+ {
+ if (i > 0)
+ maOut.print (", ");
+ maOut.print (xStates.getByIndex(i).toString());
+ }
+ maOut.println (")");
+ }
+ else
+ maOut.println ("no state set");
+
+ showAccessibleComponent (xContext, sIndent);
+ }
+ else
+ maOut.println ("object has no accessible context.");
+
+ // showInfo (xContext);
+ // showServices (xContext);
+ // showInterfaces (xContext);
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception in showAccessibility :" + e);
+ }
+ return true;
+ }
+
+
+
+
+ /** @descr Print information about the given accessible component.
+ */
+ public void showAccessibleComponent (XInterface xObject, String sIndent)
+ {
+ try
+ {
+ XAccessibleComponent xComponent =
+ (XAccessibleComponent) UnoRuntime.queryInterface (
+ XAccessibleComponent.class, xObject);
+
+ // Print information about the accessible context.
+ if (xComponent != null)
+ {
+ maOut.println (sIndent + "Position : "
+ + xComponent.getLocation().X+", "
+ + xComponent.getLocation().Y);
+ maOut.println (sIndent + "Screen position : "
+ + xComponent.getLocationOnScreen().X+", "
+ + xComponent.getLocationOnScreen().Y);
+ maOut.println (sIndent + "Size : "
+ + xComponent.getSize().Width+", "
+ + xComponent.getSize().Height);
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println (
+ "caught exception in showAccessibleComponent : " + e);
+ }
+ }
+
+
+ /** Show a textual representation of the accessibility subtree rooted in
+ xRoot.
+ */
+ public boolean showAccessibilityTree (XAccessible xRoot, int depth)
+ {
+ try
+ {
+ if ( ! showAccessibility (xRoot, depth))
+ return false;
+
+ String sIndent = "";
+ for (int i=0; i<depth; i++)
+ sIndent += " ";
+
+ // Iterate over children and show them.
+ XAccessibleContext xContext = xRoot.getAccessibleContext();
+ if (xContext != null)
+ {
+ int n = xContext.getAccessibleChildCount();
+ for (int i=0; i<n; i++)
+ {
+ maOut.println (sIndent + "child " + i + " :");
+ showAccessibilityTree (xContext.getAccessibleChild(i),depth+1);
+ }
+ }
+ else
+ maOut.println ("Accessible object has no context");
+ }
+ catch (Exception e)
+ {
+ System.out.println (
+ "caught exception in showAccessibleTree : " + e);
+ return false;
+ }
+
+ return true;
+ }
+
+ public void showProperties (XInterface xObject)
+ {
+ XPropertySet xSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, xObject);
+ if (xSet == null)
+ maOut.println ("object does not support XPropertySet");
+ else
+ {
+ XPropertySetInfo xInfo = xSet.getPropertySetInfo ();
+ Property[] aProperties = xInfo.getProperties ();
+ int n = aProperties.length;
+ for (int i=0; i<n; i++)
+ maOut.println (i + " : " + aProperties[i].Name +", " + aProperties[i].Type);
+ }
+ }
+
+ private PrintStream maOut;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/Makefile b/accessibility/workben/org/openoffice/accessibility/misc/Makefile
new file mode 100644
index 000000000000..a33a430c0eaa
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/Makefile
@@ -0,0 +1,69 @@
+#*************************************************************************
+#
+# $RCSfile: Makefile,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+all : package
+
+ROOT=../../../..
+PACKAGE = org.openoffice.accessibility.misc
+SUBDIRS =
+
+include makefile.common
+
+include $(ROOT)/makefile.in
+
+package: subdirs $(CLASS_FILES)
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java b/accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java
new file mode 100644
index 000000000000..d990a517dfc1
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/MessageArea.java
@@ -0,0 +1,125 @@
+package org.openoffice.accessibility.misc;
+
+import java.awt.Font;
+import java.awt.Rectangle;
+import java.awt.Color;
+import java.awt.Graphics;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JScrollBar;
+
+
+
+/** A message area displays text in a scrollable text widget. It is a
+ singleton. Other objects can access it directly to display messages.
+*/
+public class MessageArea
+ extends JScrollPane
+{
+ public static synchronized MessageArea Instance ()
+ {
+ if (saInstance == null)
+ saInstance = new MessageArea ();
+ return saInstance;
+ }
+
+
+
+
+ /** Create a new message area. This method is private because the class is
+ a singleton and may therefore not be instanciated from the outside.
+ */
+ private MessageArea ()
+ {
+ maText = new JTextArea();
+ maText.setBackground (new Color (255,250,240));
+ maText.setFont (new Font ("Helvetica", Font.PLAIN, 9));
+ setViewportView (maText);
+ setVerticalScrollBarPolicy (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ setHorizontalScrollBarPolicy (JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+
+ printMessage (
+ "class path is " + System.getProperty ("java.class.path") + "\n");
+ }
+
+
+
+
+ /** Show the given string at the end of the message area and scroll to make
+ it visible.
+ */
+ public static synchronized void print (String aMessage)
+ {
+ print (0, aMessage);
+ }
+
+
+
+
+ /** Show the given string at the end of the message area and scroll to make
+ it visible. Indent the string as requested.
+ */
+ public static synchronized void print (int nIndentation, String aMessage)
+ {
+ while (nIndentation-- > 0)
+ aMessage = " " + aMessage;
+ Instance().printMessage(aMessage);
+ }
+
+
+
+
+ /** Show the given string at the end of the message area and scroll to make
+ it visible.
+ */
+ public static void println (String aMessage)
+ {
+ println (0, aMessage);
+ }
+
+
+
+
+ /** Show the given string at the end of the message area and scroll to make
+ it visible.
+ */
+ public static void println (int nIndentation, String aMessage)
+ {
+ print (nIndentation, aMessage+"\n");
+ }
+
+
+
+
+ public void paintComponent (Graphics g)
+ {
+ synchronized (g)
+ {
+ JScrollBar sb = getVerticalScrollBar();
+ if (sb != null)
+ {
+ int nScrollBarValue = sb.getMaximum() - sb.getVisibleAmount() - 1;
+ sb.setValue (nScrollBarValue);
+ }
+ super.paintComponent (g);
+ }
+ }
+
+
+
+
+ /** Append the given string to the end of the text and scroll so that it
+ becomes visible. This is an internal method. Use one of the static
+ and public ones.
+ */
+ private synchronized void printMessage (String aMessage)
+ {
+ maText.append (aMessage);
+ }
+
+
+
+
+ private static MessageArea saInstance = null;
+ private JTextArea maText;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java b/accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java
new file mode 100644
index 000000000000..736bc2c7f17b
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/NameProvider.java
@@ -0,0 +1,263 @@
+package org.openoffice.accessibility.misc;
+
+import java.util.HashMap;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.AccessibleRelationType;
+
+
+/** Provide names for several accessibility constants groups.
+*/
+public class NameProvider
+{
+ /** Return the name of the specified state.
+ @param nStateId
+ Id of the state for which to return its name. This is one of
+ the ids listed in the <type>AccessibleStateType</const>
+ constants group.
+ @return
+ Returns the name of the specified state. When an invalid or
+ unknown state id is given then a special string is returned that
+ says that the state does not exist.
+ */
+ public static String getStateName (int nStateId)
+ {
+ String sStateName = (String)maStateMap.get (new Integer(nStateId));
+ if (sStateName == null)
+ sStateName = new String ("<unknown state " + nStateId + ">");
+ return sStateName;
+ }
+
+
+ /** Return the name of the specified event.
+ @param nEventId
+ Id of the event type for which to return its name. This is one
+ of the ids listed in the <type>AccessibleEventId</const>
+ constants group.
+ @return
+ Returns the name of the specified event type or an empty string
+ if an invalid / unknown event id was given.
+ */
+ public static String getEventName (int nEventId)
+ {
+ return (String)maEventMap.get (new Integer(nEventId));
+ }
+
+
+ /** Return the name of the specified role.
+ @param nRole
+ Id of the role for which to return its name. This is one of
+ the ids listed in the <type>AccessibleRole</const>
+ constants group.
+ @return
+ Returns the name of the specified role or an empty string if an
+ invalid / unknown role id was given.
+ */
+ public static String getRoleName (int nRole)
+ {
+ return (String)maRoleMap.get (new Integer(nRole));
+ }
+
+
+ /** Return the name of the specified relation.
+ @param nRelation
+ Id of the relation for which to return its name. This is one of
+ the ids listed in the <type>AccessibleRelationType</const>
+ constants group.
+ @return
+ Returns the name of the specified relation type or an empty
+ string if an invalid / unknown role id was given.
+ */
+ public static String getRelationName (int nRelation)
+ {
+ return (String)maRelationMap.get (new Integer(nRelation));
+ }
+
+
+ private static HashMap maStateMap = new HashMap();
+ private static HashMap maEventMap = new HashMap();
+ private static HashMap maRoleMap = new HashMap();
+ private static HashMap maRelationMap = new HashMap();
+
+ static {
+ maStateMap.put (new Integer (AccessibleStateType.INVALID), "INVALID");
+ maStateMap.put (new Integer (AccessibleStateType.ACTIVE), "ACTIVE");
+ maStateMap.put (new Integer (AccessibleStateType.ARMED), "ARMED");
+ maStateMap.put (new Integer (AccessibleStateType.BUSY), "BUSY");
+ maStateMap.put (new Integer (AccessibleStateType.CHECKED), "CHECKED");
+ // maStateMap.put (new Integer (AccessibleStateType.COLLAPSED), "COLLAPSED");
+ maStateMap.put (new Integer (AccessibleStateType.DEFUNC), "DEFUNC");
+ maStateMap.put (new Integer (AccessibleStateType.EDITABLE), "EDITABLE");
+ maStateMap.put (new Integer (AccessibleStateType.ENABLED), "ENABLED");
+ maStateMap.put (new Integer (AccessibleStateType.EXPANDABLE), "EXPANDABLE");
+ maStateMap.put (new Integer (AccessibleStateType.EXPANDED), "EXPANDED");
+ maStateMap.put (new Integer (AccessibleStateType.FOCUSABLE), "FOCUSABLE");
+ maStateMap.put (new Integer (AccessibleStateType.FOCUSED), "FOCUSED");
+ maStateMap.put (new Integer (AccessibleStateType.HORIZONTAL), "HORIZONTAL");
+ maStateMap.put (new Integer (AccessibleStateType.ICONIFIED), "ICONIFIED");
+ maStateMap.put (new Integer (AccessibleStateType.MODAL), "MODAL");
+ maStateMap.put (new Integer (AccessibleStateType.MULTI_LINE), "MULTI_LINE");
+ maStateMap.put (new Integer (AccessibleStateType.MULTI_SELECTABLE), "MULTI_SELECTABLE");
+ maStateMap.put (new Integer (AccessibleStateType.OPAQUE), "OPAQUE");
+ maStateMap.put (new Integer (AccessibleStateType.PRESSED), "PRESSED");
+ maStateMap.put (new Integer (AccessibleStateType.RESIZABLE), "RESIZABLE");
+ maStateMap.put (new Integer (AccessibleStateType.SELECTABLE), "SELECTABLE");
+ maStateMap.put (new Integer (AccessibleStateType.SELECTED), "SELECTED");
+ maStateMap.put (new Integer (AccessibleStateType.SENSITIVE), "SENSITIVE");
+ maStateMap.put (new Integer (AccessibleStateType.SHOWING), "SHOWING");
+ maStateMap.put (new Integer (AccessibleStateType.SINGLE_LINE), "SINGLE_LINE");
+ maStateMap.put (new Integer (AccessibleStateType.STALE), "STALE");
+ maStateMap.put (new Integer (AccessibleStateType.TRANSIENT), "TRANSIENT");
+ maStateMap.put (new Integer (AccessibleStateType.VERTICAL), "VERTICAL");
+ maStateMap.put (new Integer (AccessibleStateType.VISIBLE), "VISIBLE");
+ maStateMap.put (new Integer (AccessibleStateType.MANAGES_DESCENDANTS),
+ "MANAGES_DESCENDANTS");
+ //maStateMap.put (new Integer (AccessibleStateType.INCONSISTENT),"INCONSISTENT");
+
+
+ maEventMap.put (new Integer (0),
+ "[UNKNOWN]");
+ maEventMap.put (new Integer (AccessibleEventId.NAME_CHANGED),
+ "NAME_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.DESCRIPTION_CHANGED),
+ "DESCRIPTION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.ACTION_CHANGED),
+ "ACTION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.STATE_CHANGED),
+ "STATE_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.ACTIVE_DESCENDANT_CHANGED),
+ "ACTIVE_DESCENDANT_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.BOUNDRECT_CHANGED),
+ "BOUNDRECT_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.CHILD),
+ "CHILD");
+ maEventMap.put (new Integer (AccessibleEventId.INVALIDATE_ALL_CHILDREN),
+ "INVALIDATE_ALL_CHILDREN");
+ maEventMap.put (new Integer (AccessibleEventId.SELECTION_CHANGED),
+ "SELECTION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.VISIBLE_DATA_CHANGED),
+ "VISIBLE_DATA_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.VALUE_CHANGED),
+ "VALUE_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.CONTENT_FLOWS_FROM_RELATION_CHANGED),
+ "CONTENT_FLOWS_FROM_RELATION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.CONTENT_FLOWS_TO_RELATION_CHANGED),
+ "CONTENT_FLOWS_TO_RELATION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.CONTROLLED_BY_RELATION_CHANGED),
+ "CONTROLLED_BY_RELATION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.CONTROLLER_FOR_RELATION_CHANGED),
+ "CONTROLLER_FOR_RELATION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.LABEL_FOR_RELATION_CHANGED),
+ "LABEL_FOR_RELATION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.LABELED_BY_RELATION_CHANGED),
+ "LABELED_BY_RELATION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.MEMBER_OF_RELATION_CHANGED),
+ "MEMBER_OF_RELATION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.SUB_WINDOW_OF_RELATION_CHANGED),
+ "SUB_WINDOW_OF_RELATION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.CARET_CHANGED),
+ "CARET_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TEXT_SELECTION_CHANGED),
+ "TEXT_SELECTION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TEXT_CHANGED),
+ "TEXT_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TEXT_ATTRIBUTE_CHANGED),
+ "TEXT_ATTRIBUTE_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.HYPERTEXT_CHANGED),
+ "HYPERTEXT_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TABLE_CAPTION_CHANGED),
+ "TABLE_CAPTION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TABLE_COLUMN_DESCRIPTION_CHANGED),
+ "TABLE_COLUMN_DESCRIPTION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TABLE_COLUMN_HEADER_CHANGED),
+ "TABLE_COLUMN_HEADER_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TABLE_MODEL_CHANGED),
+ "TABLE_MODEL_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TABLE_ROW_DESCRIPTION_CHANGED),
+ "TABLE_ROW_DESCRIPTION_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TABLE_ROW_HEADER_CHANGED),
+ "TABLE_ROW_HEADER_CHANGED");
+ maEventMap.put (new Integer (AccessibleEventId.TABLE_SUMMARY_CHANGED),
+ "TABLE_SUMMARY_CHANGED");
+
+ maRoleMap.put (new Integer(AccessibleRole.UNKNOWN), "UNKNOWN");
+ maRoleMap.put (new Integer (AccessibleRole.UNKNOWN), "UNKNOWN");
+ maRoleMap.put (new Integer (AccessibleRole.ALERT), "ALERT");
+ maRoleMap.put (new Integer (AccessibleRole.COLUMN_HEADER), "COLUMN_HEADER");
+ maRoleMap.put (new Integer (AccessibleRole.CANVAS), "CANVAS");
+ maRoleMap.put (new Integer (AccessibleRole.CHECK_BOX), "CHECK_BOX");
+ maRoleMap.put (new Integer (AccessibleRole.CHECK_MENU_ITEM), "CHECK_MENU_ITEM");
+ maRoleMap.put (new Integer (AccessibleRole.COLOR_CHOOSER), "COLOR_CHOOSER");
+ maRoleMap.put (new Integer (AccessibleRole.COMBO_BOX), "COMBO_BOX");
+ maRoleMap.put (new Integer (AccessibleRole.DESKTOP_ICON), "DESKTOP_ICON");
+ maRoleMap.put (new Integer (AccessibleRole.DESKTOP_PANE), "DESKTOP_PANE");
+ maRoleMap.put (new Integer (AccessibleRole.DIRECTORY_PANE), "DIRECTORY_PANE");
+ maRoleMap.put (new Integer (AccessibleRole.DIALOG), "DIALOG");
+ maRoleMap.put (new Integer (AccessibleRole.DOCUMENT), "DOCUMENT");
+ maRoleMap.put (new Integer (AccessibleRole.EMBEDDED_OBJECT), "EMBEDDED_OBJECT");
+ maRoleMap.put (new Integer (AccessibleRole.END_NOTE), "END_NOTE");
+ maRoleMap.put (new Integer (AccessibleRole.FILE_CHOOSER), "FILE_CHOOSER");
+ maRoleMap.put (new Integer (AccessibleRole.FILLER), "FILLER");
+ maRoleMap.put (new Integer (AccessibleRole.FONT_CHOOSER), "FONT_CHOOSER");
+ maRoleMap.put (new Integer (AccessibleRole.FOOTER), "FOOTER");
+ maRoleMap.put (new Integer (AccessibleRole.FOOTNOTE), "FOOTNOTE");
+ maRoleMap.put (new Integer (AccessibleRole.FRAME), "FRAME");
+ maRoleMap.put (new Integer (AccessibleRole.GLASS_PANE), "GLASS_PANE");
+ maRoleMap.put (new Integer (AccessibleRole.GRAPHIC), "GRAPHIC");
+ maRoleMap.put (new Integer (AccessibleRole.GROUP_BOX), "GROUP_BOX");
+ maRoleMap.put (new Integer (AccessibleRole.HEADER), "HEADER");
+ maRoleMap.put (new Integer (AccessibleRole.HEADING), "HEADING");
+ maRoleMap.put (new Integer (AccessibleRole.HYPER_LINK), "HYPER_LINK");
+ maRoleMap.put (new Integer (AccessibleRole.ICON), "ICON");
+ maRoleMap.put (new Integer (AccessibleRole.INTERNAL_FRAME), "INTERNAL_FRAME");
+ maRoleMap.put (new Integer (AccessibleRole.LABEL), "LABEL");
+ maRoleMap.put (new Integer (AccessibleRole.LAYERED_PANE), "LAYERED_PANE");
+ maRoleMap.put (new Integer (AccessibleRole.LIST), "LIST");
+ maRoleMap.put (new Integer (AccessibleRole.LIST_ITEM), "LIST_ITEM");
+ maRoleMap.put (new Integer (AccessibleRole.MENU), "MENU");
+ maRoleMap.put (new Integer (AccessibleRole.MENU_BAR), "MENU_BAR");
+ maRoleMap.put (new Integer (AccessibleRole.MENU_ITEM), "MENU_ITEM");
+ maRoleMap.put (new Integer (AccessibleRole.OPTION_PANE), "OPTION_PANE");
+ maRoleMap.put (new Integer (AccessibleRole.PAGE_TAB), "PAGE_TAB");
+ maRoleMap.put (new Integer (AccessibleRole.PAGE_TAB_LIST), "PAGE_TAB_LIST");
+ maRoleMap.put (new Integer (AccessibleRole.PANEL), "PANEL");
+ maRoleMap.put (new Integer (AccessibleRole.PARAGRAPH), "PARAGRAPH");
+ maRoleMap.put (new Integer (AccessibleRole.PASSWORD_TEXT), "PASSWORD_TEXT");
+ maRoleMap.put (new Integer (AccessibleRole.POPUP_MENU), "POPUP_MENU");
+ maRoleMap.put (new Integer (AccessibleRole.PUSH_BUTTON), "PUSH_BUTTON");
+ maRoleMap.put (new Integer (AccessibleRole.PROGRESS_BAR), "PROGRESS_BAR");
+ maRoleMap.put (new Integer (AccessibleRole.RADIO_BUTTON), "RADIO_BUTTON");
+ maRoleMap.put (new Integer (AccessibleRole.RADIO_MENU_ITEM), "RADIO_MENU_ITEM");
+ maRoleMap.put (new Integer (AccessibleRole.ROW_HEADER), "ROW_HEADER");
+ maRoleMap.put (new Integer (AccessibleRole.ROOT_PANE), "ROOT_PANE");
+ maRoleMap.put (new Integer (AccessibleRole.SCROLL_BAR), "SCROLL_BAR");
+ maRoleMap.put (new Integer (AccessibleRole.SCROLL_PANE), "SCROLL_PANE");
+ maRoleMap.put (new Integer (AccessibleRole.SHAPE), "SHAPE");
+ maRoleMap.put (new Integer (AccessibleRole.SEPARATOR), "SEPARATOR");
+ maRoleMap.put (new Integer (AccessibleRole.SLIDER), "SLIDER");
+ maRoleMap.put (new Integer (AccessibleRole.SPIN_BOX), "SPIN_BOX");
+ maRoleMap.put (new Integer (AccessibleRole.SPLIT_PANE), "SPLIT_PANE");
+ maRoleMap.put (new Integer (AccessibleRole.STATUS_BAR), "STATUS_BAR");
+ maRoleMap.put (new Integer (AccessibleRole.TABLE), "TABLE");
+ maRoleMap.put (new Integer (AccessibleRole.TABLE_CELL), "TABLE_CELL");
+ maRoleMap.put (new Integer (AccessibleRole.TEXT), "TEXT");
+ maRoleMap.put (new Integer (AccessibleRole.TEXT_FRAME), "TEXT_FRAME");
+ maRoleMap.put (new Integer (AccessibleRole.TOGGLE_BUTTON), "TOGGLE_BUTTON");
+ maRoleMap.put (new Integer (AccessibleRole.TOOL_BAR), "TOOL_BAR");
+ maRoleMap.put (new Integer (AccessibleRole.TOOL_TIP), "TOOL_TIP");
+ maRoleMap.put (new Integer (AccessibleRole.TREE), "TREE");
+ maRoleMap.put (new Integer (AccessibleRole.VIEW_PORT), "VIEW_PORT");
+ maRoleMap.put (new Integer (AccessibleRole.WINDOW), "WINDOW");
+
+ maRelationMap.put (new Integer (AccessibleRelationType.INVALID), "INVALID");
+ maRelationMap.put (new Integer (AccessibleRelationType.CONTENT_FLOWS_FROM), "CONTENT_FLOWS_FROM");
+ maRelationMap.put (new Integer (AccessibleRelationType.CONTENT_FLOWS_TO), "CONTENT_FLOWS_TO");
+ maRelationMap.put (new Integer (AccessibleRelationType.CONTROLLED_BY), "CONTROLLED_BY");
+ maRelationMap.put (new Integer (AccessibleRelationType.CONTROLLER_FOR), "CONTROLLER_FOR");
+ maRelationMap.put (new Integer (AccessibleRelationType.LABEL_FOR), "LABEL_FOR");
+ maRelationMap.put (new Integer (AccessibleRelationType.LABELED_BY), "LABELED_BY");
+ maRelationMap.put (new Integer (AccessibleRelationType.MEMBER_OF), "MEMBER_OF");
+ maRelationMap.put (new Integer (AccessibleRelationType.SUB_WINDOW_OF), "SUB_WINDOW_OF");
+ }
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java b/accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java
new file mode 100644
index 000000000000..d9f77d9e4e07
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/OfficeConnection.java
@@ -0,0 +1,169 @@
+package org.openoffice.accessibility.misc;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.PrintStream;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.Vector;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.bridge.XUnoUrlResolver;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.comp.helper.Bootstrap;
+
+/** This class establishes a connection to a StarOffice application.
+ */
+public class OfficeConnection
+ extends TimerTask
+{
+ final public static long snDelay = 3000;
+
+ public static synchronized OfficeConnection Instance ()
+ {
+ if (saInstance == null)
+ saInstance = new OfficeConnection ();
+ return saInstance;
+ }
+
+
+
+
+ static public void SetPipeName (String sPipeName)
+ {
+ ssDefaultPipeName = sPipeName;
+ }
+
+
+
+
+ public void AddConnectionListener (ActionListener aListener)
+ {
+ SimpleOffice aOffice = SimpleOffice.Instance();
+ if (IsValid())
+ aListener.actionPerformed (
+ new ActionEvent (aOffice,0,"<connected>"));
+ maListeners.add (aListener);
+ }
+
+
+
+ /** @descr Return the service manager that represents the connected
+ StarOffice application
+ */
+ public XMultiServiceFactory GetServiceManager ()
+ {
+ return maServiceManager;
+ }
+
+
+
+
+ /** Return a flag that indicates if the constructor has been able to
+ establish a valid connection.
+ */
+ public boolean IsValid ()
+ {
+ return (maServiceManager != null);
+ }
+
+
+
+
+ /** Connect to a already running StarOffice application that has
+ been started with a command line argument like
+ "-accept=pipe,name=<username>;urp;"
+ */
+ private boolean Connect ()
+ {
+ mbInitialized = true;
+ // Set up connection string.
+ String sConnectString = "uno:pipe,name=" + msPipeName
+ + ";urp;StarOffice.ServiceManager";
+
+ // connect to a running office and get the ServiceManager
+ try
+ {
+ // Create a URL Resolver.
+ XMultiServiceFactory aLocalServiceManager =
+ Bootstrap.createSimpleServiceManager();
+ XUnoUrlResolver aURLResolver =
+ (XUnoUrlResolver) UnoRuntime.queryInterface (
+ XUnoUrlResolver.class,
+ aLocalServiceManager.createInstance (
+ "com.sun.star.bridge.UnoUrlResolver")
+ );
+
+ maServiceManager =
+ (XMultiServiceFactory) UnoRuntime.queryInterface (
+ XMultiServiceFactory.class,
+ aURLResolver.resolve (sConnectString)
+ );
+ }
+
+ catch (Exception e)
+ {
+ if (maOut != null)
+ {
+ maOut.println ("Could not connect with "
+ + sConnectString + " : " + e);
+ maOut.println ("Please start OpenOffice/StarOffice with "
+ + "\"-accept=pipe,name=" + msPipeName + ";urp;\"");
+ }
+ }
+
+ return maServiceManager != null;
+ }
+
+
+ public void run ()
+ {
+ if ( ! IsValid())
+ {
+ MessageArea.println ("trying to connect");
+ if (Connect())
+ {
+ // Stop the timer.
+ cancel ();
+
+ ActionEvent aEvent = new ActionEvent (this,0,"<connected>");
+ for (int i=0; i<maListeners.size(); i++)
+ ((ActionListener)maListeners.elementAt(i)).actionPerformed(aEvent);
+ }
+ }
+ }
+
+ private OfficeConnection ()
+ {
+ this (null);
+ }
+
+
+ private OfficeConnection (PrintStream aOut)
+ {
+ msPipeName = ssDefaultPipeName;
+ maOut = aOut;
+ maListeners = new Vector();
+ maServiceManager = null;
+
+ maTimer = new Timer (true);
+ maTimer.schedule (this, 0, snDelay);
+ }
+
+
+ private static OfficeConnection saInstance = null;
+ private static String ssDefaultPipeName = System.getenv( "USER" );
+
+ private XMultiServiceFactory maServiceManager;
+ String msPipeName;
+
+ /** A value of true just indicates that it has been tried to establish a connection,
+ not that that has been successfull.
+ */
+ private boolean mbInitialized = false;
+
+ /// Stream used to print messages.
+ private PrintStream maOut;
+ private Timer maTimer;
+ private Vector maListeners;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/Options.java b/accessibility/workben/org/openoffice/accessibility/misc/Options.java
new file mode 100644
index 000000000000..e3c358264a1d
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/Options.java
@@ -0,0 +1,106 @@
+package org.openoffice.accessibility.misc;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Properties;
+
+
+/** Load from and save options into a file.
+*/
+public class Options
+ extends Properties
+{
+ static public Options Instance ()
+ {
+ if (saOptions == null)
+ saOptions = new Options ();
+ return saOptions;
+ }
+
+ static public void SetString (String sName, String sValue)
+ {
+ Instance().setProperty (sName, sValue);
+ Instance().Save ();
+ }
+
+ static public String GetString (String sName)
+ {
+ return Instance().getProperty (sName);
+ }
+
+ static public void SetBoolean (String sName, boolean bValue)
+ {
+ Instance().setProperty (sName, Boolean.toString(bValue));
+ Instance().Save ();
+ }
+
+ static public boolean GetBoolean (String sName)
+ {
+ return Boolean.valueOf(Instance().getProperty (sName)).booleanValue();
+ }
+
+ static public void SetInteger (String sName, int nValue)
+ {
+ Instance().setProperty (sName, Integer.toString(nValue));
+ Instance().Save ();
+ }
+
+ static public int GetInteger (String sName, int nDefault)
+ {
+ String sValue = Instance().getProperty (sName);
+ if (sValue == null)
+ return nDefault;
+ else
+ return Integer.parseInt (sValue);
+ }
+
+ public void Load (String sBaseName)
+ {
+ try
+ {
+ load (new FileInputStream (ProvideFile(sBaseName)));
+ }
+ catch (java.io.IOException e)
+ {
+ // Ignore a non-existing options file.
+ }
+ }
+
+ public void Save (String sBaseName)
+ {
+ ProvideFile(sBaseName);
+ Save ();
+ }
+
+ public void Save ()
+ {
+ if (maFile != null)
+ {
+ try
+ {
+ store (new FileOutputStream (maFile), null);
+ }
+ catch (java.io.IOException e)
+ {
+ }
+ }
+ }
+
+ private Options ()
+ {
+ maFile = null;
+ }
+
+ private File ProvideFile (String sBaseName)
+ {
+ maFile = new File (
+ System.getProperty ("user.home"),
+ sBaseName);
+ return maFile;
+ }
+
+ static private Options saOptions = null;
+ private File maFile;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/SimpleOffice.java b/accessibility/workben/org/openoffice/accessibility/misc/SimpleOffice.java
new file mode 100644
index 000000000000..3a2dcdf21926
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/SimpleOffice.java
@@ -0,0 +1,413 @@
+package org.openoffice.accessibility.misc;
+
+import java.lang.Thread;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XChild;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XEnumeration;
+
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XTasksSupplier;
+import com.sun.star.frame.XTask;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XServiceName;
+import com.sun.star.lang.XTypeProvider;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.Type;
+
+import com.sun.star.drawing.XDrawView;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapeDescriptor;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleRelationSet;
+import com.sun.star.accessibility.XAccessibleStateSet;
+
+
+/** This singleton class tries to simplify some tasks like loading a document
+ or getting various objects.
+*/
+public class SimpleOffice
+{
+ synchronized static public SimpleOffice Instance ()
+ {
+ if (saInstance == null)
+ saInstance = new SimpleOffice ();
+
+ return saInstance;
+ }
+
+ synchronized static public void Clear ()
+ {
+ saInstance = null;
+ }
+
+
+ public XModel LoadDocument (String URL)
+ {
+ XModel xModel = null;
+ try
+ {
+ // Load the document from the specified URL.
+ XComponentLoader xLoader =
+ (XComponentLoader)UnoRuntime.queryInterface(
+ XComponentLoader.class, mxDesktop);
+
+ XComponent xComponent = xLoader.loadComponentFromURL (
+ URL,
+ "_blank",
+ 0,
+ new PropertyValue[0]
+ );
+
+ xModel = (XModel) UnoRuntime.queryInterface(
+ XModel.class, xComponent);
+ }
+ catch (java.lang.NullPointerException e)
+ {
+ MessageArea.println ("caught exception while loading "
+ + URL + " : " + e);
+ }
+ catch (Exception e)
+ {
+ MessageArea.println ("caught exception while loading "
+ + URL + " : " + e);
+ }
+ return xModel;
+ }
+
+
+
+
+ public XModel GetModel (String name)
+ {
+ XModel xModel = null;
+ try
+ {
+ XTasksSupplier xTasksSupplier =
+ (XTasksSupplier) UnoRuntime.queryInterface(
+ XTasksSupplier.class, mxDesktop);
+ XEnumerationAccess xEA = xTasksSupplier.getTasks();
+ XEnumeration xE = xEA.createEnumeration();
+ while (xE.hasMoreElements())
+ {
+ XTask xTask = (XTask) UnoRuntime.queryInterface(
+ XTask.class, xE.nextElement());
+ MessageArea.print (xTask.getName());
+ }
+ }
+ catch (Exception e)
+ {
+ MessageArea.println ("caught exception while getting Model " + name
+ + ": " + e);
+ }
+ return xModel;
+ }
+
+
+ public XModel GetModel (XDrawView xView)
+ {
+ XController xController = (XController) UnoRuntime.queryInterface(
+ XController.class, xView);
+ if (xController != null)
+ return xController.getModel();
+ else
+ {
+ MessageArea.println ("can't cast view to controller");
+ return null;
+ }
+ }
+
+
+
+
+ public XDesktop GetDesktop ()
+ {
+ if (mxDesktop != null)
+ return mxDesktop;
+ try
+ {
+ // Get the factory of the connected office.
+ XMultiServiceFactory xMSF =
+ OfficeConnection.Instance().GetServiceManager ();
+ if (xMSF == null)
+ {
+ MessageArea.println ("can't connect to office");
+ return null;
+ }
+ else
+ MessageArea.println ("Connected successfully.");
+
+ // Create a new desktop.
+ mxDesktop = (XDesktop) UnoRuntime.queryInterface(
+ XDesktop.class,
+ xMSF.createInstance ("com.sun.star.frame.Desktop")
+ );
+ }
+ catch (Exception e)
+ {
+ MessageArea.println ("caught exception while creating desktop: "
+ + e);
+ }
+
+ return mxDesktop;
+ }
+
+
+ /** Return a reference to the extended toolkit which is a broadcaster of
+ top window, key, and focus events.
+ */
+ public XExtendedToolkit GetExtendedToolkit ()
+ {
+ XExtendedToolkit xToolkit = null;
+ if (this != null)
+ try
+ {
+ // Get the factory of the connected office.
+ XMultiServiceFactory xMSF =
+ OfficeConnection.Instance().GetServiceManager ();
+ if (xMSF != null)
+ {
+ xToolkit = (XExtendedToolkit) UnoRuntime.queryInterface(
+ XExtendedToolkit.class,
+ xMSF.createInstance ("stardiv.Toolkit.VCLXToolkit")
+ );
+ }
+ }
+ catch (Exception e)
+ {
+ MessageArea.println (
+ "caught exception while creating extended toolkit: " + e);
+ }
+
+ return xToolkit;
+ }
+
+
+
+ static public XAccessible GetAccessibleObject (XInterface xObject)
+ {
+ XAccessible xAccessible = null;
+ try
+ {
+ xAccessible = (XAccessible) UnoRuntime.queryInterface(
+ XAccessible.class, xObject);
+ }
+ catch (Exception e)
+ {
+ System.err.println (
+ "caught exception while getting accessible object" + e);
+ e.printStackTrace (System.err);
+ }
+ return xAccessible;
+ }
+
+ static public XAccessibleContext GetAccessibleContext (XInterface xObject)
+ {
+ XAccessible xAccessible = GetAccessibleObject (xObject);
+ if (xAccessible != null)
+ return xAccessible.getAccessibleContext();
+ else
+ return null;
+ }
+
+ /** Return the root object of the accessibility hierarchy.
+ */
+ public XAccessible GetAccessibleRoot (XAccessible xAccessible)
+ {
+ try
+ {
+ XAccessible xParent = null;
+ do
+ {
+ XAccessibleContext xContext = xAccessible.getAccessibleContext();
+ if (xContext != null)
+ xParent = xContext.getAccessibleParent();
+ if (xParent != null)
+ xAccessible = xParent;
+ }
+ while (xParent != null);
+ }
+ catch (Exception e)
+ {
+ MessageArea.println (
+ "caught exception while getting accessible root" + e);
+ e.printStackTrace();
+ }
+ return xAccessible;
+ }
+
+
+
+
+ /** @descr Return the current window associated with the given
+ model.
+ */
+ public XWindow GetCurrentWindow ()
+ {
+ return GetCurrentWindow ((XModel) UnoRuntime.queryInterface(
+ XModel.class, GetDesktop()));
+ }
+
+
+
+
+
+ public XWindow GetCurrentWindow (XModel xModel)
+ {
+ XWindow xWindow = null;
+ try
+ {
+ if (xModel == null)
+ MessageArea.println ("invalid model (==null)");
+ XController xController = xModel.getCurrentController();
+ if (xController == null)
+ MessageArea.println ("can't get controller from model");
+ XFrame xFrame = xController.getFrame();
+ if (xFrame == null)
+ MessageArea.println ("can't get frame from controller");
+ xWindow = xFrame.getComponentWindow ();
+ if (xWindow == null)
+ MessageArea.println ("can't get window from frame");
+ }
+ catch (Exception e)
+ {
+ MessageArea.println ("caught exception while getting current window" + e);
+ }
+
+ return xWindow;
+ }
+
+
+ /** @descr Return the current draw page of the given desktop.
+ */
+ public XDrawPage GetCurrentDrawPage ()
+ {
+ return GetCurrentDrawPage (
+ (XDrawView) UnoRuntime.queryInterface(
+ XDrawView.class,
+ GetCurrentView()));
+ }
+
+
+
+
+ public XDrawPage GetCurrentDrawPage (XDrawView xView)
+ {
+ XDrawPage xPage = null;
+ try
+ {
+ if (xView == null)
+ MessageArea.println ("can't get current draw page from null view");
+ else
+ xPage = xView.getCurrentPage();
+ }
+ catch (Exception e)
+ {
+ MessageArea.println ("caught exception while getting current draw page : " + e);
+ }
+
+ return xPage;
+ }
+
+
+
+
+ /** @descr Return the current view of the given desktop.
+ */
+ public XDrawView GetCurrentView ()
+ {
+ return GetCurrentView (GetDesktop());
+ }
+
+ public XDrawView GetCurrentView (XDesktop xDesktop)
+ {
+ if (xDesktop == null)
+ MessageArea.println ("can't get desktop to retrieve current view");
+
+ XDrawView xView = null;
+ try
+ {
+ XComponent xComponent = xDesktop.getCurrentComponent();
+ if (xComponent == null)
+ MessageArea.println ("can't get component to retrieve current view");
+
+ XFrame xFrame = xDesktop.getCurrentFrame();
+ if (xFrame == null)
+ MessageArea.println ("can't get frame to retrieve current view");
+
+ XController xController = xFrame.getController();
+ if (xController == null)
+ MessageArea.println ("can't get controller to retrieve current view");
+
+ xView = (XDrawView) UnoRuntime.queryInterface(
+ XDrawView.class, xController);
+ if (xView == null)
+ MessageArea.println ("could not cast controller into view");
+ }
+ catch (Exception e)
+ {
+ MessageArea.println ("caught exception while getting current view : " + e);
+ }
+
+ return xView;
+ }
+
+
+
+
+ // Return the accessible object of the document window.
+ public static XAccessible GetAccessibleDocumentWindow (XDrawPage xPage)
+ {
+ XIndexAccess xShapeList = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xPage);
+ if (xShapeList.getCount() > 0)
+ {
+ // All shapes return as accessible object the document window's
+ // accessible object. This is, of course, a hack and will be
+ // removed as soon as the missing infrastructure for obtaining
+ // the object directly is implemented.
+ XShape xShape = null;
+ try{
+ xShape = (XShape) UnoRuntime.queryInterface(
+ XShape.class, xShapeList.getByIndex (0));
+ } catch (Exception e)
+ {}
+ XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface (
+ XAccessible.class, xShape);
+ return xAccessible;
+ }
+ else
+ return null;
+ }
+
+ private SimpleOffice ()
+ {
+ }
+
+
+
+ private XDesktop mxDesktop;
+ private static SimpleOffice saInstance = null;
+}
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/makefile.common b/accessibility/workben/org/openoffice/accessibility/misc/makefile.common
new file mode 100644
index 000000000000..d06336e12c56
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/makefile.common
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.common,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+JARFILES = sandbox.jar jurt.jar unoil.jar ridl.jar juh.jar java_uno.jar
+JAVAFILES = \
+ AccessibleEventMulticaster.java \
+ InformationWriter.java \
+ MessageArea.java \
+ NameProvider.java \
+ OfficeConnection.java \
+ Options.java \
+ SimpleOffice.java
diff --git a/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk b/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk
new file mode 100644
index 000000000000..f0b71f860c3e
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJNAME = awb
+PRJ = ..$/..$/..$/..$/..
+TARGET = java_misc
+PACKAGE = org$/openoffice$/accessibility$/misc
+
+USE_JAVAVER:=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(JAVAVER:s/.//)" >= "140"
+
+.INCLUDE : makefile.common
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+#JARTARGET = $(TARGET).jar
+#JARCOMPRESS = TRUE
+#JARCLASSDIRS = $(PACKAGE) org/openoffice/java/accessibility/awb
+#CUSTOMMANIFESTFILE = manifest
+.ENDIF
+
+# --- Targets ------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
diff --git a/automation/source/communi/communi.cxx b/automation/source/communi/communi.cxx
index 55b72e1031e2..6f79551ecd72 100644
--- a/automation/source/communi/communi.cxx
+++ b/automation/source/communi/communi.cxx
@@ -260,7 +260,7 @@ long CommunicationLinkViaSocket::DataReceived( void* EMPTYARG )
IMPL_LINK( CommunicationLinkViaSocket, PutDataReceivedHdl, CommunicationLinkViaSocket*, EMPTYARG )
{
- nDataReceivedEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationLinkViaSocket, DataReceived ) );
+ nDataReceivedEventId = GetpApp()->PostUserEvent( LINK( this, CommunicationLink, DataReceived ) );
return 0;
}
diff --git a/automation/source/server/server.cxx b/automation/source/server/server.cxx
index 5d84cb6cd75d..988f4055a2eb 100644
--- a/automation/source/server/server.cxx
+++ b/automation/source/server/server.cxx
@@ -805,7 +805,7 @@ BOOL ImplRemoteControl::QueCommands( ULONG nServiceId, SvStream *pIn )
break;
}
default:
- DBG_ERROR1( "Unbekannter Request Nr:%il", nId );
+ DBG_ERROR1( "Unbekannter Request Nr:%i", nId );
break;
}
if( !pIn->IsEof() )
diff --git a/automation/source/testtool/makefile.mk b/automation/source/testtool/makefile.mk
index 4cb27a48ddd4..79a811fdaee7 100644
--- a/automation/source/testtool/makefile.mk
+++ b/automation/source/testtool/makefile.mk
@@ -103,12 +103,15 @@ $(MISC)$/xfilter.pl : filter.pl
.IF "$(GUI)"=="UNX"
INIFILESUFFIX=rc
+BRANDPATH=none
.ELIF "$(GUI)"=="WNT" || "$(GUI)"=="OS2"
INIFILESUFFIX=.ini
+BRANDPATH=..
.END
$(BIN)$/testtool$(INIFILESUFFIX): testtool.ini
- $(SED) -e s/$(EMQ)!INIFILESUFFIX$(EMQ)!/$(INIFILESUFFIX)/ < $< > $@
+ $(SED) -e s/$(EMQ)!INIFILESUFFIX$(EMQ)!/$(INIFILESUFFIX)/ \
+ -e s/$(EMQ)!BRANDPATH$(EMQ)!/$(BRANDPATH)/ < $< > $@
ALLTAR: \
$(BIN)$/testtool$(INIFILESUFFIX)
diff --git a/automation/source/testtool/tcommuni.cxx b/automation/source/testtool/tcommuni.cxx
index f341bd3efe36..3ac135829f6d 100644
--- a/automation/source/testtool/tcommuni.cxx
+++ b/automation/source/testtool/tcommuni.cxx
@@ -36,7 +36,6 @@
#include <vcl/svapp.hxx>
#include <tools/time.hxx>
#include <tools/debug.hxx>
-#include <vos/process.hxx>
#include <vcl/timer.hxx>
#ifndef _BASIC_TTRESHLP_HXX
diff --git a/automation/source/testtool/testtool.ini b/automation/source/testtool/testtool.ini
index bf1b54c8777e..ff2e43f5c0f6 100644
--- a/automation/source/testtool/testtool.ini
+++ b/automation/source/testtool/testtool.ini
@@ -1,7 +1,7 @@
[Bootstrap]
URE_BOOTSTRAP=${ORIGIN}/fundamentalbasis!INIFILESUFFIX!
OOO_BASE_DIR=${ORIGIN}/..
-BRAND_BASE_DIR=${OOO_BASE_DIR}/none
+BRAND_BASE_DIR=${OOO_BASE_DIR}/!BRANDPATH!
UserInstallation=${SYSUSERCONFIG}/.oootesttool
[Misc]
diff --git a/automation/util/makefile.mk b/automation/util/makefile.mk
index f96910a01325..8d68000c7c5a 100644
--- a/automation/util/makefile.mk
+++ b/automation/util/makefile.mk
@@ -157,7 +157,6 @@ APP1STDLIBS+= \
$(SVLLIB) \
$(VCLLIB) \
$(SALLIB) \
- $(SJLIB) \
$(VOSLIB) \
$(UCBHELPERLIB) \
$(COMPHELPERLIB) \
@@ -221,8 +220,7 @@ APP3STDLIBS= \
$(SALLIB) \
$(TOOLSLIB) \
$(SVTOOLLIB) \
- $(VCLLIB) \
- $(SJLIB)
+ $(VCLLIB)
.IF "$(GUI)"=="UNX"
.IF "$(OS)"=="MACOSX"
diff --git a/automation/util/manually_added_ids.hid b/automation/util/manually_added_ids.hid
index 1a76246e5128..7372dc0d9879 100755
--- a/automation/util/manually_added_ids.hid
+++ b/automation/util/manually_added_ids.hid
@@ -3,11 +3,6 @@ MSC_Super_ID 123456
MSC_Super_ID2 1234567
MSC_Super_ID3 12345678
-HID_OPTIONS_JAVA_LIST 39997
-
-PDF1TBO 867876864
-PDF2TBO 867860480
-
FontWork1TBO 40026
FontWork2TBO 40027
diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc
index af2e4371484a..d4f048cda8d7 100644
--- a/basctl/inc/basidesh.hrc
+++ b/basctl/inc/basidesh.hrc
@@ -177,6 +177,15 @@
#define RID_STR_EXPORTBASIC ( RID_BASICIDE_START + 101 )
#define RID_STR_PACKAGE_BUNDLE ( RID_BASICIDE_START + 102 )
+#define RID_STR_DLGIMP_CLASH_RENAME ( RID_BASICIDE_START + 110 )
+#define RID_STR_DLGIMP_CLASH_REPLACE ( RID_BASICIDE_START + 111 )
+#define RID_STR_DLGIMP_CLASH_TITLE ( RID_BASICIDE_START + 112 )
+#define RID_STR_DLGIMP_CLASH_TEXT ( RID_BASICIDE_START + 113 )
+#define RID_STR_DLGIMP_MISMATCH_ADD ( RID_BASICIDE_START + 114 )
+#define RID_STR_DLGIMP_MISMATCH_OMIT ( RID_BASICIDE_START + 115 )
+#define RID_STR_DLGIMP_MISMATCH_TITLE ( RID_BASICIDE_START + 116 )
+#define RID_STR_DLGIMP_MISMATCH_TEXT ( RID_BASICIDE_START + 117 )
+
#endif // _SVX_NOIDERESIDS
#endif // _BASIDESH_HRC
diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi
index a665ad8e505f..2ada0ff3159c 100644
--- a/basctl/sdi/baside.sdi
+++ b/basctl/sdi/baside.sdi
@@ -416,6 +416,12 @@ shell BasicIDEShell
StateMethod = GetState;
]
+ SID_IMPORT_DIALOG
+ [
+ ExecMethod = ExecuteDialog;
+ StateMethod = GetState;
+ ]
+
SID_DIALOG_TESTMODE
[
ExecMethod = ExecuteDialog;
diff --git a/basctl/sdi/makefile.mk b/basctl/sdi/makefile.mk
index abb072712ceb..d94921bf9ae2 100644
--- a/basctl/sdi/makefile.mk
+++ b/basctl/sdi/makefile.mk
@@ -38,7 +38,7 @@ TARGET=basslots
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
-
+.IF "$(L10N_framework)"==""
SDI1NAME=$(TARGET)
SDI1EXPORT=basctl
@@ -49,6 +49,6 @@ SVSDI1DEPEND= \
baside.sdi
# --- Targets -------------------------------------------------------
-
+.ENDIF
.INCLUDE : target.mk
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 964d88353688..9d0a5fc38c7a 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -542,6 +542,15 @@ BOOL ModulWindow::SaveBasicSource()
return bDone;
}
+BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName );
+
+BOOL ModulWindow::ImportDialog()
+{
+ const ScriptDocument& rDocument = GetDocument();
+ String aLibName = GetLibName();
+ BOOL bRet = implImportDialog( this, aCurPath, rDocument, aLibName );
+ return bRet;
+}
BOOL ModulWindow::ToggleBreakPoint( ULONG nLine )
{
@@ -1032,6 +1041,11 @@ void __EXPORT ModulWindow::ExecuteCommand( SfxRequest& rReq )
SaveBasicSource();
}
break;
+ case SID_IMPORT_DIALOG:
+ {
+ ImportDialog();
+ }
+ break;
case SID_BASICIDE_MATCHGROUP:
{
if ( !GetEditView()->MatchGroup() )
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 81cc80af0656..0559e1d9c474 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -408,6 +408,7 @@ public:
BOOL LoadBasic();
BOOL SaveBasicSource();
+ BOOL ImportDialog();
void EditMacro( const String& rMacroName );
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 89176a88a675..1d64a7c318d1 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -46,6 +46,7 @@
#include <ide_pch.hxx>
+#include <vector>
#include <basidesh.hrc>
#include <baside3.hxx>
#include <localizationmgr.hxx>
@@ -63,6 +64,7 @@
#include <helpid.hrc>
#include <bastype2.hxx>
#include <svx/svdview.hxx>
+#include <svx/unolingu.hxx>
#include <tools/diagnose_ex.h>
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
@@ -73,6 +75,7 @@
#include <com/sun/star/script/XLibraryContainer2.hpp>
#endif
#include <svtools/ehdl.hxx>
+#include <svtools/langtab.hxx>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
@@ -638,6 +641,10 @@ void __EXPORT DialogWindow::ExecuteCommand( SfxRequest& rReq )
case SID_EXPORT_DIALOG:
SaveDialog();
break;
+
+ case SID_IMPORT_DIALOG:
+ ImportDialog();
+ break;
}
rReq.Done();
@@ -859,7 +866,406 @@ BOOL DialogWindow::SaveDialog()
return bDone;
}
-
+extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft,
+ const ::com::sun::star::lang::Locale& rLocaleRight );
+
+std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq
+ ( Sequence< lang::Locale > aFirstSeq, Sequence< lang::Locale > aSecondSeq )
+{
+ std::vector< lang::Locale > avRet;
+
+ const lang::Locale* pFirst = aFirstSeq.getConstArray();
+ const lang::Locale* pSecond = aSecondSeq.getConstArray();
+ sal_Int32 nFirstCount = aFirstSeq.getLength();
+ sal_Int32 nSecondCount = aSecondSeq.getLength();
+
+ for( sal_Int32 iFirst = 0 ; iFirst < nFirstCount ; iFirst++ )
+ {
+ const lang::Locale& rFirstLocale = pFirst[ iFirst ];
+
+ bool bAlsoContainedInSecondSeq = false;
+ for( sal_Int32 iSecond = 0 ; iSecond < nSecondCount ; iSecond++ )
+ {
+ const lang::Locale& rSecondLocale = pSecond[ iSecond ];
+
+ bool bMatch = localesAreEqual( rFirstLocale, rSecondLocale );
+ if( bMatch )
+ {
+ bAlsoContainedInSecondSeq = true;
+ break;
+ }
+ }
+
+ if( !bAlsoContainedInSecondSeq )
+ avRet.push_back( rFirstLocale );
+ }
+
+ return avRet;
+}
+
+
+class NameClashQueryBox : public MessBox
+{
+public:
+ NameClashQueryBox( Window* pParent,
+ const XubString& rTitle, const XubString& rMessage );
+};
+
+NameClashQueryBox::NameClashQueryBox( Window* pParent,
+ const XubString& rTitle, const XubString& rMessage )
+ : MessBox( pParent, 0, rTitle, rMessage )
+{
+ if ( rTitle.Len() )
+ SetText( rTitle );
+
+ maMessText = rMessage;
+
+ AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_RENAME ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
+ AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_REPLACE ) ), RET_NO, 0 );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+
+ SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ?
+ QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() );
+}
+
+
+class LanguageMismatchQueryBox : public MessBox
+{
+public:
+ LanguageMismatchQueryBox( Window* pParent,
+ const XubString& rTitle, const XubString& rMessage );
+};
+
+LanguageMismatchQueryBox::LanguageMismatchQueryBox( Window* pParent,
+ const XubString& rTitle, const XubString& rMessage )
+ : MessBox( pParent, 0, rTitle, rMessage )
+{
+ if ( rTitle.Len() )
+ SetText( rTitle );
+
+ maMessText = rMessage;
+ AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_ADD ) ), RET_YES,
+ BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
+ AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_OMIT ) ), RET_NO, 0 );
+ AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
+ AddButton( BUTTON_HELP, BUTTONID_HELP, BUTTONDIALOG_HELPBUTTON, 4 );
+
+ SetImage( GetSettings().GetStyleSettings().GetDialogColor().IsDark() ?
+ QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() );
+}
+
+BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName )
+{
+ BOOL bDone = FALSE;
+
+ Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
+ Reference < XFilePicker > xFP;
+ if( xMSF.is() )
+ {
+ Sequence <Any> aServiceType(1);
+ aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
+ xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY );
+ }
+
+ Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY);
+ xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, sal_False);
+ Any aValue;
+ aValue <<= (sal_Bool) sal_True;
+ xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue);
+
+ String aCurPath( rCurPath );
+ if ( aCurPath.Len() )
+ xFP->setDisplayDirectory ( aCurPath );
+
+ String aDialogStr( IDEResId( RID_STR_STDDIALOGNAME ) );
+ Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
+ xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) );
+ xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
+ xFltMgr->setCurrentFilter( aDialogStr );
+
+ if( xFP->execute() == RET_OK )
+ {
+ Sequence< ::rtl::OUString > aPaths = xFP->getFiles();
+ aCurPath = aPaths[0];
+
+ ::rtl::OUString aBasePath;
+ ::rtl::OUString aOUCurPath( aCurPath );
+ sal_Int32 iSlash = aOUCurPath.lastIndexOf( '/' );
+ if( iSlash != -1 )
+ aBasePath = aOUCurPath.copy( 0, iSlash + 1 );
+
+ try
+ {
+ // create dialog model
+ Reference< container::XNameContainer > xDialogModel( xMSF->createInstance
+ ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY_THROW );
+
+ Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
+
+ Reference< XInputStream > xInput;
+ if( xSFI->exists( aCurPath ) )
+ xInput = xSFI->openFileRead( aCurPath );
+
+ Reference< XComponentContext > xContext;
+ Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
+ OSL_ASSERT( xProps.is() );
+ OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
+
+ String aXmlDlgName;
+ Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
+ if( xDialogModelPropSet.is() )
+ {
+ try
+ {
+ Any aXmlDialogNameAny = xDialogModelPropSet->getPropertyValue( DLGED_PROP_NAME );
+ ::rtl::OUString aOUXmlDialogName;
+ aXmlDialogNameAny >>= aOUXmlDialogName;
+ aXmlDlgName = aOUXmlDialogName;
+ }
+ catch( beans::UnknownPropertyException& )
+ {}
+ }
+ bool bValidName = (aXmlDlgName.Len() != 0);
+ OSL_ASSERT( bValidName );
+ if( !bValidName )
+ return bDone;
+
+ bool bDialogAlreadyExists = rDocument.hasDialog( aLibName, aXmlDlgName );
+
+ String aNewDlgName = aXmlDlgName;
+ enum NameClashMode
+ {
+ NO_CLASH,
+ CLASH_OVERWRITE_DIALOG,
+ CLASH_RENAME_DIALOG,
+ };
+ NameClashMode eNameClashMode = NO_CLASH;
+ if( bDialogAlreadyExists )
+ {
+ String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_CLASH_TITLE ) );
+ String aQueryBoxText( IDEResId( RID_STR_DLGIMP_CLASH_TEXT ) );
+ aQueryBoxText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "$(ARG1)" ) ), aXmlDlgName );
+
+ NameClashQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
+ USHORT nRet = aQueryBox.Execute();
+ if( RET_YES == nRet )
+ {
+ // RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox
+ eNameClashMode = CLASH_RENAME_DIALOG;
+
+ aNewDlgName = rDocument.createObjectName( E_DIALOGS, aLibName );
+ }
+ else if( RET_NO == nRet )
+ {
+ // RET_NO == Replace, see NameClashQueryBox::NameClashQueryBox
+ eNameClashMode = CLASH_OVERWRITE_DIALOG;
+ }
+ else if( RET_CANCEL == nRet )
+ {
+ return bDone;
+ }
+ }
+
+ BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
+ if( pIDEShell == NULL )
+ {
+ OSL_ASSERT( pIDEShell != NULL );
+ return bDone;
+ }
+
+ // Resource?
+ ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+ Reference< task::XInteractionHandler > xDummyHandler;
+ bool bReadOnly = true;
+ Reference< XStringResourceWithLocation > xImportStringResource =
+ StringResourceWithLocation::create( xContext, aBasePath, bReadOnly,
+ aLocale, aXmlDlgName, ::rtl::OUString(), xDummyHandler );
+
+ Sequence< lang::Locale > aImportLocaleSeq = xImportStringResource->getLocales();
+ sal_Int32 nImportLocaleCount = aImportLocaleSeq.getLength();
+
+ Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, TRUE ) );
+ Reference< resource::XStringResourceManager > xLibStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
+ sal_Int32 nLibLocaleCount = 0;
+ Sequence< lang::Locale > aLibLocaleSeq;
+ if( xLibStringResourceManager.is() )
+ {
+ aLibLocaleSeq = xLibStringResourceManager->getLocales();
+ nLibLocaleCount = aLibLocaleSeq.getLength();
+ }
+
+ // Check language matches
+ std::vector< lang::Locale > aOnlyInImportLanguages =
+ implGetLanguagesOnlyContainedInFirstSeq( aImportLocaleSeq, aLibLocaleSeq );
+ int nOnlyInImportLanguageCount = aOnlyInImportLanguages.size();
+
+ // For now: Keep languages from lib
+ bool bLibLocalized = (nLibLocaleCount > 0);
+ bool bImportLocalized = (nImportLocaleCount > 0);
+
+ bool bAddDialogLanguagesToLib = false;
+ if( nOnlyInImportLanguageCount > 0 )
+ {
+ String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_MISMATCH_TITLE ) );
+ String aQueryBoxText( IDEResId( RID_STR_DLGIMP_MISMATCH_TEXT ) );
+ LanguageMismatchQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
+ USHORT nRet = aQueryBox.Execute();
+ if( RET_YES == nRet )
+ {
+ // RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
+ bAddDialogLanguagesToLib = true;
+ }
+ // RET_NO == Omit, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
+ // -> nothing to do here
+ //else if( RET_NO == nRet )
+ //{
+ //}
+ else if( RET_CANCEL == nRet )
+ {
+ return bDone;
+ }
+ }
+
+ if( bImportLocalized )
+ {
+ bool bCopyResourcesForDialog = true;
+ if( bAddDialogLanguagesToLib )
+ {
+ LocalizationMgr* pCurMgr = pIDEShell->GetCurLocalizationMgr();
+
+ lang::Locale aFirstLocale;
+ aFirstLocale = aOnlyInImportLanguages[0];
+ if( nOnlyInImportLanguageCount > 1 )
+ {
+ // Check if import default belongs to only import languages and use it then
+ lang::Locale aImportDefaultLocale = xImportStringResource->getDefaultLocale();
+ lang::Locale aTmpLocale;
+ for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i )
+ {
+ aTmpLocale = aOnlyInImportLanguages[i];
+ if( localesAreEqual( aImportDefaultLocale, aTmpLocale ) )
+ {
+ aFirstLocale = aImportDefaultLocale;
+ break;
+ }
+ }
+ }
+
+ Sequence< lang::Locale > aFirstLocaleSeq( 1 );
+ aFirstLocaleSeq[0] = aFirstLocale;
+ pCurMgr->handleAddLocales( aFirstLocaleSeq );
+
+ if( nOnlyInImportLanguageCount > 1 )
+ {
+ Sequence< lang::Locale > aRemainingLocaleSeq( nOnlyInImportLanguageCount - 1 );
+ lang::Locale aTmpLocale;
+ int iSeq = 0;
+ for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i )
+ {
+ aTmpLocale = aOnlyInImportLanguages[i];
+ if( !localesAreEqual( aFirstLocale, aTmpLocale ) )
+ aRemainingLocaleSeq[iSeq++] = aTmpLocale;
+ }
+ pCurMgr->handleAddLocales( aRemainingLocaleSeq );
+ }
+ }
+ else if( !bLibLocalized )
+ {
+ Reference< resource::XStringResourceManager > xImportStringResourceManager( xImportStringResource, UNO_QUERY );
+ LocalizationMgr::resetResourceForDialog( xDialogModel, xImportStringResourceManager );
+ bCopyResourcesForDialog = false;
+ }
+
+ if( bCopyResourcesForDialog )
+ {
+ Reference< resource::XStringResourceResolver > xImportStringResourceResolver( xImportStringResource, UNO_QUERY );
+ LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, aXmlDlgName,
+ xLibStringResourceManager, xImportStringResourceResolver );
+ }
+ }
+ else if( bLibLocalized )
+ {
+ LocalizationMgr::setResourceIDsForDialog( xDialogModel, xLibStringResourceManager );
+ }
+
+
+ LocalizationMgr::setStringResourceAtDialog( rDocument, aLibName, aNewDlgName, xDialogModel );
+
+ if( eNameClashMode == CLASH_OVERWRITE_DIALOG )
+ {
+ if ( BasicIDE::RemoveDialog( rDocument, aLibName, aNewDlgName ) )
+ {
+ IDEBaseWindow* pDlgWin = pIDEShell->FindDlgWin( rDocument, aLibName, aNewDlgName, FALSE, TRUE );
+ if( pDlgWin != NULL )
+ pIDEShell->RemoveWindow( pDlgWin, TRUE );
+ BasicIDE::MarkDocumentModified( rDocument );
+ }
+ else
+ {
+ // TODO: Assertion?
+ return bDone;
+ }
+ }
+
+ if( eNameClashMode == CLASH_RENAME_DIALOG )
+ {
+ bool bRenamed = false;
+ if( xDialogModelPropSet.is() )
+ {
+ try
+ {
+ Any aXmlDialogNameAny;
+ aXmlDialogNameAny <<= ::rtl::OUString( aNewDlgName );
+ xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, aXmlDialogNameAny );
+ bRenamed = true;
+ }
+ catch( beans::UnknownPropertyException& )
+ {}
+ }
+
+
+ if( bRenamed )
+ {
+ LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel );
+ }
+ else
+ {
+ // TODO: Assertion?
+ return bDone;
+ }
+ }
+
+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
+ bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
+ if( bSuccess )
+ {
+ DialogWindow* pNewDlgWin = pIDEShell->CreateDlgWin( rDocument, aLibName, aNewDlgName );
+ pIDEShell->SetCurWindow( pNewDlgWin, TRUE );
+ }
+
+ bDone = TRUE;
+ }
+ catch( Exception& )
+ {}
+ }
+
+ return bDone;
+}
+
+BOOL DialogWindow::ImportDialog()
+{
+ DBG_CHKTHIS( DialogWindow, 0 );
+
+ const ScriptDocument& rDocument = GetDocument();
+ String aLibName = GetLibName();
+ BOOL bRet = implImportDialog( this, aCurPath, rDocument, aLibName );
+ return bRet;
+}
+
DlgEdModel* DialogWindow::GetModel() const
{
return pEditor ? pEditor->GetModel() : NULL;
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index a435450e3a8a..581c685427d2 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -41,6 +41,7 @@
#define _SOLAR__PRIVATE 1
#include <basidesh.hxx>
+#include <baside2.hxx>
#include <baside3.hxx>
#include <basobj.hxx>
#include <localizationmgr.hxx>
@@ -170,9 +171,10 @@ SdrView* BasicIDEShell::GetCurDlgView() const
// Nur wenn Dialogfenster oben:
void __EXPORT BasicIDEShell::ExecuteDialog( SfxRequest& rReq )
{
- if ( !pCurWin || !pCurWin->IsA( TYPE( DialogWindow ) ) )
- return;
-
- pCurWin->ExecuteCommand( rReq );
+ if ( pCurWin && ( pCurWin->IsA( TYPE( DialogWindow) ) ||
+ (rReq.GetSlot() == SID_IMPORT_DIALOG &&pCurWin->IsA( TYPE( ModulWindow) ) ) ) )
+ {
+ pCurWin->ExecuteCommand( rReq );
+ }
}
diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src
index 130dda34d9e4..1c8d734d1997 100644
--- a/basctl/source/basicide/basidesh.src
+++ b/basctl/source/basicide/basidesh.src
@@ -640,6 +640,48 @@ String RID_STR_TRANSLATION_DEFAULT
Text [ en-US ] = "[Default Language]" ;
};
+
+String RID_STR_DLGIMP_CLASH_RENAME
+{
+ Text [ en-US ] = "Rename" ;
+};
+
+String RID_STR_DLGIMP_CLASH_REPLACE
+{
+ Text [ en-US ] = "Replace" ;
+};
+
+String RID_STR_DLGIMP_CLASH_TITLE
+{
+ Text [ en-US ] = "Dialog Import - Name already used" ;
+};
+
+String RID_STR_DLGIMP_CLASH_TEXT
+{
+ Text [ en-US ] = "The library already contains a dialog with the name:\n\n$(ARG1)\n\nRename dialog to keep current dialog or replace existing dialog.\n " ;
+};
+
+String RID_STR_DLGIMP_MISMATCH_ADD
+{
+ Text [ en-US ] = "Add" ;
+};
+
+String RID_STR_DLGIMP_MISMATCH_OMIT
+{
+ Text [ en-US ] = "Omit" ;
+};
+
+String RID_STR_DLGIMP_MISMATCH_TITLE
+{
+ Text [ en-US ] = "Dialog Import - Language Mismatch" ;
+};
+
+String RID_STR_DLGIMP_MISMATCH_TEXT
+{
+ Text [ en-US ] = "The dialog to be imported supports other languages than the target library.\n\nAdd these languages to the library to keep additional language resources provided by the dialog or omit them to stay with the current library languages.\n\nNote: For languages not supported by the dialog the resources of the dialog's default language will be used.\n " ;
+};
+
+
#define MN_EDIT 20
#define MN_VIEW 21
#define MN_EXTRA 22
diff --git a/basctl/source/basicide/brkdlg.src b/basctl/source/basicide/brkdlg.src
index 50623ff94ac3..ededb6909e8f 100644
--- a/basctl/source/basicide/brkdlg.src
+++ b/basctl/source/basicide/brkdlg.src
@@ -81,20 +81,20 @@ ModalDialog RID_BASICIDE_BREAKPOINTDLG
FixedText RID_FT_PASS
{
Pos = MAP_APPFONT ( 6 , 102 ) ;
- Size = MAP_APPFONT ( 35 , 10 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
Text [ en-US ] = "Pass Count:" ;
};
FixedText RID_FT_BRKPOINTS
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 40 , 10 ) ;
+ Size = MAP_APPFONT ( 110, 10 ) ;
Text [ en-US ] = "Breakpoints" ;
};
NumericField RID_FLD_PASS
{
Border = TRUE ;
- Pos = MAP_APPFONT ( 41 , 100 ) ;
- Size = MAP_APPFONT ( 40 , 12 ) ;
+ Pos = MAP_APPFONT ( 81 , 100 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
TabStop = TRUE ;
};
Text [ en-US ] = "Manage Breakpoints" ;
diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx
index 223939390354..b60d4d432bfd 100644
--- a/basctl/source/inc/baside3.hxx
+++ b/basctl/source/inc/baside3.hxx
@@ -37,6 +37,10 @@
#include <bastypes.hxx>
#include <svtools/undo.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER_HPP_
#include <com/sun/star/script/XLibraryContainer.hpp>
@@ -94,6 +98,7 @@ public:
void DisableBrowser();
void UpdateBrowser();
BOOL SaveDialog();
+ BOOL ImportDialog();
virtual String GetTitle();
virtual BasicEntryDescriptor CreateEntryDescriptor();
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index 2c9e4fe2b747..f4f118b0b277 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -86,6 +86,7 @@ class BasicIDEShell :public SfxViewShell
{
friend class JavaDebuggingListenerImpl;
friend class LocalizationMgr;
+friend BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName );
friend bool BasicIDE::RemoveDialog( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName );
ObjectCatalog* pObjectCatalog;
@@ -147,7 +148,6 @@ protected:
DialogWindow* CreateDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName );
ModulWindow* FindBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName, BOOL bCreateIfNotExist, BOOL bFindSuspended = FALSE );
- DialogWindow* FindDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName, BOOL bCreateIfNotExist, BOOL bFindSuspended = FALSE );
ModulWindow* ShowActiveModuleWindow( StarBASIC* pBasic );
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
@@ -221,6 +221,7 @@ public:
ModulWindowLayout* GetLayoutWindow() const { return pModulLayout; }
IDEBaseWindow* FindWindow( const ScriptDocument& rDocument, const String& rLibName = String(), const String& rName = String(), USHORT nType = BASICIDE_TYPE_UNKNOWN, BOOL bFindSuspended = FALSE );
+ DialogWindow* FindDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName, BOOL bCreateIfNotExist, BOOL bFindSuspended = FALSE );
IDEBaseWindow* FindApplicationWindow();
BOOL NextPage( BOOL bPrev = FALSE );
diff --git a/basctl/uiconfig/basicide/toolbar/dialogbar.xml b/basctl/uiconfig/basicide/toolbar/dialogbar.xml
index afc409fa4895..91b9a925fa60 100644
--- a/basctl/uiconfig/basicide/toolbar/dialogbar.xml
+++ b/basctl/uiconfig/basicide/toolbar/dialogbar.xml
@@ -1,8 +1,9 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:LibSelector" />
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:ChooseControls" />
- <toolbar:toolbaritem xlink:href=".uno:ExportDialog" />
+ <toolbar:toolbaritem xlink:href=".uno:ImportDialog" />
+ <toolbar:toolbaritem xlink:href=".uno:ExportDialog" />
</toolbar:toolbar> \ No newline at end of file
diff --git a/basctl/uiconfig/basicide/toolbar/macrobar.xml b/basctl/uiconfig/basicide/toolbar/macrobar.xml
index 8f08ba1ce97f..6e22bff09baf 100644
--- a/basctl/uiconfig/basicide/toolbar/macrobar.xml
+++ b/basctl/uiconfig/basicide/toolbar/macrobar.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
<toolbar:toolbaritem xlink:href=".uno:LibSelector" toolbar:helpid="helpid:30787" />
@@ -17,4 +17,6 @@
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:LoadBasic" toolbar:helpid="helpid:5951" />
<toolbar:toolbaritem xlink:href=".uno:SaveBasicAs" toolbar:helpid="helpid:5953" />
-</toolbar:toolbar> \ No newline at end of file
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:ImportDialog" />
+</toolbar:toolbar>
diff --git a/basctl/util/makefile.mk b/basctl/util/makefile.mk
index 80b3efd4325d..0f2a919ff655 100644
--- a/basctl/util/makefile.mk
+++ b/basctl/util/makefile.mk
@@ -54,6 +54,7 @@ SHL1TARGET= basctl$(DLLPOSTFIX)
SHL1IMPLIB= basctl
SHL1BASE = 0x1d800000
SHL1STDLIBS= \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(SFX2LIB) \
$(BASICLIB) \
diff --git a/bean/com/sun/star/beans/makefile.mk b/bean/com/sun/star/beans/makefile.mk
index a59ff3fa006a..1c38ff105ec9 100644
--- a/bean/com/sun/star/beans/makefile.mk
+++ b/bean/com/sun/star/beans/makefile.mk
@@ -36,7 +36,7 @@ PACKAGE = com$/sun$/star$/beans
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
-
+.IF "$(L10N_framework)"==""
.IF "$(OS)"=="MACOSX"
dummy:
@@ -63,5 +63,6 @@ JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
.ENDIF
# --- Targets ------------------------------------------------------
+.ENDIF # L10N_framework
.INCLUDE : target.mk
diff --git a/bean/com/sun/star/comp/beans/makefile.mk b/bean/com/sun/star/comp/beans/makefile.mk
index afe3e63dfdc7..983991fd0c70 100644
--- a/bean/com/sun/star/comp/beans/makefile.mk
+++ b/bean/com/sun/star/comp/beans/makefile.mk
@@ -36,7 +36,7 @@ PACKAGE = com$/sun$/star$/comp$/beans
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
-
+.IF "$(L10N_framework)"==""
.IF "$(OS)"=="MACOSX"
dummy:
@@ -74,5 +74,6 @@ JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
.ENDIF
# --- Targets ------------------------------------------------------
+.ENDIF # L10N_framework
.INCLUDE : target.mk
diff --git a/bean/util/makefile.mk b/bean/util/makefile.mk
index 9e62d604dc15..ac495a77f554 100644
--- a/bean/util/makefile.mk
+++ b/bean/util/makefile.mk
@@ -36,7 +36,7 @@ TARGET = officebean
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
-
+.IF "$(L10N_framework)"==""
JARCLASSDIRS = \
com$/sun$/star$/comp$/beans \
com$/sun$/star$/beans
@@ -53,6 +53,7 @@ ZIP1DIR=$(PRJ)
ZIP1LIST=com -x "*makefile.mk"
# --- Targets ------------------------------------------------------
+.ENDIF # L10N_framework
.INCLUDE : target.mk
diff --git a/crashrep/source/unx/makefile.mk b/crashrep/source/unx/makefile.mk
index 54628be1f2f7..2f8be8f96a76 100755
--- a/crashrep/source/unx/makefile.mk
+++ b/crashrep/source/unx/makefile.mk
@@ -63,7 +63,7 @@ APP1RPATH=BRAND
.IF "$(OS)" != "MACOSX"
APP1STDLIBS=$(DYNAMIC) -lXext -lX11
.ENDIF
-.IF "$(OS)" != "FREEBSD" && "$(OS)" != "MACOSX"
+.IF "$(OS)" != "FREEBSD" && "$(OS)" != "MACOSX" && "$(OS)"!="NETBSD"
APP1STDLIBS+=-ldl -lnsl
.ENDIF
.IF "$(OS)" == "SOLARIS"
diff --git a/embedserv/source/inprocserv/makefile.mk b/embedserv/source/inprocserv/makefile.mk
index 0f81dcc8bd0d..1928b1ec42ac 100644
--- a/embedserv/source/inprocserv/makefile.mk
+++ b/embedserv/source/inprocserv/makefile.mk
@@ -57,7 +57,17 @@ SLOFILES=\
$(SLO)$/inprocembobj.obj
SHL1TARGET=$(TARGET)
-SHL1STDLIBS=\
+.IF "$(COM)"=="GCC"
+SHL1STDLIBS += -lstdc++
+.IF "$(MINGW_GCCLIB_EH)"=="YES"
+SHL1STDLIBS += -lgcc_eh
+.ENDIF
+SHL1STDLIBS += -lgcc -lmingw32 -lmoldname -lmsvcrt
+.ELSE
+SHL1STDLIBS=
+.ENDIF
+
+SHL1STDLIBS+=\
$(UUIDLIB)\
$(OLE32LIB)\
$(GDI32LIB)\
diff --git a/extensions/source/abpilot/makefile.mk b/extensions/source/abpilot/makefile.mk
index 85a19ade9996..8830b9144409 100644
--- a/extensions/source/abpilot/makefile.mk
+++ b/extensions/source/abpilot/makefile.mk
@@ -94,6 +94,7 @@ SHL1STDLIBS= \
$(COMPHELPERLIB) \
$(TKLIB) \
$(UNOTOOLSLIB) \
+ $(SVXCORELIB) \
$(SVXLIB)
SHL1LIBS= $(SLB)$/$(TARGET).lib
diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx
index f7cfafe39c10..c34aceb418a3 100644
--- a/extensions/source/abpilot/typeselectionpage.cxx
+++ b/extensions/source/abpilot/typeselectionpage.cxx
@@ -116,6 +116,7 @@ namespace abp
bool bFirstVisible = true;
Link aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected );
+ const Size aSpacing( LogicToPixel( Size( 0, 3 ), MAP_APPFONT ) );
for ( ::std::vector< ButtonItem >::const_iterator loop = m_aAllTypes.begin();
loop != m_aAllTypes.end(); ++loop )
{
@@ -125,7 +126,7 @@ namespace abp
else
{
aItem.m_pItem->SetPosPixel( aTopLeft );
- aTopLeft.Y() += aItemSize.Height();
+ aTopLeft.Y() += aItemSize.Height() + aSpacing.Height();
aItem.m_pItem->SetClickHdl( aTypeSelectionHandler );
aItem.m_pItem->Show();
diff --git a/extensions/source/activex/main/SOActiveX.h b/extensions/source/activex/main/SOActiveX.h
index f7017d582be9..2bf33f96b4e9 100644
--- a/extensions/source/activex/main/SOActiveX.h
+++ b/extensions/source/activex/main/SOActiveX.h
@@ -163,7 +163,7 @@ public:
HRESULT GetUrlStruct( OLECHAR* sUrl, CComPtr<IDispatch>& pdispUrl );
HRESULT Cleanup();
HRESULT TerminateOffice();
- HRESULT CSOActiveX::GetURL( const OLECHAR* url,
+ HRESULT GetURL( const OLECHAR* url,
const OLECHAR* target );
void CallbackCreateXInputStream( CBindStatusCallback<CSOActiveX>* pbsc, BYTE* pBytes, DWORD dwSize );
diff --git a/extensions/source/config/ldap/ldapaccess.cxx b/extensions/source/config/ldap/ldapaccess.cxx
index 7c4a690cd16f..a850a441c5fe 100644
--- a/extensions/source/config/ldap/ldapaccess.cxx
+++ b/extensions/source/config/ldap/ldapaccess.cxx
@@ -40,14 +40,30 @@
namespace extensions { namespace config { namespace ldap {
-
+oslModule LdapConnection::s_Ldap_Module = NULL;
+t_ldap_unbind_s LdapConnection::s_p_unbind_s = NULL;
+t_ldap_simple_bind_s LdapConnection::s_p_simple_bind_s = NULL;
+t_ldap_set_option LdapConnection::s_p_set_option = NULL;
+t_ldap_err2string LdapConnection::s_p_err2string = NULL;
+t_ldap_init LdapConnection::s_p_init = NULL;
+t_ldap_msgfree LdapConnection::s_p_msgfree = NULL;
+t_ldap_get_dn LdapConnection::s_p_get_dn = NULL;
+t_ldap_first_entry LdapConnection::s_p_first_entry = NULL;
+t_ldap_search_s LdapConnection::s_p_search_s = NULL;
+t_ldap_value_free LdapConnection::s_p_value_free = NULL;
+t_ldap_get_values LdapConnection::s_p_get_values = NULL;
+t_ldap_memfree LdapConnection::s_p_memfree = NULL;
//------------------------------------------------------------------------------
typedef int LdapErrCode;
//------------------------------------------------------------------------------
struct LdapMessageHolder
{
LdapMessageHolder() : msg(0) {}
- ~LdapMessageHolder() { if (msg) ldap_msgfree(msg); }
+ ~LdapMessageHolder()
+ {
+ if (msg)
+ (*LdapConnection::s_p_msgfree)(msg);
+ }
LDAPMessage * msg;
@@ -66,7 +82,7 @@ void LdapConnection::disconnect()
{
if (mConnection != NULL)
{
- ldap_unbind_s(mConnection) ;
+ (*s_p_unbind_s)(mConnection) ;
mConnection = NULL;
}
}
@@ -85,11 +101,11 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
{
message.appendAscii(aOperation).appendAscii(": ") ;
}
- message.appendAscii(ldap_err2string(aRetCode)).appendAscii(" (") ;
+ message.appendAscii((*LdapConnection::s_p_err2string)(aRetCode)).appendAscii(" (") ;
sal_Char *stub = NULL ;
#ifndef LDAP_OPT_SIZELIMIT // for use with OpenLDAP
- ldap_get_lderrno(aConnection, NULL, &stub) ;
+ (*s_p_get_lderrno)(aConnection, NULL, &stub) ;
#endif
if (stub != NULL)
{
@@ -99,7 +115,7 @@ static void checkLdapReturnCode(const sal_Char *aOperation,
// string itself. At any rate freeing it seems to
// cause some undue problems at least on Windows.
// This call is thus disabled for the moment.
- //ldap_memfree(stub) ;
+ //(*s_p_memfree)(stub) ;
}
else { message.appendAscii(kNoSpecificMessage) ; }
message.appendAscii(")") ;
@@ -126,20 +142,20 @@ void LdapConnection::connectSimple()
initConnection() ;
// Set Protocol V3
int version = LDAP_VERSION3;
- ldap_set_option(mConnection,
+ (*s_p_set_option)(mConnection,
LDAP_OPT_PROTOCOL_VERSION,
&version);
#ifdef LDAP_X_OPT_CONNECT_TIMEOUT // OpenLDAP doesn't support this and the func
/* timeout is specified in milliseconds -> 4 seconds*/
int timeout = 4000;
- ldap_set_option( mConnection,
+ (*s_p_set_option)( mConnection,
LDAP_X_OPT_CONNECT_TIMEOUT,
&timeout );
#endif
// Do the bind
- LdapErrCode retCode = ldap_simple_bind_s(mConnection,
+ LdapErrCode retCode = (*s_p_simple_bind_s)(mConnection,
mLdapDefinition.mAnonUser ,
mLdapDefinition.mAnonCredentials) ;
@@ -160,7 +176,7 @@ void LdapConnection::initConnection()
if (mLdapDefinition.mPort == 0) mLdapDefinition.mPort = LDAP_PORT;
- mConnection = ldap_init(mLdapDefinition.mServer,
+ mConnection = (*s_p_init)(mLdapDefinition.mServer,
mLdapDefinition.mPort) ;
if (mConnection == NULL)
{
@@ -186,7 +202,7 @@ void LdapConnection::initConnection()
rtl::OString aUserDn =findUserDn( rtl::OUStringToOString(aUser, RTL_TEXTENCODING_ASCII_US));
LdapMessageHolder result;
- LdapErrCode retCode = ldap_search_s(mConnection,
+ LdapErrCode retCode = (*s_p_search_s)(mConnection,
aUserDn,
LDAP_SCOPE_BASE,
"(objectclass=*)",
@@ -228,21 +244,21 @@ void LdapConnection::initConnection()
sal_Char * attributes [2];
attributes[0]= const_cast<sal_Char *>(LDAP_NO_ATTRS);
attributes[1]= NULL;
- LdapErrCode retCode = ldap_search_s(mConnection,
+ LdapErrCode retCode = (*s_p_search_s)(mConnection,
mLdapDefinition.mBaseDN,
LDAP_SCOPE_SUBTREE,
filter.makeStringAndClear(), attributes, 0, &result.msg) ;
checkLdapReturnCode("FindUserDn", retCode,mConnection) ;
rtl::OString userDn ;
- LDAPMessage *entry = ldap_first_entry(mConnection, result.msg) ;
+ LDAPMessage *entry = (*s_p_first_entry)(mConnection, result.msg) ;
if (entry != NULL)
{
- sal_Char *charsDn = ldap_get_dn(mConnection, entry) ;
+ sal_Char *charsDn = (*s_p_get_dn)(mConnection, entry) ;
userDn = charsDn ;
- ldap_memfree(charsDn) ;
+ (*s_p_memfree)(charsDn) ;
}
else
{
@@ -264,7 +280,7 @@ rtl::OString LdapConnection::getSingleAttribute(
attributes [0] = aAttribute ;
attributes [1] = 0 ;
LdapMessageHolder result ;
- LdapErrCode retCode = ldap_search_s(mConnection,
+ LdapErrCode retCode = (*s_p_search_s)(mConnection,
aDn,
LDAP_SCOPE_BASE,
"(objectclass=*)",
@@ -277,22 +293,57 @@ rtl::OString LdapConnection::getSingleAttribute(
return value ;
}
checkLdapReturnCode("GetSingleAttribute", retCode, mConnection) ;
- LDAPMessage *entry = ldap_first_entry(mConnection, result.msg) ;
+ LDAPMessage *entry = (*s_p_first_entry)(mConnection, result.msg) ;
if (entry != NULL)
{
- sal_Char **values = ldap_get_values(mConnection, entry,
+ sal_Char **values = (*s_p_get_values)(mConnection, entry,
aAttribute) ;
if (values != NULL)
{
if (*values != NULL) { value = *values ; }
- ldap_value_free(values) ;
+ (*s_p_value_free)(values) ;
}
}
return value ;
}
+extern "C" { static void SAL_CALL thisModule() {} }
+void LdapConnection::loadModule()
+{
+ if ( !s_Ldap_Module )
+ {
+#if defined(WIN) || defined(WNT)
+ const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM("nsldap32v50.dll"));
+#else
+#ifdef WITH_OPENLDAP
+ const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM("libldap.so"));
+#else
+ const ::rtl::OUString sModuleName(RTL_CONSTASCII_USTRINGPARAM("libldap50.so"));
+#endif
+#endif
+
+ // load the dbtools library
+ s_Ldap_Module = osl_loadModuleRelative(&thisModule, sModuleName.pData, 0);
+ if ( s_Ldap_Module != NULL )
+ {
+ s_p_unbind_s = (t_ldap_unbind_s)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_unbind_s").pData));
+ s_p_simple_bind_s = (t_ldap_simple_bind_s)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_simple_bind_s").pData));
+ s_p_set_option = (t_ldap_set_option)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_set_option").pData));
+ s_p_err2string = (t_ldap_err2string)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_err2string").pData));
+ s_p_init = (t_ldap_init)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_init").pData));
+ s_p_msgfree = (t_ldap_msgfree)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_msgfree").pData));
+ s_p_get_dn = (t_ldap_get_dn)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_get_dn").pData));
+ s_p_first_entry = (t_ldap_first_entry)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_first_entry").pData));
+ s_p_search_s = (t_ldap_search_s)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_search_s").pData));
+ s_p_value_free = (t_ldap_value_free)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_value_free").pData));
+ s_p_get_values = (t_ldap_get_values)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_get_values").pData));
+ s_p_memfree = (t_ldap_memfree)(osl_getFunctionSymbol(s_Ldap_Module, ::rtl::OUString::createFromAscii("ldap_memfree").pData));
+ }
+ }
+}
+
//------------------------------------------------------------------------------
} } } // extensions.config.ldap
diff --git a/extensions/source/config/ldap/ldapaccess.hxx b/extensions/source/config/ldap/ldapaccess.hxx
index 9017162c0c5e..47022bb0d615 100644
--- a/extensions/source/config/ldap/ldapaccess.hxx
+++ b/extensions/source/config/ldap/ldapaccess.hxx
@@ -34,10 +34,9 @@
#include "wrapldapinclude.hxx"
#include <com/sun/star/ldap/LdapGenericException.hpp>
-#ifndef _COM_SUN_STAR_LDAP_LDAP_CONNECTIONEXCEPTION_HPP_
#include <com/sun/star/ldap/LdapConnectionException.hpp>
-#endif // _COM_SUN_STAR_LDAP_LDAP_CONNECTIONEXCEPTION_HPP_
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <osl/module.h>
namespace extensions { namespace config { namespace ldap {
@@ -50,6 +49,18 @@ namespace ldap = css::ldap ;
struct LdapUserProfile;
class LdapUserProfileMap;
+typedef LDAP_API(int) (LDAP_CALL *t_ldap_unbind_s)( LDAP *ld );
+typedef LDAP_API(int) (LDAP_CALL *t_ldap_simple_bind_s)( LDAP *ld, const char *who, const char *passwd );
+typedef LDAP_API(int) (LDAP_CALL *t_ldap_set_option)( LDAP *ld, int option, const void *optdata );
+typedef LDAP_API(char *) (LDAP_CALL *t_ldap_err2string)( int err );
+typedef LDAP_API(LDAP *) (LDAP_CALL *t_ldap_init)( const char *defhost, int defport );
+typedef LDAP_API(int) (LDAP_CALL *t_ldap_msgfree)( LDAPMessage *lm );
+typedef LDAP_API(char *) (LDAP_CALL *t_ldap_get_dn)( LDAP *ld, LDAPMessage *entry );
+typedef LDAP_API(LDAPMessage *) (LDAP_CALL *t_ldap_first_entry)( LDAP *ld, LDAPMessage *chain );
+typedef LDAP_API(int) (LDAP_CALL *t_ldap_search_s)( LDAP *ld, const char *base, int scope, const char *filter, char **attrs, int attrsonly, LDAPMessage **res );
+typedef LDAP_API(void) (LDAP_CALL *t_ldap_value_free)( char **vals );
+typedef LDAP_API(char **) (LDAP_CALL *t_ldap_get_values)( LDAP *ld, LDAPMessage *entry, const char *target );
+typedef LDAP_API(void) (LDAP_CALL *t_ldap_memfree)( void *p );
//------------------------------------------------------------------------------
/** Struct containing the information on LDAP connection */
struct LdapDefinition
@@ -75,6 +86,7 @@ struct LdapDefinition
/** Class encapulating all LDAP functionality */
class LdapConnection
{
+ friend struct LdapMessageHolder;
public:
/** Default constructor */
@@ -124,6 +136,12 @@ public:
throw (lang::IllegalArgumentException,
ldap::LdapConnectionException,
ldap::LdapGenericException);
+
+ void loadModule();
+
+ static t_ldap_err2string s_p_err2string;
+ static t_ldap_value_free s_p_value_free;
+ static t_ldap_get_values s_p_get_values;
private:
void initConnection()
@@ -142,6 +160,19 @@ private:
/** LDAP connection object */
LDAP* mConnection ;
LdapDefinition mLdapDefinition;
+
+ static oslModule s_Ldap_Module;
+ static t_ldap_unbind_s s_p_unbind_s;
+ static t_ldap_simple_bind_s s_p_simple_bind_s;
+ static t_ldap_set_option s_p_set_option;
+ static t_ldap_init s_p_init;
+ static t_ldap_msgfree s_p_msgfree;
+ static t_ldap_get_dn s_p_get_dn;
+ static t_ldap_first_entry s_p_first_entry;
+ static t_ldap_search_s s_p_search_s;
+
+ static t_ldap_memfree s_p_memfree;
+
} ;
//------------------------------------------------------------------------------
}} }
diff --git a/extensions/source/config/ldap/ldapuserprof.cxx b/extensions/source/config/ldap/ldapuserprof.cxx
index 7475af4e8fcf..3a031ddae211 100644
--- a/extensions/source/config/ldap/ldapuserprof.cxx
+++ b/extensions/source/config/ldap/ldapuserprof.cxx
@@ -31,7 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_extensions.hxx"
#include "ldapuserprof.hxx"
-
+#include "ldapaccess.hxx"
namespace extensions { namespace config { namespace ldap {
//==============================================================================
@@ -127,14 +127,14 @@ void LdapUserProfileMap::ldapToUserProfile(LDAP *aConnection,
for (sal_uInt32 j = 0 ;
j < mMapping [i].mLdapAttributes.size() ; ++ j)
{
- values = ldap_get_values(aConnection, aEntry,
+ values = (*LdapConnection::s_p_get_values)(aConnection, aEntry,
mMapping [i].mLdapAttributes [j]) ;
if (values != NULL)
{
aProfile.mProfile[i].mValue = rtl::OStringToOUString(
*values, RTL_TEXTENCODING_UTF8);
- ldap_value_free(values);
+ (*LdapConnection::s_p_value_free)(values);
break;
}
}
diff --git a/extensions/source/config/ldap/ldapuserprofilebe.cxx b/extensions/source/config/ldap/ldapuserprofilebe.cxx
index 13cd3ff2070d..330834c5b414 100644
--- a/extensions/source/config/ldap/ldapuserprofilebe.cxx
+++ b/extensions/source/config/ldap/ldapuserprofilebe.cxx
@@ -112,27 +112,30 @@ LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContex
OSL_ENSURE(!bReentrantCall, "configuration: Ldap Backend constructor called reentrantly - probably a registration error.");
if (!bReentrantCall)
- try
{
- bReentrantCall = true ;
- if (! readLdapConfiguration(aDefinition) )
+ try
{
- throw backend::BackendSetupException(
- rtl::OUString::createFromAscii("LdapUserProfileBe- LDAP not configured"),
- NULL, uno::Any());
+ bReentrantCall = true ;
+ if (! readLdapConfiguration(aDefinition) )
+ {
+ throw backend::BackendSetupException(
+ rtl::OUString::createFromAscii("LdapUserProfileBe- LDAP not configured"),
+ NULL, uno::Any());
+ }
+
+ bReentrantCall = false ;
+ }
+ catch (uno::Exception&)
+ {
+ bReentrantCall = false;
+ throw;
}
-
- bReentrantCall = false ;
- }
- catch (uno::Exception&)
- {
- bReentrantCall = false;
- throw;
}
}
try
{
+ mLdapSource->mConnection.loadModule();
mLdapSource->mConnection.connectSimple(aDefinition);
//Set the UserDN
mUserDN = mLdapSource->mConnection.findUserDn(
diff --git a/extensions/source/config/ldap/makefile.mk b/extensions/source/config/ldap/makefile.mk
index acd47ab9e281..5ff3da4d21de 100644
--- a/extensions/source/config/ldap/makefile.mk
+++ b/extensions/source/config/ldap/makefile.mk
@@ -82,7 +82,6 @@ SHL1DEF=$(MISC)$/$(SHL1TARGET).def
SHL1LIBS=$(LIB1TARGET)
SHL1IMPLIB=i$(SHL1TARGET)
SHL1STDLIBS= \
- $(LDAPSDKLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALHELPERLIB) \
diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx
index 7b36f27626c4..f86b284b72fd 100644
--- a/extensions/source/dbpilots/listcombowizard.cxx
+++ b/extensions/source/dbpilots/listcombowizard.cxx
@@ -223,9 +223,6 @@ namespace dbp
// the bound field
getContext().xObjectModel->setPropertyValue(::rtl::OUString::createFromAscii("DataField"), makeAny(::rtl::OUString(getSettings().sLinkedFormField)));
-
- // by default, create a drop down control
- getContext().xObjectModel->setPropertyValue(::rtl::OUString::createFromAscii("Dropdown"), ::cppu::bool2any(sal_True));
}
catch(Exception&)
{
diff --git a/extensions/source/ole/oleobjw.hxx b/extensions/source/ole/oleobjw.hxx
index 2addf2f037a7..255d66f46ea8 100644
--- a/extensions/source/ole/oleobjw.hxx
+++ b/extensions/source/ole/oleobjw.hxx
@@ -32,8 +32,10 @@
#define __OLEOBJW_HXX
#include "ole2uno.hxx"
+#ifdef _MSC_VER
#pragma warning (push,1)
#pragma warning (disable:4548)
+#endif
#include <tools/presys.h>
#define _WIN32_WINNT 0x0400
@@ -46,7 +48,9 @@
#include <hash_map>
#include <tools/postsys.h>
+#ifdef _MSC_VER
#pragma warning (pop)
+#endif
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase4.hxx>
@@ -88,7 +92,7 @@ public:
~IUnknownWrapper_Impl();
//XInterface
- Any SAL_CALL IUnknownWrapper_Impl::queryInterface(const Type& t)
+ Any SAL_CALL queryInterface(const Type& t)
throw (RuntimeException);
// XInvokation
diff --git a/extensions/source/oooimprovecore/makefile.mk b/extensions/source/oooimprovecore/makefile.mk
index 53de4e333994..b527f16bf44e 100644
--- a/extensions/source/oooimprovecore/makefile.mk
+++ b/extensions/source/oooimprovecore/makefile.mk
@@ -52,6 +52,9 @@ LIB1FILES= \
$(SLB)$/$(TARGET).lib \
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+.IF "$(GUI)"=="OS2"
+SHL1TARGET=oooimpc$(DLLPOSTFIX)
+.ENDIF
SHL1STDLIBS= \
$(COMPHELPERLIB) \
@@ -62,6 +65,7 @@ SHL1STDLIBS= \
$(SVLLIB) \
$(SVTOOLLIB) \
$(SFXLIB) \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(TOOLSLIB)
diff --git a/extensions/source/oooimprovement/config.cxx b/extensions/source/oooimprovement/config.cxx
index daf1e81bc60d..bece7e089f1a 100644
--- a/extensions/source/oooimprovement/config.cxx
+++ b/extensions/source/oooimprovement/config.cxx
@@ -222,6 +222,7 @@ namespace oooimprovement
return result;
}
+#ifdef FUTURE
sal_Int32 Config::getFailedAttempts() const
{
sal_Int32 result = 0;
@@ -231,6 +232,7 @@ namespace oooimprovement
MyConfigurationHelper::E_READONLY) >>= result;
return result;
}
+#endif
sal_Int32 Config::getOfficeStartCounterdown() const
{
diff --git a/extensions/source/oooimprovement/config.hxx b/extensions/source/oooimprovement/config.hxx
index ff032a6032a5..c5ea887fa76f 100644
--- a/extensions/source/oooimprovement/config.hxx
+++ b/extensions/source/oooimprovement/config.hxx
@@ -53,7 +53,9 @@ namespace oooimprovement
::rtl::OUString getSoapId() const;
::rtl::OUString getSoapUrl() const;
sal_Int32 getReportCount() const;
+#ifdef FUTURE
sal_Int32 getFailedAttempts() const;
+#endif
sal_Int32 getOfficeStartCounterdown() const;
sal_Int32 incrementEventCount(sal_Int32 by);
sal_Int32 incrementReportCount(sal_Int32 by);
diff --git a/extensions/source/oooimprovement/corecontroller.cxx b/extensions/source/oooimprovement/corecontroller.cxx
index 34fc24e42302..3c9245d3faa9 100644
--- a/extensions/source/oooimprovement/corecontroller.cxx
+++ b/extensions/source/oooimprovement/corecontroller.cxx
@@ -33,7 +33,6 @@
#include "corecontroller.hxx"
#include "config.hxx"
-
using ::rtl::OUString;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
@@ -41,14 +40,6 @@ using namespace ::com::sun::star::uno;
namespace oooimprovement
{
-
- CoreController::CoreController(const Reference<XComponentContext>& context)
- : m_ServiceFactory(Reference<XMultiServiceFactory>(
- context->getServiceManager()->createInstanceWithContext(
- OUString::createFromAscii("com.sun.star.lang.XMultiServiceFactory"), context),
- UNO_QUERY))
- { }
-
CoreController::CoreController(const Reference<XMultiServiceFactory>& sf)
: m_ServiceFactory(sf)
{ }
@@ -96,9 +87,6 @@ namespace oooimprovement
return aServiceNames;
}
- Reference<XInterface> SAL_CALL CoreController::Create(const Reference<XComponentContext>& context)
- { return *(new CoreController(context)); }
-
Reference<XInterface> SAL_CALL CoreController::Create(const Reference<XMultiServiceFactory>& sm)
{ return *(new CoreController(sm)); }
}
diff --git a/extensions/source/oooimprovement/corecontroller.hxx b/extensions/source/oooimprovement/corecontroller.hxx
index 3f1cadb82b69..4f62e9d026b6 100644
--- a/extensions/source/oooimprovement/corecontroller.hxx
+++ b/extensions/source/oooimprovement/corecontroller.hxx
@@ -54,8 +54,8 @@ namespace oooimprovement
// css::lang::XServiceInfo - static version
static ::rtl::OUString SAL_CALL getImplementationName_static();
static css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static();
- static css::uno::Reference< css::uno::XInterface> SAL_CALL Create(
- const css::uno::Reference<css::uno::XComponentContext>& context);
+ //static css::uno::Reference< css::uno::XInterface> SAL_CALL Create(
+ // const css::uno::Reference<css::uno::XComponentContext>& context);
static css::uno::Reference< css::uno::XInterface> SAL_CALL Create(
const css::uno::Reference< css::lang::XMultiServiceFactory>& sm);
diff --git a/extensions/source/oooimprovement/errormail.cxx b/extensions/source/oooimprovement/errormail.cxx
index fdfec120695f..38e863750220 100644
--- a/extensions/source/oooimprovement/errormail.cxx
+++ b/extensions/source/oooimprovement/errormail.cxx
@@ -37,7 +37,7 @@
#include <rtl/string.hxx>
#include <rtl/strbuf.hxx>
-#ifdef UNIX
+#if defined(UNIX) || defined(OS2)
#include <sys/utsname.h>
#endif
#ifdef WIN32
@@ -83,12 +83,14 @@ namespace {
return "Win32";
#elif defined UNIX
return "Unix";
+ #elif defined OS2
+ return "OS/2";
#else
return "Unknown";
#endif
};
-#ifdef UNIX
+#if defined(UNIX) || defined(OS2)
static const OString getLocale()
{
const char * locale = getenv( "LC_ALL" );
diff --git a/extensions/source/oooimprovement/invite_job.cxx b/extensions/source/oooimprovement/invite_job.cxx
index 20efafcaa69a..bb1ce11d23fe 100644
--- a/extensions/source/oooimprovement/invite_job.cxx
+++ b/extensions/source/oooimprovement/invite_job.cxx
@@ -67,12 +67,12 @@ namespace
namespace oooimprovement
{
- InviteJob::InviteJob(const Reference<XComponentContext>& context)
- : m_ServiceFactory(Reference<XMultiServiceFactory>(
- context->getServiceManager()->createInstanceWithContext(
- OUString::createFromAscii("com.sun.star.lang.XMultiServiceFactory"), context),
- UNO_QUERY))
- { }
+// InviteJob::InviteJob(const Reference<XComponentContext>& context)
+// : m_ServiceFactory(Reference<XMultiServiceFactory>(
+// context->getServiceManager()->createInstanceWithContext(
+// OUString::createFromAscii("com.sun.star.lang.XMultiServiceFactory"), context),
+// UNO_QUERY))
+// { }
InviteJob::InviteJob(const Reference<XMultiServiceFactory>& sf)
: m_ServiceFactory(sf)
@@ -128,8 +128,8 @@ namespace oooimprovement
return aServiceNames;
}
- Reference<XInterface> InviteJob::Create(const Reference<XComponentContext>& context)
- { return *(new InviteJob(context)); }
+// Reference<XInterface> InviteJob::Create(const Reference<XComponentContext>& context)
+// { return *(new InviteJob(context)); }
Reference<XInterface> InviteJob::Create(const Reference<XMultiServiceFactory>& sm)
{ return *(new InviteJob(sm)); }
diff --git a/extensions/source/oooimprovement/invite_job.hxx b/extensions/source/oooimprovement/invite_job.hxx
index 17e5c2586003..8c1cd57f07a8 100644
--- a/extensions/source/oooimprovement/invite_job.hxx
+++ b/extensions/source/oooimprovement/invite_job.hxx
@@ -53,8 +53,8 @@ namespace oooimprovement
// XServiceInfo - static version
static ::rtl::OUString SAL_CALL getImplementationName_static();
static css::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames_static();
- static css::uno::Reference< css::uno::XInterface> SAL_CALL Create(
- const css::uno::Reference< css::uno::XComponentContext>& context);
+ //static css::uno::Reference< css::uno::XInterface> SAL_CALL Create(
+ // const css::uno::Reference< css::uno::XComponentContext>& context);
static css::uno::Reference< css::uno::XInterface> SAL_CALL Create(const css::uno::Reference< css::lang::XMultiServiceFactory>& sm);
diff --git a/extensions/source/oooimprovement/makefile.mk b/extensions/source/oooimprovement/makefile.mk
index 41f91fc7b5ca..f9b508b13f2f 100644
--- a/extensions/source/oooimprovement/makefile.mk
+++ b/extensions/source/oooimprovement/makefile.mk
@@ -70,6 +70,10 @@ SHL1STDLIBS= \
$(UNOTOOLSLIB) \
SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
+.IF "$(GUI)"=="OS2"
+SHL1TARGET= oooimp$(DLLPOSTFIX)
+.ENDIF
+
SHL1LIBS= $(SLB)$/$(TARGET).lib
SHL1DEF= $(MISC)$/$(SHL1TARGET).def
DEF1NAME= $(SHL1TARGET)
diff --git a/extensions/source/oooimprovement/myconfigurationhelper.cxx b/extensions/source/oooimprovement/myconfigurationhelper.cxx
index c6e68e92a064..e0f14c6ec445 100644
--- a/extensions/source/oooimprovement/myconfigurationhelper.cxx
+++ b/extensions/source/oooimprovement/myconfigurationhelper.cxx
@@ -149,33 +149,6 @@ namespace oooimprovement
xProps->setPropertyValue(sKey, aValue);
}
- Reference<XInterface> MyConfigurationHelper::makeSureSetNodeExists(
- const Reference<XInterface> xCFG,
- const OUString& sRelPathToSet,
- const OUString& sSetNode)
- {
- Reference<css::container::XHierarchicalNameAccess> xAccess(xCFG, UNO_QUERY_THROW);
- Reference<css::container::XNameAccess> xSet;
- xAccess->getByHierarchicalName(sRelPathToSet) >>= xSet;
- if (!xSet.is())
- throw css::container::NoSuchElementException(
- noSuchElement(sRelPathToSet),
- Reference<XInterface>());
-
- Reference<XInterface> xNode;
- if (xSet->hasByName(sSetNode))
- xSet->getByName(sSetNode) >>= xNode;
- else
- {
- Reference<XSingleServiceFactory> xNodeFactory(xSet, UNO_QUERY_THROW);
- xNode = xNodeFactory->createInstance();
- Reference<css::container::XNameContainer> xSetReplace(xSet, UNO_QUERY_THROW);
- xSetReplace->insertByName(sSetNode, makeAny(xNode));
- }
-
- return xNode;
- }
-
Any MyConfigurationHelper::readDirectKey(
const Reference<XMultiServiceFactory> xSMGR,
const OUString& sPackage,
diff --git a/extensions/source/oooimprovement/myconfigurationhelper.hxx b/extensions/source/oooimprovement/myconfigurationhelper.hxx
index a5d0c749e81a..5c5cb38b6a68 100644
--- a/extensions/source/oooimprovement/myconfigurationhelper.hxx
+++ b/extensions/source/oooimprovement/myconfigurationhelper.hxx
@@ -163,40 +163,6 @@ namespace oooimprovement
const css::uno::Any& aValue);
//-----------------------------------------------
- /** it checks if the specified set node exists ... or create an empty one
- * otherwise.
- *
- * This method must be used in combination with openConfig().
- * The cached configuration access must be provided here ... and
- * all operations are made relativ to this access point.
- *
- * Further this method must be used only with configuration set's.
- * Atomic keys can't be "created" ... they "exists everytimes".
- *
- * @param xCFG
- * the configuration root, where sRelPathToSet should be interpreted
- * as relativ path.
- *
- * @param sRelPathToSet
- * path relative to xCFG parameter.
- *
- * @param sSetNode
- * the set node, which should be checked if its exists ...
- * or which should be created with default values.
- *
- * @return A reference to the found (or new created) set node.
- * Cant be NULL .. in such case an exception occure !
- *
- * @throw css::uno::Any exceptions the underlying configuration can throw.
- * E.g. css::uno::Exception if the provided configuration
- * access does not allow writing for this set.
- */
- static css::uno::Reference< css::uno::XInterface> makeSureSetNodeExists(
- const css::uno::Reference< css::uno::XInterface> xCFG,
- const ::rtl::OUString& sRelPathToSet,
- const ::rtl::OUString& sSetNode);
-
- //-----------------------------------------------
/** commit all changes made on the specified configuration access.
*
* This method must be used in combination with openConfig().
diff --git a/extensions/source/oooimprovement/soaprequest.cxx b/extensions/source/oooimprovement/soaprequest.cxx
index d67ce911d204..045a02701fc6 100644
--- a/extensions/source/oooimprovement/soaprequest.cxx
+++ b/extensions/source/oooimprovement/soaprequest.cxx
@@ -33,6 +33,7 @@
#include "soaprequest.hxx"
#include "errormail.hxx"
+#include "config.hxx"
#include <boost/shared_ptr.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -56,7 +57,7 @@ namespace
{
static unsigned long asUlong(sal_Int8 input)
{
- return *reinterpret_cast<unsigned char *>(&input) ;
+ return *reinterpret_cast<unsigned char *>(&input);
};
static Sequence<sal_Int8> base64_encode(const Sequence<sal_Int8>& input)
@@ -150,10 +151,18 @@ namespace
"</SOAP-ENV:Envelope>\n");
static const OString SOAP_ITEM_END("]]></value></item>\n");
- static const OString getSoapSoapId(const OString& soap_id)
+ static const OString getSoapOfficeversion(const Reference<XMultiServiceFactory>& sf)
{
- OStringBuffer buf =
- "<body xsi:type=\"xsd:string\">" + xmlEncode(soap_id) + "</body>\n";
+ return ::rtl::OUStringToOString(oooimprovement::Config(sf).getCompleteProductname(), RTL_TEXTENCODING_ASCII_US);
+ };
+
+ static const OString getSoapSoapId(const Reference<XMultiServiceFactory>& sf, const OString& soap_id)
+ {
+ OStringBuffer buf;
+ buf.append("<body xsi:type=\"xsd:string\">");
+ buf.append(xmlEncode(soap_id)).append("\n");
+ buf.append(xmlEncode(getSoapOfficeversion(sf))).append("\n");
+ buf.append("</body>\n");
return buf.makeStringAndClear();
};
@@ -180,7 +189,7 @@ namespace oooimprovement
writeString(target, SOAP_START);
writeString(
target,
- getSoapSoapId(rtl::OUStringToOString(m_SoapId, RTL_TEXTENCODING_ASCII_US)));
+ getSoapSoapId(m_ServiceFactory, rtl::OUStringToOString(m_SoapId, RTL_TEXTENCODING_ASCII_US)));
writeString(target, SOAP_ITEMS_START);
writeString(target, getSoapItemStart("reportmail.xml"));
writeString(target, Errormail(m_ServiceFactory).getXml());
diff --git a/extensions/source/plugin/aqua/macmgr.cxx b/extensions/source/plugin/aqua/macmgr.cxx
index 26df705a1d97..65a56f03f7ad 100644
--- a/extensions/source/plugin/aqua/macmgr.cxx
+++ b/extensions/source/plugin/aqua/macmgr.cxx
@@ -400,12 +400,56 @@ static int parseMimeResource( CFBundleRef i_xBundle,
return nAdded;
}
+// check some known bad plugins to avoid crashes
+static bool checkBlackList( CFBundleRef i_xBundle )
+{
+ rtl::OUString aBundleName;
+ CFTypeRef bundlename = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("CFBundleName"));
+ if( bundlename && CFGetTypeID(bundlename) == CFStringGetTypeID() )
+ aBundleName = getString( static_cast<CFStringRef>(bundlename) );
+
+ rtl::OUString aBundleVersion;
+ CFTypeRef bundleversion = CFBundleGetValueForInfoDictionaryKey( i_xBundle, CFSTR("CFBundleVersion"));
+ if( bundleversion && CFGetTypeID(bundleversion) == CFStringGetTypeID() )
+ aBundleVersion = getString( static_cast<CFStringRef>(bundleversion) );
+
+ bool bReject = false;
+ // #i102735# VLC plugin prior to 1.0 tends to crash
+ if( aBundleName.equalsAscii( "VLC Plug-in" ) )
+ {
+ sal_Int32 nIndex = 0;
+ rtl::OUString aMajor( aBundleVersion.getToken( 0, '.', nIndex ) );
+ if( aMajor.toInt32() < 1 )
+ {
+ bReject = true;
+ }
+ }
+ // #i103674# Garmin Communicator Plugin crashes
+ else if( aBundleName.equalsAscii( "Garmin Communicator Plugin" ) )
+ {
+ bReject = true;
+ }
+
+ #if OSL_DEBUG_LEVEL > 1
+ if( bReject )
+ fprintf( stderr, "rejecting plugin \"%s\" version %s\n",
+ rtl::OUStringToOString( aBundleName, RTL_TEXTENCODING_UTF8 ).getStr(),
+ rtl::OUStringToOString( aBundleVersion, RTL_TEXTENCODING_UTF8 ).getStr()
+ );
+ #endif
+
+ return bReject;
+}
+
static int getPluginDescriptions( CFBundleRef i_xBundle , list< PluginDescription* >& io_rDescriptions )
{
int nDescriptions = 0;
if( ! i_xBundle )
return nDescriptions;
+ if( checkBlackList( i_xBundle ) )
+ return 0;
+
rtl::OUString aPlugURL;
CFURLRef xURL = CFBundleCopyBundleURL( i_xBundle );
aPlugURL = getString( xURL );
@@ -424,7 +468,8 @@ static int getPluginDescriptions( CFBundleRef i_xBundle , list< PluginDescriptio
fprintf( stderr, "URL: %s\nname: %s\ndescription: %s\n",
rtl::OUStringToOString( aPlugURL, RTL_TEXTENCODING_UTF8 ).getStr(),
rtl::OUStringToOString( aPlugName, RTL_TEXTENCODING_UTF8 ).getStr(),
- rtl::OUStringToOString( aPlugDescription, RTL_TEXTENCODING_UTF8 ).getStr() );
+ rtl::OUStringToOString( aPlugDescription, RTL_TEXTENCODING_UTF8 ).getStr()
+ );
#endif
@@ -535,7 +580,7 @@ static rtl::OUString FindFolderURL( FSVolumeRefNum vRefNum, OSType folderType )
return aRet;
}
-Sequence<PluginDescription> XPluginManager_Impl::getPluginDescriptions() throw()
+Sequence<PluginDescription> XPluginManager_Impl::impl_getPluginDescriptions() throw()
{
static Sequence<PluginDescription> aDescriptions;
static BOOL bHavePlugins = FALSE;
diff --git a/extensions/source/plugin/aqua/makefile.mk b/extensions/source/plugin/aqua/makefile.mk
index b68ee9f73f93..9cbe83809d11 100644
--- a/extensions/source/plugin/aqua/makefile.mk
+++ b/extensions/source/plugin/aqua/makefile.mk
@@ -55,7 +55,6 @@ CDEFS+=-DOJI
.ENDIF
.IF "$(GUIBASE)"=="aqua"
-OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions
CFLAGSCXX+=$(OBJCXXFLAGS)
.ENDIF # "$(GUIBASE)"=="aqua"
diff --git a/extensions/source/plugin/base/makefile.mk b/extensions/source/plugin/base/makefile.mk
index f25f8fb47679..1e0a39b663e6 100644
--- a/extensions/source/plugin/base/makefile.mk
+++ b/extensions/source/plugin/base/makefile.mk
@@ -51,7 +51,6 @@ CDEFS+=-DDISABLE_XAW
.IF "$(WITH_MOZILLA)" != "NO"
.IF "$(GUIBASE)"=="aqua"
-OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions
CFLAGSCXX+=$(OBJCXXFLAGS)
.ENDIF # "$(GUIBASE)"=="aqua"
diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx
index 92fca1211caa..bb5422c69a51 100644
--- a/extensions/source/plugin/base/manager.cxx
+++ b/extensions/source/plugin/base/manager.cxx
@@ -35,19 +35,19 @@
#include <cstdarg>
#endif
-#include <plugin/impl.hxx>
+#include "plugin/impl.hxx"
-#ifndef _OSL_MUTEX_HXX
-#include <osl/mutex.hxx>
-#endif
-#include <svtools/pathoptions.hxx>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XEnumeration.hpp>
-#include <com/sun/star/container/XElementAccess.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/loader/XImplementationLoader.hpp>
-#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
+#include "osl/mutex.hxx"
+#include "svtools/pathoptions.hxx"
+#include "vcl/configsettings.hxx"
+
+#include "com/sun/star/container/XEnumerationAccess.hpp"
+#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/container/XEnumeration.hpp"
+#include "com/sun/star/container/XElementAccess.hpp"
+#include "com/sun/star/container/XIndexAccess.hpp"
+#include "com/sun/star/loader/XImplementationLoader.hpp"
+#include "com/sun/star/loader/CannotActivateFactoryException.hpp"
PluginManager* PluginManager::pManager = NULL;
@@ -165,6 +165,20 @@ XPlugin_Impl* XPluginManager_Impl::getPluginImplementation( const Reference< ::c
return NULL;
}
+Sequence<com::sun::star::plugin::PluginDescription> XPluginManager_Impl::getPluginDescriptions() throw()
+{
+ Sequence<com::sun::star::plugin::PluginDescription> aRet;
+
+ vcl::SettingsConfigItem* pCfg = vcl::SettingsConfigItem::get();
+ rtl::OUString aVal( pCfg->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BrowserPlugins" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Disabled" ) ) ) );
+ if( ! aVal.toBoolean() )
+ {
+ aRet = impl_getPluginDescriptions();
+ }
+ return aRet;
+}
+
Reference< ::com::sun::star::plugin::XPlugin > XPluginManager_Impl::createPlugin( const Reference< ::com::sun::star::plugin::XPluginContext >& acontext, INT16 mode, const Sequence< ::rtl::OUString >& argn, const Sequence< ::rtl::OUString >& argv, const ::com::sun::star::plugin::PluginDescription& plugintype)
throw( RuntimeException,::com::sun::star::plugin::PluginException )
{
diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx
index 28524770521c..e9adee5088dd 100644
--- a/extensions/source/plugin/inc/plugin/impl.hxx
+++ b/extensions/source/plugin/inc/plugin/impl.hxx
@@ -293,6 +293,9 @@ public:
virtual Reference< com::sun::star::plugin::XPluginContext > SAL_CALL createPluginContext() throw();
// has to be implemented per system
+ virtual Sequence< com::sun::star::plugin::PluginDescription > SAL_CALL impl_getPluginDescriptions(void) throw();
+ // calls system specific impl_getPluginDescriptions
+ // checks whether plugins are disabled
virtual Sequence< com::sun::star::plugin::PluginDescription > SAL_CALL getPluginDescriptions(void) throw();
virtual Reference< com::sun::star::plugin::XPlugin > SAL_CALL createPlugin( const Reference< com::sun::star::plugin::XPluginContext > & acontext, sal_Int16 mode, const Sequence< rtl::OUString >& argn, const Sequence< rtl::OUString >& argv, const com::sun::star::plugin::PluginDescription& plugintype) throw( RuntimeException,::com::sun::star::plugin::PluginException );
diff --git a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
index 5f0e639e1c7e..862075d92c28 100644
--- a/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
+++ b/extensions/source/plugin/inc/plugin/unx/plugcon.hxx
@@ -67,7 +67,9 @@ extern "C" {
# endif
#endif
#include <X11/Xatom.h>
-#define XP_UNIX
+#ifndef XP_UNIX
+# define XP_UNIX
+#endif
#define MOZ_X11
#include <stdio.h>
#ifdef SYSTEM_MOZILLA
@@ -102,7 +104,7 @@ extern "C" {
extern "C" {
#include <npsdk/npupp.h>
}
-#include <npapi.h>
+#include <npsdk/npapi.h>
#if NP_VERSION_MINOR < 17
// compatibility hack: compile with older NPN api header, but define
diff --git a/extensions/source/plugin/unx/unxmgr.cxx b/extensions/source/plugin/unx/unxmgr.cxx
index ff17d1e24324..1f1d291daf8d 100644
--- a/extensions/source/plugin/unx/unxmgr.cxx
+++ b/extensions/source/plugin/unx/unxmgr.cxx
@@ -226,7 +226,7 @@ static void CheckPluginRegistryFiles( const rtl::OString& rPath, list< PluginDes
closedir( pDIR );
}
-Sequence<PluginDescription> XPluginManager_Impl::getPluginDescriptions() throw()
+Sequence<PluginDescription> XPluginManager_Impl::impl_getPluginDescriptions() throw()
{
static Sequence<PluginDescription> aDescriptions;
static BOOL bHavePlugins = FALSE;
diff --git a/extensions/source/plugin/util/makefile.mk b/extensions/source/plugin/util/makefile.mk
index 657992ec1b33..dfba6a755201 100644
--- a/extensions/source/plugin/util/makefile.mk
+++ b/extensions/source/plugin/util/makefile.mk
@@ -96,8 +96,8 @@ SHL1STDLIBS+= \
$(CPPULIB) \
$(SALLIB)
-.IF "$(OS)"=="MACOSX" && "$(GUIBASE)"=="unx"
-SHL1STDLIBS+= -lX11
+.IF "$(GUIBASE)"=="unx"
+SHL1STDLIBS+=$(X11LINK_DYNAMIC)
.ENDIF
SHL1STDLIBS+=$(SHL1OWNLIBS)
diff --git a/extensions/source/plugin/win/winmgr.cxx b/extensions/source/plugin/win/winmgr.cxx
index 6a63ad8b5402..caf7a38a5458 100644
--- a/extensions/source/plugin/win/winmgr.cxx
+++ b/extensions/source/plugin/win/winmgr.cxx
@@ -325,7 +325,7 @@ static void add_SO_Plugins( PluginLocationMap & rPlugins )
}
//__________________________________________________________________________________________________
-Sequence< PluginDescription > XPluginManager_Impl::getPluginDescriptions(void) throw()
+Sequence< PluginDescription > XPluginManager_Impl::impl_getPluginDescriptions(void) throw()
{
Guard< Mutex > aGuard( Mutex::getGlobalMutex() );
static Sequence<PluginDescription > s_aDescriptions( 0 );
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index 23008fc9a1de..bd60181f1d0e 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -1244,14 +1244,74 @@ namespace pcr
}
//------------------------------------------------------------------
+ long OBrowserListBox::PreNotify( NotifyEvent& _rNEvt )
+ {
+ switch ( _rNEvt.GetType() )
+ {
+ case EVENT_KEYINPUT:
+ {
+ const KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent();
+ if ( ( pKeyEvent->GetKeyCode().GetModifier() != 0 )
+ || ( ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEUP )
+ && ( pKeyEvent->GetKeyCode().GetCode() != KEY_PAGEDOWN )
+ )
+ )
+ break;
+
+ long nScrollOffset = 0;
+ if ( m_aVScroll.IsVisible() )
+ {
+ if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP )
+ nScrollOffset = -m_aVScroll.GetPageSize();
+ else if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN )
+ nScrollOffset = m_aVScroll.GetPageSize();
+ }
+
+ if ( nScrollOffset )
+ {
+ long nNewThumbPos = m_aVScroll.GetThumbPos() + nScrollOffset;
+ nNewThumbPos = ::std::max( nNewThumbPos, m_aVScroll.GetRangeMin() );
+ nNewThumbPos = ::std::min( nNewThumbPos, m_aVScroll.GetRangeMax() );
+ m_aVScroll.DoScroll( nNewThumbPos );
+ nNewThumbPos = m_aVScroll.GetThumbPos();
+
+ sal_uInt16 nFocusControlPos = 0;
+ sal_uInt16 nActiveControlPos = impl_getControlPos( m_xActiveControl );
+ if ( nActiveControlPos < nNewThumbPos )
+ nFocusControlPos = (sal_uInt16)nNewThumbPos;
+ else if ( nActiveControlPos >= nNewThumbPos + CalcVisibleLines() )
+ nFocusControlPos = (sal_uInt16)nNewThumbPos + CalcVisibleLines() - 1;
+ if ( nFocusControlPos )
+ {
+ if ( nFocusControlPos < m_aOrderedLines.size() )
+ {
+ m_aOrderedLines[ nFocusControlPos ]->second.pLine->GrabFocus();
+ }
+ else
+ OSL_ENSURE( false, "OBrowserListBox::PreNotify: internal error, invalid focus control position!" );
+ }
+ }
+
+ return 1L;
+ // handled this. In particular, we also consume PageUp/Down events if we do not use them for scrolling,
+ // otherwise they would be used to scroll the document view, which does not sound like it is desired by
+ // the user.
+ }
+ }
+ return Control::PreNotify( _rNEvt );
+ }
+
+ //------------------------------------------------------------------
long OBrowserListBox::Notify( NotifyEvent& _rNEvt )
{
- if ( EVENT_COMMAND == _rNEvt.GetType() )
+ switch ( _rNEvt.GetType() )
+ {
+ case EVENT_COMMAND:
{
const CommandEvent* pCommand = _rNEvt.GetCommandEvent();
if ( ( COMMAND_WHEEL == pCommand->GetCommand() )
- || ( COMMAND_STARTAUTOSCROLL == pCommand->GetCommand() )
- || ( COMMAND_AUTOSCROLL == pCommand->GetCommand() )
+ || ( COMMAND_STARTAUTOSCROLL == pCommand->GetCommand() )
+ || ( COMMAND_AUTOSCROLL == pCommand->GetCommand() )
)
{
// interested in scroll events if we have a scrollbar
@@ -1261,6 +1321,9 @@ namespace pcr
}
}
}
+ break;
+ }
+
return Control::Notify( _rNEvt );
}
diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx
index a89e1dc83c39..46ae1f94aaa8 100644
--- a/extensions/source/propctrlr/browserlistbox.hxx
+++ b/extensions/source/propctrlr/browserlistbox.hxx
@@ -149,6 +149,7 @@ namespace pcr
void EnableUpdate();
void DisableUpdate();
long Notify( NotifyEvent& _rNEvt );
+ long PreNotify( NotifyEvent& _rNEvt );
void SetListener( IPropertyLineListener* _pListener );
void SetObserver( IPropertyControlObserver* _pObserver );
diff --git a/extensions/source/propctrlr/eformspropertyhandler.cxx b/extensions/source/propctrlr/eformspropertyhandler.cxx
index d0ac0de3857a..b200d37cb83b 100644
--- a/extensions/source/propctrlr/eformspropertyhandler.cxx
+++ b/extensions/source/propctrlr/eformspropertyhandler.cxx
@@ -412,6 +412,18 @@ namespace pcr
}
//--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL EFormsPropertyHandler::getSupersededProperties( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( !m_pHelper.get() )
+ return Sequence< ::rtl::OUString >();
+
+ Sequence< ::rtl::OUString > aReturn( 1 );
+ aReturn[ 0 ] = PROPERTY_INPUT_REQUIRED;
+ return aReturn;
+ }
+
+ //--------------------------------------------------------------------
LineDescriptor SAL_CALL EFormsPropertyHandler::describePropertyLine( const ::rtl::OUString& _rPropertyName,
const Reference< XPropertyControlFactory >& _rxControlFactory )
throw (UnknownPropertyException, NullPointerException, RuntimeException)
diff --git a/extensions/source/propctrlr/eformspropertyhandler.hxx b/extensions/source/propctrlr/eformspropertyhandler.hxx
index 700cf43431cf..55c464d77076 100644
--- a/extensions/source/propctrlr/eformspropertyhandler.hxx
+++ b/extensions/source/propctrlr/eformspropertyhandler.hxx
@@ -77,6 +77,8 @@ namespace pcr
virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
SAL_CALL getActuatingProperties( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
+ SAL_CALL getSupersededProperties( ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::inspection::LineDescriptor
SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::inspection::InteractiveSelectionResult
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index 4d7c09563b5d..05d0984349b4 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -53,6 +53,7 @@
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/form/XForm.hpp>
#include <com/sun/star/form/XFormController.hpp>
#include <com/sun/star/inspection/PropertyControlType.hpp>
@@ -146,6 +147,7 @@ namespace pcr
/** === end UNO using === **/
namespace PropertyControlType = ::com::sun::star::inspection::PropertyControlType;
namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute;
+ namespace FormComponentType = ::com::sun::star::form::FormComponentType;
//====================================================================
//= EventDescription
@@ -538,6 +540,7 @@ namespace pcr
,m_aPropertyListeners( m_aMutex )
,m_bEventsMapInitialized( false )
,m_bIsDialogElement( false )
+ ,m_nGridColumnType( -1 )
{
DBG_CTOR( EventHandler, NULL );
}
@@ -602,6 +605,7 @@ namespace pcr
m_aEvents.swap( aEmpty );
m_bIsDialogElement = false;
+ m_nGridColumnType = -1;
try
{
Reference< XPropertySetInfo > xPSI( m_xComponent->getPropertySetInfo() );
@@ -610,6 +614,15 @@ namespace pcr
&& xPSI->hasPropertyByName( PROPERTY_HEIGHT )
&& xPSI->hasPropertyByName( PROPERTY_POSITIONX )
&& xPSI->hasPropertyByName( PROPERTY_POSITIONY );
+
+ Reference< XChild > xAsChild( _rxIntrospectee, UNO_QUERY );
+ if ( xAsChild.is() && !Reference< XForm >( _rxIntrospectee, UNO_QUERY ).is() )
+ {
+ if ( FormComponentType::GRIDCONTROL == classifyComponent( xAsChild->getParent() ) )
+ {
+ m_nGridColumnType = classifyComponent( _rxIntrospectee );
+ }
+ }
}
catch( const Exception& )
{
@@ -827,12 +840,15 @@ namespace pcr
const ::rtl::OUString* pMethods = aMethods.getConstArray();
sal_uInt32 methodCount = aMethods.getLength();
- for (sal_uInt32 method = 0 ; method < methodCount ; method++,++pMethods )
+ for (sal_uInt32 method = 0 ; method < methodCount ; ++method, ++pMethods )
{
EventDescription aEvent;
if ( !lcl_getEventDescriptionForMethod( *pMethods, aEvent ) )
continue;
+ if ( !impl_filterMethod_nothrow( aEvent ) )
+ continue;
+
const_cast< EventHandler* >( this )->m_aEvents.insert( EventMap::value_type(
lcl_getEventPropertyName( sListenerClassName, *pMethods ), aEvent ) );
}
@@ -1272,6 +1288,29 @@ namespace pcr
}
}
+ //--------------------------------------------------------------------
+ bool EventHandler::impl_filterMethod_nothrow( const EventDescription& _rEvent ) const
+ {
+ // some (control-triggered) events do not make sense for certain grid control columns. However,
+ // our mechnism to retrieve control-triggered events does not know about this, so we do some
+ // late filtering here.
+ switch ( m_nGridColumnType )
+ {
+ case FormComponentType::COMBOBOX:
+ if ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.nUniqueBrowseId )
+ return false;
+ break;
+ case FormComponentType::LISTBOX:
+ if ( ( UID_BRWEVT_CHANGED == _rEvent.nUniqueBrowseId )
+ || ( UID_BRWEVT_ACTIONPERFORMED == _rEvent.nUniqueBrowseId )
+ )
+ return false;
+ break;
+ }
+
+ return true;
+ }
+
//........................................................................
} // namespace pcr
//........................................................................
diff --git a/extensions/source/propctrlr/eventhandler.hxx b/extensions/source/propctrlr/eventhandler.hxx
index a68fe100afb4..dcb70f8fd2b3 100644
--- a/extensions/source/propctrlr/eventhandler.hxx
+++ b/extensions/source/propctrlr/eventhandler.hxx
@@ -107,6 +107,8 @@ namespace pcr
/// is our introspectee a dialog element?
bool m_bIsDialogElement;
// TODO: move different handling into different derived classes?
+ /// (FormComponent) type of the grid column being inspected, or -1 if we're not inspecting a grid column
+ sal_Int16 m_nGridColumnType;
public:
// XServiceInfo - static versions
@@ -248,6 +250,12 @@ namespace pcr
::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
impl_getContextFrame_nothrow() const;
+ /** approves or denies a certain method to be included in the UI
+ @return
+ <TRUE/> if and only if the given method is allowed.
+ */
+ bool impl_filterMethod_nothrow( const EventDescription& _rEvent ) const;
+
private:
EventHandler(); // never implemented
EventHandler( const EventHandler& ); // never implemented
diff --git a/extensions/source/propctrlr/formbrowsertools.cxx b/extensions/source/propctrlr/formbrowsertools.cxx
index 898a618f53a0..ccce47a7346d 100644
--- a/extensions/source/propctrlr/formbrowsertools.cxx
+++ b/extensions/source/propctrlr/formbrowsertools.cxx
@@ -53,6 +53,7 @@ namespace pcr
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
+ //------------------------------------------------------------------------
::rtl::OUString GetUIHeadlineName(sal_Int16 nClassId, const Any& aUnoObj)
{
PcrClient aResourceAccess;
@@ -130,6 +131,20 @@ namespace pcr
return sClassName;
}
+ //------------------------------------------------------------------------
+ sal_Int16 classifyComponent( const Reference< XInterface >& _rxComponent )
+ {
+ Reference< XPropertySet > xComponentProps( _rxComponent, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xPSI( xComponentProps->getPropertySetInfo(), UNO_SET_THROW );
+
+ sal_Int16 nControlType( FormComponentType::CONTROL );
+ if ( xPSI->hasPropertyByName( PROPERTY_CLASSID ) )
+ {
+ OSL_VERIFY( xComponentProps->getPropertyValue( PROPERTY_CLASSID ) >>= nControlType );
+ }
+ return nControlType;
+ }
+
//............................................................................
} // namespace pcr
//............................................................................
diff --git a/extensions/source/propctrlr/formbrowsertools.hxx b/extensions/source/propctrlr/formbrowsertools.hxx
index 6fb0c732ea1f..760aa9cb6d42 100644
--- a/extensions/source/propctrlr/formbrowsertools.hxx
+++ b/extensions/source/propctrlr/formbrowsertools.hxx
@@ -44,6 +44,7 @@ namespace pcr
//............................................................................
::rtl::OUString GetUIHeadlineName(sal_Int16 _nClassId, const ::com::sun::star::uno::Any& _rUnoObject);
+ sal_Int16 classifyComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
//========================================================================
struct FindPropertyByHandle : public ::std::unary_function< ::com::sun::star::beans::Property, bool >
diff --git a/extensions/source/propctrlr/makefile.mk b/extensions/source/propctrlr/makefile.mk
index c043850e3c73..9b9ffe47aa15 100644
--- a/extensions/source/propctrlr/makefile.mk
+++ b/extensions/source/propctrlr/makefile.mk
@@ -120,6 +120,7 @@ SHL1TARGET= $(TARGET)$(DLLPOSTFIX)
SHL1VERSIONMAP= $(TARGET).map
SHL1STDLIBS= \
+ $(SVXCORELIB) \
$(SVXLIB) \
$(SFXLIB) \
$(SVTOOLLIB)\
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index c4dff2512a29..ac9ae434cad6 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -114,6 +114,7 @@ namespace pcr
,m_bContainerFocusListening( false )
,m_bSuspendingPropertyHandlers( false )
,m_bConstructed( false )
+ ,m_bBindingIntrospectee( false )
{
DBG_CTOR(OPropertyBrowserController,NULL);
}
@@ -300,7 +301,13 @@ namespace pcr
// it in order to inspect another object.
throw VetoException();
}
+ if ( m_bBindingIntrospectee )
+ throw VetoException();
+
+ m_bBindingIntrospectee = true;
impl_rebindToInspectee_nothrow( InterfaceArray( _rObjects.getConstArray(), _rObjects.getConstArray() + _rObjects.getLength() ) );
+ m_bBindingIntrospectee = false;
+
}
//--------------------------------------------------------------------
diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx
index 3254294e4777..bfa55053338b 100644
--- a/extensions/source/propctrlr/propcontroller.hxx
+++ b/extensions/source/propctrlr/propcontroller.hxx
@@ -168,6 +168,7 @@ namespace pcr
bool m_bContainerFocusListening;
bool m_bSuspendingPropertyHandlers;
bool m_bConstructed;
+ bool m_bBindingIntrospectee;
protected:
DECLARE_XINTERFACE()
diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx
index ebe5b7c4ed48..d87865c0405c 100644
--- a/extensions/source/propctrlr/standardcontrol.hxx
+++ b/extensions/source/propctrlr/standardcontrol.hxx
@@ -69,6 +69,7 @@ namespace pcr
{
protected:
typedef ControlWindow< LISTBOX_WINDOW > ListBoxType;
+
public:
ListLikeControlWithModifyHandler( Window* _pParent, WinBits _nStyle )
:ListBoxType( _pParent, _nStyle )
@@ -76,8 +77,35 @@ namespace pcr
}
void SetModifyHdl( const Link& _rLink ) { ListBoxType::SetSelectHdl( _rLink ); }
+
+ protected:
+ long PreNotify( NotifyEvent& _rNEvt );
};
+ //------------------------------------------------------------------------
+ template< class LISTBOX_WINDOW >
+ long ListLikeControlWithModifyHandler< LISTBOX_WINDOW >::PreNotify( NotifyEvent& _rNEvt )
+ {
+ if ( _rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const ::KeyEvent* pKeyEvent = _rNEvt.GetKeyEvent();
+ if ( ( pKeyEvent->GetKeyCode().GetModifier() == 0 )
+ && ( ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP )
+ || ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN )
+ )
+ )
+ {
+ if ( !ListBoxType::IsInDropDown() )
+ {
+ // don't give the base class a chance to consume the event, in the property browser, it is
+ // intended to scroll the complete property page
+ return ListBoxType::GetParent()->PreNotify( _rNEvt );
+ }
+ }
+ }
+ return ListBoxType::PreNotify( _rNEvt );
+ }
+
//========================================================================
//= OTimeControl
//========================================================================
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index c0374bbb3ce5..de2e7f272350 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -224,6 +224,19 @@ void SaneDlg::InitFields()
maReslBox.SetMin( (long)pDouble[0] );
maReslBox.SetMax( (long)pDouble[1] );
maReslBox.InsertValue( (long)pDouble[0] );
+ // mh@openoffice.org: issue 68557: Can only select 75 and 2400 dpi in Scanner dialogue
+ // scanner allows random setting of dpi resolution, a slider might be useful
+ // support that
+ // workaround: offer at least some more standard dpi resolution between
+ // min and max value
+ int bGot300 = 0;
+ for ( int nRes = (long) pDouble[0] * 2; nRes < (long) pDouble[1]; nRes = nRes * 2 )
+ {
+ if ( !bGot300 && nRes > 300 ) {
+ nRes = 300; bGot300 = 1;
+ }
+ maReslBox.InsertValue(nRes);
+ }
maReslBox.InsertValue( (long)pDouble[1] );
}
if( pDouble )
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
index 2e0d470b3241..0b1d1e68f9f3 100644
--- a/extensions/source/scanner/scanunx.cxx
+++ b/extensions/source/scanner/scanunx.cxx
@@ -197,7 +197,14 @@ void ScannerThread::run()
void ScannerManager::DestroyData()
{
- // unused
+ // was unused, now because of i99835: "Scanning interface not SANE API compliant"
+ // delete all SaneHolder to get Sane Dtor called
+ int i;
+ for ( i = allSanes.Count(); i > 0; i-- )
+ {
+ SaneHolder *pSaneHolder = allSanes.GetObject(i-1);
+ if ( pSaneHolder ) delete pSaneHolder;
+ }
}
// -----------------------------------------------------------------------------
diff --git a/extensions/util/hidother.src b/extensions/util/hidother.src
index 49b67060f8a3..3f8fcd5ed7f8 100644
--- a/extensions/util/hidother.src
+++ b/extensions/util/hidother.src
@@ -30,208 +30,92 @@
#include "../inc/extensio.hrc"
-hidspecial HID_BIB_CHANGESOURCE { HelpId = HID_BIB_CHANGESOURCE; }
-hidspecial HID_BIB_MAPPINGDLG { HelpId = HID_BIB_MAPPINGDLG; }
-hidspecial HID_BIB_TBX_TABLE { HelpId = HID_BIB_TBX_TABLE; }
-hidspecial HID_BIB_TBX_SEARCH { HelpId = HID_BIB_TBX_SEARCH; }
-hidspecial HID_BIB_TBX_AUTOFILTER { HelpId = HID_BIB_TBX_AUTOFILTER; }
+hidspecial HID_ABSPILOT { HelpId = HID_ABSPILOT; }
+hidspecial HID_ABSPILOT_CANCEL { HelpId = HID_ABSPILOT_CANCEL; }
+hidspecial HID_ABSPILOT_FINISH { HelpId = HID_ABSPILOT_FINISH; }
+hidspecial HID_ABSPILOT_NEXT { HelpId = HID_ABSPILOT_NEXT; }
+hidspecial HID_ABSPILOT_PREVIOUS { HelpId = HID_ABSPILOT_PREVIOUS; }
-hidspecial HID_BIB_IDENTIFIER_POS { HelpId = HID_BIB_IDENTIFIER_POS; }
+hidspecial HID_BIB_ADDRESS_POS { HelpId = HID_BIB_ADDRESS_POS; }
+hidspecial HID_BIB_ANNOTE_POS { HelpId = HID_BIB_ANNOTE_POS; }
hidspecial HID_BIB_AUTHORITYTYPE_POS { HelpId = HID_BIB_AUTHORITYTYPE_POS; }
hidspecial HID_BIB_AUTHOR_POS { HelpId = HID_BIB_AUTHOR_POS; }
-hidspecial HID_BIB_TITLE_POS { HelpId = HID_BIB_TITLE_POS; }
-hidspecial HID_BIB_YEAR_POS { HelpId = HID_BIB_YEAR_POS; }
-hidspecial HID_BIB_ISBN_POS { HelpId = HID_BIB_ISBN_POS; }
hidspecial HID_BIB_BOOKTITLE_POS { HelpId = HID_BIB_BOOKTITLE_POS; }
+hidspecial HID_BIB_CHANGESOURCE { HelpId = HID_BIB_CHANGESOURCE; }
hidspecial HID_BIB_CHAPTER_POS { HelpId = HID_BIB_CHAPTER_POS; }
+hidspecial HID_BIB_CONTROL_PAGE { HelpId = HID_BIB_CONTROL_PAGE; }
+hidspecial HID_BIB_CONTROL_PARENT { HelpId = HID_BIB_CONTROL_PARENT; }
+hidspecial HID_BIB_CUSTOM1_POS { HelpId = HID_BIB_CUSTOM1_POS; }
+hidspecial HID_BIB_CUSTOM2_POS { HelpId = HID_BIB_CUSTOM2_POS; }
+hidspecial HID_BIB_CUSTOM3_POS { HelpId = HID_BIB_CUSTOM3_POS; }
+hidspecial HID_BIB_CUSTOM4_POS { HelpId = HID_BIB_CUSTOM4_POS; }
+hidspecial HID_BIB_CUSTOM5_POS { HelpId = HID_BIB_CUSTOM5_POS; }
+hidspecial HID_BIB_DB_GRIDCTRL { HelpId = HID_BIB_DB_GRIDCTRL; }
+hidspecial HID_BIB_DB_TBX { HelpId = HID_BIB_DB_TBX; }
+hidspecial HID_BIB_DELETE_RECORD { HelpId = HID_BIB_DELETE_RECORD; }
hidspecial HID_BIB_EDITION_POS { HelpId = HID_BIB_EDITION_POS; }
hidspecial HID_BIB_EDITOR_POS { HelpId = HID_BIB_EDITOR_POS; }
hidspecial HID_BIB_HOWPUBLISHED_POS { HelpId = HID_BIB_HOWPUBLISHED_POS; }
+hidspecial HID_BIB_IDENTIFIER_POS { HelpId = HID_BIB_IDENTIFIER_POS; }
+hidspecial HID_BIB_INSERT_RECORD { HelpId = HID_BIB_INSERT_RECORD; }
hidspecial HID_BIB_INSTITUTION_POS { HelpId = HID_BIB_INSTITUTION_POS; }
+hidspecial HID_BIB_ISBN_POS { HelpId = HID_BIB_ISBN_POS; }
hidspecial HID_BIB_JOURNAL_POS { HelpId = HID_BIB_JOURNAL_POS; }
+hidspecial HID_BIB_MAPPINGDLG { HelpId = HID_BIB_MAPPINGDLG; }
hidspecial HID_BIB_MONTH_POS { HelpId = HID_BIB_MONTH_POS; }
hidspecial HID_BIB_NOTE_POS { HelpId = HID_BIB_NOTE_POS; }
-hidspecial HID_BIB_ANNOTE_POS { HelpId = HID_BIB_ANNOTE_POS; }
hidspecial HID_BIB_NUMBER_POS { HelpId = HID_BIB_NUMBER_POS; }
hidspecial HID_BIB_ORGANIZATIONS_POS { HelpId = HID_BIB_ORGANIZATIONS_POS; }
hidspecial HID_BIB_PAGES_POS { HelpId = HID_BIB_PAGES_POS; }
hidspecial HID_BIB_PUBLISHER_POS { HelpId = HID_BIB_PUBLISHER_POS; }
-hidspecial HID_BIB_ADDRESS_POS { HelpId = HID_BIB_ADDRESS_POS; }
+hidspecial HID_BIB_REPORTTYPE_POS { HelpId = HID_BIB_REPORTTYPE_POS; }
hidspecial HID_BIB_SCHOOL_POS { HelpId = HID_BIB_SCHOOL_POS; }
hidspecial HID_BIB_SERIES_POS { HelpId = HID_BIB_SERIES_POS; }
-hidspecial HID_BIB_REPORTTYPE_POS { HelpId = HID_BIB_REPORTTYPE_POS; }
-hidspecial HID_BIB_VOLUME_POS { HelpId = HID_BIB_VOLUME_POS; }
+hidspecial HID_BIB_TBX_AUTOFILTER { HelpId = HID_BIB_TBX_AUTOFILTER; }
+hidspecial HID_BIB_TBX_SEARCH { HelpId = HID_BIB_TBX_SEARCH; }
+hidspecial HID_BIB_TBX_TABLE { HelpId = HID_BIB_TBX_TABLE; }
+hidspecial HID_BIB_TITLE_POS { HelpId = HID_BIB_TITLE_POS; }
hidspecial HID_BIB_URL_POS { HelpId = HID_BIB_URL_POS; }
-hidspecial HID_BIB_CUSTOM1_POS { HelpId = HID_BIB_CUSTOM1_POS; }
-hidspecial HID_BIB_CUSTOM2_POS { HelpId = HID_BIB_CUSTOM2_POS; }
-hidspecial HID_BIB_CUSTOM3_POS { HelpId = HID_BIB_CUSTOM3_POS; }
-hidspecial HID_BIB_CUSTOM4_POS { HelpId = HID_BIB_CUSTOM4_POS; }
-hidspecial HID_BIB_CUSTOM5_POS { HelpId = HID_BIB_CUSTOM5_POS; }
-
-hidspecial HID_BIB_DB_TBX { HelpId = HID_BIB_DB_TBX; }
-hidspecial HID_BIB_DB_GRIDCTRL { HelpId = HID_BIB_DB_GRIDCTRL; }
-hidspecial HID_BIB_CONTROL_PAGE { HelpId = HID_BIB_CONTROL_PAGE; }
-hidspecial HID_BIB_CONTROL_PARENT { HelpId = HID_BIB_CONTROL_PARENT; }
-
-hidspecial HID_GRIDWIZARD_PREVIOUS { HelpId = HID_GRIDWIZARD_PREVIOUS; };
-hidspecial HID_GRIDWIZARD_NEXT { HelpId = HID_GRIDWIZARD_NEXT; }
-hidspecial HID_GRIDWIZARD_CANCEL { HelpId = HID_GRIDWIZARD_CANCEL; }
-hidspecial HID_GRIDWIZARD_FINISH { HelpId = HID_GRIDWIZARD_FINISH; }
-hidspecial HID_GROUPWIZARD_PREVIOUS { HelpId = HID_GROUPWIZARD_PREVIOUS; }
-hidspecial HID_GROUPWIZARD_NEXT { HelpId = HID_GROUPWIZARD_NEXT; }
-hidspecial HID_GROUPWIZARD_CANCEL { HelpId = HID_GROUPWIZARD_CANCEL; }
-hidspecial HID_GROUPWIZARD_FINISH { HelpId = HID_GROUPWIZARD_FINISH; }
-hidspecial HID_LISTWIZARD_PREVIOUS { HelpId = HID_LISTWIZARD_PREVIOUS; }
-hidspecial HID_LISTWIZARD_NEXT { HelpId = HID_LISTWIZARD_NEXT; }
-hidspecial HID_LISTWIZARD_CANCEL { HelpId = HID_LISTWIZARD_CANCEL; }
-hidspecial HID_LISTWIZARD_FINISH { HelpId = HID_LISTWIZARD_FINISH; }
-hidspecial HID_DBIWIZARD_PREVIOUS { HelpId = HID_DBIWIZARD_PREVIOUS; }
-hidspecial HID_DBIWIZARD_NEXT { HelpId = HID_DBIWIZARD_NEXT; }
-hidspecial HID_DBIWIZARD_CANCEL { HelpId = HID_DBIWIZARD_CANCEL; }
-hidspecial HID_DBIWIZARD_FINISH { HelpId = HID_DBIWIZARD_FINISH; }
-hidspecial UID_DBIWIZARD_SOURCESTATS { HelpId = UID_DBIWIZARD_SOURCESTATS; }
-hidspecial UID_DBIWIZARD_SOURCEFILE { HelpId = UID_DBIWIZARD_SOURCEFILE; }
-hidspecial UID_DBIWIZARD_QUERIES { HelpId = UID_DBIWIZARD_QUERIES; }
-hidspecial UID_DBIWIZARD_FORMS { HelpId = UID_DBIWIZARD_FORMS; }
-hidspecial UID_DBIWIZARD_FORMS_SAVETO { HelpId = UID_DBIWIZARD_FORMS_SAVETO; }
-hidspecial UID_BIB_FRAME_WINDOW { HelpId = UID_BIB_FRAME_WINDOW;}
+hidspecial HID_BIB_VOLUME_POS { HelpId = HID_BIB_VOLUME_POS; }
+hidspecial HID_BIB_YEAR_POS { HelpId = HID_BIB_YEAR_POS; }
-hidspecial HID_ABSPILOT_PREVIOUS { HelpId = HID_ABSPILOT_PREVIOUS; }
-hidspecial HID_ABSPILOT_NEXT { HelpId = HID_ABSPILOT_NEXT; }
-hidspecial HID_ABSPILOT_CANCEL { HelpId = HID_ABSPILOT_CANCEL; }
-hidspecial HID_ABSPILOT_FINISH { HelpId = HID_ABSPILOT_FINISH; }
-hidspecial HID_ABSPILOT { HelpId = HID_ABSPILOT; }
+hidspecial HID_CHECK_FOR_UPD_CANCEL { HelpId = HID_CHECK_FOR_UPD_CANCEL; }
+hidspecial HID_CHECK_FOR_UPD_CLOSE { HelpId = HID_CHECK_FOR_UPD_CLOSE; }
+hidspecial HID_CHECK_FOR_UPD_DESCRIPTION { HelpId = HID_CHECK_FOR_UPD_DESCRIPTION; }
+hidspecial HID_CHECK_FOR_UPD_DLG { HelpId = HID_CHECK_FOR_UPD_DLG; }
+hidspecial HID_CHECK_FOR_UPD_DOWNLOAD { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD; }
+hidspecial HID_CHECK_FOR_UPD_DOWNLOAD2 { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD2; }
+hidspecial HID_CHECK_FOR_UPD_INSTALL { HelpId = HID_CHECK_FOR_UPD_INSTALL; }
+hidspecial HID_CHECK_FOR_UPD_PAUSE { HelpId = HID_CHECK_FOR_UPD_PAUSE; }
+hidspecial HID_CHECK_FOR_UPD_RESUME { HelpId = HID_CHECK_FOR_UPD_RESUME; }
+hidspecial HID_CHECK_FOR_UPD_STATUS { HelpId = HID_CHECK_FOR_UPD_STATUS; }
-hidspecial UID_ABSPILOT_HELP { HelpId = UID_ABSPILOT_HELP; }
hidspecial HID_DBIWIZARD { HelpId = HID_DBIWIZARD; }
-hidspecial UID_DBIWIZARD_HELP { HelpId = UID_DBIWIZARD_HELP; }
+hidspecial HID_DBIWIZARD_CANCEL { HelpId = HID_DBIWIZARD_CANCEL; }
hidspecial HID_DBIWIZARD_FILESELECTION { HelpId = HID_DBIWIZARD_FILESELECTION; }
+hidspecial HID_DBIWIZARD_FINISH { HelpId = HID_DBIWIZARD_FINISH; }
+hidspecial HID_DBIWIZARD_NEXT { HelpId = HID_DBIWIZARD_NEXT; }
+hidspecial HID_DBIWIZARD_PREVIOUS { HelpId = HID_DBIWIZARD_PREVIOUS; }
-hidspecial HID_BIB_DELETE_RECORD { HelpId = HID_BIB_DELETE_RECORD; }
-hidspecial HID_BIB_INSERT_RECORD { HelpId = HID_BIB_INSERT_RECORD; }
-
-hidspecial HID_PROP_TITLE { HelpId = HID_PROP_TITLE; }
-hidspecial HID_PROP_STEP { HelpId = HID_PROP_STEP; }
-hidspecial HID_PROP_VALUE { HelpId = HID_PROP_VALUE; }
-hidspecial HID_PROP_PROGRESSVALUE { HelpId = HID_PROP_PROGRESSVALUE; }
-hidspecial HID_PROP_PROGRESSVALUE_MIN { HelpId = HID_PROP_PROGRESSVALUE_MIN; }
-hidspecial HID_PROP_PROGRESSVALUE_MAX { HelpId = HID_PROP_PROGRESSVALUE_MAX; }
-hidspecial HID_PROP_SCROLLVALUE { HelpId = HID_PROP_SCROLLVALUE; }
-hidspecial HID_PROP_SCROLLVALUE_MIN { HelpId = HID_PROP_SCROLLVALUE_MIN; }
-hidspecial HID_PROP_SCROLLVALUE_MAX { HelpId = HID_PROP_SCROLLVALUE_MAX; }
-hidspecial HID_PROP_LINEINCREMENT { HelpId = HID_PROP_LINEINCREMENT; }
-hidspecial HID_PROP_BLOCKINCREMENT { HelpId = HID_PROP_BLOCKINCREMENT; }
-hidspecial HID_PROP_VISIBLESIZE { HelpId = HID_PROP_VISIBLESIZE; }
-hidspecial HID_PROP_ORIENTATION { HelpId = HID_PROP_ORIENTATION; }
-hidspecial HID_PROP_POSITIONX { HelpId = HID_PROP_POSITIONX; }
-hidspecial HID_PROP_POSITIONY { HelpId = HID_PROP_POSITIONY; }
-hidspecial HID_PROP_PUSHBUTTONTYPE { HelpId = HID_PROP_PUSHBUTTONTYPE; }
-hidspecial HID_PROP_STATE { HelpId = HID_PROP_STATE; }
-hidspecial HID_PROP_SCALEIMAGE { HelpId = HID_PROP_SCALEIMAGE; }
-hidspecial HID_PROP_BOUND_CELL { HelpId = HID_PROP_BOUND_CELL; }
-hidspecial HID_PROP_LIST_CELL_RANGE { HelpId = HID_PROP_LIST_CELL_RANGE; }
-hidspecial HID_PROP_CELL_EXCHANGE_TYPE { HelpId = HID_PROP_CELL_EXCHANGE_TYPE; }
-hidspecial HID_PROP_SELECTEDITEMS { HelpId = HID_PROP_SELECTEDITEMS; }
-hidspecial HID_PROP_SCROLLVALUEMIN { HelpId = HID_PROP_SCROLLVALUE_MIN; }
-hidspecial HID_PROP_DEFAULT_SCROLLVALUE { HelpId = HID_PROP_DEFAULT_SCROLLVALUE; }
-hidspecial HID_PROP_REPEAT_DELAY { HelpId = HID_PROP_REPEAT_DELAY; }
-hidspecial HID_PROP_SYMBOLCOLOR { HelpId = HID_PROP_SYMBOLCOLOR; }
-hidspecial HID_PROP_SPINVALUE { HelpId = HID_PROP_SPINVALUE; }
-hidspecial HID_PROP_SPINVALUE_MIN { HelpId = HID_PROP_SPINVALUE_MIN; }
-hidspecial HID_PROP_SPINVALUE_MAX { HelpId = HID_PROP_SPINVALUE_MAX; }
-hidspecial HID_PROP_DEFAULT_SPINVALUE { HelpId = HID_PROP_DEFAULT_SPINVALUE; }
-hidspecial HID_PROP_SPININCREMENT { HelpId = HID_PROP_SPININCREMENT; }
-hidspecial HID_PROP_REPEAT { HelpId = HID_PROP_REPEAT; }
-hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; }
-hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; }
-hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; }
-hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; }
-hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; }
-hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; }
-hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; }
-hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; }
-hidspecial UID_PROP_DLG_SYMBOLCOLOR { HelpId = UID_PROP_DLG_SYMBOLCOLOR; }
-hidspecial UID_EVT_MACRODLG { HelpId = UID_EVT_MACRODLG; }
-hidspecial HID_PROP_WORDBREAK { HelpId = HID_PROP_WORDBREAK; }
-hidspecial HID_PROP_SHOW_SCROLLBARS { HelpId = HID_PROP_SHOW_SCROLLBARS; }
-hidspecial HID_PROP_TABORDER_CONTROLS { HelpId = HID_PROP_TABORDER_CONTROLS; }
-hidspecial HID_PROP_ICONSIZE { HelpId = HID_PROP_ICONSIZE; }
-hidspecial HID_PROP_SHOW_POSITION { HelpId = HID_PROP_SHOW_POSITION; }
-hidspecial HID_PROP_SHOW_NAVIGATION { HelpId = HID_PROP_SHOW_NAVIGATION; }
-hidspecial HID_PROP_SHOW_RECORDACTIONS { HelpId = HID_PROP_SHOW_RECORDACTIONS; }
-hidspecial HID_PROP_SHOW_FILTERSORT { HelpId = HID_PROP_SHOW_FILTERSORT; }
-
-hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; }
-hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; }
-hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; }
-hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; }
-hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; }
-hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; }
-hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; }
-hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; }
-hidspecial UID_PROP_DLG_TABINDEX { HelpId = UID_PROP_DLG_TABINDEX; }
-hidspecial UID_PROP_DLG_SQLCOMMAND { HelpId = UID_PROP_DLG_SQLCOMMAND; }
-hidspecial UID_PROP_DLG_FORMLINKFIELDS { HelpId = UID_PROP_DLG_FORMLINKFIELDS; }
-hidspecial HID_FIELDLINK_DETAIL_COLUMN { HelpId = HID_FIELDLINK_DETAIL_COLUMN; }
-hidspecial HID_FIELDLINK_MASTER_COLUMN { HelpId = HID_FIELDLINK_MASTER_COLUMN; }
-hidspecial UID_FIELDLINK_DETAIL1 { HelpId = UID_FIELDLINK_DETAIL1; }
-hidspecial UID_FIELDLINK_MASTER1 { HelpId = UID_FIELDLINK_MASTER1; }
-hidspecial UID_FIELDLINK_DETAIL2 { HelpId = UID_FIELDLINK_DETAIL2; }
-hidspecial UID_FIELDLINK_MASTER2 { HelpId = UID_FIELDLINK_MASTER2; }
-hidspecial UID_FIELDLINK_DETAIL3 { HelpId = UID_FIELDLINK_DETAIL3; }
-hidspecial UID_FIELDLINK_MASTER3 { HelpId = UID_FIELDLINK_MASTER3; }
-hidspecial UID_FIELDLINK_DETAIL4 { HelpId = UID_FIELDLINK_DETAIL4; }
-hidspecial UID_FIELDLINK_MASTER4 { HelpId = UID_FIELDLINK_MASTER4; }
-hidspecial UID_PROP_DLG_FILTER { HelpId = UID_PROP_DLG_FILTER; }
-hidspecial UID_PROP_DLG_ORDER { HelpId = UID_PROP_DLG_ORDER; }
-hidspecial UID_PROP_DLG_SELECTION { HelpId = UID_PROP_DLG_SELECTION; }
-hidspecial UID_PROP_DLG_SYMBOLCOLOR { HelpId = UID_PROP_DLG_SYMBOLCOLOR; }
-hidspecial UID_BRWEVT_APPROVEACTIONPERFORMED { HelpId = UID_BRWEVT_APPROVEACTIONPERFORMED; }
-hidspecial UID_BRWEVT_ACTIONPERFORMED { HelpId = UID_BRWEVT_ACTIONPERFORMED; }
-hidspecial UID_BRWEVT_CHANGED { HelpId = UID_BRWEVT_CHANGED; }
-hidspecial UID_BRWEVT_TEXTCHANGED { HelpId = UID_BRWEVT_TEXTCHANGED; }
-hidspecial UID_BRWEVT_ITEMSTATECHANGED { HelpId = UID_BRWEVT_ITEMSTATECHANGED; }
-hidspecial UID_BRWEVT_FOCUSGAINED { HelpId = UID_BRWEVT_FOCUSGAINED; }
-hidspecial UID_BRWEVT_FOCUSLOST { HelpId = UID_BRWEVT_FOCUSLOST; }
-hidspecial UID_BRWEVT_KEYTYPED { HelpId = UID_BRWEVT_KEYTYPED; }
-hidspecial UID_BRWEVT_KEYUP { HelpId = UID_BRWEVT_KEYUP; }
-hidspecial UID_BRWEVT_MOUSEENTERED { HelpId = UID_BRWEVT_MOUSEENTERED; }
-hidspecial UID_BRWEVT_MOUSEDRAGGED { HelpId = UID_BRWEVT_MOUSEDRAGGED; }
-hidspecial UID_BRWEVT_MOUSEMOVED { HelpId = UID_BRWEVT_MOUSEMOVED; }
-hidspecial UID_BRWEVT_MOUSEPRESSED { HelpId = UID_BRWEVT_MOUSEPRESSED; }
-hidspecial UID_BRWEVT_MOUSERELEASED { HelpId = UID_BRWEVT_MOUSERELEASED; }
-hidspecial UID_BRWEVT_MOUSEEXITED { HelpId = UID_BRWEVT_MOUSEEXITED; }
-hidspecial UID_BRWEVT_APPROVERESETTED { HelpId = UID_BRWEVT_APPROVERESETTED; }
-hidspecial UID_BRWEVT_RESETTED { HelpId = UID_BRWEVT_RESETTED; }
-hidspecial UID_BRWEVT_SUBMITTED { HelpId = UID_BRWEVT_SUBMITTED; }
-hidspecial UID_BRWEVT_BEFOREUPDATE { HelpId = UID_BRWEVT_BEFOREUPDATE; }
-hidspecial UID_BRWEVT_AFTERUPDATE { HelpId = UID_BRWEVT_AFTERUPDATE; }
-hidspecial UID_BRWEVT_LOADED { HelpId = UID_BRWEVT_LOADED; }
-hidspecial UID_BRWEVT_RELOADING { HelpId = UID_BRWEVT_RELOADING; }
-hidspecial UID_BRWEVT_RELOADED { HelpId = UID_BRWEVT_RELOADED; }
-hidspecial UID_BRWEVT_UNLOADING { HelpId = UID_BRWEVT_UNLOADING; }
-hidspecial UID_BRWEVT_UNLOADED { HelpId = UID_BRWEVT_UNLOADED; }
-hidspecial UID_BRWEVT_CONFIRMDELETE { HelpId = UID_BRWEVT_CONFIRMDELETE; }
-hidspecial UID_BRWEVT_APPROVEROWCHANGE { HelpId = UID_BRWEVT_APPROVEROWCHANGE; }
-hidspecial UID_BRWEVT_ROWCHANGE { HelpId = UID_BRWEVT_ROWCHANGE; }
-hidspecial UID_BRWEVT_POSITIONING { HelpId = UID_BRWEVT_POSITIONING; }
-hidspecial UID_BRWEVT_POSITIONED { HelpId = UID_BRWEVT_POSITIONED; }
-hidspecial UID_BRWEVT_APPROVEPARAMETER { HelpId = UID_BRWEVT_APPROVEPARAMETER; }
-hidspecial UID_BRWEVT_ERROROCCURED { HelpId = UID_BRWEVT_ERROROCCURED; }
-hidspecial UID_BRWEVT_ADJUSTMENTVALUECHANGED { HelpId = UID_BRWEVT_ADJUSTMENTVALUECHANGED; }
-hidspecial HID_PROP_AUTOLINEBREAK { HelpId = HID_PROP_AUTOLINEBREAK; }
-hidspecial HID_PROP_TEXTTYPE { HelpId = HID_PROP_TEXTTYPE; }
-hidspecial HID_PROP_LINEEND_FORMAT { HelpId = HID_PROP_LINEEND_FORMAT; }
+hidspecial HID_DLG_DBCHANGE { HelpId = HID_DLG_DBCHANGE; }
+hidspecial HID_DLG_MAPPING { HelpId = HID_DLG_MAPPING; }
hidspecial HID_EVT_ACTIONPERFORMED { HelpId = HID_EVT_ACTIONPERFORMED; }
+hidspecial HID_EVT_ADJUSTMENTVALUECHANGED { HelpId = HID_EVT_ADJUSTMENTVALUECHANGED; }
hidspecial HID_EVT_AFTERUPDATE { HelpId = HID_EVT_AFTERUPDATE; }
+hidspecial HID_EVT_APPROVEACTIONPERFORMED { HelpId = HID_EVT_APPROVEACTIONPERFORMED; }
+hidspecial HID_EVT_APPROVEPARAMETER { HelpId = HID_EVT_APPROVEPARAMETER; }
+hidspecial HID_EVT_APPROVERESETTED { HelpId = HID_EVT_APPROVERESETTED; }
+hidspecial HID_EVT_APPROVEROWCHANGE { HelpId = HID_EVT_APPROVEROWCHANGE; }
hidspecial HID_EVT_BEFOREUPDATE { HelpId = HID_EVT_BEFOREUPDATE; }
+hidspecial HID_EVT_CHANGED { HelpId = HID_EVT_CHANGED; }
hidspecial HID_EVT_CONFIRMDELETE { HelpId = HID_EVT_CONFIRMDELETE; }
hidspecial HID_EVT_ERROROCCURED { HelpId = HID_EVT_ERROROCCURED; }
hidspecial HID_EVT_FOCUSGAINED { HelpId = HID_EVT_FOCUSGAINED; }
hidspecial HID_EVT_FOCUSLOST { HelpId = HID_EVT_FOCUSLOST; }
hidspecial HID_EVT_ITEMSTATECHANGED { HelpId = HID_EVT_ITEMSTATECHANGED; }
hidspecial HID_EVT_KEYTYPED { HelpId = HID_EVT_KEYTYPED; }
+hidspecial HID_EVT_KEYUP { HelpId = HID_EVT_KEYUP; }
hidspecial HID_EVT_LOADED { HelpId = HID_EVT_LOADED; }
hidspecial HID_EVT_MOUSEDRAGGED { HelpId = HID_EVT_MOUSEDRAGGED; }
hidspecial HID_EVT_MOUSEENTERED { HelpId = HID_EVT_MOUSEENTERED; }
@@ -240,74 +124,314 @@ hidspecial HID_EVT_MOUSEMOVED { HelpId = HID_EVT_MOUSEMOVED; }
hidspecial HID_EVT_MOUSEPRESSED { HelpId = HID_EVT_MOUSEPRESSED; }
hidspecial HID_EVT_MOUSERELEASED { HelpId = HID_EVT_MOUSERELEASED; }
hidspecial HID_EVT_POSITIONED { HelpId = HID_EVT_POSITIONED; }
+hidspecial HID_EVT_POSITIONING { HelpId = HID_EVT_POSITIONING; }
+hidspecial HID_EVT_RELOADED { HelpId = HID_EVT_RELOADED; }
+hidspecial HID_EVT_RELOADING { HelpId = HID_EVT_RELOADING; }
hidspecial HID_EVT_RESETTED { HelpId = HID_EVT_RESETTED; }
+hidspecial HID_EVT_ROWCHANGE { HelpId = HID_EVT_ROWCHANGE; }
hidspecial HID_EVT_SUBMITTED { HelpId = HID_EVT_SUBMITTED; }
hidspecial HID_EVT_TEXTCHANGED { HelpId = HID_EVT_TEXTCHANGED; }
hidspecial HID_EVT_UNLOADED { HelpId = HID_EVT_UNLOADED; }
-hidspecial HID_EVT_CHANGED { HelpId = HID_EVT_CHANGED; }
-hidspecial HID_EVT_APPROVEACTIONPERFORMED { HelpId = HID_EVT_APPROVEACTIONPERFORMED; }
-hidspecial HID_EVT_APPROVERESETTED { HelpId = HID_EVT_APPROVERESETTED; }
-hidspecial HID_EVT_KEYUP { HelpId = HID_EVT_KEYUP; }
-hidspecial HID_EVT_APPROVEPARAMETER { HelpId = HID_EVT_APPROVEPARAMETER; }
-hidspecial HID_EVT_POSITIONING { HelpId = HID_EVT_POSITIONING; }
-hidspecial HID_EVT_RELOADED { HelpId = HID_EVT_RELOADED; }
-hidspecial HID_EVT_APPROVEROWCHANGE { HelpId = HID_EVT_APPROVEROWCHANGE; }
-hidspecial HID_EVT_ROWCHANGE { HelpId = HID_EVT_ROWCHANGE; }
-hidspecial HID_EVT_RELOADING { HelpId = HID_EVT_RELOADING; }
hidspecial HID_EVT_UNLOADING { HelpId = HID_EVT_UNLOADING; }
-hidspecial HID_EVT_ADJUSTMENTVALUECHANGED { HelpId = HID_EVT_ADJUSTMENTVALUECHANGED; }
-hidspecial HID_PROP_TOGGLE { HelpId = HID_PROP_TOGGLE; }
+
+hidspecial HID_FIELDLINK_DETAIL_COLUMN { HelpId = HID_FIELDLINK_DETAIL_COLUMN; }
+hidspecial HID_FIELDLINK_MASTER_COLUMN { HelpId = HID_FIELDLINK_MASTER_COLUMN; }
+
+hidspecial HID_GRIDWIZARD_CANCEL { HelpId = HID_GRIDWIZARD_CANCEL; }
+hidspecial HID_GRIDWIZARD_FINISH { HelpId = HID_GRIDWIZARD_FINISH; }
+hidspecial HID_GRIDWIZARD_NEXT { HelpId = HID_GRIDWIZARD_NEXT; }
+hidspecial HID_GRIDWIZARD_PREVIOUS { HelpId = HID_GRIDWIZARD_PREVIOUS; };
+hidspecial HID_GROUPWIZARD_CANCEL { HelpId = HID_GROUPWIZARD_CANCEL; }
+hidspecial HID_GROUPWIZARD_FINISH { HelpId = HID_GROUPWIZARD_FINISH; }
+hidspecial HID_GROUPWIZARD_NEXT { HelpId = HID_GROUPWIZARD_NEXT; }
+hidspecial HID_GROUPWIZARD_PREVIOUS { HelpId = HID_GROUPWIZARD_PREVIOUS; }
+
+hidspecial HID_LISTWIZARD_CANCEL { HelpId = HID_LISTWIZARD_CANCEL; }
+hidspecial HID_LISTWIZARD_FINISH { HelpId = HID_LISTWIZARD_FINISH; }
+hidspecial HID_LISTWIZARD_NEXT { HelpId = HID_LISTWIZARD_NEXT; }
+hidspecial HID_LISTWIZARD_PREVIOUS { HelpId = HID_LISTWIZARD_PREVIOUS; }
+
+hidspecial HID_PROP_ALIGN { HelpId = HID_PROP_ALIGN; }
+hidspecial HID_PROP_ALLOW_ADDITIONS { HelpId = HID_PROP_ALLOW_ADDITIONS; }
+hidspecial HID_PROP_ALLOW_DELETIONS { HelpId = HID_PROP_ALLOW_DELETIONS; }
+hidspecial HID_PROP_ALLOW_EDITS { HelpId = HID_PROP_ALLOW_EDITS; }
+hidspecial HID_PROP_ANCHOR_TYPE { HelpId = HID_PROP_ANCHOR_TYPE; }
+hidspecial HID_PROP_AUTOCOMPLETE { HelpId = HID_PROP_AUTOCOMPLETE; }
+hidspecial HID_PROP_AUTOLINEBREAK { HelpId = HID_PROP_AUTOLINEBREAK; }
+hidspecial HID_PROP_BACKGROUNDCOLOR { HelpId = HID_PROP_BACKGROUNDCOLOR; }
+hidspecial HID_PROP_BINDING_NAME { HelpId = HID_PROP_BINDING_NAME; }
+hidspecial HID_PROP_BIND_EXPRESSION { HelpId = HID_PROP_BIND_EXPRESSION; }
+hidspecial HID_PROP_BLOCKINCREMENT { HelpId = HID_PROP_BLOCKINCREMENT; }
+hidspecial HID_PROP_BORDER { HelpId = HID_PROP_BORDER; }
+hidspecial HID_PROP_BORDERCOLOR { HelpId = HID_PROP_BORDERCOLOR; }
+hidspecial HID_PROP_BOUNDCOLUMN { HelpId = HID_PROP_BOUNDCOLUMN; }
+hidspecial HID_PROP_BOUND_CELL { HelpId = HID_PROP_BOUND_CELL; }
+hidspecial HID_PROP_BUTTONTYPE { HelpId = HID_PROP_BUTTONTYPE; }
+hidspecial HID_PROP_CELL_EXCHANGE_TYPE { HelpId = HID_PROP_CELL_EXCHANGE_TYPE; }
+hidspecial HID_PROP_CLASSID { HelpId = HID_PROP_CLASSID; }
+hidspecial HID_PROP_CONTROLLABEL { HelpId = HID_PROP_CONTROLLABEL; }
+hidspecial HID_PROP_CONTROLSOURCE { HelpId = HID_PROP_CONTROLSOURCE; }
+hidspecial HID_PROP_CURRENCYSYMBOL { HelpId = HID_PROP_CURRENCYSYMBOL; }
+hidspecial HID_PROP_CURRSYM_POSITION { HelpId = HID_PROP_CURRSYM_POSITION; }
+hidspecial HID_PROP_CURSORSOURCE { HelpId = HID_PROP_CURSORSOURCE; }
+hidspecial HID_PROP_CURSORSOURCETYPE { HelpId = HID_PROP_CURSORSOURCETYPE; }
+hidspecial HID_PROP_CURSORTYPE { HelpId = HID_PROP_CURSORTYPE; }
+hidspecial HID_PROP_CYCLE { HelpId = HID_PROP_CYCLE; }
+hidspecial HID_PROP_DATAENTRY { HelpId = HID_PROP_DATAENTRY; }
+hidspecial HID_PROP_DATASOURCE { HelpId = HID_PROP_DATASOURCE; }
+hidspecial HID_PROP_DATE { HelpId = HID_PROP_DATE; }
+hidspecial HID_PROP_DATEFORMAT { HelpId = HID_PROP_DATEFORMAT; }
+hidspecial HID_PROP_DATEMAX { HelpId = HID_PROP_DATEMAX; }
+hidspecial HID_PROP_DATEMIN { HelpId = HID_PROP_DATEMIN; }
+hidspecial HID_PROP_DECIMAL_ACCURACY { HelpId = HID_PROP_DECIMAL_ACCURACY; }
+hidspecial HID_PROP_DECORATION { HelpId = HID_PROP_DECORATION; }
+hidspecial HID_PROP_DEFAULTVALUE { HelpId = HID_PROP_DEFAULTVALUE; }
+hidspecial HID_PROP_DEFAULT_BUTTON { HelpId = HID_PROP_DEFAULT_BUTTON; }
+hidspecial HID_PROP_DEFAULT_DATE { HelpId = HID_PROP_DEFAULT_DATE; }
+hidspecial HID_PROP_DEFAULT_LONG_VALUE { HelpId = HID_PROP_DEFAULT_LONG_VALUE; }
+hidspecial HID_PROP_DEFAULT_SCROLLVALUE { HelpId = HID_PROP_DEFAULT_SCROLLVALUE; }
+hidspecial HID_PROP_DEFAULT_SELECT_SEQ { HelpId = HID_PROP_DEFAULT_SELECT_SEQ; }
+hidspecial HID_PROP_DEFAULT_SPINVALUE { HelpId = HID_PROP_DEFAULT_SPINVALUE; }
+hidspecial HID_PROP_DEFAULT_STATE { HelpId = HID_PROP_DEFAULT_STATE; }
+hidspecial HID_PROP_DEFAULT_TIME { HelpId = HID_PROP_DEFAULT_TIME; }
+hidspecial HID_PROP_DIRTY { HelpId = HID_PROP_DIRTY; }
+hidspecial HID_PROP_DROPDOWN { HelpId = HID_PROP_DROPDOWN; }
+hidspecial HID_PROP_ECHO_CHAR { HelpId = HID_PROP_ECHO_CHAR; }
+hidspecial HID_PROP_EDITABLE { HelpId = HID_PROP_EDITABLE; }
+hidspecial HID_PROP_EDITMASK { HelpId = HID_PROP_EDITMASK; }
+hidspecial HID_PROP_EFFECTIVEDEFAULT { HelpId = HID_PROP_EFFECTIVEDEFAULT; }
+hidspecial HID_PROP_EFFECTIVEMAX { HelpId = HID_PROP_EFFECTIVEMAX; }
+hidspecial HID_PROP_EFFECTIVEMIN { HelpId = HID_PROP_EFFECTIVEMIN; }
+hidspecial HID_PROP_EMPTY_IS_NULL { HelpId = HID_PROP_EMPTY_IS_NULL; }
+hidspecial HID_PROP_ENABLED { HelpId = HID_PROP_ENABLED; }
+hidspecial HID_PROP_ENABLE_VISIBLE { HelpId = HID_PROP_ENABLE_VISIBLE; }
+hidspecial HID_PROP_ESCAPE_PROCESSING { HelpId = HID_PROP_ESCAPE_PROCESSING; }
+hidspecial HID_PROP_FILLCOLOR { HelpId = HID_PROP_FILLCOLOR; }
+hidspecial HID_PROP_FILTER { HelpId = HID_PROP_FILTER; }
+hidspecial HID_PROP_FILTERPROPOSAL { HelpId = HID_PROP_FILTERPROPOSAL; }
hidspecial HID_PROP_FOCUSONCLICK { HelpId = HID_PROP_FOCUSONCLICK; }
+hidspecial HID_PROP_FONT { HelpId = HID_PROP_FONT; }
+hidspecial HID_PROP_FORMATKEY { HelpId = HID_PROP_FORMATKEY; }
+hidspecial HID_PROP_GROUPBOX { HelpId = HID_PROP_GROUPBOX; }
+hidspecial HID_PROP_HEIGHT { HelpId = HID_PROP_HEIGHT; }
+hidspecial HID_PROP_HELPTEXT { HelpId = HID_PROP_HELPTEXT; }
+hidspecial HID_PROP_HELPURL { HelpId = HID_PROP_HELPURL; }
+hidspecial HID_PROP_HIDDEN_VALUE { HelpId = HID_PROP_HIDDEN_VALUE; }
hidspecial HID_PROP_HIDEINACTIVESELECTION { HelpId = HID_PROP_HIDEINACTIVESELECTION; }
-hidspecial HID_PROP_VISUALEFFECT { HelpId = HID_PROP_VISUALEFFECT; }
-hidspecial HID_PROP_BORDERCOLOR { HelpId = HID_PROP_BORDERCOLOR; }
-hidspecial UID_PROP_DLG_BORDERCOLOR { HelpId = UID_PROP_DLG_BORDERCOLOR; }
+hidspecial HID_PROP_HSCROLL { HelpId = HID_PROP_HSCROLL; }
+hidspecial HID_PROP_ICONSIZE { HelpId = HID_PROP_ICONSIZE; }
hidspecial HID_PROP_IMAGEPOSITION { HelpId = HID_PROP_IMAGEPOSITION; }
+hidspecial HID_PROP_IMAGE_URL { HelpId = HID_PROP_IMAGE_URL; }
+hidspecial HID_PROP_INPUT_REQUIRED { HelpId = HID_PROP_INPUT_REQUIRED; }
+hidspecial HID_PROP_INVOKES_STOP_NOT_EDITING { HelpId = HID_PROP_INVOKES_STOP_NOT_EDITING; }
+hidspecial HID_PROP_LABEL { HelpId = HID_PROP_LABEL; }
+hidspecial HID_PROP_LEFT { HelpId = HID_PROP_LEFT; }
+hidspecial HID_PROP_LINECOLOR { HelpId = HID_PROP_LINECOLOR; }
+hidspecial HID_PROP_LINECOUNT { HelpId = HID_PROP_LINECOUNT; }
+hidspecial HID_PROP_LINEEND_FORMAT { HelpId = HID_PROP_LINEEND_FORMAT; }
+hidspecial HID_PROP_LINEINCREMENT { HelpId = HID_PROP_LINEINCREMENT; }
+hidspecial HID_PROP_LISTINDEX { HelpId = HID_PROP_LISTINDEX; }
+hidspecial HID_PROP_LISTSOURCE { HelpId = HID_PROP_LISTSOURCE; }
+hidspecial HID_PROP_LISTSOURCETYPE { HelpId = HID_PROP_LISTSOURCETYPE; }
+hidspecial HID_PROP_LIST_BINDING { HelpId = HID_PROP_LIST_BINDING; }
+hidspecial HID_PROP_LIST_CELL_RANGE { HelpId = HID_PROP_LIST_CELL_RANGE; }
+hidspecial HID_PROP_LITERALMASK { HelpId = HID_PROP_LITERALMASK; }
+hidspecial HID_PROP_LOCKED { HelpId = HID_PROP_LOCKED; }
+hidspecial HID_PROP_MASTERFIELDS { HelpId = HID_PROP_MASTERFIELDS; }
+hidspecial HID_PROP_MAXTEXTLEN { HelpId = HID_PROP_MAXTEXTLEN; }
+hidspecial HID_PROP_MULTILINE { HelpId = HID_PROP_MULTILINE; }
+hidspecial HID_PROP_MULTISELECTION { HelpId = HID_PROP_MULTISELECTION; }
+hidspecial HID_PROP_NAME { HelpId = HID_PROP_NAME; }
+hidspecial HID_PROP_NAVIGATION { HelpId = HID_PROP_NAVIGATION; }
+hidspecial HID_PROP_NAVIGATIONBAR { HelpId = HID_PROP_NAVIGATIONBAR; }
+hidspecial HID_PROP_NOLABEL { HelpId = HID_PROP_NOLABEL; }
+hidspecial HID_PROP_OLDVALUE { HelpId = HID_PROP_OLDVALUE; }
+hidspecial HID_PROP_ORIENTATION { HelpId = HID_PROP_ORIENTATION; }
+hidspecial HID_PROP_POSITIONX { HelpId = HID_PROP_POSITIONX; }
+hidspecial HID_PROP_POSITIONY { HelpId = HID_PROP_POSITIONY; }
+hidspecial HID_PROP_PRINTABLE { HelpId = HID_PROP_PRINTABLE; }
+hidspecial HID_PROP_PROGRESSVALUE { HelpId = HID_PROP_PROGRESSVALUE; }
+hidspecial HID_PROP_PROGRESSVALUE_MAX { HelpId = HID_PROP_PROGRESSVALUE_MAX; }
+hidspecial HID_PROP_PROGRESSVALUE_MIN { HelpId = HID_PROP_PROGRESSVALUE_MIN; }
+hidspecial HID_PROP_PUSHBUTTONTYPE { HelpId = HID_PROP_PUSHBUTTONTYPE; }
+hidspecial HID_PROP_READONLY { HelpId = HID_PROP_READONLY; }
+hidspecial HID_PROP_RECORDMARKER { HelpId = HID_PROP_RECORDMARKER; }
+hidspecial HID_PROP_REFVALUE { HelpId = HID_PROP_REFVALUE; }
+hidspecial HID_PROP_REPEAT { HelpId = HID_PROP_REPEAT; }
+hidspecial HID_PROP_REPEAT_DELAY { HelpId = HID_PROP_REPEAT_DELAY; }
+hidspecial HID_PROP_REQUIRED { HelpId = HID_PROP_REQUIRED; }
+hidspecial HID_PROP_RIGHT { HelpId = HID_PROP_RIGHT; }
+hidspecial HID_PROP_ROOT_DISPLAYED { HelpId = HID_PROP_ROOT_DISPLAYED; }
+hidspecial HID_PROP_ROWHEIGHT { HelpId = HID_PROP_ROWHEIGHT; }
+hidspecial HID_PROP_ROW_HEIGHT { HelpId = HID_PROP_ROW_HEIGHT; }
+hidspecial HID_PROP_SCALEIMAGE { HelpId = HID_PROP_SCALEIMAGE; }
+hidspecial HID_PROP_SCROLLVALUE { HelpId = HID_PROP_SCROLLVALUE; }
+hidspecial HID_PROP_SCROLLVALUEMIN { HelpId = HID_PROP_SCROLLVALUE_MIN; }
+hidspecial HID_PROP_SCROLLVALUE_MAX { HelpId = HID_PROP_SCROLLVALUE_MAX; }
+hidspecial HID_PROP_SCROLLVALUE_MIN { HelpId = HID_PROP_SCROLLVALUE_MIN; }
+hidspecial HID_PROP_SEARCHING { HelpId = HID_PROP_SEARCHING; }
+hidspecial HID_PROP_SELECTEDITEMS { HelpId = HID_PROP_SELECTEDITEMS; }
+hidspecial HID_PROP_SELECTION_TYPE { HelpId = HID_PROP_SELECTION_TYPE; }
+hidspecial HID_PROP_SHOWS_HANDLES { HelpId = HID_PROP_SHOWS_HANDLES; }
+hidspecial HID_PROP_SHOWS_ROOT_HANDLES { HelpId = HID_PROP_SHOWS_ROOT_HANDLES; }
+hidspecial HID_PROP_SHOWTHOUSANDSEP { HelpId = HID_PROP_SHOWTHOUSANDSEP; }
+hidspecial HID_PROP_SHOW_FILTERSORT { HelpId = HID_PROP_SHOW_FILTERSORT; }
+hidspecial HID_PROP_SHOW_NAVIGATION { HelpId = HID_PROP_SHOW_NAVIGATION; }
+hidspecial HID_PROP_SHOW_POSITION { HelpId = HID_PROP_SHOW_POSITION; }
+hidspecial HID_PROP_SHOW_RECORDACTIONS { HelpId = HID_PROP_SHOW_RECORDACTIONS; }
+hidspecial HID_PROP_SHOW_SCROLLBARS { HelpId = HID_PROP_SHOW_SCROLLBARS; }
+hidspecial HID_PROP_SLAVEFIELDS { HelpId = HID_PROP_SLAVEFIELDS; }
+hidspecial HID_PROP_SORT_CRITERIA { HelpId = HID_PROP_SORT_CRITERIA; }
+hidspecial HID_PROP_SPIN { HelpId = HID_PROP_SPIN; }
+hidspecial HID_PROP_SPININCREMENT { HelpId = HID_PROP_SPININCREMENT; }
+hidspecial HID_PROP_SPINVALUE { HelpId = HID_PROP_SPINVALUE; }
+hidspecial HID_PROP_SPINVALUE_MAX { HelpId = HID_PROP_SPINVALUE_MAX; }
+hidspecial HID_PROP_SPINVALUE_MIN { HelpId = HID_PROP_SPINVALUE_MIN; }
+hidspecial HID_PROP_STATE { HelpId = HID_PROP_STATE; }
+hidspecial HID_PROP_STEP { HelpId = HID_PROP_STEP; }
+hidspecial HID_PROP_STRICTFORMAT { HelpId = HID_PROP_STRICTFORMAT; }
+hidspecial HID_PROP_STRINGITEMLIST { HelpId = HID_PROP_STRINGITEMLIST; }
+hidspecial HID_PROP_SUBMISSION_ID { HelpId = HID_PROP_SUBMISSION_ID; }
+hidspecial HID_PROP_SUBMIT_ACTION { HelpId = HID_PROP_SUBMIT_ACTION; }
+hidspecial HID_PROP_SUBMIT_ENCODING { HelpId = HID_PROP_SUBMIT_ENCODING; }
+hidspecial HID_PROP_SUBMIT_METHOD { HelpId = HID_PROP_SUBMIT_METHOD; }
+hidspecial HID_PROP_SUBMIT_TARGET { HelpId = HID_PROP_SUBMIT_TARGET; }
+hidspecial HID_PROP_SYMBOLCOLOR { HelpId = HID_PROP_SYMBOLCOLOR; }
+hidspecial HID_PROP_TABINDEX { HelpId = HID_PROP_TABINDEX; }
+hidspecial HID_PROP_TABORDER_CONTROLS { HelpId = HID_PROP_TABORDER_CONTROLS; }
+hidspecial HID_PROP_TABSTOP { HelpId = HID_PROP_TABSTOP; }
+hidspecial HID_PROP_TAG { HelpId = HID_PROP_TAG; }
+hidspecial HID_PROP_TARGET_FRAME { HelpId = HID_PROP_TARGET_FRAME; }
+hidspecial HID_PROP_TARGET_URL { HelpId = HID_PROP_TARGET_URL; }
+hidspecial HID_PROP_TEXT { HelpId = HID_PROP_TEXT; }
+hidspecial HID_PROP_TEXTTYPE { HelpId = HID_PROP_TEXTTYPE; }
+hidspecial HID_PROP_TIME { HelpId = HID_PROP_TIME; }
+hidspecial HID_PROP_TIMEFORMAT { HelpId = HID_PROP_TIMEFORMAT; }
+hidspecial HID_PROP_TIMEMAX { HelpId = HID_PROP_TIMEMAX; }
+hidspecial HID_PROP_TIMEMIN { HelpId = HID_PROP_TIMEMIN; }
+hidspecial HID_PROP_TITLE { HelpId = HID_PROP_TITLE; }
+hidspecial HID_PROP_TOGGLE { HelpId = HID_PROP_TOGGLE; }
+hidspecial HID_PROP_TRISTATE { HelpId = HID_PROP_TRISTATE; }
+hidspecial HID_PROP_UNCHECKEDREFVALUE { HelpId = HID_PROP_UNCHECKEDREFVALUE; }
+hidspecial HID_PROP_UNIQUE { HelpId = HID_PROP_UNIQUE; }
+hidspecial HID_PROP_VALUE { HelpId = HID_PROP_VALUE; }
+hidspecial HID_PROP_VALUEMAX { HelpId = HID_PROP_VALUEMAX; }
+hidspecial HID_PROP_VALUEMIN { HelpId = HID_PROP_VALUEMIN; }
+hidspecial HID_PROP_VALUESTEP { HelpId = HID_PROP_VALUESTEP; }
+hidspecial HID_PROP_VERTICAL_ALIGN { HelpId = HID_PROP_VERTICAL_ALIGN; }
+hidspecial HID_PROP_VISIBLESIZE { HelpId = HID_PROP_VISIBLESIZE; }
+hidspecial HID_PROP_VISUALEFFECT { HelpId = HID_PROP_VISUALEFFECT; }
+hidspecial HID_PROP_VSCROLL { HelpId = HID_PROP_VSCROLL; }
+hidspecial HID_PROP_WHEEL_BEHAVIOR { HelpId = HID_PROP_WHEEL_BEHAVIOR; }
+hidspecial HID_PROP_WIDTH { HelpId = HID_PROP_WIDTH; }
+hidspecial HID_PROP_WORDBREAK { HelpId = HID_PROP_WORDBREAK; }
+hidspecial HID_PROP_WRITING_MODE { HelpId = HID_PROP_WRITING_MODE; }
hidspecial HID_PROP_XML_DATA_MODEL { HelpId = HID_PROP_XML_DATA_MODEL; }
-hidspecial HID_PROP_BIND_EXPRESSION { HelpId = HID_PROP_BIND_EXPRESSION; }
-hidspecial HID_PROP_XSD_REQUIRED { HelpId = HID_PROP_XSD_REQUIRED; }
-hidspecial HID_PROP_XSD_RELEVANT { HelpId = HID_PROP_XSD_RELEVANT; }
-hidspecial HID_PROP_XSD_READONLY { HelpId = HID_PROP_XSD_READONLY; }
-hidspecial HID_PROP_XSD_CONSTRAINT { HelpId = HID_PROP_XSD_CONSTRAINT; }
hidspecial HID_PROP_XSD_CALCULATION { HelpId = HID_PROP_XSD_CALCULATION; }
+hidspecial HID_PROP_XSD_CONSTRAINT { HelpId = HID_PROP_XSD_CONSTRAINT; }
hidspecial HID_PROP_XSD_DATA_TYPE { HelpId = HID_PROP_XSD_DATA_TYPE; }
-hidspecial HID_PROP_XSD_WHITESPACES { HelpId = HID_PROP_XSD_WHITESPACES; }
-hidspecial HID_PROP_XSD_PATTERN { HelpId = HID_PROP_XSD_PATTERN; }
+hidspecial HID_PROP_XSD_FRACTION_DIGITS { HelpId = HID_PROP_XSD_FRACTION_DIGITS; }
hidspecial HID_PROP_XSD_LENGTH { HelpId = HID_PROP_XSD_LENGTH; }
-hidspecial HID_PROP_XSD_MIN_LENGTH { HelpId = HID_PROP_XSD_MIN_LENGTH; }
+hidspecial HID_PROP_XSD_MAX_EXCLUSIVE { HelpId = HID_PROP_XSD_MAX_EXCLUSIVE; }
+hidspecial HID_PROP_XSD_MAX_INCLUSIVE { HelpId = HID_PROP_XSD_MAX_INCLUSIVE; }
hidspecial HID_PROP_XSD_MAX_LENGTH { HelpId = HID_PROP_XSD_MAX_LENGTH; }
+hidspecial HID_PROP_XSD_MIN_EXCLUSIVE { HelpId = HID_PROP_XSD_MIN_EXCLUSIVE; }
+hidspecial HID_PROP_XSD_MIN_INCLUSIVE { HelpId = HID_PROP_XSD_MIN_INCLUSIVE; }
+hidspecial HID_PROP_XSD_MIN_LENGTH { HelpId = HID_PROP_XSD_MIN_LENGTH; }
+hidspecial HID_PROP_XSD_PATTERN { HelpId = HID_PROP_XSD_PATTERN; }
+hidspecial HID_PROP_XSD_READONLY { HelpId = HID_PROP_XSD_READONLY; }
+hidspecial HID_PROP_XSD_RELEVANT { HelpId = HID_PROP_XSD_RELEVANT; }
+hidspecial HID_PROP_XSD_REQUIRED { HelpId = HID_PROP_XSD_REQUIRED; }
+hidspecial HID_PROP_XSD_TOTAL_DIGITS { HelpId = HID_PROP_XSD_TOTAL_DIGITS; }
+hidspecial HID_PROP_XSD_WHITESPACES { HelpId = HID_PROP_XSD_WHITESPACES; }
+
+hidspecial HID_PROTOCOLS { HelpId = HID_PROTOCOLS; }
+hidspecial HID_SELECTION_TLB { HelpId = HID_SELECTION_TLB; }
+
+hidspecial UID_ABSPILOT_HELP { HelpId = UID_ABSPILOT_HELP; }
+hidspecial UID_BIB_FRAME_WINDOW { HelpId = UID_BIB_FRAME_WINDOW;}
+
+hidspecial UID_BRWEVT_ACTIONPERFORMED { HelpId = UID_BRWEVT_ACTIONPERFORMED; }
+hidspecial UID_BRWEVT_ADJUSTMENTVALUECHANGED { HelpId = UID_BRWEVT_ADJUSTMENTVALUECHANGED; }
+hidspecial UID_BRWEVT_AFTERUPDATE { HelpId = UID_BRWEVT_AFTERUPDATE; }
+hidspecial UID_BRWEVT_APPROVEACTIONPERFORMED { HelpId = UID_BRWEVT_APPROVEACTIONPERFORMED; }
+hidspecial UID_BRWEVT_APPROVEPARAMETER { HelpId = UID_BRWEVT_APPROVEPARAMETER; }
+hidspecial UID_BRWEVT_APPROVERESETTED { HelpId = UID_BRWEVT_APPROVERESETTED; }
+hidspecial UID_BRWEVT_APPROVEROWCHANGE { HelpId = UID_BRWEVT_APPROVEROWCHANGE; }
+hidspecial UID_BRWEVT_BEFOREUPDATE { HelpId = UID_BRWEVT_BEFOREUPDATE; }
+hidspecial UID_BRWEVT_CHANGED { HelpId = UID_BRWEVT_CHANGED; }
+hidspecial UID_BRWEVT_CONFIRMDELETE { HelpId = UID_BRWEVT_CONFIRMDELETE; }
+hidspecial UID_BRWEVT_ERROROCCURED { HelpId = UID_BRWEVT_ERROROCCURED; }
+hidspecial UID_BRWEVT_FOCUSGAINED { HelpId = UID_BRWEVT_FOCUSGAINED; }
+hidspecial UID_BRWEVT_FOCUSLOST { HelpId = UID_BRWEVT_FOCUSLOST; }
+hidspecial UID_BRWEVT_ITEMSTATECHANGED { HelpId = UID_BRWEVT_ITEMSTATECHANGED; }
+hidspecial UID_BRWEVT_KEYTYPED { HelpId = UID_BRWEVT_KEYTYPED; }
+hidspecial UID_BRWEVT_KEYUP { HelpId = UID_BRWEVT_KEYUP; }
+hidspecial UID_BRWEVT_LOADED { HelpId = UID_BRWEVT_LOADED; }
+hidspecial UID_BRWEVT_MOUSEDRAGGED { HelpId = UID_BRWEVT_MOUSEDRAGGED; }
+hidspecial UID_BRWEVT_MOUSEENTERED { HelpId = UID_BRWEVT_MOUSEENTERED; }
+hidspecial UID_BRWEVT_MOUSEEXITED { HelpId = UID_BRWEVT_MOUSEEXITED; }
+hidspecial UID_BRWEVT_MOUSEMOVED { HelpId = UID_BRWEVT_MOUSEMOVED; }
+hidspecial UID_BRWEVT_MOUSEPRESSED { HelpId = UID_BRWEVT_MOUSEPRESSED; }
+hidspecial UID_BRWEVT_MOUSERELEASED { HelpId = UID_BRWEVT_MOUSERELEASED; }
+hidspecial UID_BRWEVT_POSITIONED { HelpId = UID_BRWEVT_POSITIONED; }
+hidspecial UID_BRWEVT_POSITIONING { HelpId = UID_BRWEVT_POSITIONING; }
+hidspecial UID_BRWEVT_RELOADED { HelpId = UID_BRWEVT_RELOADED; }
+hidspecial UID_BRWEVT_RELOADING { HelpId = UID_BRWEVT_RELOADING; }
+hidspecial UID_BRWEVT_RESETTED { HelpId = UID_BRWEVT_RESETTED; }
+hidspecial UID_BRWEVT_ROWCHANGE { HelpId = UID_BRWEVT_ROWCHANGE; }
+hidspecial UID_BRWEVT_SUBMITTED { HelpId = UID_BRWEVT_SUBMITTED; }
+hidspecial UID_BRWEVT_TEXTCHANGED { HelpId = UID_BRWEVT_TEXTCHANGED; }
+hidspecial UID_BRWEVT_UNLOADED { HelpId = UID_BRWEVT_UNLOADED; }
+hidspecial UID_BRWEVT_UNLOADING { HelpId = UID_BRWEVT_UNLOADING; }
+
+hidspecial UID_DBIWIZARD_FORMS { HelpId = UID_DBIWIZARD_FORMS; }
+hidspecial UID_DBIWIZARD_FORMS_SAVETO { HelpId = UID_DBIWIZARD_FORMS_SAVETO; }
+hidspecial UID_DBIWIZARD_HELP { HelpId = UID_DBIWIZARD_HELP; }
+hidspecial UID_DBIWIZARD_QUERIES { HelpId = UID_DBIWIZARD_QUERIES; }
+hidspecial UID_DBIWIZARD_SOURCEFILE { HelpId = UID_DBIWIZARD_SOURCEFILE; }
+hidspecial UID_DBIWIZARD_SOURCESTATS { HelpId = UID_DBIWIZARD_SOURCESTATS; }
+
+hidspecial UID_EVT_MACRODLG { HelpId = UID_EVT_MACRODLG; }
+
+hidspecial UID_FIELDLINK_DETAIL1 { HelpId = UID_FIELDLINK_DETAIL1; }
+hidspecial UID_FIELDLINK_DETAIL2 { HelpId = UID_FIELDLINK_DETAIL2; }
+hidspecial UID_FIELDLINK_DETAIL3 { HelpId = UID_FIELDLINK_DETAIL3; }
+hidspecial UID_FIELDLINK_DETAIL4 { HelpId = UID_FIELDLINK_DETAIL4; }
+hidspecial UID_FIELDLINK_MASTER1 { HelpId = UID_FIELDLINK_MASTER1; }
+hidspecial UID_FIELDLINK_MASTER2 { HelpId = UID_FIELDLINK_MASTER2; }
+hidspecial UID_FIELDLINK_MASTER3 { HelpId = UID_FIELDLINK_MASTER3; }
+hidspecial UID_FIELDLINK_MASTER4 { HelpId = UID_FIELDLINK_MASTER4; }
+
+hidspecial UID_PROP_ADD_DATA_TYPE { HelpId = UID_PROP_ADD_DATA_TYPE; }
+hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; }
+hidspecial UID_PROP_DLG_ATTR_DATASOURCE { HelpId = UID_PROP_DLG_ATTR_DATASOURCE; }
+hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; }
+hidspecial UID_PROP_DLG_ATTR_TARGET_URL { HelpId = UID_PROP_DLG_ATTR_TARGET_URL; }
+hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; }
+hidspecial UID_PROP_DLG_BACKGROUNDCOLOR { HelpId = UID_PROP_DLG_BACKGROUNDCOLOR; }
hidspecial UID_PROP_DLG_BIND_EXPRESSION { HelpId = UID_PROP_DLG_BIND_EXPRESSION; }
-hidspecial UID_PROP_DLG_XSD_REQUIRED { HelpId = UID_PROP_DLG_XSD_REQUIRED; }
-hidspecial UID_PROP_DLG_XSD_RELEVANT { HelpId = UID_PROP_DLG_XSD_RELEVANT; }
-hidspecial UID_PROP_DLG_XSD_READONLY { HelpId = UID_PROP_DLG_XSD_READONLY; }
-hidspecial UID_PROP_DLG_XSD_CONSTRAINT { HelpId = UID_PROP_DLG_XSD_CONSTRAINT; }
+hidspecial UID_PROP_DLG_BORDERCOLOR { HelpId = UID_PROP_DLG_BORDERCOLOR; }
+hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; }
+hidspecial UID_PROP_DLG_CONTROLLABEL { HelpId = UID_PROP_DLG_CONTROLLABEL; }
+hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; }
+hidspecial UID_PROP_DLG_FILLCOLOR { HelpId = UID_PROP_DLG_FILLCOLOR; }
+hidspecial UID_PROP_DLG_FILTER { HelpId = UID_PROP_DLG_FILTER; }
+hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; }
+hidspecial UID_PROP_DLG_FONT_TYPE { HelpId = UID_PROP_DLG_FONT_TYPE; }
+hidspecial UID_PROP_DLG_FORMLINKFIELDS { HelpId = UID_PROP_DLG_FORMLINKFIELDS; }
+hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; }
+hidspecial UID_PROP_DLG_IMAGE_URL { HelpId = UID_PROP_DLG_IMAGE_URL; }
+hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; }
+hidspecial UID_PROP_DLG_NUMBER_FORMAT { HelpId = UID_PROP_DLG_NUMBER_FORMAT; }
+hidspecial UID_PROP_DLG_ORDER { HelpId = UID_PROP_DLG_ORDER; }
+hidspecial UID_PROP_DLG_SELECTION { HelpId = UID_PROP_DLG_SELECTION; }
+hidspecial UID_PROP_DLG_SQLCOMMAND { HelpId = UID_PROP_DLG_SQLCOMMAND; }
+hidspecial UID_PROP_DLG_SYMBOLCOLOR { HelpId = UID_PROP_DLG_SYMBOLCOLOR; }
+hidspecial UID_PROP_DLG_TABINDEX { HelpId = UID_PROP_DLG_TABINDEX; }
hidspecial UID_PROP_DLG_XSD_CALCULATION { HelpId = UID_PROP_DLG_XSD_CALCULATION; }
-hidspecial UID_PROP_ADD_DATA_TYPE { HelpId = UID_PROP_ADD_DATA_TYPE; }
+hidspecial UID_PROP_DLG_XSD_CONSTRAINT { HelpId = UID_PROP_DLG_XSD_CONSTRAINT; }
+hidspecial UID_PROP_DLG_XSD_READONLY { HelpId = UID_PROP_DLG_XSD_READONLY; }
+hidspecial UID_PROP_DLG_XSD_RELEVANT { HelpId = UID_PROP_DLG_XSD_RELEVANT; }
+hidspecial UID_PROP_DLG_XSD_REQUIRED { HelpId = UID_PROP_DLG_XSD_REQUIRED; }
hidspecial UID_PROP_REMOVE_DATA_TYPE { HelpId = UID_PROP_REMOVE_DATA_TYPE; }
-hidspecial HID_PROP_XSD_TOTAL_DIGITS { HelpId = HID_PROP_XSD_TOTAL_DIGITS; }
-hidspecial HID_PROP_XSD_FRACTION_DIGITS { HelpId = HID_PROP_XSD_FRACTION_DIGITS; }
-hidspecial HID_PROP_XSD_MAX_INCLUSIVE { HelpId = HID_PROP_XSD_MAX_INCLUSIVE; }
-hidspecial HID_PROP_XSD_MAX_EXCLUSIVE { HelpId = HID_PROP_XSD_MAX_EXCLUSIVE; }
-hidspecial HID_PROP_XSD_MIN_INCLUSIVE { HelpId = HID_PROP_XSD_MIN_INCLUSIVE; }
-hidspecial HID_PROP_XSD_MIN_EXCLUSIVE { HelpId = HID_PROP_XSD_MIN_EXCLUSIVE; }
-hidspecial HID_PROP_UNCHECKEDREFVALUE { HelpId = HID_PROP_UNCHECKEDREFVALUE; }
-hidspecial HID_PROP_SUBMISSION_ID { HelpId = HID_PROP_SUBMISSION_ID; }
-hidspecial HID_PROP_LIST_BINDING { HelpId = HID_PROP_LIST_BINDING; }
-hidspecial HID_PROP_BINDING_NAME { HelpId = HID_PROP_BINDING_NAME; }
-
-hidspecial HID_CHECK_FOR_UPD_DLG { HelpId = HID_CHECK_FOR_UPD_DLG; }
-hidspecial HID_CHECK_FOR_UPD_CLOSE { HelpId = HID_CHECK_FOR_UPD_CLOSE; }
-hidspecial HID_CHECK_FOR_UPD_PAUSE { HelpId = HID_CHECK_FOR_UPD_PAUSE; }
-hidspecial HID_CHECK_FOR_UPD_RESUME { HelpId = HID_CHECK_FOR_UPD_RESUME; }
-hidspecial HID_CHECK_FOR_UPD_DOWNLOAD { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD; }
-hidspecial HID_CHECK_FOR_UPD_DOWNLOAD2 { HelpId = HID_CHECK_FOR_UPD_DOWNLOAD2; }
-hidspecial HID_CHECK_FOR_UPD_INSTALL { HelpId = HID_CHECK_FOR_UPD_INSTALL; }
-hidspecial HID_CHECK_FOR_UPD_STATUS { HelpId = HID_CHECK_FOR_UPD_STATUS; }
-hidspecial HID_CHECK_FOR_UPD_DESCRIPTION { HelpId = HID_CHECK_FOR_UPD_DESCRIPTION; }
-hidspecial HID_CHECK_FOR_UPD_CANCEL { HelpId = HID_CHECK_FOR_UPD_CANCEL; }
-hidspecial HID_PROP_NOLABEL { HelpId = HID_PROP_NOLABEL; }
-hidspecial HID_PROP_INPUT_REQUIRED { HelpId = HID_PROP_INPUT_REQUIRED; }
-hidspecial HID_PROP_WRITING_MODE { HelpId = HID_PROP_WRITING_MODE; }
-hidspecial HID_PROP_ENABLE_VISIBLE { HelpId = HID_PROP_ENABLE_VISIBLE; }
-hidspecial HID_PROP_WHEEL_BEHAVIOR { HelpId = HID_PROP_WHEEL_BEHAVIOR; }
-hidspecial HID_PROP_ANCHOR_TYPE { HelpId = HID_PROP_ANCHOR_TYPE; }
diff --git a/forms/qa/integration/forms/TestSkeleton.java b/forms/qa/integration/forms/TestSkeleton.java
index f16083664cbe..8f2765b3a6d5 100644
--- a/forms/qa/integration/forms/TestSkeleton.java
+++ b/forms/qa/integration/forms/TestSkeleton.java
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: TestSkeleton.java,v $
- * $Revision: 1.5 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -29,61 +26,50 @@
************************************************************************/
package integration.forms;
-import com.sun.star.uno.UnoRuntime;
-
-import com.sun.star.lang.XMultiServiceFactory;
-
-import com.sun.star.util.XCloseable;
+import com.sun.star.uno.Exception;
-import integration.forms.DocumentHelper;
-
-public class TestSkeleton extends complexlib.ComplexTestCase
+public class TestSkeleton extends TestCase
{
- private DocumentHelper m_document;
- private FormLayer m_formLayer;
- private XMultiServiceFactory m_orb;
-
- /** Creates a new instance of ValueBinding */
+ /** Creates a new instance of TestSkeleton */
public TestSkeleton()
{
+ super( DocumentType.WRITER );
}
/* ------------------------------------------------------------------ */
public String[] getTestMethodNames()
{
return new String[] {
- "checkSomething"
+ "checkTestSkeleton"
};
}
/* ------------------------------------------------------------------ */
public String getTestObjectName()
{
- return "Form Control Spreadsheet Cell Binding Test";
+ return "Test Skeleton";
+ }
+
+ /* ------------------------------------------------------------------ */
+ public void checkTestSkeleton() throws com.sun.star.uno.Exception, java.lang.Exception
+ {
}
/* ------------------------------------------------------------------ */
- public void before() throws com.sun.star.uno.Exception, java.lang.Exception
+ public void before() throws Exception, java.lang.Exception
{
- m_orb = (XMultiServiceFactory)param.getMSF();
- m_document = DocumentHelper.blankTextDocument( m_orb );
- m_formLayer = new FormLayer( m_document );
+ super.before();
}
/* ------------------------------------------------------------------ */
- public void after() throws com.sun.star.uno.Exception, java.lang.Exception
+ public void after() throws Exception, java.lang.Exception
{
- // close our document
- if ( m_document != null )
- {
- XCloseable closeDoc = (XCloseable)UnoRuntime.queryInterface( XCloseable.class,
- m_document.getDocument() );
- closeDoc.close( true );
- }
+ super.before();
}
/* ------------------------------------------------------------------ */
- public void checkSomething() throws com.sun.star.uno.Exception, java.lang.Exception
+ protected void prepareDocument() throws com.sun.star.uno.Exception, java.lang.Exception
{
+ super.prepareDocument();
}
-}
+ }
diff --git a/forms/qa/makefile.mk b/forms/qa/makefile.mk
index 822f67e1bb46..b34529e2fbcf 100644
--- a/forms/qa/makefile.mk
+++ b/forms/qa/makefile.mk
@@ -73,15 +73,18 @@ ALL: ALLDEP
.INCLUDE : target.mk
+test:
+ echo $(SOLARBINDIR)
+
.IF "$(BUILD_QADEVOOO)" == "YES"
show_targets:
- +@java $(RUNNER_CLASSPATH) complexlib.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s/.\$///:s/.java//))
+ +@$(AUGMENT_LIBRARY_PATH) java $(RUNNER_CLASSPATH) complexlib.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s/.\$///:s/.java//))
run:
- +$(COPY) integration$/forms$/*.props $(CLASSDIR)$/$(PACKAGE) && java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -sce forms_all.sce
+ +$(COPY) integration$/forms$/*.props $(CLASSDIR)$/$(PACKAGE) && $(AUGMENT_LIBRARY_PATH) java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -sce forms_all.sce
run_%:
- +$(COPY) integration$/forms$/*.props $(CLASSDIR)$/$(PACKAGE) && java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o integration.$(PRJNAME).$(@:s/run_//)
+ +$(COPY) integration$/forms$/*.props $(CLASSDIR)$/$(PACKAGE) && $(AUGMENT_LIBRARY_PATH) java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o integration.$(PRJNAME).$(@:s/run_//)
.ELSE
run: show_targets
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index ed3e85a905ec..23c05be9f89f 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -2151,9 +2151,9 @@ sal_Bool OBoundControlModel::connectToField(const Reference<XRowSet>& rForm)
try
{
+ sal_Int32 nFieldType = DataType::OTHER;
if ( xFieldCandidate.is() )
{
- sal_Int32 nFieldType = 0;
xFieldCandidate->getPropertyValue( PROPERTY_FIELDTYPE ) >>= nFieldType;
if ( approveDbColumnType( nFieldType ) )
impl_setField_noNotify( xFieldCandidate );
@@ -2165,6 +2165,8 @@ sal_Bool OBoundControlModel::connectToField(const Reference<XRowSet>& rForm)
{
if( m_xField->getPropertySetInfo()->hasPropertyByName( PROPERTY_VALUE ) )
{
+ m_nFieldType = nFieldType;
+
// an wertaenderungen horchen
m_xField->addPropertyChangeListener( PROPERTY_VALUE, this );
m_xColumnUpdate = Reference< XColumnUpdate >( m_xField, UNO_QUERY );
diff --git a/forms/source/xforms/model_ui.cxx b/forms/source/xforms/model_ui.cxx
index 20900f3ec3e0..92883f70a950 100644
--- a/forms/source/xforms/model_ui.cxx
+++ b/forms/source/xforms/model_ui.cxx
@@ -539,18 +539,21 @@ Model::XModel_t Model::newModel( const Reference<com::sun::star::frame::XModel>&
const OUString& sName )
throw( RuntimeException )
{
- Model* pModel = NULL;
+ Model::XModel_t xModel;
Reference<XNameContainer> xModels = lcl_getModels( xCmp );
if( xModels.is()
&& ! xModels->hasByName( sName ) )
{
- pModel = new Model();
+ Model* pModel = new Model();
+ xModel.set( pModel );
+
pModel->setID( sName );
pModel->newInstance( OUString(), OUString(), sal_False );
- xModels->insertByName( sName, makeAny( Reference<XModel>( pModel ) ) );
+ pModel->initialize();
+ xModels->insertByName( sName, makeAny( xModel ) );
}
- return pModel;
+ return xModel;
}
void Model::renameModel( const Reference<com::sun::star::frame::XModel>& xCmp,
diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx
index 1c4bf3f6d14f..a4dfbe3b08e6 100644
--- a/forms/source/xforms/xpathlib/xpathlib.cxx
+++ b/forms/source/xforms/xpathlib/xpathlib.cxx
@@ -293,7 +293,7 @@ void xforms_nowFunction(xmlXPathParserContextPtr ctxt, int /*nargs*/)
*/
DateTime aDateTime;
::rtl::OString aDateTimeString = makeDateTimeString(aDateTime);
- xmlChar *pString = (xmlChar*)rtl_allocateMemory(aDateTimeString.getLength()+1);
+ xmlChar *pString = static_cast<xmlChar*>(xmlMalloc(aDateTimeString.getLength()+1));
strncpy((char*)pString, (char*)aDateTimeString.getStr(), aDateTimeString.getLength());
pString[aDateTimeString.getLength()] = 0;
xmlXPathReturnString(ctxt, pString);
diff --git a/forms/util/makefile.mk b/forms/util/makefile.mk
index 1e99e6446f47..1c454b1383db 100644
--- a/forms/util/makefile.mk
+++ b/forms/util/makefile.mk
@@ -73,7 +73,7 @@ SHL1STDLIBS= \
$(COMPHELPERLIB) \
$(DBTOOLSLIB) \
$(TKLIB) \
- $(SVXLIB) \
+ $(SVXCORELIB) \
$(UCBHELPERLIB) \
$(LIBXML2LIB) \
$(ICUUCLIB) \
@@ -96,22 +96,6 @@ RES1FILELIST=\
RESLIB1NAME=$(TARGET)
RESLIB1SRSFILES=$(RES1FILELIST)
-.IF "$(GUI)"=="UNX"
-
-# [ed] 6/19/02 Only add in libraries for X11 OS X builds
-
-.IF "$(OS)"=="MACOSX"
-.IF "$(GUIBASE)"=="unx"
-SHL1STDLIBS +=\
- -lX11 -lXt -lXmu
-.ENDIF
-.ELSE
-SHL1STDLIBS +=\
- -lX11
-.ENDIF # OS == MACOSX
-
-.ENDIF
-
.IF "$(GUI)"=="OS2"
SHL1STDLIBS += pthread.lib libz.lib
.ENDIF
diff --git a/lingucomponent/source/spellcheck/macosxspell/makefile.mk b/lingucomponent/source/spellcheck/macosxspell/makefile.mk
index c414c671dfcc..ac3ac3b7d3a0 100644
--- a/lingucomponent/source/spellcheck/macosxspell/makefile.mk
+++ b/lingucomponent/source/spellcheck/macosxspell/makefile.mk
@@ -52,8 +52,8 @@ CFLAGSCC += $(HUNSPELL_CFLAGS)
# --- Files --------------------------------------------------------
-CFLAGSCXX += -I..$/..$/lingutil
-CFLAGSCXX += -x objective-c++ -fobjc-exceptions
+CFLAGSCXX+=$(OBJCXXFLAGS)
+CFLAGSCXX+=-I..$/..$/lingutil
EXCEPTIONSFILES= \
$(SLO)$/macspellimp.obj
diff --git a/package/inc/ZipEntry.hxx b/package/inc/ZipEntry.hxx
index aa311cc14ae9..eed7a7a7cff5 100644
--- a/package/inc/ZipEntry.hxx
+++ b/package/inc/ZipEntry.hxx
@@ -42,8 +42,8 @@ struct ZipEntry
sal_Int32 nCompressedSize;
sal_Int32 nSize;
sal_Int32 nOffset;
- sal_Int16 nNameLen;
+ sal_Int16 nPathLen;
sal_Int16 nExtraLen;
- ::rtl::OUString sName;
+ ::rtl::OUString sPath;
};
#endif
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index 287b899f7ab0..a954a1691c4b 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -40,6 +40,7 @@
#include <Inflater.hxx>
#endif
+#include <mutexholder.hxx>
namespace com { namespace sun { namespace star {
namespace lang { class XMultiServiceFactory; }
@@ -64,7 +65,6 @@ class EncryptionData;
class ZipFile
{
protected:
- ::rtl::OUString sName; /* zip file name */
::rtl::OUString sComment; /* zip file comment */
EntryHash aEntries;
ByteGrabber aGrabber;
@@ -90,6 +90,7 @@ protected:
// aMediaType parameter is used only for raw stream header creation
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > createUnbufferedStream(
+ SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
const vos::ORef < EncryptionData > &rData,
sal_Int8 nStreamMode,
@@ -128,7 +129,8 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawData(
ZipEntry& rEntry,
const vos::ORef < EncryptionData > &rData,
- sal_Bool bDecrypt)
+ 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 vos::ORef < EncryptionData > & xEncryptionData, rtlCipher &rCipher, sal_Bool bDecode );
@@ -157,13 +159,15 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream(
ZipEntry& rEntry,
const vos::ORef < EncryptionData > &rData,
- sal_Bool bDecrypt )
+ 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 vos::ORef < EncryptionData > &rData,
- sal_Bool bDecrypt )
+ sal_Bool bDecrypt,
+ SotMutexHolderRef aMutexHolder )
throw ( ::com::sun::star::packages::WrongPasswordException,
::com::sun::star::io::IOException,
::com::sun::star::packages::zip::ZipException,
@@ -172,7 +176,8 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getWrappedRawStream(
ZipEntry& rEntry,
const vos::ORef < EncryptionData > &rData,
- const ::rtl::OUString& aMediaType )
+ const ::rtl::OUString& aMediaType,
+ SotMutexHolderRef aMutexHolder )
throw ( ::com::sun::star::packages::NoEncryptionException,
::com::sun::star::io::IOException,
::com::sun::star::packages::zip::ZipException,
diff --git a/package/inc/ZipPackage.hxx b/package/inc/ZipPackage.hxx
index 93d7b83c95ff..0549c06b6bb7 100644
--- a/package/inc/ZipPackage.hxx
+++ b/package/inc/ZipPackage.hxx
@@ -37,12 +37,15 @@
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
#ifndef _COM_SUN_STAR_LANG_XPSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#include <HashMaps.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <osl/file.h>
+#include <mutexholder.hxx>
+
class ZipOutputStream;
class ZipPackageFolder;
class ZipFile;
@@ -81,44 +84,55 @@ class ZipPackage : public cppu::WeakImplHelper7
>
{
protected:
- ::com::sun::star::uno::Sequence < sal_Int8 > aEncryptionKey;
- FolderHash aRecent;
- ::rtl::OUString sURL;
- sal_Bool bHasEncryptedEntries;
- sal_Bool bUseManifest;
- sal_Bool bForceRecovery;
+ 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_bUseManifest;
+ sal_Bool m_bForceRecovery;
sal_Bool m_bMediaTypeFallbackUsed;
sal_Int16 m_nFormat;
sal_Bool m_bAllowRemoveOnInsert;
- InitialisationMode eMode;
+ InitialisationMode m_eMode;
- ::com::sun::star::uno::Reference < com::sun::star::container::XNameContainer > xRootFolder;
- ::com::sun::star::uno::Reference < com::sun::star::io::XStream > xStream;
- ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xContentStream;
- ::com::sun::star::uno::Reference < com::sun::star::io::XSeekable > xContentSeek;
- const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xFactory;
+ ::com::sun::star::uno::Reference < com::sun::star::container::XNameContainer > m_xRootFolder;
+ ::com::sun::star::uno::Reference < com::sun::star::io::XStream > m_xStream;
+ ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream > m_xContentStream;
+ ::com::sun::star::uno::Reference < com::sun::star::io::XSeekable > m_xContentSeek;
+ const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
- ZipPackageFolder *pRootFolder;
- ZipFile *pZipFile;
+ ZipPackageFolder *m_pRootFolder;
+ ZipFile *m_pZipFile;
void parseManifest();
void parseContentType();
void getZipFileContents();
- sal_Bool writeFileIsTemp();
- ::com::sun::star::uno::Reference < ::com::sun::star::io::XActiveDataStreamer > openOriginalForOutput();
+
void WriteMimetypeMagicFile( ZipOutputStream& aZipOut );
+ void WriteManifest( ZipOutputStream& aZipOut, const ::std::vector< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& aManList );
+ void WriteContentTypes( ZipOutputStream& aZipOut, const ::std::vector< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& aManList );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > writeTempFile();
+ ::com::sun::star::uno::Reference < ::com::sun::star::io::XActiveDataStreamer > openOriginalForOutput();
void DisconnectFromTargetAndThrowException_Impl(
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);
virtual ~ZipPackage( void );
- ZipFile& getZipFile() { return *pZipFile;}
- const com::sun::star::uno::Sequence < sal_Int8 > & getEncryptionKey ( ) {return aEncryptionKey;}
+ ZipFile& getZipFile() { return *m_pZipFile;}
+ const com::sun::star::uno::Sequence < sal_Int8 > & getEncryptionKey ( ) {return m_aEncryptionKey;}
sal_Int16 getFormat() const { return m_nFormat; }
+ SotMutexHolderRef GetSharedMutexRef() { return m_aMutexHolder; }
+
+ void ConnectTo( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream );
+
// XInitialization
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
diff --git a/package/inc/ZipPackageBuffer.hxx b/package/inc/ZipPackageBuffer.hxx
index 222422fe6409..81f461bb2e77 100644
--- a/package/inc/ZipPackageBuffer.hxx
+++ b/package/inc/ZipPackageBuffer.hxx
@@ -56,7 +56,7 @@ public:
inline void realloc ( sal_Int32 nSize ) { m_aBuffer.realloc ( nSize ); }
inline const sal_Int8 * getConstArray () const { return m_aBuffer.getConstArray(); }
- inline const com::sun::star::uno::Sequence < sal_Int8> & getSequence () const { return m_aBuffer; }
+ inline const com::sun::star::uno::Sequence < sal_Int8> getSequence () const { return m_aBuffer; }
// XInputStream
virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
diff --git a/package/inc/ZipPackageFolder.hxx b/package/inc/ZipPackageFolder.hxx
index dfe72a6975b9..1edbae7f5d3d 100644
--- a/package/inc/ZipPackageFolder.hxx
+++ b/package/inc/ZipPackageFolder.hxx
@@ -74,6 +74,8 @@ public:
::rtl::OUString& GetVersion() { return m_sVersion; }
void SetVersion( const ::rtl::OUString& aVersion ) { m_sVersion = aVersion; }
+ sal_Bool LookForUnexpectedODF12Streams( const ::rtl::OUString& aPath );
+
void setChildStreamsTypeByExtension( const ::com::sun::star::beans::StringPair& aPair );
void doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetParent )
diff --git a/package/inc/zipfileaccess.hxx b/package/inc/zipfileaccess.hxx
index 434ddefb61c2..fbee9799930e 100644
--- a/package/inc/zipfileaccess.hxx
+++ b/package/inc/zipfileaccess.hxx
@@ -40,7 +40,8 @@
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/implbase5.hxx>
-#include <osl/mutex.hxx>
+
+#include <mutexholder.hxx>
#include <ZipFile.hxx>
#include <HashMaps.hxx>
@@ -52,7 +53,8 @@ class OZipFileAccess : public ::cppu::WeakImplHelper5<
::com::sun::star::lang::XComponent,
::com::sun::star::lang::XServiceInfo >
{
- ::osl::Mutex m_aMutex;
+ SotMutexHolderRef m_aMutexHolder;
+
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xContentStream;
diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx
index 78d262358a0f..e64c650a386c 100644
--- a/package/source/manifest/ManifestDefines.hxx
+++ b/package/source/manifest/ManifestDefines.hxx
@@ -54,10 +54,17 @@
#define ATTRIBUTE_ALGORITHM_NAME "manifest:algorithm-name"
#define ATTRIBUTE_INITIALISATION_VECTOR "manifest:initialisation-vector"
+#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"
#endif
diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx
index 6ca9972cf729..4ae1785a0d8b 100644
--- a/package/source/manifest/ManifestExport.cxx
+++ b/package/source/manifest/ManifestExport.cxx
@@ -61,6 +61,7 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
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 ) );
@@ -68,10 +69,12 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
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) );
@@ -89,6 +92,9 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
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 ) );
::comphelper::AttributeList * pRootAttrList = new ::comphelper::AttributeList;
const Sequence < PropertyValue > *pSequence = rManList.getConstArray();
@@ -96,15 +102,16 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
// find the mediatype of the document if any
OUString aDocMediaType;
+ OUString aDocVersion;
for (sal_uInt32 nInd = 0; nInd < nManLength ; nInd++ )
{
OUString aMediaType;
OUString aPath;
+ OUString aVersion;
const PropertyValue *pValue = pSequence[nInd].getConstArray();
for (sal_uInt32 j = 0, nNum = pSequence[nInd].getLength(); j < nNum; j++, pValue++)
{
-
if (pValue->Name.equals (sMediaTypeProperty) )
{
pValue->Value >>= aMediaType;
@@ -113,20 +120,26 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
{
pValue->Value >>= aPath;
}
+ else if (pValue->Name.equals (sVersionProperty) )
+ {
+ pValue->Value >>= aVersion;
+ }
- if ( aPath.getLength() && aMediaType.getLength() )
+ if ( aPath.getLength() && aMediaType.getLength() && aVersion.getLength() )
break;
}
if ( aPath.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) ) )
{
aDocMediaType = aMediaType;
+ aDocVersion = aVersion;
break;
}
}
sal_Bool bProvideDTD = sal_False;
sal_Bool bAcceptNonemptyVersion = sal_False;
+ sal_Bool bStoreStartKeyGeneration = sal_False;
if ( aDocMediaType.getLength() )
{
if ( aDocMediaType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII ) ) )
@@ -152,6 +165,11 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
sCdataAttribute,
OUString( RTL_CONSTASCII_USTRINGPARAM ( MANIFEST_OASIS_NAMESPACE ) ) );
bAcceptNonemptyVersion = sal_True;
+ if ( aDocVersion.compareTo( ODFVER_012_TEXT ) >= 0 )
+ {
+ // this is ODF12 generation, let encrypted streams contain start-key-generation entry
+ bStoreStartKeyGeneration = sal_True;
+ }
}
else
{
@@ -224,6 +242,7 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
xHandler->startElement( sFileEntryElement , xAttrList);
if ( pVector && pSalt && pIterationCount )
{
+ // ==== Encryption Data
::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList;
Reference < XAttributeList > xNewAttrList (pNewAttrList);
OUStringBuffer aBuffer;
@@ -239,6 +258,7 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
}
xHandler->startElement( sEncryptionDataElement , xNewAttrList);
+ // ==== Algorithm
pNewAttrList = new ::comphelper::AttributeList;
xNewAttrList = pNewAttrList;
@@ -253,11 +273,15 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->endElement( sAlgorithmElement );
+ // ==== Key Derivation
pNewAttrList = new ::comphelper::AttributeList;
xNewAttrList = pNewAttrList;
pNewAttrList->AddAttribute ( sKeyDerivationNameAttribute, sCdataAttribute, sPBKDF2 );
+ if ( bStoreStartKeyGeneration )
+ pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, sDerivedKeySize );
+
sal_Int32 nCount = 0;
pIterationCount->Value >>= nCount;
aBuffer.append (nCount);
@@ -271,6 +295,25 @@ ManifestExport::ManifestExport(Reference < XDocumentHandler > xHandler, const S
xHandler->startElement( sKeyDerivationElement , xNewAttrList);
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->endElement( sKeyDerivationElement );
+
+ // we have to store start-key-generation element as the last one to workaround the parsing problem
+ // in OOo3.1 and older versions
+ if ( bStoreStartKeyGeneration )
+ {
+ // ==== Start Key Generation
+ pNewAttrList = new ::comphelper::AttributeList;
+ xNewAttrList = pNewAttrList;
+
+ // currently SHA1 is used to generate 20-bytes start key
+ pNewAttrList->AddAttribute ( sStartKeyGenerationNameAttribute, sCdataAttribute, sSHA1 );
+ pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, sStartKeySize );
+
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->startElement( sStartKeyGenerationElement , xNewAttrList);
+ xHandler->ignorableWhitespace ( sWhiteSpace );
+ xHandler->endElement( sStartKeyGenerationElement );
+ }
+
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->endElement( sEncryptionDataElement );
}
diff --git a/package/source/manifest/makefile.mk b/package/source/manifest/makefile.mk
index 4d6e599c83c4..197ace20479e 100644
--- a/package/source/manifest/makefile.mk
+++ b/package/source/manifest/makefile.mk
@@ -42,6 +42,8 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
+.IF "$(L10N_framework)"==""
+
SLOFILES= \
$(SLO)$/ManifestReader.obj \
$(SLO)$/ManifestWriter.obj \
@@ -50,6 +52,8 @@ SLOFILES= \
$(SLO)$/Base64Codec.obj \
$(SLO)$/UnoRegister.obj
+.ENDIF # L10N_framework
+
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
diff --git a/package/source/xstor/makefile.mk b/package/source/xstor/makefile.mk
index 1a2e0ef765e5..a0e49f2096e0 100644
--- a/package/source/xstor/makefile.mk
+++ b/package/source/xstor/makefile.mk
@@ -42,6 +42,8 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
+.IF "$(L10N_framework)"==""
+
SLOFILES = \
$(SLO)$/ohierarchyholder.obj\
$(SLO)$/ocompinstream.obj\
@@ -68,6 +70,8 @@ SHL1IMPLIB=i$(SHL1TARGET)
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=$(SHL1TARGET).dxp
+.ENDIF # L10N_framework
+
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 2946c14f98ff..67e71baf8533 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -3171,7 +3171,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa
m_pImpl->m_aProps[nInd].Value <<= bCompressedValueFromType;
}
}
- else if ( m_pData->m_nStorageType == PACKAGE_STORAGE && aPropertyName.equalsAscii( "Compressed" ) )
+ else if ( aPropertyName.equals( aCompressedString ) )
{
// if the "Compressed" property is not set explicitly, the MediaType can change the default value
m_pImpl->m_bCompressedSetExplicit = sal_True;
@@ -3206,8 +3206,7 @@ void SAL_CALL OWriteStream::setPropertyValue( const ::rtl::OUString& aPropertyNa
else
throw lang::IllegalArgumentException(); //TODO
}
- else if ( m_pData->m_nStorageType == OFOPXML_STORAGE
- && ( aPropertyName.equalsAscii( "MediaType" ) || aPropertyName.equalsAscii( "Compressed" ) ) )
+ else if ( m_pData->m_nStorageType == OFOPXML_STORAGE && aPropertyName.equals( aMediaTypeString ) )
{
for ( sal_Int32 nInd = 0; nInd < m_pImpl->m_aProps.getLength(); nInd++ )
{
@@ -3282,8 +3281,8 @@ uno::Any SAL_CALL OWriteStream::getPropertyValue( const ::rtl::OUString& aProp )
else
aPropertyName = aProp;
- if ( ( m_pData->m_nStorageType == PACKAGE_STORAGE || m_pData->m_nStorageType == OFOPXML_STORAGE )
- && aPropertyName.equalsAscii( "MediaType" )
+ if ( ( ( m_pData->m_nStorageType == PACKAGE_STORAGE || m_pData->m_nStorageType == OFOPXML_STORAGE )
+ && aPropertyName.equalsAscii( "MediaType" ) )
|| m_pData->m_nStorageType == PACKAGE_STORAGE && aPropertyName.equalsAscii( "Encrypted" )
|| aPropertyName.equalsAscii( "Compressed" ) )
{
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index b49fbd67b98d..4d0af7bb7619 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -3224,7 +3224,7 @@ sal_Bool SAL_CALL OStorage::isStreamElement( const ::rtl::OUString& aElementName
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
uno::Any aCaught( ::cppu::getCaughtException() );
- throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't detect whether it is a stream!" ) ),
+ throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't detect whether it is a stream!" ) ),
uno::Reference< io::XInputStream >(),
aCaught );
}
@@ -3293,7 +3293,7 @@ sal_Bool SAL_CALL OStorage::isStorageElement( const ::rtl::OUString& aElementNam
m_pImpl->AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow" ) ) );
uno::Any aCaught( ::cppu::getCaughtException() );
- throw embed::StorageWrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Can't detect whether it is a storage" ) ),
+ throw lang::WrappedTargetRuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "can't detect whether it is a storage" ) ),
uno::Reference< io::XInputStream >(),
aCaught );
}
@@ -4804,6 +4804,7 @@ void SAL_CALL OStorage::setPropertyValue( const ::rtl::OUString& aPropertyName,
m_pImpl->m_bIsModified = sal_True;
}
else if ( m_pData->m_bIsRoot && ( aPropertyName.equalsAscii( "HasEncryptedEntries" )
+ || aPropertyName.equalsAscii( "HasNonEncryptedEntries" )
|| aPropertyName.equalsAscii( "URL" )
|| aPropertyName.equalsAscii( "RepairPackage" ) )
|| aPropertyName.equalsAscii( "IsRoot" )
@@ -4937,7 +4938,8 @@ uno::Any SAL_CALL OStorage::getPropertyValue( const ::rtl::OUString& aPropertyNa
return uno::makeAny( sal_False ); // RepairPackage
}
- else if ( m_pData->m_nStorageType == PACKAGE_STORAGE && aPropertyName.equalsAscii( "HasEncryptedEntries" ) )
+ else if ( m_pData->m_nStorageType == PACKAGE_STORAGE
+ && ( aPropertyName.equalsAscii( "HasEncryptedEntries" ) || aPropertyName.equalsAscii( "HasNonEncryptedEntries" ) ) )
{
try {
m_pImpl->ReadContents();
diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx
index 1eba064a2165..53e4301844c9 100644
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@ -41,6 +41,8 @@
#include <algorithm>
#include <string.h>
+#include <osl/mutex.hxx>
+
#if 0
// for debugging purposes here
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
@@ -55,14 +57,16 @@ using com::sun::star::lang::IllegalArgumentException;
using com::sun::star::packages::zip::ZipIOException;
using ::rtl::OUString;
-XUnbufferedStream::XUnbufferedStream( ZipEntry & rEntry,
+XUnbufferedStream::XUnbufferedStream( SotMutexHolderRef aMutexHolder,
+ ZipEntry & rEntry,
Reference < XInputStream > xNewZipStream,
const vos::ORef < EncryptionData > &rData,
sal_Int8 nStreamMode,
sal_Bool bIsEncrypted,
const ::rtl::OUString& aMediaType,
sal_Bool bRecoveryMode )
-: mxZipStream ( xNewZipStream )
+: maMutexHolder( aMutexHolder.Is() ? aMutexHolder : SotMutexHolderRef( new SotMutexHolder ) )
+, mxZipStream ( xNewZipStream )
, mxZipSeek ( xNewZipStream, UNO_QUERY )
, maEntry ( rEntry )
, mxData ( rData )
@@ -115,7 +119,8 @@ XUnbufferedStream::XUnbufferedStream( ZipEntry & rEntry,
// allows to read package raw stream
XUnbufferedStream::XUnbufferedStream( const Reference < XInputStream >& xRawStream,
const vos::ORef < EncryptionData > &rData )
-: mxZipStream ( xRawStream )
+: maMutexHolder( new SotMutexHolder )
+, mxZipStream ( xRawStream )
, mxZipSeek ( xRawStream, UNO_QUERY )
, mxData ( rData )
, maCipher ( NULL )
@@ -159,6 +164,8 @@ XUnbufferedStream::~XUnbufferedStream()
sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
throw( NotConnectedException, BufferSizeExceededException, IOException, RuntimeException)
{
+ ::osl::MutexGuard aGuard( maMutexHolder->GetMutex() );
+
sal_Int32 nRequestedBytes = nBytesToRead;
OSL_ENSURE( !mnHeaderToRead || mbWrappedRaw, "Only encrypted raw stream can be provided with header!" );
if ( mnMyCurrent + nRequestedBytes > mnZipSize + maHeader.getLength() )
diff --git a/package/source/zipapi/XUnbufferedStream.hxx b/package/source/zipapi/XUnbufferedStream.hxx
index 09be39fa85a3..db688761726e 100644
--- a/package/source/zipapi/XUnbufferedStream.hxx
+++ b/package/source/zipapi/XUnbufferedStream.hxx
@@ -36,16 +36,11 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <cppuhelper/implbase1.hxx>
-#ifndef _VOS_REF_H_
#include <vos/ref.hxx>
-#endif
-#ifndef _INFLATER_HXX
#include <Inflater.hxx>
-#endif
#include <ZipEntry.hxx>
-#ifndef _CRC32_HXX_
#include <CRC32.hxx>
-#endif
+#include <mutexholder.hxx>
#define UNBUFF_STREAM_DATA 0
#define UNBUFF_STREAM_RAW 1
@@ -59,6 +54,8 @@ class XUnbufferedStream : public cppu::WeakImplHelper1
>
{
protected:
+ SotMutexHolderRef maMutexHolder;
+
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::Sequence < sal_Int8 > maCompBuffer, maHeader;
@@ -73,7 +70,9 @@ protected:
sal_Bool mbCheckCRC;
public:
- XUnbufferedStream( ZipEntry & rEntry,
+ XUnbufferedStream(
+ SotMutexHolderRef aMutexHolder,
+ ZipEntry & rEntry,
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
const vos::ORef < EncryptionData > &rData,
sal_Int8 nStreamMode,
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 1ddf31a66c5f..246cbd889015 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -492,13 +492,14 @@ Reference < XInputStream > ZipFile::createMemoryStream(
}
#endif
Reference < XInputStream > ZipFile::createUnbufferedStream(
+ SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
const ORef < EncryptionData > &rData,
sal_Int8 nStreamMode,
sal_Bool bIsEncrypted,
::rtl::OUString aMediaType )
{
- return new XUnbufferedStream ( rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
+ return new XUnbufferedStream ( aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
}
@@ -509,7 +510,8 @@ ZipEnumeration * SAL_CALL ZipFile::entries( )
Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
const vos::ORef < EncryptionData > &rData,
- sal_Bool bIsEncrypted )
+ sal_Bool bIsEncrypted,
+ SotMutexHolderRef aMutexHolder )
throw(IOException, ZipException, RuntimeException)
{
if ( rEntry.nOffset <= 0 )
@@ -525,7 +527,8 @@ Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
if ( bIsEncrypted && !rData.isEmpty() && rData->aDigest.getLength() )
bNeedRawStream = !hasValidPassword ( rEntry, rData );
- return createUnbufferedStream ( rEntry,
+ return createUnbufferedStream ( aMutexHolder,
+ rEntry,
rData,
bNeedRawStream ? UNBUFF_STREAM_RAW : UNBUFF_STREAM_DATA,
bIsEncrypted );
@@ -533,7 +536,8 @@ Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
const vos::ORef < EncryptionData > &rData,
- sal_Bool bIsEncrypted )
+ sal_Bool bIsEncrypted,
+ SotMutexHolderRef aMutexHolder )
throw ( packages::WrongPasswordException,
IOException,
ZipException,
@@ -562,7 +566,8 @@ Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
else
bNeedRawStream = ( rEntry.nMethod == STORED );
- return createUnbufferedStream ( rEntry,
+ return createUnbufferedStream ( aMutexHolder,
+ rEntry,
rData,
bNeedRawStream ? UNBUFF_STREAM_RAW : UNBUFF_STREAM_DATA,
bIsEncrypted );
@@ -570,19 +575,21 @@ Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry,
Reference< XInputStream > SAL_CALL ZipFile::getRawData( ZipEntry& rEntry,
const vos::ORef < EncryptionData > &rData,
- sal_Bool bIsEncrypted )
+ sal_Bool bIsEncrypted,
+ SotMutexHolderRef aMutexHolder )
throw(IOException, ZipException, RuntimeException)
{
if ( rEntry.nOffset <= 0 )
readLOC( rEntry );
- return createUnbufferedStream ( rEntry, rData, UNBUFF_STREAM_RAW, bIsEncrypted );
+ return createUnbufferedStream ( aMutexHolder, rEntry, rData, UNBUFF_STREAM_RAW, bIsEncrypted );
}
Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
ZipEntry& rEntry,
const vos::ORef < EncryptionData > &rData,
- const ::rtl::OUString& aMediaType )
+ const ::rtl::OUString& aMediaType,
+ SotMutexHolderRef aMutexHolder )
throw ( packages::NoEncryptionException,
IOException,
ZipException,
@@ -594,14 +601,14 @@ Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
if ( rEntry.nOffset <= 0 )
readLOC( rEntry );
- return createUnbufferedStream ( rEntry, rData, UNBUFF_STREAM_WRAPPEDRAW, sal_True, aMediaType );
+ return createUnbufferedStream ( aMutexHolder, rEntry, rData, UNBUFF_STREAM_WRAPPEDRAW, sal_True, aMediaType );
}
sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
throw(IOException, ZipException, RuntimeException)
{
sal_Int32 nTestSig, nTime, nCRC, nSize, nCompressedSize;
- sal_Int16 nVersion, nFlag, nHow, nNameLen, nExtraLen;
+ sal_Int16 nVersion, nFlag, nHow, nPathLen, nExtraLen;
sal_Int32 nPos = -rEntry.nOffset;
aGrabber.seek(nPos);
@@ -616,18 +623,32 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
aGrabber >> nCRC;
aGrabber >> nCompressedSize;
aGrabber >> nSize;
- aGrabber >> nNameLen;
+ aGrabber >> nPathLen;
aGrabber >> nExtraLen;
- rEntry.nOffset = static_cast < sal_Int32 > (aGrabber.getPosition()) + nNameLen + nExtraLen;
+ rEntry.nOffset = static_cast < sal_Int32 > (aGrabber.getPosition()) + nPathLen + nExtraLen;
- if ( rEntry.nNameLen == -1 ) // the file was created
- rEntry.nNameLen = nNameLen;
+ // read always in UTF8, some tools seem not to set UTF8 bit
+ uno::Sequence < sal_Int8 > aNameBuffer( nPathLen );
+ sal_Int32 nRead = aGrabber.readBytes( aNameBuffer, nPathLen );
+ if ( nRead < aNameBuffer.getLength() )
+ aNameBuffer.realloc( nRead );
+
+ ::rtl::OUString sLOCPath = rtl::OUString::intern( (sal_Char *) aNameBuffer.getArray(),
+ aNameBuffer.getLength(),
+ RTL_TEXTENCODING_UTF8 );
+
+ if ( rEntry.nPathLen == -1 ) // the file was created
+ {
+ rEntry.nPathLen = nPathLen;
+ rEntry.sPath = sLOCPath;
+ }
// the method can be reset for internal use so it is not checked
sal_Bool bBroken = rEntry.nVersion != nVersion
|| rEntry.nFlag != nFlag
|| rEntry.nTime != nTime
- || rEntry.nNameLen != nNameLen;
+ || rEntry.nPathLen != nPathLen
+ || !rEntry.sPath.equals( sLOCPath );
if ( bBroken && !bRecoveryMode )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "The stream seems to be broken!" ) ),
@@ -742,7 +763,7 @@ sal_Int32 ZipFile::readCEN()
aMemGrabber >> aEntry.nCrc;
aMemGrabber >> aEntry.nCompressedSize;
aMemGrabber >> aEntry.nSize;
- aMemGrabber >> aEntry.nNameLen;
+ aMemGrabber >> aEntry.nPathLen;
aMemGrabber >> aEntry.nExtraLen;
aMemGrabber >> nCommentLen;
aMemGrabber.skipBytes ( 8 );
@@ -751,7 +772,7 @@ sal_Int32 ZipFile::readCEN()
aEntry.nOffset += nLocPos;
aEntry.nOffset *= -1;
- if ( aEntry.nNameLen < 0 || aEntry.nNameLen > ZIP_MAXNAMELEN )
+ if ( aEntry.nPathLen < 0 || aEntry.nPathLen > ZIP_MAXNAMELEN )
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "name length exceeds ZIP_MAXNAMELEN bytes" ) ), Reference < XInterface > () );
if ( nCommentLen < 0 || nCommentLen > ZIP_MAXNAMELEN )
@@ -761,15 +782,15 @@ sal_Int32 ZipFile::readCEN()
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "extra header info exceeds ZIP_MAXEXTRA bytes") ), Reference < XInterface > () );
// read always in UTF8, some tools seem not to set UTF8 bit
- aEntry.sName = rtl::OUString::intern ( (sal_Char *) aMemGrabber.getCurrentPos(),
- aEntry.nNameLen,
+ aEntry.sPath = rtl::OUString::intern ( (sal_Char *) aMemGrabber.getCurrentPos(),
+ aEntry.nPathLen,
RTL_TEXTENCODING_UTF8 );
- if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aEntry.sName, sal_True ) )
+ if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aEntry.sPath, sal_True ) )
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip entry has an invalid name.") ), Reference < XInterface > () );
- aMemGrabber.skipBytes( aEntry.nNameLen + aEntry.nExtraLen + nCommentLen );
- aEntries[aEntry.sName] = aEntry;
+ aMemGrabber.skipBytes( aEntry.nPathLen + aEntry.nExtraLen + nCommentLen );
+ aEntries[aEntry.sPath] = aEntry;
}
if (nCount != nTotal)
@@ -823,7 +844,7 @@ sal_Int32 ZipFile::recover()
aMemGrabber >> aEntry.nCrc;
aMemGrabber >> aEntry.nCompressedSize;
aMemGrabber >> aEntry.nSize;
- aMemGrabber >> aEntry.nNameLen;
+ aMemGrabber >> aEntry.nPathLen;
aMemGrabber >> aEntry.nExtraLen;
sal_Int32 nDescrLength =
@@ -835,32 +856,32 @@ sal_Int32 ZipFile::recover()
// For OOo2.0 the whole package must be switched to unsigned values
if ( aEntry.nCompressedSize < 0 ) aEntry.nCompressedSize = 0x7FFFFFFF;
if ( aEntry.nSize < 0 ) aEntry.nSize = 0x7FFFFFFF;
- if ( aEntry.nNameLen < 0 ) aEntry.nNameLen = 0x7FFF;
+ if ( aEntry.nPathLen < 0 ) aEntry.nPathLen = 0x7FFF;
if ( aEntry.nExtraLen < 0 ) aEntry.nExtraLen = 0x7FFF;
// End of quick fix
- sal_Int32 nBlockLength = aEntry.nSize + aEntry.nNameLen + aEntry.nExtraLen + 30 + nDescrLength;
- if ( aEntry.nNameLen <= ZIP_MAXNAMELEN && aEntry.nExtraLen < ZIP_MAXEXTRA
+ sal_Int32 nBlockLength = aEntry.nSize + aEntry.nPathLen + aEntry.nExtraLen + 30 + nDescrLength;
+ if ( aEntry.nPathLen <= ZIP_MAXNAMELEN && aEntry.nExtraLen < ZIP_MAXEXTRA
&& ( nGenPos + nPos + nBlockLength ) <= nLength )
{
// read always in UTF8, some tools seem not to set UTF8 bit
- if( nPos + 30 + aEntry.nNameLen <= nBufSize )
- aEntry.sName = OUString ( (sal_Char *) &pBuffer[nPos + 30],
- aEntry.nNameLen,
+ if( nPos + 30 + aEntry.nPathLen <= nBufSize )
+ aEntry.sPath = OUString ( (sal_Char *) &pBuffer[nPos + 30],
+ aEntry.nPathLen,
RTL_TEXTENCODING_UTF8 );
else
{
Sequence < sal_Int8 > aFileName;
aGrabber.seek( nGenPos + nPos + 30 );
- aGrabber.readBytes( aFileName, aEntry.nNameLen );
- aEntry.sName = OUString ( (sal_Char *) aFileName.getArray(),
+ aGrabber.readBytes( aFileName, aEntry.nPathLen );
+ aEntry.sPath = OUString ( (sal_Char *) aFileName.getArray(),
aFileName.getLength(),
RTL_TEXTENCODING_UTF8 );
- aEntry.nNameLen = static_cast< sal_Int16 >(aFileName.getLength());
+ aEntry.nPathLen = static_cast< sal_Int16 >(aFileName.getLength());
}
- aEntry.nOffset = nGenPos + nPos + 30 + aEntry.nNameLen + aEntry.nExtraLen;
+ aEntry.nOffset = nGenPos + nPos + 30 + aEntry.nPathLen + aEntry.nExtraLen;
if ( ( aEntry.nSize || aEntry.nCompressedSize ) && !checkSizeAndCRC( aEntry ) )
{
@@ -869,8 +890,8 @@ sal_Int32 ZipFile::recover()
aEntry.nSize = 0;
}
- if ( aEntries.find( aEntry.sName ) == aEntries.end() )
- aEntries[aEntry.sName] = aEntry;
+ if ( aEntries.find( aEntry.sPath ) == aEntries.end() )
+ aEntries[aEntry.sPath] = aEntry;
}
}
}
diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index 65e8369e9095..1faa37176271 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -295,10 +295,10 @@ void ZipOutputStream::writeEND(sal_uInt32 nOffset, sal_uInt32 nLength)
void ZipOutputStream::writeCEN( const ZipEntry &rEntry )
throw(IOException, RuntimeException)
{
- if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sName, sal_True ) )
+ if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) )
throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), Reference< XInterface >() );
- ::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sName, RTL_TEXTENCODING_UTF8 );
+ ::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 );
sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() );
aChucker << CENSIG;
@@ -344,10 +344,10 @@ void ZipOutputStream::writeEXT( const ZipEntry &rEntry )
sal_Int32 ZipOutputStream::writeLOC( const ZipEntry &rEntry )
throw(IOException, RuntimeException)
{
- if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sName, sal_True ) )
+ if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) )
throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), Reference< XInterface >() );
- ::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sName, RTL_TEXTENCODING_UTF8 );
+ ::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 );
sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() );
aChucker << LOCSIG;
diff --git a/package/source/zipapi/makefile.mk b/package/source/zipapi/makefile.mk
index 5b58eae750b3..e0fb43f93180 100644
--- a/package/source/zipapi/makefile.mk
+++ b/package/source/zipapi/makefile.mk
@@ -40,6 +40,7 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
# --- Files --------------------------------------------------------
+.IF "$(L10N_framework)"==""
#CFLAGS+=/Ob0 /Od
.IF "$(SYSTEM_ZLIB)" == "YES"
CFLAGS+=-DSYSTEM_ZLIB
@@ -55,6 +56,8 @@ SLOFILES= \
$(SLO)$/ZipOutputStream.obj \
$(SLO)$/XUnbufferedStream.obj
+.ENDIF # L10N_framework
+
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index caf64748afaa..b95711778e77 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -83,6 +83,7 @@
#include <comphelper/seekableinput.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/ofopxmlhelper.hxx>
+#include <comphelper/documentconstants.hxx>
using namespace rtl;
using namespace std;
@@ -106,6 +107,8 @@ using namespace com::sun::star::packages::zip::ZipConstants;
#define LOGFILE_AUTHOR "mg115289"
+namespace {
+
sal_Bool isLocalFile_Impl( ::rtl::OUString aURL )
{
::rtl::OUString aSystemPath;
@@ -132,6 +135,27 @@ sal_Bool isLocalFile_Impl( ::rtl::OUString aURL )
return ( aSystemPath.getLength() != 0 );
}
+class PostinitializationGuard
+{
+ uno::Reference< io::XInputStream > m_xTempStream;
+
+ ZipPackage& m_rZipPackage;
+
+public:
+ PostinitializationGuard( const uno::Reference< io::XInputStream >& xTempStream,
+ ZipPackage& rZipPackage )
+ : m_xTempStream( xTempStream )
+ , m_rZipPackage( rZipPackage )
+ {}
+
+ virtual ~PostinitializationGuard()
+ {
+ m_rZipPackage.ConnectTo( m_xTempStream );
+ }
+};
+
+}
+
//===========================================================================
class ActiveDataStreamer : public ::cppu::WeakImplHelper1< XActiveDataStreamer >
@@ -174,39 +198,41 @@ class DummyInputStream : public ::cppu::WeakImplHelper1< XInputStream >
//===========================================================================
ZipPackage::ZipPackage (const uno::Reference < XMultiServiceFactory > &xNewFactory)
-: bHasEncryptedEntries ( sal_False )
-, bUseManifest ( sal_True )
-, bForceRecovery ( sal_False )
+: m_aMutexHolder( new SotMutexHolder )
+, m_bHasEncryptedEntries ( sal_False )
+, m_bHasNonEncryptedEntries ( sal_False )
+, m_bUseManifest ( sal_True )
+, m_bForceRecovery ( sal_False )
, m_bMediaTypeFallbackUsed ( sal_False )
, m_nFormat( PACKAGE_FORMAT ) // package is the default format
, m_bAllowRemoveOnInsert( sal_True )
-, eMode ( e_IMode_None )
-, xFactory( xNewFactory )
-, pRootFolder( NULL )
-, pZipFile( NULL )
+, m_eMode ( e_IMode_None )
+, m_xFactory( xNewFactory )
+, m_pRootFolder( NULL )
+, m_pZipFile( NULL )
{
- xRootFolder = pRootFolder = new ZipPackageFolder( xFactory, m_nFormat, m_bAllowRemoveOnInsert );
+ m_xRootFolder = m_pRootFolder = new ZipPackageFolder( m_xFactory, m_nFormat, m_bAllowRemoveOnInsert );
}
ZipPackage::~ZipPackage( void )
{
- delete pZipFile;
+ delete m_pZipFile;
// All folders and streams contain pointers to their parents, when a parent diappeares
// it should disconnect all the children from itself during destruction automatically.
- // So there is no need in explicit pRootFolder->releaseUpwardRef() call here any more
- // since pRootFolder has no parent and cleaning of it's children will be done automatically
- // during pRootFolder dieing by refcount.
+ // 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 hash_map of the root folder is cleared, releasing all subfolders
- // and substreams which in turn release theirs, etc. When xRootFolder is
+ // 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).
- pRootFolder->releaseUpwardRef();
+ m_pRootFolder->releaseUpwardRef();
#endif
}
@@ -216,13 +242,13 @@ void ZipPackage::parseManifest()
{
sal_Bool bManifestParsed = sal_False;
const OUString sMeta ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF" ) );
- if ( xRootFolder->hasByName( sMeta ) )
+ if ( m_xRootFolder->hasByName( sMeta ) )
{
const OUString sManifest (RTL_CONSTASCII_USTRINGPARAM( "manifest.xml") );
try {
uno::Reference< XUnoTunnel > xTunnel;
- Any aAny = xRootFolder->getByName( sMeta );
+ Any aAny = m_xRootFolder->getByName( sMeta );
aAny >>= xTunnel;
uno::Reference< XNameContainer > xMetaInfFolder( xTunnel, UNO_QUERY );
if ( xMetaInfFolder.is() && xMetaInfFolder->hasByName( sManifest ) )
@@ -233,7 +259,7 @@ void ZipPackage::parseManifest()
if (xSink.is())
{
OUString sManifestReader ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.manifest.ManifestReader" ) );
- uno::Reference < XManifestReader > xReader (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" ) );
@@ -275,6 +301,7 @@ void ZipPackage::parseManifest()
else if (pValue[j].Name.equals( sPropDigest ) )
pDigest = &(pValue[j].Value);
}
+
if (sPath.getLength() && hasByHierarchicalName ( sPath ) )
{
aAny = getByHierarchicalName( sPath );
@@ -291,6 +318,7 @@ void ZipPackage::parseManifest()
{
pStream = reinterpret_cast < ZipPackageStream* > ( xUnoTunnel->getSomething(ZipPackageStream::static_getImplementationId()));
pStream->SetMediaType ( sMediaType );
+ pStream->SetFromManifest( sal_True );
if (pSalt && pVector && pCount && pSize)
{
@@ -319,9 +347,12 @@ void ZipPackage::parseManifest()
pStream->SetToBeCompressed ( sal_True );
pStream->SetToBeEncrypted ( sal_True );
pStream->SetIsEncrypted ( sal_True );
- if ( !bHasEncryptedEntries && pStream->getName().compareToAscii ( "content.xml" ) == 0 )
- bHasEncryptedEntries = sal_True;
+ if ( !m_bHasEncryptedEntries
+ && pStream->getName().equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "content.xml" ) ) ) )
+ m_bHasEncryptedEntries = sal_True;
}
+ else
+ m_bHasNonEncryptedEntries = sal_True;
}
}
}
@@ -329,7 +360,7 @@ void ZipPackage::parseManifest()
bManifestParsed = sal_True;
}
else
- VOS_ENSURE ( 0, "Couldn't get a ManifestReader!" ); // throw RuntimeException?
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "No manifes parser!" ) ), uno::Reference< uno::XInterface >() );
}
// now hide the manifest.xml file from user
@@ -338,46 +369,76 @@ void ZipPackage::parseManifest()
}
catch( Exception& )
{
- if ( !bForceRecovery )
+ if ( !m_bForceRecovery )
throw;
}
}
+ if ( !bManifestParsed && !m_bForceRecovery )
+ throw ZipIOException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Could not parse manifest.xml\n" ) ),
+ uno::Reference< uno::XInterface >() );
+
const OUString sMimetype ( RTL_CONSTASCII_USTRINGPARAM ( "mimetype" ) );
- if ( xRootFolder->hasByName( sMimetype ) )
+ if ( m_xRootFolder->hasByName( sMimetype ) )
{
- if ( !bManifestParsed )
+ // get mediatype from the "mimetype" stream
+ ::rtl::OUString aPackageMediatype;
+ uno::Reference< lang::XUnoTunnel > xMimeTypeTunnel;
+ m_xRootFolder->getByName( sMimetype ) >>= xMimeTypeTunnel;
+ uno::Reference < io::XActiveDataSink > xMimeSink( xMimeTypeTunnel, UNO_QUERY );
+ if ( xMimeSink.is() )
{
- // try to get mediatype from the "mimetype" stream
- uno::Reference< lang::XUnoTunnel > xMimeTypeTunnel;
- xRootFolder->getByName( sMimetype ) >>= xMimeTypeTunnel;
- uno::Reference < io::XActiveDataSink > xMimeSink( xMimeTypeTunnel, UNO_QUERY );
- if ( xMimeSink.is() )
+ uno::Reference< io::XInputStream > xMimeInStream = xMimeSink->getInputStream();
+ if ( xMimeInStream.is() )
{
- uno::Reference< io::XInputStream > xMimeInStream = xMimeSink->getInputStream();
- if ( xMimeInStream.is() )
- {
- // Mediatypes longer than 1024 symbols should not appear here
- uno::Sequence< sal_Int8 > aData( 1024 );
- sal_Int32 nRead = xMimeInStream->readBytes( aData, 1024 );
- OSL_ENSURE( nRead == aData.getLength(), "Difference between reading result and data!\n" );
- if ( nRead > aData.getLength() )
- nRead = aData.getLength();
- if ( nRead )
- {
- ::rtl::OUString aFallBack( (sal_Char*)aData.getConstArray(), nRead, RTL_TEXTENCODING_ASCII_US );
- if ( aFallBack.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "application/vnd." ) ) == 0 )
- {
- // accept only types that look similar to own mediatypes
- pRootFolder->SetMediaType( aFallBack );
- m_bMediaTypeFallbackUsed = sal_True;
- }
- }
- }
+ // Mediatypes longer than 1024 symbols should not appear here
+ uno::Sequence< sal_Int8 > aData( 1024 );
+ sal_Int32 nRead = xMimeInStream->readBytes( aData, 1024 );
+ if ( nRead > aData.getLength() )
+ nRead = aData.getLength();
+
+ if ( nRead )
+ aPackageMediatype = ::rtl::OUString( (sal_Char*)aData.getConstArray(), nRead, RTL_TEXTENCODING_ASCII_US );
}
+ }
+
+ if ( !bManifestParsed )
+ {
+ // the manifest.xml could not be successfuly parsed, this is an inconsistent package
+ if ( aPackageMediatype.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "application/vnd." ) ) == 0 )
+ {
+ // accept only types that look similar to own mediatypes
+ m_pRootFolder->SetMediaType( aPackageMediatype );
+ m_bMediaTypeFallbackUsed = sal_True;
+ }
+ }
+ else if ( !m_bForceRecovery )
+ {
+ // the mimetype stream should contain the information from manifest.xml
+ if ( !m_pRootFolder->GetMediaType().equals( aPackageMediatype ) )
+ throw ZipIOException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "mimetype conflicts with manifest.xml\n" ) ),
+ uno::Reference< uno::XInterface >() );
}
- xRootFolder->removeByName( sMimetype );
+
+ m_xRootFolder->removeByName( sMimetype );
+ }
+
+ sal_Bool bODF12AndOlder = ( m_pRootFolder->GetVersion().compareTo( ODFVER_012_TEXT ) >= 0 );
+ if ( !m_bForceRecovery && bODF12AndOlder && m_pRootFolder->LookForUnexpectedODF12Streams( ::rtl::OUString() ) )
+ {
+ // this is an ODF1.2 document that contains streams not referred in the manifest.xml
+ throw ZipIOException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "there are streams not referred in manifest.xml\n" ) ),
+ uno::Reference< uno::XInterface >() );
+ }
+
+ if ( bODF12AndOlder )
+ {
+ // it is ODF1.2 or later, let the META-INF folder be unavailable for user
+ m_xRootFolder->removeByName( sMeta );
}
}
}
@@ -389,12 +450,12 @@ void ZipPackage::parseContentType()
const ::rtl::OUString aContentTypes( RTL_CONSTASCII_USTRINGPARAM ( "[Content_Types].xml" ) );
try {
// the content type must exist in OFOPXML format!
- if ( !xRootFolder->hasByName( aContentTypes ) )
+ if ( !m_xRootFolder->hasByName( aContentTypes ) )
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Wrong format!" ) ),
uno::Reference< uno::XInterface >() );
uno::Reference< lang::XUnoTunnel > xTunnel;
- uno::Any aAny = xRootFolder->getByName( aContentTypes );
+ uno::Any aAny = m_xRootFolder->getByName( aContentTypes );
aAny >>= xTunnel;
uno::Reference < io::XActiveDataSink > xSink( xTunnel, UNO_QUERY );
if ( xSink.is() )
@@ -405,14 +466,14 @@ void ZipPackage::parseContentType()
sal_Int32 nInd = 0;
// here aContentTypeInfo[0] - Defaults, and aContentTypeInfo[1] - Overrides
uno::Sequence< uno::Sequence< beans::StringPair > > aContentTypeInfo =
- ::comphelper::OFOPXMLHelper::ReadContentTypeSequence( xInStream, xFactory );
+ ::comphelper::OFOPXMLHelper::ReadContentTypeSequence( xInStream, m_xFactory );
if ( aContentTypeInfo.getLength() != 2 )
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
// set the implicit types fist
for ( nInd = 0; nInd < aContentTypeInfo[0].getLength(); nInd++ )
- pRootFolder->setChildStreamsTypeByExtension( aContentTypeInfo[0][nInd] );
+ m_pRootFolder->setChildStreamsTypeByExtension( aContentTypeInfo[0][nInd] );
// now set the explicit types
for ( nInd = 0; nInd < aContentTypeInfo[1].getLength(); nInd++ )
@@ -440,11 +501,11 @@ void ZipPackage::parseContentType()
}
}
- xRootFolder->removeByName( aContentTypes );
+ m_xRootFolder->removeByName( aContentTypes );
}
catch( uno::Exception& )
{
- if ( !bForceRecovery )
+ if ( !m_bForceRecovery )
throw;
}
}
@@ -452,7 +513,7 @@ void ZipPackage::parseContentType()
void ZipPackage::getZipFileContents()
{
- auto_ptr < ZipEnumeration > pEnum ( pZipFile->entries() );
+ auto_ptr < ZipEnumeration > pEnum ( m_pZipFile->entries() );
ZipPackageStream *pPkgStream;
ZipPackageFolder *pPkgFolder, *pCurrent;
OUString sTemp, sDirName;
@@ -462,20 +523,20 @@ void ZipPackage::getZipFileContents()
while (pEnum->hasMoreElements())
{
nIndex = nOldIndex = 0;
- pCurrent = pRootFolder;
+ pCurrent = m_pRootFolder;
const ZipEntry & rEntry = *pEnum->nextElement();
- const OUString & rName = rEntry.sName;
+ const OUString & rName = rEntry.sPath;
nStreamIndex = rName.lastIndexOf ( '/' );
if ( nStreamIndex != -1 )
{
sDirName = rName.copy ( 0, nStreamIndex);
- aIter = aRecent.find ( sDirName );
- if ( aIter != aRecent.end() )
+ aIter = m_aRecent.find ( sDirName );
+ if ( aIter != m_aRecent.end() )
pCurrent = (*aIter).second;
}
- if ( pCurrent == pRootFolder )
+ if ( pCurrent == m_pRootFolder )
{
while ( (nIndex = rName.indexOf('/', nOldIndex) ) != -1 )
{
@@ -484,7 +545,7 @@ void ZipPackage::getZipFileContents()
break;
if ( !pCurrent->hasByName( sTemp ) )
{
- pPkgFolder = new ZipPackageFolder( xFactory, m_nFormat, m_bAllowRemoveOnInsert );
+ pPkgFolder = new ZipPackageFolder( m_xFactory, m_nFormat, m_bAllowRemoveOnInsert );
pPkgFolder->setName( sTemp );
pPkgFolder->doSetParent( pCurrent, sal_True );
pCurrent = pPkgFolder;
@@ -494,13 +555,13 @@ void ZipPackage::getZipFileContents()
nOldIndex = nIndex+1;
}
if ( nStreamIndex != -1 && sDirName.getLength() )
- aRecent [ sDirName ] = pCurrent;
+ m_aRecent [ sDirName ] = pCurrent;
}
if ( rName.getLength() -1 != nStreamIndex )
{
nStreamIndex++;
sTemp = rName.copy( nStreamIndex, rName.getLength() - nStreamIndex);
- pPkgStream = new ZipPackageStream( *this, xFactory, m_bAllowRemoveOnInsert );
+ pPkgStream = new ZipPackageStream( *this, m_xFactory, m_bAllowRemoveOnInsert );
pPkgStream->SetPackageMember( sal_True );
pPkgStream->setZipEntryOnLoading( rEntry );
pPkgStream->setName( sTemp );
@@ -530,13 +591,13 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
OUString aParamUrl;
if ( (aArguments[ind] >>= aParamUrl))
{
- eMode = e_IMode_URL;
+ m_eMode = e_IMode_URL;
try
{
sal_Int32 nParam = aParamUrl.indexOf( '?' );
if ( nParam >= 0 )
{
- sURL = aParamUrl.copy( 0, nParam );
+ m_aURL = aParamUrl.copy( 0, nParam );
OUString aParam = aParamUrl.copy( nParam + 1 );
sal_Int32 nIndex = 0;
@@ -545,28 +606,28 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
::rtl::OUString aCommand = aParam.getToken( 0, '&', nIndex );
if ( aCommand.equals( OUString::createFromAscii( "repairpackage" ) ) )
{
- bForceRecovery = sal_True;
+ m_bForceRecovery = sal_True;
break;
}
else if ( aCommand.equals( OUString::createFromAscii( "purezip" ) ) )
{
m_nFormat = ZIP_FORMAT;
- pRootFolder->setPackageFormat_Impl( m_nFormat );
+ m_pRootFolder->setPackageFormat_Impl( m_nFormat );
break;
}
else if ( aCommand.equals( OUString::createFromAscii( "ofopxml" ) ) )
{
m_nFormat = OFOPXML_FORMAT;
- pRootFolder->setPackageFormat_Impl( m_nFormat );
+ m_pRootFolder->setPackageFormat_Impl( m_nFormat );
break;
}
}
while ( nIndex >= 0 );
}
else
- sURL = aParamUrl;
+ m_aURL = aParamUrl;
- Content aContent ( sURL, uno::Reference < XCommandEnvironment >() );
+ Content aContent ( m_aURL, uno::Reference < XCommandEnvironment >() );
Any aAny = aContent.getPropertyValue( OUString::createFromAscii( "Size" ) );
sal_uInt64 aSize = 0;
// kind of optimisation: treat empty files as nonexistent files
@@ -576,7 +637,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
{
uno::Reference < XActiveDataSink > xSink = new ZipPackageSink;
if (aContent.openStream ( xSink ) )
- xContentStream = xSink->getInputStream();
+ m_xContentStream = xSink->getInputStream();
}
else
bHaveZipFile = sal_False;
@@ -589,20 +650,20 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
bHaveZipFile = sal_False;
}
}
- else if ( (aArguments[ind] >>= xStream ) )
+ else if ( (aArguments[ind] >>= m_xStream ) )
{
// a writable stream can implement both XStream & XInputStream
- eMode = e_IMode_XStream;
- xContentStream = xStream->getInputStream();
+ m_eMode = e_IMode_XStream;
+ m_xContentStream = m_xStream->getInputStream();
}
- else if ( (aArguments[ind] >>= xContentStream) )
+ else if ( (aArguments[ind] >>= m_xContentStream) )
{
- eMode = e_IMode_XInputStream;
+ m_eMode = e_IMode_XInputStream;
}
else if ( ( aArguments[ind] >>= aNamedValue ) )
{
if ( aNamedValue.Name.equalsAscii( "RepairPackage" ) )
- aNamedValue.Value >>= bForceRecovery;
+ aNamedValue.Value >>= m_bForceRecovery;
else if ( aNamedValue.Name.equalsAscii( "PackageFormat" ) )
{
// setting this argument to true means Package format
@@ -613,27 +674,27 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
if ( !bPackFormat )
m_nFormat = ZIP_FORMAT;
- pRootFolder->setPackageFormat_Impl( m_nFormat );
+ m_pRootFolder->setPackageFormat_Impl( m_nFormat );
}
else if ( aNamedValue.Name.equalsAscii( "StorageFormat" ) )
{
::rtl::OUString aFormatName;
aNamedValue.Value >>= aFormatName;
- if ( aFormatName.equalsAscii( "PackageFormat" ) )
+ if ( aFormatName.equals( PACKAGE_STORAGE_FORMAT_STRING ) )
m_nFormat = PACKAGE_FORMAT;
- else if ( aFormatName.equalsAscii( "ZipFormat" ) )
+ else if ( aFormatName.equals( ZIP_STORAGE_FORMAT_STRING ) )
m_nFormat = ZIP_FORMAT;
- else if ( aFormatName.equalsAscii( "OFOPXMLFormat" ) )
+ else if ( aFormatName.equals( OFOPXML_STORAGE_FORMAT_STRING ) )
m_nFormat = OFOPXML_FORMAT;
else
throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 );
- pRootFolder->setPackageFormat_Impl( m_nFormat );
+ m_pRootFolder->setPackageFormat_Impl( m_nFormat );
}
else if ( aNamedValue.Name.equalsAscii( "AllowRemoveOnInsert" ) )
{
aNamedValue.Value >>= m_bAllowRemoveOnInsert;
- pRootFolder->setRemoveOnInsertMode_Impl( m_bAllowRemoveOnInsert );
+ m_pRootFolder->setRemoveOnInsertMode_Impl( m_bAllowRemoveOnInsert );
}
// for now the progress handler is not used, probably it will never be
@@ -649,16 +710,16 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
try
{
- if (xContentStream.is())
+ if (m_xContentStream.is())
{
// the stream must be seekable, if it is not it will be wrapped
- xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( xContentStream, xFactory );
- xContentSeek = uno::Reference < XSeekable > ( xContentStream, UNO_QUERY );
- if ( ! xContentSeek.is() )
+ m_xContentStream = ::comphelper::OSeekableInputWrapper::CheckSeekableCanWrap( m_xContentStream, m_xFactory );
+ m_xContentSeek = uno::Reference < XSeekable > ( m_xContentStream, UNO_QUERY );
+ if ( ! m_xContentSeek.is() )
throw com::sun::star::uno::Exception ( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "The package component _requires_ an XSeekable interface!" ) ),
static_cast < ::cppu::OWeakObject * > ( this ) );
- if ( !xContentSeek->getLength() )
+ if ( !m_xContentSeek->getLength() )
bHaveZipFile = sal_False;
}
else
@@ -675,7 +736,7 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
{
try
{
- pZipFile = new ZipFile ( xContentStream, xFactory, sal_True, bForceRecovery, xProgressHandler );
+ m_pZipFile = new ZipFile ( m_xContentStream, m_xFactory, sal_True, m_bForceRecovery, xProgressHandler );
getZipFileContents();
}
catch ( IOException & )
@@ -688,14 +749,14 @@ void SAL_CALL ZipPackage::initialize( const Sequence< Any >& aArguments )
}
catch ( Exception & )
{
- if( pZipFile ) { delete pZipFile; pZipFile = NULL; }
+ if( m_pZipFile ) { delete m_pZipFile; m_pZipFile = NULL; }
throw;
}
if ( bBadZipFile )
{
// clean up the memory, and tell the UCB about the error
- if( pZipFile ) { delete pZipFile; pZipFile = NULL; }
+ if( m_pZipFile ) { delete m_pZipFile; m_pZipFile = NULL; }
throw com::sun::star::packages::zip::ZipIOException (
OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Bad Zip File." ) ),
@@ -715,7 +776,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
FolderHash::iterator aIter;
if ( (nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' )
- return makeAny ( uno::Reference < XUnoTunnel > (pRootFolder) );
+ return makeAny ( uno::Reference < XUnoTunnel > (m_pRootFolder) );
else
{
nStreamIndex = aName.lastIndexOf ( '/' );
@@ -723,8 +784,8 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
if ( nStreamIndex != -1 )
{
sDirName = aName.copy ( 0, nStreamIndex);
- aIter = aRecent.find ( sDirName );
- if ( aIter != aRecent.end() )
+ aIter = m_aRecent.find ( sDirName );
+ if ( aIter != m_aRecent.end() )
{
if ( bFolder )
{
@@ -733,7 +794,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
if ( sTemp == (*aIter).second->getName() )
return makeAny ( uno::Reference < XUnoTunnel > ( (*aIter).second ) );
else
- aRecent.erase ( aIter );
+ m_aRecent.erase ( aIter );
}
else
{
@@ -741,17 +802,17 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
if ( (*aIter).second->hasByName( sTemp ) )
return (*aIter).second->getByName( sTemp );
else
- aRecent.erase( aIter );
+ m_aRecent.erase( aIter );
}
}
}
else
{
- if ( pRootFolder->hasByName ( aName ) )
- return pRootFolder->getByName ( aName );
+ if ( m_pRootFolder->hasByName ( aName ) )
+ return m_pRootFolder->getByName ( aName );
}
nOldIndex = 0;
- ZipPackageFolder * pCurrent = pRootFolder;
+ ZipPackageFolder * pCurrent = m_pRootFolder;
ZipPackageFolder * pPrevious = NULL;
while ( ( nIndex = aName.indexOf('/', nOldIndex)) != -1)
{
@@ -770,7 +831,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
if ( bFolder )
{
if (nStreamIndex != -1 )
- aRecent[sDirName] = pPrevious;
+ m_aRecent[sDirName] = pPrevious;
return makeAny ( uno::Reference < XUnoTunnel > ( pCurrent ) );
}
else
@@ -779,7 +840,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName )
if ( pCurrent->hasByName ( sTemp ) )
{
if (nStreamIndex != -1 )
- aRecent[sDirName] = pCurrent;
+ m_aRecent[sDirName] = pCurrent;
return pCurrent->getByName( sTemp );
}
else
@@ -804,8 +865,8 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
if ( nStreamIndex != -1 )
{
sDirName = aName.copy ( 0, nStreamIndex);
- aIter = aRecent.find ( sDirName );
- if ( aIter != aRecent.end() )
+ aIter = m_aRecent.find ( sDirName );
+ if ( aIter != m_aRecent.end() )
{
if ( bFolder )
{
@@ -814,7 +875,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
if ( sTemp == (*aIter).second->getName() )
return sal_True;
else
- aRecent.erase ( aIter );
+ m_aRecent.erase ( aIter );
}
else
{
@@ -822,16 +883,16 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
if ( (*aIter).second->hasByName( sTemp ) )
return sal_True;
else
- aRecent.erase( aIter );
+ m_aRecent.erase( aIter );
}
}
}
else
{
- if ( pRootFolder->hasByName ( aName ) )
+ if ( m_pRootFolder->hasByName ( aName ) )
return sal_True;
}
- ZipPackageFolder * pCurrent = pRootFolder;
+ ZipPackageFolder * pCurrent = m_pRootFolder;
ZipPackageFolder * pPrevious = NULL;
nOldIndex = 0;
while ( ( nIndex = aName.indexOf('/', nOldIndex)) != -1)
@@ -850,7 +911,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
}
if ( bFolder )
{
- aRecent[sDirName] = pPrevious;
+ m_aRecent[sDirName] = pPrevious;
return sal_True;
}
else
@@ -859,7 +920,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
if ( pCurrent->hasByName( sTemp ) )
{
- aRecent[sDirName] = pCurrent;
+ m_aRecent[sDirName] = pCurrent;
return sal_True;
}
}
@@ -871,7 +932,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName )
uno::Reference< XInterface > SAL_CALL ZipPackage::createInstance( )
throw(Exception, RuntimeException)
{
- uno::Reference < XInterface > xRef = *(new ZipPackageStream ( *this, 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 )
@@ -882,9 +943,9 @@ uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( c
if ( aArguments.getLength() )
aArguments[0] >>= bArg;
if (bArg)
- xRef = *new ZipPackageFolder ( xFactory, m_nFormat, m_bAllowRemoveOnInsert );
+ xRef = *new ZipPackageFolder ( m_xFactory, m_nFormat, m_bAllowRemoveOnInsert );
else
- xRef = *new ZipPackageStream ( *this, xFactory, m_bAllowRemoveOnInsert );
+ xRef = *new ZipPackageStream ( *this, m_xFactory, m_bAllowRemoveOnInsert );
return xRef;
}
@@ -892,17 +953,17 @@ uno::Reference< XInterface > SAL_CALL ZipPackage::createInstanceWithArguments( c
void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
{
const OUString sMime ( RTL_CONSTASCII_USTRINGPARAM ( "mimetype" ) );
- if (xRootFolder->hasByName( sMime ) )
- xRootFolder->removeByName( sMime );
+ if (m_xRootFolder->hasByName( sMime ) )
+ m_xRootFolder->removeByName( sMime );
ZipEntry * pEntry = new ZipEntry;
- sal_Int32 nBufferLength = pRootFolder->GetMediaType( ).getLength();
- OString sMediaType = OUStringToOString( pRootFolder->GetMediaType(), RTL_TEXTENCODING_ASCII_US );
+ 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(),
nBufferLength );
- pEntry->sName = sMime;
+ pEntry->sPath = sMime;
pEntry->nMethod = STORED;
pEntry->nSize = pEntry->nCompressedSize = nBufferLength;
pEntry->nTime = ZipOutputStream::getCurrentDosTime();
@@ -928,21 +989,138 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
}
}
-sal_Bool ZipPackage::writeFileIsTemp()
+void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< Sequence < PropertyValue > >& aManList )
+{
+ // Write the manifest
+ uno::Reference < XOutputStream > xManOutStream;
+ OUString sManifestWriter( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.manifest.ManifestWriter" ) );
+ uno::Reference < XManifestWriter > xWriter ( m_xFactory->createInstance( sManifestWriter ), UNO_QUERY );
+ if ( xWriter.is() )
+ {
+ ZipEntry * pEntry = new ZipEntry;
+ ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
+ xManOutStream = uno::Reference < XOutputStream > (*pBuffer, UNO_QUERY);
+
+ 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();
+ aIter != aEnd;
+ aIter++, pSequence++)
+ *pSequence= (*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
+ vos::ORef < EncryptionData > xEmpty;
+ aZipOut.putNextEntry( *pEntry, xEmpty );
+ aZipOut.write( pBuffer->getSequence(), 0, nBufferLength );
+ aZipOut.closeEntry();
+ }
+ else
+ {
+ VOS_ENSURE ( 0, "Couldn't get a ManifestWriter!" );
+ IOException aException;
+ throw WrappedTargetException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Couldn't get a ManifestWriter!" ) ),
+ static_cast < OWeakObject * > ( this ),
+ makeAny( aException ) );
+ }
+}
+
+void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< Sequence < PropertyValue > >& aManList )
+{
+ const OUString sFullPath ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
+ const OUString sMediaType ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
+
+ ZipEntry* pEntry = new ZipEntry;
+ 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->nMethod = DEFLATED;
+ pEntry->nCrc = pEntry->nSize = pEntry->nCompressedSize = -1;
+ pEntry->nTime = ZipOutputStream::getCurrentDosTime();
+
+ // Convert vector into a Sequence
+ // TODO/LATER: use Defaulst entries in future
+ uno::Sequence< beans::StringPair > aDefaultsSequence;
+ uno::Sequence< beans::StringPair > aOverridesSequence( aManList.size() );
+ sal_Int32 nSeqLength = 0;
+ for ( vector< uno::Sequence< beans::PropertyValue > >::const_iterator aIter = aManList.begin(),
+ aEnd = aManList.end();
+ aIter != aEnd;
+ aIter++)
+ {
+ ::rtl::OUString aPath;
+ ::rtl::OUString aType;
+ 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;
+ if ( aType.getLength() )
+ {
+ // only nonempty type makes sence here
+ nSeqLength++;
+ (*aIter)[PKG_MNFST_FULLPATH].Value >>= aPath;
+ aOverridesSequence[nSeqLength-1].First = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) + aPath;
+ aOverridesSequence[nSeqLength-1].Second = aType;
+ }
+ }
+ aOverridesSequence.realloc( nSeqLength );
+
+ ::comphelper::OFOPXMLHelper::WriteContentSequence(
+ xConTypeOutStream, aDefaultsSequence, aOverridesSequence, m_xFactory );
+
+ sal_Int32 nBufferLength = static_cast < sal_Int32 > ( pBuffer->getPosition() );
+ pBuffer->realloc( nBufferLength );
+
+ // there is no encryption in this format currently
+ vos::ORef < EncryptionData > xEmpty;
+ aZipOut.putNextEntry( *pEntry, xEmpty );
+ 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 );
+ m_xContentStream = xInStream;
+
+ // seek back to the beginning of the temp file so we can read segments from it
+ m_xContentSeek->seek( 0 );
+ if ( m_pZipFile )
+ m_pZipFile->setInputStream( m_xContentStream );
+ else
+ 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
- // write directly to it otherwize create a temporary file to write to
+ // write directly to it otherwize create a temporary file to write to.
+ // If a temporary file is created it is returned back by the method.
+ // If the data written directly, xComponentStream will be switched here
sal_Bool bUseTemp = sal_True;
- uno::Reference < XOutputStream > xTempOut;
- uno::Reference< XActiveDataStreamer > xSink;
+ uno::Reference < io::XInputStream > xResult;
+ uno::Reference < io::XInputStream > xTempIn;
+
+ uno::Reference < io::XOutputStream > xTempOut;
+ uno::Reference< io::XActiveDataStreamer > xSink;
- if ( eMode == e_IMode_URL && !pZipFile && isLocalFile_Impl( sURL ) )
+ if ( m_eMode == e_IMode_URL && !m_pZipFile && isLocalFile_Impl( m_aURL ) )
{
xSink = openOriginalForOutput();
if( xSink.is() )
{
- uno::Reference< XStream > xStr = xSink->getStream();
+ uno::Reference< io::XStream > xStr = xSink->getStream();
if( xStr.is() )
{
xTempOut = xStr->getOutputStream();
@@ -951,10 +1129,10 @@ sal_Bool ZipPackage::writeFileIsTemp()
}
}
}
- else if ( eMode == e_IMode_XStream && !pZipFile )
+ else if ( m_eMode == e_IMode_XStream && !m_pZipFile )
{
// write directly to an empty stream
- xTempOut = xStream->getOutputStream();
+ xTempOut = m_xStream->getOutputStream();
if( xTempOut.is() )
bUseTemp = sal_False;
}
@@ -963,7 +1141,9 @@ sal_Bool ZipPackage::writeFileIsTemp()
{
// create temporary file
const OUString sServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
- xTempOut = uno::Reference < XOutputStream > ( xFactory->createInstance ( sServiceName ), UNO_QUERY );
+ uno::Reference < io::XStream > xTempFile( m_xFactory->createInstance ( sServiceName ), UNO_QUERY_THROW );
+ xTempOut.set( xTempFile->getOutputStream(), UNO_SET_THROW );
+ xTempIn.set( xTempFile->getInputStream(), UNO_SET_THROW );
}
// Hand it to the ZipOutputStream:
@@ -980,12 +1160,12 @@ sal_Bool ZipPackage::writeFileIsTemp()
// META-INF directory implicitly created if does not exist
const OUString sMeta ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF" ) );
- if ( xRootFolder->hasByName( sMeta ) )
+ if ( m_xRootFolder->hasByName( sMeta ) )
{
const OUString sManifest (RTL_CONSTASCII_USTRINGPARAM( "manifest.xml") );
uno::Reference< XUnoTunnel > xTunnel;
- Any aAny = xRootFolder->getByName( sMeta );
+ Any aAny = m_xRootFolder->getByName( sMeta );
aAny >>= xTunnel;
uno::Reference< XNameContainer > xMetaInfFolder( xTunnel, UNO_QUERY );
if ( xMetaInfFolder.is() && xMetaInfFolder->hasByName( sManifest ) )
@@ -995,23 +1175,20 @@ sal_Bool ZipPackage::writeFileIsTemp()
// Write a magic file with mimetype
WriteMimetypeMagicFile( aZipOut );
}
- if ( m_nFormat == OFOPXML_FORMAT )
+ else if ( m_nFormat == OFOPXML_FORMAT )
{
// Remove the old [Content_Types].xml file as the
// file will be re-generated
const ::rtl::OUString aContentTypes( RTL_CONSTASCII_USTRINGPARAM ( "[Content_Types].xml" ) );
- if ( xRootFolder->hasByName( aContentTypes ) )
- xRootFolder->removeByName( aContentTypes );
+ if ( m_xRootFolder->hasByName( aContentTypes ) )
+ m_xRootFolder->removeByName( aContentTypes );
}
// Create a vector to store data for the manifest.xml file
vector < Sequence < PropertyValue > > aManList;
- // Make a reference to the manifest output stream so it persists
- // until the call to ZipOutputStream->finish()
- uno::Reference < XOutputStream > xManOutStream;
const OUString sMediaType ( RTL_CONSTASCII_USTRINGPARAM ( "MediaType" ) );
const OUString sVersion ( RTL_CONSTASCII_USTRINGPARAM ( "Version" ) );
const OUString sFullPath ( RTL_CONSTASCII_USTRINGPARAM ( "FullPath" ) );
@@ -1020,9 +1197,9 @@ sal_Bool ZipPackage::writeFileIsTemp()
{
Sequence < PropertyValue > aPropSeq ( PKG_SIZE_NOENCR_MNFST );
aPropSeq [PKG_MNFST_MEDIATYPE].Name = sMediaType;
- aPropSeq [PKG_MNFST_MEDIATYPE].Value <<= pRootFolder->GetMediaType( );
+ aPropSeq [PKG_MNFST_MEDIATYPE].Value <<= m_pRootFolder->GetMediaType( );
aPropSeq [PKG_MNFST_VERSION].Name = sVersion;
- aPropSeq [PKG_MNFST_VERSION].Value <<= 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 ( "/" ) );
@@ -1040,114 +1217,27 @@ sal_Bool ZipPackage::writeFileIsTemp()
// call saveContents (it will recursively save sub-directories
OUString aEmptyString;
- pRootFolder->saveContents( aEmptyString, aManList, aZipOut, aEncryptionKey, aRandomPool );
+ m_pRootFolder->saveContents( aEmptyString, aManList, aZipOut, m_aEncryptionKey, aRandomPool );
// Clean up random pool memory
rtl_random_destroyPool ( aRandomPool );
- if( bUseManifest && m_nFormat == PACKAGE_FORMAT )
+ if( m_bUseManifest && m_nFormat == PACKAGE_FORMAT )
{
- // Write the manifest
- OUString sManifestWriter( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.packages.manifest.ManifestWriter" ) );
- uno::Reference < XManifestWriter > xWriter ( xFactory->createInstance( sManifestWriter ), UNO_QUERY );
- if ( xWriter.is() )
- {
- ZipEntry * pEntry = new ZipEntry;
- ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
- xManOutStream = uno::Reference < XOutputStream > (*pBuffer, UNO_QUERY);
-
- pEntry->sName = 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();
- aIter != aEnd;
- aIter++, pSequence++)
- *pSequence= (*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
- vos::ORef < EncryptionData > xEmpty;
- aZipOut.putNextEntry( *pEntry, xEmpty );
- aZipOut.write( pBuffer->getSequence(), 0, nBufferLength );
- aZipOut.closeEntry();
- }
- else
- {
- VOS_ENSURE ( 0, "Couldn't get a ManifestWriter!" );
- IOException aException;
- throw WrappedTargetException(
- OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "Couldn't get a ManifestWriter!" ) ),
- static_cast < OWeakObject * > ( this ),
- makeAny( aException ) );
- }
+ WriteManifest( aZipOut, aManList );
}
else if( m_nFormat == OFOPXML_FORMAT )
{
- ZipEntry* pEntry = new ZipEntry;
- ZipPackageBuffer *pBuffer = new ZipPackageBuffer( n_ConstBufferSize );
- uno::Reference< io::XOutputStream > xConTypeOutStream( *pBuffer, UNO_QUERY );
-
- pEntry->sName = ::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
- // TODO/LATER: use Defaulst entries in future
- uno::Sequence< beans::StringPair > aDefaultsSequence;
- uno::Sequence< beans::StringPair > aOverridesSequence( aManList.size() );
- sal_Int32 nSeqLength = 0;
- for ( vector< uno::Sequence< beans::PropertyValue > >::const_iterator aIter = aManList.begin(),
- aEnd = aManList.end();
- aIter != aEnd;
- aIter++)
- {
- ::rtl::OUString aPath;
- ::rtl::OUString aType;
- 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;
- if ( aType.getLength() )
- {
- // only nonempty type makes sence here
- nSeqLength++;
- (*aIter)[PKG_MNFST_FULLPATH].Value >>= aPath;
- aOverridesSequence[nSeqLength-1].First = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) ) + aPath;
- aOverridesSequence[nSeqLength-1].Second = aType;
- }
- }
- aOverridesSequence.realloc( nSeqLength );
-
- ::comphelper::OFOPXMLHelper::WriteContentSequence(
- xConTypeOutStream, aDefaultsSequence, aOverridesSequence, xFactory );
-
- sal_Int32 nBufferLength = static_cast < sal_Int32 > ( pBuffer->getPosition() );
- pBuffer->realloc( nBufferLength );
-
- // there is no encryption in this format currently
- vos::ORef < EncryptionData > xEmpty;
- aZipOut.putNextEntry( *pEntry, xEmpty );
- aZipOut.write( pBuffer->getSequence(), 0, nBufferLength );
- aZipOut.closeEntry();
+ WriteContentTypes( aZipOut, aManList );
}
aZipOut.finish();
- // Update our References to point to the new temp file
if( bUseTemp )
- {
- xContentStream = uno::Reference < XInputStream > ( xTempOut, UNO_QUERY_THROW );
- xContentSeek = uno::Reference < XSeekable > ( xTempOut, UNO_QUERY_THROW );
- }
- else
+ xResult = xTempIn;
+
+ // Update our References to point to the new temp file
+ if( !bUseTemp )
{
// the case when the original contents were written directly
xTempOut->flush();
@@ -1158,14 +1248,15 @@ sal_Bool ZipPackage::writeFileIsTemp()
if ( asyncOutputMonitor.is() )
asyncOutputMonitor->waitForCompletion();
- if ( eMode == e_IMode_URL )
- xContentStream = xSink->getStream()->getInputStream();
- else if ( eMode == e_IMode_XStream )
- xContentStream = xStream->getInputStream();
-
- xContentSeek = uno::Reference < XSeekable > ( xContentStream, UNO_QUERY_THROW );
+ // no need to postpone switching to the new stream since the target was written directly
+ uno::Reference< io::XInputStream > xNewStream;
+ if ( m_eMode == e_IMode_URL )
+ xNewStream = xSink->getStream()->getInputStream();
+ else if ( m_eMode == e_IMode_XStream && m_xStream.is() )
+ xNewStream = m_xStream->getInputStream();
- OSL_ENSURE( xContentStream.is() && xContentSeek.is(), "XSeekable interface is required!" );
+ if ( xNewStream.is() )
+ ConnectTo( xNewStream );
}
}
catch ( uno::Exception& )
@@ -1197,23 +1288,16 @@ sal_Bool ZipPackage::writeFileIsTemp()
}
}
- // seek back to the beginning of the temp file so we can read segments from it
- xContentSeek->seek ( 0 );
- if ( pZipFile )
- pZipFile->setInputStream ( xContentStream );
- else
- pZipFile = new ZipFile ( xContentStream, xFactory, sal_False );
-
- return bUseTemp;
+ return xResult;
}
uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
{
// open and truncate the original file
- Content aOriginalContent (sURL, uno::Reference < XCommandEnvironment >() );
+ Content aOriginalContent (m_aURL, uno::Reference < XCommandEnvironment >() );
uno::Reference< XActiveDataStreamer > xSink = new ActiveDataStreamer;
- if ( eMode == e_IMode_URL )
+ if ( m_eMode == e_IMode_URL )
{
try
{
@@ -1259,10 +1343,13 @@ uno::Reference< XActiveDataStreamer > ZipPackage::openOriginalForOutput()
}
// XChangesBatch
-void SAL_CALL ZipPackage::commitChanges( )
+void SAL_CALL ZipPackage::commitChanges()
throw(WrappedTargetException, RuntimeException)
{
- if ( eMode == e_IMode_XInputStream )
+ // lock the component for the time of commiting
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
+
+ if ( m_eMode == e_IMode_XInputStream )
{
IOException aException;
throw WrappedTargetException( OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "This package is read only!" ) ),
@@ -1270,13 +1357,19 @@ void SAL_CALL ZipPackage::commitChanges( )
}
RTL_LOGFILE_TRACE_AUTHOR ( "package", LOGFILE_AUTHOR, "{ ZipPackage::commitChanges" );
- // First we write the entire package to a temporary file. After writeTempFile,
- // xContentSeek and xContentStream will reference the new temporary file.
- // Exception - empty or nonexistent local file that is written directly
- if ( writeFileIsTemp() )
+ // first the writeTempFile is called, if it returns a stream the stream should be written to the target
+ // if no stream was returned, the file was written directly, nothing should be done
+
+ uno::Reference< io::XInputStream > xTempInStream = writeTempFile();
+ if ( xTempInStream.is() )
{
- if ( eMode == e_IMode_XStream )
+ uno::Reference< io::XSeekable > xTempSeek( xTempInStream, uno::UNO_QUERY_THROW );
+
+ // switch to the new temporary stream only after the transfer
+ PostinitializationGuard aPostInitGuard( xTempInStream, *this );
+
+ if ( m_eMode == e_IMode_XStream )
{
// First truncate our output stream
uno::Reference < XOutputStream > xOutputStream;
@@ -1284,9 +1377,9 @@ void SAL_CALL ZipPackage::commitChanges( )
// preparation for copy step
try
{
- xContentSeek->seek( 0 );
+ xTempSeek->seek( 0 );
- xOutputStream = xStream->getOutputStream();
+ xOutputStream = m_xStream->getOutputStream();
uno::Reference < XTruncate > xTruncate ( xOutputStream, UNO_QUERY );
if ( !xTruncate.is() )
throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -1303,7 +1396,7 @@ void SAL_CALL ZipPackage::commitChanges( )
try
{
// then copy the contents of the tempfile to our output stream
- ::comphelper::OStorageHelper::CopyInputToOutput( xContentStream, xOutputStream );
+ ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutputStream );
xOutputStream->flush();
uno::Reference< io::XAsyncOutputMonitor > asyncOutputMonitor(
xOutputStream, uno::UNO_QUERY);
@@ -1316,19 +1409,19 @@ void SAL_CALL ZipPackage::commitChanges( )
// if anything goes wrong in this block the target file becomes corrupted
// so an exception should be thrown as a notification about it
// and the package must disconnect from the stream
- DisconnectFromTargetAndThrowException_Impl( xContentStream );
+ DisconnectFromTargetAndThrowException_Impl( xTempInStream );
}
}
- else if ( eMode == e_IMode_URL )
+ else if ( m_eMode == e_IMode_URL )
{
uno::Reference< XOutputStream > aOrigFileStream;
sal_Bool bCanBeCorrupted = sal_False;
- if( isLocalFile_Impl( sURL ) )
+ if( isLocalFile_Impl( m_aURL ) )
{
// write directly in case of local file
uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleAccess(
- xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ),
+ m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ),
uno::UNO_QUERY );
OSL_ENSURE( xSimpleAccess.is(), "Can't instatiate SimpleFileAccess service!\n" );
uno::Reference< io::XTruncate > xOrigTruncate;
@@ -1336,7 +1429,7 @@ void SAL_CALL ZipPackage::commitChanges( )
{
try
{
- aOrigFileStream = xSimpleAccess->openFileWrite( sURL );
+ aOrigFileStream = xSimpleAccess->openFileWrite( m_aURL );
xOrigTruncate = uno::Reference< io::XTruncate >( aOrigFileStream, uno::UNO_QUERY_THROW );
// after successful truncation the file is already corrupted
xOrigTruncate->truncate();
@@ -1349,7 +1442,7 @@ void SAL_CALL ZipPackage::commitChanges( )
{
try
{
- ::comphelper::OStorageHelper::CopyInputToOutput( xContentStream, aOrigFileStream );
+ ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, aOrigFileStream );
aOrigFileStream->closeOutput();
}
catch( uno::Exception& )
@@ -1369,12 +1462,12 @@ void SAL_CALL ZipPackage::commitChanges( )
{
try
{
- uno::Reference < XPropertySet > xPropSet ( xContentStream, UNO_QUERY );
+ uno::Reference < XPropertySet > xPropSet ( xTempInStream, UNO_QUERY );
OSL_ENSURE( xPropSet.is(), "This is a temporary file that must implement XPropertySet!\n" );
if ( !xPropSet.is() )
throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- OUString sTargetFolder = sURL.copy ( 0, sURL.lastIndexOf ( static_cast < sal_Unicode > ( '/' ) ) );
+ OUString sTargetFolder = m_aURL.copy ( 0, m_aURL.lastIndexOf ( static_cast < sal_Unicode > ( '/' ) ) );
Content aContent ( sTargetFolder, uno::Reference < XCommandEnvironment > () );
OUString sTempURL;
@@ -1385,7 +1478,7 @@ void SAL_CALL ZipPackage::commitChanges( )
aInfo.NameClash = NameClash::OVERWRITE;
aInfo.MoveData = sal_False;
aInfo.SourceURL = sTempURL;
- aInfo.NewTitle = rtl::Uri::decode ( sURL.copy ( 1 + sURL.lastIndexOf ( static_cast < sal_Unicode > ( '/' ) ) ),
+ aInfo.NewTitle = rtl::Uri::decode ( m_aURL.copy ( 1 + m_aURL.lastIndexOf ( static_cast < sal_Unicode > ( '/' ) ) ),
rtl_UriDecodeWithCharset,
RTL_TEXTENCODING_UTF8 );
aAny <<= aInfo;
@@ -1396,7 +1489,7 @@ void SAL_CALL ZipPackage::commitChanges( )
catch (::com::sun::star::uno::Exception& r)
{
if ( bCanBeCorrupted )
- DisconnectFromTargetAndThrowException_Impl( xContentStream );
+ DisconnectFromTargetAndThrowException_Impl( xTempInStream );
throw WrappedTargetException(
OUString( RTL_CONSTASCII_USTRINGPARAM ( OSL_LOG_PREFIX "This package may be read only!" ) ),
@@ -1415,15 +1508,15 @@ void SAL_CALL ZipPackage::commitChanges( )
void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Reference< io::XInputStream >& xTempStream )
{
- xStream = uno::Reference< io::XStream >( xTempStream, uno::UNO_QUERY );
- if ( xStream.is() )
- eMode = e_IMode_XStream;
+ m_xStream = uno::Reference< io::XStream >( xTempStream, uno::UNO_QUERY );
+ if ( m_xStream.is() )
+ m_eMode = e_IMode_XStream;
else
- eMode = e_IMode_XInputStream;
+ m_eMode = e_IMode_XInputStream;
::rtl::OUString aTempURL;
try {
- uno::Reference< beans::XPropertySet > xTempFile( xContentStream, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xTempFile( xTempStream, uno::UNO_QUERY_THROW );
uno::Any aUrl = xTempFile->getPropertyValue( ::rtl::OUString::createFromAscii( "Uri" ) );
aUrl >>= aTempURL;
xTempFile->setPropertyValue( ::rtl::OUString::createFromAscii( "RemoveFile" ),
@@ -1539,16 +1632,17 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const
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("MediaTypeFallbackUsed") ) )
throw PropertyVetoException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("EncryptionKey") ) )
{
- if (!( aValue >>= aEncryptionKey ) )
+ if (!( aValue >>= m_aEncryptionKey ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 );
}
else if (aPropertyName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("UseManifest") ) )
{
- if (!( aValue >>= bUseManifest ) )
+ if (!( aValue >>= m_bUseManifest ) )
throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 2 );
}
else
@@ -1564,17 +1658,22 @@ Any SAL_CALL ZipPackage::getPropertyValue( const OUString& PropertyName )
Any aAny;
if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "EncryptionKey" ) ) )
{
- aAny <<= aEncryptionKey;
+ aAny <<= m_aEncryptionKey;
return aAny;
}
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "HasEncryptedEntries" ) ) )
{
- aAny <<= bHasEncryptedEntries;
+ aAny <<= m_bHasEncryptedEntries;
+ return aAny;
+ }
+ else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "HasNonEncryptedEntries" ) ) )
+ {
+ aAny <<= m_bHasNonEncryptedEntries;
return aAny;
}
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "UseManifest" ) ) )
{
- aAny <<= bUseManifest;
+ aAny <<= m_bUseManifest;
return aAny;
}
else if (PropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "MediaTypeFallbackUsed" ) ) )
diff --git a/package/source/zippackage/ZipPackageEntry.cxx b/package/source/zippackage/ZipPackageEntry.cxx
index 78fbb7423aa7..b233e34c2a28 100644
--- a/package/source/zippackage/ZipPackageEntry.cxx
+++ b/package/source/zippackage/ZipPackageEntry.cxx
@@ -65,20 +65,20 @@ ZipPackageEntry::~ZipPackageEntry()
OUString SAL_CALL ZipPackageEntry::getName( )
throw(RuntimeException)
{
- return aEntry.sName;
+ return msName;
}
void SAL_CALL ZipPackageEntry::setName( const OUString& aName )
throw(RuntimeException)
{
- if ( pParent && pParent->hasByName ( aEntry.sName ) )
- pParent->removeByName ( aEntry.sName );
+ if ( pParent && msName.getLength() && pParent->hasByName ( msName ) )
+ pParent->removeByName ( msName );
// 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 >() );
- aEntry.sName = aName;
+ msName = aName;
if ( pParent )
pParent->doInsertByName ( this, sal_False );
@@ -94,7 +94,7 @@ void ZipPackageEntry::doSetParent ( ZipPackageFolder * pNewParent, sal_Bool bIns
{
// xParent = pParent = pNewParent;
pParent = pNewParent;
- if ( bInsert && !pNewParent->hasByName ( aEntry.sName ) )
+ if ( bInsert && msName.getLength() && !pNewParent->hasByName ( msName ) )
pNewParent->doInsertByName ( this, sal_False );
}
@@ -110,8 +110,8 @@ void SAL_CALL ZipPackageEntry::setParent( const Reference< XInterface >& xNewPar
if ( pNewParent != pParent )
{
- if ( pParent && pParent->hasByName ( aEntry.sName ) && mbAllowRemoveOnInsert )
- pParent->removeByName( aEntry.sName );
+ if ( pParent && msName.getLength() && pParent->hasByName ( msName ) && mbAllowRemoveOnInsert )
+ pParent->removeByName( msName );
doSetParent ( pNewParent, sal_True );
}
}
diff --git a/package/source/zippackage/ZipPackageEntry.hxx b/package/source/zippackage/ZipPackageEntry.hxx
index 89fe4c6f225b..01b47d71f728 100644
--- a/package/source/zippackage/ZipPackageEntry.hxx
+++ b/package/source/zippackage/ZipPackageEntry.hxx
@@ -53,6 +53,7 @@ class ZipPackageEntry : public cppu::WeakImplHelper5
>
{
protected:
+ ::rtl::OUString msName;
bool mbIsFolder:1;
bool mbAllowRemoveOnInsert:1;
// com::sun::star::uno::Reference < com::sun::star::container::XNameContainer > xParent;
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index 2787ad938df9..5215c07579d2 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -93,6 +93,60 @@ ZipPackageFolder::~ZipPackageFolder()
{
}
+sal_Bool ZipPackageFolder::LookForUnexpectedODF12Streams( const ::rtl::OUString& aPath )
+{
+ sal_Bool bHasUnexpected = sal_False;
+
+ for ( ContentHash::const_iterator aCI = maContents.begin(), aEnd = maContents.end();
+ !bHasUnexpected && aCI != aEnd;
+ aCI++)
+ {
+ const OUString &rShortName = (*aCI).first;
+ const ContentInfo &rInfo = *(*aCI).second;
+
+ if ( rInfo.bFolder )
+ {
+ if ( aPath.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF/" ) ) ) )
+ {
+ // META-INF is not allowed to contain subfolders
+ bHasUnexpected = sal_True;
+ }
+ else
+ {
+ OUString sOwnPath = aPath + rShortName + OUString( RTL_CONSTASCII_USTRINGPARAM ( "/" ) );
+ bHasUnexpected = rInfo.pFolder->LookForUnexpectedODF12Streams( sOwnPath );
+ }
+ }
+ else
+ {
+ if ( aPath.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF/" ) ) ) )
+ {
+ if ( !rShortName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "manifest.xml" ) ) )
+ && rShortName.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "signatures" ) ) ) == -1 )
+ {
+ // a stream from META-INF with unexpected name
+ bHasUnexpected = sal_True;
+ }
+
+ // streams from META-INF with expected names are allowed not to be registered in manifest.xml
+ }
+ else if ( !rInfo.pStream->IsFromManifest() )
+ {
+ // the stream is not in META-INF and ist notregistered in manifest.xml,
+ // check whether it is an internal part of the package format
+ if ( aPath.getLength()
+ || !rShortName.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "mimetype" ) ) ) )
+ {
+ // if it is not "mimetype" from the root it is not a part of the package
+ bHasUnexpected = sal_True;
+ }
+ }
+ }
+ }
+
+ return bHasUnexpected;
+}
+
void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair& aPair )
{
::rtl::OUString aExt;
@@ -112,9 +166,9 @@ void ZipPackageFolder::setChildStreamsTypeByExtension( const beans::StringPair&
rInfo.pFolder->setChildStreamsTypeByExtension( aPair );
else
{
- sal_Int32 nNameLength = rShortName.getLength();
+ sal_Int32 nPathLength = rShortName.getLength();
sal_Int32 nExtLength = aExt.getLength();
- if ( nNameLength >= nExtLength && rShortName.match( aExt, nNameLength - nExtLength ) )
+ if ( nPathLength >= nExtLength && rShortName.match( aExt, nPathLength - nExtLength ) )
rInfo.pStream->SetMediaType( aPair.Second );
}
}
@@ -130,8 +184,8 @@ void ZipPackageFolder::copyZipEntry( ZipEntry &rDest, const ZipEntry &rSource)
rDest.nCompressedSize = rSource.nCompressedSize;
rDest.nSize = rSource.nSize;
rDest.nOffset = rSource.nOffset;
- rDest.sName = rSource.sName;
- rDest.nNameLen = rSource.nNameLen;
+ rDest.sPath = rSource.sPath;
+ rDest.nPathLen = rSource.nPathLen;
rDest.nExtraLen = rSource.nExtraLen;
}
@@ -271,9 +325,9 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
// it is an empty subfolder, use workaround to store it
ZipEntry* pTempEntry = new ZipEntry();
ZipPackageFolder::copyZipEntry ( *pTempEntry, aEntry );
- pTempEntry->nNameLen = (sal_Int16)( ::rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getLength() );
+ pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( rPath, RTL_TEXTENCODING_UTF8 ).getLength() );
pTempEntry->nExtraLen = -1;
- pTempEntry->sName = rPath;
+ pTempEntry->sPath = rPath;
try
{
@@ -332,8 +386,8 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
// store the ZipEntry data in pTempEntry
ZipPackageFolder::copyZipEntry ( *pTempEntry, pStream->aEntry );
- pTempEntry->sName = rPath + rShortName;
- pTempEntry->nNameLen = (sal_Int16)( ::rtl::OUStringToOString( pTempEntry->sName, RTL_TEXTENCODING_UTF8 ).getLength() );
+ pTempEntry->sPath = rPath + rShortName;
+ pTempEntry->nPathLen = (sal_Int16)( ::rtl::OUStringToOString( pTempEntry->sPath, RTL_TEXTENCODING_UTF8 ).getLength() );
sal_Bool bToBeEncrypted = pStream->IsToBeEncrypted() && (bHaveEncryptionKey || pStream->HasOwnKey());
sal_Bool bToBeCompressed = bToBeEncrypted ? sal_True : pStream->IsToBeCompressed();
@@ -343,7 +397,7 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
pValue[PKG_MNFST_VERSION].Name = sVersionProperty;
pValue[PKG_MNFST_VERSION].Value <<= ::rtl::OUString(); // no version is stored for streams currently
pValue[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
- pValue[PKG_MNFST_FULLPATH].Value <<= pTempEntry->sName;
+ pValue[PKG_MNFST_FULLPATH].Value <<= pTempEntry->sPath;
OSL_ENSURE( pStream->GetStreamMode() != PACKAGE_STREAM_NOTSET, "Unacceptable ZipPackageStream mode!" );
@@ -633,7 +687,6 @@ void ZipPackageFolder::saveContents(OUString &rPath, std::vector < Sequence < Pr
if ( pStream->IsEncrypted() )
pStream->setSize( nOwnStreamOrigSize );
- pStream->aEntry.sName = rShortName;
pStream->aEntry.nOffset *= -1;
}
}
@@ -726,9 +779,9 @@ void ZipPackageFolder::doInsertByName ( ZipPackageEntry *pEntry, sal_Bool bSetPa
throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
{
if ( pEntry->IsFolder() )
- maContents[pEntry->aEntry.sName] = new ContentInfo ( static_cast < ZipPackageFolder *> ( pEntry ) );
+ maContents[pEntry->getName()] = new ContentInfo ( static_cast < ZipPackageFolder *> ( pEntry ) );
else
- maContents[pEntry->aEntry.sName] = new ContentInfo ( static_cast < ZipPackageStream *> ( pEntry ) );
+ maContents[pEntry->getName()] = new ContentInfo ( static_cast < ZipPackageStream *> ( pEntry ) );
if ( bSetParent )
pEntry->setParent ( *this );
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index ad68f34fd71c..242e37bfb764 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -76,6 +76,7 @@ ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
, m_nMagicalHackSize( 0 )
, m_bHasSeekable( sal_False )
, m_bCompressedIsSetFromOutside( sal_False )
+, m_bFromManifest( sal_False )
{
OSL_ENSURE( m_xFactory.is(), "No factory is provided to ZipPackageStream!\n" );
@@ -90,7 +91,7 @@ ZipPackageStream::ZipPackageStream ( ZipPackage & rNewPackage,
aEntry.nCompressedSize = -1;
aEntry.nSize = -1;
aEntry.nOffset = -1;
- aEntry.nNameLen = -1;
+ aEntry.nPathLen = -1;
aEntry.nExtraLen = -1;
if ( !aImplementationId.getLength() )
@@ -113,8 +114,8 @@ void ZipPackageStream::setZipEntryOnLoading( const ZipEntry &rInEntry)
aEntry.nCompressedSize = rInEntry.nCompressedSize;
aEntry.nSize = rInEntry.nSize;
aEntry.nOffset = rInEntry.nOffset;
- aEntry.sName = rInEntry.sName;
- aEntry.nNameLen = rInEntry.nNameLen;
+ aEntry.sPath = rInEntry.sPath;
+ aEntry.nPathLen = rInEntry.nPathLen;
aEntry.nExtraLen = rInEntry.nExtraLen;
if ( aEntry.nMethod == STORED )
@@ -229,10 +230,8 @@ Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( sal_B
if ( !xNewPackStream.is() )
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- if ( !m_aSharedMutexRef.Is() )
- m_aSharedMutexRef = new SotMutexHolder();
xNewPackStream->setDataStream( static_cast< io::XInputStream* >(
- new WrapStreamForShare( GetOwnSeekStream(), m_aSharedMutexRef ) ) );
+ new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() ) ) );
Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY );
if ( !xNewPSProps.is() )
@@ -385,7 +384,6 @@ void SAL_CALL ZipPackageStream::setInputStream( const Reference< io::XInputStrea
throw(RuntimeException)
{
// if seekable access is required the wrapping will be done on demand
- m_aSharedMutexRef = new SotMutexHolder();
xStream = aStream;
m_bHasSeekable = sal_False;
SetPackageMember ( sal_False );
@@ -403,13 +401,11 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawData()
{
if ( !xEncryptionData.isEmpty() && !bHaveOwnKey )
xEncryptionData->aKey = rZipPackage.getEncryptionKey();
- return rZipPackage.getZipFile().getRawData( aEntry, xEncryptionData, bIsEncrypted );
+ return rZipPackage.getZipFile().getRawData( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
- if ( !m_aSharedMutexRef.Is() )
- m_aSharedMutexRef = new SotMutexHolder();
- return new WrapStreamForShare( GetOwnSeekStream(), m_aSharedMutexRef );
+ return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
}
else
return Reference < io::XInputStream > ();
@@ -436,13 +432,11 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getInputStream( )
{
if ( !xEncryptionData.isEmpty() && !bHaveOwnKey )
xEncryptionData->aKey = rZipPackage.getEncryptionKey();
- return rZipPackage.getZipFile().getInputStream( aEntry, xEncryptionData, bIsEncrypted );
+ return rZipPackage.getZipFile().getInputStream( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
- if ( !m_aSharedMutexRef.Is() )
- m_aSharedMutexRef = new SotMutexHolder();
- return new WrapStreamForShare( GetOwnSeekStream(), m_aSharedMutexRef );
+ return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
}
else
return Reference < io::XInputStream > ();
@@ -482,15 +476,13 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
if ( !xEncryptionData.isEmpty() && !bHaveOwnKey )
xEncryptionData->aKey = rZipPackage.getEncryptionKey();
- return rZipPackage.getZipFile().getDataStream( aEntry, xEncryptionData, bIsEncrypted );
+ return rZipPackage.getZipFile().getDataStream( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( m_nStreamMode == PACKAGE_STREAM_RAW )
return ZipFile::StaticGetDataFromRawStream( GetOwnSeekStream(), xEncryptionData );
else if ( GetOwnSeekStream().is() )
{
- if ( !m_aSharedMutexRef.Is() )
- m_aSharedMutexRef = new SotMutexHolder();
- return new WrapStreamForShare( GetOwnSeekStream(), m_aSharedMutexRef );
+ return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
}
else
return uno::Reference< io::XInputStream >();
@@ -515,15 +507,13 @@ Reference< io::XInputStream > SAL_CALL ZipPackageStream::getRawStream()
if ( !bIsEncrypted || xEncryptionData.isEmpty() )
throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- return rZipPackage.getZipFile().getWrappedRawStream( aEntry, xEncryptionData, sMediaType );
+ return rZipPackage.getZipFile().getWrappedRawStream( aEntry, xEncryptionData, sMediaType, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
if ( m_nStreamMode == PACKAGE_STREAM_RAW )
{
- if ( !m_aSharedMutexRef.Is() )
- m_aSharedMutexRef = new SotMutexHolder();
- return new WrapStreamForShare( GetOwnSeekStream(), m_aSharedMutexRef );
+ return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
}
else if ( m_nStreamMode == PACKAGE_STREAM_DATA && bToBeEncrypted )
return TryToGetRawFromDataStream( sal_True );
@@ -568,7 +558,6 @@ void SAL_CALL ZipPackageStream::setRawStream( const Reference< io::XInputStream
// the raw stream MUST have seekable access
m_bHasSeekable = sal_True;
- m_aSharedMutexRef = new SotMutexHolder();
SetPackageMember ( sal_False );
aEntry.nTime = -1;
m_nStreamMode = PACKAGE_STREAM_RAW;
@@ -589,7 +578,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getPlainRawStream(
if (IsPackageMember())
{
- return rZipPackage.getZipFile().getRawData( aEntry, xEncryptionData, bIsEncrypted );
+ return rZipPackage.getZipFile().getRawData( aEntry, xEncryptionData, bIsEncrypted, rZipPackage.GetSharedMutexRef() );
}
else if ( GetOwnSeekStream().is() )
{
@@ -688,11 +677,11 @@ void SAL_CALL ZipPackageStream::setPropertyValue( const OUString& aPropertyName,
OUString sTempString;
if ( ( aValue >>= sTempString ) )
{
- sal_Int32 nNameLength = sTempString.getLength();
- Sequence < sal_Int8 > aSequence ( nNameLength );
+ sal_Int32 nPathLength = sTempString.getLength();
+ Sequence < sal_Int8 > aSequence ( nPathLength );
sal_Int8 *pArray = aSequence.getArray();
const sal_Unicode *pChar = sTempString.getStr();
- for ( sal_Int16 i = 0; i < nNameLength; i++)
+ for ( sal_Int16 i = 0; i < nPathLength; i++)
pArray[i] = static_cast < const sal_Int8 > (pChar[i]);
aNewKey = aSequence;
}
diff --git a/package/source/zippackage/ZipPackageStream.hxx b/package/source/zippackage/ZipPackageStream.hxx
index e0a2129c6519..e5aa1d24fcca 100644
--- a/package/source/zippackage/ZipPackageStream.hxx
+++ b/package/source/zippackage/ZipPackageStream.hxx
@@ -70,12 +70,12 @@ protected:
sal_uInt32 m_nMagicalHackPos;
sal_uInt32 m_nMagicalHackSize;
- SotMutexHolderRef m_aSharedMutexRef;
-
sal_Bool m_bHasSeekable;
sal_Bool m_bCompressedIsSetFromOutside;
+ sal_Bool m_bFromManifest;
+
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& GetOwnSeekStream();
public:
@@ -84,6 +84,10 @@ public:
sal_Bool IsToBeEncrypted () const { return bToBeEncrypted;}
sal_Bool IsEncrypted () const { return bIsEncrypted;}
sal_Bool IsPackageMember () const { return m_nStreamMode == PACKAGE_STREAM_PACKAGEMEMBER;}
+
+ sal_Bool IsFromManifest() const { return m_bFromManifest; }
+ void SetFromManifest( sal_Bool bValue ) { m_bFromManifest = bValue; }
+
vos::ORef < EncryptionData > & getEncryptionData ()
{ return xEncryptionData;}
const com::sun::star::uno::Sequence < sal_Int8 >& getKey () const
diff --git a/package/source/zippackage/makefile.mk b/package/source/zippackage/makefile.mk
index 9d18121f631f..64ddf157571f 100644
--- a/package/source/zippackage/makefile.mk
+++ b/package/source/zippackage/makefile.mk
@@ -40,6 +40,8 @@ ENABLE_EXCEPTIONS=TRUE
.INCLUDE : settings.mk
+.IF "$(L10N_framework)"==""
+
# --- Files --------------------------------------------------------
# the following flag un-inlines function calls and disables optimisations
#CFLAGS+=/Ob0 /Od
@@ -58,6 +60,8 @@ SLOFILES= \
# $(SLO)$/InteractionRequest.obj \
# $(SLO)$/InteractionContinuation.obj
+.ENDIF # L10N_framework
+
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index c284956f117e..42f95d3a268f 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -53,7 +53,8 @@ using namespace ::com::sun::star;
// ----------------------------------------------------------------
OZipFileAccess::OZipFileAccess( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
-: m_xFactory( xFactory )
+: m_aMutexHolder( new SotMutexHolder )
+, m_xFactory( xFactory )
, m_pZipFile( NULL )
, m_pListenersContainer( NULL )
, m_bDisposed( sal_False )
@@ -66,7 +67,7 @@ OZipFileAccess::OZipFileAccess( const uno::Reference< lang::XMultiServiceFactory
OZipFileAccess::~OZipFileAccess()
{
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( !m_bDisposed )
{
try {
@@ -179,7 +180,7 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
throw ( uno::Exception,
uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -242,7 +243,7 @@ uno::Any SAL_CALL OZipFileAccess::getByName( const ::rtl::OUString& aName )
lang::WrappedTargetException,
uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -256,7 +257,8 @@ uno::Any SAL_CALL OZipFileAccess::getByName( const ::rtl::OUString& aName )
uno::Reference< io::XInputStream > xEntryStream( m_pZipFile->getDataStream( (*aIter).second,
new EncryptionData(),
- sal_False ) );
+ sal_False,
+ m_aMutexHolder ) );
if ( !xEntryStream.is() )
throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -268,7 +270,7 @@ uno::Any SAL_CALL OZipFileAccess::getByName( const ::rtl::OUString& aName )
uno::Sequence< ::rtl::OUString > SAL_CALL OZipFileAccess::getElementNames()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -287,7 +289,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OZipFileAccess::getElementNames()
aNames.realloc( nLen );
}
- aNames[nLen-1] = (*aIter).second.sName;
+ aNames[nLen-1] = (*aIter).second.sPath;
}
if ( aNames.getLength() != nLen )
@@ -303,7 +305,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL OZipFileAccess::getElementNames()
sal_Bool SAL_CALL OZipFileAccess::hasByName( const ::rtl::OUString& aName )
throw (uno::RuntimeException)
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -320,7 +322,7 @@ sal_Bool SAL_CALL OZipFileAccess::hasByName( const ::rtl::OUString& aName )
uno::Type SAL_CALL OZipFileAccess::getElementType()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -335,7 +337,7 @@ uno::Type SAL_CALL OZipFileAccess::getElementType()
sal_Bool SAL_CALL OZipFileAccess::hasElements()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -353,7 +355,7 @@ uno::Reference< io::XInputStream > SAL_CALL OZipFileAccess::getStreamByPattern(
io::IOException,
uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -366,11 +368,12 @@ uno::Reference< io::XInputStream > SAL_CALL OZipFileAccess::getStreamByPattern(
for ( EntryHash::iterator aIter = m_pZipFile->GetEntryHash().begin(); aIter != m_pZipFile->GetEntryHash().end(); aIter++ )
{
- if ( StringGoodForPattern_Impl( (*aIter).second.sName, aPattern ) )
+ if ( StringGoodForPattern_Impl( (*aIter).second.sPath, aPattern ) )
{
uno::Reference< io::XInputStream > xEntryStream( m_pZipFile->getDataStream( (*aIter).second,
new EncryptionData(),
- sal_False ) );
+ sal_False,
+ m_aMutexHolder ) );
if ( !xEntryStream.is() )
throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -386,7 +389,7 @@ uno::Reference< io::XInputStream > SAL_CALL OZipFileAccess::getStreamByPattern(
void SAL_CALL OZipFileAccess::dispose()
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
@@ -418,13 +421,13 @@ void SAL_CALL OZipFileAccess::dispose()
void SAL_CALL OZipFileAccess::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
if ( !m_pListenersContainer )
- m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex );
+ m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutexHolder->GetMutex() );
m_pListenersContainer->addInterface( xListener );
}
@@ -432,7 +435,7 @@ void SAL_CALL OZipFileAccess::addEventListener( const uno::Reference< lang::XEve
void SAL_CALL OZipFileAccess::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
throw ( uno::RuntimeException )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
if ( m_bDisposed )
throw lang::DisposedException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
diff --git a/package/util/makefile.mk b/package/util/makefile.mk
index 0b8d2d7604af..99573c19ffb0 100644
--- a/package/util/makefile.mk
+++ b/package/util/makefile.mk
@@ -45,6 +45,8 @@ NO_BSYMBOLIC=TRUE
.INCLUDE : settings.mk
+.IF "$(L10N_framework)"==""
+
# --- General ----------------------------------------------------
LIB1TARGET= $(SLB)$/$(TARGET).lib
@@ -71,6 +73,8 @@ SHL1DEF=$(MISC)$/$(SHL1TARGET).def
SHL1LIBS=$(LIB1TARGET)
DEF1NAME=$(SHL1TARGET)
+.ENDIF # L10N_framework
+
# --- Targets ----------------------------------------------------------
.INCLUDE : target.mk
diff --git a/setup_native/prj/build.lst b/setup_native/prj/build.lst
index fcb276075a09..8835ff0d6ad2 100644
--- a/setup_native/prj/build.lst
+++ b/setup_native/prj/build.lst
@@ -1,7 +1,8 @@
-pk setup_native : soltools xml2cmp sal officecfg unoil NULL
+pk setup_native : transex3 soltools sal xml2cmp NULL
pk setup_native usr1 - all sn_mkout NULL
pk setup_native\scripts\source nmake - u sn_source NULL
pk setup_native\scripts nmake - u sn_scripts sn_source.u NULL
+pk setup_native\source\mac nmake - u sn_mac NULL
pk setup_native\source\win32\customactions\tools nmake - w sn_tools NULL
pk setup_native\source\win32\customactions\relnotes nmake - w sn_relnotes NULL
pk setup_native\source\win32\customactions\rebase nmake - w sn_rebase NULL
@@ -16,8 +17,3 @@ pk setup_native\source\win32\customactions\languagepacks nmake - w sn_lang
pk setup_native\source\win32\customactions\patch nmake - w sn_patch sn_languagepacks.w sn_shellextensions.w sn_quickstarter.w sn_tools.w NULL
pk setup_native\source\win32\stwrapper nmake - w sn_stwrapper NULL
pk setup_native\source\ulfconv nmake - all sn_ulfconv NULL
-pk setup_native\registry\data\org\openoffice\Office nmake - all sn_regconfig NULL
-pk setup_native\source\registration\com\sun\star\servicetag\resources get - all sn_svctagres NULL
-pk setup_native\source\registration\com\sun\star\servicetag nmake - all sn_svctag NULL
-pk setup_native\source\registration\com\sun\star\registration nmake - all sn_regjob sn_svctag NULL
-
diff --git a/setup_native/prj/d.lst b/setup_native/prj/d.lst
index a5df50320a73..a573b94fd5cb 100644
--- a/setup_native/prj/d.lst
+++ b/setup_native/prj/d.lst
@@ -19,6 +19,7 @@ mkdir: %_DEST%\bin%_EXT%\userscripts
..\%__SRC%\bin\javaloader.sh %_DEST%\bin%_EXT%\javaloader.sh
..\%__SRC%\bin\stclient_wrapper.sh %_DEST%\bin%_EXT%\stclient_wrapper
..\%__SRC%\bin\stclient_wrapper.exe %_DEST%\bin%_EXT%\stclient_wrapper.exe
+..\%__SRC%\misc\mac_ulffiles_dest\*.ulf %_DEST%\bin%_EXT%\*.ulf
..\source\win32\msi-encodinglist.txt %_DEST%\bin%_EXT%\msi-encodinglist.txt
..\source\win32\patchlist.txt %_DEST%\bin%_EXT%\patchlist.txt
..\source\win32\desktophelper.txt %_DEST%\bin%_EXT%\desktophelper.txt
@@ -27,6 +28,8 @@ mkdir: %_DEST%\bin%_EXT%\userscripts
..\source\win32\nsis\*.ico %_DEST%\bin%_EXT%\*.ico
..\source\win32\nsis\*.bmp %_DEST%\bin%_EXT%\*.bmp
..\source\linux\*.dat %_DEST%\bin%_EXT%\*.dat
+..\source\mac\*.icns %_DEST%\bin%_EXT%\*.icns
+..\source\mac\Info.plist.langpack %_DEST%\bin%_EXT%\Info.plist.langpack
..\source\java\openofficeorg_setup.gif %_DEST%\bin%_EXT%\osl\Setup.gif
..\source\java\javaversion.dat %_DEST%\bin%_EXT%\javaversion.dat
..\source\java\javaversion2.dat %_DEST%\bin%_EXT%\javaversion2.dat
@@ -35,15 +38,11 @@ mkdir: %_DEST%\bin%_EXT%\userscripts
..\source\packinfo\*.pcp %_DEST%\bin%_EXT%\*.pcp
..\scripts\admin.pl %_DEST%\bin%_EXT%\admin.pl
..\scripts\*.txt %_DEST%\bin%_EXT%\*.txt
+..\scripts\mac_install.script %_DEST%\bin%_EXT%\mac_install.script
+..\scripts\osx_install_languagepack.applescript %_DEST%\bin%_EXT%\osx_install_languagepack.applescript
+..\scripts\osx_install_patch.applescript %_DEST%\bin%_EXT%\osx_install_patch.applescript
..\%__SRC%\lib\getuid.so %_DEST%\bin%_EXT%\getuid.so
..\inc\setup_native\qswin32.h %_DEST%\inc%_EXT%\setup_native\qswin32.h
-mkdir: %_DEST%\xml%_EXT%\registry\spool
-mkdir: %_DEST%\xml%_EXT%\registry\spool\org
-mkdir: %_DEST%\xml%_EXT%\registry\spool\org\openoffice
-mkdir: %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office
-mkdir: %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office\Jobs
-
-..\%__SRC%\misc\registry\spool\org\openoffice\Office\Jobs\*.xcu %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office\Jobs
diff --git a/setup_native/registry/data/org/openoffice/Office/Jobs.xcu b/setup_native/registry/data/org/openoffice/Office/Jobs.xcu
deleted file mode 100644
index 628e3dcdf70a..000000000000
--- a/setup_native/registry/data/org/openoffice/Office/Jobs.xcu
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--***********************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: Jobs.xcu,v $
- *
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************ -->
-<oor:component-data oor:name="Jobs" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <node oor:name="Jobs">
- <node oor:name="ProductRegistration" oor:op="replace">
- <prop oor:name="Service">
- <value>com.sun.star.comp.framework.DoRegistrationJob</value>
- </prop>
- <node oor:name="Arguments">
- <prop oor:name="ProductName" oor:op="replace" oor:type="xs:string">
- <value>${SERVICETAG_PRODUCTNAME}</value>
- </prop>
- <prop oor:name="ProductVersion" oor:op="replace" oor:type="xs:string">
- <value>${SERVICETAG_PRODUCTVERSION}</value>
- </prop>
- <prop oor:name="ProductURN" oor:op="replace" oor:type="xs:string">
- <value>${SERVICETAG_URN}</value>
- </prop>
- <prop oor:name="ProductSource" oor:op="replace" oor:type="xs:string">
- <value>${SERVICETAG_SOURCE}</value>
- </prop>
- <prop oor:name="ProductParent" oor:op="replace" oor:type="xs:string">
- <value>${SERVICETAG_PARENTNAME}</value>
- </prop>
- <prop oor:name="Vendor" oor:op="replace" oor:type="xs:string">
- <value>Sun Microsystems, Inc.</value>
- </prop>
- <prop oor:name="RegistrationData" oor:op="replace" oor:type="xs:string">
- <value>$(user)/registration.xml</value>
- </prop>
- <prop oor:name="RegistrationURL" oor:op="replace" oor:type="xs:string">
- <value>${REGISTRATION_HOST}/register/${registry_urn}?product=${REGISTRATION_PRODUCT}&amp;locale=${locale}&amp;cid=${REGISTRATION_CID}</value>
- </prop>
- </node>
- </node>
- </node>
- <node oor:name="Events">
- <node oor:name="onRegisterNow" oor:op="fuse">
- <node oor:name="JobList">
- <node oor:name="ProductRegistration" oor:op="replace"/>
- </node>
- </node>
- <node oor:name="onRegisterLater" oor:op="fuse">
- <node oor:name="JobList">
- <node oor:name="ProductRegistration" oor:op="replace"/>
- </node>
- </node>
- </node>
-</oor:component-data>
diff --git a/setup_native/registry/data/org/openoffice/Office/makefile.mk b/setup_native/registry/data/org/openoffice/Office/makefile.mk
deleted file mode 100644
index aa1c37db6eab..000000000000
--- a/setup_native/registry/data/org/openoffice/Office/makefile.mk
+++ /dev/null
@@ -1,79 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.5 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..$/..$/..$/..
-PRJNAME=setup_native
-TARGET=data_registration
-PACKAGE=org.openoffice.Office
-
-ABSXCSROOT=$(SOLARXMLDIR)
-XCSROOT=..
-DTDDIR=$(ABSXCSROOT)
-XSLDIR=$(ABSXCSROOT)$/processing
-PROCESSOUT=$(MISC)$/$(TARGET)
-PROCESSORDIR=$(SOLARBINDIR)
-
-.INCLUDE : settings.mk
-
-# --- Files -------------------------------------------------------
-
-.IF "$(BUILD_SPECIAL)"!=""
-
-XCUFILES= \
- Jobs.xcu
-
-MODULEFILES=
-
-LOCALIZEDFILES=
-
-PACKAGEDIR=$(subst,.,$/ $(PACKAGE))
-SPOOLDIR=$(MISC)$/registry$/spool
-
-MYXCUFILES= \
- $(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-registration.xcu
-
-.ELSE # "$(BUILD_SPECIAL)"!=""
-
-dummy:
- @echo "Nothing to build"
-
-.ENDIF # "$(BUILD_SPECIAL)"!=""
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-
-ALLTAR : $(MYXCUFILES)
-
-$(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-registration.xcu : $(PROCESSOUT)$/registry$/data$/$/$(PACKAGEDIR)$/Jobs.xcu
- @-$(MKDIRHIER) $(@:d)
- @$(COPY) $< $@
-
diff --git a/setup_native/scripts/fake-db.spec b/setup_native/scripts/fake-db.spec
index 447e5a98babd..e6275048efe3 100644
--- a/setup_native/scripts/fake-db.spec
+++ b/setup_native/scripts/fake-db.spec
@@ -6,6 +6,7 @@ Group: dummy
License: LGPL
BuildArch: noarch
AutoReqProv: no
+%define _tmppath /tmp
#BuildRoot: %{_tmppath}/%{name}-root
Provides: libgnomevfs-2.so.0
Provides: libgconf-2.so.4
diff --git a/setup_native/scripts/mac_install.script b/setup_native/scripts/mac_install.script
new file mode 100644
index 000000000000..2b34da1b04ed
--- /dev/null
+++ b/setup_native/scripts/mac_install.script
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# shell script as a workaraound since it is hard to impossible to store compiled
+# applescript in CVS and running osacompile would require a GUI session while
+# building (or root privileges)
+# using osascript only works when the shell script is camouflaged as application
+
+MY_DIR=$(dirname "$0")
+
+osascript "$MY_DIR/osx_install.applescript"
diff --git a/setup_native/scripts/makefile.mk b/setup_native/scripts/makefile.mk
index c1df2ff56026..59b310fe0e70 100644
--- a/setup_native/scripts/makefile.mk
+++ b/setup_native/scripts/makefile.mk
@@ -37,7 +37,7 @@ TARGET=install
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
-
+.IF "$(L10N_framework)"==""
# --- Files --------------------------------------------------------
UNIXTEXT= \
@@ -59,8 +59,9 @@ FAKEDBROOT=$(COMMONMISC)/$(TARGET)/fake-db-root
# --- Targets ------------------------------------------------------
+.ENDIF # L10N_framework
.INCLUDE : target.mk
-
+.IF "$(L10N_framework)"==""
.IF "$(OS)" == "SOLARIS" || "$(OS)" == "LINUX"
ALLTAR: $(BIN)$/install $(BIN)$/uninstall
@@ -99,3 +100,4 @@ $(LB)$/getuid.so.stripped: $(LB)$/getuid.so
.ENDIF
+.ENDIF # L10N_framework
diff --git a/setup_native/scripts/osx_install_languagepack.applescript b/setup_native/scripts/osx_install_languagepack.applescript
new file mode 100644
index 000000000000..33d376adec1b
--- /dev/null
+++ b/setup_native/scripts/osx_install_languagepack.applescript
@@ -0,0 +1,115 @@
+(*
+This script is meant to
+ 1) Identify installed instances of the product
+ 2) check whether the user has write-access (and if not
+ ask for authentification)
+ 3) install the shipped tarball
+*)
+
+-- strings for localisations - to be meant to be replaced
+-- by a makefile or similar
+set OKLabel to "[OKLabel]"
+set InstallLabel to "[InstallLabel]"
+set AbortLabel to "[AbortLabel]"
+set intro to "[IntroText1]
+
+[IntroText2]
+
+[IntroText3]"
+set chooseMyOwn to "[ChooseMyOwnText]"
+set listPrompt to "[ListPromptText]"
+set chooseManual to "[ChooseManualText]"
+set listOKLabel to "[ListOKLabelText]"
+set listCancelLabel to "[ListCancelLabel]"
+set appInvalid to "[AppInvalidText1]
+
+[AppInvalidText2]" -- string will begin with the chosen application's name
+set startInstall to "[StartInstallText1]
+
+[StartInstallText2]"
+set IdentifyQ to "[IdentifyQText]
+
+[IdentifyQText2]"
+set IdentifyYES to "[IdentifyYES]"
+set IdentifyNO to "[IdentifyNO]"
+set installFailed to "[InstallFailedText]"
+set installComplete to "[InstallCompleteText]
+
+[InstallCompleteText2]"
+
+set sourcedir to (do shell script "dirname " & quoted form of POSIX path of (path to of me))
+
+display dialog intro buttons {AbortLabel, InstallLabel} default button 2
+
+if (button returned of result) is AbortLabel then
+ return 2
+end if
+
+set the found_ooos to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLPRODUCTNAME].app'\"") & "
+" & chooseMyOwn
+
+-- the choice returned is of type "list"
+-- Show selection dialog only if more than one or no product was found
+if (get first paragraph of found_ooos) is "" then
+ set the choice to (choose from list of paragraphs in found_ooos default items (get last paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel)
+ if choice is false then
+ -- do nothing, the user cancelled the installation
+ return 2 --aborted by user
+ else if (choice as string) is chooseMyOwn then
+ -- yeah, one needs to use "choose file", otherwise
+ -- the user would not be able to select the .app
+ set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles)
+ end if
+else if (get second paragraph of found_ooos) is chooseMyOwn then
+ -- set choice to found installation
+ set the choice to (get first paragraph of found_ooos)
+else
+ set the choice to (choose from list of paragraphs in found_ooos default items (get first paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel)
+ if choice is false then
+ -- do nothing, the user cancelled the installation
+ return 2 --aborted by user
+ else if (choice as string) is chooseMyOwn then
+ -- yeah, one needs to use "choose file", otherwise
+ -- the user would not be able to select the .app
+ set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles)
+ end if
+end if
+
+-- now only check whether the path is really from [PRODUCTNAME]
+try
+ do shell script "grep '<string>[PRODUCTNAME] [PRODUCTVERSION]' " & quoted form of (choice as string) & "/Contents/Info.plist"
+on error
+ display dialog (choice as string) & appInvalid buttons {InstallLabel} default button 1 with icon 0
+ return 3 --wrong target-directory
+end try
+
+(*
+display dialog startInstall buttons {AbortLabel, InstallLabel} default button 2
+
+if (button returned of result) is AbortLabel then
+ return 2
+end if
+*)
+
+set tarCommand to "/usr/bin/tar -C " & quoted form of (choice as string) & " -xjf " & quoted form of sourcedir & "/tarball.tar.bz2"
+try
+ do shell script tarCommand
+
+on error errMSG number errNUM
+ display dialog IdentifyQ buttons {IdentifyYES, IdentifyNO} with icon 2
+ if (button returned of result) is IdentifyYES then
+ try
+ do shell script tarCommand with administrator privileges
+ on error errMSG number errNUM
+ display dialog installFailed buttons {OKLabel} default button 1 with icon 0
+ -- -60005 username/password wrong
+ -- -128 aborted by user
+ -- 2 error from tar - tarball not found (easy to test)
+ return errNUM
+ end try
+ else
+ return 2 -- aborted by user
+ end if
+end try
+
+display dialog installComplete buttons {OKLabel} default button 1
diff --git a/setup_native/scripts/osx_install_patch.applescript b/setup_native/scripts/osx_install_patch.applescript
new file mode 100644
index 000000000000..33a9d4126339
--- /dev/null
+++ b/setup_native/scripts/osx_install_patch.applescript
@@ -0,0 +1,113 @@
+(*
+This script is meant to
+ 1) Identify installed instances of the product
+ 2) check whether the user has write-access (and if not
+ ask for authentification)
+ 3) install the shipped tarball
+*)
+
+-- strings for localisations - to be meant to be replaced
+-- by a makefile or similar
+set OKLabel to "[OKLabel]"
+set InstallLabel to "[InstallLabel]"
+set AbortLabel to "[AbortLabel]"
+set intro to "[IntroText1]
+
+[IntroText2]
+
+[IntroText3]"
+set chooseMyOwn to "[ChooseMyOwnText]"
+set listPrompt to "[ListPromptText]"
+set chooseManual to "[ChooseManualText]"
+set listOKLabel to "[ListOKLabelText]"
+set listCancelLabel to "[ListCancelLabel]"
+set appInvalid to "[AppInvalidText1]
+
+[AppInvalidText2]" -- string will begin with the chosen application's name
+set startInstall to "[StartInstallText1]
+
+[StartInstallText2]"
+set IdentifyQ to "[IdentifyQText]
+
+[IdentifyQText2]"
+set IdentifyYES to "[IdentifyYES]"
+set IdentifyNO to "[IdentifyNO]"
+set installFailed to "[InstallFailedText]"
+set installComplete to "[InstallCompleteTextPatch]"
+
+set sourcedir to (do shell script "dirname " & quoted form of POSIX path of (path to of me))
+
+display dialog intro buttons {AbortLabel, InstallLabel} default button 2
+
+if (button returned of result) is AbortLabel then
+ return 2
+end if
+
+set the found_ooos to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLPRODUCTNAME].app'\"") & "
+" & chooseMyOwn
+
+-- the choice returned is of type "list"
+-- Show selection dialog only if more than one or no product was found
+if (get first paragraph of found_ooos) is "" then
+ set the choice to (choose from list of paragraphs in found_ooos default items (get last paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel)
+ if choice is false then
+ -- do nothing, the user cancelled the installation
+ return 2 --aborted by user
+ else if (choice as string) is chooseMyOwn then
+ -- yeah, one needs to use "choose file", otherwise
+ -- the user would not be able to select the .app
+ set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles)
+ end if
+else if (get second paragraph of found_ooos) is chooseMyOwn then
+ -- set choice to found installation
+ set the choice to (get first paragraph of found_ooos)
+else
+ set the choice to (choose from list of paragraphs in found_ooos default items (get first paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel)
+ if choice is false then
+ -- do nothing, the user cancelled the installation
+ return 2 --aborted by user
+ else if (choice as string) is chooseMyOwn then
+ -- yeah, one needs to use "choose file", otherwise
+ -- the user would not be able to select the .app
+ set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles)
+ end if
+end if
+
+-- now only check whether the path is really from [PRODUCTNAME]
+try
+ do shell script "grep '<string>[PRODUCTNAME] [PRODUCTVERSION]' " & quoted form of (choice as string) & "/Contents/Info.plist"
+on error
+ display dialog (choice as string) & appInvalid buttons {InstallLabel} default button 1 with icon 0
+ return 3 --wrong target-directory
+end try
+
+(*
+display dialog startInstall buttons {AbortLabel, InstallLabel} default button 2
+
+if (button returned of result) is AbortLabel then
+ return 2
+end if
+*)
+
+set tarCommand to "/usr/bin/tar -C " & quoted form of (choice as string) & " -xjf " & quoted form of sourcedir & "/tarball.tar.bz2"
+try
+ do shell script tarCommand
+
+on error errMSG number errNUM
+ display dialog IdentifyQ buttons {IdentifyYES, IdentifyNO} with icon 2
+ if (button returned of result) is IdentifyYES then
+ try
+ do shell script tarCommand with administrator privileges
+ on error errMSG number errNUM
+ display dialog installFailed buttons {OKLabel} default button 1 with icon 0
+ -- -60005 username/password wrong
+ -- -128 aborted by user
+ -- 2 error from tar - tarball not found (easy to test)
+ return errNUM
+ end try
+ else
+ return 2 -- aborted by user
+ end if
+end try
+
+display dialog installComplete buttons {OKLabel} default button 1
diff --git a/setup_native/scripts/source/getuid.c b/setup_native/scripts/source/getuid.c
index 926c2b809af2..9af63f4f079d 100644
--- a/setup_native/scripts/source/getuid.c
+++ b/setup_native/scripts/source/getuid.c
@@ -88,13 +88,29 @@ int fstatat64(int fildes, const char *path, struct stat64 *buf, int flag)
return ret;
}
-
-#elif defined LINUX
+#elif defined LINUX
uid_t getuid (void) {return 0;}
uid_t geteuid (void) {return 0;}
/* This is to fool tar */
+#ifdef X86_64
+int __lxstat(int n, const char *path, struct stat *buf)
+{
+ int ret = 0;
+ static int (*p_lstat) (int n, const char *path, struct stat *buf) = NULL;
+ if (p_lstat == NULL)
+ p_lstat = (int (*)(int n, const char *path, struct stat *buf))
+ dlsym (RTLD_NEXT, "__lxstat");
+ ret = (*p_lstat)(n, path, buf);
+ if (buf != NULL)
+ {
+ buf->st_uid = 0; /* root */
+ buf->st_gid = 0; /* root */
+ }
+ return ret;
+}
+#else
int __lxstat64(int n, const char *path, struct stat64 *buf)
{
int ret = 0;
@@ -105,13 +121,12 @@ int __lxstat64(int n, const char *path, struct stat64 *buf)
ret = (*p_lstat)(n, path, buf);
if (buf != NULL)
{
- buf->st_uid = 0; /* root */
- buf->st_gid = 0; /* root */
+ buf->st_uid = 0;
+ buf->st_gid = 0;
}
-
return ret;
}
-
+#endif
#endif
#ifdef _cplusplus
diff --git a/setup_native/source/java/javaversion.dat b/setup_native/source/java/javaversion.dat
index 120bed23d7bf..87172c3a6495 100755
--- a/setup_native/source/java/javaversion.dat
+++ b/setup_native/source/java/javaversion.dat
@@ -30,30 +30,30 @@
#*************************************************************************
# GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})")
-JAVAVERSION=Java 6 Update 13
-WINDOWSJAVAVERSION=Java 6 Update 13
+JAVAVERSION=Java 6 Update 16
+WINDOWSJAVAVERSION=Java 6 Update 16
# Windows (scp2 and downloadtemplate.nsi)
-WINDOWSJAVAFILENAME=jre-6u13-windows-i586-p.exe
-WINDOWSJAVAREGISTRYENTRY=1.6.0_13
+WINDOWSJAVAFILENAME=jre-6u16-windows-i586.exe
+WINDOWSJAVAREGISTRYENTRY=1.6.0_16
# Linux (scp2)
-LINUXJAVAFILENAME=jre-6u13-linux-i586.rpm
+LINUXJAVAFILENAME=jre-6u16-linux-i586.rpm
# Linux (rpmUnit.xml, rpm -qp <filename> )
-LINUXJAVANAME=jre-1.6.0_13-fcs
+LINUXJAVANAME=jre-1.6.0_16-fcs
# Linux-x64 (scp2)
-LINUXX64JAVAFILENAME=jre-6u13-linux-amd64.rpm
+LINUXX64JAVAFILENAME=jre-6u16-linux-amd64.rpm
# Solaris Sparc (scp2)
-SOLSJAVARTPACKED=SUNWj6rt_1_6_0_13_sparc.tar.gz
-SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_13_sparc.tar.gz
-SOLSJAVAMANPACKED=SUNWj6man_1_6_0_13_sparc.tar.gz
+SOLSJAVARTPACKED=SUNWj6rt_1_6_0_16_sparc.tar.gz
+SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_16_sparc.tar.gz
+SOLSJAVAMANPACKED=SUNWj6man_1_6_0_16_sparc.tar.gz
# Solaris x86 (scp2)
-SOLIJAVARTPACKED=SUNWj6rt_1_6_0_13_x86.tar.gz
-SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_13_x86.tar.gz
-SOLIJAVAMANPACKED=SUNWj6man_1_6_0_13_x86.tar.gz
+SOLIJAVARTPACKED=SUNWj6rt_1_6_0_16_x86.tar.gz
+SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_16_x86.tar.gz
+SOLIJAVAMANPACKED=SUNWj6man_1_6_0_16_x86.tar.gz
# Solaris (pkgUnit.xml, needs only to be changed in major changes)
SOLARISJAVART=SUNWj6rt
diff --git a/setup_native/source/java/javaversion2.dat b/setup_native/source/java/javaversion2.dat
index e997838421b6..87172c3a6495 100644
--- a/setup_native/source/java/javaversion2.dat
+++ b/setup_native/source/java/javaversion2.dat
@@ -30,30 +30,30 @@
#*************************************************************************
# GUI String in the installer ("Java Runtime Environment (${JAVAVERSION})")
-JAVAVERSION=Java 6 Update 15
-WINDOWSJAVAVERSION=Java 6 Update 15
+JAVAVERSION=Java 6 Update 16
+WINDOWSJAVAVERSION=Java 6 Update 16
# Windows (scp2 and downloadtemplate.nsi)
-WINDOWSJAVAFILENAME=jre-6u15-windows-i586.exe
-WINDOWSJAVAREGISTRYENTRY=1.6.0_15
+WINDOWSJAVAFILENAME=jre-6u16-windows-i586.exe
+WINDOWSJAVAREGISTRYENTRY=1.6.0_16
# Linux (scp2)
-LINUXJAVAFILENAME=jre-6u15-linux-i586.rpm
+LINUXJAVAFILENAME=jre-6u16-linux-i586.rpm
# Linux (rpmUnit.xml, rpm -qp <filename> )
-LINUXJAVANAME=jre-1.6.0_15-fcs
+LINUXJAVANAME=jre-1.6.0_16-fcs
# Linux-x64 (scp2)
-LINUXX64JAVAFILENAME=jre-6u15-linux-amd64.rpm
+LINUXX64JAVAFILENAME=jre-6u16-linux-amd64.rpm
# Solaris Sparc (scp2)
-SOLSJAVARTPACKED=SUNWj6rt_1_6_0_15_sparc.tar.gz
-SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_15_sparc.tar.gz
-SOLSJAVAMANPACKED=SUNWj6man_1_6_0_15_sparc.tar.gz
+SOLSJAVARTPACKED=SUNWj6rt_1_6_0_16_sparc.tar.gz
+SOLSJAVACFGPACKED=SUNWj6cfg_1_6_0_16_sparc.tar.gz
+SOLSJAVAMANPACKED=SUNWj6man_1_6_0_16_sparc.tar.gz
# Solaris x86 (scp2)
-SOLIJAVARTPACKED=SUNWj6rt_1_6_0_15_x86.tar.gz
-SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_15_x86.tar.gz
-SOLIJAVAMANPACKED=SUNWj6man_1_6_0_15_x86.tar.gz
+SOLIJAVARTPACKED=SUNWj6rt_1_6_0_16_x86.tar.gz
+SOLIJAVACFGPACKED=SUNWj6cfg_1_6_0_16_x86.tar.gz
+SOLIJAVAMANPACKED=SUNWj6man_1_6_0_16_x86.tar.gz
# Solaris (pkgUnit.xml, needs only to be changed in major changes)
SOLARISJAVART=SUNWj6rt
diff --git a/setup_native/source/mac/Info.plist.langpack b/setup_native/source/mac/Info.plist.langpack
new file mode 100644
index 000000000000..3c1eb2c6f369
--- /dev/null
+++ b/setup_native/source/mac/Info.plist.langpack
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <!-- UTI declarations for OS X >= 10.4 -->
+ <key>UTExportedTypeDeclarations</key>
+
+ <key>UTImportedTypeDeclarations</key>
+
+ <key>CFBundleExecutable</key>
+ <string>[FULLPRODUCTNAME]</string>
+ <key>CFBundleGetInfoString</key>
+ <string>[FULLPRODUCTNAME]</string>
+ <key>CFBundleIconFile</key>
+ <string>ooo3_installer.icns</string>
+ <key>CFBundleShortVersionString</key>
+ <string>9</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.openoffice.script</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>[FULLPRODUCTNAME]</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>OOo3</string>
+ <key>LSRequiresCarbon</key>
+ <string>1</string>
+ <key>NSPrincipalClass</key>
+ <string>VCL_NSApplication</string>
+</dict>
+</plist>
+
diff --git a/setup_native/source/mac/macinstall.ulf b/setup_native/source/mac/macinstall.ulf
new file mode 100644
index 000000000000..4651d93e03ab
--- /dev/null
+++ b/setup_native/source/mac/macinstall.ulf
@@ -0,0 +1,68 @@
+[OKLabel]
+en-US = "Ok"
+
+[InstallLabel]
+en-US = "Install"
+
+[AbortLabel]
+en-US = "Abort"
+
+[IntroText1]
+en-US = "Welcome to the [FULLPRODUCTNAME] Installation Wizard"
+
+[IntroText2]
+en-US = "This installation will update your installed versions of [PRODUCTNAME]"
+
+[IntroText3]
+en-US = "This might take a moment."
+
+[ChooseMyOwnText]
+en-US = "Not listed (choose location in an extra step)"
+
+[ListPromptText]
+en-US = "Choose [PRODUCTNAME] [PRODUCTVERSION] installation for which you want to install the [FULLPRODUCTNAME]"
+
+[ChooseManualText]
+en-US = "Point the dialog to your [PRODUCTNAME] [PRODUCTVERSION] installation."
+
+[ListOKLabelText]
+en-US = "Install"
+
+[ListCancelLabel]
+en-US = "Abort"
+
+[AppInvalidText1]
+en-US = "This is not a valid [PRODUCTNAME] [PRODUCTVERSION] installation."
+
+[AppInvalidText2]
+en-US = "Run the installer again and choose a valid [PRODUCTNAME] [PRODUCTVERSION] installation"
+
+[StartInstallText1]
+en-US = "Click Install to start the installation"
+
+[StartInstallText2]
+en-US = "Installation might take a minute..."
+
+[IdentifyQText]
+en-US = "Installation failed, most likely your account does not have the necessary privileges."
+
+[IdentifyQText2]
+en-US = "Do you want to identify as administrator and try again?"
+
+[IdentifyYES]
+en-US = "Yes, identify"
+
+[IdentifyNO]
+en-US = "No, abort installation"
+
+[InstallFailedText]
+en-US = "Installation failed."
+
+[InstallCompleteText]
+en-US = "Installation of [PRODUCTNAME] language pack completed."
+
+[InstallCompleteText2]
+en-US = "Call 'Tools-Options-Language Settings' to change the user interface language."
+
+[InstallCompleteTextPatch]
+en-US = "Installation of [FULLPRODUCTNAME] completed"
diff --git a/setup_native/source/mac/makefile.mk b/setup_native/source/mac/makefile.mk
new file mode 100644
index 000000000000..026073b65c44
--- /dev/null
+++ b/setup_native/source/mac/makefile.mk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.5 $
+#
+# last change: $Author: rt $ $Date: 2005-09-07 18:20:20 $
+#
+# The Contents of this file are made available subject to
+# the terms of GNU Lesser General Public License Version 2.1.
+#
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2005 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=setup_native
+TARGET=mac_ulffiles
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# ------------------------------------------------------------------
+
+ULFFILES = macinstall.ulf
+
+ULFDESTFILES=$(foreach,i,$(ULFFILES) $(MISC)$/$(TARGET)_dest$/$i)
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(OS)"=="MACOSX"
+ALLTAR : $(ULFDESTFILES)
+.ENDIF
+
+.INCLUDE : target.mk
+
+.IF "$(WITH_LANG)"!=""
+$(MISC)$/$(TARGET)_dest$/%.ulf : $(COMMONMISC)$/$(TARGET)$/%.ulf
+.ELSE # "$(WITH_LANG)"!=""
+$(MISC)$/$(TARGET)_dest$/%.ulf : %.ulf
+.ENDIF # "$(WITH_LANG)"!=""
+ @-$(MKDIRHIER) $(MISC)$/$(TARGET)_dest
+ $(COPY) $< $@
diff --git a/setup_native/source/mac/ooo3_installer.icns b/setup_native/source/mac/ooo3_installer.icns
new file mode 100644
index 000000000000..e064ad70479d
--- /dev/null
+++ b/setup_native/source/mac/ooo3_installer.icns
Binary files differ
diff --git a/setup_native/source/packinfo/spellchecker_selection.txt b/setup_native/source/packinfo/spellchecker_selection.txt
index bc53123cc325..d7f7f7d53d9f 100644
--- a/setup_native/source/packinfo/spellchecker_selection.txt
+++ b/setup_native/source/packinfo/spellchecker_selection.txt
@@ -4,6 +4,7 @@
# Second column: Assigned spellchecker languages. Comma separated list.
af = "af,en-US"
+ca = "ca,es,en,fr"
cs = "cs,en-US"
da = "da,de,en-US"
de = "de,en-US,fr,it"
@@ -17,10 +18,13 @@ it = "de,en-US,fr,it"
ja = "en-US"
ko = "en-US"
lt = "en-US,lt"
+nb = "no,en,fr,de,es"
ne = "en-US,ne"
nl = "en-US,fr,de,nl"
+nn = "no,en,fr,de,es"
pl = "de,en-US,pl,ru"
pt-BR = "en-US,es,pt"
+ro = "ro,en,de,hu"
ru = "de,en-US,ru"
sk = "en-US,sk"
sl = "en-US,sl"
diff --git a/setup_native/source/registration/com/sun/star/registration/Registration.java b/setup_native/source/registration/com/sun/star/registration/Registration.java
deleted file mode 100644
index afcb1b99660e..000000000000
--- a/setup_native/source/registration/com/sun/star/registration/Registration.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: Registration.java,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-package com.sun.star.registration;
-
-import com.sun.star.beans.NamedValue;
-import com.sun.star.comp.loader.FactoryHelper;
-import com.sun.star.frame.DispatchResultEvent;
-import com.sun.star.frame.DispatchResultState;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XMultiComponentFactory;
-import com.sun.star.lang.XSingleServiceFactory;
-import com.sun.star.registry.*;
-import com.sun.star.servicetag.*;
-import com.sun.star.system.*;
-import com.sun.star.task.*;
-import com.sun.star.uno.*;
-import com.sun.star.uri.XExternalUriReferenceTranslator;
-import com.sun.star.util.XStringSubstitution;
-
-import java.io.*;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Set;
-import java.net.HttpURLConnection;
-
-public class Registration {
-
- public static XSingleServiceFactory __getServiceFactory(String implName,
- XMultiServiceFactory multiFactory, XRegistryKey regKey) {
- XSingleServiceFactory xSingleServiceFactory = null;
-
- if (implName.equals(Registration.class.getName())) {
- xSingleServiceFactory = FactoryHelper.getServiceFactory(_Registration.class, _serviceName, multiFactory, regKey);
- }
-
- return xSingleServiceFactory;
- }
-
- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
- return FactoryHelper.writeRegistryServiceInfo(Registration.class.getName(), _serviceName, regKey);
- }
-
- static final String _serviceName = "com.sun.star.comp.framework.DoRegistrationJob";
-
- static public class _Registration implements XJob {
- XComponentContext xComponentContext;
-
- XStringSubstitution xPathSubstService = null;
- XExternalUriReferenceTranslator xUriTranslator = null;
-
- RegistrationData theRegistrationData = null;
-
- public _Registration(XComponentContext xComponentContext) {
- this.xComponentContext = xComponentContext;
- }
-
- private String resolvePath(String path) {
- try {
- if( xPathSubstService == null || xUriTranslator == null ) {
- XMultiComponentFactory theServiceManager = xComponentContext.getServiceManager();
- if( xPathSubstService == null ) {
- Object o = theServiceManager.createInstanceWithContext(
- "com.sun.star.util.PathSubstitution",
- xComponentContext );
- xPathSubstService = (XStringSubstitution)
- UnoRuntime.queryInterface(XStringSubstitution.class, o);
- }
-
- if( xUriTranslator == null ) {
- Object o = theServiceManager.createInstanceWithContext(
- "com.sun.star.uri.ExternalUriReferenceTranslator",
- xComponentContext );
- xUriTranslator = (XExternalUriReferenceTranslator)
- UnoRuntime.queryInterface(XExternalUriReferenceTranslator.class, o);
- }
- }
-
- String s = xPathSubstService.substituteVariables(path, true);
- return xUriTranslator.translateToExternal(s);
- } catch (java.lang.Exception e) {
- return path;
- }
- }
-
- private void openBrowser(String url) {
- try {
- XMultiComponentFactory theServiceManager = xComponentContext.getServiceManager();
-
- Object o = theServiceManager.createInstanceWithContext(
- "com.sun.star.system.SystemShellExecute",
- xComponentContext );
-
- XSystemShellExecute xShellExecuteService = (XSystemShellExecute)
- UnoRuntime.queryInterface(XSystemShellExecute.class, o);
-
- xShellExecuteService.execute( url, "", SystemShellExecuteFlags.DEFAULTS );
- } catch (java.lang.Exception e) {
- }
- }
-
- private ServiceTag getServiceTagFromRegistrationData(File xmlFile, String productURN) {
- try {
- RegistrationData storedRegData = RegistrationData.loadFromXML(new FileInputStream(xmlFile));
- Set<ServiceTag> storedServiceTags = storedRegData.getServiceTags();
-
- Iterator<ServiceTag> tagIterator = storedServiceTags.iterator();
- while( tagIterator.hasNext() ) {
- ServiceTag tag = tagIterator.next();
- if( tag.getProductURN().equals(productURN) ) {
- theRegistrationData = storedRegData;
- return tag;
- }
- }
-
- // product URN has changed, remove registration data file
- xmlFile.delete();
- } catch (IOException e) {
- // fall through intentionally
- } catch (IllegalArgumentException e) {
- // file is damaged (or a name clash appeared)
- xmlFile.delete();
- }
- return null;
- }
-
- /*
- * XJob
- *
- * NOTE: as this Job hets triggered by the the JobExecutor service from first start
- * wizard and registration reminder code (because their frames do not implement
- * XDispatchProvider), making this an XAsyncJob doesn't make sense as the
- * JobExecutor waits for the jobFinished call on the listener passed.
- */
- public Object execute(NamedValue[] args)
- throws com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.Exception {
-
- final NamedValue[] f_args = args;
-
- new Thread(
- new Runnable () {
- public void run() {
- try {
- executeImpl(f_args);
- } catch(com.sun.star.uno.Exception e) {
- }
- }
- }
- ).start();
-
- NamedValue ret[] = new NamedValue[1];
- ret[0] = new NamedValue( "Deactivate", new Boolean(false) );
- return ret;
- }
-
- public synchronized void executeImpl(NamedValue[] args)
- throws com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.Exception {
-
- // extract the interesting part of the argument list
- NamedValue[] theJobConfig = null;
- NamedValue[] theEnvironment = null;
-
- int c = args.length;
- for (int i=0; i<c; ++i) {
- if (args[i].Name.equals("JobConfig"))
- theJobConfig = (NamedValue[]) AnyConverter.toArray(args[i].Value);
- else if (args[i].Name.equals("Environment"))
- theEnvironment = (NamedValue[]) AnyConverter.toArray(args[i].Value);
- }
-
- if (theEnvironment==null)
- throw new com.sun.star.lang.IllegalArgumentException("no environment");
-
- boolean saveConfig = false;
-
- String productName = "";
- String productVersion = "";
- String productURN = "";
- String productParent = "";
- String productParentURN = "";
- String productDefinedInstanceID = "";
- String productSource = "";
- String vendor = "";
-
- String urlRegData = null;
- String registrationURL = null;
-
- c = theJobConfig.length;
- for (int i=0; i<c; ++i) {
- if( theJobConfig[i].Name.equals("ProductName") ) {
- productName = AnyConverter.toString(theJobConfig[i].Value);
- } else if( theJobConfig[i].Name.equals("ProductVersion") ) {
- productVersion = AnyConverter.toString(theJobConfig[i].Value);
- } else if( theJobConfig[i].Name.equals("ProductURN") ) {
- productURN = AnyConverter.toString(theJobConfig[i].Value);
- } else if( theJobConfig[i].Name.equals("ProductParent") ) {
- productParent = AnyConverter.toString(theJobConfig[i].Value);
- } else if( theJobConfig[i].Name.equals("ProductParentURN") ) {
- productParentURN = AnyConverter.toString(theJobConfig[i].Value);
- } else if( theJobConfig[i].Name.equals("ProductSource") ) {
- productSource = AnyConverter.toString(theJobConfig[i].Value);
- } else if( theJobConfig[i].Name.equals("Vendor") ) {
- vendor = AnyConverter.toString(theJobConfig[i].Value);
- } else if( theJobConfig[i].Name.equals("RegistrationData") ) {
- urlRegData = resolvePath(AnyConverter.toString(theJobConfig[i].Value));
- } else if( theJobConfig[i].Name.equals("RegistrationURL") ) {
- registrationURL = AnyConverter.toString(theJobConfig[i].Value);
- } else {
- System.err.println( theJobConfig[i].Name + " = " + AnyConverter.toString(theJobConfig[i].Value) );
- }
- }
-
- if (registrationURL==null)
- throw new com.sun.star.lang.IllegalArgumentException("no registration url");
-
- boolean local_only = false;
-
- c = theEnvironment.length;
- for (int i=0; i<c; ++i) {
- if( theEnvironment[i].Name.equals("EventName") ) {
- if( ! AnyConverter.toString(theEnvironment[i].Value).equals("onRegisterNow") ) {
- local_only = true;
- }
- }
- }
-
- try {
-
- /* ensure only one thread accesses/writes registration.xml at a time
- * regardless how many instances of this Job exist.
- */
- synchronized( _serviceName ) {
-
- File xmlRegData = new File( new URI( urlRegData ) );
-
- ServiceTag tag = getServiceTagFromRegistrationData(xmlRegData, productURN);
- if( tag == null ) {
- tag = ServiceTag.newInstance(
- ServiceTag.generateInstanceURN(),
- productName,
- productVersion,
- productURN,
- productParent,
- productParentURN,
- productDefinedInstanceID,
- vendor,
- System.getProperty("os.arch"),
- Installer.getZoneName(),
- productSource);
-
- theRegistrationData = new RegistrationData();
- theRegistrationData.addServiceTag(tag);
- theRegistrationData.storeToXML( new FileOutputStream( xmlRegData ) );
- }
-
- // Store the service tag in local registry, which might have been installed later
- if( Registry.isSupported() ) {
- // ignore communication failures with local service tag client
- try {
- if( Registry.getSystemRegistry().getServiceTag(tag.getInstanceURN()) == null ) {
- Registry.getSystemRegistry().addServiceTag(tag);
- }
- } catch( java.io.IOException e) {
- e.printStackTrace();
- } catch (java.lang.RuntimeException e) {
- e.printStackTrace();
- }
- }
- }
-
- if( ! local_only ) {
- registrationURL = registrationURL.replaceAll("\\$\\{registry_urn\\}", theRegistrationData.getRegistrationURN());
- registrationURL = registrationURL.replaceAll("\\$\\{locale\\}", Locale.getDefault().getLanguage());
-
- HttpURLConnection con = (HttpURLConnection) new URL(registrationURL).openConnection();
- con.setDoInput(true);
- con.setDoOutput(true);
- con.setUseCaches(false);
- con.setAllowUserInteraction(false);
- con.setRequestMethod("POST");
-
- con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
- try {
- con.connect();
-
- OutputStream out = con.getOutputStream();
- theRegistrationData.storeToXML(out);
- out.flush();
- out.close();
-
- int returnCode = con.getResponseCode();
-// if (returnCode == HttpURLConnection.HTTP_OK);
- } catch(java.lang.Exception e) {
- // IOException and UnknownHostException
- }
- openBrowser(registrationURL);
- }
- } catch (java.net.MalformedURLException e) {
- e.printStackTrace();
- throw new com.sun.star.lang.IllegalArgumentException( e.toString() );
- } catch (java.net.URISyntaxException e) {
- e.printStackTrace();
- throw new com.sun.star.lang.IllegalArgumentException( e.toString() );
- } catch (java.io.IOException e) {
- e.printStackTrace();
- throw new com.sun.star.uno.RuntimeException( e.toString() );
- } catch (java.lang.RuntimeException e) {
- e.printStackTrace();
- throw new com.sun.star.uno.RuntimeException( e.toString() );
- }
- }
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/registration/makefile.mk b/setup_native/source/registration/com/sun/star/registration/makefile.mk
deleted file mode 100644
index f20eaf71adce..000000000000
--- a/setup_native/source/registration/com/sun/star/registration/makefile.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.2 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJNAME = setup_native
-PRJ = ..$/..$/..$/..$/..$/..
-TARGET = productregistration
-PACKAGE = com$/sun$/star$/registration
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-.IF "$(ENABLE_SVCTAGS)" == "YES"
-
-JARFILES = jurt.jar unoil.jar ridl.jar
-JAVAFILES = \
- Registration.java
-
-JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
-
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
-JARCLASSDIRS = $(PACKAGE) com$/sun$/star$/servicetag
-CUSTOMMANIFESTFILE = manifest
-.ENDIF # "$(ENABLE_SVCTAGS)" == "YES"
-
-# --- Targets ------------------------------------------------------
-
-
-.INCLUDE : target.mk
-
diff --git a/setup_native/source/registration/com/sun/star/registration/manifest b/setup_native/source/registration/com/sun/star/registration/manifest
deleted file mode 100644
index 952aaa804e96..000000000000
--- a/setup_native/source/registration/com/sun/star/registration/manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-RegistrationClassName: com.sun.star.registration.Registration
-UNO-Type-Path:
diff --git a/setup_native/source/registration/com/sun/star/servicetag/BrowserSupport.java b/setup_native/source/registration/com/sun/star/servicetag/BrowserSupport.java
deleted file mode 100644
index c97d5f2cd4f0..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/BrowserSupport.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: BrowserSupport.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.io.IOException;
-import java.net.URI;
-
-/**
- * BrowserSupport class.
- *
- * The implementation of the com.sun.servicetag API needs to be
- * compiled with JDK 5 as well since the consumer of this API
- * may require to support JDK 5 (e.g. NetBeans).
- *
- * The Desktop.browse() method can be backported in this class
- * if needed. The current implementation only supports JDK 6.
- */
-class BrowserSupport {
- private static boolean isBrowseSupported = false;
- private static Method browseMethod = null;
- private static Object desktop = null;
- private static volatile Boolean result = false;
-
-
- private static void initX() {
- if (desktop != null) {
- return;
- }
- boolean supported = false;
- Method browseM = null;
- Object desktopObj = null;
- try {
- // Determine if java.awt.Desktop is supported
- Class desktopCls = Class.forName("java.awt.Desktop", true, null);
- Method getDesktopM = desktopCls.getMethod("getDesktop");
- browseM = desktopCls.getMethod("browse", URI.class);
-
- Class actionCls = Class.forName("java.awt.Desktop$Action", true, null);
- final Method isDesktopSupportedMethod = desktopCls.getMethod("isDesktopSupported");
- Method isSupportedMethod = desktopCls.getMethod("isSupported", actionCls);
- Field browseField = actionCls.getField("BROWSE");
- // isDesktopSupported calls getDefaultToolkit which can block
- // infinitely, see 6636099 for details, to workaround we call
- // in a thread and time it out, noting that the issue is specific
- // to X11, it does not hurt for Windows.
- Thread xthread = new Thread() {
- public void run() {
- try {
- // support only if Desktop.isDesktopSupported() and
- // Desktop.isSupported(Desktop.Action.BROWSE) return true.
- result = (Boolean) isDesktopSupportedMethod.invoke(null);
- } catch (IllegalAccessException e) {
- // should never reach here
- InternalError x =
- new InternalError("Desktop.getDesktop() method not found");
- x.initCause(e);
- } catch (InvocationTargetException e) {
- // browser not supported
- if (Util.isVerbose()) {
- e.printStackTrace();
- }
- }
- }
- };
- // set it to daemon, so that the vm will exit.
- xthread.setDaemon(true);
- xthread.start();
- try {
- xthread.join(5 * 1000);
- } catch (InterruptedException ie) {
- // ignore the exception
- }
- if (result.booleanValue()) {
- desktopObj = getDesktopM.invoke(null);
- result = (Boolean) isSupportedMethod.invoke(desktopObj, browseField.get(null));
- supported = result.booleanValue();
- }
- } catch (ClassNotFoundException e) {
- // browser not supported
- if (Util.isVerbose()) {
- e.printStackTrace();
- }
- } catch (NoSuchMethodException e) {
- // browser not supported
- if (Util.isVerbose()) {
- e.printStackTrace();
- }
- } catch (NoSuchFieldException e) {
- // browser not supported
- if (Util.isVerbose()) {
- e.printStackTrace();
- }
- } catch (IllegalAccessException e) {
- // should never reach here
- InternalError x =
- new InternalError("Desktop.getDesktop() method not found");
- x.initCause(e);
- throw x;
- } catch (InvocationTargetException e) {
- // browser not supported
- if (Util.isVerbose()) {
- e.printStackTrace();
- }
- }
- isBrowseSupported = supported;
- browseMethod = browseM;
- desktop = desktopObj;
- }
-
- static boolean isSupported() {
- initX();
- return isBrowseSupported;
- }
-
- /**
- * Launches the default browser to display a {@code URI}.
- * If the default browser is not able to handle the specified
- * {@code URI}, the application registered for handling
- * {@code URIs} of the specified type is invoked. The application
- * is determined from the protocol and path of the {@code URI}, as
- * defined by the {@code URI} class.
- * <p>
- * This method calls the Desktop.getDesktop().browse() method.
- * <p>
- * @param uri the URI to be displayed in the user default browser
- *
- * @throws NullPointerException if {@code uri} is {@code null}
- * @throws UnsupportedOperationException if the current platform
- * does not support the {@link Desktop.Action#BROWSE} action
- * @throws IOException if the user default browser is not found,
- * or it fails to be launched, or the default handler application
- * failed to be launched
- * @throws IllegalArgumentException if the necessary permissions
- * are not available and the URI can not be converted to a {@code URL}
- */
- static void browse(URI uri) throws IOException {
- if (uri == null) {
- throw new NullPointerException("null uri");
- }
- if (!isSupported()) {
- throw new UnsupportedOperationException("Browse operation is not supported");
- }
-
- // Call Desktop.browse() method
- try {
- if (Util.isVerbose()) {
- System.out.println("desktop: " + desktop + ":browsing..." + uri);
- }
- browseMethod.invoke(desktop, uri);
- } catch (IllegalAccessException e) {
- // should never reach here
- InternalError x =
- new InternalError("Desktop.getDesktop() method not found");
- x.initCause(e);
- throw x;
- } catch (InvocationTargetException e) {
- Throwable x = e.getCause();
- if (x != null) {
- if (x instanceof UnsupportedOperationException) {
- throw (UnsupportedOperationException) x;
- } else if (x instanceof IllegalArgumentException) {
- throw (IllegalArgumentException) x;
- } else if (x instanceof IOException) {
- throw (IOException) x;
- } else if (x instanceof SecurityException) {
- throw (SecurityException) x;
- } else {
- // ignore
- }
- }
- }
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/Installer.java b/setup_native/source/registration/com/sun/star/servicetag/Installer.java
deleted file mode 100644
index 02825dfec69d..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/Installer.java
+++ /dev/null
@@ -1,947 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: Installer.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-import static com.sun.star.servicetag.Util.*;
-
-/**
- * Service Tag Installer for Java SE.
- */
-public class Installer {
- // System properties for testing
- private static String SVCTAG_DIR_PATH =
- "servicetag.dir.path";
- private static String SVCTAG_ENABLE_REGISTRATION =
- "servicetag.registration.enabled";
- private final static String SUN_VENDOR = "Sun Microsystems";
- private final static String REGISTRATION_XML = "registration.xml";
- private final static String SERVICE_TAG_FILE = "servicetag";
- private final static String REGISTRATION_HTML_NAME = "register";
-
- private final static Locale[] knownSupportedLocales =
- new Locale[] { Locale.ENGLISH,
- Locale.JAPANESE,
- Locale.SIMPLIFIED_CHINESE};
-
- private final static String javaHome = System.getProperty("java.home");
- private static File svcTagDir;
- private static File serviceTagFile;
- private static File regXmlFile;
- private static RegistrationData registration;
- private static boolean supportRegistration;
- private static String registerHtmlParent;
- private static Set<Locale> supportedLocales = new HashSet<Locale>();
- private static Properties swordfishProps = null;
- private static String[] jreArchs = null;
- static {
- String dir = System.getProperty(SVCTAG_DIR_PATH);
- if (dir == null) {
- svcTagDir = new File(getJrePath(), "lib" + File.separator + SERVICE_TAG_FILE);
- } else {
- svcTagDir = new File(dir);
- }
- serviceTagFile = new File(svcTagDir, SERVICE_TAG_FILE);
- regXmlFile = new File(svcTagDir, REGISTRATION_XML);
- if (System.getProperty(SVCTAG_ENABLE_REGISTRATION) == null) {
- supportRegistration = isJdk();
- } else {
- supportRegistration = true;
- }
- }
-
- private Installer() {
- }
-
- // Implementation of ServiceTag.getJavaServiceTag(String) method
- static ServiceTag getJavaServiceTag(String source) throws IOException {
- if (!System.getProperty("java.vendor").startsWith(SUN_VENDOR)) {
- // Products bundling this implementation may run on
- // Mac OS which is not a Sun JDK
- return null;
- }
- boolean cleanup = false;
- try {
- // Check if we have the swordfish entries for this JRE version
- if (loadSwordfishEntries() == null) {
- return null;
- }
-
- ServiceTag st = getJavaServiceTag();
- // Check if the service tag created by this bundle owner
- if (st != null && st.getSource().equals(source)) {
- // Install the system service tag if supported
- // stclient may be installed after the service tag creation
- if (Registry.isSupported()) {
- installSystemServiceTag();
- }
- return st;
- }
-
- // in case any exception thrown during the cleanup
- cleanup = true;
-
- // re-create a new one for this bundle owner
- // first delete the registration data
- deleteRegistrationData();
- cleanup = false;
-
- // create service tag and generate new register.html pages
- return createServiceTag(source);
- } finally {
- if (cleanup) {
- if (regXmlFile.exists()) {
- regXmlFile.delete();
- }
- if (serviceTagFile.exists()) {
- serviceTagFile.delete();
- }
- }
- }
- }
-
- /**
- * Returns the Java SE registration data located in
- * the <JRE>/lib/servicetag/registration.xml by default.
- *
- * @throws IllegalArgumentException if the registration data
- * is of invalid format.
- */
- private static synchronized RegistrationData getRegistrationData()
- throws IOException {
- if (registration != null) {
- return registration;
- }
- if (regXmlFile.exists()) {
- BufferedInputStream in = null;
- try {
- in = new BufferedInputStream(new FileInputStream(regXmlFile));
- registration = RegistrationData.loadFromXML(in);
- } catch (IllegalArgumentException ex) {
- System.err.println("Error: Bad registration data \"" +
- regXmlFile + "\":" + ex.getMessage());
- throw ex;
- } finally {
- if (in != null) {
- in.close();
- }
- }
- } else {
- registration = new RegistrationData();
- }
- return registration;
- }
-
- /**
- * Write the registration data to the registration.xml file.
- *
- * The offline registration page has to be regenerated with
- * the new registration data.
- *
- * @throws java.io.IOException
- */
- private static synchronized void writeRegistrationXml()
- throws IOException {
- if (!svcTagDir.exists()) {
- // This check is for NetBeans or other products that
- // bundles this com.sun.servicetag implementation for
- // pre-6u5 release.
- if (!svcTagDir.mkdir()) {
- throw new IOException("Failed to create directory: " + svcTagDir);
- }
- }
-
- // regenerate the new offline registration page
- deleteRegistrationHtmlPage();
- getRegistrationHtmlPage();
-
- BufferedOutputStream out = null;
- try {
- out = new BufferedOutputStream(new FileOutputStream(regXmlFile));
- getRegistrationData().storeToXML(out);
- } catch (IllegalArgumentException ex) {
- System.err.println("Error: Bad registration data \"" +
- regXmlFile + "\":" + ex.getMessage());
- throw ex;
- } finally {
- if (out != null) {
- out.close();
- }
- }
- }
-
- /**
- * Returns the instance urn(s) stored in the servicetag file
- * or empty set if file not exists.
- */
- private static Set<String> getInstalledURNs() throws IOException {
- Set<String> urnSet = new HashSet<String>();
- if (serviceTagFile.exists()) {
- BufferedReader in = null;
- try {
- in = new BufferedReader(new FileReader(serviceTagFile));
- String urn;
- while ((urn = in.readLine()) != null) {
- urn = urn.trim();
- if (urn.length() > 0) {
- urnSet.add(urn);
- }
- }
- } finally {
- if (in != null) {
- in.close();
- }
- }
- }
- return urnSet;
- }
-
- /**
- * Return the Java SE service tag(s) if it exists.
- * Typically only one Java SE service tag but it could have two for
- * Solaris 32-bit and 64-bit on the same install directory.
- *
- * @return the service tag(s) for Java SE
- */
- private static ServiceTag[] getJavaServiceTagArray() throws IOException {
- RegistrationData regData = getRegistrationData();
- Set<ServiceTag> svcTags = regData.getServiceTags();
- Set<ServiceTag> result = new HashSet<ServiceTag>();
-
- Properties props = loadSwordfishEntries();
- String jdkUrn = props.getProperty("servicetag.jdk.urn");
- String jreUrn = props.getProperty("servicetag.jre.urn");
- for (ServiceTag st : svcTags) {
- if (st.getProductURN().equals(jdkUrn) ||
- st.getProductURN().equals(jreUrn)) {
- result.add(st);
- }
- }
- return result.toArray(new ServiceTag[0]);
- }
-
- /**
- * Returns the Java SE service tag for this running platform;
- * or null if not exist.
- * This method will return the 64-bit service tag if the JDK
- * supports both 32-bit and 64-bit if already created.
- */
- private static ServiceTag getJavaServiceTag() throws IOException {
- String definedId = getProductDefinedId();
- for (ServiceTag st : getJavaServiceTagArray()) {
- if (st.getProductDefinedInstanceID().equals(definedId)) {
- return st;
- }
- }
- return null;
- }
-
- /**
- * Create a service tag for Java SE and install in the system
- * service tag registry if supported.
- *
- * A registration data <JRE>/lib/servicetag/registration.xml
- * will be created to storeToXML the XML entry for Java SE service tag.
- * If the system supports service tags, this method will install
- * the Java SE service tag in the system service tag registry and
- * its <tt>instance_urn</tt> will be stored to <JRE>/lib/servicetag/servicetag.
- *
- * If <JRE>/lib/servicetag/registration.xml exists but is not installed
- * in the system service tag registry (i.e. servicetag doesn't exist),
- * this method will install it as described above.
- *
- * If the system supports service tag, stclient will be used
- * to create the Java SE service tag.
- *
- * A Solaris 32-bit and 64-bit JDK will be installed in the same
- * directory but the registration.xml will have 2 service tags.
- * The servicetag file will also contain 2 instance_urns for that case.
- */
- private static ServiceTag createServiceTag(String svcTagSource)
- throws IOException {
- // determine if a new service tag is needed to be created
- ServiceTag newSvcTag = null;
- if (getJavaServiceTag() == null) {
- newSvcTag = newServiceTag(svcTagSource);
- }
-
- // Add the new service tag in the registration data
- if (newSvcTag != null) {
- RegistrationData regData = getRegistrationData();
-
- // Add the service tag to the registration data in JDK/JRE
- newSvcTag = regData.addServiceTag(newSvcTag);
-
- // add if there is a service tag for the OS
- ServiceTag osTag = SolarisServiceTag.getServiceTag();
- if (osTag != null && regData.getServiceTag(osTag.getInstanceURN()) == null) {
- regData.addServiceTag(osTag);
- }
- // write to the registration.xml
- writeRegistrationXml();
- }
-
- // Install the system service tag if supported
- if (Registry.isSupported()) {
- installSystemServiceTag();
- }
- return newSvcTag;
- }
-
- private static void installSystemServiceTag() throws IOException {
- // only install the service tag in the registry if
- // it has permission to write the servicetag file.
- if ((!serviceTagFile.exists() && !svcTagDir.canWrite()) ||
- (serviceTagFile.exists() && !serviceTagFile.canWrite())) {
- return;
- }
-
- Set<String> urns = getInstalledURNs();
- ServiceTag[] javaSvcTags = getJavaServiceTagArray();
- if (urns.size() < javaSvcTags.length) {
- for (ServiceTag st : javaSvcTags) {
- // Add the service tag in the system service tag registry
- // if not installed
- String instanceURN = st.getInstanceURN();
- if (!urns.contains(instanceURN)) {
- Registry.getSystemRegistry().addServiceTag(st);
- }
- }
- }
- writeInstalledUrns();
- }
-
- private static ServiceTag newServiceTag(String svcTagSource) throws IOException {
- // Load the swoRDFish information for the service tag creation
- Properties props = loadSwordfishEntries();
-
- // Determine the product URN and name
- String productURN;
- String productName;
-
- if (isJdk()) {
- // <HOME>/jre exists which implies it's a JDK
- productURN = props.getProperty("servicetag.jdk.urn");
- productName = props.getProperty("servicetag.jdk.name");
- } else {
- // Otherwise, it's a JRE
- productURN = props.getProperty("servicetag.jre.urn");
- productName = props.getProperty("servicetag.jre.name");
- }
-
- return ServiceTag.newInstance(ServiceTag.generateInstanceURN(),
- productName,
- System.getProperty("java.version"),
- productURN,
- props.getProperty("servicetag.parent.name"),
- props.getProperty("servicetag.parent.urn"),
- getProductDefinedId(),
- SUN_VENDOR,
- System.getProperty("os.arch"),
- getZoneName(),
- svcTagSource);
- }
-
- /**
- * Delete the registration data, the offline registration pages and
- * the service tags in the system service tag registry if installed.
- *
- * The registration.xml and servicetag file will be removed.
- */
- private static synchronized void deleteRegistrationData()
- throws IOException {
- try {
- // delete the offline registration page
- deleteRegistrationHtmlPage();
-
- // Remove the service tag from the system ST registry if exists
- Set<String> urns = getInstalledURNs();
- if (urns.size() > 0 && Registry.isSupported()) {
- for (String u : urns) {
- Registry.getSystemRegistry().removeServiceTag(u);
- }
- }
- registration = null;
- } finally {
- // Delete the registration.xml and servicetag files if exists
- if (regXmlFile.exists()) {
- if (!regXmlFile.delete()) {
- throw new IOException("Failed to delete " + regXmlFile);
- }
- }
- if (serviceTagFile.exists()) {
- if (!serviceTagFile.delete()) {
- throw new IOException("Failed to delete " + serviceTagFile);
- }
- }
- }
- }
-
- /**
- * Updates the registration data to contain one single service tag
- * for the running Java runtime.
- */
- private static synchronized void updateRegistrationData(String svcTagSource)
- throws IOException {
- RegistrationData regData = getRegistrationData();
- ServiceTag curSvcTag = newServiceTag(svcTagSource);
-
- ServiceTag[] javaSvcTags = getJavaServiceTagArray();
- Set<String> urns = getInstalledURNs();
- for (ServiceTag st : javaSvcTags) {
- if (!st.getProductDefinedInstanceID().equals(curSvcTag.getProductDefinedInstanceID())) {
- String instanceURN = st.getInstanceURN();
- regData.removeServiceTag(instanceURN);
-
- // remove it from the system service tag registry if exists
- if (urns.contains(instanceURN) && Registry.isSupported()) {
- Registry.getSystemRegistry().removeServiceTag(instanceURN);
- }
- }
- }
- writeRegistrationXml();
- writeInstalledUrns();
- }
-
- private static void writeInstalledUrns() throws IOException {
- // if the Registry is not supported,
- // remove the servicetag file
- if (!Registry.isSupported() && serviceTagFile.exists()) {
- serviceTagFile.delete();
- return;
- }
-
- PrintWriter out = null;
- try {
- out = new PrintWriter(serviceTagFile);
-
- ServiceTag[] javaSvcTags = getJavaServiceTagArray();
- for (ServiceTag st : javaSvcTags) {
- // Write the instance_run to the servicetag file
- String instanceURN = st.getInstanceURN();
- out.println(instanceURN);
- }
- } finally {
- if (out != null) {
- out.close();
- }
- }
- }
-
- /**
- * Load the values associated with the swoRDFish metadata entries
- * for Java SE. The swoRDFish metadata entries are different for
- * different release.
- *
- * @param version Version of Java SE
- */
- private static synchronized Properties loadSwordfishEntries() throws IOException {
- if (swordfishProps != null) {
- return swordfishProps;
- }
-
- // The version string for Java SE 6 is 1.6.0
- // We just need the minor number in the version string
- int version = Util.getJdkVersion();
-
- String filename = "/com/sun/servicetag/resources/javase_" +
- version + "_swordfish.properties";
- InputStream in = Installer.class.getClass().getResourceAsStream(filename);
- if (in == null) {
- return null;
- }
- swordfishProps = new Properties();
- try {
- swordfishProps.load(in);
- } finally {
- in.close();
- }
- return swordfishProps;
- }
-
- /**
- * Returns the product defined instance ID for Java SE.
- * It is a list of comma-separated name/value pairs:
- * "id=<full-version> <arch> [<arch>]*"
- * "dir=<java.home system property value>"
- *
- * where <full-version> is the full version string of the JRE,
- * <arch> is the architecture that the runtime supports
- * (i.e. "sparc", "sparcv9", "i386", "amd64" (ISA list))
- *
- * For Solaris, it can be dual mode that can support both
- * 32-bit and 64-bit. the "id" will be set to
- * "1.6.0_03-b02 sparc sparcv9"
- *
- * The "dir" property is included in the service tag to enable
- * the Service Tag software to determine if a service tag for
- * Java SE is invalid and perform appropriate service tag
- * cleanup if necessary. See RFE# 6574781 Service Tags Enhancement.
- *
- */
- private static String getProductDefinedId() {
- StringBuilder definedId = new StringBuilder();
- definedId.append("id=");
- definedId.append(System.getProperty("java.runtime.version"));
-
- String[] archs = getJreArchs();
- for (String name : archs) {
- definedId.append(" " + name);
- }
-
- String location = ",dir=" + javaHome;
- if ((definedId.length() + location.length()) < 256) {
- definedId.append(",dir=");
- definedId.append(javaHome);
- } else {
- // if it exceeds the limit, we will not include the location
- if (isVerbose()) {
- System.err.println("Warning: Product defined instance ID exceeds the field limit:");
- }
- }
-
- return definedId.toString();
- }
-
- /**
- * Returns the architectures that the runtime supports
- * (i.e. "sparc", "sparcv9", "i386", "amd64" (ISA list))
- * The directory name where libjava.so is located.
- *
- * On Windows, returns the "os.arch" system property value.
- */
- private synchronized static String[] getJreArchs() {
- if (jreArchs != null) {
- return jreArchs;
- }
-
- Set<String> archs = new HashSet<String>();
-
- String os = System.getProperty("os.name");
- if (os.equals("SunOS") || os.equals("Linux")) {
- // Traverse the directories under <JRE>/lib.
- // If <JRE>/lib/<arch>/libjava.so exists, add <arch>
- // to the product defined ID
- File dir = new File(getJrePath() + File.separator + "lib");
- if (dir.isDirectory()) {
- String[] children = dir.list();
- for (String name : children) {
- File f = new File(dir, name + File.separator + "libjava.so");
- if (f.exists()) {
- archs.add(name);
- }
- }
- }
- } else {
- // Windows - append the os.arch
- archs.add(System.getProperty("os.arch"));
- }
- jreArchs = archs.toArray(new String[0]);
- return jreArchs;
- }
-
- /**
- * Return the zonename if zone is supported; otherwise, return
- * "global".
- */
- public static String getZoneName() throws IOException {
- String zonename = "global";
-
- String command = "/usr/bin/zonename";
- File f = new File(command);
- // com.sun.servicetag package has to be compiled with JDK 5 as well
- // JDK 5 doesn't support the File.canExecute() method.
- // Risk not checking isExecute() for the zonename command is very low.
- if (f.exists()) {
- ProcessBuilder pb = new ProcessBuilder(command);
- Process p = pb.start();
- String output = commandOutput(p);
- if (p.exitValue() == 0) {
- zonename = output.trim();
- }
-
- }
- return zonename;
- }
-
- private synchronized static String getRegisterHtmlParent() throws IOException {
- if (registerHtmlParent == null) {
- File htmlDir; // register.html is put under the JDK directory
- if (getJrePath().endsWith(File.separator + "jre")) {
- htmlDir = new File(getJrePath(), "..");
- } else {
- // j2se non-image build
- htmlDir = new File(getJrePath());
- }
-
- // initialize the supported locales
- initSupportedLocales(htmlDir);
-
- // Determine the location of the offline registration page
- String path = System.getProperty(SVCTAG_DIR_PATH);
- if (path == null) {
- // Default is <JDK>/register.html
- registerHtmlParent = htmlDir.getCanonicalPath();
- } else {
- File f = new File(path);
- registerHtmlParent = f.getCanonicalPath();
- if (!f.isDirectory()) {
- throw new InternalError("Path " + path + " set in \"" +
- SVCTAG_DIR_PATH + "\" property is not a directory");
- }
- }
- }
- return registerHtmlParent;
- }
-
- /**
- * Returns the File object of the offline registration page localized
- * for the default locale in the JDK directory.
- */
- static synchronized File getRegistrationHtmlPage() throws IOException {
- if (!supportRegistration) {
- // No register.html page generated if JRE
- return null;
- }
-
- String parent = getRegisterHtmlParent();
-
- // check if the offline registration page is already generated
- File f = new File(parent, REGISTRATION_HTML_NAME + ".html");
- if (!f.exists()) {
- // Generate the localized version of the offline registration Page
- generateRegisterHtml(parent);
- }
-
- String name = REGISTRATION_HTML_NAME;
- List<Locale> candidateLocales = getCandidateLocales(Locale.getDefault());
- for (Locale l : candidateLocales) {
- if (supportedLocales.contains(l)) {
- name = REGISTRATION_HTML_NAME + "_" + l.toString();
- break;
- }
- }
- File htmlFile = new File(parent, name + ".html");
- if (isVerbose()) {
- System.out.print("Offline registration page: " + htmlFile);
- System.out.println((htmlFile.exists() ?
- "" : " not exist. Use register.html"));
- }
- if (htmlFile.exists()) {
- return htmlFile;
- } else {
- return new File(parent,
- REGISTRATION_HTML_NAME + ".html");
- }
- }
-
- private static List<Locale> getCandidateLocales(Locale locale) {
- String language = locale.getLanguage();
- String country = locale.getCountry();
- String variant = locale.getVariant();
-
- List<Locale> locales = new ArrayList<Locale>(3);
- if (variant.length() > 0) {
- locales.add(locale);
- }
- if (country.length() > 0) {
- locales.add((locales.size() == 0) ?
- locale : new Locale(language, country, ""));
- }
- if (language.length() > 0) {
- locales.add((locales.size() == 0) ?
- locale : new Locale(language, "", ""));
- }
- return locales;
- }
-
- // Remove the offline registration pages
- private static void deleteRegistrationHtmlPage() throws IOException {
- String parent = getRegisterHtmlParent();
- if (parent == null) {
- return;
- }
-
- for (Locale locale : supportedLocales) {
- String name = REGISTRATION_HTML_NAME;
- if (!locale.equals(Locale.ENGLISH)) {
- name += "_" + locale.toString();
- }
- File f = new File(parent, name + ".html");
- if (f.exists()) {
- if (!f.delete()) {
- throw new IOException("Failed to delete " + f);
- }
- }
- }
- }
-
- private static void initSupportedLocales(File jdkDir) {
- if (supportedLocales.isEmpty()) {
- // initialize with the known supported locales
- for (Locale l : knownSupportedLocales) {
- supportedLocales.add(l);
- }
- }
-
- // Determine unknown supported locales if any
- // by finding the localized version of README.html
- // This prepares if a new locale in JDK is supported in
- // e.g. in the OpenSource world
- FilenameFilter ff = new FilenameFilter() {
- public boolean accept(File dir, String name) {
- String fname = name.toLowerCase();
- if (fname.startsWith("readme") && fname.endsWith(".html")) {
- return true;
- }
- return false;
- }
- };
-
- String[] readmes = jdkDir.list(ff);
- for (String name : readmes) {
- String basename = name.substring(0, name.length() - ".html".length());
- String[] ss = basename.split("_");
- switch (ss.length) {
- case 1:
- // English version
- break;
- case 2:
- supportedLocales.add(new Locale(ss[1]));
- break;
- case 3:
- supportedLocales.add(new Locale(ss[1], ss[2]));
- break;
- default:
- // ignore
- break;
- }
- }
- if (isVerbose()) {
- System.out.println("Supported locales: ");
- for (Locale l : supportedLocales) {
- System.out.println(l);
- }
- }
- }
-
- private static final String JDK_HEADER_PNG_KEY = "@@JDK_HEADER_PNG@@";
- private static final String JDK_VERSION_KEY = "@@JDK_VERSION@@";
- private static final String REGISTRATION_URL_KEY = "@@REGISTRATION_URL@@";
- private static final String REGISTRATION_PAYLOAD_KEY = "@@REGISTRATION_PAYLOAD@@";
-
- @SuppressWarnings("unchecked")
- private static void generateRegisterHtml(String parent) throws IOException {
- int version = Util.getJdkVersion();
- int update = Util.getUpdateVersion();
- String jdkVersion = "Version " + version;
- if (update > 0) {
- // product name is not translated
- jdkVersion += " Update " + update;
- }
- RegistrationData regData = getRegistrationData();
- String registerURL = SunConnection.getRegistrationURL(
- regData.getRegistrationURN()).toString();
- // Make sure it uses the canonical path before getting the URI.
- File img = new File(svcTagDir.getCanonicalPath(), "jdk_header.png");
- String headerImageSrc = img.toURI().toString();
-
- // Format the registration data in one single line
- StringBuilder payload = new StringBuilder();
- String xml = regData.toString().replaceAll("\"", "%22");
- BufferedReader reader = new BufferedReader(new StringReader(xml));
- try {
- String line = null;
- while ((line = reader.readLine()) != null) {
- payload.append(line.trim());
- }
- } finally {
- reader.close();
- }
-
- String resourceFilename = "/com/sun/star/servicetag/resources/register";
- for (Locale locale : supportedLocales) {
- String name = REGISTRATION_HTML_NAME;
- String resource = resourceFilename;
- if (!locale.equals(Locale.ENGLISH)) {
- name += "_" + locale.toString();
- resource += "_" + locale.toString();
- }
- File f = new File(parent, name + ".html");
- InputStream in = null;
- BufferedReader br = null;
- PrintWriter pw = null;
- try {
- in = Installer.class.getClass().getResourceAsStream(resource + ".html");
- if (in == null) {
- // if the resource file is missing
- if (isVerbose()) {
- System.out.println("Missing resouce file: " + resource + ".html");
- }
- continue;
- }
- if (isVerbose()) {
- System.out.println("Generating " + f + " from " + resource + ".html");
- }
-
- br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
- pw = new PrintWriter(f, "UTF-8");
- String line = null;
- while ((line = br.readLine()) != null) {
- String output = line;
- if (line.contains(JDK_VERSION_KEY)) {
- output = line.replace(JDK_VERSION_KEY, jdkVersion);
- } else if (line.contains(JDK_HEADER_PNG_KEY)) {
- output = line.replace(JDK_HEADER_PNG_KEY, headerImageSrc);
- } else if (line.contains(REGISTRATION_URL_KEY)) {
- output = line.replace(REGISTRATION_URL_KEY, registerURL);
- } else if (line.contains(REGISTRATION_PAYLOAD_KEY)) {
- output = line.replace(REGISTRATION_PAYLOAD_KEY, payload.toString());
- }
- pw.println(output);
- }
- f.setReadOnly();
- pw.flush();
- } finally {
- if (pw != null) {
- pw.close();
- }
- if (in != null) {
- in.close();
- }
- if (br!= null) {
- br.close();
- }
- }
- }
- }
-
- /**
- * A utility class to create a service tag for Java SE.
- * <p>
- * <b>Usage:</b><br>
- * <blockquote><tt>
- * &lt;JAVA_HOME&gt;/bin/java com.sun.servicetag.Installer
- * </tt></blockquote>
- * <p>
- */
- public static void main(String[] args) {
- String source = "Manual";
-
- // Parse the options (arguments starting with "-" )
- boolean delete = false;
- boolean update = false;
- boolean register = false;
- int count = 0;
- while (count < args.length) {
- String arg = args[count];
- if (arg.trim().length() == 0) {
- // skip empty arguments
- count++;
- continue;
- }
-
- if (arg.equals("-source")) {
- source = args[++count];
- } else if (arg.equals("-delete")) {
- delete = true;
- } else if (arg.equals("-register")) {
- register = true;
- } else {
- usage();
- return;
- }
- count++;
- }
- try {
- if (delete) {
- deleteRegistrationData();
- } else {
- ServiceTag[] javaSvcTags = getJavaServiceTagArray();
- String[] archs = getJreArchs();
- if (javaSvcTags.length > archs.length) {
- // 64-bit has been uninstalled
- // so remove the service tag
- updateRegistrationData(source);
- } else {
- // create the service tag
- createServiceTag(source);
- }
- }
-
- if (register) {
- // Registration is only supported by JDK
- // For testing purpose, override with a "servicetag.enable.registration" property
-
- RegistrationData regData = getRegistrationData();
- if (supportRegistration && !regData.getServiceTags().isEmpty()) {
- SunConnection.register(regData);
- }
- }
- System.exit(0);
- } catch (IOException e) {
- System.err.println("I/O Error: " + e.getMessage());
- if (isVerbose()) {
- e.printStackTrace();
- }
- } catch (IllegalArgumentException ex) {
- if (isVerbose()) {
- ex.printStackTrace();
- }
- } catch (Exception e) {
- System.err.println("Error: " + e.getMessage());
- if (isVerbose()) {
- e.printStackTrace();
- }
- }
- System.exit(1);
- }
-
- private static void usage() {
- System.out.println("Usage:");
- System.out.print(" " + Installer.class.getName());
- System.out.println(" [-delete|-source <source>|-register]");
- System.out.println(" to create a service tag for the Java platform");
- System.out.println("");
- System.out.println("Internal Options:");
- System.out.println(" -source: to specify the source of the service tag to be created");
- System.out.println(" -delete: to delete the service tag ");
- System.out.println(" -register: to register the JDK");
- System.out.println(" -help: to print this help message");
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java b/setup_native/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java
deleted file mode 100644
index 90e38021c103..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: LinuxSystemEnvironment.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-// The Service Tags team maintains the latest version of the implementation
-// for system environment data collection. JDK will include a copy of
-// the most recent released version for a JDK release. We rename
-// the package to com.sun.servicetag so that the Sun Connection
-// product always uses the latest version from the com.sun.scn.servicetags
-// package. JDK and users of the com.sun.servicetag API
-// (e.g. NetBeans and SunStudio) will use the version in JDK.
-
-import java.io.*;
-
-/**
- * Linux implementation of the SystemEnvironment class.
- */
-class LinuxSystemEnvironment extends SystemEnvironment {
- LinuxSystemEnvironment() {
- setHostId(getLinuxHostId());
- setSystemModel(getCommandOutput("/bin/uname", "-i"));
- setSystemManufacturer(getLinuxSystemManufacturer());
- setCpuManufacturer(getLinuxCpuManufacturer());
- setSerialNumber(getLinuxSN());
- }
- private String dmiInfo = null;
-
- private static final int SN = 1;
- private static final int SYS = 2;
- private static final int CPU = 3;
-
- private String getLinuxHostId() {
- String output = getCommandOutput("/usr/bin/hostid");
- // trim off the leading 0x
- if (output.startsWith("0x")) {
- output = output.substring(2);
- }
- return output;
- }
-
- /**
- * Tries to obtain and return the cpu manufacturer.
- * @return The cpu manufacturer (an empty string if not found or an error occurred)
- */
- private String getLinuxCpuManufacturer() {
- String tmp = getLinuxPSNInfo(CPU);
- if (tmp.length() > 0) {
- return tmp;
- }
-
- String contents = getFileContent("/proc/cpuinfo");
- for (String line : contents.split("\n")) {
- if (line.contains("vendor_id")) {
- String[] ss = line.split(":", 2);
- if (ss.length > 1) {
- return ss[1].trim();
- }
- }
- }
-
- // returns an empty string if it can't be found or an error happened
- return getLinuxDMIInfo("dmi type 4", "manufacturer");
- }
-
-
- /**
- * Tries to obtain and return the system manufacturer.
- * @return The system manufacturer (an empty string if not found or an error occurred)
- */
- private String getLinuxSystemManufacturer() {
- String tmp = getLinuxPSNInfo(SYS);
- if (tmp.length() > 0) {
- return tmp;
- }
-
- // returns an empty string if it can't be found or an error happened
- return getLinuxDMIInfo("dmi type 1", "manufacturer");
- }
-
- /**
- * Tries to obtain and return the serial number of the system.
- * @return The serial number (an empty string if not found or an error occurred)
- */
- private String getLinuxSN() {
- String tmp = getLinuxPSNInfo(SN);
- if (tmp.length() > 0) {
- return tmp;
- }
-
- // returns an empty string if it can't be found or an error happened
- return getLinuxDMIInfo("dmi type 1", "serial number");
- }
-
- private String getLinuxPSNInfo(int target) {
- // try to read from the psn file if it exists
- String contents = getFileContent("/var/run/psn");
- String[] ss = contents.split("\n");
- if (target <= ss.length) {
- return ss[target-1];
- }
-
- // default case is to return ""
- return "";
- }
-
- // reads from dmidecode with the given type and target
- // returns an empty string if nothing was found or an error occurred
- //
- // Sample output segment:
- // Handle 0x0001
- // DMI type 1, 25 bytes.
- // System Information
- // Manufacturer: System manufacturer
- // Product Name: System Product Name
- // Version: System Version
- // Serial Number: System Serial Number
- // UUID: 3091D719-B25B-D911-959D-6D1B12C7686E
- // Wake-up Type: Power Switch
-
- private synchronized String getLinuxDMIInfo(String dmiType, String target) {
- // only try to get dmidecode information once, after that, we can
- // reuse the output
- if (dmiInfo == null) {
- Thread dmidecodeThread = new Thread() {
- public void run() {
- dmiInfo = getCommandOutput("/usr/sbin/dmidecode");
- }
- };
- dmidecodeThread.start();
-
- try {
- dmidecodeThread.join(2000);
- if (dmidecodeThread.isAlive()) {
- dmidecodeThread.interrupt();
- dmiInfo = "";
- }
- } catch (InterruptedException ie) {
- dmidecodeThread.interrupt();
- }
- }
-
- if (dmiInfo.length() == 0) {
- return "";
- }
- boolean dmiFlag = false;
- for (String s : dmiInfo.split("\n")) {
- String line = s.toLowerCase();
- if (dmiFlag) {
- if (line.contains(target)) {
- String key = target + ":";
- int indx = line.indexOf(key) + key.length();
- if (line.contains(key) && indx < line.length()) {
- return line.substring(indx).trim();
- }
- String[] ss = line.split(":");
- return ss[ss.length-1];
- }
- } else if (line.contains(dmiType)) {
- dmiFlag = true;
- }
- }
- return "";
- }
-
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/RegistrationData.java b/setup_native/source/registration/com/sun/star/servicetag/RegistrationData.java
deleted file mode 100644
index 57be724a78a3..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/RegistrationData.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: RegistrationData.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.net.UnknownHostException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import static com.sun.star.servicetag.RegistrationDocument.*;
-
-/**
- * A {@code RegistrationData} object is a container of one or more
- * {@link #getServiceTags service tags} that identify the
- * components for product registration.
- * Each {@code RegistrationData} object has a {@link #getRegistrationURN
- * uniform resource name} (URN) as its identifier.
- * <a name="EnvMap"></a>
- * It also has an <i>environment map</i> with
- * the following elements:
- * <blockquote>
- * <table border=0>
- * <tr>
- * <td><tt>hostname</tt></td>
- * <td>Hostname of the system</td>
- * <td>e.g. woody</td>
- * </tr>
- * <tr>
- * <td><tt>hostId</tt></td>
- * <td>Host ID of the system</td>
- * <td>e.g. 83abc1ab</td>
- * </tr>
- * <tr>
- * <td><tt>osName</tt></td>
- * <td>Operating system name</td>
- * <td> e.g. SunOS</td>
- * </tr>
- * <tr>
- * <td><tt>osVersion</tt></td>
- * <td>Operating system version</td>
- * <td> e.g. 5.10</td>
- * </tr>
- * <tr>
- * <td><tt>osArchitecture</tt></td>
- * <td>Operating system architecture</td>
- * <td> e.g. sparc</td>
- * </tr>
- * <tr>
- * <td><tt>systemModel</tt></td>
- * <td>System model</td>
- * <td> e.g. SUNW,Sun-Fire-V440</td>
- * </tr>
- * <tr>
- * <td><tt>systemManufacturer</tt></td>
- * <td>System manufacturer</td>
- * <td> e.g. Sun Microsystems</td>
- * </tr>
- * <tr>
- * <td><tt>cpuManufacturer</tt></td>
- * <td>CPU manufacturer</td>
- * <td> e.g. Sun Microsystems</td>
- * </tr>
- * <tr>
- * <td><tt>serialNumber</tt></td>
- * <td>System serial number</td>
- * <td> e.g. BEL078932</td>
- * </tr>
- * </table>
- * </blockquote>
- * The <tt>hostname</tt> and <tt>osName</tt> element must have a non-empty value.
- * If an element is not available on a system and their value will be
- * empty.
- * <p>
- * <a name="XMLSchema">
- * <b>Registration XML Schema</b></a>
- * <p>
- * A {@code RegistrationData} object can be {@link #loadFromXML loaded} from
- * and {@link #storeToXML stored} into an XML file in the format described
- * by the
- * <a href="https://sn-tools.central.sun.com/twiki/pub/ServiceTags/RegistrationRelayService/product_registration.xsd">
- * registration data schema</a>. The registration data schema is defined by the
- * Service Tags Technology.
- * <p>
- * Typically the registration data is constructed at installation time
- * and stored in an XML file for later service tag lookup or registration.
- *
- * <p>
- * <b>Example Usage</b>
- * <p>
- * The examples below show how the {@code RegistrationData} can be
- * used for product registration.
- * Exception handling is not shown in these examples for clarity.
- * <ol>
- * <li>This example shows how the JDK creates a JDK service tag, installs it
- * in the system service tag registry and adds it to the registration data.
- * <br>
- * <blockquote><pre>
- * // create a service tag object with an instance_urn
- * ServiceTag st = ServiceTag.newInstance(ServiceTag.generateInstanceURN(),
- * ....);
- * // Adds to the system service tag registry if supported
- * if (Registry.isSupported()) {
- * Registry.getSystemRegistry().addServiceTag(st);
- * }
- *
- * // add to the registration data
- * RegistrationData registration = new RegistrationData();
- * registration.addServiceTag(st);
- * </pre></blockquote>
- * </li>
- * <li>At this point, the registration data is ready to
- * send to Sun Connection for registration. This example shows how to register
- * the JDK via the <i>Registration Relay Service</i>.
- * <p>
- * There are several registration services for Sun Connection. For example,
- * the <a href="https://sn-tools.central.sun.com/twiki/bin/view/ServiceTags/RegistrationRelayService">
- * Registration Relay Service</a> is a web application interface that
- * processes the registration data payload sent via HTTP post
- * and hosts the registration user interface for a specified
- * registration URL. Refer to the
- * Registration Relay Service Specification for details.
- * <p>
- * <blockquote><pre>
- * // Open the connection to the URL of the registration service
- * HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
- * con.setDoInput(true);
- * con.setDoOutput(true);
- * con.setUseCaches(false);
- * con.setAllowUserInteraction(false);
- * con.setRequestMethod("POST");
- * con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
- * con.connect();
- *
- * // send the registration data to the registration service
- * OutputStream out = con.getOutputStream();
- * registration.storeToXML(out);
- * out.close();
- * </pre></blockquote>
- * </li>
- * <li>This example shows how to store the registration data in an XML file.
- * for later service tag lookup or registration.
- * <br>
- * <blockquote><pre>
- * BufferedOutputStream out = new BufferedOutputStream(
- * new FileOutputStream(""&lt;JAVA_HOME&gt;/lib/servicetag/registration.xml"));
- * registration.storeToXML(out);
- * out.close();
- * </pre></blockquote>
- * </li>
- * <li>This example shows how to install service tags that are in the
- * registration data in the system service tag registry when determined
- * to be available. The system service tag registry might not have existed
- * when the registration data was constructed.
- * <br>
- * <blockquote><pre>
- * if (Registry.isSupported()) {
- * Set&lt;ServiceTag&gt; svctags = registration.getServiceTags();
- * for (ServiceTag st : svctags) {
- * Registry.getSystemRegistry().addServiceTag(st);
- * }
- * }
- * </pre></blockquote>
- * </li>
- * </ol>
- *
- * @see <a href="https://sunconnection.sun.com/inventory">Sun Connection Inventory Channel</a>
- */
-public class RegistrationData {
- private final Map<String, String> environment;
- private final Map<String, ServiceTag> svcTagMap;
- private final String urn;
-
- /**
- * Creates a {@code RegistrationData} object with a generated
- * {@link #getRegistrationURN registration URN}.
- * The following keys in the {@link #getEnvironmentMap environment map}
- * will be initialized for the configuration of the
- * running system:
- * <blockquote>
- * <tt>hostname</tt>, <tt>osName</tt>, <tt>osVersion</tt> and
- * <tt>osArchitecture</tt>
- * </blockquote>
- * and the value of other keys may be empty.
- */
- public RegistrationData() {
- this(Util.generateURN());
- }
-
- // package private
- RegistrationData(String urn) {
- this.urn = urn;
- this.environment = initEnvironment();
- this.svcTagMap = new LinkedHashMap<String, ServiceTag>();
- }
-
- private Map<String, String> initEnvironment() {
- Map<String, String> map = new LinkedHashMap<String, String>();
- SystemEnvironment sysEnv = SystemEnvironment.getSystemEnvironment();
- map.put(ST_NODE_HOSTNAME, sysEnv.getHostname());
- map.put(ST_NODE_HOST_ID, sysEnv.getHostId());
- map.put(ST_NODE_OS_NAME, sysEnv.getOsName());
- map.put(ST_NODE_OS_VERSION, sysEnv.getOsVersion());
- map.put(ST_NODE_OS_ARCH, sysEnv.getOsArchitecture());
- map.put(ST_NODE_SYSTEM_MODEL, sysEnv.getSystemModel());
- map.put(ST_NODE_SYSTEM_MANUFACTURER, sysEnv.getSystemManufacturer());
- map.put(ST_NODE_CPU_MANUFACTURER, sysEnv.getCpuManufacturer());
- map.put(ST_NODE_SERIAL_NUMBER, sysEnv.getSerialNumber());
- return map;
- }
-
- /**
- * Returns the uniform resource name of this registration data
- * in this format:
- * <tt>urn:st:&lt;32-char {@link java.util.UUID uuid}&gt;</tt>
- *
- * @return the URN of this registration data.
- */
- public String getRegistrationURN() {
- return urn;
- }
-
- /**
- * Returns a map containing the environment information for this
- * registration data. See the set of <a href="#EnvMap">keys</a>
- * in the environment map. Subsequent update to the environment
- * map via the {@link #setEnvironment setEnvironment} method will not be reflected
- * in the returned map.
- *
- * @return an environment map for this registration data.
- */
- public Map<String, String> getEnvironmentMap() {
- return new LinkedHashMap<String,String>(environment);
- }
-
- /**
- * Sets an element of the specified {@code name} in the environment map
- * with the given {@code value}.
- *
- * @throws IllegalArgumentException if {@code name} is not a valid key
- * in the environment map, or {@code value} is not valid.
- */
- public void setEnvironment(String name, String value) {
- if (name == null) {
- throw new NullPointerException("name is null");
- }
- if (value == null) {
- throw new NullPointerException("value is null");
- }
- if (environment.containsKey(name)) {
- if (name.equals(ST_NODE_HOSTNAME) || name.equals(ST_NODE_OS_NAME)) {
- if (value.length() == 0) {
- throw new IllegalArgumentException("\"" +
- name + "\" requires non-empty value.");
- }
- }
- environment.put(name, value);
- } else {
- throw new IllegalArgumentException("\"" +
- name + "\" is not an environment element.");
- }
- }
-
- /**
- * Returns all service tags in this registration data.
- *
- * @return a {@link Set Set} of the service tags
- * in this registration data.
- */
- public Set<ServiceTag> getServiceTags() {
- return new HashSet<ServiceTag>(svcTagMap.values());
- }
-
- /**
- * Adds a service tag to this registration data.
- * If the given service tag has an empty <tt>instance_urn</tt>,
- * this method will generate a URN and place it in the copy
- * of the service tag in this registration data.
- * This method will return the {@code ServiceTag} object
- * added to this registration data.
- *
- * @param st {@code ServiceTag} object to be added.
- * @return a {@code ServiceTag} object added to this registration data.
- *
- * @throws IllegalArgumentException if
- * a service tag of the same {@link ServiceTag#getInstanceURN
- * <tt>instance_urn</tt>} already exists in the registry.
- */
- public synchronized ServiceTag addServiceTag(ServiceTag st) {
- ServiceTag svcTag = ServiceTag.newInstanceWithUrnTimestamp(st);
-
- String instanceURN = svcTag.getInstanceURN();
- if (svcTagMap.containsKey(instanceURN)) {
- throw new IllegalArgumentException("Instance_urn = " + instanceURN +
- " already exists in the registration data.");
- } else {
- svcTagMap.put(instanceURN, svcTag);
- }
- return svcTag;
- }
-
- /**
- * Returns a service tag of the given <tt>instance_urn</tt> in this registration
- * data.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag
- * @return the {@code ServiceTag} object of the given <tt>instance_urn</tt>
- * if exists; otherwise return {@code null}.
- */
- public synchronized ServiceTag getServiceTag(String instanceURN) {
- if (instanceURN == null) {
- throw new NullPointerException("instanceURN is null");
- }
- return svcTagMap.get(instanceURN);
- }
-
- /**
- * Removes a service tag of the given <tt>instance_urn</tt> from this
- * registration data.
- *
- * @param instanceURN the <tt>instance_urn</tt> of
- * the service tag to be removed.
- *
- * @return the removed {@code ServiceTag} object;
- * or {@code null} if the service tag does not exist in this
- * registration data.
- */
- public synchronized ServiceTag removeServiceTag(String instanceURN) {
- if (instanceURN == null) {
- throw new NullPointerException("instanceURN is null");
- }
-
- ServiceTag svcTag = null;
- if (svcTagMap.containsKey(instanceURN)) {
- svcTag = svcTagMap.remove(instanceURN);
- }
- return svcTag;
- }
-
- /**
- * Updates the <tt>product_defined_instance_id</tt> in the service tag
- * of the given <tt>instance_urn</tt> in this registration data.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag to be updated.
- * @param productDefinedInstanceID the value of the
- * <tt>product_defined_instance_id</tt> to be set.
- *
- * @return the updated {@code ServiceTag} object;
- * or {@code null} if the service tag does not exist in this
- * registration data.
- */
- public synchronized ServiceTag updateServiceTag(String instanceURN,
- String productDefinedInstanceID) {
- ServiceTag svcTag = getServiceTag(instanceURN);
- if (svcTag == null) {
- return null;
- }
-
- svcTag = ServiceTag.newInstanceWithUrnTimestamp(svcTag);
- // update the product defined instance ID field
- svcTag.setProductDefinedInstanceID(productDefinedInstanceID);
- svcTagMap.put(instanceURN, svcTag);
- return svcTag;
- }
-
- /**
- * Reads the registration data from the XML document on the
- * specified input stream. The XML document must be
- * in the format described by the <a href="#XMLSchema">
- * registration data schema</a>.
- * The specified stream is closed after this method returns.
- *
- * @param in the input stream from which to read the XML document.
- * @return a {@code RegistrationData} object read from the input
- * stream.
- *
- * @throws IllegalArgumentException if the input stream
- * contains an invalid registration data.
- *
- * @throws IOException if an error occurred when reading from the input stream.
- */
- public static RegistrationData loadFromXML(InputStream in) throws IOException {
- try {
- return RegistrationDocument.load(in);
- } finally {
- in.close();
- }
- }
-
- /**
- * Writes the registration data to the specified output stream
- * in the format described by the <a href="#XMLSchema">
- * registration data schema</a> with "UTF-8" encoding.
- * The specified stream remains open after this method returns.
- *
- * @param os the output stream on which to write the XML document.
- *
- * @throws IOException if an error occurred when writing to the output stream.
- */
- public void storeToXML(OutputStream os) throws IOException {
- RegistrationDocument.store(os, this);
- os.flush();
- }
-
- /**
- * Returns a newly allocated byte array containing the registration
- * data in XML format.
- *
- * @return a newly allocated byte array containing the registration
- * data in XML format.
- */
- public byte[] toXML() {
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- storeToXML(out);
- return out.toByteArray();
- } catch (IOException e) {
- // should not reach here
- return new byte[0];
- }
- }
-
- /**
- * Returns a string representation of this registration data in XML
- * format.
- *
- * @return a string representation of this registration data in XML
- * format.
- */
- @Override
- public String toString() {
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- storeToXML(out);
- return out.toString("UTF-8");
- } catch (IOException e) {
- // should not reach here
- return "Error creating the return string.";
- }
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/RegistrationDocument.java b/setup_native/source/registration/com/sun/star/servicetag/RegistrationDocument.java
deleted file mode 100644
index 240eebf4e65c..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/RegistrationDocument.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: RegistrationDocument.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-import org.xml.sax.InputSource;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
-// For write operation
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-/**
- * XML Support Class for Product Registration.
- */
-class RegistrationDocument {
-
- private static final String REGISTRATION_DATA_SCHEMA =
- "/com/sun/star/servicetag/resources/product_registration.xsd";
- private static final String REGISTRATION_DATA_VERSION = "1.0";
- private static final String SERVICE_TAG_VERSION = "1.0";
- final static String ST_NODE_REGISTRATION_DATA = "registration_data";
- final static String ST_ATTR_REGISTRATION_VERSION = "version";
- final static String ST_NODE_ENVIRONMENT = "environment";
- final static String ST_NODE_HOSTNAME = "hostname";
- final static String ST_NODE_HOST_ID = "hostId";
- final static String ST_NODE_OS_NAME = "osName";
- final static String ST_NODE_OS_VERSION = "osVersion";
- final static String ST_NODE_OS_ARCH = "osArchitecture";
- final static String ST_NODE_SYSTEM_MODEL = "systemModel";
- final static String ST_NODE_SYSTEM_MANUFACTURER = "systemManufacturer";
- final static String ST_NODE_CPU_MANUFACTURER = "cpuManufacturer";
- final static String ST_NODE_SERIAL_NUMBER = "serialNumber";
- final static String ST_NODE_REGISTRY = "registry";
- final static String ST_ATTR_REGISTRY_URN = "urn";
- final static String ST_ATTR_REGISTRY_VERSION = "version";
- final static String ST_NODE_SERVICE_TAG = "service_tag";
- final static String ST_NODE_INSTANCE_URN = "instance_urn";
- final static String ST_NODE_PRODUCT_NAME = "product_name";
- final static String ST_NODE_PRODUCT_VERSION = "product_version";
- final static String ST_NODE_PRODUCT_URN = "product_urn";
- final static String ST_NODE_PRODUCT_PARENT_URN = "product_parent_urn";
- final static String ST_NODE_PRODUCT_PARENT = "product_parent";
- final static String ST_NODE_PRODUCT_DEFINED_INST_ID = "product_defined_inst_id";
- final static String ST_NODE_PRODUCT_VENDOR = "product_vendor";
- final static String ST_NODE_PLATFORM_ARCH = "platform_arch";
- final static String ST_NODE_TIMESTAMP = "timestamp";
- final static String ST_NODE_CONTAINER = "container";
- final static String ST_NODE_SOURCE = "source";
- final static String ST_NODE_INSTALLER_UID = "installer_uid";
-
- static RegistrationData load(InputStream in) throws IOException {
- Document document = initializeDocument(in);
-
- // Gets the registration URN
- Element root = getRegistrationDataRoot(document);
- Element registryRoot =
- getSingletonElementFromRoot(root, ST_NODE_REGISTRY);
- String urn = registryRoot.getAttribute(ST_ATTR_REGISTRY_URN);
-
- // Construct a new RegistrationData object from the DOM tree
- // Initialize the environment map and service tags
- RegistrationData regData = new RegistrationData(urn);
- addServiceTags(registryRoot, regData);
-
- Element envRoot = getSingletonElementFromRoot(root, ST_NODE_ENVIRONMENT);
- buildEnvironmentMap(envRoot, regData);
- return regData;
- }
-
- static void store(OutputStream os, RegistrationData registration)
- throws IOException {
- // create a new document with the root node
- Document document = initializeDocument();
-
- // create the nodes for the environment map and the service tags
- // in the registration data
- addEnvironmentNodes(document,
- registration.getEnvironmentMap());
- addServiceTagRegistry(document,
- registration.getRegistrationURN(),
- registration.getServiceTags());
- transform(document, os);
- }
-
- // initialize a document from an input stream
- private static Document initializeDocument(InputStream in) throws IOException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- try {
- // XML schema for validation
- SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- URL xsdUrl = RegistrationDocument.class.getResource(REGISTRATION_DATA_SCHEMA);
- Schema schema = sf.newSchema(xsdUrl);
- Validator validator = schema.newValidator();
-
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(new InputSource(in));
- validator.validate(new DOMSource(doc));
- return doc;
- } catch (SAXException sxe) {
- IllegalArgumentException e = new IllegalArgumentException("Error generated in parsing");
- e.initCause(sxe);
- throw e;
- } catch (ParserConfigurationException pce) {
- // Parser with specific options can't be built
- // should not reach here
- InternalError x = new InternalError("Error in creating the new document");
- x.initCause(pce);
- throw x;
- }
- }
-
- // initialize a new document for the registration data
- private static Document initializeDocument() throws IOException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- try {
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.newDocument();
-
- // initialize the document with the registration_data root
- Element root = doc.createElement(ST_NODE_REGISTRATION_DATA);
- doc.appendChild(root);
- root.setAttribute(ST_ATTR_REGISTRATION_VERSION, REGISTRATION_DATA_VERSION);
-
- return doc;
- } catch (ParserConfigurationException pce) {
- // Parser with specified options can't be built
- // should not reach here
- InternalError x = new InternalError("Error in creating the new document");
- x.initCause(pce);
- throw x;
- }
- }
-
- // Transform the current DOM tree with the given output stream.
- private static void transform(Document document, OutputStream os) {
- try {
- // Use a Transformer for output
- TransformerFactory tFactory = TransformerFactory.newInstance();
- tFactory.setAttribute("indent-number", new Integer(3));
-
- Transformer transformer = tFactory.newTransformer();
-
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
- transformer.transform(new DOMSource(document),
- new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8"))));
- } catch (UnsupportedEncodingException ue) {
- // Should not reach here
- InternalError x = new InternalError("Error generated during transformation");
- x.initCause(ue);
- throw x;
- } catch (TransformerConfigurationException tce) {
- // Error generated by the parser
- // Should not reach here
- InternalError x = new InternalError("Error in creating the new document");
- x.initCause(tce);
- throw x;
- } catch (TransformerException te) {
- // Error generated by the transformer
- InternalError x = new InternalError("Error generated during transformation");
- x.initCause(te);
- throw x;
- }
- }
-
- private static void addServiceTagRegistry(Document document,
- String registryURN,
- Set<ServiceTag> svcTags) {
- // add service tag registry node and its attributes
- Element reg = document.createElement(ST_NODE_REGISTRY);
- reg.setAttribute(ST_ATTR_REGISTRY_URN, registryURN);
- reg.setAttribute(ST_ATTR_REGISTRY_VERSION, SERVICE_TAG_VERSION);
-
- Element root = getRegistrationDataRoot(document);
- root.appendChild(reg);
-
- // adds the elements for the service tags
- for (ServiceTag st : svcTags) {
- addServiceTagElement(document, reg, st);
- }
- }
-
- private static void addServiceTagElement(Document document,
- Element registryRoot,
- ServiceTag st) {
- Element svcTag = document.createElement(ST_NODE_SERVICE_TAG);
- registryRoot.appendChild(svcTag);
- addChildElement(document, svcTag,
- ST_NODE_INSTANCE_URN, st.getInstanceURN());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_NAME, st.getProductName());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_VERSION, st.getProductVersion());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_URN, st.getProductURN());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_PARENT_URN, st.getProductParentURN());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_PARENT, st.getProductParent());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_DEFINED_INST_ID,
- st.getProductDefinedInstanceID());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_VENDOR, st.getProductVendor());
- addChildElement(document, svcTag,
- ST_NODE_PLATFORM_ARCH, st.getPlatformArch());
- addChildElement(document, svcTag,
- ST_NODE_TIMESTAMP, Util.formatTimestamp(st.getTimestamp()));
- addChildElement(document, svcTag,
- ST_NODE_CONTAINER, st.getContainer());
- addChildElement(document, svcTag,
- ST_NODE_SOURCE, st.getSource());
- addChildElement(document, svcTag,
- ST_NODE_INSTALLER_UID,
- String.valueOf(st.getInstallerUID()));
- }
-
- private static void addChildElement(Document document, Element root,
- String element, String text) {
- Element node = document.createElement(element);
- node.appendChild(document.createTextNode(text));
- root.appendChild(node);
- }
-
- // Constructs service tags from the document
- private static void addServiceTags(Element registryRoot,
- RegistrationData registration) {
- NodeList children = registryRoot.getElementsByTagName(ST_NODE_SERVICE_TAG);
- int length = (children == null ? 0 : children.getLength());
- for (int i = 0; i < length; i++) {
- Element svcTagElement = (Element) children.item(i);
- ServiceTag st = getServiceTag(svcTagElement);
- registration.addServiceTag(st);
- }
- }
-
- // build environment map from the document
- private static void buildEnvironmentMap(Element envRoot,
- RegistrationData registration) {
- registration.setEnvironment(ST_NODE_HOSTNAME, getTextValue(envRoot, ST_NODE_HOSTNAME));
- registration.setEnvironment(ST_NODE_HOST_ID, getTextValue(envRoot, ST_NODE_HOST_ID));
- registration.setEnvironment(ST_NODE_OS_NAME, getTextValue(envRoot, ST_NODE_OS_NAME));
- registration.setEnvironment(ST_NODE_OS_VERSION, getTextValue(envRoot, ST_NODE_OS_VERSION));
- registration.setEnvironment(ST_NODE_OS_ARCH, getTextValue(envRoot, ST_NODE_OS_ARCH));
- registration.setEnvironment(ST_NODE_SYSTEM_MODEL, getTextValue(envRoot, ST_NODE_SYSTEM_MODEL));
- registration.setEnvironment(ST_NODE_SYSTEM_MANUFACTURER, getTextValue(envRoot, ST_NODE_SYSTEM_MANUFACTURER));
- registration.setEnvironment(ST_NODE_CPU_MANUFACTURER, getTextValue(envRoot, ST_NODE_CPU_MANUFACTURER));
- registration.setEnvironment(ST_NODE_SERIAL_NUMBER, getTextValue(envRoot, ST_NODE_SERIAL_NUMBER));
- }
-
- // add the nodes representing the environment map in the document
- private static void addEnvironmentNodes(Document document,
- Map<String, String> envMap) {
- Element root = getRegistrationDataRoot(document);
- Element env = document.createElement(ST_NODE_ENVIRONMENT);
- root.appendChild(env);
- Set<Map.Entry<String, String>> keys = envMap.entrySet();
- for (Map.Entry<String, String> entry : keys) {
- addChildElement(document, env, entry.getKey(), entry.getValue());
- }
- }
-
- private static Element getRegistrationDataRoot(Document doc) {
- Element root = doc.getDocumentElement();
- if (!root.getNodeName().equals(ST_NODE_REGISTRATION_DATA)) {
- throw new IllegalArgumentException("Not a " +
- ST_NODE_REGISTRATION_DATA +
- " node \"" + root.getNodeName() + "\"");
- }
- return root;
- }
-
- private static Element getSingletonElementFromRoot(Element root, String name) {
- NodeList children = root.getElementsByTagName(name);
- int length = (children == null ? 0 : children.getLength());
- if (length != 1) {
- throw new IllegalArgumentException("Invalid number of " + name +
- " nodes = " + length);
- }
- Element e = (Element) children.item(0);
- if (!e.getNodeName().equals(name)) {
- throw new IllegalArgumentException("Not a " + name +
- " node \"" + e.getNodeName() + "\"");
- }
- return e;
- }
-
- // Constructs one ServiceTag instance from a service tag element root
- private static ServiceTag getServiceTag(Element svcTagElement) {
- return new ServiceTag(
- getTextValue(svcTagElement, ST_NODE_INSTANCE_URN),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_NAME),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_VERSION),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_URN),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT_URN),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_DEFINED_INST_ID),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_VENDOR),
- getTextValue(svcTagElement, ST_NODE_PLATFORM_ARCH),
- getTextValue(svcTagElement, ST_NODE_CONTAINER),
- getTextValue(svcTagElement, ST_NODE_SOURCE),
- Util.getIntValue(getTextValue(svcTagElement, ST_NODE_INSTALLER_UID)),
- Util.parseTimestamp(getTextValue(svcTagElement, ST_NODE_TIMESTAMP))
- );
- }
-
- private static String getTextValue(Element e, String tagName) {
- String value = "";
- NodeList nl = e.getElementsByTagName(tagName);
- if (nl != null && nl.getLength() > 0) {
- Element el = (Element) nl.item(0);
- Node node = el.getFirstChild();
- if (node != null) {
- value = node.getNodeValue();
- }
- }
- return value;
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/Registry.java b/setup_native/source/registration/com/sun/star/servicetag/Registry.java
deleted file mode 100644
index c118dc2e2575..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/Registry.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: Registry.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import static com.sun.star.servicetag.Util.*;
-import static com.sun.star.servicetag.RegistrationDocument.*;
-
-/**
- * A service tag registry is a XML-based registry containing
- * the list of {@link ServiceTag service tags} installed in the system.
- * The {@code Registry} class provides interfaces
- * to add, remove, update, and get a service tag from a service tag
- * registry.
- * This {@code Registry} class may not be supported
- * on all systems. The {@link #isSupported} method
- * can be called to determine if it is supported.
- * <p>
- * A registry may implement restrictions to only allow certain users
- * to {@link #updateServiceTag update} and
- * to {@link #removeServiceTag remove} a service tag record. Typically,
- * only the owner of the service tag, the owner of the registry
- * and superuser are authorized to update or remove a service tag in
- * the registry.
- *
- * @see <a href="https://sn-tools.central.sun.com/twiki/bin/view/ServiceTags/ServiceTagDevGuideHelper">
- * Service Tag User Guide</a>
- */
-public class Registry {
-
- private static final String STCLIENT_SOLARIS = "/usr/bin/stclient";
- private static final String STCLIENT_LINUX = "/opt/sun/servicetag/bin/stclient";
- // stclient exit value (see sthelper.h)
- private static final int ST_ERR_NOT_AUTH = 245;
- private static final int ST_ERR_REC_NOT_FOUND = 225;
-
- // The stclient output has to be an exported interface
- private static final String INSTANCE_URN_DESC = "Product instance URN=";
- private static boolean initialized = false;
- private static boolean supportsHelperClass = true; // default
- private static File stclient = null;
- private static String stclientPath = null;
- private static Registry registry = new Registry();
-
- // System properties for testing
- private static String SVCTAG_STCLIENT_CMD = "servicetag.stclient.cmd";
- private static String SVCTAG_STHELPER_SUPPORTED = "servicetag.sthelper.supported";
-
- private Registry() {
- }
-
- private synchronized static String getSTclient() {
- if (!initialized) {
- // the system property always overrides the default setting
- if (System.getProperty(SVCTAG_STHELPER_SUPPORTED) != null) {
- supportsHelperClass = Boolean.getBoolean(SVCTAG_STHELPER_SUPPORTED);
- }
-
- // This is only used for testing
- stclientPath = System.getProperty(SVCTAG_STCLIENT_CMD);
- if (stclientPath != null) {
- return stclientPath;
- }
-
- // Initialization to determine the platform's stclient pathname
- String os = System.getProperty("os.name");
- if (os.equals("SunOS")) {
- stclient = new File(STCLIENT_SOLARIS);
- } else if (os.equals("Linux")) {
- stclient = new File(STCLIENT_LINUX);
- } else if (os.startsWith("Windows")) {
- stclient = getWindowsStClientFile();
- } else {
- if (isVerbose()) {
- System.out.println("Running on non-Sun JDK");
- }
- }
- initialized = true;
- }
-
- // com.sun.servicetag package has to be compiled with JDK 5 as well
- // JDK 5 doesn't support the File.canExecute() method.
- // Risk not checking isExecute() for the stclient command is very low.
-
- if (stclientPath == null && stclient != null && stclient.exists()) {
- stclientPath = stclient.getAbsolutePath();
- }
- return stclientPath;
- }
-
- /**
- * Returns the system service tag registry. The {@code Registry} class
- * may not be supported on some platforms; use the {@link #isSupported}
- * method to determine if it is supported.
- *
- * @return the {@code Registry} object for the system service tag registry.
- *
- * @throws UnsupportedOperationException if the {@code Registry} class is
- * not supported.
- */
- public static Registry getSystemRegistry() {
- if (isSupported()) {
- return registry;
- } else {
- throw new UnsupportedOperationException("Registry class is not supported");
- }
- }
-
- /**
- * Returns {@code true} if the {@code Registry} class is supported on this system.
- *
- * @return {@code true} if the {@code Registry} class is supported;
- * otherwise, return {@code false}.
- */
- public static boolean isSupported() {
- return (getSTclient() != null && supportsHelperClass);
- }
-
- private static List<String> getCommandList() {
- // Set up the arguments to call stclient
- List<String> command = new ArrayList<String>();
- if (System.getProperty(SVCTAG_STCLIENT_CMD) != null) {
- // This is for jtreg testing use. This will be set to something
- // like:
- // $JAVA_HOME/bin/java -cp $TEST_DIR \
- // -Dstclient.registry.path=$TEST_DIR/registry.xml \
- // SvcTagClient
- //
- // On Windows, the JAVA_HOME and TEST_DIR path could contain
- // space e.g. c:\Program Files\Java\jdk1.6.0_05\bin\java.
- // The SVCTAG_STCLIENT_CMD must be set with a list of
- // space-separated parameters. If a parameter contains spaces,
- // it must be quoted with '"'.
-
- String cmd = getSTclient();
- int len = cmd.length();
- int i = 0;
- while (i < len) {
- char separator = ' ';
- if (cmd.charAt(i) == '"') {
- separator = '"';
- i++;
- }
- // look for the separator or matched the closing '"'
- int j;
- for (j = i+1; j < len; j++) {
- if (cmd.charAt(j) == separator) {
- break;
- }
- }
-
- if (i == j-1) {
- // add an empty parameter
- command.add("\"\"");
- } else {
- // double quotes and space are not included
- command.add(cmd.substring(i,j));
- }
-
- // skip spaces
- for (i = j+1; i < len; i++) {
- if (!Character.isSpaceChar(cmd.charAt(i))) {
- break;
- }
- }
- }
- if (isVerbose()) {
- System.out.println("Command list:");
- for (String s : command) {
- System.out.println(s);
- }
- }
- } else {
- command.add(getSTclient());
- }
- return command;
- }
-
- // Returns null if the service tag record not found;
- // or throw UnauthorizedAccessException or IOException
- // based on the exitValue.
- private static ServiceTag checkReturnError(int exitValue,
- String output,
- ServiceTag st) throws IOException {
- switch (exitValue) {
- case ST_ERR_REC_NOT_FOUND:
- return null;
- case ST_ERR_NOT_AUTH:
- if (st != null) {
- throw new UnauthorizedAccessException(
- "Not authorized to access " + st.getInstanceURN() +
- " installer_uid=" + st.getInstallerUID());
- } else {
- throw new UnauthorizedAccessException(
- "Not authorized:" + output);
- }
- default:
- throw new IOException("stclient exits with error" +
- " (" + exitValue + ")\n" + output);
- }
- }
-
- /**
- * Adds a service tag to this registry.
- * If the given service tag has an empty <tt>instance_urn</tt>,
- * this helper class will generate a URN and place it in the
- * copy of the service tag in this registry.
- * This method will return the {@code ServiceTag} representing
- * the service tag entry to this registry.
- *
- * @param st {@code ServiceTag} object
- * @return a {@code ServiceTag} object representing the service tag
- * entry to this registry.
- *
- * @throws IllegalArgumentException if a service tag of the same
- * <tt>instance_urn</tt> already exists in this registry.
- *
- * @throws java.io.IOException if an I/O error occurs in this operation.
- */
- public ServiceTag addServiceTag(ServiceTag st) throws IOException {
- List<String> command = getCommandList();
- command.add("-a");
- if (st.getInstanceURN().length() > 0) {
- ServiceTag sysSvcTag = getServiceTag(st.getInstanceURN());
- if (sysSvcTag != null) {
- throw new IllegalArgumentException("Instance_urn = " +
- st.getInstanceURN() + " already exists");
- }
- command.add("-i");
- command.add(st.getInstanceURN());
- }
- command.add("-p");
- command.add(st.getProductName());
- command.add("-e");
- command.add(st.getProductVersion());
- command.add("-t");
- command.add(st.getProductURN());
- if (st.getProductParentURN().length() > 0) {
- command.add("-F");
- command.add(st.getProductParentURN());
- }
- command.add("-P");
- command.add(st.getProductParent());
- if (st.getProductDefinedInstanceID().length() > 0) {
- command.add("-I");
- command.add(st.getProductDefinedInstanceID());
- }
- command.add("-m");
- command.add(st.getProductVendor());
- command.add("-A");
- command.add(st.getPlatformArch());
- command.add("-z");
- command.add(st.getContainer());
- command.add("-S");
- command.add(st.getSource());
-
- BufferedReader in = null;
- try {
- ProcessBuilder pb = new ProcessBuilder(command);
- Process p = pb.start();
- String output = commandOutput(p);
- if (isVerbose()) {
- System.out.println("Output from stclient -a command:");
- System.out.println(output);
- }
- String urn = "";
- if (p.exitValue() == 0) {
- // Obtain the instance urn from the stclient output
- in = new BufferedReader(new StringReader(output));
- String line = null;
- while ((line = in.readLine()) != null) {
- line = line.trim();
- if (line.startsWith(INSTANCE_URN_DESC)) {
- urn = line.substring(INSTANCE_URN_DESC.length());
- break;
- }
- }
- if (urn.length() == 0) {
- throw new IOException("Error in creating service tag:\n" +
- output);
- }
- return getServiceTag(urn);
- } else {
- return checkReturnError(p.exitValue(), output, st);
- }
- } finally {
- if (in != null) {
- in.close();
- }
- }
- }
-
- /**
- * Removes a service tag of the given <tt>instance_urn</tt> from this
- * registry.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag
- * to be removed.
- *
- * @return the {@code ServiceTag} object removed from this registry;
- * or {@code null} if the service tag does not exist in this registry.
- *
- * @throws UnauthorizedAccessException if the user is not authorized to
- * remove the service tag of the given <tt>instance_urn</tt>
- * from this registry.
- *
- * @throws java.io.IOException if an I/O error occurs in this operation.
- */
- public ServiceTag removeServiceTag(String instanceURN) throws IOException {
- ServiceTag st = getServiceTag(instanceURN);
- if (st == null) {
- return null;
- }
-
- List<String> command = getCommandList();
- command.add("-d");
- command.add("-i");
- command.add(instanceURN);
-
- ProcessBuilder pb = new ProcessBuilder(command);
- Process p = pb.start();
- String output = commandOutput(p);
- if (isVerbose()) {
- System.out.println("Output from stclient -d command:");
- System.out.println(output);
- }
- if (p.exitValue() == 0) {
- return st;
- } else {
- return checkReturnError(p.exitValue(), output, st);
- }
- }
-
- /**
- * Updates the <tt>product_defined_instance_id</tt> in the service tag
- * of the specified <tt>instance_urn</tt> in this registry.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag to be updated.
- * @param productDefinedInstanceID the value of the
- * <tt>product_defined_instance_id</tt> to be set.
- *
- * @return the updated {@code ServiceTag} object;
- * or {@code null} if the service tag does not exist in this
- * registry.
- *
- * @throws UnauthorizedAccessException if the user is not authorized to
- * update the service tag from this registry.
- *
- * @throws IOException if an I/O error occurs in this operation.
- */
- public ServiceTag updateServiceTag(String instanceURN,
- String productDefinedInstanceID)
- throws IOException {
- ServiceTag svcTag = getServiceTag(instanceURN);
- if (svcTag == null) {
- return null;
- }
-
- List<String> command = getCommandList();
- command.add("-u");
- command.add("-i");
- command.add(instanceURN);
- command.add("-I");
- if (productDefinedInstanceID.length() > 0) {
- command.add(productDefinedInstanceID);
- } else {
- command.add("\"\"");
- }
-
- ProcessBuilder pb = new ProcessBuilder(command);
- Process p = pb.start();
- String output = commandOutput(p);
- if (isVerbose()) {
- System.out.println("Output from stclient -u command:");
- System.out.println(output);
- }
-
- if (p.exitValue() == 0) {
- return getServiceTag(instanceURN);
- } else {
- return checkReturnError(p.exitValue(), output, svcTag);
- }
- }
-
- /**
- * Returns a {@code ServiceTag} object of the given <tt>instance_urn</tt>
- * in this registry.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag
- * @return a {@code ServiceTag} object of the given <tt>instance_urn</tt>
- * in this registry; or {@code null} if not found.
- *
- * @throws java.io.IOException if an I/O error occurs in this operation.
- */
- public ServiceTag getServiceTag(String instanceURN) throws IOException {
- if (instanceURN == null) {
- throw new NullPointerException("instanceURN is null");
- }
-
- List<String> command = getCommandList();
- command.add("-g");
- command.add("-i");
- command.add(instanceURN);
-
- ProcessBuilder pb = new ProcessBuilder(command);
- Process p = pb.start();
- String output = commandOutput(p);
- if (isVerbose()) {
- System.out.println("Output from stclient -g command:");
- System.out.println(output);
- }
- if (p.exitValue() == 0) {
- return parseServiceTag(output);
- } else {
- return checkReturnError(p.exitValue(), output, null);
- }
- }
-
- private ServiceTag parseServiceTag(String output) throws IOException {
- BufferedReader in = null;
- try {
- Properties props = new Properties();
- // parse the service tag output from stclient
- in = new BufferedReader(new StringReader(output));
- String line = null;
- while ((line = in.readLine()) != null) {
- if ((line = line.trim()).length() > 0) {
- String[] ss = line.trim().split("=", 2);
- if (ss.length == 2) {
- props.setProperty(ss[0].trim(), ss[1].trim());
- } else {
- props.setProperty(ss[0].trim(), "");
- }
- }
- }
-
- String urn = props.getProperty(ST_NODE_INSTANCE_URN);
- String productName = props.getProperty(ST_NODE_PRODUCT_NAME);
- String productVersion = props.getProperty(ST_NODE_PRODUCT_VERSION);
- String productURN = props.getProperty(ST_NODE_PRODUCT_URN);
- String productParent = props.getProperty(ST_NODE_PRODUCT_PARENT);
- String productParentURN = props.getProperty(ST_NODE_PRODUCT_PARENT_URN);
- String productDefinedInstanceID =
- props.getProperty(ST_NODE_PRODUCT_DEFINED_INST_ID);
- String productVendor = props.getProperty(ST_NODE_PRODUCT_VENDOR);
- String platformArch = props.getProperty(ST_NODE_PLATFORM_ARCH);
- String container = props.getProperty(ST_NODE_CONTAINER);
- String source = props.getProperty(ST_NODE_SOURCE);
- int installerUID =
- Util.getIntValue(props.getProperty(ST_NODE_INSTALLER_UID));
- Date timestamp =
- Util.parseTimestamp(props.getProperty(ST_NODE_TIMESTAMP));
-
- return new ServiceTag(urn,
- productName,
- productVersion,
- productURN,
- productParent,
- productParentURN,
- productDefinedInstanceID,
- productVendor,
- platformArch,
- container,
- source,
- installerUID,
- timestamp);
- } finally {
- if (in != null) {
- in.close();
- }
- }
-
- }
-
- /**
- * Returns the service tags of the specified
- * <tt>product_urn</tt> in this registry.
- *
- * @param productURN the <tt>product_urn</tt> to look up
- * @return a {@code Set} of {@code ServiceTag} objects
- * of the specified <tt>product_urn</tt> in this registry.
- *
- * @throws java.io.IOException if an I/O error occurs in this operation.
- */
- public Set<ServiceTag> findServiceTags(String productURN) throws IOException {
- if (productURN == null) {
- throw new NullPointerException("productURN is null");
- }
-
- List<String> command = getCommandList();
- command.add("-f");
- command.add("-t");
- command.add(productURN);
-
- BufferedReader in = null;
- try {
- ProcessBuilder pb = new ProcessBuilder(command);
- Process p = pb.start();
- String output = commandOutput(p);
-
- Set<ServiceTag> instances = new HashSet<ServiceTag>();
- if (p.exitValue() == 0) {
- // parse the service tag output from stclient
- in = new BufferedReader(new StringReader(output));
- String line = null;
- while ((line = in.readLine()) != null) {
- String s = line.trim();
- if (s.startsWith("urn:st:")) {
- instances.add(getServiceTag(s));
- }
- }
- } else {
- checkReturnError(p.exitValue(), output, null);
- }
- return instances;
- } finally {
- if (in != null) {
- in.close();
- }
- }
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/ServiceTag.java b/setup_native/source/registration/com/sun/star/servicetag/ServiceTag.java
deleted file mode 100644
index 4b2be9ff8cc2..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/ServiceTag.java
+++ /dev/null
@@ -1,640 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: ServiceTag.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.util.Date;
-import java.io.IOException;
-import static com.sun.star.servicetag.RegistrationDocument.*;
-
-/**
- * A service tag is an XML-based data structure that identifies a product or
- * a component on a system. The service tag schema is defined by the
- * Service Tags Technology. The location of the DTD file is platform dependent.
- * On Solaris, see <tt>/usr/share/lib/xml/dtd/servicetag.dtd</tt>.
- * <p>
- * A valid {@code ServiceTag} instance must comply to the service tag schema
- * and contain the following fields:
- * <ul>
- * <li>{@link #getInstanceURN <tt>instance_urn</tt>}</li>
- * <li>{@link #getProductName <tt>product_name</tt>}</li>
- * <li>{@link #getProductVersion <tt>product_version</tt>}</li>
- * <li>{@link #getProductURN <tt>product_urn</tt>}</li>
- * <li>{@link #getProductParent <tt>product_parent</tt>}</li>
- * <li>{@link #getProductParentURN <tt>product_parent_urn</tt>}</li>
- * <li>{@link #getProductDefinedInstanceID <tt>product_defined_inst_id</tt>}</li>
- * <li>{@link #getProductVendor <tt>product_vendor</tt>}</li>
- * <li>{@link #getPlatformArch <tt>platform_arch</tt>}</li>
- * <li>{@link #getContainer <tt>container</tt>}</li>
- * <li>{@link #getSource <tt>source</tt>}</li>
- * <li>{@link #getInstallerUID <tt>installer_uid</tt>}</li>
- * <li>{@link #getTimestamp <tt>timestamp</tt>}</li>
- * </ul>
- *
- * The <tt>instance_urn</tt> can be specified when a {@code ServiceTag}
- * object is created, or it can be generated when it is added to
- * a {@link RegistrationData} object, or {@link Registry
- * system service tag registry}. The <tt>installer_uid</tt> and
- * <tt>timestamp</tt> are set when a {@code ServiceTag} object
- * is added to a {@link RegistrationData} object, or {@link Registry
- * system service tag registry}.
- *
- * @see <a href="https://sunconnection.sun.com/FAQ/sc_faq.html">Service Tags FAQ</a>
- */
-public class ServiceTag {
-
- private String instanceURN;
- private String productName;
- private String productVersion;
- private String productURN;
- private String productParent;
- private String productParentURN;
- private String productDefinedInstanceID;
- private String productVendor;
- private String platformArch;
- private String container;
- private String source;
- private int installerUID;
- private Date timestamp;
-
- // Service Tag Field Lengths (defined in sthelper.h)
- // Since the constants defined in sthelper.h includes the null-terminated
- // character, so minus 1 from the sthelper.h defined values.
- private final int MAX_URN_LEN = 256 - 1;
- private final int MAX_PRODUCT_NAME_LEN = 256 - 1;
- private final int MAX_PRODUCT_VERSION_LEN = 64 - 1;
- private final int MAX_PRODUCT_PARENT_LEN = 256 - 1;
- private final int MAX_PRODUCT_VENDOR_LEN = 64 - 1;
- private final int MAX_PLATFORM_ARCH_LEN = 64 - 1;
- private final int MAX_CONTAINER_LEN = 64 - 1;
- private final int MAX_SOURCE_LEN = 64 - 1;
-
- // private constructors
- private ServiceTag() {
- }
- // package private
- ServiceTag(String instanceURN,
- String productName,
- String productVersion,
- String productURN,
- String productParent,
- String productParentURN,
- String productDefinedInstanceID,
- String productVendor,
- String platformArch,
- String container,
- String source,
- int installerUID,
- Date timestamp) {
- setInstanceURN(instanceURN);
- setProductName(productName);
- setProductVersion(productVersion);
- setProductURN(productURN);
- setProductParentURN(productParentURN);
- setProductParent(productParent);
- setProductDefinedInstanceID(productDefinedInstanceID);
- setProductVendor(productVendor);
- setPlatformArch(platformArch);
- setContainer(container);
- setSource(source);
- setInstallerUID(installerUID);
- setTimestamp(timestamp);
- }
-
- /**
- * Creates a service tag object with no <tt>instance_urn</tt>.
- *
- * @param productName the name of the product.
- * @param productVersion the version of the product.
- * @param productURN the uniform resource name of the product
- * @param productParent the name of the product's parent.
- * @param productParentURN the uniform resource name of the product's parent.
- * @param productDefinedInstanceID the instance identifier.
- * @param productVendor the vendor of the product.
- * @param platformArch the operating system architecture.
- * @param container the container of the product.
- * @param source the source of the product.
- *
- * @throws IllegalArgumentException if any value of the input fields
- * does not conform to the service tag XML schema.
- */
- public static ServiceTag newInstance(String productName,
- String productVersion,
- String productURN,
- String productParent,
- String productParentURN,
- String productDefinedInstanceID,
- String productVendor,
- String platformArch,
- String container,
- String source) {
- return new ServiceTag("", /* empty instance_urn */
- productName,
- productVersion,
- productURN,
- productParent,
- productParentURN,
- productDefinedInstanceID,
- productVendor,
- platformArch,
- container,
- source,
- -1,
- null);
- }
-
- /**
- * Creates a service tag object with a specified <tt>instance_urn</tt>.
- *
- * @param instanceURN the uniform resource name of this instance.
- * @param productName the name of the product.
- * @param productVersion the version of the product.
- * @param productURN the uniform resource name of the product
- * @param productParent the name of the product's parent.
- * @param productParentURN the uniform resource name of the product's parent.
- * @param productDefinedInstanceID the instance identifier.
- * @param productVendor the vendor of the product.
- * @param platformArch the operating system architecture.
- * @param container the container of the product.
- * @param source the source of the product.
- *
- * @throws IllegalArgumentException if any value of the input fields
- * does not conform to the service tag XML schema.
- */
- public static ServiceTag newInstance(String instanceURN,
- String productName,
- String productVersion,
- String productURN,
- String productParent,
- String productParentURN,
- String productDefinedInstanceID,
- String productVendor,
- String platformArch,
- String container,
- String source) {
- return new ServiceTag(instanceURN,
- productName,
- productVersion,
- productURN,
- productParent,
- productParentURN,
- productDefinedInstanceID,
- productVendor,
- platformArch,
- container,
- source,
- -1,
- null);
- }
-
- // Creates a copy of the ServiceTag instance
- // with instance_urn and timestamp initialized
- static ServiceTag newInstanceWithUrnTimestamp(ServiceTag st) {
- String instanceURN =
- (st.getInstanceURN().length() == 0 ? Util.generateURN() :
- st.getInstanceURN());
- ServiceTag svcTag = new ServiceTag(instanceURN,
- st.getProductName(),
- st.getProductVersion(),
- st.getProductURN(),
- st.getProductParent(),
- st.getProductParentURN(),
- st.getProductDefinedInstanceID(),
- st.getProductVendor(),
- st.getPlatformArch(),
- st.getContainer(),
- st.getSource(),
- st.getInstallerUID(),
- new Date());
- return svcTag;
- }
-
- /**
- * Returns a uniform resource name (URN) in this format:
- * <blockquote>
- * "<tt>urn:st:<32-char {@link java.util.UUID uuid}></tt>"
- * </blockquote>
- * @return a URN.
- */
- public static String generateInstanceURN() {
- return Util.generateURN();
- }
-
- /**
- * Returns the uniform resource name of this service tag instance.
- *
- * @return the <tt>instance_urn</tt> of this service tag.
- */
- public String getInstanceURN() {
- return instanceURN;
- }
-
- /**
- * Returns the name of the product.
- *
- * @return the product name.
- */
- public String getProductName() {
- return productName;
- }
-
- /**
- * Returns the version of the product.
- *
- * @return the product version.
- */
- public String getProductVersion() {
- return productVersion;
- }
-
- /**
- * Returns the uniform resource name of the product.
- *
- * @return the product URN.
- */
- public String getProductURN() {
- return productURN;
- }
-
- /**
- * Returns the uniform resource name of the product's parent.
- *
- * @return the product's parent URN.
- */
- public String getProductParentURN() {
- return productParentURN;
- }
-
- /**
- * Returns the name of the product's parent.
- *
- * @return the product's parent name.
- */
- public String getProductParent() {
- return productParent;
- }
-
- /**
- * Returns the identifier defined for this product instance.
- *
- * @return the identifier defined for this product instance.
- */
- public String getProductDefinedInstanceID() {
- return productDefinedInstanceID;
- }
-
- /**
- * Returns the vendor of the product.
- *
- * @return the product vendor.
- */
- public String getProductVendor() {
- return productVendor;
- }
-
- /**
- * Returns the platform architecture on which the product
- * is running on.
- *
- * @return the platform architecture on which the product is running on.
- */
- public String getPlatformArch() {
- return platformArch;
- }
-
- /**
- * Returns the timestamp. This timestamp is set when this service tag
- * is added to or updated in a {@code RegistrationData} object or
- * the system service tag registry.
- * This method may return {@code null}.
- *
- * @return timestamp when this service tag
- * is added to or updated in a {@code RegistrationData} object or
- * the system service tag registry, or {@code null}.
- */
- public Date getTimestamp() {
- if (timestamp != null) {
- return (Date) timestamp.clone();
- } else {
- return null;
- }
- }
-
-
- /**
- * Returns the container of the product.
- *
- * @return the container of the product.
- */
- public String getContainer() {
- return container;
- }
-
- /**
- * Returns the source of this service tag.
- *
- * @return source of this service tag.
- */
- public String getSource() {
- return source;
- }
-
- /**
- * Returns the UID. The UID is set when this service tag
- * is added to or updated in the system service tag registry.
- * This is platform dependent whose default value is {@code -1}.
- * When this service tag is added to a {@code RegistrationData},
- * the UID is not set.
- *
- * @return the UID of whom this service tag
- * is added to or updated in the system service tag registry,
- * or {@code -1}.
- */
- public int getInstallerUID() {
- return installerUID;
- }
-
- // The following setter methods are used to validate the
- // input field when constructing a ServiceTag instance
-
- private void setInstanceURN(String instanceURN) {
- if (instanceURN == null) {
- throw new NullPointerException("Parameter instanceURN cannot be null");
- }
- if (instanceURN.length() > MAX_URN_LEN) {
- throw new IllegalArgumentException("instanceURN \"" + instanceURN +
- "\" exceeds maximum length " + MAX_URN_LEN);
- }
- this.instanceURN = instanceURN;
- }
-
- private void setProductName(String productName) {
- if (productName == null) {
- throw new NullPointerException("Parameter productName cannot be null");
- }
- if (productName.length() == 0) {
- throw new IllegalArgumentException("product name cannot be empty");
- }
- if (productName.length() > MAX_PRODUCT_NAME_LEN) {
- throw new IllegalArgumentException("productName \"" + productName +
- "\" exceeds maximum length " + MAX_PRODUCT_NAME_LEN);
- }
- this.productName = productName;
- }
-
- private void setProductVersion(String productVersion) {
- if (productVersion == null) {
- throw new NullPointerException("Parameter productVersion cannot be null");
- }
-
- if (productVersion.length() == 0) {
- throw new IllegalArgumentException("product version cannot be empty");
- }
- if (productVersion.length() > MAX_PRODUCT_VERSION_LEN) {
- throw new IllegalArgumentException("productVersion \"" +
- productVersion + "\" exceeds maximum length " +
- MAX_PRODUCT_VERSION_LEN);
- }
- this.productVersion = productVersion;
- }
-
- private void setProductURN(String productURN) {
- if (productURN == null) {
- throw new NullPointerException("Parameter productURN cannot be null");
- }
- if (productURN.length() == 0) {
- throw new IllegalArgumentException("product URN cannot be empty");
- }
- if (productURN.length() > MAX_URN_LEN) {
- throw new IllegalArgumentException("productURN \"" + productURN +
- "\" exceeds maximum length " + MAX_URN_LEN);
- }
- this.productURN = productURN;
- }
-
- private void setProductParentURN(String productParentURN) {
- if (productParentURN == null) {
- throw new NullPointerException("Parameter productParentURN cannot be null");
- }
- // optional field - can be empty
- if (productParentURN.length() > MAX_URN_LEN) {
- throw new IllegalArgumentException("productParentURN \"" +
- productParentURN + "\" exceeds maximum length " +
- MAX_URN_LEN);
- }
- this.productParentURN = productParentURN;
- }
-
- private void setProductParent(String productParent) {
- if (productParent == null) {
- throw new NullPointerException("Parameter productParent cannot be null");
- }
- if (productParent.length() == 0) {
- throw new IllegalArgumentException("product parent cannot be empty");
- }
- if (productParent.length() > MAX_PRODUCT_PARENT_LEN) {
- throw new IllegalArgumentException("productParent \"" +
- productParent + "\" exceeds maximum length " +
- MAX_PRODUCT_PARENT_LEN);
- }
- this.productParent = productParent;
- }
-
- void setProductDefinedInstanceID(String productDefinedInstanceID) {
- if (productDefinedInstanceID == null) {
- throw new NullPointerException("Parameter productDefinedInstanceID cannot be null");
- }
- if (productDefinedInstanceID.length() > MAX_URN_LEN) {
- throw new IllegalArgumentException("productDefinedInstanceID \"" +
- productDefinedInstanceID + "\" exceeds maximum length " +
- MAX_URN_LEN);
- }
- // optional field - can be empty
- this.productDefinedInstanceID = productDefinedInstanceID;
- }
-
- private void setProductVendor(String productVendor) {
- if (productVendor == null) {
- throw new NullPointerException("Parameter productVendor cannot be null");
- }
- if (productVendor.length() == 0) {
- throw new IllegalArgumentException("product vendor cannot be empty");
- }
- if (productVendor.length() > MAX_PRODUCT_VENDOR_LEN) {
- throw new IllegalArgumentException("productVendor \"" +
- productVendor + "\" exceeds maximum length " +
- MAX_PRODUCT_VENDOR_LEN);
- }
- this.productVendor = productVendor;
- }
-
- private void setPlatformArch(String platformArch) {
- if (platformArch == null) {
- throw new NullPointerException("Parameter platformArch cannot be null");
- }
- if (platformArch.length() == 0) {
- throw new IllegalArgumentException("platform architecture cannot be empty");
- }
- if (platformArch.length() > MAX_PLATFORM_ARCH_LEN) {
- throw new IllegalArgumentException("platformArch \"" +
- platformArch + "\" exceeds maximum length " +
- MAX_PLATFORM_ARCH_LEN);
- }
- this.platformArch = platformArch;
- }
-
- private void setTimestamp(Date timestamp) {
- // can be null
- this.timestamp = timestamp;
- }
-
- private void setContainer(String container) {
- if (container == null) {
- throw new NullPointerException("Parameter container cannot be null");
- }
- if (container.length() == 0) {
- throw new IllegalArgumentException("container cannot be empty");
- }
- if (container.length() > MAX_CONTAINER_LEN) {
- throw new IllegalArgumentException("container \"" +
- container + "\" exceeds maximum length " +
- MAX_CONTAINER_LEN);
- }
- this.container = container;
- }
-
- private void setSource(String source) {
- if (source == null) {
- throw new NullPointerException("Parameter source cannot be null");
- }
- if (source.length() == 0) {
- throw new IllegalArgumentException("source cannot be empty");
- }
- if (source.length() > MAX_SOURCE_LEN) {
- throw new IllegalArgumentException("source \"" + source +
- "\" exceeds maximum length " + MAX_SOURCE_LEN);
- }
- this.source = source;
- }
-
- private void setInstallerUID(int installerUID) {
- this.installerUID = installerUID;
- }
-
- /**
- * Compares this service tag to the specified object.
- * The result is {@code true} if and only if the argument is
- * not {@code null} and is a {@code ServiceTag} object whose
- * <tt>instance_urn</tt> is the same as the
- * <tt>instance_urn</tt> of this service tag.
- *
- * @return {@code true} if this service tag is the same as
- * the specified object.
- */
- @Override
- public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof ServiceTag)) {
- return false;
- }
- ServiceTag st = (ServiceTag) obj;
- if (st == this) {
- return true;
- }
- return st.getInstanceURN().equals(getInstanceURN());
- }
-
- /**
- * Returns the hash code value for this service tag.
- * @return the hash code value for this service tag.
- */
- @Override
- public int hashCode() {
- int hash = 7;
- hash = 19 * hash + (this.instanceURN != null ? this.instanceURN.hashCode() : 0);
- return hash;
- }
-
- /**
- * Returns the string representation of this service tag.
- * The format is implementation specific.
- *
- * @return the string representation of this service tag.
- */
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(ST_NODE_INSTANCE_URN).append("=").append(instanceURN).append("\n");
- sb.append(ST_NODE_PRODUCT_NAME).append("=").append(productName).append("\n");
- sb.append(ST_NODE_PRODUCT_VERSION).append("=").append(productVersion).append("\n");
- sb.append(ST_NODE_PRODUCT_URN).append("=").append(productURN).append("\n");
- sb.append(ST_NODE_PRODUCT_PARENT_URN).append("=").append(productParentURN).append("\n");
- sb.append(ST_NODE_PRODUCT_PARENT).append("=").append(productParent).append("\n");
- sb.append(ST_NODE_PRODUCT_DEFINED_INST_ID).append("=").append(productDefinedInstanceID).append("\n");
- sb.append(ST_NODE_PRODUCT_VENDOR).append("=").append(productVendor).append("\n");
- sb.append(ST_NODE_PLATFORM_ARCH).append("=").append(platformArch).append("\n");
- sb.append(ST_NODE_TIMESTAMP).append("=").append(Util.formatTimestamp(timestamp)).append("\n");
- sb.append(ST_NODE_CONTAINER).append("=").append(container).append("\n");
- sb.append(ST_NODE_SOURCE).append("=").append(source).append("\n");
- sb.append(ST_NODE_INSTALLER_UID).append("=").append(String.valueOf(installerUID)).append("\n");
- return sb.toString();
- }
-
-
- /**
- * Returns the {@link ServiceTag} instance for the running Java
- * platform. The {@link ServiceTag#setSource source} field
- * of the {@code ServiceTag} will be set to the given {@code source}.
- * This method will return {@code null} if there is no service tag
- * for the running Java platform.
- * <p>
- * This method is designed for Sun software that bundles the JDK
- * or the JRE to use. It is recommended that the {@code source}
- * string contains information about the bundling software
- * such as the name and the version of the software bundle,
- * for example,
- * <blockquote>
- * <tt>NetBeans IDE 6.0 with JDK 6 Update 5 Bundle</tt>
- * </blockquote>
- * in a NetBeans/JDK bundle.
- * <p>
- * At the first time to call this method the application
- * is required to have the write permission to the installed
- * directory of this running JDK or JRE instance.
- *
- * @param source the source that bundles the JDK or the JRE.
- * @return a {@code ServiceTag} object for the Java platform,
- * or {@code null} if not supported.
- * @throws IOException if an error occurs in this operation.
- */
- public static ServiceTag getJavaServiceTag(String source) throws IOException {
- return Installer.getJavaServiceTag(source);
- }
-
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/SolarisServiceTag.java b/setup_native/source/registration/com/sun/star/servicetag/SolarisServiceTag.java
deleted file mode 100644
index 245b993b086e..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/SolarisServiceTag.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: SolarisServiceTag.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.io.IOException;
-import java.util.Set;
-
-/**
- * Utility class to obtain the service tag for the Solaris Operating System.
- */
-class SolarisServiceTag {
- private final static String[] SolarisProductURNs = new String[] {
- "urn:uuid:a7a38948-2bd5-11d6-98ce-9d3ac1c0cfd7", /* Solaris 8 */
- "urn:uuid:4f82caac-36f3-11d6-866b-85f428ef944e", /* Solaris 9 */
- "urn:uuid:a19de03b-48bc-11d9-9607-080020a9ed93", /* Solaris 9 sparc */
- "urn:uuid:4c35c45b-4955-11d9-9607-080020a9ed93", /* Solaris 9 x86 */
- "urn:uuid:5005588c-36f3-11d6-9cec-fc96f718e113", /* Solaris 10 */
- "urn:uuid:6df19e63-7ef5-11db-a4bd-080020a9ed93" /* Solaris 11 */
- };
-
- /**
- * Returns null if not found.
- *
- * There is only one service tag for the operating system.
- */
- static ServiceTag getServiceTag() throws IOException {
- if (Registry.isSupported()) {
- Registry streg = Registry.getSystemRegistry();
- for (String parentURN : SolarisProductURNs) {
- Set<ServiceTag> instances = streg.findServiceTags(parentURN);
- for (ServiceTag st : instances) {
- // there should have only one service tag for the OS
- return st;
- }
- }
- }
- return null;
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java b/setup_native/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java
deleted file mode 100644
index 1ce5f5697bcb..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: SolarisSystemEnvironment.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-// The Service Tags team maintains the latest version of the implementation
-// for system environment data collection. JDK will include a copy of
-// the most recent released version for a JDK release. We rename
-// the package to com.sun.servicetag so that the Sun Connection
-// product always uses the latest version from the com.sun.scn.servicetags
-// package. JDK and users of the com.sun.servicetag API
-// (e.g. NetBeans and SunStudio) will use the version in JDK.
-
-import java.io.*;
-
-/**
- * Solaris implementation of the SystemEnvironment class.
- */
-class SolarisSystemEnvironment extends SystemEnvironment {
- SolarisSystemEnvironment() {
- setHostId(getCommandOutput("/usr/bin/hostid"));
- setSystemModel(getCommandOutput("/usr/bin/uname", "-i"));
- setSystemManufacturer(getSolarisSystemManufacturer());
- setCpuManufacturer(getSolarisCpuManufacturer());
- setSerialNumber(getSolarisSN());
- }
-
- /**
- * Tries to obtain the cpu manufacturer.
- * @return The cpu manufacturer (an empty string if not found or an error occurred)
- */
- private String getSolarisCpuManufacturer() {
- // not fully accurate, this could be another manufacturer (fujitsu for example)
- if ("sparc".equalsIgnoreCase(System.getProperty("os.arch"))) {
- return "Sun Microsystems, Inc";
- }
-
- // if we're here, then we'll try smbios (type 3)
- return getSmbiosData("3", "Manufacturer: ");
- }
-
- /**
- * Tries to obtain the system manufacturer.
- * @return The system manufacturer (an empty string if not found or an error occurred)
- */
- private String getSolarisSystemManufacturer() {
- // not fully accurate, this could be another manufacturer (fujitsu for example)
- if ("sparc".equalsIgnoreCase(System.getProperty("os.arch"))) {
- return "Sun Microsystems, Inc";
- }
-
- // if we're here, then we'll try smbios (type 1)
- return getSmbiosData("1", "Manufacturer: ");
- }
-
- /**
- * Tries to obtain the serial number.
- * @return The serial number (empty string if not found or an error occurred)
- */
- private String getSolarisSN() {
- // try to read from the psn file if it exists
- String tmp = getFileContent("/var/run/psn");
- if (tmp.length() > 0) {
- return tmp.trim();
- }
-
- // if we're here, then we'll try sneep
- String tmpSN = getSneepSN();
- if (tmpSN.length() > 0) {
- return tmpSN;
- }
-
- // if we're here, then we'll try smbios (type 1)
- tmpSN = getSmbiosData("1", "Serial Number: ");
- if (tmpSN.length() > 0) {
- return tmpSN;
- }
-
- // if we're here, then we'll try smbios (type 3)
- tmpSN = getSmbiosData("3", "Serial Number: ");
- if (tmpSN.length() > 0) {
- return tmpSN;
- }
-
- // give up and return
- return "";
- }
-
- // Sample smbios output segment:
- // ID SIZE TYPE
- // 1 150 SMB_TYPE_SYSTEM (system information)
- //
- // Manufacturer: Sun Microsystems
- // Product: Sun Fire X4600
- // Version: To Be Filled By O.E.M.
- // Serial Number: 00:14:4F:45:0C:2A
- private String getSmbiosData(String type, String target) {
- String output = getCommandOutput("/usr/sbin/smbios", "-t", type);
- for (String s : output.split("\n")) {
- if (s.contains(target)) {
- int indx = s.indexOf(target) + target.length();
- if (indx < s.length()) {
- String tmp = s.substring(indx).trim();
- String lowerCaseStr = tmp.toLowerCase();
- if (!lowerCaseStr.startsWith("not available")
- && !lowerCaseStr.startsWith("to be filled by o.e.m")) {
- return tmp;
- }
- }
- }
- }
-
- return "";
- }
-
- private String getSneepSN() {
- String basedir = getCommandOutput("pkgparam","SUNWsneep","BASEDIR");
- File f = new File(basedir + "/bin/sneep");
- if (f.exists()) {
- String sneepSN = getCommandOutput(basedir + "/bin/sneep");
- if (sneepSN.equalsIgnoreCase("unknown")) {
- return "";
- } else {
- return sneepSN;
- }
- } else {
- return "";
- }
- }
-
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/SunConnection.java b/setup_native/source/registration/com/sun/star/servicetag/SunConnection.java
deleted file mode 100644
index 4a3d2ee9722f..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/SunConnection.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: SunConnection.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.io.OutputStreamWriter;
-import java.util.Locale;
-import javax.net.ssl.HttpsURLConnection;
-
-/**
- * Sun Connection Class for Product Registration.
- *
- * Registration Web Application Interface
- * 1) POST the product registry to the output stream of the registration
- * relay service.
- * 2) Open the webapp URL from a browser with the following parameters:
- * registry-urn
- * product=jdk
- * locale=<locale-lang>
- *
- * @see https://sn-tools.central.sun.com/twiki/pub/ServiceTags/RegistrationRelayService/
- *
- */
-class SunConnection {
-
- private static String JDK_REGISTRATION_URL =
- "https://inventory.sun.com/RegistrationWeb/register";
- private static String SANDBOX_TESTING_URL =
- "https://connection-tst.sun.com/RegistrationWeb/register";
-
- // System properties for testing
- private static String SVCTAG_REGISTER_TESTING = "servicetag.register.testing";
- private static String SVCTAG_REGISTRATION_URL = "servicetag.registration.url";
- private static String SVCTAG_CONNECTION_TIMEOUT = "servicetag.connection.timeout";
-
- private SunConnection() {
- }
-
- /**
- * Returns a URL for JDK registration interfacing with the Sun Connection
- * registration relay service in this form:
- * <registration-url>/<registry_urn>?product=jdk&locale=<locale-lang>
- *
- * The <registration-url> can be overridden by an environment
- * variable or a system property.
- *
- * 1) "servicetag.register.testing" system property to switch to the
- * Sun Connection registration sandbox testing.
- * 2) "servicetag.registration.url" system property to override
- * the URL
- * 3) Default production URL
- *
- */
- static URL getRegistrationURL(String registrationURN) {
- String url = System.getProperty(SVCTAG_REGISTRATION_URL);
- if (url == null) {
- if (System.getProperty(SVCTAG_REGISTER_TESTING) != null) {
- url = SANDBOX_TESTING_URL;
- } else {
- url = JDK_REGISTRATION_URL;
- }
- }
-
- // trim whitespaces
- url = url.trim();
- if (url.length() == 0) {
- throw new InternalError("Empty registration url set");
- }
-
- // Add the registry_urn in the URL's query
- String registerURL = rewriteURL(url, registrationURN);
- try {
- return new URL(registerURL);
- } catch (MalformedURLException ex) {
- // should never reach here
- InternalError x =
- new InternalError(ex.getMessage());
- x.initCause(ex);
- throw x;
- }
- }
-
- private static String rewriteURL(String url, String registryURN) {
- StringBuilder sb = new StringBuilder(url.trim());
- int len = sb.length();
- if (sb.charAt(len-1) != '/') {
- sb.append('/');
- }
- sb.append(registryURN);
- sb.append("?");
- sb.append("product=jdk");
- sb.append("&");
- sb.append("locale=").append(Locale.getDefault().getLanguage());
- return sb.toString();
- }
-
- /**
- * Registers all products in the given product registry. If it fails
- * to post the service tag registry, open the browser with the offline
- * registration page.
- *
- * @param regData registration data to be posted to the Sun Connection
- * for registration.
- *
- * @throws IOException if I/O error occurs in this operation
- */
- public static void register(RegistrationData regData) throws IOException {
- // Gets the URL for SunConnection registration relay service
- URL url = getRegistrationURL(regData.getRegistrationURN());
-
- // Post the Product Registry to Sun Connection
- boolean succeed = postRegistrationData(url, regData);
- if (succeed) {
- // service tags posted successfully
- // now prompt for registration
- openBrowser(url);
- } else {
- // open browser with the offline registration page
- openOfflineRegisterPage();
- }
- }
-
- /**
- * Opens a browser for JDK product registration.
- * @param url Registration Webapp URL
- */
- private static void openBrowser(URL url) throws IOException {
- if (!BrowserSupport.isSupported()) {
- if (Util.isVerbose()) {
- System.out.println("Browser is not supported");
- }
- return;
- }
-
- try {
- BrowserSupport.browse(url.toURI());
- } catch (URISyntaxException ex) {
- InternalError x = new InternalError("Error in registering: " + ex.getMessage());
- x.initCause(ex);
- throw x;
- } catch (IllegalArgumentException ex) {
- if (Util.isVerbose()) {
- ex.printStackTrace();
- }
- } catch (UnsupportedOperationException ex) {
- // ignore if not supported
- if (Util.isVerbose()) {
- ex.printStackTrace();
- }
- }
- }
-
- /**
- * POST service tag registry to Sun Connection
- * @param loc the URL of the webapp to handle the POST request
- * @param streg the Service Tag registry
- * @return true if posting succeeds; otherwise, false.
- */
- private static boolean postRegistrationData(URL url,
- RegistrationData registration) {
- try {
- HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
- con.setDoInput(true);
- con.setDoOutput(true);
- con.setUseCaches(false);
- con.setAllowUserInteraction(false);
-
- // default 10 seconds timeout
- String timeout = System.getProperty(SVCTAG_CONNECTION_TIMEOUT, "10");
- con.setConnectTimeout(Util.getIntValue(timeout) * 1000);
-
- if (Util.isVerbose()) {
- System.out.println("Connecting to post registration data at " + url);
- }
-
- con.setRequestMethod("POST");
- con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
- con.connect();
-
- OutputStream out = con.getOutputStream();
- registration.storeToXML(out);
- out.flush();
- out.close();
-
- int returnCode = con.getResponseCode();
- if (Util.isVerbose()) {
- System.out.println("POST return status = " + returnCode);
- printReturnData(con, returnCode);
- }
- return (returnCode == HttpURLConnection.HTTP_OK);
- } catch (MalformedURLException me) {
- // should never reach here
- InternalError x = new InternalError("Error in registering: " + me.getMessage());
- x.initCause(me);
- throw x;
- } catch (Exception ioe) {
- // SocketTimeoutException, IOException or UnknownHostException
- if (Util.isVerbose()) {
- ioe.printStackTrace();
- }
- return false;
- }
- }
-
- /**
- * Opens the offline registratioin page in the browser.
- *
- */
- private static void openOfflineRegisterPage()
- throws IOException {
- if (!BrowserSupport.isSupported()) {
- if (Util.isVerbose()) {
- System.out.println("Browser is not supported");
- }
- return;
- }
-
- File registerPage = Installer.getRegistrationHtmlPage();
- try {
- BrowserSupport.browse(registerPage.toURI());
- } catch (FileNotFoundException ex) {
- // should never reach here
- InternalError x =
- new InternalError("Error in launching " + registerPage + ": " + ex.getMessage());
- x.initCause(ex);
- throw x;
- } catch (IllegalArgumentException ex) {
- if (Util.isVerbose()) {
- ex.printStackTrace();
- }
- } catch (UnsupportedOperationException ex) {
- // ignore if not supported
- if (Util.isVerbose()) {
- ex.printStackTrace();
- }
- }
- }
-
- private static void printReturnData(HttpURLConnection con, int returnCode)
- throws IOException {
- BufferedReader reader = null;
- try {
- if (returnCode < 400) {
- reader = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
- } else {
- reader = new BufferedReader(
- new InputStreamReader(con.getErrorStream()));
- }
- StringBuilder sb = new StringBuilder();
- String line;
- while ((line = reader.readLine()) != null) {
- sb.append(line).append("\n");
- }
- System.out.println("Response is : ");
- System.out.println(sb.toString());
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java b/setup_native/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java
deleted file mode 100644
index d50104e827ed..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: SysnetRegistryHelper.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import static com.sun.star.servicetag.Util.*;
-import static com.sun.star.servicetag.RegistrationDocument.*;
-
-/**
- * Class containing additional methods that are not yet
- * in the JDK Registry class. Note that all methods in this class
- * will be superceeded by the JDK classes.
- */
-public class SysnetRegistryHelper {
-
- private static final String STCLIENT_SOLARIS = "/usr/bin/stclient";
- private static final String STCLIENT_LINUX = "/opt/sun/servicetag/bin/stclient";
- // stclient exit value (see sthelper.h)
- private static final int ST_ERR_NOT_AUTH = 245;
- private static final int ST_ERR_REC_NOT_FOUND = 225;
-
- // The stclient output has to be an exported interface
- private static final String INSTANCE_URN_OPEN_ELEMENT = "<instance_urn>";
- private static final String INSTANCE_URN_CLOSE_ELEMENT = "</instance_urn>";
- private static final String REGISTRY_URN = "<registry urn=\"";
- private static final String INSTANCE_URN_DESC = "Product instance URN=";
- private static boolean initialized = false;
- private static boolean supportsHelperClass = true; // default
- private static File stclient = null;
- private static String stclientPath = null;
-
- // System properties for testing
- private static String SVCTAG_STCLIENT_CMD = "servicetag.stclient.cmd";
- private static String SVCTAG_STHELPER_SUPPORTED = "servicetag.sthelper.supported";
-
- private synchronized static String getSTclient() {
- if (!initialized) {
- // the system property always overrides the default setting
- if (System.getProperty(SVCTAG_STHELPER_SUPPORTED) != null) {
- supportsHelperClass = Boolean.getBoolean(SVCTAG_STHELPER_SUPPORTED);
- }
-
- // This is only used for testing
- stclientPath = System.getProperty(SVCTAG_STCLIENT_CMD);
- if (stclientPath != null) {
- return stclientPath;
- }
-
- // Initialization to determine the platform's stclient pathname
- String os = System.getProperty("os.name");
- if (os.equals("SunOS")) {
- stclient = new File(STCLIENT_SOLARIS);
- } else if (os.equals("Linux")) {
- stclient = new File(STCLIENT_LINUX);
- } else if (os.startsWith("Windows")) {
- stclient = getWindowsStClientFile();
- } else {
- if (isVerbose()) {
- System.out.println("Running on non-Sun JDK");
- }
- }
- initialized = true;
- }
-
- // com.sun.servicetag package has to be compiled with JDK 5 as well
- // JDK 5 doesn't support the File.canExecute() method.
- // Risk not checking isExecute() for the stclient command is very low.
-
- if (stclientPath == null && stclient != null && stclient.exists()) {
- stclientPath = stclient.getAbsolutePath();
- }
- return stclientPath;
- }
-
- private static List<String> getCommandList() {
- // Set up the arguments to call stclient
- List<String> command = new ArrayList<String>();
- if (System.getProperty(SVCTAG_STCLIENT_CMD) != null) {
- // This is for jtreg testing use. This will be set to something
- // like:
- // $JAVA_HOME/bin/java -cp $TEST_DIR \
- // -Dstclient.registry.path=$TEST_DIR/registry.xml \
- // SvcTagClient
- //
- // On Windows, the JAVA_HOME and TEST_DIR path could contain
- // space e.g. c:\Program Files\Java\jdk1.6.0_05\bin\java.
- // The SVCTAG_STCLIENT_CMD must be set with a list of
- // space-separated parameters. If a parameter contains spaces,
- // it must be quoted with '"'.
-
- String cmd = getSTclient();
- int len = cmd.length();
- int i = 0;
- while (i < len) {
- char separator = ' ';
- if (cmd.charAt(i) == '"') {
- separator = '"';
- i++;
- }
- // look for the separator or matched the closing '"'
- int j;
- for (j = i+1; j < len; j++) {
- if (cmd.charAt(j) == separator) {
- break;
- }
- }
-
- if (i == j-1) {
- // add an empty parameter
- command.add("\"\"");
- } else {
- // double quotes and space are not included
- command.add(cmd.substring(i,j));
- }
-
- // skip spaces
- for (i = j+1; i < len; i++) {
- if (!Character.isSpaceChar(cmd.charAt(i))) {
- break;
- }
- }
- }
- if (isVerbose()) {
- System.out.println("Command list:");
- for (String s : command) {
- System.out.println(s);
- }
- }
- } else {
- command.add(getSTclient());
- }
- return command;
- }
-
- // Returns null if the service tag record not found;
- // or throw UnauthorizedAccessException or IOException
- // based on the exitValue.
- private static ServiceTag checkReturnError(int exitValue,
- String output,
- ServiceTag st) throws IOException {
- switch (exitValue) {
- case ST_ERR_REC_NOT_FOUND:
- return null;
- case ST_ERR_NOT_AUTH:
- if (st != null) {
- throw new UnauthorizedAccessException(
- "Not authorized to access " + st.getInstanceURN() +
- " installer_uid=" + st.getInstallerUID());
- } else {
- throw new UnauthorizedAccessException(
- "Not authorized:" + output);
- }
- default:
- throw new IOException("stclient exits with error" +
- " (" + exitValue + ")\n" + output);
- }
- }
-
- /**
- * Returns a {@code ServiceTag} object of the given <tt>instance_urn</tt>
- * in this registry.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag
- * @return a {@code ServiceTag} object of the given <tt>instance_urn</tt>
- * in this registry; or {@code null} if not found.
- *
- * @throws java.io.IOException if an I/O error occurs in this operation.
- */
- private static ServiceTag getServiceTag(String instanceURN) throws IOException {
- if (instanceURN == null) {
- throw new NullPointerException("instanceURN is null");
- }
-
- List<String> command = getCommandList();
- command.add("-g");
- command.add("-i");
- command.add(instanceURN);
-
- ProcessBuilder pb = new ProcessBuilder(command);
- Process p = pb.start();
- String output = commandOutput(p);
- if (isVerbose()) {
- System.out.println("Output from stclient -g command:");
- System.out.println(output);
- }
- if (p.exitValue() == 0) {
- return parseServiceTag(output);
- } else {
- return checkReturnError(p.exitValue(), output, null);
- }
- }
-
- private static ServiceTag parseServiceTag(String output) throws IOException {
- BufferedReader in = null;
- try {
- Properties props = new Properties();
- // parse the service tag output from stclient
- in = new BufferedReader(new StringReader(output));
- String line = null;
- while ((line = in.readLine()) != null) {
- if ((line = line.trim()).length() > 0) {
- String[] ss = line.trim().split("=", 2);
- if (ss.length == 2) {
- props.setProperty(ss[0].trim(), ss[1].trim());
- } else {
- props.setProperty(ss[0].trim(), "");
- }
- }
- }
-
- String urn = props.getProperty(ST_NODE_INSTANCE_URN);
- String productName = props.getProperty(ST_NODE_PRODUCT_NAME);
- String productVersion = props.getProperty(ST_NODE_PRODUCT_VERSION);
- String productURN = props.getProperty(ST_NODE_PRODUCT_URN);
- String productParent = props.getProperty(ST_NODE_PRODUCT_PARENT);
- String productParentURN = props.getProperty(ST_NODE_PRODUCT_PARENT_URN);
- String productDefinedInstanceID =
- props.getProperty(ST_NODE_PRODUCT_DEFINED_INST_ID);
- String productVendor = props.getProperty(ST_NODE_PRODUCT_VENDOR);
- String platformArch = props.getProperty(ST_NODE_PLATFORM_ARCH);
- String container = props.getProperty(ST_NODE_CONTAINER);
- String source = props.getProperty(ST_NODE_SOURCE);
- int installerUID =
- Util.getIntValue(props.getProperty(ST_NODE_INSTALLER_UID));
- Date timestamp =
- Util.parseTimestamp(props.getProperty(ST_NODE_TIMESTAMP));
-
- return new ServiceTag(urn,
- productName,
- productVersion,
- productURN,
- productParent,
- productParentURN,
- productDefinedInstanceID,
- productVendor,
- platformArch,
- container,
- source,
- installerUID,
- timestamp);
- } finally {
- if (in != null) {
- in.close();
- }
- }
-
- }
-
- /**
- * Returns the urn of this registry.
- *
- * @return a {@code String} for the urn of this registry.
- *
- * @throws java.io.IOException if an I/O error occurs in this operation.
- */
- // Once JDK makes this method available, we'll deprecate this method
- // @deprecated Use the JDK version when available.
- public static String getRegistryURN() throws IOException {
- List<String> command = getCommandList();
- command.add("-x");
-
- BufferedReader in = null;
- try {
- ProcessBuilder pb = new ProcessBuilder(command);
- Process p = pb.start();
- String output = commandOutput(p);
-
- String registryURN = null;
- if (p.exitValue() == 0) {
- // parse the service tag output from stclient
- in = new BufferedReader(new StringReader(output));
- String line = null;
- while ((line = in.readLine()) != null) {
- String s = line.trim();
- if (s.indexOf(REGISTRY_URN) != -1) {
- s = s.substring(s.indexOf(REGISTRY_URN)
- + REGISTRY_URN.length());
- if (s.indexOf("\"") != -1) {
- s = s.substring(0, s.indexOf("\""));
- registryURN = s;
- break;
- }
- }
- }
- } else {
- checkReturnError(p.exitValue(), output, null);
- }
- return registryURN;
- } finally {
- if (in != null) {
- in.close();
- }
- }
- }
-
- /**
- * Returns all the service tags in this registry.
- *
- * @return a {@code Set} of {@code ServiceTag} objects
- * in this registry.
- *
- * @throws java.io.IOException if an I/O error occurs in this operation.
- */
- // Once JDK makes this method available, we'll deprecate this method
- // @deprecated Use the JDK version when available.
- public static Set<ServiceTag> getServiceTags() throws IOException {
- List<String> command = getCommandList();
- command.add("-x");
-
- BufferedReader in = null;
- try {
- ProcessBuilder pb = new ProcessBuilder(command);
- Process p = pb.start();
- String output = commandOutput(p);
-
- Set<ServiceTag> instances = new HashSet<ServiceTag>();
- if (p.exitValue() == 0) {
- // parse the service tag output from stclient
- in = new BufferedReader(new StringReader(output));
- String line = null;
- while ((line = in.readLine()) != null) {
- String s = line.trim();
- if (s.indexOf(INSTANCE_URN_OPEN_ELEMENT) != -1
- && s.indexOf(INSTANCE_URN_CLOSE_ELEMENT) != -1) {
- s = s.substring(s.indexOf(INSTANCE_URN_OPEN_ELEMENT)
- + INSTANCE_URN_OPEN_ELEMENT.length(),
- s.indexOf(INSTANCE_URN_CLOSE_ELEMENT));
- try {
- instances.add(getServiceTag(s));
- } catch (Exception e) {
- }
- }
- }
- } else {
- checkReturnError(p.exitValue(), output, null);
- }
- return instances;
- } finally {
- if (in != null) {
- in.close();
- }
- }
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/SystemEnvironment.java b/setup_native/source/registration/com/sun/star/servicetag/SystemEnvironment.java
deleted file mode 100644
index e5b9e0e3b4fe..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/SystemEnvironment.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: SystemEnvironment.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-// The Service Tags team maintains the latest version of the implementation
-// for system environment data collection. JDK will include a copy of
-// the most recent released version for a JDK release. We rename
-// the package to com.sun.servicetag so that the Sun Connection
-// product always uses the latest version from the com.sun.scn.servicetags
-// package. JDK and users of the com.sun.servicetag API
-// (e.g. NetBeans and SunStudio) will use the version in JDK.
-
-import java.io.*;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-/**
- * SystemEnvironment class collects the environment data with the
- * best effort from the underlying platform.
- */
-public class SystemEnvironment {
- private String hostname;
- private String hostId;
- private String osName;
- private String osVersion;
- private String osArchitecture;
- private String systemModel;
- private String systemManufacturer;
- private String cpuManufacturer;
- private String serialNumber;
- private static SystemEnvironment sysEnv = null;
-
- public static synchronized SystemEnvironment getSystemEnvironment() {
- if (sysEnv == null) {
- String os = System.getProperty("os.name");
- if (os.equals("SunOS")) {
- sysEnv = new SolarisSystemEnvironment();
- } else if (os.equals("Linux")) {
- sysEnv = new LinuxSystemEnvironment();
- } else if (os.startsWith("Windows")) {
- sysEnv = new WindowsSystemEnvironment();
- } else {
- sysEnv = new SystemEnvironment();
- }
- }
- return sysEnv;
- }
-
- // package-private
- SystemEnvironment() {
- try {
- this.hostname = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException ex) {
- this.hostname = "Unknown host";
- }
- this.hostId = "";
- this.osName = System.getProperty("os.name");
- this.osVersion = System.getProperty("os.version");
- this.osArchitecture = System.getProperty("os.arch");
- this.systemModel = "";
- this.systemManufacturer = "";
- this.cpuManufacturer = "";
- this.serialNumber = "";
- }
-
-
- /**
- * Sets the hostname.
- * @param hostname The hostname to set.
- */
- public void setHostname(String hostname) {
- this.hostname = hostname;
- }
-
- /**
- * Sets the OS name.
- * @param osName The osName to set.
- */
- public void setOsName(String osName) {
- this.osName = osName;
- }
-
- /**
- * Sets the OS version.
- * @param osVersion The osVersion to set.
- */
- public void setOsVersion(String osVersion) {
- this.osVersion = osVersion;
- }
-
- /**
- * Sets the OS architecture.
- * @param osArchitecture The osArchitecture to set.
- */
- public void setOsArchitecture(String osArchitecture) {
- this.osArchitecture = osArchitecture;
- }
-
- /**
- * Sets the system model.
- * @param systemModel The systemModel to set.
- */
- public void setSystemModel(String systemModel) {
- this.systemModel = systemModel;
- }
-
- /**
- * Sets the system manufacturer.
- * @param systemManufacturer The systemManufacturer to set.
- */
- public void setSystemManufacturer(String systemManufacturer) {
- this.systemManufacturer = systemManufacturer;
- }
-
- /**
- * Sets the cpu manufacturer.
- * @param cpuManufacturer The cpuManufacturer to set.
- */
- public void setCpuManufacturer(String cpuManufacturer) {
- this.cpuManufacturer = cpuManufacturer;
- }
-
- /**
- * Sets the serial number.
- * @param serialNumber The serialNumber to set.
- */
- public void setSerialNumber(String serialNumber) {
- this.serialNumber = serialNumber;
- }
-
- /**
- * Sets the hostid. Truncates to a max length of 16 chars.
- * @param hostId The hostid to set.
- */
- public void setHostId(String hostId) {
- if (hostId == null || hostId.equals("null")) {
- hostId = "";
- }
- if (hostId.length() > 16) {
- hostId = hostId.substring(0,16);
- }
- this.hostId = hostId;
- }
-
- /**
- * Returns the hostname.
- * @return The hostname.
- */
- public String getHostname() {
- return hostname;
- }
-
- /**
- * Returns the osName.
- * @return The osName.
- */
- public String getOsName() {
- return osName;
- }
-
- /**
- * Returns the osVersion.
- * @return The osVersion.
- */
- public String getOsVersion() {
- return osVersion;
- }
-
- /**
- * Returns the osArchitecture.
- * @return The osArchitecture.
- */
- public String getOsArchitecture() {
- return osArchitecture;
- }
-
- /**
- * Returns the systemModel.
- * @return The systemModel.
- */
- public String getSystemModel() {
- return systemModel;
- }
-
- /**
- * Returns the systemManufacturer.
- * @return The systemManufacturer.
- */
- public String getSystemManufacturer() {
- return systemManufacturer;
- }
-
- /**
- * Returns the serialNumber.
- * @return The serialNumber.
- */
- public String getSerialNumber() {
- return serialNumber;
- }
-
- /**
- * Returns the hostId.
- * @return The hostId.
- */
- public String getHostId() {
- return hostId;
- }
-
- /**
- * Returns the cpuManufacturer.
- * @return The cpuManufacturer.
- */
- public String getCpuManufacturer() {
- return cpuManufacturer;
- }
-
- protected String getCommandOutput(String... command) {
- StringBuilder sb = new StringBuilder();
- BufferedReader br = null;
- Process p = null;
- try {
- ProcessBuilder pb = new ProcessBuilder(command);
- p = pb.start();
- p.waitFor();
-
- if (p.exitValue() == 0) {
- br = new BufferedReader(new InputStreamReader(p.getInputStream()));
- String line = null;
- while ((line = br.readLine()) != null) {
- line = line.trim();
- if (line.length() > 0) {
- if (sb.length() > 0) {
- sb.append("\n");
- }
- sb.append(line);
- }
- }
- }
- return sb.toString();
- } catch (InterruptedException ie) {
- // in case the command hangs
- if (p != null) {
- p.destroy();
- }
- return "";
- } catch (Exception e) {
- // ignore exception
- return "";
- } finally {
- if (p != null) {
- try {
- p.getErrorStream().close();
- } catch (IOException e) {
- // ignore
- }
- try {
- p.getInputStream().close();
- } catch (IOException e) {
- // ignore
- }
- try {
- p.getOutputStream().close();
- } catch (IOException e) {
- // ignore
- }
- p = null;
- }
- if (br != null) {
- try {
- br.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- }
-
- protected String getFileContent(String filename) {
- File f = new File(filename);
- if (!f.exists()) {
- return "";
- }
-
- StringBuilder sb = new StringBuilder();
- BufferedReader br = null;
- try {
- br = new BufferedReader(new FileReader(f));
- String line = null;
- while ((line = br.readLine()) != null) {
- line = line.trim();
- if (line.length() > 0) {
- if (sb.length() > 0) {
- sb.append("\n");
- }
- sb.append(line);
- }
- }
- return sb.toString();
- } catch (Exception e) {
- // ignore exception
- return "";
- } finally {
- if (br != null) {
- try {
- br.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/Util.java b/setup_native/source/registration/com/sun/star/servicetag/Util.java
deleted file mode 100644
index 55fa097297e6..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/Util.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: Util.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.util.Date;
-import java.text.SimpleDateFormat;
-import java.text.ParseException;
-import java.util.TimeZone;
-import java.util.UUID;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-// Utility class for com.sun.star.servicetag package
-class Util {
- private static boolean verbose = (System.getProperty("servicetag.verbose") != null);
- private static String jrepath = null;
-
- // for debugging and tracing
- static boolean isVerbose() {
- return verbose;
- }
-
- /**
- * Gets the pathname of JRE in the running platform
- * This can be a JDK or JRE.
- */
- static synchronized String getJrePath() {
- if (jrepath == null) {
- // Determine the JRE path by checking the existence of
- // <HOME>/jre/lib and <HOME>/lib.
- String javaHome = System.getProperty("java.home");
- jrepath = javaHome + File.separator + "jre";
- File f = new File(jrepath, "lib");
- if (!f.exists()) {
- // java.home usually points to the JRE path
- jrepath = javaHome;
- }
- }
- return jrepath;
- }
-
- /**
- * Tests if the running platform is a JDK.
- */
- static boolean isJdk() {
- // <HOME>/jre exists which implies it's a JDK
- return getJrePath().endsWith(File.separator + "jre");
- }
-
- /**
- * Generates the URN string of "urn:st" namespace
- */
- static String generateURN() {
- return "urn:st:" + UUID.randomUUID().toString();
- }
-
- static int getIntValue(String value) {
- try {
- return Integer.parseInt(value);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("\"" + value + "\"" +
- " expected to be an integer");
- }
- }
-
- /**
- * Formats the Date into a timestamp string in YYYY-MM-dd HH:mm:ss GMT.
- * @param timestamp Date
- * @return a string representation of the timestamp
- * in the YYYY-MM-dd HH:mm:ss GMT format.
- */
- static String formatTimestamp(Date timestamp) {
- if (timestamp == null) {
- return "[No timestamp]";
- }
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
- df.setTimeZone(TimeZone.getTimeZone("GMT"));
- return df.format(timestamp);
- }
-
- /**
- * Parses a timestamp string in YYYY-MM-dd HH:mm:ss GMT format.
- * @param timestamp Timestamp in the YYYY-MM-dd HH:mm:ss GMT format.
- * @return Date
- */
- static Date parseTimestamp(String timestamp) {
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
- df.setTimeZone(TimeZone.getTimeZone("GMT"));
- try {
- return df.parse(timestamp);
- } catch (ParseException e) {
- // should not reach here
- e.printStackTrace();
- return new Date();
- }
- }
-
- static String commandOutput(Process p) throws IOException {
- Reader r = null;
- Reader err = null;
- try {
- r = new InputStreamReader(p.getInputStream());
- err = new InputStreamReader(p.getErrorStream());
- String output = commandOutput(r);
- String errorMsg = commandOutput(err);
- p.waitFor();
- return output + errorMsg.trim();
- } catch (InterruptedException e) {
- if (isVerbose()) {
- e.printStackTrace();
- }
- return e.getMessage();
- } finally {
- if (r != null) {
- r.close();
- }
- if (err != null) {
- err.close();
- }
- }
- }
-
- static String commandOutput(Reader r) throws IOException {
- StringBuilder sb = new StringBuilder();
- int c;
- while ((c = r.read()) > 0) {
- if (c != '\r') {
- sb.append((char) c);
- }
- }
- return sb.toString();
- }
-
- static int getJdkVersion() {
- parseVersion();
- return jdkVersion;
- }
-
- static int getUpdateVersion() {
- parseVersion();
- return jdkUpdate;
- }
-
- private static int jdkVersion = 0;
- private static int jdkUpdate = 0;
- private static synchronized void parseVersion() {
- if (jdkVersion > 0) {
- return;
- }
-
- // parse java.runtime.version
- // valid format of the version string is:
- // n.n.n[_uu[c]][-<identifer>]-bxx
- String cs = System.getProperty("java.runtime.version");
- if (cs.length() >= 5 &&
- Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' &&
- Character.isDigit(cs.charAt(2)) && cs.charAt(3) == '.' &&
- Character.isDigit(cs.charAt(4))) {
- jdkVersion = Character.digit(cs.charAt(2), 10);
- cs = cs.substring(5, cs.length());
- if (cs.charAt(0) == '_' && cs.length() >= 3 &&
- Character.isDigit(cs.charAt(1)) &&
- Character.isDigit(cs.charAt(2))) {
- int nextChar = 3;
- try {
- String uu = cs.substring(1, 3);
- jdkUpdate = Integer.valueOf(uu).intValue();
- } catch (NumberFormatException e) {
- // not conforming to the naming convention
- return;
- }
- }
- } else {
- throw new InternalError("Invalid java.runtime.version" + cs);
- }
- }
-
- /**
- * Returns this java string as a null-terminated byte array
- */
- private static byte[] stringToByteArray(String str) {
- return (str + "\u0000").getBytes();
- }
-
- /**
- * Converts a null-terminated byte array to java string
- */
- private static String byteArrayToString(byte[] array) {
- return new String(array, 0, array.length -1);
- }
-
- /**
- * Gets the stclient path using a well known location from
- * the Windows platform Registry, otherwise it will return null.
- */
- static File getWindowsStClientFile() {
- File out = null;
- String regKey = "software\\microsoft\\windows\\currentversion\\app paths\\stclient.exe";
- String keyName = "" ; // use the default key
- String path = getRegistryKey(regKey, keyName);
-
- if (path != null && (new File(path)).exists()) {
- out = new File(path);
- }
- if (isVerbose()) {
- System.out.println("stclient=" + out);
- }
- return out;
- }
-
- /**
- * This uses reflection to access a private java windows registry
- * interface, any changes to that Class must be appropriately adjusted.
- * Returns a null if unsuccessful.
- */
- private static String getRegistryKey(String regKey, String keyName) {
- String out = null;
- try {
- Class<?> clazz = Class.forName("java.util.prefs.WindowsPreferences");
-
- // Get the registry methods
- Method winRegOpenKeyM = clazz.getDeclaredMethod("WindowsRegOpenKey",
- int.class, byte[].class, int.class);
- winRegOpenKeyM.setAccessible(true);
-
- Method winRegCloseKeyM = clazz.getDeclaredMethod("WindowsRegCloseKey",
- int.class);
- winRegCloseKeyM.setAccessible(true);
-
- Method winRegQueryValueM = clazz.getDeclaredMethod("WindowsRegQueryValueEx",
- int.class, byte[].class);
- winRegQueryValueM.setAccessible(true);
-
- // Get all the constants we need
- int HKLM = getValueFromStaticField("HKEY_LOCAL_MACHINE", clazz);
- int KEY_READ = getValueFromStaticField("KEY_READ", clazz);
- int ERROR_CODE = getValueFromStaticField("ERROR_CODE", clazz);
- int NATIVE_HANDLE = getValueFromStaticField("NATIVE_HANDLE", clazz);
- int ERROR_SUCCESS = getValueFromStaticField("ERROR_SUCCESS", clazz);
-
- // Convert keys
- byte[] reg = stringToByteArray(regKey);
- byte[] key = stringToByteArray(keyName);
-
- // Open the registry
- int[] result = (int[]) winRegOpenKeyM.invoke(null, HKLM, reg, KEY_READ);
-
- if (result[ERROR_CODE] == ERROR_SUCCESS) {
- byte[] stvalue = (byte[]) winRegQueryValueM.invoke(null,
- result[NATIVE_HANDLE], key);
- out = byteArrayToString(stvalue);
- winRegCloseKeyM.invoke(null, result[NATIVE_HANDLE]);
- }
- } catch (Exception ex) {
- if (isVerbose()) {
- ex.printStackTrace();
- }
- }
- return out;
- }
-
- private static int getValueFromStaticField(String fldName, Class<?> klass) throws Exception {
- Field f = klass.getDeclaredField(fldName);
- f.setAccessible(true);
- return f.getInt(null);
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java b/setup_native/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java
deleted file mode 100644
index cdc374f4a993..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: WindowsSystemEnvironment.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-// The Service Tags team maintains the latest version of the implementation
-// for system environment data collection. JDK will include a copy of
-// the most recent released version for a JDK release. We rename
-// the package to com.sun.servicetag so that the Sun Connection
-// product always uses the latest version from the com.sun.scn.servicetags
-// package. JDK and users of the com.sun.servicetag API
-// (e.g. NetBeans and SunStudio) will use the version in JDK.
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Windows implementation of the SystemEnvironment class.
- */
-class WindowsSystemEnvironment extends SystemEnvironment {
- WindowsSystemEnvironment() {
- super();
-
- // run a call to make sure things are initialized
- // ignore the first call result as the system may
- // give inconsistent data on the first invocation ever
- getWmicResult("computersystem", "get", "model");
-
- setSystemModel(getWmicResult("computersystem", "get", "model"));
- setSystemManufacturer(getWmicResult("computersystem", "get", "manufacturer"));
- setSerialNumber(getWmicResult("bios", "get", "serialnumber"));
-
- String cpuMfr = getWmicResult("cpu", "get", "manufacturer");
- // this isn't as good an option, but if we couldn't get anything
- // from wmic, try the processor_identifier
- if (cpuMfr.length() == 0) {
- String procId = System.getenv("processor_identifer");
- if (procId != null) {
- String[] s = procId.split(",");
- cpuMfr = s[s.length - 1].trim();
- }
- }
- setCpuManufacturer(cpuMfr);
-
- // try to remove the temp file that gets created from running wmic cmds
- try {
- // look in the current working directory
- File f = new File("TempWmicBatchFile.bat");
- if (f.exists()) {
- f.delete();
- }
- } catch (Exception e) {
- // ignore the exception
- }
- }
-
-
- /**
- * This method invokes wmic outside of the normal environment
- * collection routines.
- *
- * An initial call to wmic can be costly in terms of time.
- *
- * <code>
- * Details of why the first call is costly can be found at:
- *
- * http://support.microsoft.com/kb/290216/en-us
- *
- * "When you run the Wmic.exe utility for the first time, the utility
- * compiles its .mof files into the repository. To save time during
- * Windows installation, this operation takes place as necessary."
- * </code>
- */
- private String getWmicResult(String alias, String verb, String property) {
- String res = "";
- BufferedReader in = null;
- try {
- ProcessBuilder pb = new ProcessBuilder("cmd", "/C", "WMIC", alias, verb, property);
- Process p = pb.start();
- // need this for executing windows commands (at least
- // needed for executing wmic command)
- BufferedWriter bw = new BufferedWriter(
- new OutputStreamWriter(p.getOutputStream()));
- bw.write(13);
- bw.flush();
- bw.close();
-
- p.waitFor();
- if (p.exitValue() == 0) {
- in = new BufferedReader(new InputStreamReader(p.getInputStream()));
- String line = null;
- while ((line = in.readLine()) != null) {
- line = line.trim();
- if (line.length() == 0) {
- continue;
- }
- res = line;
- }
- // return the *last* line read
- return res;
- }
-
- } catch (Exception e) {
- // ignore the exception
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- return res.trim();
- }
-}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/makefile.mk b/setup_native/source/registration/com/sun/star/servicetag/makefile.mk
deleted file mode 100644
index d4ebbed2f0c4..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/makefile.mk
+++ /dev/null
@@ -1,83 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.2 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJNAME = setup_native
-PRJ = ..$/..$/..$/..$/..$/..
-TARGET = servicetag
-PACKAGE = com$/sun$/star$/servicetag
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-.IF "$(ENABLE_SVCTAGS)" == "YES"
-
-JARFILES = jurt.jar unoil.jar ridl.jar
-JAVAFILES = \
- BrowserSupport.java \
- Installer.java \
- LinuxSystemEnvironment.java \
- RegistrationData.java \
- RegistrationDocument.java \
- Registry.java \
- ServiceTag.java \
- SolarisServiceTag.java \
- SolarisSystemEnvironment.java \
- SunConnection.java \
- SysnetRegistryHelper.java \
- SystemEnvironment.java \
- UnauthorizedAccessException.java \
- Util.java \
- WindowsSystemEnvironment.java
-
-JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
-
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
-JARCLASSDIRS = $(PACKAGE)
-
-JAVARES= $(CLASSDIR)$/$(PACKAGE)$/resources$/product_registration.xsd
-
-.ENDIF # "$(ENABLE_SVCTAGS)" == "YES"
-
-# --- Targets ------------------------------------------------------
-
-
-.INCLUDE : target.mk
-
-.IF "$(ENABLE_SVCTAGS)" == "YES"
-ALLTAR: $(JAVARES)
-
-$(JAVARES) : $$(@:d:d:f)$/$$(@:f)
- $(MKDIRHIER) $(@:d)
- $(COPY) $< $@
-
-.ENDIF # "$(ENABLE_SVCTAGS)" == "YES"
diff --git a/setup_native/source/registration/com/sun/star/servicetag/resources/product_registration.xsd b/setup_native/source/registration/com/sun/star/servicetag/resources/product_registration.xsd
deleted file mode 100644
index e9b34417d9ae..000000000000
--- a/setup_native/source/registration/com/sun/star/servicetag/resources/product_registration.xsd
+++ /dev/null
@@ -1,301 +0,0 @@
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
-<xs:element name="registration_data">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="environment"
- minOccurs="1"
- maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="hostname"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="hostId"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="osName"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="osVersion"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="osArchitecture"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="systemModel"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="systemManufacturer"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="cpuManufacturer"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="serialNumber"
- minOccurs='1'
- maxOccurs='1'/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="registry"
- minOccurs="1"
- maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="service_tag"
- minOccurs="0"
- maxOccurs="1024">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="instance_urn"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_name"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_version"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_urn"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_parent_urn"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_parent"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_defined_inst_id"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_vendor"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="platform_arch"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="timestamp"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="container"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="source"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="installer_uid"
- minOccurs='1'
- maxOccurs='1'/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="urn"
- type="xs:string"
- use="required"/>
- <xs:attribute name="version"
- type="xs:string"
- use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="version"
- type="xs:string"
- use="required"/>
- </xs:complexType>
-</xs:element>
-
- <!-- definition of simple elements -->
- <xs:element name="hostname">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="hostId">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="16"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="osName">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="256"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="osVersion">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="osArchitecture">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="256"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="systemModel">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="systemManufacturer">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="cpuManufacturer">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="serialNumber">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="256"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="instance_urn">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_name">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_version">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_urn">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_parent_urn">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_parent">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_defined_inst_id">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_vendor">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="platform_arch">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="timestamp">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="24"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="container">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="source">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="installer_uid">
- <xs:simpleType>
- <xs:restriction base="xs:integer">
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
-</xs:schema>
diff --git a/setup_native/source/win32/customactions/indexingfilter/makefile.mk b/setup_native/source/win32/customactions/indexingfilter/makefile.mk
index ae7fc33a524f..7f8df5bad93a 100644
--- a/setup_native/source/win32/customactions/indexingfilter/makefile.mk
+++ b/setup_native/source/win32/customactions/indexingfilter/makefile.mk
@@ -39,7 +39,6 @@ ENABLE_EXCEPTIONS=TRUE
DYNAMIC_CRT=
NO_DEFAULT_STL=TRUE
USE_DEFFILE=TRUE
-MINGW_NODLL=YES
.INCLUDE : settings.mk
diff --git a/setup_native/source/win32/customactions/javafilter/makefile.mk b/setup_native/source/win32/customactions/javafilter/makefile.mk
index 0c71f1268bd8..fc9cd828dfcc 100644
--- a/setup_native/source/win32/customactions/javafilter/makefile.mk
+++ b/setup_native/source/win32/customactions/javafilter/makefile.mk
@@ -39,7 +39,6 @@ TARGET=jfregca
NO_DEFAULT_STL=TRUE
ENABLE_EXCEPTIONS=TRUE
DYNAMIC_CRT=
-MINGW_NODLL=YES
.INCLUDE : settings.mk
diff --git a/setup_native/source/win32/customactions/languagepacks/makefile.mk b/setup_native/source/win32/customactions/languagepacks/makefile.mk
index 5246b4717fd5..76906308a676 100644
--- a/setup_native/source/win32/customactions/languagepacks/makefile.mk
+++ b/setup_native/source/win32/customactions/languagepacks/makefile.mk
@@ -40,7 +40,6 @@ ENABLE_EXCEPTIONS=TRUE
NO_DEFAULT_STL=TRUE
DYNAMIC_CRT=
USE_DEFFILE=TRUE
-MINGW_NODLL=YES
.INCLUDE : settings.mk
diff --git a/setup_native/source/win32/customactions/patch/makefile.mk b/setup_native/source/win32/customactions/patch/makefile.mk
index 996b4fc38e5d..2f3b952aeb2c 100755
--- a/setup_native/source/win32/customactions/patch/makefile.mk
+++ b/setup_native/source/win32/customactions/patch/makefile.mk
@@ -39,7 +39,6 @@ ENABLE_EXCEPTIONS=TRUE
NO_DEFAULT_STL=TRUE
DYNAMIC_CRT=
USE_DEFFILE=TRUE
-MINGW_NODLL=YES
.INCLUDE : settings.mk
diff --git a/setup_native/source/win32/customactions/quickstarter/makefile.mk b/setup_native/source/win32/customactions/quickstarter/makefile.mk
index 44ce1a2b1acf..4d56f45adeca 100644
--- a/setup_native/source/win32/customactions/quickstarter/makefile.mk
+++ b/setup_native/source/win32/customactions/quickstarter/makefile.mk
@@ -42,7 +42,6 @@ ENABLE_EXCEPTIONS=TRUE
NO_DEFAULT_STL=TRUE
DYNAMIC_CRT=
USE_DEFFILE=TRUE
-MINGW_NODLL=YES
.INCLUDE : settings.mk
diff --git a/setup_native/source/win32/customactions/regactivex/makefile.mk b/setup_native/source/win32/customactions/regactivex/makefile.mk
index 45707071d33f..96300d45ba0d 100644
--- a/setup_native/source/win32/customactions/regactivex/makefile.mk
+++ b/setup_native/source/win32/customactions/regactivex/makefile.mk
@@ -39,7 +39,6 @@ ENABLE_EXCEPTIONS=TRUE
NO_DEFAULT_STL=TRUE
DYNAMIC_CRT=
USE_DEFFILE=TRUE
-MINGW_NODLL=YES
.INCLUDE : settings.mk
diff --git a/setup_native/source/win32/customactions/regpatchactivex/makefile.mk b/setup_native/source/win32/customactions/regpatchactivex/makefile.mk
index 7c194e94b1d3..69511c936f0e 100644
--- a/setup_native/source/win32/customactions/regpatchactivex/makefile.mk
+++ b/setup_native/source/win32/customactions/regpatchactivex/makefile.mk
@@ -55,7 +55,11 @@ INCPRE+=.\Include
SLOFILES = $(SLO)$/regpatchactivex.obj
.IF "$(COM)"=="GCC"
-SHL1STDLIBS= -lmingw32 -lstdc++ -lgcc -lmsvcrt
+SHL1STDLIBS += -lstdc++
+.IF "$(MINGW_GCCLIB_EH)"=="YES"
+SHL1STDLIBS += -lgcc_eh
+.ENDIF
+SHL1STDLIBS += -lgcc -lmingw32 -lmoldname -lmsvcrt
.ELSE
SHL1STDLIBS=
.ENDIF
diff --git a/setup_native/source/win32/customactions/relnotes/makefile.mk b/setup_native/source/win32/customactions/relnotes/makefile.mk
index 8d3af6286009..b83d58468ec6 100644
--- a/setup_native/source/win32/customactions/relnotes/makefile.mk
+++ b/setup_native/source/win32/customactions/relnotes/makefile.mk
@@ -40,7 +40,6 @@ ENABLE_EXCEPTIONS=TRUE
NO_DEFAULT_STL=TRUE
DYNAMIC_CRT=
USE_DEFFILE=TRUE
-MINGW_NODLL=YES
.INCLUDE : settings.mk
diff --git a/setup_native/source/win32/customactions/shellextensions/makefile.mk b/setup_native/source/win32/customactions/shellextensions/makefile.mk
index 14546c834807..e7dc9a561883 100644
--- a/setup_native/source/win32/customactions/shellextensions/makefile.mk
+++ b/setup_native/source/win32/customactions/shellextensions/makefile.mk
@@ -39,7 +39,6 @@ ENABLE_EXCEPTIONS=TRUE
NO_DEFAULT_STL=TRUE
DYNAMIC_CRT=
USE_DEFFILE=TRUE
-MINGW_NODLL=YES
.INCLUDE : settings.mk
diff --git a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
index 5b5d649ea334..b014188f91d2 100644
--- a/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
+++ b/setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx
@@ -194,6 +194,18 @@ extern "C" UINT __stdcall RenamePrgFolder( MSIHANDLE handle )
// MessageBox(NULL, sRenameSrc.c_str(), "OFFICEINSTALLLOCATION", MB_OK);
bool bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() );
+ if ( !bSuccess )
+ {
+ TCHAR sAppend[2] = TEXT("0");
+ for ( int i = 0; i < 10; i++ )
+ {
+ sRenameDst = sOfficeInstallPath + TEXT("program_old") + sAppend;
+ bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() );
+ if ( bSuccess )
+ break;
+ sAppend[0] += 1;
+ }
+ }
#if 0
if ( !bSuccess )
@@ -214,6 +226,14 @@ extern "C" UINT __stdcall RemovePrgFolder( MSIHANDLE handle )
bool bSuccess = RemoveCompleteDirectory( sRemoveDir );
+ TCHAR sAppend[2] = TEXT("0");
+ for ( int i = 0; i < 10; i++ )
+ {
+ sRemoveDir = sOfficeInstallPath + TEXT("program_old") + sAppend;
+ bSuccess = RemoveCompleteDirectory( sRemoveDir );
+ sAppend[0] += 1;
+ }
+
#if 0
if ( bSuccess )
MessageBox(NULL, "Removing folder successful", "RemovePrgFolder", MB_OK);
diff --git a/setup_native/source/win32/customactions/tools/makefile.mk b/setup_native/source/win32/customactions/tools/makefile.mk
index 2c6a63a6fff2..e7a6c44d6ee3 100644
--- a/setup_native/source/win32/customactions/tools/makefile.mk
+++ b/setup_native/source/win32/customactions/tools/makefile.mk
@@ -40,7 +40,6 @@ ENABLE_EXCEPTIONS=TRUE
NO_DEFAULT_STL=TRUE
DYNAMIC_CRT=
USE_DEFFILE=TRUE
-MINGW_NODLL=YES
.INCLUDE : settings.mk
diff --git a/wizards/com/sun/star/wizards/ui/WizardDialog.java b/wizards/com/sun/star/wizards/ui/WizardDialog.java
index 2e101ff3398a..15b840fa9c89 100644
--- a/wizards/com/sun/star/wizards/ui/WizardDialog.java
+++ b/wizards/com/sun/star/wizards/ui/WizardDialog.java
@@ -232,14 +232,29 @@ public abstract class WizardDialog extends UnoDialog2 implements VetoableChangeL
{
int iDialogHeight = ((Integer) Helper.getUnoPropertyValue(this.xDialogModel, "Height")).intValue();
+ // the roadmap control has got no real TabIndex ever
+ // that is not correct, but changing this would need time, so it is used
+ // without TabIndex as before
oRoadmap = insertControlModel("com.sun.star.awt.UnoControlRoadmapModel", "rdmNavi",
new String[]
{
- "Height", "PositionX", "PositionY", "Step", "TabIndex", "Width"
+ "Height",
+ "PositionX",
+ "PositionY",
+ "Step",
+ "TabIndex",
+ "Tabstop",
+ "Width"
},
new Object[]
{
- new Integer(iDialogHeight - 26), new Integer(0), new Integer(0), new Integer(0), new Short((short) 0), new Integer(85)
+ new Integer(iDialogHeight - 26),
+ new Integer(0),
+ new Integer(0),
+ new Integer(0),
+ new Short((short)0),
+ Boolean.TRUE,
+ new Integer(85)
});
XPropertySet xPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmap);
xPSet.setPropertyValue("Name", "rdmNavi");
diff --git a/wizards/source/euro/Init.xba b/wizards/source/euro/Init.xba
index baedb650a0f9..45fdafdbafe5 100644
--- a/wizards/source/euro/Init.xba
+++ b/wizards/source/euro/Init.xba
@@ -68,6 +68,9 @@ Public sCurrAUSTRIAN as String
Public sCurrFINNISH as String
Public sCurrGREEK as String
Public sCurrSLOVENIAN as String
+Public sCurrCYPRIOT as String
+Public sCurrMALTESE as String
+Public sCurrSLOVAK as String
Public sCurrUNKNOWN as String
Public sCurrSYSUNKNOWN as String
@@ -76,7 +79,7 @@ Public sPrgsCONVERTING as String
Public sPrgsUNPROTECT as String
Public sInclusiveSubDir as String
-Public Const SBCOUNTRYCOUNT = 12
+Public Const SBCOUNTRYCOUNT = 15
Public CurMimeType as String
Public CurCellCount as Long
Public oSheets as Object
@@ -112,8 +115,8 @@ Public CurExtension(2) as String
Public Currfactor as Double
Public CurrSymbolList(2) as String
Public CurrLanguage as String
-Public CurrValue(12,5)
-Public LangIDValue(12,2,2) as String
+Public CurrValue(15,5)
+Public LangIDValue(15,2,2) as String
Public PreName as String
Public Separator as String
Public BitmapDir as String
@@ -189,8 +192,11 @@ Dim LocWorkPath as String
sCurrFINNISH = GetResText(1510)
sCurrGREEK = GetResText(1511)
sCurrSLOVENIAN = GetResText(1512)
- sCurrUNKNOWN = GetResText(1513)
- sCurrSYSUNKNOWN = GetResText(1514)
+ sCurrCYPRIOT = GetResText(1513)
+ sCurrMALTESE = GetResText(1514)
+ sCurrSLOVAK = GetResText(1515)
+ sCurrUNKNOWN = GetResText(1516)
+ sCurrSYSUNKNOWN = GetResText(1517)
.cmdCancel.Label = sCANCEL
.cmdHelp.Label = sHELP
.cmdBack.Label = GetResText(1002)
@@ -299,6 +305,10 @@ Sub InitializeLanguages()
LangIDValue(7,0,1) = &quot;IE&quot;
LangIDValue(7,0,2) = &quot;-1809&quot;
+ LangIDValue(7,1,0) = &quot;ga&quot;
+ LangIDValue(7,1,1) = &quot;IE&quot;
+ LangIDValue(7,1,2) = &quot;-83C&quot;
+
&apos; CURRENCIES_LUXEMBOURG
LangIDValue(8,0,0) = &quot;fr&quot;
LangIDValue(8,0,1) = &quot;LU&quot;
@@ -330,7 +340,23 @@ Sub InitializeLanguages()
&apos; CURRENCIES_SLOVENIAN
LangIDValue(12,0,0) = &quot;sl&quot;
LangIDValue(12,0,1) = &quot;SI&quot;
- LangIDValue(12,0,2) = &quot;-408&quot;
+ LangIDValue(12,0,2) = &quot;-424&quot;
+
+&apos; CURRENCIES_CYPRIOT
+ LangIDValue(13,0,0) = &quot;el&quot;
+ LangIDValue(13,0,1) = &quot;CY&quot;
+ LangIDValue(13,0,2) = &quot;-408&quot;
+
+&apos; CURRENCIES_MALTESE
+ LangIDValue(14,0,0) = &quot;mt&quot;
+ LangIDValue(14,0,1) = &quot;MT&quot;
+ LangIDValue(14,0,2) = &quot;-43A&quot;
+
+&apos; CURRENCIES_SLOVAK
+ LangIDValue(15,0,0) = &quot;sk&quot;
+ LangIDValue(15,0,1) = &quot;SK&quot;
+ LangIDValue(15,0,2) = &quot;-41B&quot;
+
End Sub
@@ -456,6 +482,33 @@ Dim i as Integer
CurrValue(12,4) = &quot;SIT&quot;
CurrValue(12,5) = &quot;SIT&quot;
+ CurrValue(13,0) = sCurrCYPRIOT
+ &apos; real conversion rate
+ CurrValue(13,1) = 0.585274
+ &apos; rounded conversion rate
+ CurrValue(13,2) = 0.6
+ CurrValue(13,3) = &quot;£C&quot;
+ CurrValue(13,4) = &quot;£&quot;
+ CurrValue(13,5) = &quot;CYP&quot;
+
+ CurrValue(14,0) = sCurrMALTESE
+ &apos; real conversion rate
+ CurrValue(14,1) = 0.429300
+ &apos; rounded conversion rate
+ CurrValue(14,2) = 0.4
+ CurrValue(14,3) = chr(8356)
+ CurrValue(14,4) = &quot;Lm&quot;
+ CurrValue(14,5) = &quot;MTL&quot;
+
+ CurrValue(15,0) = sCurrSLOVAK
+ &apos; real conversion rate
+ CurrValue(15,1) = 30.1260
+ &apos; rounded conversion rate
+ CurrValue(15,2) = 30
+ CurrValue(15,3) = &quot;Sk&quot;
+ CurrValue(15,4) = &quot;Sk&quot;
+ CurrValue(15,5) = &quot;SKK&quot;
+
i = -1
CurrSymbolList(0) = &quot;&quot;
CurrSymbolList(1) = &quot;&quot;
diff --git a/wizards/source/euro/euro.src b/wizards/source/euro/euro.src
index c62a756d1733..227c11203792 100644
--- a/wizards/source/euro/euro.src
+++ b/wizards/source/euro/euro.src
@@ -429,11 +429,26 @@ Text [ en-US ] = "Slovenian Tolar";
String CURRENCIES + 13
{
-Text [ en-US ] = "The currency set for the document is not a European currency!";
+Text [ en-US ] = "Cypriot Pound";
};
String CURRENCIES + 14
{
+Text [ en-US ] = "Maltese Lira";
+};
+
+String CURRENCIES + 15
+{
+Text [ en-US ] = "Slovak Koruna";
+};
+
+String CURRENCIES + 16
+{
+Text [ en-US ] = "The currency set for the document is not a European currency!";
+};
+
+String CURRENCIES + 17
+{
Text [ en-US ] = "The language set for your operating system is not a language of the European Monetary Union.";
};
diff --git a/wizards/source/importwizard/ImportDialog.xdl b/wizards/source/importwizard/ImportDialog.xdl
index dbc7e118c99e..082c06bc8970 100644
--- a/wizards/source/importwizard/ImportDialog.xdl
+++ b/wizards/source/importwizard/ImportDialog.xdl
@@ -89,7 +89,7 @@
<dlg:fixedline dlg:id="hlnDocuments" dlg:tab-index="42" dlg:left="6" dlg:top="110" dlg:width="258" dlg:height="8" dlg:page="2" dlg:value="hlnDocuments"/>
<dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="43" dlg:left="6" dlg:top="181" dlg:width="258" dlg:height="6"/>
<dlg:fixedline dlg:id="hlnProgress" dlg:tab-index="44" dlg:left="6" dlg:top="55" dlg:width="258" dlg:height="8" dlg:page="4" dlg:value="hlnProgress"/>
- <dlg:button dlg:id="cmdShowLogFile" dlg:tab-index="45" dlg:disabled="true" dlg:left="105" dlg:top="142" dlg:width="60" dlg:height="14" dlg:page="4" dlg:value="cmdShowLogFile">
+ <dlg:button dlg:id="cmdShowLogFile" dlg:tab-index="45" dlg:disabled="true" dlg:left="75" dlg:top="142" dlg:width="120" dlg:height="14" dlg:page="4" dlg:value="cmdShowLogFile">
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.script:ImportWizard.FilesModul.OpenLogDocument?language=Basic&amp;location=application" script:language="Script"/>
</dlg:button>
</dlg:bulletinboard>
diff --git a/wizards/source/schedule/LocalHolidays.xba b/wizards/source/schedule/LocalHolidays.xba
index 7c7d46ce664d..0b347c03f031 100644
--- a/wizards/source/schedule/LocalHolidays.xba
+++ b/wizards/source/schedule/LocalHolidays.xba
@@ -13,8 +13,10 @@ Dim lDate&amp;
CalInsertBankholiday(DateSerial(YearInt, 1, 1), &quot;Jour de l&apos;an&quot;, cHolidayType_Full)
lEasterDate = CalEasterTable(YearInt)
CalInsertBankholiday(lEasterDate, &quot;Pâques&quot;, cHolidayType_Full)
- CalInsertBankholiday(lEasterDate + 10, &quot;Pentecôte&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lEasterDate + 1, &quot;Lundi de Pâques&quot;, cHolidayType_Full)
CalInsertBankholiday(lEasterDate + 39, &quot;Ascension&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lEasterDate + 49, &quot;Pentecôte&quot;, cHolidayType_Full)
+ CalInsertBankholiday(lEasterDate + 50, &quot;Lundi de Pentecôte&quot;, cHolidayType_Full)
CalInsertBankholiday(DateSerial(YearInt, 5, 1), &quot;Fête du travail&quot;, cHolidayType_Full)
CalInsertBankholiday(DateSerial(YearInt, 5, 8), &quot;Victoire 1945&quot;, cHolidayType_Full)
CalInsertBankholiday(DateSerial(YearInt, 7, 14), &quot;Fête Nationale&quot;, cHolidayType_Full)
diff --git a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
index 9e1f8d1667c2..a6e4afac417f 100644
--- a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
+++ b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx
@@ -36,10 +36,12 @@
#include <vcl/button.hxx>
#include <svtools/stdctrl.hxx>
#include <svx/simptabl.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
#include <xmlsecurity/documentsignaturehelper.hxx>
#include <xmlsecurity/xmlsignaturehelper.hxx>
+
#ifndef _STLP_VECTOR
#include <vector>
#endif
@@ -53,6 +55,8 @@ namespace io {
class XStream; }
namespace embed {
class XStorage; }
+namespace xml { namespace dom {
+ class XDocumentBuilder; } }
}}}
namespace css = com::sun::star;
@@ -68,10 +72,12 @@ private:
css::uno::Reference < css::embed::XStorage > mxStore;
css::uno::Reference < css::io::XStream > mxSignatureStream;
+ css::uno::Reference < css::io::XStream > mxTempSignatureStream;
SignatureInformations maCurrentSignatureInformations;
bool mbVerifySignatures;
bool mbSignaturesChanged;
DocumentSignatureMode meSignatureMode;
+ css::uno::Sequence < css::uno::Sequence < css::beans::PropertyValue > > m_manifest;
FixedText maHintDocFT;
FixedText maHintBasicFT;
@@ -83,6 +89,7 @@ private:
FixedInfo maSigsInvalidFI;
FixedImage maSigsNotvalidatedImg;
FixedInfo maSigsNotvalidatedFI;
+ FixedInfo maSigsOldSignatureFI;
PushButton maViewBtn;
PushButton maAddBtn;
@@ -93,17 +100,24 @@ private:
CancelButton maCancelBtn;
HelpButton maHelpBtn;
+ ::rtl::OUString m_sODFVersion;
+ //Signals if the document contains already a document signature. This is only
+ //importent when we are signing macros and if the value is true.
+ bool m_bHasDocumentSignature;
+ bool m_bWarningShowSignMacro;
+
DECL_LINK( ViewButtonHdl, Button* );
DECL_LINK( AddButtonHdl, Button* );
DECL_LINK( RemoveButtonHdl, Button* );
DECL_LINK( SignatureHighlightHdl, void* );
DECL_LINK( SignatureSelectHdl, void* );
DECL_LINK( StartVerifySignatureHdl, void* );
+ DECL_LINK( OKButtonHdl, void* );
- void ImplGetSignatureInformations();
+ void ImplGetSignatureInformations(bool bUseTempStream);
void ImplFillSignaturesBox();
void ImplShowSignaturesDetails();
- SignatureStreamHelper ImplOpenSignatureStream( sal_Int32 eStreamMode );
+ SignatureStreamHelper ImplOpenSignatureStream( sal_Int32 eStreamMode, bool bTempStream );
//Checks if adding is allowed.
//See the spec at specs/www/appwide/security/Electronic_Signatures_and_Security.sxw
@@ -111,10 +125,15 @@ private:
bool canAdd();
bool canRemove();
+ //Checks if a particular stream is a valid xml stream. Those are treated differently
+ //when they are signed (c14n transformation)
+ bool isXML(const ::rtl::OUString& rURI );
+ bool canAddRemove();
+
public:
DigitalSignaturesDialog( Window* pParent, cssu::Reference<
cssu::XComponentContext >& rxCtx, DocumentSignatureMode eMode,
- sal_Bool bReadOnly );
+ sal_Bool bReadOnly, const ::rtl::OUString& sODFVersion, bool bHasDocumentSignature);
~DigitalSignaturesDialog();
// Initialize the dialog and the security environment, returns TRUE on success
diff --git a/xmlsecurity/inc/xmlsecurity/documentsignaturehelper.hxx b/xmlsecurity/inc/xmlsecurity/documentsignaturehelper.hxx
index 615776b023b7..6fb4ac80badd 100644
--- a/xmlsecurity/inc/xmlsecurity/documentsignaturehelper.hxx
+++ b/xmlsecurity/inc/xmlsecurity/documentsignaturehelper.hxx
@@ -33,7 +33,7 @@
#include <com/sun/star/uno/Reference.h>
#include <rtl/ustring.hxx>
-
+#include "xmlsecurity/sigstruct.hxx"
#ifndef _STLP_VECTOR
#include <vector>
@@ -64,6 +64,13 @@ namespace css = com::sun::star;
enum DocumentSignatureMode { SignatureModeDocumentContent, SignatureModeMacros, SignatureModePackage };
+enum DocumentSignatureAlgorithm
+{
+ OOo2Document,
+ OOo3_0Document,
+ OOo3_2Document
+};
+
struct SignatureStreamHelper
{
css::uno::Reference < css::embed::XStorage > xSignatureStorage;
@@ -75,14 +82,24 @@ class DocumentSignatureHelper
{
public:
- static SignatureStreamHelper OpenSignatureStream( const css::uno::Reference < css::embed::XStorage >& rxStore, sal_Int32 nOpenMode, DocumentSignatureMode eDocSigMode );
- static std::vector< rtl::OUString > CreateElementList( const css::uno::Reference < css::embed::XStorage >& rxStore, const ::rtl::OUString rRootStorageName, DocumentSignatureMode eMode );
-
+ static SignatureStreamHelper OpenSignatureStream(
+ const css::uno::Reference < css::embed::XStorage >& rxStore, sal_Int32 nOpenMode,
+ DocumentSignatureMode eDocSigMode );
+ static std::vector< rtl::OUString > CreateElementList(
+ const css::uno::Reference < css::embed::XStorage >& rxStore,
+ const ::rtl::OUString rRootStorageName, DocumentSignatureMode eMode,
+ const DocumentSignatureAlgorithm mode);
+ static bool isODFPre_1_2(const ::rtl::OUString & sODFVersion);
+ static bool isOOo3_2_Signature(const SignatureInformation & sigInfo);
+ static DocumentSignatureAlgorithm getDocumentAlgorithm(
+ const ::rtl::OUString & sODFVersion, const SignatureInformation & sigInfo);
+ static bool checkIfAllFilesAreSigned( const ::std::vector< ::rtl::OUString > & sElementList,
+ const SignatureInformation & sigInfo, const DocumentSignatureAlgorithm alg);
+ static bool equalsReferenceUriManifestPath(
+ const ::rtl::OUString & rUri, const ::rtl::OUString & rPath);
static ::rtl::OUString GetDocumentContentSignatureDefaultStreamName();
static ::rtl::OUString GetScriptingContentSignatureDefaultStreamName();
static ::rtl::OUString GetPackageSignatureDefaultStreamName();
- static bool isODFPre_1_2(const ::com::sun::star::uno::Reference <
- ::com::sun::star::embed::XStorage >& /*rxStore*/);
};
diff --git a/xmlsecurity/inc/xmlsecurity/global.hrc b/xmlsecurity/inc/xmlsecurity/global.hrc
index 35e2f3910cef..ef59a9dafa01 100644
--- a/xmlsecurity/inc/xmlsecurity/global.hrc
+++ b/xmlsecurity/inc/xmlsecurity/global.hrc
@@ -47,8 +47,6 @@
#define RID_XMLSECTP_LOCK 1011
#define RID_XMLSECTP_LOCK_HC 1012
#define RID_XMLSECWB_NO_MOZILLA_PROFILE 1013
-#define RID_XMLSECDLG_OLD_ODF_FORMAT 1014
-
#endif
diff --git a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
index 0b98ae55306f..53455b652fa5 100644
--- a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
+++ b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
@@ -145,9 +145,10 @@ public:
void SetUriBinding( com::sun::star::uno::Reference< com::sun::star::xml::crypto::XUriBinding >& rxUriBinding );
com::sun::star::uno::Reference< com::sun::star::xml::crypto::XUriBinding > GetUriBinding() const;
- // Set the storage which should be used by the default UriBinding
- // Must be set before StatrtMission().
- void SetStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStorage );
+ // Set the storage which should be used by the default UriBinding
+ // Must be set before StatrtMission().
+ //sODFVersion indicates the ODF version
+ void SetStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStorage, ::rtl::OUString sODFVersion );
// Argument for the Link is a uno::Reference< xml::sax::XAttributeList >*
// Return 1 to verify, 0 to skip.
diff --git a/xmlsecurity/prj/build.lst b/xmlsecurity/prj/build.lst
index b9853a77c6f2..cd438326bd00 100644
--- a/xmlsecurity/prj/build.lst
+++ b/xmlsecurity/prj/build.lst
@@ -1,4 +1,4 @@
-xs xmlsecurity : l10n xmloff unotools offapi unoil svx MOZ:moz SO:moz_prebuilt LIBXMLSEC:libxmlsec NULL
+xs xmlsecurity : l10n xmloff unotools offapi unoil svx MOZ:moz SO:moz_prebuilt LIBXMLSEC:libxmlsec NSS:nss 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
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 831eb48befae..dde41a4ac636 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -54,11 +54,14 @@
#include <tools/urlobj.hxx>
#include <vcl/msgbox.hxx>
#include <svtools/securityoptions.hxx>
-#include <com/sun/star/security/CertificateValidity.hdl>
+#include <com/sun/star/security/CertificateValidity.hpp>
#include <com/sun/star/security/SerialNumberAdapter.hpp>
#include <ucbhelper/contentbroker.hxx>
#include <unotools/ucbhelper.hxx>
#include <comphelper/componentcontext.hxx>
+#include "comphelper/documentconstants.hxx"
+
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
#include <stdio.h>
@@ -67,74 +70,145 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
namespace css = ::com::sun::star;
-DocumentDigitalSignatures::DocumentDigitalSignatures( const Reference< XComponentContext >& rxCtx )
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+DocumentDigitalSignatures::DocumentDigitalSignatures( const Reference< XComponentContext >& rxCtx ):
+ mxCtx(rxCtx),
+ m_sODFVersion(ODFVER_012_TEXT),
+ m_nArgumentsCount(0),
+ m_bHasDocumentSignature(false)
+{
+}
+
+void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments)
+ throw (css::uno::Exception, css::uno::RuntimeException)
{
- mxCtx = rxCtx;
+ if (aArguments.getLength() == 0 || aArguments.getLength() > 2)
+ throw css::lang::IllegalArgumentException(
+ OUSTR("DocumentDigitalSignatures::initialize requires one or two arguments"),
+ Reference<XInterface>(static_cast<XInitialization*>(this), UNO_QUERY), 0);
+
+ m_nArgumentsCount = aArguments.getLength();
+
+ if (!(aArguments[0] >>= m_sODFVersion))
+ throw css::lang::IllegalArgumentException(
+ OUSTR("DocumentDigitalSignatures::initialize: the first arguments must be a string"),
+ Reference<XInterface>(static_cast<XInitialization*>(this), UNO_QUERY), 0);
+
+ if (aArguments.getLength() == 2
+ && !(aArguments[1] >>= m_bHasDocumentSignature))
+ throw css::lang::IllegalArgumentException(
+ OUSTR("DocumentDigitalSignatures::initialize: the second arguments must be a bool"),
+ Reference<XInterface>(static_cast<XInitialization*>(this), UNO_QUERY), 1);
+
+ //the Version is supported as of ODF1.2, so for and 1.1 document or older we will receive the
+ //an empty string. In this case we set it to ODFVER_010_TEXT. Then we can later check easily
+ //if initialize was called. Only then m_sODFVersion.getLength() is greater than 0
+ if (m_sODFVersion.getLength() == 0)
+ m_sODFVersion = ODFVER_010_TEXT;
}
-sal_Bool DocumentDigitalSignatures::signDocumentContent( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xSignStream ) throw (RuntimeException)
+sal_Bool DocumentDigitalSignatures::signDocumentContent(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XStream >& xSignStream)
+ throw (RuntimeException)
{
+ OSL_ENSURE(m_sODFVersion.getLength(), "DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
return ImplViewSignatures( rxStorage, xSignStream, SignatureModeDocumentContent, false );
}
-Sequence< ::com::sun::star::security::DocumentSignatureInformation > DocumentDigitalSignatures::verifyDocumentContentSignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignInStream ) throw (RuntimeException)
+Sequence< css::security::DocumentSignatureInformation >
+DocumentDigitalSignatures::verifyDocumentContentSignatures(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
{
+ OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
return ImplVerifySignatures( rxStorage, xSignInStream, SignatureModeDocumentContent );
}
-void DocumentDigitalSignatures::showDocumentContentSignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignInStream ) throw (RuntimeException)
+void DocumentDigitalSignatures::showDocumentContentSignatures(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
{
+ OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
ImplViewSignatures( rxStorage, xSignInStream, SignatureModeDocumentContent, true );
}
-::rtl::OUString DocumentDigitalSignatures::getDocumentContentSignatureDefaultStreamName() throw (::com::sun::star::uno::RuntimeException)
+::rtl::OUString DocumentDigitalSignatures::getDocumentContentSignatureDefaultStreamName()
+ throw (css::uno::RuntimeException)
{
return DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName();
}
-sal_Bool DocumentDigitalSignatures::signScriptingContent( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xSignStream ) throw (RuntimeException)
+sal_Bool DocumentDigitalSignatures::signScriptingContent(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XStream >& xSignStream ) throw (RuntimeException)
{
+ OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+ OSL_ENSURE(m_nArgumentsCount == 2, "DocumentDigitalSignatures: Service was not initialized properly");
return ImplViewSignatures( rxStorage, xSignStream, SignatureModeMacros, false );
}
-Sequence< ::com::sun::star::security::DocumentSignatureInformation > DocumentDigitalSignatures::verifyScriptingContentSignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignInStream ) throw (RuntimeException)
+Sequence< css::security::DocumentSignatureInformation >
+DocumentDigitalSignatures::verifyScriptingContentSignatures(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
{
+ OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
return ImplVerifySignatures( rxStorage, xSignInStream, SignatureModeMacros );
}
-void DocumentDigitalSignatures::showScriptingContentSignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignInStream ) throw (RuntimeException)
+void DocumentDigitalSignatures::showScriptingContentSignatures(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
{
+ OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
ImplViewSignatures( rxStorage, xSignInStream, SignatureModeMacros, true );
}
-::rtl::OUString DocumentDigitalSignatures::getScriptingContentSignatureDefaultStreamName() throw (::com::sun::star::uno::RuntimeException)
+::rtl::OUString DocumentDigitalSignatures::getScriptingContentSignatureDefaultStreamName()
+ throw (css::uno::RuntimeException)
{
return DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName();
}
-sal_Bool DocumentDigitalSignatures::signPackage( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xSignStream ) throw (RuntimeException)
+sal_Bool DocumentDigitalSignatures::signPackage(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XStream >& xSignStream ) throw (RuntimeException)
{
+ OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
return ImplViewSignatures( rxStorage, xSignStream, SignatureModePackage, false );
}
-Sequence< ::com::sun::star::security::DocumentSignatureInformation > DocumentDigitalSignatures::verifyPackageSignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignInStream ) throw (RuntimeException)
+Sequence< css::security::DocumentSignatureInformation >
+DocumentDigitalSignatures::verifyPackageSignatures(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
{
+ OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
return ImplVerifySignatures( rxStorage, xSignInStream, SignatureModePackage );
}
-void DocumentDigitalSignatures::showPackageSignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignInStream ) throw (RuntimeException)
+void DocumentDigitalSignatures::showPackageSignatures(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
{
+ OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
ImplViewSignatures( rxStorage, xSignInStream, SignatureModePackage, true );
}
-::rtl::OUString DocumentDigitalSignatures::getPackageSignatureDefaultStreamName( ) throw (::com::sun::star::uno::RuntimeException)
+::rtl::OUString DocumentDigitalSignatures::getPackageSignatureDefaultStreamName( )
+ throw (::com::sun::star::uno::RuntimeException)
{
return DocumentSignatureHelper::GetPackageSignatureDefaultStreamName();
}
-sal_Bool DocumentDigitalSignatures::ImplViewSignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignStream, DocumentSignatureMode eMode, bool bReadOnly ) throw (RuntimeException)
+sal_Bool DocumentDigitalSignatures::ImplViewSignatures(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XInputStream >& xSignStream,
+ DocumentSignatureMode eMode, bool bReadOnly ) throw (RuntimeException)
{
Reference< io::XStream > xStream;
if ( xSignStream.is() )
@@ -142,10 +216,13 @@ sal_Bool DocumentDigitalSignatures::ImplViewSignatures( const Reference< ::com::
return ImplViewSignatures( rxStorage, xStream, eMode, bReadOnly );
}
-sal_Bool DocumentDigitalSignatures::ImplViewSignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xSignStream, DocumentSignatureMode eMode, bool bReadOnly ) throw (RuntimeException)
+sal_Bool DocumentDigitalSignatures::ImplViewSignatures(
+ const Reference< css::embed::XStorage >& rxStorage, const Reference< css::io::XStream >& xSignStream,
+ DocumentSignatureMode eMode, bool bReadOnly ) throw (RuntimeException)
{
sal_Bool bChanges = sal_False;
- DigitalSignaturesDialog aSignaturesDialog( NULL, mxCtx, eMode, bReadOnly );
+ DigitalSignaturesDialog aSignaturesDialog(
+ NULL, mxCtx, eMode, bReadOnly, m_sODFVersion, m_bHasDocumentSignature);
bool bInit = aSignaturesDialog.Init( rtl::OUString() );
DBG_ASSERT( bInit, "Error initializing security context!" );
if ( bInit )
@@ -175,7 +252,10 @@ sal_Bool DocumentDigitalSignatures::ImplViewSignatures( const Reference< ::com::
return bChanges;
}
-Sequence< ::com::sun::star::security::DocumentSignatureInformation > DocumentDigitalSignatures::ImplVerifySignatures( const Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignStream, DocumentSignatureMode eMode ) throw (RuntimeException)
+Sequence< css::security::DocumentSignatureInformation >
+DocumentDigitalSignatures::ImplVerifySignatures(
+ const Reference< css::embed::XStorage >& rxStorage,
+ const Reference< css::io::XInputStream >& xSignStream, DocumentSignatureMode eMode ) throw (RuntimeException)
{
if (!rxStorage.is())
{
@@ -206,7 +286,7 @@ Sequence< ::com::sun::star::security::DocumentSignatureInformation > DocumentDig
if ( !bInit )
return Sequence< ::com::sun::star::security::DocumentSignatureInformation >(0);
- aSignatureHelper.SetStorage( rxStorage );
+ aSignatureHelper.SetStorage(rxStorage, m_sODFVersion);
aSignatureHelper.StartMission();
@@ -223,12 +303,17 @@ Sequence< ::com::sun::star::security::DocumentSignatureInformation > DocumentDig
if ( nInfos )
{
- std::vector< rtl::OUString > aElementsToBeVerified = DocumentSignatureHelper::CreateElementList( rxStorage, ::rtl::OUString(), eMode );
- Reference<security::XSerialNumberAdapter> xSerialNumberAdapter =
+ Reference<security::XSerialNumberAdapter> xSerialNumberAdapter =
::com::sun::star::security::SerialNumberAdapter::create(mxCtx);
for( int n = 0; n < nInfos; ++n )
{
+ DocumentSignatureAlgorithm mode = DocumentSignatureHelper::getDocumentAlgorithm(
+ m_sODFVersion, aSignInfos[n]);
+ const std::vector< rtl::OUString > aElementsToBeVerified =
+ DocumentSignatureHelper::CreateElementList(
+ rxStorage, ::rtl::OUString(), eMode, mode);
+
const SignatureInformation& rInfo = aSignInfos[n];
css::security::DocumentSignatureInformation& rSigInfo = arInfos[n];
@@ -254,7 +339,8 @@ Sequence< ::com::sun::star::security::DocumentSignatureInformation > DocumentDig
if (rSigInfo.Signer.is())
{
try {
- rSigInfo.CertificateStatus = xSecEnv->verifyCertificate(rSigInfo.Signer);
+ rSigInfo.CertificateStatus = xSecEnv->verifyCertificate(rSigInfo.Signer,
+ Sequence<Reference<css::security::XCertificate> >());
} catch (SecurityException& ) {
OSL_ENSURE(0, "Verification of certificate failed");
rSigInfo.CertificateStatus = css::security::CertificateValidity::INVALID;
@@ -272,17 +358,13 @@ Sequence< ::com::sun::star::security::DocumentSignatureInformation > DocumentDig
if ( rSigInfo.SignatureIsValid )
{
- // Can only be valid if ALL streams are signed, which means real stream count == signed stream count
- unsigned int nRealCount = 0;
- for ( int i = rInfo.vSignatureReferenceInfors.size(); i; )
- {
- const SignatureReferenceInformation& rInf = rInfo.vSignatureReferenceInfors[--i];
- // There is also an extra entry of type TYPE_SAMEDOCUMENT_REFERENCE because of signature date.
- if ( ( rInf.nType == TYPE_BINARYSTREAM_REFERENCE ) || ( rInf.nType == TYPE_XMLSTREAM_REFERENCE ) )
- nRealCount++;
- }
- rSigInfo.SignatureIsValid = ( aElementsToBeVerified.size() == nRealCount );
+ rSigInfo.SignatureIsValid =
+ DocumentSignatureHelper::checkIfAllFilesAreSigned(
+ aElementsToBeVerified, rInfo, mode);
}
+ if (eMode == SignatureModeDocumentContent)
+ rSigInfo.PartialDocumentSignature =
+ ! DocumentSignatureHelper::isOOo3_2_Signature(aSignInfos[n]);
}
}
@@ -297,7 +379,7 @@ void DocumentDigitalSignatures::manageTrustedSources( ) throw (RuntimeException
// Macro Security also has some options where no security environment is needed, so raise dialog anyway.
// Later I should change the code so the Dialog creates the SecEnv on demand...
- cssu::Reference< dcss::xml::crypto::XSecurityEnvironment > xSecEnv;
+ Reference< dcss::xml::crypto::XSecurityEnvironment > xSecEnv;
XMLSignatureHelper aSignatureHelper( mxCtx );
if ( aSignatureHelper.Init( rtl::OUString() ) )
@@ -307,7 +389,8 @@ void DocumentDigitalSignatures::manageTrustedSources( ) throw (RuntimeException
aDlg.Execute();
}
-void DocumentDigitalSignatures::showCertificate( const Reference< ::com::sun::star::security::XCertificate >& _Certificate ) throw (RuntimeException)
+void DocumentDigitalSignatures::showCertificate(
+ const Reference< css::security::XCertificate >& _Certificate ) throw (RuntimeException)
{
XMLSignatureHelper aSignatureHelper( mxCtx );
@@ -323,7 +406,8 @@ void DocumentDigitalSignatures::showCertificate( const Reference< ::com::sun::st
}
-::sal_Bool DocumentDigitalSignatures::isAuthorTrusted( const Reference< ::com::sun::star::security::XCertificate >& Author ) throw (RuntimeException)
+::sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
+ const Reference< css::security::XCertificate >& Author ) throw (RuntimeException)
{
sal_Bool bFound = sal_False;
@@ -376,7 +460,8 @@ void DocumentDigitalSignatures::showCertificate( const Reference< ::com::sun::st
return bFound;
}
-void DocumentDigitalSignatures::addAuthorToTrustedSources( const Reference< ::com::sun::star::security::XCertificate >& Author ) throw (RuntimeException)
+void DocumentDigitalSignatures::addAuthorToTrustedSources(
+ const Reference< css::security::XCertificate >& Author ) throw (RuntimeException)
{
SvtSecurityOptions aSecOpts;
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.hxx b/xmlsecurity/source/component/documentdigitalsignatures.hxx
index fb0328bc2347..35d22c62ca6a 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.hxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.hxx
@@ -31,21 +31,35 @@
#ifndef _XMLSECURITY_DOCUMENTDIGITALSIGNATURES_HXX
#define _XMLSECURITY_DOCUMENTDIGITALSIGNATURES_HXX
-#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include "com/sun/star/lang/XInitialization.hpp"
#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <xmlsecurity/documentsignaturehelper.hxx>
+namespace com { namespace sun { namespace star {
-class DocumentDigitalSignatures : public cppu::WeakImplHelper1
+ namespace uno {
+ class XComponentContext;
+ }
+}}}
+
+class DocumentDigitalSignatures : public cppu::WeakImplHelper2
<
- com::sun::star::security::XDocumentDigitalSignatures
+ com::sun::star::security::XDocumentDigitalSignatures,
+ com::sun::star::lang::XInitialization
>
{
private:
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxCtx;
+ // will be set by XInitialization. If not we assume true. false means an earlier version.
+ ::rtl::OUString m_sODFVersion;
+ //The number of arguments which were passed in XInitialization::initialize
+ int m_nArgumentsCount;
+ //Indicates if the document already contains a document signature
+ bool m_bHasDocumentSignature;
sal_Bool ImplViewSignatures( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xSignStream, DocumentSignatureMode eMode, bool bReadOnly ) throw (::com::sun::star::uno::RuntimeException);
sal_Bool ImplViewSignatures( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rxStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignStream, DocumentSignatureMode eMode, bool bReadOnly ) throw (::com::sun::star::uno::RuntimeException);
@@ -58,6 +72,10 @@ public:
static ::rtl::OUString GetImplementationName() throw (com::sun::star::uno::RuntimeException);
static ::com::sun::star::uno::Sequence < ::rtl::OUString > GetSupportedServiceNames() throw (com::sun::star::uno::RuntimeException);
+ //XInitialization
+ void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
// XDocumentDigitalSignatures
::sal_Bool SAL_CALL signDocumentContent( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xSignStream ) throw (::com::sun::star::uno::RuntimeException);
::com::sun::star::uno::Sequence< ::com::sun::star::security::DocumentSignatureInformation > SAL_CALL verifyDocumentContentSignatures( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xSignInStream ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 0d77d05df31c..7f04872f7a63 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -126,7 +126,8 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( Window* _pParent, Certif
maKeyImg.SetImage( Image( XMLSEC_RES( IMG_KEY_HC ) ) );
//Verify the certificate
- sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(mpDlg->mxCert);
+ sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(mpDlg->mxCert,
+ Sequence<Reference<css::security::XCertificate> >());
//We currently have two status
//These errors are alloweds
sal_Int32 validCertErrors = css::security::CertificateValidity::VALID
@@ -310,8 +311,10 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif
aDetails = XmlSec::GetHexString( aSeq, pHexSep, nLineBreak );
InsertElement( String( XMLSEC_RES( STR_SERIALNUM ) ), aLBEntry, aDetails, true );
- aLBEntry = XmlSec::GetPureContent( xCert->getIssuerName(), ", " );
- aDetails = XmlSec::GetPureContent( xCert->getIssuerName(), "\n", true );
+ std::pair< ::rtl::OUString, ::rtl::OUString> pairIssuer =
+ XmlSec::GetDNForCertDetailsView(xCert->getIssuerName());
+ aLBEntry = pairIssuer.first;
+ aDetails = pairIssuer.second;
InsertElement( String( XMLSEC_RES( STR_ISSUER ) ), aLBEntry, aDetails );
/*
aSeq = xCert->getIssuerUniqueID();
@@ -332,8 +335,10 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( Window* _pParent, Certif
aLBEntry += GetSettings().GetUILocaleDataWrapper().getTime( aDateTime.GetTime() );
InsertElement( String( XMLSEC_RES( STR_VALIDTO ) ), aLBEntry, aLBEntry );
- aLBEntry = XmlSec::GetPureContent( xCert->getSubjectName(), ", " );
- aDetails = XmlSec::GetPureContent( xCert->getSubjectName(), "\n", true );
+ std::pair< ::rtl::OUString, ::rtl::OUString > pairSubject =
+ XmlSec::GetDNForCertDetailsView(xCert->getSubjectName());
+ aLBEntry = pairSubject.first;
+ aDetails = pairSubject.second;
InsertElement( String( XMLSEC_RES( STR_SUBJECT ) ), aLBEntry, aDetails );
/*
aSeq = xCert->getSubjectUniqueID();
@@ -481,7 +486,8 @@ void CertificateViewerCertPathTP::ActivatePage()
const Reference< security::XCertificate > rCert = pCertPath[ --i ];
String sName = XmlSec::GetContentPart( rCert->getSubjectName() );
//Verify the certificate
- sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert);
+ sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert,
+ Sequence<Reference<css::security::XCertificate> >());
//We currently have two status
//These errors are alloweds
sal_Int32 validCertErrors = css::security::CertificateValidity::VALID
diff --git a/xmlsecurity/source/dialogs/dialogs.hrc b/xmlsecurity/source/dialogs/dialogs.hrc
index ca329fabf71d..f62a2a422eaf 100644
--- a/xmlsecurity/source/dialogs/dialogs.hrc
+++ b/xmlsecurity/source/dialogs/dialogs.hrc
@@ -88,6 +88,7 @@
#define IMG_STATE_VALID_HC 13
#define IMG_STATE_BROKEN_HC 14
#define IMG_STATE_NOTVALIDATED_HC 15
+#define FI_STATE_OLDSIGNATURE 16
//#define DS_WIDTH DLGS_WIDTH
//#define DS_HEIGHT DLGS_HEIGHT
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index e0c27b59c3c0..cf07edb7023e 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -48,13 +48,19 @@
#include <com/sun/star/security/CertificateValidity.hdl>
#include <com/sun/star/packages/WrongPasswordException.hpp>
#include <com/sun/star/security/SerialNumberAdapter.hpp>
+#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
+#include <com/sun/star/packages/manifest/XManifestReader.hpp>
+
#include <rtl/ustrbuf.hxx>
+#include <rtl/uri.hxx>
#include <tools/date.hxx>
#include <tools/time.hxx>
#include "dialogs.hrc"
+#include "digitalsignaturesdialog.hrc"
#include "helpids.hrc"
#include "resourcemanager.hxx"
@@ -62,18 +68,20 @@
#include <unotools/configitem.hxx>
#include <comphelper/componentcontext.hxx>
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-using namespace ::com::sun::star::security;
-namespace css = ::com::sun::star;
/* HACK: disable some warnings for MS-C */
#ifdef _MSC_VER
#pragma warning (disable : 4355) // 4355: this used in initializer-list
#endif
+using namespace ::com::sun::star::security;
+using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
-using ::com::sun::star::uno::Sequence;
+namespace css = ::com::sun::star;
using ::rtl::OUString;
+
namespace
{
class SaveODFItem: public utl::ConfigItem
@@ -109,49 +117,70 @@ namespace
OUString(RTL_CONSTASCII_USTRINGPARAM(
"[xmlsecurity] Could not open property Office.Common/Save/ODF/DefaultVersion")), 0);
}
-
}
-sal_Bool HandleStreamAsXML_Impl( const uno::Reference < embed::XStorage >& rxStore, const rtl::OUString& rURI )
+/* Using the zip storage, we cannot get the properties "MediaType" and "IsEncrypted"
+ We use the manifest to find out if a file is xml and if it is encrypted.
+ The parameter is an encoded uri. However, the manifest contains paths. Therefore
+ the path is encoded as uri, so they can be compared.
+*/
+bool DigitalSignaturesDialog::isXML(const rtl::OUString& rURI )
{
- sal_Bool bResult = sal_False;
+ OSL_ASSERT(mxStore.is());
- try
+ bool bIsXML = false;
+ bool bPropsAvailable = false;
+ const OUString sPropFullPath(RTL_CONSTASCII_USTRINGPARAM("FullPath"));
+ const OUString sPropMediaType(RTL_CONSTASCII_USTRINGPARAM("MediaType"));
+ const OUString sPropDigest(RTL_CONSTASCII_USTRINGPARAM("Digest"));
+
+ for (int i = 0; i < m_manifest.getLength(); i++)
{
- sal_Int32 nSepPos = rURI.indexOf( '/' );
- if ( nSepPos == -1 )
+ Any digest;
+ const Sequence< css::beans::PropertyValue >& entry = m_manifest[i];
+ OUString sPath, sMediaType;
+ bool bEncrypted = false;
+ for (int j = 0; j < entry.getLength(); j++)
{
- uno::Reference< io::XStream > xStream;
- xStream = rxStore->cloneStreamElement( rURI );
- if ( !xStream.is() )
- throw uno::RuntimeException();
-
- ::rtl::OUString aMediaType;
- sal_Bool bEncrypted = sal_False;
- uno::Reference< beans::XPropertySet > xProps( xStream, uno::UNO_QUERY_THROW );
- xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ) ) >>= aMediaType;
- xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEncrypted" ) ) ) >>= bEncrypted;
- bResult = ( aMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "text/xml" ) ) ) && !bEncrypted );
+ const css::beans::PropertyValue & prop = entry[j];
+
+ if (prop.Name.equals( sPropFullPath ) )
+ prop.Value >>= sPath;
+ else if (prop.Name.equals( sPropMediaType ) )
+ prop.Value >>= sMediaType;
+ else if (prop.Name.equals( sPropDigest ) )
+ bEncrypted = true;
}
- else
+ if (DocumentSignatureHelper::equalsReferenceUriManifestPath(rURI, sPath))
{
- rtl::OUString aStoreName = rURI.copy( 0, nSepPos );
- rtl::OUString aElement = rURI.copy( nSepPos+1 );
- uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( aStoreName, embed::ElementModes::READ );
- bResult = HandleStreamAsXML_Impl( xSubStore, aElement );
+ bIsXML = sMediaType.equals(OUSTR("text/xml")) && ! bEncrypted;
+ bPropsAvailable = true;
+ break;
}
}
- catch( uno::Exception& )
+ if (!bPropsAvailable)
{
- }
-
- return bResult;
+ //This would be the case for at least mimetype, META-INF/manifest.xml
+ //META-INF/macrosignatures.xml.
+ //Files can only be encrypted if they are in the manifest.xml.
+ //That is, the current file cannot be encrypted, otherwise bPropsAvailable
+ //would be true.
+ OUString aXMLExt( RTL_CONSTASCII_USTRINGPARAM( "XML" ) );
+ sal_Int32 nSep = rURI.lastIndexOf( '.' );
+ if ( nSep != (-1) )
+ {
+ OUString aExt = rURI.copy( nSep+1 );
+ if (aExt.equalsIgnoreAsciiCase(aXMLExt ))
+ bIsXML = true;
+ }
+ }
+ return bIsXML;
}
DigitalSignaturesDialog::DigitalSignaturesDialog(
Window* pParent,
uno::Reference< uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode,
- sal_Bool bReadOnly)
+ sal_Bool bReadOnly, const ::rtl::OUString& sODFVersion, bool bHasDocumentSignature)
:ModalDialog ( pParent, XMLSEC_RES( RID_XMLSECDLG_DIGSIG ) )
,mxCtx ( rxCtx )
,maSignatureHelper ( rxCtx )
@@ -166,6 +195,7 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
,maSigsInvalidFI ( this, XMLSEC_RES( FI_STATE_BROKEN ) )
,maSigsNotvalidatedImg( this, XMLSEC_RES( IMG_STATE_NOTVALIDATED ) )
,maSigsNotvalidatedFI ( this, XMLSEC_RES( FI_STATE_NOTVALIDATED ) )
+ ,maSigsOldSignatureFI ( this, XMLSEC_RES( FI_STATE_OLDSIGNATURE) )
,maViewBtn ( this, XMLSEC_RES( BTN_VIEWCERT ) )
,maAddBtn ( this, XMLSEC_RES( BTN_ADDCERT ) )
,maRemoveBtn ( this, XMLSEC_RES( BTN_REMOVECERT ) )
@@ -173,6 +203,9 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
,maOKBtn ( this, XMLSEC_RES( BTN_OK ) )
,maCancelBtn ( this, XMLSEC_RES( BTN_CANCEL ) )
,maHelpBtn ( this, XMLSEC_RES( BTN_HELP ) )
+ ,m_sODFVersion (sODFVersion)
+ ,m_bHasDocumentSignature(bHasDocumentSignature)
+ ,m_bWarningShowSignMacro(false)
{
// --> PB #i48253 the tablistbox needs its own unique id
maSignaturesLB.Window::SetUniqueId( HID_XMLSEC_TREE_SIGNATURESDLG );
@@ -209,6 +242,8 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
maRemoveBtn.SetClickHdl( LINK( this, DigitalSignaturesDialog, RemoveButtonHdl ) );
maRemoveBtn.Disable();
+ maOKBtn.SetClickHdl( LINK( this, DigitalSignaturesDialog, OKButtonHdl) );
+
switch( meSignatureMode )
{
case SignatureModeDocumentContent: maHintDocFT.Show(); break;
@@ -220,6 +255,7 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
XmlSec::AlignAndFitImageAndControl( maSigsValidImg, maSigsValidFI, 5 );
XmlSec::AlignAndFitImageAndControl( maSigsInvalidImg, maSigsInvalidFI, 5 );
XmlSec::AlignAndFitImageAndControl( maSigsNotvalidatedImg, maSigsNotvalidatedFI, 5 );
+ XmlSec::AlignAndFitImageAndControl( maSigsNotvalidatedImg, maSigsOldSignatureFI, 5 );
}
DigitalSignaturesDialog::~DigitalSignaturesDialog()
@@ -243,7 +279,21 @@ BOOL DigitalSignaturesDialog::Init( const rtl::OUString& rTokenName )
void DigitalSignaturesDialog::SetStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStore )
{
mxStore = rxStore;
- maSignatureHelper.SetStorage( mxStore );
+ maSignatureHelper.SetStorage( mxStore, m_sODFVersion);
+
+ Reference < css::packages::manifest::XManifestReader > xReader(
+ mxCtx->getServiceManager()->createInstanceWithContext(
+ OUSTR("com.sun.star.packages.manifest.ManifestReader"), mxCtx), UNO_QUERY_THROW);
+
+ //Get the manifest.xml
+ Reference < css::embed::XStorage > xSubStore(rxStore->openStorageElement(
+ OUSTR("META-INF"), css::embed::ElementModes::READ), UNO_QUERY_THROW);
+
+ Reference< css::io::XInputStream > xStream(
+ xSubStore->openStreamElement(OUSTR("manifest.xml"), css::embed::ElementModes::READ),
+ UNO_QUERY_THROW);
+
+ m_manifest = xReader->readManifestSequence(xStream);
}
void DigitalSignaturesDialog::SetSignatureStream( const cssu::Reference < css::io::XStream >& rxStream )
@@ -251,40 +301,70 @@ void DigitalSignaturesDialog::SetSignatureStream( const cssu::Reference < css::i
mxSignatureStream = rxStream;
}
-
-bool DigitalSignaturesDialog::canAdd()
+bool DigitalSignaturesDialog::canAddRemove()
{
- bool ret = false;
+ //m56
+ bool ret = true;
OSL_ASSERT(mxStore.is());
- bool bDoc1_1 = DocumentSignatureHelper::isODFPre_1_2(mxStore);
+ bool bDoc1_1 = DocumentSignatureHelper::isODFPre_1_2(m_sODFVersion);
SaveODFItem item;
bool bSave1_1 = item.isLessODF1_2();
// see specification
//cvs: specs/www/appwide/security/Electronic_Signatures_and_Security.sxw
//Paragraph 'Behavior with regard to ODF 1.2'
+ //For both, macro and document
if ( (!bSave1_1 && bDoc1_1) || (bSave1_1 && bDoc1_1) )
{
//#4
ErrorBox err(NULL, XMLSEC_RES(RID_XMLSECDLG_OLD_ODF_FORMAT));
err.Execute();
+ ret = false;
}
- else
- ret = true;
+ //As of OOo 3.2 the document signature includes in macrosignatures.xml. That is
+ //adding a macro signature will break an existing document signature.
+ //The sfx2 will remove the documentsignature when the user adds a macro signature
+ if (meSignatureMode == SignatureModeMacros
+ && ret)
+ {
+ if (m_bHasDocumentSignature && !m_bWarningShowSignMacro)
+ {
+ //The warning says that the document signatures will be removed if the user
+ //continues. He can then either press 'OK' or 'NO'
+ //It the user presses 'Add' or 'Remove' several times then, then the warning
+ //is shown every time until the user presses 'OK'. From then on, the warning
+ //is not displayed anymore as long as the signatures dialog is alive.
+ if (QueryBox(
+ NULL, XMLSEC_RES(MSG_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN)).Execute() == RET_NO)
+ ret = false;
+ else
+ m_bWarningShowSignMacro = true;
+
+ }
+ }
return ret;
}
+bool DigitalSignaturesDialog::canAdd()
+{
+ if (canAddRemove())
+ return true;
+ return false;
+}
+
bool DigitalSignaturesDialog::canRemove()
{
- return canAdd();
+ if (canAddRemove())
+ return true;
+ return false;
}
short DigitalSignaturesDialog::Execute()
{
// Verify Signatures and add certificates to ListBox...
mbVerifySignatures = true;
- ImplGetSignatureInformations();
+ ImplGetSignatureInformations(false);
ImplFillSignaturesBox();
// Only verify once, content will not change.
@@ -304,6 +384,35 @@ IMPL_LINK( DigitalSignaturesDialog, SignatureHighlightHdl, void*, EMPTYARG )
return 0;
}
+IMPL_LINK( DigitalSignaturesDialog, OKButtonHdl, void*, EMPTYARG )
+{
+ // Export all other signatures...
+ SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(
+ embed::ElementModes::WRITE|embed::ElementModes::TRUNCATE, false );
+ uno::Reference< io::XOutputStream > xOutputStream(
+ aStreamHelper.xSignatureStream, uno::UNO_QUERY );
+ uno::Reference< com::sun::star::xml::sax::XDocumentHandler> xDocumentHandler =
+ maSignatureHelper.CreateDocumentHandlerWithHeader( xOutputStream );
+
+ int nInfos = maCurrentSignatureInformations.size();
+ for( int n = 0 ; n < nInfos ; ++n )
+ maSignatureHelper.ExportSignature(
+ xDocumentHandler, maCurrentSignatureInformations[ n ] );
+
+ maSignatureHelper.CloseDocumentHandler( xDocumentHandler);
+
+ // If stream was not provided, we are responsible for committing it....
+ if ( !mxSignatureStream.is() )
+ {
+ uno::Reference< embed::XTransactedObject > xTrans(
+ aStreamHelper.xSignatureStorage, uno::UNO_QUERY );
+ xTrans->commit();
+ }
+
+ EndDialog(RET_OK);
+ return 0;
+}
+
IMPL_LINK( DigitalSignaturesDialog, SignatureSelectHdl, void*, EMPTYARG )
{
ImplShowSignaturesDetails();
@@ -353,34 +462,33 @@ IMPL_LINK( DigitalSignaturesDialog, AddButtonHdl, Button*, EMPTYARG )
xCert->getIssuerName(), aCertSerial,
aStrBuffer.makeStringAndClear());
+ std::vector< rtl::OUString > aElements =
+ DocumentSignatureHelper::CreateElementList(
+ mxStore, rtl::OUString(), meSignatureMode, OOo3_2Document);
- std::vector< rtl::OUString > aElements = DocumentSignatureHelper::CreateElementList( mxStore, rtl::OUString(), meSignatureMode );
-
- ::rtl::OUString aXMLExt( RTL_CONSTASCII_USTRINGPARAM( "XML" ) );
sal_Int32 nElements = aElements.size();
for ( sal_Int32 n = 0; n < nElements; n++ )
{
- bool bBinaryMode = true;
- sal_Int32 nSep = aElements[n].lastIndexOf( '.' );
- if ( nSep != (-1) )
- {
- ::rtl::OUString aExt = aElements[n].copy( nSep+1 );
- if ( aExt.equalsIgnoreAsciiCase( aXMLExt ) )
- {
- bBinaryMode = !HandleStreamAsXML_Impl( mxStore, aElements[n] );
- }
- }
+ bool bBinaryMode = !isXML(aElements[n]);
maSignatureHelper.AddForSigning( nSecurityId, aElements[n], aElements[n], bBinaryMode );
}
maSignatureHelper.SetDateTime( nSecurityId, Date(), Time() );
- SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream( embed::ElementModes::WRITE|embed::ElementModes::TRUNCATE );
- uno::Reference< io::XOutputStream > xOutputStream( aStreamHelper.xSignatureStream, uno::UNO_QUERY );
- uno::Reference< com::sun::star::xml::sax::XDocumentHandler> xDocumentHandler = maSignatureHelper.CreateDocumentHandlerWithHeader( xOutputStream );
+ // We open a signature stream in which the existing and the new
+ //signature is written. ImplGetSignatureInformation (later in this function) will
+ //then read the stream an will fill maCurrentSignatureInformations. The final signature
+ //is written when the user presses OK. Then only maCurrentSignatureInformation and
+ //a sax writer are used to write the information.
+ SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(
+ css::embed::ElementModes::WRITE|css::embed::ElementModes::TRUNCATE, true);
+ Reference< css::io::XOutputStream > xOutputStream(
+ aStreamHelper.xSignatureStream, UNO_QUERY_THROW);
+ Reference< css::xml::sax::XDocumentHandler> xDocumentHandler =
+ maSignatureHelper.CreateDocumentHandlerWithHeader( xOutputStream );
// Export old signatures...
- int nInfos = maCurrentSignatureInformations.size();
+ int nInfos = maCurrentSignatureInformations.size();
for ( int n = 0; n < nInfos; n++ )
maSignatureHelper.ExportSignature( xDocumentHandler, maCurrentSignatureInformations[n]);
@@ -392,15 +500,10 @@ IMPL_LINK( DigitalSignaturesDialog, AddButtonHdl, Button*, EMPTYARG )
maSignatureHelper.EndMission();
- // If stream was not provided, we are responsible for committing it....
- if ( !mxSignatureStream.is() )
- {
- uno::Reference< embed::XTransactedObject > xTrans( aStreamHelper.xSignatureStorage, uno::UNO_QUERY );
- xTrans->commit();
- }
-
aStreamHelper = SignatureStreamHelper(); // release objects...
+ mbSignaturesChanged = true;
+
sal_Int32 nStatus = maSignatureHelper.GetSignatureInformation( nSecurityId ).nStatus;
if ( nStatus == ::com::sun::star::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED )
@@ -412,7 +515,7 @@ IMPL_LINK( DigitalSignaturesDialog, AddButtonHdl, Button*, EMPTYARG )
// will not contain
// SecurityOperationStatus_OPERATION_SUCCEEDED
mbVerifySignatures = true;
- ImplGetSignatureInformations();
+ ImplGetSignatureInformations(true);
ImplFillSignaturesBox();
}
}
@@ -421,7 +524,7 @@ IMPL_LINK( DigitalSignaturesDialog, AddButtonHdl, Button*, EMPTYARG )
{
DBG_ERROR( "Exception while adding a signature!" );
// Don't keep invalid entries...
- ImplGetSignatureInformations();
+ ImplGetSignatureInformations(true);
ImplFillSignaturesBox();
}
@@ -440,9 +543,12 @@ IMPL_LINK( DigitalSignaturesDialog, RemoveButtonHdl, Button*, EMPTYARG )
maCurrentSignatureInformations.erase( maCurrentSignatureInformations.begin()+nSelected );
// Export all other signatures...
- SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream( embed::ElementModes::WRITE|embed::ElementModes::TRUNCATE );
- uno::Reference< io::XOutputStream > xOutputStream( aStreamHelper.xSignatureStream, uno::UNO_QUERY );
- uno::Reference< com::sun::star::xml::sax::XDocumentHandler> xDocumentHandler = maSignatureHelper.CreateDocumentHandlerWithHeader( xOutputStream );
+ SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(
+ css::embed::ElementModes::WRITE | css::embed::ElementModes::TRUNCATE, true);
+ Reference< css::io::XOutputStream > xOutputStream(
+ aStreamHelper.xSignatureStream, UNO_QUERY_THROW);
+ Reference< css::xml::sax::XDocumentHandler> xDocumentHandler =
+ maSignatureHelper.CreateDocumentHandlerWithHeader( xOutputStream );
int nInfos = maCurrentSignatureInformations.size();
for( int n = 0 ; n < nInfos ; ++n )
@@ -452,13 +558,6 @@ IMPL_LINK( DigitalSignaturesDialog, RemoveButtonHdl, Button*, EMPTYARG )
mbSignaturesChanged = true;
- // If stream was not provided, we are responsible for committing it....
- if ( !mxSignatureStream.is() )
- {
- uno::Reference< embed::XTransactedObject > xTrans( aStreamHelper.xSignatureStorage, uno::UNO_QUERY );
- xTrans->commit();
- }
-
aStreamHelper = SignatureStreamHelper(); // release objects...
ImplFillSignaturesBox();
@@ -467,7 +566,7 @@ IMPL_LINK( DigitalSignaturesDialog, RemoveButtonHdl, Button*, EMPTYARG )
{
DBG_ERROR( "Exception while removing a signature!" );
// Don't keep invalid entries...
- ImplGetSignatureInformations();
+ ImplGetSignatureInformations(true);
ImplFillSignaturesBox();
}
}
@@ -493,12 +592,18 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
String aNullStr;
int nInfos = maCurrentSignatureInformations.size();
int nValidSigs = 0, nValidCerts = 0;
+ bool bAllNewSignatures = true;
if( nInfos )
{
- std::vector< rtl::OUString > aElementsToBeVerified = DocumentSignatureHelper::CreateElementList( mxStore, ::rtl::OUString(), meSignatureMode );
for( int n = 0; n < nInfos; ++n )
{
+ DocumentSignatureAlgorithm mode = DocumentSignatureHelper::getDocumentAlgorithm(
+ m_sODFVersion, maCurrentSignatureInformations[n]);
+ std::vector< rtl::OUString > aElementsToBeVerified =
+ DocumentSignatureHelper::CreateElementList(
+ mxStore, ::rtl::OUString(), meSignatureMode, mode);
+
const SignatureInformation& rInfo = maCurrentSignatureInformations[n];
//First we try to get the certificate which is embedded in the XML Signature
if (rInfo.ouX509Certificate.getLength())
@@ -530,7 +635,8 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
{
//check the validity of the cert
try {
- sal_Int32 certResult = xSecEnv->verifyCertificate(xCert);
+ sal_Int32 certResult = xSecEnv->verifyCertificate(xCert,
+ Sequence<css::uno::Reference<css::security::XCertificate> >());
//These errors are alloweds
sal_Int32 validErrors = css::security::CertificateValidity::VALID
@@ -558,28 +664,42 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
if ( bSigValid )
{
- // Can only be valid if ALL streams are signed, which means real stream count == signed stream count
- unsigned int nRealCount = 0;
- for ( int i = rInfo.vSignatureReferenceInfors.size(); i; )
- {
- const SignatureReferenceInformation& rInf = rInfo.vSignatureReferenceInfors[--i];
- // There is also an extra entry of type TYPE_SAMEDOCUMENT_REFERENCE because of signature date.
- if ( ( rInf.nType == TYPE_BINARYSTREAM_REFERENCE ) || ( rInf.nType == TYPE_XMLSTREAM_REFERENCE ) )
- nRealCount++;
- }
- bSigValid = ( aElementsToBeVerified.size() == nRealCount );
+ bSigValid = DocumentSignatureHelper::checkIfAllFilesAreSigned(
+ aElementsToBeVerified, rInfo, mode);
if( bSigValid )
nValidSigs++;
}
Image aImage;
- if ( bSigValid && bCertValid )
- aImage = maSigsValidImg.GetImage();
- else if ( bSigValid && !bCertValid )
- aImage = maSigsNotvalidatedImg.GetImage();
- else if ( !bSigValid )
+ if (!bSigValid)
+ {
aImage = maSigsInvalidImg.GetImage();
+ }
+ else if (bSigValid && !bCertValid)
+ {
+ aImage = maSigsNotvalidatedImg.GetImage();
+ }
+ //Check if the signature is a "old" document signature, that is, which was created
+ //by an version of OOo previous to 3.2
+ else if (meSignatureMode == SignatureModeDocumentContent
+ && bSigValid && bCertValid && !DocumentSignatureHelper::isOOo3_2_Signature(
+ maCurrentSignatureInformations[n]))
+ {
+ aImage = maSigsNotvalidatedImg.GetImage();
+ bAllNewSignatures &= false;
+ }
+ else if (meSignatureMode == SignatureModeDocumentContent
+ && bSigValid && bCertValid && DocumentSignatureHelper::isOOo3_2_Signature(
+ maCurrentSignatureInformations[n]))
+ {
+ aImage = maSigsValidImg.GetImage();
+ }
+ else if (meSignatureMode == SignatureModeMacros
+ && bSigValid && bCertValid)
+ {
+ aImage = aImage = maSigsValidImg.GetImage();
+ }
SvLBoxEntry* pEntry = maSignaturesLB.InsertEntry( aNullStr, aImage, aImage );
maSignaturesLB.SetEntryText( aSubject, pEntry, 1 );
@@ -589,28 +709,37 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
}
}
- bool bAllSigsValid = ( nValidSigs == nInfos );
- bool bAllCertsValid = ( nValidCerts == nInfos );
- bool bShowValidState = nInfos && ( bAllSigsValid && bAllCertsValid );
- bool bShowNotValidatedState = nInfos && ( bAllSigsValid && !bAllCertsValid );
+ bool bAllSigsValid = (nValidSigs == nInfos);
+ bool bAllCertsValid = (nValidCerts == nInfos);
+ bool bShowValidState = nInfos && (bAllSigsValid && bAllCertsValid && bAllNewSignatures);
+
+ bool bShowNotValidatedState = nInfos && (bAllSigsValid && (!bAllCertsValid || !bAllNewSignatures));
bool bShowInvalidState = nInfos && !bAllSigsValid;
- maSigsValidImg.Show( bShowValidState );
+
+ maSigsValidImg.Show( bShowValidState);
maSigsValidFI.Show( bShowValidState );
maSigsInvalidImg.Show( bShowInvalidState );
maSigsInvalidFI.Show( bShowInvalidState );
- maSigsNotvalidatedImg.Show( bShowNotValidatedState );
- maSigsNotvalidatedFI.Show( bShowNotValidatedState );
+
+ maSigsNotvalidatedImg.Show(bShowNotValidatedState);
+ //bAllNewSignatures is always true if we are not in document mode
+ maSigsNotvalidatedFI.Show(nInfos && bAllSigsValid && ! bAllCertsValid);
+ maSigsOldSignatureFI.Show(nInfos && bAllSigsValid && bAllCertsValid && !bAllNewSignatures);
SignatureHighlightHdl( NULL );
}
-void DigitalSignaturesDialog::ImplGetSignatureInformations()
+
+//If bUseTempStream is true then the temporary signature stream is used.
+//Otherwise the real signature stream is used.
+void DigitalSignaturesDialog::ImplGetSignatureInformations(bool bUseTempStream)
{
maCurrentSignatureInformations.clear();
maSignatureHelper.StartMission();
- SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream( embed::ElementModes::READ );
+ SignatureStreamHelper aStreamHelper = ImplOpenSignatureStream(
+ css::embed::ElementModes::READ, bUseTempStream);
if ( aStreamHelper.xSignatureStream.is() )
{
uno::Reference< io::XInputStream > xInputStream( aStreamHelper.xSignatureStream, uno::UNO_QUERY );
@@ -650,30 +779,72 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails()
}
}
-SignatureStreamHelper DigitalSignaturesDialog::ImplOpenSignatureStream( sal_Int32 nStreamOpenMode )
+//If bTempStream is true, then a temporary stream is return. If it is false then, the actual
+//signature stream is used.
+//Everytime the user presses Add a new temporary stream is created.
+//We keep the temporary stream as member because ImplGetSignatureInformations
+//will later access the stream to create DocumentSignatureInformation objects
+//which are stored in maCurrentSignatureInformations.
+SignatureStreamHelper DigitalSignaturesDialog::ImplOpenSignatureStream(
+ sal_Int32 nStreamOpenMode, bool bTempStream)
{
SignatureStreamHelper aHelper;
- if ( !mxSignatureStream.is() )
+ if (bTempStream)
{
- aHelper = DocumentSignatureHelper::OpenSignatureStream( mxStore, nStreamOpenMode, meSignatureMode );
+ if (nStreamOpenMode & css::embed::ElementModes::TRUNCATE)
+ {
+ //We write always into a new temporary stream.
+ mxTempSignatureStream = Reference < css::io::XStream >(
+ mxCtx->getServiceManager()->createInstanceWithContext(
+ OUSTR( "com.sun.star.io.TempFile" ), mxCtx) ,
+ UNO_QUERY_THROW);
+ aHelper.xSignatureStream = mxTempSignatureStream;
+ }
+ else
+ {
+ //When we read from the temp stream, then we must have previously
+ //created one.
+ OSL_ASSERT(mxTempSignatureStream.is());
+ }
+ aHelper.xSignatureStream = mxTempSignatureStream;
}
else
{
- aHelper.xSignatureStream = mxSignatureStream;
- if ( nStreamOpenMode & embed::ElementModes::TRUNCATE )
+ //No temporary stream
+ if (!mxSignatureStream.is())
{
- css::uno::Reference < css::io::XTruncate > xTruncate( mxSignatureStream, uno::UNO_QUERY );
- DBG_ASSERT( xTruncate.is(), "ImplOpenSignatureStream - Stream does not support xTruncate!" );
- xTruncate->truncate();
+ //We may not have a dedicated stream for writing the signature
+ //So we take one directly from the storage
+ //Or DocumentDigitalSignatures::showDocumentContentSignatures was called,
+ //in which case Add/Remove is not allowed. This is done, for example, if the
+ //document is readonly
+ aHelper = DocumentSignatureHelper::OpenSignatureStream(
+ mxStore, nStreamOpenMode, meSignatureMode );
}
else
{
- css::uno::Reference < css::io::XSeekable > xSeek( mxSignatureStream, uno::UNO_QUERY );
- DBG_ASSERT( xSeek.is(), "ImplOpenSignatureStream - Stream does not support xSeekable!" );
- xSeek->seek( 0 );
+ aHelper.xSignatureStream = mxSignatureStream;
}
}
+ if (nStreamOpenMode & css::embed::ElementModes::TRUNCATE)
+ {
+ css::uno::Reference < css::io::XTruncate > xTruncate(
+ aHelper.xSignatureStream, UNO_QUERY_THROW);
+ DBG_ASSERT( xTruncate.is(), "ImplOpenSignatureStream - Stream does not support xTruncate!" );
+ xTruncate->truncate();
+ }
+ else if ( bTempStream || mxSignatureStream.is())
+ {
+ //In case we read the signature stream from the storage directly,
+ //which is the case when DocumentDigitalSignatures::showDocumentContentSignatures
+ //then XSeakable is not supported
+ css::uno::Reference < css::io::XSeekable > xSeek(
+ aHelper.xSignatureStream, UNO_QUERY_THROW);
+ DBG_ASSERT( xSeek.is(), "ImplOpenSignatureStream - Stream does not support xSeekable!" );
+ xSeek->seek( 0 );
+ }
+
return aHelper;
}
diff --git a/setup_native/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java b/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc
index 785cb35777ae..19054bd0399b 100644
--- a/setup_native/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.hrc
@@ -1,59 +1,36 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: UnauthorizedAccessException.java,v $
- *
- * $Revision: 1.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.servicetag;
-
-/**
- * Thrown if the user is not authorized to
- * {@link Registry#updateServiceTag update} or
- * {@link Registry#removeServiceTag remove}
- * a service tag from a {@link Registry}.
- */
-public class UnauthorizedAccessException extends RuntimeException {
-
- /**
- * Constructs an <code>UnauthorizedAccessException</code> object
- * without detail message.
- */
- public UnauthorizedAccessException() {
- }
-
-
- /**
- * Constructs an <code>UnauthorizedAccessException</code> object
- * with the specified detail message.
- *
- * @param msg the detail message.
- */
- public UnauthorizedAccessException(String msg) {
- super(msg);
- }
-}
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 ! defined INCLUDED_DIGITALSIGNATURESDIALOG_HRC
+#define INCLUDED_DIGITALSIGNATURESDIALOG_HRC
+
+//global.hrc in xmlsecurity/inc starts at 1000
+#define RID_DIGITALSIGNATUREDLG_START 2000
+
+#define RID_XMLSECDLG_OLD_ODF_FORMAT RID_DIGITALSIGNATUREDLG_START
+#define MSG_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN (RID_DIGITALSIGNATUREDLG_START + 1)
+#endif
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.src b/xmlsecurity/source/dialogs/digitalsignaturesdialog.src
index f102053ce615..016014fbb582 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.src
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.src
@@ -30,6 +30,7 @@
#include "dialogs.hrc"
#include "helpids.hrc"
+#include "digitalsignaturesdialog.hrc"
ModalDialog RID_XMLSECDLG_DIGSIG
{
@@ -87,6 +88,7 @@ ModalDialog RID_XMLSECDLG_DIGSIG
{
Text [ en-US ] = "The signatures in this document are invalid";
};
+
FixedImage IMG_STATE_VALID
{
Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A );
@@ -104,6 +106,13 @@ ModalDialog RID_XMLSECDLG_DIGSIG
Hide = TRUE;
Text [ en-US ] = "The signatures in this document are valid";
};
+ FixedText FI_STATE_OLDSIGNATURE
+ {
+ Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A );
+ Size = MAP_APPFONT( DS_COL_7-DS_COL_0, RSC_CD_FIXEDTEXT_HEIGHT );
+ Hide = TRUE;
+ Text [ en-US ] = "Not all parts of the document are signed";
+ };
FixedImage IMG_STATE_BROKEN
{
Pos = MAP_APPFONT( DS_COL_0, DS_ROW_2A );
@@ -205,3 +214,13 @@ ErrorBox RID_XMLSECDLG_OLD_ODF_FORMAT
"Save document in ODF 1.2 format and add all desired signatures again.";
};
+
+QueryBox MSG_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "Adding or removing a macro signature will remove all document signatures.\n"
+ "Do you really want to continue?";
+};
+
+
diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx
index 513a8f773921..1817ce84cbfc 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.cxx
+++ b/xmlsecurity/source/dialogs/resourcemanager.cxx
@@ -38,7 +38,12 @@
#include <svtools/stdctrl.hxx>
#include <vcl/solar.hrc>
#include <svtools/syslocale.hxx>
+#include <rtl/ustring.h>
+#include <rtl/ustrbuf.h>
+#include <vector>
+using ::rtl::OUString;
+using namespace std;
namespace XmlSec
{
@@ -110,122 +115,249 @@ namespace XmlSec
return GetLocaleData().getDate( GetDateTime( _rDT ) );
}
- String GetPureContent( const String& _rRawString, const char* _pCommaReplacement, bool _bPreserveId )
+ /*
+ Creates two strings based on the distinguished name which are displayed in the
+ certificate details view. The first string contains only the values of the attribute
+ and valudes pairs, which are separated by commas. All escape characters ('"') are
+ removed.
+ The second string is for the details view at the bottom. It shows the attribute/value
+ pairs on different lines. All escape characters ('"') are removed.
+ */
+ pair< OUString, OUString> GetDNForCertDetailsView( const OUString & rRawString)
{
- enum STATE { PRE_ID, ID, EQUALSIGN, PRE_CONT, CONT };
- String s;
- STATE e = _bPreserveId? PRE_ID : ID;
-
- const sal_Unicode* p = _rRawString.GetBuffer();
- sal_Unicode c;
- const sal_Unicode cComma = ',';
- const sal_Unicode cEqualSign = '=';
- const sal_Unicode cSpace = ' ';
- String aCommaReplacement;
- if( _pCommaReplacement )
- aCommaReplacement = String::CreateFromAscii( _pCommaReplacement );
-
- while( *p )
+ vector< pair< OUString, OUString > > vecAttrValueOfDN = parseDN(rRawString);
+ ::rtl::OUStringBuffer s1, s2;
+ OUString sEqual(RTL_CONSTASCII_USTRINGPARAM(" = "));
+ typedef vector< pair < OUString, OUString > >::const_iterator CIT;
+ for (CIT i = vecAttrValueOfDN.begin(); i < vecAttrValueOfDN.end(); i ++)
{
- c = *p;
- switch( e )
+ if (i != vecAttrValueOfDN.begin())
{
- case PRE_ID:
- if( c != cSpace )
- {
- s += c;
- e = ID;
- }
- break;
- case ID:
- if( _bPreserveId )
- s += c;
-
- if( c == cEqualSign )
- e = _bPreserveId? PRE_CONT : CONT;
- break;
- case EQUALSIGN:
- break;
- case PRE_CONT:
- if( c != cSpace )
- {
- s += c;
- e = CONT;
- }
- break;
- case CONT:
- if( c == cComma )
- {
- s += aCommaReplacement;
- e = _bPreserveId? PRE_ID : ID;
- }
- else
- s += c;
- break;
+ s1.append(static_cast<sal_Unicode>(','));
+ s2.append(static_cast<sal_Unicode>('\n'));
}
-
- ++p;
+ s1.append(i->second);
+ s2.append(i->first);
+ s2.append(sEqual);
+ s2.append(i->second);
}
-
-// xub_StrLen nEquPos = _rRawString.SearchAscii( "=" );
-// if( nEquPos == STRING_NOTFOUND )
-// s = _rRawString;
-// else
-// {
-// ++nEquPos;
-// s = String( _rRawString, nEquPos, STRING_MAXLEN );
-// s.EraseLeadingAndTrailingChars();
-// }
-
- return s;
+ return make_pair(s1.makeStringAndClear(), s2.makeStringAndClear());
}
- String GetContentPart( const String& _rRawString, const String& _rPartId )
+/*
+ Whenever the attribute value contains special characters, such as '"' or ',' (without '')
+ then the value will be enclosed in double quotes by the respective Windows or NSS function
+ which we use to retrieve, for example, the subject name. If double quotes appear in the value then
+ they are escaped with a double quote. This function removes the escape characters.
+*/
+#ifdef WNT
+vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
{
- String s;
-
- xub_StrLen nContStart = _rRawString.Search( _rPartId );
- if( nContStart != STRING_NOTFOUND )
+ vector< pair<OUString, OUString> > retVal;
+ bool bInEscape = false;
+ bool bInValue = false;
+ bool bInType = true;
+ sal_Int32 nTypeNameStart = 0;
+ OUString sType;
+ ::rtl::OUStringBuffer sbufValue;
+ sal_Int32 length = rRawString.getLength();
+
+ for (sal_Int32 i = 0; i < length; i++)
{
- nContStart = nContStart + _rPartId.Len();
- ++nContStart; // now it's start of content, directly after Id
-
- xub_StrLen nContEnd = _rRawString.Search( sal_Unicode( ',' ), nContStart );
+ sal_Unicode c = rRawString[i];
- s = String( _rRawString, nContStart, nContEnd - nContStart );
+ if (c == '=')
+ {
+ if (! bInValue)
+ {
+ sType = rRawString.copy(nTypeNameStart, i - nTypeNameStart);
+ sType = sType.trim();
+ bInType = false;
+ }
+ else
+ {
+ sbufValue.append(c);
+ }
+ }
+ else if (c == '"')
+ {
+ if (!bInEscape)
+ {
+ //If this is the quote is the first of the couple which enclose the
+ //whole value, because the value contains special characters
+ //then we just drop it. That is, this character must be followed by
+ //a character which is not '"'.
+ if ( i + 1 < length && rRawString[i+1] == '"')
+ bInEscape = true;
+ else
+ bInValue = !bInValue; //value is enclosed in " "
+ }
+ else
+ {
+ //This quote is escaped by a preceding quote and therefore is
+ //part of the value
+ sbufValue.append(c);
+ bInEscape = false;
+ }
+ }
+ else if (c == ',')
+ {
+ //The comma separate the attribute value pairs.
+ //If the comma is not part of a value (the value would then be enclosed in '"'),
+ //then we have reached the end of the value
+ if (!bInValue)
+ {
+ OSL_ASSERT(sType.getLength());
+ retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
+ sType = OUString();
+ //The next char is the start of the new type
+ nTypeNameStart = i + 1;
+ bInType = true;
+ }
+ else
+ {
+ //The whole string is enclosed because it contains special characters.
+ //The enclosing '"' are not part of certificate but will be added by
+ //the function (Windows or NSS) which retrieves DN
+ sbufValue.append(c);
+ }
+ }
+ else
+ {
+ if (!bInType)
+ sbufValue.append(c);
+ }
+ }
+ if (sbufValue.getLength())
+ {
+ OSL_ASSERT(sType.getLength());
+ retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
}
+ return retVal;
+ }
+#else
+vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
+ {
+ vector< pair<OUString, OUString> > retVal;
+ //bInEscape == true means that the preceding character is an escape character
+ bool bInEscape = false;
+ bool bInValue = false;
+ bool bInType = true;
+ sal_Int32 nTypeNameStart = 0;
+ OUString sType;
+ ::rtl::OUStringBuffer sbufValue;
+ sal_Int32 length = rRawString.getLength();
+
+ for (sal_Int32 i = 0; i < length; i++)
+ {
+ sal_Unicode c = rRawString[i];
- return s;
+ if (c == '=')
+ {
+ if (! bInValue)
+ {
+ sType = rRawString.copy(nTypeNameStart, i - nTypeNameStart);
+ sType = sType.trim();
+ bInType = false;
+ }
+ else
+ {
+ sbufValue.append(c);
+ }
+ }
+ else if (c == '\\')
+ {
+ if (!bInEscape)
+ {
+ bInEscape = true;
+ }
+ else
+ { // bInEscape is true
+ sbufValue.append(c);
+ bInEscape = false;
+ }
+ }
+ else if (c == '"')
+ {
+ //an unescaped '"' is either at the beginning or end of the value
+ if (!bInEscape)
+ {
+ if ( !bInValue)
+ bInValue = true;
+ else if (bInValue)
+ bInValue = false;
+ }
+ else
+ {
+ //This quote is escaped by a preceding quote and therefore is
+ //part of the value
+ sbufValue.append(c);
+ bInEscape = false;
+ }
+ }
+ else if (c == ',')
+ {
+ //The comma separate the attribute value pairs.
+ //If the comma is not part of a value (the value would then be enclosed in '"'),
+ //then we have reached the end of the value
+ if (!bInValue)
+ {
+ OSL_ASSERT(sType.getLength());
+ retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
+ sType = OUString();
+ //The next char is the start of the new type
+ nTypeNameStart = i + 1;
+ bInType = true;
+ }
+ else
+ {
+ //The whole string is enclosed because it contains special characters.
+ //The enclosing '"' are not part of certificate but will be added by
+ //the function (Windows or NSS) which retrieves DN
+ sbufValue.append(c);
+ }
+ }
+ else
+ {
+ if (!bInType)
+ {
+ sbufValue.append(c);
+ bInEscape = false;
+ }
+ }
+ }
+ if (sbufValue.getLength())
+ {
+ OSL_ASSERT(sType.getLength());
+ retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
+ }
+ return retVal;
}
- /**
- * This Method should consider some string like "C=CN-XXX , O=SUN-XXX , CN=Jack" ,
- * here the first CN represent china , and the second CN represent the common name ,
- * so I changed the method to handle this .
- * By CP , mailto : chandler.peng@sun.com
- **/
+#endif
+
String GetContentPart( const String& _rRawString )
{
- // search over some parts to find a string
- //static char* aIDs[] = { "CN", "OU", "O", "E", NULL };
- static char const * aIDs[] = { "CN=", "OU=", "O=", "E=", NULL };// By CP
- String sPart;
+ char const * aIDs[] = { "CN", "OU", "O", "E", NULL };
+ OUString retVal;
int i = 0;
+ vector< pair< OUString, OUString > > vecAttrValueOfDN = parseDN(_rRawString);
while ( aIDs[i] )
{
- String sPartId = String::CreateFromAscii( aIDs[i++] );
- xub_StrLen nContStart = _rRawString.Search( sPartId );
- if ( nContStart != STRING_NOTFOUND )
+ OUString sPartId = OUString::createFromAscii( aIDs[i++] );
+ typedef vector< pair < OUString, OUString > >::const_iterator CIT;
+ for (CIT idn = vecAttrValueOfDN.begin(); idn != vecAttrValueOfDN.end(); idn++)
{
- nContStart = nContStart + sPartId.Len();
- //++nContStart; // now it's start of content, directly after Id // delete By CP
- xub_StrLen nContEnd = _rRawString.Search( sal_Unicode( ',' ), nContStart );
- sPart = String( _rRawString, nContStart, nContEnd - nContStart );
- break;
+ if (idn->first.equals(sPartId))
+ {
+ retVal = idn->second;
+ break;
+ }
}
+ if (retVal.getLength())
+ break;
}
-
- return sPart;
+ return retVal;
}
String GetHexString( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep, UINT16 _nLineBreak )
diff --git a/xmlsecurity/source/dialogs/resourcemanager.hxx b/xmlsecurity/source/dialogs/resourcemanager.hxx
index 500ba6501c39..0525010f0abe 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.hxx
+++ b/xmlsecurity/source/dialogs/resourcemanager.hxx
@@ -36,6 +36,8 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/uno/Sequence.hxx>
+#include <vector>
+
class FixedImage;
class FixedInfo;
class Control;
@@ -51,10 +53,10 @@ namespace XmlSec
String GetDateTimeString( const rtl::OUString& _rDate, const rtl::OUString& _rTime );
String GetDateString( const ::com::sun::star::util::DateTime& _rDT );
- String GetPureContent( const String& _rRawString,
- const char* _pCommaReplacement = ", ",
- bool _bPreserveId = false ); // strips "CN=" and so from string
- String GetContentPart( const String& _rRawString, const String& _rPartId );
+ std::vector< std::pair< ::rtl::OUString, ::rtl::OUString> >
+ parseDN(const ::rtl::OUString& rRawString);
+ std::pair< ::rtl::OUString, ::rtl::OUString> GetDNForCertDetailsView(
+ const ::rtl::OUString & rRawString);
String GetContentPart( const String& _rRawString );
String GetHexString( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq, const char* _pSep = ":", UINT16 _nLineBreak = 0xFFFF );
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index 37186bd2515c..ca2cfe941f4d 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -1,291 +1,465 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: documentsignaturehelper.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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 <xmlsecurity/documentsignaturehelper.hxx>
-
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include "com/sun/star/beans/XPropertySet.hpp"
-
-#include "comphelper/documentconstants.hxx"
-#include <tools/debug.hxx>
-#include "rtl/uri.hxx"
-
-using namespace ::com::sun::star;
-namespace css = ::com::sun::star;
-
-namespace
-{
-::rtl::OUString getElement(::rtl::OUString const & version, ::sal_Int32 * index)
-{
- while (*index < version.getLength() && version[*index] == '0') {
- ++*index;
- }
- return version.getToken(0, '.', *index);
-}
-
-
-
-// Return 1 if version1 is greater then version 2, 0 if they are equal
-//and -1 if version1 is less version 2
-int compareVersions(
- ::rtl::OUString const & version1, ::rtl::OUString const & version2)
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: documentsignaturehelper.cxx,v $
+ * $Revision: 1.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <xmlsecurity/documentsignaturehelper.hxx>
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include "com/sun/star/beans/XPropertySet.hpp"
+
+#include "comphelper/documentconstants.hxx"
+#include <tools/debug.hxx>
+#include "rtl/uri.hxx"
+
+using namespace ::com::sun::star::uno;
+//using namespace ::com::sun::star;
+namespace css = ::com::sun::star;
+using rtl::OUString;
+
+
+namespace
+{
+::rtl::OUString getElement(::rtl::OUString const & version, ::sal_Int32 * index)
+{
+ while (*index < version.getLength() && version[*index] == '0') {
+ ++*index;
+ }
+ return version.getToken(0, '.', *index);
+}
+
+
+
+// Return 1 if version1 is greater then version 2, 0 if they are equal
+//and -1 if version1 is less version 2
+int compareVersions(
+ ::rtl::OUString const & version1, ::rtl::OUString const & version2)
+{
+ for (::sal_Int32 i1 = 0, i2 = 0; i1 >= 0 || i2 >= 0;) {
+ ::rtl::OUString e1(getElement(version1, &i1));
+ ::rtl::OUString e2(getElement(version2, &i2));
+ if (e1.getLength() < e2.getLength()) {
+ return -1;
+ } else if (e1.getLength() > e2.getLength()) {
+ return 1;
+ } else if (e1 < e2) {
+ return -1;
+ } else if (e1 > e2) {
+ return 1;
+ }
+ }
+ return 0;
+}
+}
+//If the OOo 3.0 mode is used then we exclude
+//'mimetype' and all content of 'META-INF'.
+//If the argument 'bSigning' is true then the element list is created for a signing
+//operation in which case we use the latest signing algorithm. That is all elements
+//we find in the zip storage are added to the list. We do not support the old signatures
+//which did not contain all files.
+//If 'bSigning' is false, then we validate. If the user enabled validating according to OOo 3.0
+//then mimetype and all content of META-INF must be excluded.
+void ImplFillElementList(
+ std::vector< rtl::OUString >& rList, const Reference < css::embed::XStorage >& rxStore,
+ const ::rtl::OUString rRootStorageName, const bool bRecursive,
+ const DocumentSignatureAlgorithm mode)
+{
+ ::rtl::OUString aMetaInfName( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) );
+ ::rtl::OUString sMimeTypeName (RTL_CONSTASCII_USTRINGPARAM("mimetype"));
+ ::rtl::OUString aSep( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+
+ Reference < css::container::XNameAccess > xElements( rxStore, UNO_QUERY );
+ Sequence< ::rtl::OUString > aElements = xElements->getElementNames();
+ sal_Int32 nElements = aElements.getLength();
+ const ::rtl::OUString* pNames = aElements.getConstArray();
+
+ for ( sal_Int32 n = 0; n < nElements; n++ )
+ {
+ if (mode != OOo3_2Document
+ && (pNames[n] == aMetaInfName
+ || pNames[n] == sMimeTypeName))
+ {
+ continue;
+ }
+ else
+ {
+ ::rtl::OUString sEncName = ::rtl::Uri::encode(
+ pNames[n], rtl_UriCharClassRelSegment,
+ rtl_UriEncodeStrict, RTL_TEXTENCODING_UTF8);
+ if (sEncName.getLength() == 0 && pNames[n].getLength() != 0)
+ throw css::uno::Exception(::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Failed to encode element name of XStorage")), 0);
+
+ if ( rxStore->isStreamElement( pNames[n] ) )
+ {
+ //Exclude documentsignatures.xml!
+ if (pNames[n].equals(
+ DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName()))
+ continue;
+ ::rtl::OUString aFullName( rRootStorageName + sEncName );
+ rList.push_back(aFullName);
+ }
+ else if ( bRecursive && rxStore->isStorageElement( pNames[n] ) )
+ {
+ Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( pNames[n], css::embed::ElementModes::READ );
+ rtl::OUString aFullRootName( rRootStorageName + sEncName + aSep );
+ ImplFillElementList(rList, xSubStore, aFullRootName, bRecursive, mode);
+ }
+ }
+ }
+}
+
+
+bool DocumentSignatureHelper::isODFPre_1_2(const ::rtl::OUString & sVersion)
+{
+ //The property version exists only if the document is at least version 1.2
+ //That is, if the document has version 1.1 and sVersion is empty.
+ //The constant is defined in comphelper/documentconstants.hxx
+ if (compareVersions(sVersion, ODFVER_012_TEXT) == -1)
+ return true;
+ return false;
+}
+
+bool DocumentSignatureHelper::isOOo3_2_Signature(const SignatureInformation & sigInfo)
+{
+ ::rtl::OUString sManifestURI(RTL_CONSTASCII_USTRINGPARAM("META-INF/manifest.xml"));
+ bool bOOo3_2 = false;
+ typedef ::std::vector< SignatureReferenceInformation >::const_iterator CIT;
+ for (CIT i = sigInfo.vSignatureReferenceInfors.begin();
+ i < sigInfo.vSignatureReferenceInfors.end(); i++)
+ {
+ if (i->ouURI.equals(sManifestURI))
+ {
+ bOOo3_2 = true;
+ break;
+ }
+ }
+ return bOOo3_2;
+}
+
+DocumentSignatureAlgorithm
+DocumentSignatureHelper::getDocumentAlgorithm(
+ const ::rtl::OUString & sODFVersion, const SignatureInformation & sigInfo)
+{
+ OSL_ASSERT(sODFVersion.getLength());
+ DocumentSignatureAlgorithm mode = OOo3_2Document;
+ if (!isOOo3_2_Signature(sigInfo))
+ {
+ if (isODFPre_1_2(sODFVersion))
+ mode = OOo2Document;
+ else
+ mode = OOo3_0Document;
+ }
+ return mode;
+}
+
+//The function creates a list of files which are to be signed or for which
+//the signature is to be validated. The strings are UTF8 encoded URIs which
+//contain '/' as path separators.
+//
+//The algorithm how document signatures are created and validated has
+//changed over time. The change affects only which files within the document
+//are changed. Document signatures created by OOo 2.x only used particular files. Since
+//OOo 3.0 everything except "mimetype" and "META-INF" are signed. As of OOo 3.2 everything
+//except META-INF/documentsignatures.xml is signed.
+//Signatures are validated according to the algorithm which was then used for validation.
+//That is, when validating a signature which was created by OOo 3.0, then mimetype and
+//META-INF are not used.
+//
+//When a signature is created then we always use the latest algorithm. That is, we use
+//that of OOo 3.2
+std::vector< rtl::OUString >
+DocumentSignatureHelper::CreateElementList(
+ const Reference < css::embed::XStorage >& rxStore,
+ const ::rtl::OUString /*rRootStorageName*/, DocumentSignatureMode eMode,
+ const DocumentSignatureAlgorithm mode)
+{
+ std::vector< rtl::OUString > aElements;
+ ::rtl::OUString aSep( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+
+ switch ( eMode )
+ {
+ case SignatureModeDocumentContent:
+ {
+ if (mode == OOo2Document) //that is, ODF 1.0, 1.1
+ {
+ // 1) Main content
+ ImplFillElementList(aElements, rxStore, ::rtl::OUString(), false, mode);
+
+ // 2) Pictures...
+ rtl::OUString aSubStorageName( rtl::OUString::createFromAscii( "Pictures" ) );
+ try
+ {
+ Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
+ ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ }
+ catch(css::io::IOException& )
+ {
+ ; // Doesn't have to exist...
+ }
+ // 3) OLE....
+ aSubStorageName = rtl::OUString::createFromAscii( "ObjectReplacements" );
+ try
+ {
+ Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
+ ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ xSubStore.clear();
+
+ // Object folders...
+ rtl::OUString aMatchStr( rtl::OUString::createFromAscii( "Object " ) );
+ Reference < css::container::XNameAccess > xElements( rxStore, UNO_QUERY );
+ Sequence< ::rtl::OUString > aElementNames = xElements->getElementNames();
+ sal_Int32 nElements = aElementNames.getLength();
+ const ::rtl::OUString* pNames = aElementNames.getConstArray();
+ for ( sal_Int32 n = 0; n < nElements; n++ )
+ {
+ if ( ( pNames[n].match( aMatchStr ) ) && rxStore->isStorageElement( pNames[n] ) )
+ {
+ Reference < css::embed::XStorage > xTmpSubStore = rxStore->openStorageElement( pNames[n], css::embed::ElementModes::READ );
+ ImplFillElementList(aElements, xTmpSubStore, pNames[n]+aSep, true, mode);
+ }
+ }
+ }
+ catch( com::sun::star::io::IOException& )
+ {
+ ; // Doesn't have to exist...
+ }
+ }
+ else
+ {
+ // Everything except META-INF
+ ImplFillElementList(aElements, rxStore, ::rtl::OUString(), true, mode);
+ }
+ }
+ break;
+ case SignatureModeMacros:
+ {
+ // 1) Macros
+ rtl::OUString aSubStorageName( rtl::OUString::createFromAscii( "Basic" ) );
+ try
+ {
+ Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
+ ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ }
+ catch( com::sun::star::io::IOException& )
+ {
+ ; // Doesn't have to exist...
+ }
+
+ // 2) Dialogs
+ aSubStorageName = rtl::OUString::createFromAscii( "Dialogs") ;
+ try
+ {
+ Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
+ ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ }
+ catch( com::sun::star::io::IOException& )
+ {
+ ; // Doesn't have to exist...
+ }
+ // 3) Scripts
+ aSubStorageName = rtl::OUString::createFromAscii( "Scripts") ;
+ try
+ {
+ Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, css::embed::ElementModes::READ );
+ ImplFillElementList(aElements, xSubStore, aSubStorageName+aSep, true, mode);
+ }
+ catch( css::io::IOException& )
+ {
+ ; // Doesn't have to exist...
+ }
+ }
+ break;
+ case SignatureModePackage:
+ {
+ // Everything except META-INF
+ ImplFillElementList(aElements, rxStore, ::rtl::OUString(), true, mode);
+ }
+ break;
+ }
+
+ return aElements;
+}
+
+SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream(
+ const Reference < css::embed::XStorage >& rxStore, sal_Int32 nOpenMode, DocumentSignatureMode eDocSigMode )
+{
+ sal_Int32 nSubStorageOpenMode = css::embed::ElementModes::READ;
+ if ( nOpenMode & css::embed::ElementModes::WRITE )
+ nSubStorageOpenMode = css::embed::ElementModes::WRITE;
+
+ SignatureStreamHelper aHelper;
+
+ try
+ {
+ ::rtl::OUString aSIGStoreName( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) );
+ aHelper.xSignatureStorage = rxStore->openStorageElement( aSIGStoreName, nSubStorageOpenMode );
+ if ( aHelper.xSignatureStorage.is() )
+ {
+ ::rtl::OUString aSIGStreamName;
+ if ( eDocSigMode == SignatureModeDocumentContent )
+ aSIGStreamName = DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName();
+ else if ( eDocSigMode == SignatureModeMacros )
+ aSIGStreamName = DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName();
+ else
+ aSIGStreamName = DocumentSignatureHelper::GetPackageSignatureDefaultStreamName();
+
+ aHelper.xSignatureStream = aHelper.xSignatureStorage->openStreamElement( aSIGStreamName, nOpenMode );
+ }
+ }
+ catch(css::io::IOException& )
+ {
+ // Doesn't have to exist...
+ DBG_ASSERT( nOpenMode == css::embed::ElementModes::READ, "Error creating signature stream..." );
+ }
+
+ return aHelper;
+}
+
+//sElementList contains all files which are expected to be signed. Only those files must me signed,
+//no more, no less.
+//The DocumentSignatureAlgorithm indicates if the document was created with OOo 2.x. Then
+//the uri s in the Reference elements in the signature, were not properly encoded.
+// For example: <Reference URI="ObjectReplacements/Object 1">
+bool DocumentSignatureHelper::checkIfAllFilesAreSigned(
+ const ::std::vector< ::rtl::OUString > & sElementList,
+ const SignatureInformation & sigInfo,
+ const DocumentSignatureAlgorithm alg)
+{
+ // Can only be valid if ALL streams are signed, which means real stream count == signed stream count
+ unsigned int nRealCount = 0;
+ for ( int i = sigInfo.vSignatureReferenceInfors.size(); i; )
+ {
+ const SignatureReferenceInformation& rInf = sigInfo.vSignatureReferenceInfors[--i];
+ // There is also an extra entry of type TYPE_SAMEDOCUMENT_REFERENCE because of signature date.
+ if ( ( rInf.nType == TYPE_BINARYSTREAM_REFERENCE ) || ( rInf.nType == TYPE_XMLSTREAM_REFERENCE ) )
+ {
+ ::rtl::OUString sReferenceURI = rInf.ouURI;
+ if (alg == OOo2Document)
+ {
+ //Comparing URIs is a difficult. Therefore we kind of normalize
+ //it before comparing. We assume that our URI do not have a leading "./"
+ //and fragments at the end (...#...)
+ sReferenceURI = ::rtl::Uri::encode(
+ sReferenceURI, rtl_UriCharClassPchar,
+ rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8);
+ }
+
+ //find the file in the element list
+ typedef ::std::vector< ::rtl::OUString >::const_iterator CIT;
+ for (CIT aIter = sElementList.begin(); aIter < sElementList.end(); aIter++)
+ {
+ ::rtl::OUString sElementListURI = *aIter;
+ if (alg == OOo2Document)
+ {
+ sElementListURI =
+ ::rtl::Uri::encode(
+ sElementListURI, rtl_UriCharClassPchar,
+ rtl_UriEncodeCheckEscapes, RTL_TEXTENCODING_UTF8);
+ }
+ if (sElementListURI.equals(sReferenceURI))
+ {
+ nRealCount++;
+ break;
+ }
+ }
+ }
+ }
+ return sElementList.size() == nRealCount;
+}
+
+/*Compares the Uri which are obtained from CreateElementList with
+ the path obtained from the manifest.xml.
+ Returns true if both strings are equal.
+*/
+bool DocumentSignatureHelper::equalsReferenceUriManifestPath(
+ const OUString & rUri, const OUString & rPath)
{
- for (::sal_Int32 i1 = 0, i2 = 0; i1 >= 0 || i2 >= 0;) {
- ::rtl::OUString e1(getElement(version1, &i1));
- ::rtl::OUString e2(getElement(version2, &i2));
- if (e1.getLength() < e2.getLength()) {
- return -1;
- } else if (e1.getLength() > e2.getLength()) {
- return 1;
- } else if (e1 < e2) {
- return -1;
- } else if (e1 > e2) {
- return 1;
- }
- }
- return 0;
-}
-}
-
-void ImplFillElementList( std::vector< rtl::OUString >& rList, const uno::Reference < embed::XStorage >& rxStore, const ::rtl::OUString rRootStorageName, bool bRecursive )
-{
- ::rtl::OUString aMetaInfName( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) );
- ::rtl::OUString aSep( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
-
- uno::Reference < container::XNameAccess > xElements( rxStore, uno::UNO_QUERY );
- uno::Sequence< ::rtl::OUString > aElements = xElements->getElementNames();
- sal_Int32 nElements = aElements.getLength();
- const ::rtl::OUString* pNames = aElements.getConstArray();
- for ( sal_Int32 n = 0; n < nElements; n++ )
- {
- if ( pNames[n] != aMetaInfName )
- {
- ::rtl::OUString sEncName = ::rtl::Uri::encode(
- pNames[n], rtl_UriCharClassRelSegment,
- rtl_UriEncodeStrict, RTL_TEXTENCODING_UTF8);
- if (sEncName.getLength() == 0 && pNames[n].getLength() != 0)
- throw css::uno::Exception(::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("Failed to encode element name of XStorage")), 0);
-
- if ( rxStore->isStreamElement( pNames[n] ) )
- {
- ::rtl::OUString aFullName( rRootStorageName + sEncName );
- rList.push_back(aFullName);
- }
- else if ( bRecursive && rxStore->isStorageElement( pNames[n] ) )
- {
- uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( pNames[n], embed::ElementModes::READ );
- rtl::OUString aFullRootName( rRootStorageName + sEncName + aSep );
- ImplFillElementList( rList, xSubStore, aFullRootName, bRecursive );
- }
- }
- }
-}
-
-
-bool DocumentSignatureHelper::isODFPre_1_2(const uno::Reference < embed::XStorage >& rxStore)
-{
- ::rtl::OUString sVersion;
- uno::Reference< beans::XPropertySet > xProps(rxStore, uno::UNO_QUERY_THROW );
- xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= sVersion;
- //The property version exists only if the document is at least version 1.2
- //The constant is defined in comphelper/documentconstants.hxx
- if (compareVersions(sVersion, ODFVER_012_TEXT) == -1)
- return true;
- return false;
-}
-
+ bool retVal = false;
+ //split up the uri and path into segments. Both are separated by '/'
+ std::vector<OUString> vUriSegments;
+ sal_Int32 nIndex = 0;
+ do
+ {
+ OUString aToken = rUri.getToken( 0, '/', nIndex );
+ vUriSegments.push_back(aToken);
+ }
+ while (nIndex >= 0);
+
+ std::vector<OUString> vPathSegments;
+ nIndex = 0;
+ do
+ {
+ OUString aToken = rPath.getToken( 0, '/', nIndex );
+ vPathSegments.push_back(aToken);
+ }
+ while (nIndex >= 0);
+
+ //Now compare each segment of the uri with its counterpart from the path
+ if (vUriSegments.size() == vPathSegments.size())
+ {
+ retVal = true;
+ typedef std::vector<OUString>::const_iterator CIT;
+ for (CIT i = vUriSegments.begin(), j = vPathSegments.begin();
+ i != vUriSegments.end(); i++, j++)
+ {
+ //Decode the uri segment, so that %20 becomes ' ', etc.
+ OUString sDecUri = ::rtl::Uri::decode(
+ *i, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8);
+ if (!sDecUri.equals(*j))
+ {
+ retVal = false;
+ break;
+ }
+ }
+ }
-std::vector< rtl::OUString > DocumentSignatureHelper::CreateElementList( const uno::Reference < embed::XStorage >& rxStore, const ::rtl::OUString /*rRootStorageName*/, DocumentSignatureMode eMode )
-{
- std::vector< rtl::OUString > aElements;
- ::rtl::OUString aSep( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
-
- bool bPre1_2 = isODFPre_1_2(rxStore);
-
- switch ( eMode )
- {
- case SignatureModeDocumentContent:
- {
- if (bPre1_2)
- {
- // 1) Main content
- ImplFillElementList( aElements, rxStore, ::rtl::OUString(), false );
-
- // 2) Pictures...
- rtl::OUString aSubStorageName( rtl::OUString::createFromAscii( "Pictures" ) );
- try
- {
- uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, embed::ElementModes::READ );
- ImplFillElementList( aElements, xSubStore, aSubStorageName+aSep, true );
- }
- catch( com::sun::star::io::IOException& )
- {
- ; // Doesn't have to exist...
- }
- // 3) OLE....
- aSubStorageName = rtl::OUString::createFromAscii( "ObjectReplacements" );
- try
- {
- uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, embed::ElementModes::READ );
- ImplFillElementList( aElements, xSubStore, aSubStorageName+aSep, true );
- xSubStore.clear();
-
- // Object folders...
- rtl::OUString aMatchStr( rtl::OUString::createFromAscii( "Object " ) );
- uno::Reference < container::XNameAccess > xElements( rxStore, uno::UNO_QUERY );
- uno::Sequence< ::rtl::OUString > aElementNames = xElements->getElementNames();
- sal_Int32 nElements = aElementNames.getLength();
- const ::rtl::OUString* pNames = aElementNames.getConstArray();
- for ( sal_Int32 n = 0; n < nElements; n++ )
- {
- if ( ( pNames[n].match( aMatchStr ) ) && rxStore->isStorageElement( pNames[n] ) )
- {
- uno::Reference < embed::XStorage > xTmpSubStore = rxStore->openStorageElement( pNames[n], embed::ElementModes::READ );
- ImplFillElementList( aElements, xTmpSubStore, pNames[n]+aSep, true );
- }
- }
- }
- catch( com::sun::star::io::IOException& )
- {
- ; // Doesn't have to exist...
- }
- }
- else
- {
- // Everything except META-INF
- ImplFillElementList( aElements, rxStore, ::rtl::OUString(), true );
- }
- }
- break;
- case SignatureModeMacros:
- {
- // 1) Macros
- rtl::OUString aSubStorageName( rtl::OUString::createFromAscii( "Basic" ) );
- try
- {
- uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, embed::ElementModes::READ );
- ImplFillElementList( aElements, xSubStore, aSubStorageName+aSep, true );
- }
- catch( com::sun::star::io::IOException& )
- {
- ; // Doesn't have to exist...
- }
-
- // 2) Dialogs
- aSubStorageName = rtl::OUString::createFromAscii( "Dialogs") ;
- try
- {
- uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, embed::ElementModes::READ );
- ImplFillElementList( aElements, xSubStore, aSubStorageName+aSep, true );
- }
- catch( com::sun::star::io::IOException& )
- {
- ; // Doesn't have to exist...
- }
- // 3) Scripts
- aSubStorageName = rtl::OUString::createFromAscii( "Scripts") ;
- try
- {
- uno::Reference < embed::XStorage > xSubStore = rxStore->openStorageElement( aSubStorageName, embed::ElementModes::READ );
- ImplFillElementList( aElements, xSubStore, aSubStorageName+aSep, true );
- }
- catch( com::sun::star::io::IOException& )
- {
- ; // Doesn't have to exist...
- }
- }
- break;
- case SignatureModePackage:
- {
- // Everything except META-INF
- ImplFillElementList( aElements, rxStore, ::rtl::OUString(), true );
- }
- break;
- }
-
- return aElements;
-}
-
-SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream( const uno::Reference < embed::XStorage >& rxStore, sal_Int32 nOpenMode, DocumentSignatureMode eDocSigMode )
-{
- sal_Int32 nSubStorageOpenMode = embed::ElementModes::READ;
- if ( nOpenMode & embed::ElementModes::WRITE )
- nSubStorageOpenMode = embed::ElementModes::WRITE;
-
- SignatureStreamHelper aHelper;
-
- try
- {
- ::rtl::OUString aSIGStoreName( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) );
- aHelper.xSignatureStorage = rxStore->openStorageElement( aSIGStoreName, nSubStorageOpenMode );
- if ( aHelper.xSignatureStorage.is() )
- {
- ::rtl::OUString aSIGStreamName;
- if ( eDocSigMode == SignatureModeDocumentContent )
- aSIGStreamName = DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName();
- else if ( eDocSigMode == SignatureModeMacros )
- aSIGStreamName = DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName();
- else
- aSIGStreamName = DocumentSignatureHelper::GetPackageSignatureDefaultStreamName();
-
- aHelper.xSignatureStream = aHelper.xSignatureStorage->openStreamElement( aSIGStreamName, nOpenMode );
- }
- }
- catch( com::sun::star::io::IOException& )
- {
- // Doesn't have to exist...
- DBG_ASSERT( nOpenMode == embed::ElementModes::READ, "Error creating signature stream..." );
- }
-
- return aHelper;
-}
-
-::rtl::OUString DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName()
-{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "documentsignatures.xml" ) );
-}
-
-::rtl::OUString DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName()
-{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "macrosignatures.xml" ) );
-}
-
-::rtl::OUString DocumentSignatureHelper::GetPackageSignatureDefaultStreamName()
-{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "packagesignatures.xml" ) );
+ return retVal;
}
+
+::rtl::OUString DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "documentsignatures.xml" ) );
+}
+
+::rtl::OUString DocumentSignatureHelper::GetScriptingContentSignatureDefaultStreamName()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "macrosignatures.xml" ) );
+}
+
+::rtl::OUString DocumentSignatureHelper::GetPackageSignatureDefaultStreamName()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "packagesignatures.xml" ) );
+}
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index 8ef7c21dd39b..a5890544be00 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -64,6 +64,7 @@
#define NS_DOCUMENTSIGNATURES_ODF_1_2 "urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0"
using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
XMLSignatureHelper::XMLSignatureHelper( const uno::Reference< uno::XComponentContext >& rxCtx)
: mxCtx(rxCtx), mbODFPre1_2(false)
@@ -110,12 +111,14 @@ com::sun::star::uno::Reference< com::sun::star::xml::crypto::XUriBinding > XMLSi
return mxUriBinding;
}
-void XMLSignatureHelper::SetStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rxStorage )
+void XMLSignatureHelper::SetStorage(
+ const Reference < css::embed::XStorage >& rxStorage,
+ ::rtl::OUString sODFVersion)
{
DBG_ASSERT( !mxUriBinding.is(), "SetStorage - UriBinding already set!" );
mxUriBinding = new UriBindingHelper( rxStorage );
DBG_ASSERT(rxStorage.is(), "SetStorage - empty storage!");
- mbODFPre1_2 = DocumentSignatureHelper::isODFPre_1_2(rxStorage);
+ mbODFPre1_2 = DocumentSignatureHelper::isODFPre_1_2(sODFVersion);
}
@@ -194,6 +197,7 @@ void XMLSignatureHelper::AddForSigning( sal_Int32 nSecurityId, const rtl::OUStri
mpXSecController->signAStream( nSecurityId, uri, objectURL, bBinary );
}
+
uno::Reference<xml::sax::XDocumentHandler> XMLSignatureHelper::CreateDocumentHandlerWithHeader(
const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream )
{
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
index 24738c0b6e98..9baa6d7061c4 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
@@ -204,42 +204,17 @@ uno::Reference < io::XInputStream > UriBindingHelper::OpenInputStream( const uno
{
// Cloning because of I can't keep all storage references open
// MBA with think about a better API...
- sal_Bool bEncrypted = sal_False;
-
const ::rtl::OUString sName = ::rtl::Uri::decode(
rURI, rtl_UriDecodeStrict, rtl_UriCharClassRelSegment);
if (sName.getLength() == 0 && rURI.getLength() != 0)
throw uno::Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"Could not decode URI for stream element.")), 0);
- try
- {
- uno::Reference< io::XStream > xStream;
- xStream = rxStore->cloneStreamElement( sName );
- if ( !xStream.is() )
- throw uno::RuntimeException();
-
- try {
- uno::Reference< beans::XPropertySet > xProps( xStream, uno::UNO_QUERY_THROW );
- xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsEncrypted" ) ) ) >>= bEncrypted;
- } catch( uno::Exception )
- {}
-
- if ( !bEncrypted )
- xInStream = xStream->getInputStream();
- }
- catch ( packages::WrongPasswordException& )
- {
- bEncrypted = sal_True;
- }
- if ( bEncrypted )
- {
- // this is an encrypted stream that should be handled accordingly
- uno::Reference< embed::XStorageRawAccess > xRawStore( rxStore, uno::UNO_QUERY );
- OSL_ENSURE( xRawStore.is(), "Strange storage implementation is used for signing!\n" );
- if ( xRawStore.is() )
- xInStream = xRawStore->getPlainRawStreamElement( sName );
- }
+ uno::Reference< io::XStream > xStream;
+ xStream = rxStore->cloneStreamElement( sName );
+ if ( !xStream.is() )
+ throw uno::RuntimeException();
+ xInStream = xStream->getInputStream();
}
else
{
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index c6c71c01a677..1b35d2b968bc 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -882,7 +882,33 @@ Reference< XCertificate > SecurityEnvironment_MSCryptImpl :: createCertificateFr
return createCertificateFromRaw( rawCert ) ;
}
-sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& aCert ) throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException ) {
+
+HCERTSTORE getCertStoreForIntermediatCerts(
+ const Sequence< Reference< ::com::sun::star::security::XCertificate > >& seqCerts)
+{
+ HCERTSTORE store = NULL;
+ store = CertOpenStore(
+ CERT_STORE_PROV_MEMORY, 0, NULL, 0, NULL);
+ if (store == NULL)
+ return NULL;
+
+ for (int i = 0; i < seqCerts.getLength(); i++)
+ {
+ Sequence<sal_Int8> data = seqCerts[i]->getEncoded();
+ PCCERT_CONTEXT cert = CertCreateCertificateContext(
+ X509_ASN_ENCODING, ( const BYTE* )&data[0], data.getLength());
+ //Adding the certificate creates a copy and not just increases the ref count
+ //Therefore we free later the certificate that we now add
+ CertAddCertificateContextToStore(store, cert, CERT_STORE_ADD_ALWAYS, NULL);
+ CertFreeCertificateContext(cert);
+ }
+ return store;
+}
+sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate(
+ const Reference< ::com::sun::star::security::XCertificate >& aCert,
+ const Sequence< Reference< ::com::sun::star::security::XCertificate > >& seqCerts)
+ throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException )
+{
sal_Int32 validity = 0;
PCCERT_CHAIN_CONTEXT pChainContext = NULL;
PCCERT_CONTEXT pCertContext = NULL;
@@ -913,52 +939,50 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate( const ::com::sun
chainPara.cbSize = sizeof( CERT_CHAIN_PARA ) ;
chainPara.RequestedUsage = certUsage ;
+
+ HCERTSTORE hCollectionStore = NULL;
+ HCERTSTORE hIntermediateCertsStore = NULL;
BOOL bChain = FALSE;
if( pCertContext != NULL )
{
- HCERTSTORE hAdditionalStore = NULL;
- HCERTSTORE hCollectionStore = NULL;
- if (m_hCertStore && m_hKeyStore)
+ hIntermediateCertsStore =
+ getCertStoreForIntermediatCerts(seqCerts);
+
+ //Merge m_hCertStore and m_hKeyStore and the store of the intermediate
+ //certificates into one store.
+ hCollectionStore = CertOpenStore(
+ CERT_STORE_PROV_COLLECTION ,
+ 0 ,
+ NULL ,
+ 0 ,
+ NULL
+ ) ;
+ if (hCollectionStore != NULL)
{
- //Merge m_hCertStore and m_hKeyStore into one store.
- hCollectionStore = CertOpenStore(
- CERT_STORE_PROV_COLLECTION ,
- 0 ,
- NULL ,
- 0 ,
- NULL
- ) ;
- if (hCollectionStore != NULL)
- {
- CertAddStoreToCollection (
- hCollectionStore ,
- m_hCertStore ,
- CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG ,
- 0) ;
- CertAddStoreToCollection (
- hCollectionStore ,
- m_hCertStore ,
- CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG ,
- 0) ;
- hAdditionalStore = hCollectionStore;
- }
+ CertAddStoreToCollection (
+ hCollectionStore ,
+ m_hCertStore ,
+ CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG ,
+ 0) ;
+ CertAddStoreToCollection (
+ hCollectionStore ,
+ m_hCertStore ,
+ CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG ,
+ 0) ;
+ CertAddStoreToCollection (
+ hCollectionStore,
+ hIntermediateCertsStore,
+ CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG,
+ 0);
}
- //if the merge of both stores failed then we add only m_hCertStore
- if (hAdditionalStore == NULL && m_hCertStore)
- hAdditionalStore = m_hCertStore;
- else if (hAdditionalStore == NULL && m_hKeyStore)
- hAdditionalStore = m_hKeyStore;
- else
- hAdditionalStore = NULL;
-
//CertGetCertificateChain searches by default in MY, CA, ROOT and TRUST
bChain = CertGetCertificateChain(
NULL ,
pCertContext ,
NULL , //use current system time
- hAdditionalStore,
+ hCollectionStore,
&chainPara ,
CERT_CHAIN_REVOCATION_CHECK_CHAIN | CERT_CHAIN_TIMESTAMP_TIME ,
NULL ,
@@ -967,8 +991,6 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate( const ::com::sun
if (!bChain)
pChainContext = NULL;
- //Close the additional store
- CertCloseStore(hCollectionStore, CERT_CLOSE_STORE_CHECK_FLAG);
}
if(bChain && pChainContext != NULL )
@@ -1081,6 +1103,12 @@ sal_Int32 SecurityEnvironment_MSCryptImpl :: verifyCertificate( const ::com::sun
if (pChainContext)
CertFreeCertificateChain(pChainContext);
+ //Close the additional store, do not destroy the contained certs
+ CertCloseStore(hCollectionStore, CERT_CLOSE_STORE_CHECK_FLAG);
+ //Close the temporary store containing the intermediate certificates and make
+ //sure all certificates are deleted.
+ CertCloseStore(hIntermediateCertsStore, CERT_CLOSE_STORE_CHECK_FLAG);
+
return validity ;
}
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
index 9770d5c1cba7..f1441184602f 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
@@ -108,7 +108,11 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper4<
virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > SAL_CALL createCertificateFromAscii( const ::rtl::OUString& asciiCertificate ) throw( ::com::sun::star::uno::SecurityException , ::com::sun::star::uno::RuntimeException ) ;
- virtual ::sal_Int32 SAL_CALL verifyCertificate( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert ) throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ;
+ virtual ::sal_Int32 SAL_CALL verifyCertificate(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::security::XCertificate > >& intermediateCertificates)
+ throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ;
virtual ::sal_Int32 SAL_CALL getCertificateCharacters( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert ) throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ;
virtual ::rtl::OUString SAL_CALL getSecurityEnvironmentInformation( ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index 00049d2901fc..41dbd6232bce 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -43,6 +43,7 @@
#include <rtl/locale.h>
#include <osl/nlsupport.h>
#include <osl/process.h>
+#include <utility>
//CP : end
@@ -53,36 +54,130 @@ using ::rtl::OUString ;
using ::com::sun::star::security::XCertificate ;
using ::com::sun::star::util::DateTime ;
-/*
- * mmi : because MS Crypto use the 'S' tag (equal to the 'ST' tag in NSS), but the NSS can't recognise
- * it, so the 'S' tag should be changed to 'ST' tag
- *
- */
-OUString replaceTagSWithTagST(OUString oldDN)
+#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+/*Resturns the index withing rRawString where sTypeName starts and where it ends.
+ The starting index is pair.first. The ending index in pair.second points
+ one char after the last character of the type.
+ sTypeName can be
+ "S" or "CN" (without ""). Do not use spaces at the beginning of the type name.
+ If the type name is not found then pair.first and pair.second are -1.
+*/
+std::pair< sal_Int32, sal_Int32 >
+findTypeInDN(const OUString& rRawString, const OUString& sTypeName)
{
-
- sal_Int32 nIndex = 0;
- OUString newDN;
- do
+ std::pair< sal_Int32, sal_Int32 > retVal;
+ bool bInEscape = false;
+ bool bInValue = false;
+ bool bFound = false;
+ sal_Int32 nTypeNameStart = 0;
+ sal_Int32 length = rRawString.getLength();
+
+ for (sal_Int32 i = 0; i < length; i++)
{
- OUString aToken = oldDN.getToken( 0, ',', nIndex ).trim();
- if (aToken.compareToAscii("S=",2) == 0)
+ sal_Unicode c = rRawString[i];
+
+ if (c == '=')
{
- newDN+=OUString::createFromAscii("ST=");
- newDN+=aToken.copy(2);
+ if (! bInValue)
+ {
+ OUString sType = rRawString.copy(nTypeNameStart, i - nTypeNameStart);
+ sType = sType.trim();
+ if (sType.equalsIgnoreAsciiCase(sTypeName))
+ {
+ bFound = true;
+ break;
+ }
+ }
}
- else
+ else if (c == '"')
{
- newDN+=aToken;
+ if (!bInEscape)
+ {
+ //If this is the quote is the first of the couple which enclose the
+ //whole value, because the value contains special characters
+ //then we just drop it. That is, this character must be followed by
+ //a character which is not '"'.
+ if ( i + 1 < length && rRawString[i+1] == '"')
+ bInEscape = true;
+ else
+ bInValue = !bInValue; //value is enclosed in " "
+ }
+ else
+ {
+ //This quote is escaped by a preceding quote and therefore is
+ //part of the value
+ bInEscape = false;
+ }
}
+ else if (c == ',')
+ {
+ //The comma separate the attribute value pairs.
+ //If the comma is not part of a value (the value would then be enclosed in '"'),
+ //then we have reached the end of the value
+ if (!bInValue)
+ {
+ //The next char is the start of the new type
+ nTypeNameStart = i + 1;
+ }
+ }
+ }
- if (nIndex >= 0)
+ //Found the Type Name, but there can still be spaces after the last comma
+ //and the beginning of the type.
+ if (bFound)
+ {
+ while (true)
+ {
+ sal_Unicode c = rRawString[nTypeNameStart];
+ if (c != ' ' && c != '\t')
+ //found
+ break;
+ nTypeNameStart ++;
+ }
+ // search end (one after last letter)
+ sal_Int32 nTypeNameEnd = nTypeNameStart;
+ nTypeNameEnd++;
+ while (true)
{
- newDN+=OUString::createFromAscii(",");
+ sal_Unicode c = rRawString[nTypeNameEnd];
+ if (c == ' ' || c == '\t' || c == '=')
+ break;
+ nTypeNameEnd++;
}
- } while ( nIndex >= 0 );
+ retVal = std::make_pair(nTypeNameStart, nTypeNameEnd);
+ }
+ else
+ {
+ retVal = std::make_pair(-1, -1);
+ }
+ return retVal;
+}
+
- return newDN;
+/*
+ MS Crypto uses the 'S' tag (equal to the 'ST' tag in NSS), but the NSS can't recognise
+ it, so the 'S' tag should be changed to 'ST' tag. However I am not sure if this is necessary
+ anymore, because we provide always the signers certificate when signing. So libmlsec can find
+ the private key based on the provided certificate (X509Certificate element) and does not need
+ the issuer name (X509IssuerName element). The issuer name in the xml signature has also no
+ effect for the signature nor the certificate validation.
+ In many RFCs, for example 4519, on speaks of 'ST'. However, the certificate does not contain
+ strings for type names. Instead it uses OIDs.
+ */
+
+OUString replaceTagSWithTagST(OUString oldDN)
+{
+ std::pair<sal_Int32, sal_Int32 > pairIndex = findTypeInDN(oldDN, OUSTR("S"));
+
+ if (pairIndex.first != -1)
+ {
+ OUString newDN = oldDN.copy(0, pairIndex.first);
+ newDN += OUSTR("ST");
+ newDN += oldDN.copy(pairIndex.second);
+ return newDN;
+ }
+ return oldDN;
}
/* end */
@@ -159,7 +254,7 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl :: getVersion() throw ( ::com::su
OUString xIssuer(issuer , cbIssuer ,encoding ) ; //By CP
delete issuer ;
- return replaceTagSWithTagST(xIssuer) ;
+ return replaceTagSWithTagST(xIssuer);
} else {
return OUString() ;
}
@@ -208,7 +303,7 @@ sal_Int16 SAL_CALL X509Certificate_MSCryptImpl :: getVersion() throw ( ::com::su
OUString xSubject(subject , cbSubject ,encoding ) ; //By CP
delete subject ;
- return replaceTagSWithTagST(xSubject) ;
+ return replaceTagSWithTagST(xSubject);
} else {
return OUString() ;
}
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index d0e6670fd2ff..90779823eca3 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -28,22 +28,20 @@
*
************************************************************************/
+
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmlsecurity.hxx"
+
+//todo before commit: nssrenam.h is not delivered!!!
+#include "nssrenam.h"
+#include "cert.h"
+#include "secerr.h"
+
#include <sal/config.h>
#include "securityenvironment_nssimpl.hxx"
#include "x509certificate_nssimpl.hxx"
#include <rtl/uuid.h>
-#include "nspr.h"
-#include "nss.h"
-#include "secport.h"
-#include "secitem.h"
-#include "secder.h"
-#include "secerr.h"
-#include "limits.h"
-#include "certt.h"
-#include "prerror.h"
#include <sal/types.h>
//For reasons that escape me, this is what xmlsec does when size_t is not 4
@@ -60,11 +58,11 @@
#include <rtl/ustrbuf.hxx>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/servicefactory.hxx>
-#include <svtools/docpasswdrequest.hxx>
+#include <comphelper/docpasswordrequest.hxx>
#include <xmlsecurity/biginteger.hxx>
#include <rtl/logfile.h>
#include <com/sun/star/task/XInteractionHandler.hpp>
-
+#include <vector>
#include "boost/scoped_array.hpp"
// MM : added for password exception
@@ -84,6 +82,7 @@ using ::com::sun::star::security::XCertificate ;
extern X509Certificate_NssImpl* NssCertToXCert( CERTCertificate* cert ) ;
extern X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* ) ;
+
char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ )
{
uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
@@ -95,7 +94,8 @@ char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ )
if ( xInteractionHandler.is() )
{
task::PasswordRequestMode eMode = bRetry ? task::PasswordRequestMode_PASSWORD_REENTER : task::PasswordRequestMode_PASSWORD_ENTER;
- RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword( eMode, ::rtl::OUString::createFromAscii(PK11_GetTokenName(pSlot)) );
+ ::comphelper::DocPasswordRequest* pPasswordRequest = new ::comphelper::DocPasswordRequest(
+ ::comphelper::DocPasswordRequestType_STANDARD, eMode, ::rtl::OUString::createFromAscii(PK11_GetTokenName(pSlot)) );
uno::Reference< task::XInteractionRequest > xRequest( pPasswordRequest );
xInteractionHandler->handle( xRequest );
@@ -748,17 +748,23 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromAs
return createCertificateFromRaw( rawCert ) ;
}
-sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& aCert ) throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException ) {
+sal_Int32 SecurityEnvironment_NssImpl ::
+verifyCertificate( const Reference< csss::XCertificate >& aCert,
+ const Sequence< Reference< csss::XCertificate > >& intermediateCerts )
+ throw( ::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException )
+{
sal_Int32 validity = 0;
const X509Certificate_NssImpl* xcert ;
const CERTCertificate* cert ;
-
+ ::std::vector<CERTCertificate*> vecTmpNSSCertificates;
Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY ) ;
if( !xCertTunnel.is() ) {
throw RuntimeException() ;
}
-
+ OSL_TRACE("[xmlsecurity] Start verification of certificate: %s",
+ OUStringToOString(
+ aCert->getIssuerName(), osl_getThreadTextEncoding()).getStr());
xcert = reinterpret_cast<X509Certificate_NssImpl*>(
@@ -769,7 +775,38 @@ sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::st
cert = xcert->getNssCert() ;
if( cert != NULL )
+ {
+
+ //prepare the intermediate certificates
+ CERTCertDBHandle * certDb = m_pHandler != NULL ? m_pHandler : CERT_GetDefaultCertDB();
+ for (sal_Int32 i = 0; i < intermediateCerts.getLength(); i++)
{
+ Sequence<sal_Int8> der = intermediateCerts[i]->getEncoded();
+ SECItem item;
+ item.type = siBuffer;
+ item.data = (unsigned char*)der.getArray();
+ item.len = der.getLength();
+
+ CERTCertificate* certTmp = CERT_NewTempCertificate(certDb, &item,
+ NULL /* nickname */,
+ PR_FALSE /* isPerm */,
+ PR_TRUE /* copyDER */);
+ if (!certTmp)
+ {
+ OSL_TRACE("[xmlsecurity] Failed to add a temporary certificate: %s",
+ OUStringToOString(intermediateCerts[i]->getIssuerName(),
+ osl_getThreadTextEncoding()).getStr());
+
+ }
+ else
+ {
+ OSL_TRACE("[xmlsecurity] Added temporary certificate: %s",
+ certTmp->subjectName ? certTmp->subjectName : "");
+ vecTmpNSSCertificates.push_back(certTmp);
+ }
+ }
+
+
int64 timeboundary ;
SECStatus status ;
@@ -779,15 +816,15 @@ sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::st
// create log
- CERTVerifyLog realLog;
+ CERTVerifyLog realLog;
CERTVerifyLog *log;
- log = &realLog;
+ log = &realLog;
- log->count = 0;
- log->head = NULL;
- log->tail = NULL;
+ log->count = 0;
+ log->head = NULL;
+ log->tail = NULL;
log->arena = PORT_NewArena( DER_DEFAULT_CHUNKSIZE );
//CERTVerifyLog *log;
@@ -798,11 +835,6 @@ sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::st
//log->arena = arena;
validity = csss::CertificateValidity::INVALID;
- CERTCertificateList * certList;
-
- certList = CERT_CertChainFromCert( (CERTCertificateStr *) cert, (SECCertUsage) 0, 0);
-
-
if( m_pHandler != NULL )
{
//JL: We must not pass a particular usage in the requiredUsages argument (the 4th) because,
@@ -894,9 +926,23 @@ sal_Int32 SecurityEnvironment_NssImpl :: verifyCertificate( const ::com::sun::st
}
else
{
+
validity = ::com::sun::star::security::CertificateValidity::INVALID ;
}
+ //Destroying the temporary certificates
+ std::vector<CERTCertificate*>::const_iterator cert_i;
+ for (cert_i = vecTmpNSSCertificates.begin(); cert_i != vecTmpNSSCertificates.end(); cert_i++)
+ {
+ OSL_TRACE("[xmlsecurity] Destroying temporary certificate");
+ CERT_DestroyCertificate(*cert_i);
+ }
+#if OSL_DEBUG_LEVEL > 1
+ if (validity == ::com::sun::star::security::CertificateValidity::VALID)
+ OSL_TRACE("[xmlsecurity] Certificate is valid.");
+ else
+ OSL_TRACE("[xmlsecurity] Certificate is invalid.");
+#endif
return validity ;
}
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
index bfa9295e50fe..d6586794bea5 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
@@ -115,7 +115,13 @@ private :
static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ) ;
- virtual ::sal_Int32 SAL_CALL verifyCertificate( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert ) throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ;
+ virtual ::sal_Int32 SAL_CALL verifyCertificate(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::security::XCertificate >& xCert,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > > &
+ intermediateCerts)
+ throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ;
virtual ::sal_Int32 SAL_CALL getCertificateCharacters( const ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate >& xCert ) throw (::com::sun::star::uno::SecurityException, ::com::sun::star::uno::RuntimeException) ;
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
index 5a3c80dfb162..3255a2d5bf58 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
@@ -54,7 +54,12 @@
#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>
@@ -64,18 +69,10 @@
#include <com/sun/star/mozilla/XMozillaBootstrap.hpp>
#include "nspr.h"
-#include "prtypes.h"
-#include "pk11func.h"
-#ifdef SYSTEM_MOZILLA
-#include "nssrenam.h"
-#include "secmod.h"
-#endif
#include "cert.h"
-#include "cryptohi.h"
-#include "certdb.h"
#include "nss.h"
-#include "prerror.h"
-
+#include "secmod.h"
+#include "nssckbi.h"
namespace cssu = com::sun::star::uno;
@@ -83,49 +80,234 @@ namespace cssl = com::sun::star::lang;
namespace cssxc = com::sun::star::xml::crypto;
using namespace com::sun::star;
+using ::rtl::OUString;
+using ::rtl::OString;
#define 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"
-bool nsscrypto_initialize( const char* token ) {
- static char initialized = 0 ;
- //PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1 ) ;
- if( !initialized ) {
- PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ;
+#define ROOT_CERTS "Root Certs for OpenOffice.org"
+
+
+extern "C" void nsscrypto_finalize();
+
+
+namespace
+{
- if( NSS_InitReadWrite( token ) != SECSuccess )
+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))
{
- char * error = NULL;
+ OSL_TRACE("[xmlsecurity] The root certifificates module \"%s"
+ "\" is already loaded: \n%s",
+ module->commonName, module->dllName);
- PR_GetErrorText(error);
- if (error)
- printf("%s",error);
- return false ;
+ RootsModule = SECMOD_ReferenceModule(module);
+ break;
}
+ }
+ }
+ list = list->next;
+ }
+ SECMOD_ReleaseReadLock(lock);
-#ifdef SYSTEM_MOZILLA
- if (!SECMOD_HasRootCerts())
+ if (RootsModule)
+ {
+ PRInt32 modType;
+ if (SECSuccess == SECMOD_DeleteModule(RootsModule->commonName, &modType))
+ {
+ OSL_TRACE("[xmlsecurity] Deleted module \"%s\".", RootsModule->commonName);
+ }
+ else
{
- SECMOD_AddNewModule("Root Certs", "libnssckbi" SAL_DLLEXTENSION,
- 0, 0);
+ OSL_TRACE("[xmlsecurity] 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;
+
+ OSL_TRACE("[xmlsecurity] Using profile: %s", token);
+
+ PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ;
+
+ if( NSS_InitReadWrite( token ) != SECSuccess )
+ {
+ char * error = NULL;
+
+ PR_GetErrorText(error);
+ if (error)
+ printf("%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)
+ OSL_TRACE("[xmlsecurity] Added new root certificate module "
+ "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
+ else
+ {
+ OSL_TRACE("[xmlsecurity] FAILED to load the new root certificate module "
+ "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
+ return_value = false;
+ }
+ }
+ else
+ {
+ OSL_TRACE("[xmlsecurity] FAILED to add new root certifice module: "
+ "\""ROOT_CERTS"\" contained in \n%s", ospath.getStr());
+ return_value = false;
- initialized = 1 ;
+ }
+ }
+ else
+ {
+ OSL_TRACE("[xmlsecurity] Adding new root certificate module failed.");
+ return_value = false;
+ }
+#if SYSTEM_MOZILLA
}
+#endif
- return true ;
+ return return_value;
}
+
// must be extern "C" because we pass the function pointer to atexit
-extern "C" void nsscrypto_finalize() {
+extern "C" void nsscrypto_finalize()
+{
+ SECMODModule *RootsModule = SECMOD_FindModule(ROOT_CERTS);
+
+ if (RootsModule)
+ {
+
+ if (SECSuccess == SECMOD_UnloadUserModule(RootsModule))
+ {
+ OSL_TRACE("[xmlsecurity] Unloaded module \""ROOT_CERTS"\".");
+ }
+ else
+ {
+ OSL_TRACE("[xmlsecurity] Failed unloadeding module \""ROOT_CERTS"\".");
+ }
+ SECMOD_DestroyModule(RootsModule);
+ }
+ else
+ {
+ OSL_TRACE("[xmlsecurity] 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)
@@ -143,7 +325,7 @@ bool getMozillaCurrentProfile(
else
{
RTL_LOGFILE_TRACE( "getMozillaCurrentProfile: Using MozillaBootstrap..." );
- mozilla::MozillaProductType productTypes[4] = {
+ mozilla::MozillaProductType productTypes[4] = {
mozilla::MozillaProductType_Thunderbird,
mozilla::MozillaProductType_Mozilla,
mozilla::MozillaProductType_Firefox,
@@ -180,6 +362,8 @@ bool getMozillaCurrentProfile(
}
}
+} // namespace
+
SEInitializer_NssImpl::SEInitializer_NssImpl(
const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF)
:mxMSF( rxMSF )
@@ -238,7 +422,7 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
return NULL;
}
----*/
- if( !nsscrypto_initialize( sCertDir.getStr() ) )
+ if( ! *initNSS( sCertDir.getStr() ) )
{
RTL_LOGFILE_TRACE( "XMLSEC: Error - nsscrypto_initialize() failed." );
if ( NSS_NoDB_Init(NULL) != SECSuccess )
@@ -251,8 +435,6 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
RTL_LOGFILE_TRACE( "XMLSEC: NSS_NoDB_Init works, enough for verifying signatures..." );
}
}
- else
- atexit(nsscrypto_finalize );
pCertHandle = CERT_GetDefaultCertDB() ;
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index c457b4fb8a30..d6b5e189330e 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -30,14 +30,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmlsecurity.hxx"
-#include <sal/config.h>
-#include <rtl/uuid.h>
-#include "x509certificate_nssimpl.hxx"
-#ifndef _CERTIFICATEEXTENSION_NSSIMPL_HXX_
-#include "certificateextension_xmlsecimpl.hxx"
-#endif
+
+#include "nssrenam.h"
#include "nspr.h"
#include "nss.h"
#include "secder.h"
@@ -48,6 +44,17 @@
#include "pk11func.h"
//MM : end
+
+
+#include <sal/config.h>
+#include <rtl/uuid.h>
+#include "x509certificate_nssimpl.hxx"
+
+#ifndef _CERTIFICATEEXTENSION_NSSIMPL_HXX_
+#include "certificateextension_xmlsecimpl.hxx"
+#endif
+
+
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::security ;
using ::rtl::OUString ;
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
index 51b2b2fd1d7f..bb16bcc7fb6e 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
@@ -40,9 +40,6 @@
#include "com/sun/star/uno/SecurityException.hpp"
#include <com/sun/star/security/XCertificate.hpp>
-#ifdef SYSTEM_MOZILLA
-#include "nssrenam.h"
-#endif
#include "cert.h"
class X509Certificate_NssImpl : public ::cppu::WeakImplHelper2<
diff --git a/xmlsecurity/util/makefile.mk b/xmlsecurity/util/makefile.mk
index e3f78a45592f..cfc012a78cd2 100644
--- a/xmlsecurity/util/makefile.mk
+++ b/xmlsecurity/util/makefile.mk
@@ -152,7 +152,7 @@ SHL4STDLIBS=\
$(SALLIB) \
$(SVLLIB) \
$(XMLOFFLIB) \
- $(SVXLIB)
+ $(SVXCORELIB)
SHL4VERSIONMAP = xmlsecurity.map
SHL4DEPN=